Lines Matching refs:dsp

46 	adsp_err(_obj->dsp, "%s: " fmt, _obj->name ? _obj->name : "legacy", \
49 adsp_dbg(_obj->dsp, "%s: " fmt, _obj->name ? _obj->name : "legacy", \
150 struct wm_adsp *dsp; member
167 struct wm_adsp *dsp; member
199 static int wm_adsp_buffer_init(struct wm_adsp *dsp);
200 static int wm_adsp_buffer_free(struct wm_adsp *dsp);
317 struct wm_adsp *dsp = snd_soc_component_get_drvdata(component); in wm_adsp_fw_get() local
319 ucontrol->value.enumerated.item[0] = dsp[e->shift_l].fw; in wm_adsp_fw_get()
330 struct wm_adsp *dsp = snd_soc_component_get_drvdata(component); in wm_adsp_fw_put() local
333 if (ucontrol->value.enumerated.item[0] == dsp[e->shift_l].fw) in wm_adsp_fw_put()
339 mutex_lock(&dsp[e->shift_l].cs_dsp.pwr_lock); in wm_adsp_fw_put()
341 if (dsp[e->shift_l].cs_dsp.booted || !list_empty(&dsp[e->shift_l].compr_list)) in wm_adsp_fw_put()
344 dsp[e->shift_l].fw = ucontrol->value.enumerated.item[0]; in wm_adsp_fw_put()
346 mutex_unlock(&dsp[e->shift_l].cs_dsp.pwr_lock); in wm_adsp_fw_put()
403 mutex_lock(&cs_ctl->dsp->pwr_lock); in wm_coeff_put()
405 mutex_unlock(&cs_ctl->dsp->pwr_lock); in wm_coeff_put()
419 mutex_lock(&cs_ctl->dsp->pwr_lock); in wm_coeff_tlv_put()
426 mutex_unlock(&cs_ctl->dsp->pwr_lock); in wm_coeff_tlv_put()
444 mutex_lock(&cs_ctl->dsp->pwr_lock); in wm_coeff_put_acked()
451 mutex_unlock(&cs_ctl->dsp->pwr_lock); in wm_coeff_put_acked()
466 mutex_lock(&cs_ctl->dsp->pwr_lock); in wm_coeff_get()
468 mutex_unlock(&cs_ctl->dsp->pwr_lock); in wm_coeff_get()
482 mutex_lock(&cs_ctl->dsp->pwr_lock); in wm_coeff_tlv_get()
489 mutex_unlock(&cs_ctl->dsp->pwr_lock); in wm_coeff_tlv_get()
540 static int wmfw_add_ctl(struct wm_adsp *dsp, struct wm_coeff_ctl *ctl) in wmfw_add_ctl() argument
574 ret = snd_soc_add_component_controls(dsp->component, kcontrol, 1); in wmfw_add_ctl()
592 struct wm_adsp *dsp = container_of(ctl->cs_ctl->dsp, in wm_adsp_ctl_work() local
596 wmfw_add_ctl(dsp, ctl); in wm_adsp_ctl_work()
601 struct wm_adsp *dsp = container_of(cs_ctl->dsp, struct wm_adsp, cs_dsp); in wm_adsp_control_add() local
602 struct cs_dsp *cs_dsp = &dsp->cs_dsp; in wm_adsp_control_add()
613 adsp_err(dsp, "Unknown region type: %d\n", cs_ctl->alg_region.type); in wm_adsp_control_add()
627 wm_adsp_fw_text[dsp->fw], cs_ctl->alg_region.alg); in wm_adsp_control_add()
632 wm_adsp_fw_text[dsp->fw], cs_ctl->alg_region.alg); in wm_adsp_control_add()
640 if (dsp->component->name_prefix) in wm_adsp_control_add()
641 avail -= strlen(dsp->component->name_prefix) + 1; in wm_adsp_control_add()
685 int wm_adsp_write_ctl(struct wm_adsp *dsp, const char *name, int type, in wm_adsp_write_ctl() argument
694 cs_ctl = cs_dsp_get_ctl(&dsp->cs_dsp, name, type, alg); in wm_adsp_write_ctl()
710 if (dsp->component->name_prefix) in wm_adsp_write_ctl()
712 dsp->component->name_prefix, ctl->name); in wm_adsp_write_ctl()
717 kcontrol = snd_soc_card_get_kcontrol(dsp->component->card, ctl_name); in wm_adsp_write_ctl()
719 adsp_err(dsp, "Can't find kcontrol %s\n", ctl_name); in wm_adsp_write_ctl()
723 snd_ctl_notify(dsp->component->card->snd_card, in wm_adsp_write_ctl()
730 int wm_adsp_read_ctl(struct wm_adsp *dsp, const char *name, int type, in wm_adsp_read_ctl() argument
735 cs_ctl = cs_dsp_get_ctl(&dsp->cs_dsp, name, type, alg); in wm_adsp_read_ctl()
746 static void wm_adsp_release_firmware_files(struct wm_adsp *dsp, in wm_adsp_release_firmware_files() argument
761 static int wm_adsp_request_firmware_file(struct wm_adsp *dsp, in wm_adsp_request_firmware_file() argument
766 struct cs_dsp *cs_dsp = &dsp->cs_dsp; in wm_adsp_request_firmware_file()
769 *filename = kasprintf(GFP_KERNEL, "%s-%s-%s.%s", dsp->part, dsp->fwf_name, in wm_adsp_request_firmware_file()
770 wm_adsp_fw[dsp->fw].file, suffix); in wm_adsp_request_firmware_file()
776 adsp_err(dsp, "Failed to request '%s'\n", *filename); in wm_adsp_request_firmware_file()
784 static int wm_adsp_request_firmware_files(struct wm_adsp *dsp, in wm_adsp_request_firmware_files() argument
792 ret = wm_adsp_request_firmware_file(dsp, wmfw_firmware, wmfw_filename, "wmfw"); in wm_adsp_request_firmware_files()
796 wm_adsp_request_firmware_file(dsp, coeff_firmware, coeff_filename, "bin"); in wm_adsp_request_firmware_files()
801 static int wm_adsp_common_init(struct wm_adsp *dsp) in wm_adsp_common_init() argument
805 INIT_LIST_HEAD(&dsp->compr_list); in wm_adsp_common_init()
806 INIT_LIST_HEAD(&dsp->buffer_list); in wm_adsp_common_init()
808 if (!dsp->fwf_name) { in wm_adsp_common_init()
809 p = devm_kstrdup(dsp->cs_dsp.dev, dsp->cs_dsp.name, GFP_KERNEL); in wm_adsp_common_init()
813 dsp->fwf_name = p; in wm_adsp_common_init()
821 int wm_adsp1_init(struct wm_adsp *dsp) in wm_adsp1_init() argument
825 dsp->cs_dsp.client_ops = &wm_adsp1_client_ops; in wm_adsp1_init()
827 ret = cs_dsp_adsp1_init(&dsp->cs_dsp); in wm_adsp1_init()
831 return wm_adsp_common_init(dsp); in wm_adsp1_init()
841 struct wm_adsp *dsp = &dsps[w->shift]; in wm_adsp1_event() local
848 dsp->component = component; in wm_adsp1_event()
852 ret = wm_adsp_request_firmware_files(dsp, in wm_adsp1_event()
858 ret = cs_dsp_adsp1_power_up(&dsp->cs_dsp, in wm_adsp1_event()
861 wm_adsp_fw_text[dsp->fw]); in wm_adsp1_event()
863 wm_adsp_release_firmware_files(dsp, in wm_adsp1_event()
868 cs_dsp_adsp1_power_down(&dsp->cs_dsp); in wm_adsp1_event()
882 struct wm_adsp *dsp = &dsps[w->shift]; in wm_adsp2_set_dspclk() local
884 return cs_dsp_set_dspclk(&dsp->cs_dsp, freq); in wm_adsp2_set_dspclk()
895 struct wm_adsp *dsp = &dsps[mc->shift - 1]; in wm_adsp2_preloader_get() local
897 ucontrol->value.integer.value[0] = dsp->preloaded; in wm_adsp2_preloader_get()
911 struct wm_adsp *dsp = &dsps[mc->shift - 1]; in wm_adsp2_preloader_put() local
914 snprintf(preload, ARRAY_SIZE(preload), "%s Preload", dsp->cs_dsp.name); in wm_adsp2_preloader_put()
916 dsp->preloaded = ucontrol->value.integer.value[0]; in wm_adsp2_preloader_put()
925 flush_work(&dsp->boot_work); in wm_adsp2_preloader_put()
933 struct wm_adsp *dsp = container_of(work, in wm_adsp_boot_work() local
942 ret = wm_adsp_request_firmware_files(dsp, in wm_adsp_boot_work()
948 cs_dsp_power_up(&dsp->cs_dsp, in wm_adsp_boot_work()
951 wm_adsp_fw_text[dsp->fw]); in wm_adsp_boot_work()
953 wm_adsp_release_firmware_files(dsp, in wm_adsp_boot_work()
963 struct wm_adsp *dsp = &dsps[w->shift]; in wm_adsp_early_event() local
967 queue_work(system_unbound_wq, &dsp->boot_work); in wm_adsp_early_event()
970 cs_dsp_power_down(&dsp->cs_dsp); in wm_adsp_early_event()
982 struct wm_adsp *dsp = container_of(cs_dsp, struct wm_adsp, cs_dsp); in wm_adsp_event_post_run() local
984 if (wm_adsp_fw[dsp->fw].num_caps != 0) in wm_adsp_event_post_run()
985 return wm_adsp_buffer_init(dsp); in wm_adsp_event_post_run()
992 struct wm_adsp *dsp = container_of(cs_dsp, struct wm_adsp, cs_dsp); in wm_adsp_event_post_stop() local
994 if (wm_adsp_fw[dsp->fw].num_caps != 0) in wm_adsp_event_post_stop()
995 wm_adsp_buffer_free(dsp); in wm_adsp_event_post_stop()
997 dsp->fatal_error = false; in wm_adsp_event_post_stop()
1005 struct wm_adsp *dsp = &dsps[w->shift]; in wm_adsp_event() local
1010 flush_work(&dsp->boot_work); in wm_adsp_event()
1011 ret = cs_dsp_run(&dsp->cs_dsp); in wm_adsp_event()
1014 cs_dsp_stop(&dsp->cs_dsp); in wm_adsp_event()
1024 int wm_adsp2_component_probe(struct wm_adsp *dsp, struct snd_soc_component *component) in wm_adsp2_component_probe() argument
1028 snprintf(preload, ARRAY_SIZE(preload), "%s Preload", dsp->cs_dsp.name); in wm_adsp2_component_probe()
1031 cs_dsp_init_debugfs(&dsp->cs_dsp, component->debugfs_root); in wm_adsp2_component_probe()
1033 dsp->component = component; in wm_adsp2_component_probe()
1039 int wm_adsp2_component_remove(struct wm_adsp *dsp, struct snd_soc_component *component) in wm_adsp2_component_remove() argument
1041 cs_dsp_cleanup_debugfs(&dsp->cs_dsp); in wm_adsp2_component_remove()
1047 int wm_adsp2_init(struct wm_adsp *dsp) in wm_adsp2_init() argument
1051 INIT_WORK(&dsp->boot_work, wm_adsp_boot_work); in wm_adsp2_init()
1053 dsp->sys_config_size = sizeof(struct wm_adsp_system_config_xm_hdr); in wm_adsp2_init()
1054 dsp->cs_dsp.client_ops = &wm_adsp2_client_ops; in wm_adsp2_init()
1056 ret = cs_dsp_adsp2_init(&dsp->cs_dsp); in wm_adsp2_init()
1060 return wm_adsp_common_init(dsp); in wm_adsp2_init()
1064 int wm_halo_init(struct wm_adsp *dsp) in wm_halo_init() argument
1068 INIT_WORK(&dsp->boot_work, wm_adsp_boot_work); in wm_halo_init()
1070 dsp->sys_config_size = sizeof(struct wm_halo_system_config_xm_hdr); in wm_halo_init()
1071 dsp->cs_dsp.client_ops = &wm_adsp2_client_ops; in wm_halo_init()
1073 ret = cs_dsp_halo_init(&dsp->cs_dsp); in wm_halo_init()
1077 return wm_adsp_common_init(dsp); in wm_halo_init()
1081 void wm_adsp2_remove(struct wm_adsp *dsp) in wm_adsp2_remove() argument
1083 cs_dsp_remove(&dsp->cs_dsp); in wm_adsp2_remove()
1096 if (compr->dsp->fatal_error) in wm_adsp_compr_attach()
1099 list_for_each_entry(tmp, &compr->dsp->buffer_list, list) { in wm_adsp_compr_attach()
1130 int wm_adsp_compr_open(struct wm_adsp *dsp, struct snd_compr_stream *stream) in wm_adsp_compr_open() argument
1136 mutex_lock(&dsp->cs_dsp.pwr_lock); in wm_adsp_compr_open()
1138 if (wm_adsp_fw[dsp->fw].num_caps == 0) { in wm_adsp_compr_open()
1139 adsp_err(dsp, "%s: Firmware does not support compressed API\n", in wm_adsp_compr_open()
1145 if (wm_adsp_fw[dsp->fw].compr_direction != stream->direction) { in wm_adsp_compr_open()
1146 adsp_err(dsp, "%s: Firmware does not support stream direction\n", in wm_adsp_compr_open()
1152 list_for_each_entry(tmp, &dsp->compr_list, list) { in wm_adsp_compr_open()
1154 adsp_err(dsp, "%s: Only a single stream supported per dai\n", in wm_adsp_compr_open()
1167 compr->dsp = dsp; in wm_adsp_compr_open()
1171 list_add_tail(&compr->list, &dsp->compr_list); in wm_adsp_compr_open()
1176 mutex_unlock(&dsp->cs_dsp.pwr_lock); in wm_adsp_compr_open()
1186 struct wm_adsp *dsp = compr->dsp; in wm_adsp_compr_free() local
1188 mutex_lock(&dsp->cs_dsp.pwr_lock); in wm_adsp_compr_free()
1196 mutex_unlock(&dsp->cs_dsp.pwr_lock); in wm_adsp_compr_free()
1206 struct wm_adsp *dsp = compr->dsp; in wm_adsp_compr_check_params() local
1223 for (i = 0; i < wm_adsp_fw[dsp->fw].num_caps; i++) { in wm_adsp_compr_check_params()
1224 caps = &wm_adsp_fw[dsp->fw].caps[i]; in wm_adsp_compr_check_params()
1290 int fw = compr->dsp->fw; in wm_adsp_compr_get_caps()
1313 return cs_dsp_read_data_word(&buf->dsp->cs_dsp, buf->host_buf_mem_type, in wm_adsp_buffer_read()
1320 return cs_dsp_write_data_word(&buf->dsp->cs_dsp, buf->host_buf_mem_type, in wm_adsp_buffer_write()
1327 const struct wm_adsp_fw_caps *caps = wm_adsp_fw[buf->dsp->fw].caps; in wm_adsp_buffer_populate()
1371 static struct wm_adsp_compr_buf *wm_adsp_buffer_alloc(struct wm_adsp *dsp) in wm_adsp_buffer_alloc() argument
1379 buf->dsp = dsp; in wm_adsp_buffer_alloc()
1383 list_add_tail(&buf->list, &dsp->buffer_list); in wm_adsp_buffer_alloc()
1388 static int wm_adsp_buffer_parse_legacy(struct wm_adsp *dsp) in wm_adsp_buffer_parse_legacy() argument
1395 alg_region = cs_dsp_find_alg_region(&dsp->cs_dsp, WMFW_ADSP2_XM, dsp->cs_dsp.fw_id); in wm_adsp_buffer_parse_legacy()
1397 adsp_err(dsp, "No algorithm region found\n"); in wm_adsp_buffer_parse_legacy()
1401 buf = wm_adsp_buffer_alloc(dsp); in wm_adsp_buffer_parse_legacy()
1405 xmalg = dsp->sys_config_size / sizeof(__be32); in wm_adsp_buffer_parse_legacy()
1408 ret = cs_dsp_read_data_word(&dsp->cs_dsp, WMFW_ADSP2_XM, addr, &magic); in wm_adsp_buffer_parse_legacy()
1417 ret = cs_dsp_read_data_word(&dsp->cs_dsp, WMFW_ADSP2_XM, addr, in wm_adsp_buffer_parse_legacy()
1446 struct wm_adsp *dsp = container_of(cs_ctl->dsp, struct wm_adsp, cs_dsp); in wm_adsp_buffer_parse_coeff() local
1462 adsp_err(dsp, "Failed to acquire host buffer\n"); in wm_adsp_buffer_parse_coeff()
1466 buf = wm_adsp_buffer_alloc(dsp); in wm_adsp_buffer_parse_coeff()
1490 adsp_err(dsp, in wm_adsp_buffer_parse_coeff()
1498 buf->name = kasprintf(GFP_KERNEL, "%s-dsp-%s", dsp->part, in wm_adsp_buffer_parse_coeff()
1507 static int wm_adsp_buffer_init(struct wm_adsp *dsp) in wm_adsp_buffer_init() argument
1512 list_for_each_entry(cs_ctl, &dsp->cs_dsp.ctl_list, list) { in wm_adsp_buffer_init()
1521 adsp_err(dsp, "Failed to parse coeff: %d\n", ret); in wm_adsp_buffer_init()
1529 if (list_empty(&dsp->buffer_list)) { in wm_adsp_buffer_init()
1531 ret = wm_adsp_buffer_parse_legacy(dsp); in wm_adsp_buffer_init()
1533 adsp_err(dsp, "Failed to parse legacy: %d\n", ret); in wm_adsp_buffer_init()
1541 wm_adsp_buffer_free(dsp); in wm_adsp_buffer_init()
1545 static int wm_adsp_buffer_free(struct wm_adsp *dsp) in wm_adsp_buffer_free() argument
1549 list_for_each_entry_safe(buf, tmp, &dsp->buffer_list, list) { in wm_adsp_buffer_free()
1582 struct wm_adsp *dsp = compr->dsp; in wm_adsp_compr_trigger() local
1587 mutex_lock(&dsp->cs_dsp.pwr_lock); in wm_adsp_compr_trigger()
1623 mutex_unlock(&dsp->cs_dsp.pwr_lock); in wm_adsp_compr_trigger()
1631 int last_region = wm_adsp_fw[buf->dsp->fw].caps->num_regions - 1; in wm_adsp_buffer_size()
1679 int wm_adsp_compr_handle_irq(struct wm_adsp *dsp) in wm_adsp_compr_handle_irq() argument
1685 mutex_lock(&dsp->cs_dsp.pwr_lock); in wm_adsp_compr_handle_irq()
1687 if (list_empty(&dsp->buffer_list)) { in wm_adsp_compr_handle_irq()
1692 adsp_dbg(dsp, "Handling buffer IRQ\n"); in wm_adsp_compr_handle_irq()
1694 list_for_each_entry(buf, &dsp->buffer_list, list) { in wm_adsp_compr_handle_irq()
1714 if (wm_adsp_fw[dsp->fw].voice_trigger && buf->irq_count == 2) in wm_adsp_compr_handle_irq()
1723 mutex_unlock(&dsp->cs_dsp.pwr_lock); in wm_adsp_compr_handle_irq()
1747 struct wm_adsp *dsp = compr->dsp; in wm_adsp_compr_pointer() local
1753 mutex_lock(&dsp->cs_dsp.pwr_lock); in wm_adsp_compr_pointer()
1757 if (dsp->fatal_error || !buf || buf->error) { in wm_adsp_compr_pointer()
1797 mutex_unlock(&dsp->cs_dsp.pwr_lock); in wm_adsp_compr_pointer()
1811 for (i = 0; i < wm_adsp_fw[buf->dsp->fw].caps->num_regions; ++i) in wm_adsp_buffer_capture_block()
1815 if (i == wm_adsp_fw[buf->dsp->fw].caps->num_regions) in wm_adsp_buffer_capture_block()
1835 ret = cs_dsp_read_raw_data_block(&buf->dsp->cs_dsp, mem_type, adsp_addr, in wm_adsp_buffer_capture_block()
1861 struct wm_adsp *dsp = compr->dsp; in wm_adsp_compr_read() local
1867 if (dsp->fatal_error || !compr->buf || compr->buf->error) { in wm_adsp_compr_read()
1906 struct wm_adsp *dsp = compr->dsp; in wm_adsp_compr_copy() local
1909 mutex_lock(&dsp->cs_dsp.pwr_lock); in wm_adsp_compr_copy()
1916 mutex_unlock(&dsp->cs_dsp.pwr_lock); in wm_adsp_compr_copy()
1924 struct wm_adsp *dsp = container_of(cs_dsp, struct wm_adsp, cs_dsp); in wm_adsp_fatal_error() local
1927 dsp->fatal_error = true; in wm_adsp_fatal_error()
1929 list_for_each_entry(compr, &dsp->compr_list, list) { in wm_adsp_fatal_error()
1937 struct wm_adsp *dsp = (struct wm_adsp *)data; in wm_adsp2_bus_error() local
1939 cs_dsp_adsp2_bus_error(&dsp->cs_dsp); in wm_adsp2_bus_error()
1947 struct wm_adsp *dsp = (struct wm_adsp *)data; in wm_halo_bus_error() local
1949 cs_dsp_halo_bus_error(&dsp->cs_dsp); in wm_halo_bus_error()
1957 struct wm_adsp *dsp = data; in wm_halo_wdt_expire() local
1959 cs_dsp_halo_wdt_expire(&dsp->cs_dsp); in wm_halo_wdt_expire()