diff options
author | Misael Lopez Cruz <misael.lopez@ti.com> | 2011-08-01 14:09:24 -0500 |
---|---|---|
committer | Simon Wilson <simonwilson@google.com> | 2011-08-03 17:42:53 -0700 |
commit | a196bac8df4d7def1f0f3f3930ff6cc3d8ad9b67 (patch) | |
tree | 08d9d7808216e9fbecbe38b487a7be7fdc8bd8e7 | |
parent | ecffea2308111ebd3e5cb85359385dd338261f69 (diff) | |
download | kernel_samsung_tuna-a196bac8df4d7def1f0f3f3930ff6cc3d8ad9b67.zip kernel_samsung_tuna-a196bac8df4d7def1f0f3f3930ff6cc3d8ad9b67.tar.gz kernel_samsung_tuna-a196bac8df4d7def1f0f3f3930ff6cc3d8ad9b67.tar.bz2 |
ASoC: ABE DSP: Share firmware strategy for built-in and modules
ABE firmware was stored locally in ABE HAL source code for built-in
support and a new firmware was created for modules which contains
the ABE firmware + equalizer configuration and coefficients.
In order to reuse the code for parsing the new firmware, original
firmware (pure ABE firmware) is converted into new firmware scheme.
Change-Id: I67346a0ae98e5bec238e12562efe571f4c42b84d
Signed-off-by: Misael Lopez Cruz <misael.lopez@ti.com>
Signed-off-by: Sebastien Guiriec <s-guiriec@ti.com>
-rw-r--r-- | sound/soc/omap/abe/abe_firmware.c | 799 | ||||
-rw-r--r-- | sound/soc/omap/omap-abe-dsp.c | 32 |
2 files changed, 813 insertions, 18 deletions
diff --git a/sound/soc/omap/abe/abe_firmware.c b/sound/soc/omap/abe/abe_firmware.c index b6b3d4d..6942aa4 100644 --- a/sound/soc/omap/abe/abe_firmware.c +++ b/sound/soc/omap/abe/abe_firmware.c @@ -1,3 +1,802 @@ +0xabeabe00, +0x00000000, +0x000178e8, +0x00000c60, +0x00000001, +0x00009110, +0x00000006, +0x20314c44, +0x61757145, +0x657a696c, +0x00000072, +0x00000000, +0x00000004, +0x00000019, +0x74616c46, +0x73657220, +0x736e6f70, +0x00000065, +0x00000000, +0x68676948, +0x7361702d, +0x64302073, +0x00000042, +0x00000000, +0x68676948, +0x7361702d, +0x312d2073, +0x00426432, +0x00000000, +0x68676948, +0x7361702d, +0x322d2073, +0x00426430, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x20324c44, +0x7466654c, +0x75714520, +0x7a696c61, +0x00007265, +0x00000004, +0x00000019, +0x74616c46, +0x73657220, +0x736e6f70, +0x00000065, +0x00000000, +0x68676948, +0x7361702d, +0x64302073, +0x00000042, +0x00000000, +0x68676948, +0x7361702d, +0x312d2073, +0x00426432, +0x00000000, +0x68676948, +0x7361702d, +0x322d2073, +0x00426430, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x20324c44, +0x68676952, +0x71452074, +0x696c6175, +0x0072657a, +0x00000004, +0x00000019, +0x74616c46, +0x73657220, +0x736e6f70, +0x00000065, +0x00000000, +0x68676948, +0x7361702d, +0x64302073, +0x00000042, +0x00000000, +0x68676948, +0x7361702d, +0x312d2073, +0x00426432, +0x00000000, +0x68676948, +0x7361702d, +0x322d2073, +0x00426430, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x65646953, +0x656e6f74, +0x75714520, +0x7a696c61, +0x00007265, +0x00000004, +0x00000009, +0x74616c46, +0x73657220, +0x736e6f70, +0x00000065, +0x00000000, +0x68676948, +0x7361702d, +0x64302073, +0x00000042, +0x00000000, +0x68676948, +0x7361702d, +0x312d2073, +0x00426432, +0x00000000, +0x68676948, +0x7361702d, +0x312d2073, +0x00426438, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x43494d41, +0x75714520, +0x7a696c61, +0x00007265, +0x00000000, +0x00000003, +0x00000013, +0x68676948, +0x7361702d, +0x64302073, +0x00000042, +0x00000000, +0x68676948, +0x7361702d, +0x312d2073, +0x00426432, +0x00000000, +0x68676948, +0x7361702d, +0x312d2073, +0x00426438, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x43494d44, +0x75714520, +0x7a696c61, +0x00007265, +0x00000000, +0x00000003, +0x00000013, +0x68676948, +0x7361702d, +0x64302073, +0x00000042, +0x00000000, +0x68676948, +0x7361702d, +0x312d2073, +0x00426432, +0x00000000, +0x68676948, +0x7361702d, +0x312d2073, +0x00426438, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00040002, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0xff8cbb51, +0x000ace72, +0xfff53192, +0x007344b1, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x0067cd91, +0xfff596e6, +0x000b29a2, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0xffc65da8, +0x00567385, +0xffa98c7d, +0x0039a258, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x0067cd91, +0xfff596e6, +0x000b29a2, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0xffe8f244, +0x00452938, +0xffbad6c8, +0x00170dbc, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x0067cd91, +0xfff596e6, +0x000b29a2, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00040002, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0xff8cbb51, +0x000ace72, +0xfff53192, +0x007344b1, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x0067cd91, +0xfff596e6, +0x000b29a2, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0xffc65da8, +0x00567385, +0xffa98c7d, +0x0039a258, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x0067cd91, +0xfff596e6, +0x000b29a2, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0xffe8f244, +0x00452938, +0xffbad6c8, +0x00170dbc, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x0067cd91, +0xfff596e6, +0x000b29a2, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00040002, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0xff8cbb51, +0x000ace72, +0xfff53192, +0x007344b1, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x0067cd91, +0xfff596e6, +0x000b29a2, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0xffc65da8, +0x00567385, +0xffa98c7d, +0x0039a258, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x0067cd91, +0xfff596e6, +0x000b29a2, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0xffe8f244, +0x00452938, +0xffbad6c8, +0x00170dbc, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x0067cd91, +0xfff596e6, +0x000b29a2, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00040002, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0xff8cbb51, +0x000ace72, +0xfff53192, +0x007344b1, +0x00000000, +0x0067cd91, +0xfff596e6, +0x000b29a2, +0x00000000, +0xffc65da8, +0x00567385, +0xffa98c7d, +0x0039a258, +0x00000000, +0x0067cd91, +0xfff596e6, +0x000b29a2, +0x00000000, +0xffe8f244, +0x00452938, +0xffbad6c8, +0x00170dbc, +0x00000000, +0x0067cd91, +0xfff596e6, +0x000b29a2, +0xffc1248b, +0xfffd1080, +0xfffaca4c, +0xfffab048, +0xfffdb0ac, +0x00024f54, +0x00054fb8, +0x000535b4, +0x0002ef80, +0x003edb7b, +0x001d92ec, +0xff962b59, +0x000bd422, +0xffe48132, +0x002dbdc2, +0xffc7a94a, +0x0033fbe6, +0xffdd3502, +0x000fea26, +0xfff0490f, +0xffd10817, +0xffaca4df, +0xffab0493, +0xffdb0acb, +0x0024f537, +0x0054fb6f, +0x00535b23, +0x002ef7eb, +0x000fb6f3, +0x001d930c, +0xff962afd, +0x000bd42a, +0xffe48122, +0x002dbdda, +0xffc7a932, +0x0033fbf6, +0xffdd34fa, +0x000fea26, +0xfff82487, +0xffe8840b, +0xffd6526f, +0xffd5824b, +0xffed8567, +0x00127a9b, +0x002a7db7, +0x0029ad93, +0x00177bf7, +0x0007db7b, +0x001d930c, +0xff962afd, +0x000bd42a, +0xffe48122, +0x002dbdda, +0xffc7a932, +0x0033fbf6, +0xffdd34fa, +0x000fea26, +0xffc1248b, +0xfffd1080, +0xfffaca4c, +0xfffab048, +0xfffdb0ac, +0x00024f54, +0x00054fb8, +0x000535b4, +0x0002ef80, +0x003edb7b, +0x001d92ec, +0xff962b59, +0x000bd422, +0xffe48132, +0x002dbdc2, +0xffc7a94a, +0x0033fbe6, +0xffdd3502, +0x000fea26, +0xfff0490f, +0xffd10817, +0xffaca4df, +0xffab0493, +0xffdb0acb, +0x0024f537, +0x0054fb6f, +0x00535b23, +0x002ef7eb, +0x000fb6f3, +0x001d930c, +0xff962afd, +0x000bd42a, +0xffe48122, +0x002dbdda, +0xffc7a932, +0x0033fbf6, +0xffdd34fa, +0x000fea26, +0xfff82487, +0xffe8840b, +0xffd6526f, +0xffd5824b, +0xffed8567, +0x00127a9b, +0x002a7db7, +0x0029ad93, +0x00177bf7, +0x0007db7b, +0x001d930c, +0xff962afd, +0x000bd42a, +0xffe48122, +0x002dbdda, +0xffc7a932, +0x0033fbf6, +0xffdd34fa, +0x000fea26, 0x00009110, /* VERSION NUMBER */ 0x00002000, /* PMEM LENGTH IN BYTES */ 0x000013E4, /* CMEM LENGTH IN BYTES */ diff --git a/sound/soc/omap/omap-abe-dsp.c b/sound/soc/omap/omap-abe-dsp.c index 0dd63e2..ecc855a 100644 --- a/sound/soc/omap/omap-abe-dsp.c +++ b/sound/soc/omap/omap-abe-dsp.c @@ -736,18 +736,15 @@ static int volume_get_gain(struct snd_kcontrol *kcontrol, static int abe_get_equalizer(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { -#if defined(CONFIG_SND_OMAP_SOC_ABE_DSP_MODULE) struct soc_enum *eqc = (struct soc_enum *)kcontrol->private_value; ucontrol->value.integer.value[0] = the_abe->equ_profile[eqc->reg]; -#endif return 0; } static int abe_put_equalizer(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { -#if defined(CONFIG_SND_OMAP_SOC_ABE_DSP_MODULE) struct soc_enum *eqc = (struct soc_enum *)kcontrol->private_value; u16 val = ucontrol->value.enumerated.item[0]; abe_equ_t equ_params; @@ -764,7 +761,7 @@ static int abe_put_equalizer(struct snd_kcontrol *kcontrol, pm_runtime_get_sync(the_abe->dev); abe_write_equalizer(eqc->reg, &equ_params); pm_runtime_put_sync(the_abe->dev); -#endif + return 1; } @@ -2125,7 +2122,6 @@ static int abe_add_widgets(struct snd_soc_platform *platform) struct fw_header *hdr = &abe->hdr; int i, j; -#if defined(CONFIG_SND_OMAP_SOC_ABE_DSP_MODULE) /* create equalizer controls */ for (i = 0; i < hdr->num_equ; i++) { struct soc_enum *equalizer_enum = &abe->equalizer_enum[i]; @@ -2153,7 +2149,6 @@ static int abe_add_widgets(struct snd_soc_platform *platform) snd_soc_add_platform_controls(platform, abe->equalizer_control, hdr->num_equ); -#endif snd_soc_add_platform_controls(platform, abe_controls, ARRAY_SIZE(abe_controls)); @@ -2296,11 +2291,13 @@ out: static int abe_probe(struct snd_soc_platform *platform) { struct abe_data *abe = snd_soc_platform_get_drvdata(platform); - const struct firmware *fw; - struct omap4_abe_dsp_pdata *pdata = abe->abe_pdata; struct opp *opp; + const u8 *fw_data; unsigned long freq = ULONG_MAX; int ret = 0, i, opp_count, offset = 0; +#if defined(CONFIG_SND_OMAP_SOC_ABE_DSP_MODULE) + const struct firmware *fw; +#endif abe->platform = platform; @@ -2313,9 +2310,13 @@ static int abe_probe(struct snd_soc_platform *platform) dev_err(abe->dev, "Failed to load firmware: %d\n", ret); return ret; } + fw_data = fw->data; +#else + fw_data = (u8 *)abe_get_default_fw(); +#endif /* get firmware and coefficients header info */ - memcpy(&abe->hdr, fw->data, sizeof(struct fw_header)); + memcpy(&abe->hdr, fw_data, sizeof(struct fw_header)); if (abe->hdr.firmware_size > ABE_MAX_FW_SIZE) { dev_err(abe->dev, "Firmware too large at %d bytes: %d\n", abe->hdr.firmware_size, ret); @@ -2345,7 +2346,7 @@ static int abe_probe(struct snd_soc_platform *platform) goto err_fw; } offset = sizeof(struct fw_header); - memcpy(abe->equ_texts, fw->data + offset, + memcpy(abe->equ_texts, fw_data + offset, abe->hdr.num_equ * sizeof(struct coeff_config)); /* get coefficients from firmware */ @@ -2355,7 +2356,7 @@ static int abe_probe(struct snd_soc_platform *platform) goto err_equ; } offset += abe->hdr.num_equ * sizeof(struct coeff_config); - memcpy(abe->equ[0], fw->data + offset, abe->hdr.coeff_size); + memcpy(abe->equ[0], fw_data + offset, abe->hdr.coeff_size); /* allocate coefficient mixer texts */ dev_dbg(abe->dev, "loaded %d equalizers\n", abe->hdr.num_equ); @@ -2390,11 +2391,8 @@ static int abe_probe(struct snd_soc_platform *platform) } memcpy(abe->firmware, - fw->data + sizeof(struct fw_header) + abe->hdr.coeff_size, + fw_data + sizeof(struct fw_header) + abe->hdr.coeff_size, abe->hdr.firmware_size); -#else - abe->firmware = abe_get_default_fw(); -#endif ret = request_irq(abe->irq, abe_irq_handler, 0, "ABE", (void *)abe); if (ret) { @@ -2460,7 +2458,6 @@ err_opp: rcu_read_unlock(); free_irq(abe->irq, (void *)abe); err_irq: -#if defined(CONFIG_SND_OMAP_SOC_ABE_DSP_MODULE) kfree(abe->firmware); err_texts: for (i = 0; i < abe->hdr.num_equ; i++) @@ -2469,6 +2466,7 @@ err_texts: err_equ: kfree(abe->equ_texts); err_fw: +#if defined(CONFIG_SND_OMAP_SOC_ABE_DSP_MODULE) release_firmware(fw); #endif return ret; @@ -2481,13 +2479,11 @@ static int abe_remove(struct snd_soc_platform *platform) free_irq(abe->irq, (void *)abe); -#if defined(CONFIG_SND_OMAP_SOC_ABE_DSP_MODULE) for (i = 0; i < abe->hdr.num_equ; i++) kfree(abe->equalizer_enum[i].texts); kfree(abe->equ[0]); kfree(abe->equ_texts); -#endif kfree(abe->firmware); pm_runtime_disable(abe->dev); |