diff options
author | Misael Lopez Cruz <misael.lopez@ti.com> | 2011-08-01 14:12:28 -0500 |
---|---|---|
committer | Simon Wilson <simonwilson@google.com> | 2011-08-03 17:43:08 -0700 |
commit | 746f1329ec2ca43413bb94817da6b23edd702ec4 (patch) | |
tree | 9019a019a7758182d85605c3fac96c222b7ace16 /sound/soc | |
parent | b00dc7412c2841bacf83456c218a17fdd694d0ed (diff) | |
download | kernel_samsung_tuna-746f1329ec2ca43413bb94817da6b23edd702ec4.zip kernel_samsung_tuna-746f1329ec2ca43413bb94817da6b23edd702ec4.tar.gz kernel_samsung_tuna-746f1329ec2ca43413bb94817da6b23edd702ec4.tar.bz2 |
ASoC: ABE: Reload equalizer coeffs during context restore
Equalizer coefficients are lost if ABE loses context, so reloading
equalizer coefficients of the active profile during context restore.
Change-Id: Ie4f86ba573609de0836c7a989f9fcbbbfe3178ed
Signed-off-by: Misael Lopez Cruz <misael.lopez@ti.com>
Diffstat (limited to 'sound/soc')
-rw-r--r-- | sound/soc/omap/omap-abe-dsp.c | 55 |
1 files changed, 36 insertions, 19 deletions
diff --git a/sound/soc/omap/omap-abe-dsp.c b/sound/soc/omap/omap-abe-dsp.c index 52b9214..059ae12 100644 --- a/sound/soc/omap/omap-abe-dsp.c +++ b/sound/soc/omap/omap-abe-dsp.c @@ -733,6 +733,30 @@ static int volume_get_gain(struct snd_kcontrol *kcontrol, return 0; } +static int abe_dsp_set_equalizer(unsigned int id, unsigned int profile) +{ + abe_equ_t equ_params; + int len; + + if (id >= the_abe->hdr.num_equ) + return -EINVAL; + + if (profile >= the_abe->equ_texts[id].count) + return -EINVAL; + + len = the_abe->equ_texts[id].coeff; + equ_params.equ_length = len; + memcpy(equ_params.coef.type1, the_abe->equ[id] + profile * len, + len * sizeof(u32)); + the_abe->equ_profile[id] = profile; + + pm_runtime_get_sync(the_abe->dev); + abe_write_equalizer(id + 1, &equ_params); + pm_runtime_put_sync(the_abe->dev); + + return 0; +} + static int abe_get_equalizer(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { @@ -747,24 +771,11 @@ static int abe_put_equalizer(struct snd_kcontrol *kcontrol, { struct soc_enum *eqc = (struct soc_enum *)kcontrol->private_value; u16 val = ucontrol->value.enumerated.item[0]; - abe_equ_t equ_params; - int len; - - if (eqc->reg >= the_abe->hdr.num_equ) - return -EINVAL; - - if (val >= the_abe->equ_texts[eqc->reg].count) - return -EINVAL; - - len = the_abe->equ_texts[eqc->reg].coeff; - equ_params.equ_length = len; - memcpy(equ_params.coef.type1, the_abe->equ[eqc->reg] + val * len, - len * sizeof(u32)); - the_abe->equ_profile[eqc->reg] = val; + int ret; - pm_runtime_get_sync(the_abe->dev); - abe_write_equalizer(eqc->reg + 1, &equ_params); - pm_runtime_put_sync(the_abe->dev); + ret = abe_dsp_set_equalizer(eqc->reg, val); + if (ret < 0) + return ret; return 1; } @@ -1878,7 +1889,7 @@ static int aess_save_context(struct abe_data *abe) static int aess_restore_context(struct abe_data *abe) { struct omap4_abe_dsp_pdata *pdata = abe->abe_pdata; - int loss_count = 0, ret; + int i, loss_count = 0, ret; if (pdata && pdata->device_scale) { ret = pdata->device_scale(the_abe->dev, the_abe->dev, @@ -1927,6 +1938,9 @@ static int aess_restore_context(struct abe_data *abe) abe_set_router_configuration(UPROUTE, 0, (u32 *)abe->router); + for (i = 0; i < abe->hdr.num_equ; i++) + abe_dsp_set_equalizer(i, abe->equ_profile[i]); + return 0; } @@ -2225,7 +2239,7 @@ static int abe_resume(struct snd_soc_dai *dai) { struct abe_data *abe = the_abe; struct omap4_abe_dsp_pdata *pdata = abe->abe_pdata; - int loss_count = 0, ret = 0; + int i, loss_count = 0, ret = 0; dev_dbg(dai->dev, "%s: %s active %d\n", __func__, dai->name, dai->active); @@ -2283,6 +2297,9 @@ static int abe_resume(struct snd_soc_dai *dai) abe_set_router_configuration(UPROUTE, 0, (u32 *)abe->router); + for (i = 0; i < abe->hdr.num_equ; i++) + abe_dsp_set_equalizer(i, abe->equ_profile[i]); + out: pm_runtime_put_sync(abe->dev); return ret; |