From a70d8bf90b722db7dd90e94d118942db11ff032e Mon Sep 17 00:00:00 2001 From: Paul Handrigan Date: Wed, 6 Jun 2018 15:45:43 -0500 Subject: [PATCH] ASoC: wm_adsp: Change fw name from device id to name. Change the device id of a part to the device name. Patch came from vendor (Cirrus). Mot-CRs-fixed: (CR): approach won't work with youtube in background Change-Id: I6ca0f03da34bffe4025b49d5e1913b03c4b9a70e Signed-off-by: Paul Handrigan Tested-by: Jira Key SLTApproved: Slta Waiver SME-Granted: SME Approvals Granted Reviewed-by: Konstantin Makariev Submit-Approved: Jira Key Reviewed-on: https://gerrit.mot.com/1354956 --- sound/soc/codecs/wm_adsp.c | 57 ++++++++++++++++++++++++++++++-------- 1 file changed, 46 insertions(+), 11 deletions(-) diff --git a/sound/soc/codecs/wm_adsp.c b/sound/soc/codecs/wm_adsp.c index 65b049b948e2..33093f535d5d 100644 --- a/sound/soc/codecs/wm_adsp.c +++ b/sound/soc/codecs/wm_adsp.c @@ -528,8 +528,8 @@ static const char *wm_adsp_fw_text[WM_ADSP_NUM_FW] = { [WM_ADSP_FW_TRACE] = "Dbg Trace", [WM_ADSP_FW_SPK_PROT] = "Protection", [WM_ADSP_FW_MISC] = "Misc", - [WM_ADSP_FW_AOU] = "AoU", - [WM_ADSP_FW_AOU_CONCURR] = "AoU Audio", + [WM_ADSP_FW_AOU] = "AOU Without Audio", + [WM_ADSP_FW_AOU_CONCURR] = "AOU With Audio", }; struct wm_adsp_system_config_xm_hdr { @@ -699,13 +699,13 @@ static struct wm_adsp_fw_defs wm_adsp_fw[WM_ADSP_NUM_FW] = { [WM_ADSP_FW_SPK_PROT] = { .file = "spk-prot" }, [WM_ADSP_FW_MISC] = { .file = "misc" }, [WM_ADSP_FW_AOU] = { - .file = "aou-ultrasound", + .file = "ultrasound", .compr_direction = SND_COMPRESS_CAPTURE, .num_caps = ARRAY_SIZE(trace_caps), .caps = trace_caps, }, [WM_ADSP_FW_AOU_CONCURR] = { - .file = "aou-concurrent", + .file = "concurrent", .compr_direction = SND_COMPRESS_CAPTURE, .num_caps = ARRAY_SIZE(trace_caps), .caps = trace_caps, @@ -2032,6 +2032,31 @@ static int wm_adsp_write_blocks(struct wm_adsp *dsp, const u8 *data, size_t len, return 0; } +struct wm_adsp_device_names { + char device_number[32]; + char device_name[32]; +}; + +static const struct wm_adsp_device_names wm_adsp_dev_list[] = { + {"cs47l35", "marley"}, + {"cs47l90", "moon"}, +}; + +static void wm_adsp_change_device_name(const char *dev_num, char *name) +{ + int i; + + for (i = 0; i < ARRAY_SIZE(wm_adsp_dev_list); i++) { + if (!strncmp(dev_num, wm_adsp_dev_list[i].device_number, + strlen(dev_num))) { + strlcpy(name, wm_adsp_dev_list[i].device_name, + strlen(wm_adsp_dev_list[i].device_name)+1); + return; + } + } + strlcpy(name, dev_num, strlen(dev_num)+1); +} + static int wm_adsp_load(struct wm_adsp *dsp) { LIST_HEAD(buf_list); @@ -2046,6 +2071,7 @@ static int wm_adsp_load(struct wm_adsp *dsp) const struct wm_adsp_region *mem; const char *region_name; char *file, *text = NULL; + char part_name[32]; unsigned int reg; int regions = 0; int ret, offset, type, sizes; @@ -2057,9 +2083,13 @@ static int wm_adsp_load(struct wm_adsp *dsp) if (dsp->firmwares[dsp->fw].fullname) snprintf(file, PAGE_SIZE, "%s", dsp->firmwares[dsp->fw].file); - else - snprintf(file, PAGE_SIZE, "%s-dsp%d-%s.wmfw", dsp->part, - dsp->num, dsp->firmwares[dsp->fw].file); + else { + memset(part_name, 0, sizeof(part_name)); + wm_adsp_change_device_name(dsp->part, part_name); + snprintf(file, PAGE_SIZE, "%s-dsp%d-%s.wmfw", part_name, + dsp->num, dsp->firmwares[dsp->fw].file); + } + file[PAGE_SIZE - 1] = '\0'; ret = request_firmware(&firmware, file, dsp->dev); @@ -2777,6 +2807,7 @@ static int wm_adsp_load_coeff(struct wm_adsp *dsp) const char *region_name; int ret, pos, blocks, type, offset, reg; char *file; + char part_name[32]; unsigned int burst_multiple; if (dsp->firmwares[dsp->fw].binfile && @@ -2787,15 +2818,19 @@ static int wm_adsp_load_coeff(struct wm_adsp *dsp) if (file == NULL) return -ENOMEM; - if (dsp->firmwares[dsp->fw].fullname && dsp->firmwares[dsp->fw].binfile) + if (dsp->firmwares[dsp->fw].fullname && + dsp->firmwares[dsp->fw].binfile) { snprintf(file, PAGE_SIZE, "%s", dsp->firmwares[dsp->fw].binfile); - else if (dsp->firmwares[dsp->fw].binfile) + } else if (dsp->firmwares[dsp->fw].binfile) { snprintf(file, PAGE_SIZE, "%s-dsp%d-%s.bin", dsp->part, dsp->num, dsp->firmwares[dsp->fw].binfile); - else - snprintf(file, PAGE_SIZE, "%s-dsp%d-%s.bin", dsp->part, + } else { + memset(part_name, 0, sizeof(part_name)); + wm_adsp_change_device_name(dsp->part, part_name); + snprintf(file, PAGE_SIZE, "%s-dsp%d-%s.bin", part_name, dsp->num, dsp->firmwares[dsp->fw].file); + } file[PAGE_SIZE - 1] = '\0'; ret = request_firmware(&firmware, file, dsp->dev);