aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorSebastien Guiriec <s-guiriec@ti.com>2011-08-28 13:36:17 -0500
committerSimon Wilson <simonwilson@google.com>2011-09-12 10:11:09 -0700
commit04633df51e49bfc90d92be9b1dedf041e7bc2e9d (patch)
tree793ba6d35ab865cd05cfb8660f23ca0f16d9dd97 /sound
parentca80213673ce0351d936a5a0f835064c8e4f150e (diff)
downloadkernel_samsung_tuna-04633df51e49bfc90d92be9b1dedf041e7bc2e9d.zip
kernel_samsung_tuna-04633df51e49bfc90d92be9b1dedf041e7bc2e9d.tar.gz
kernel_samsung_tuna-04633df51e49bfc90d92be9b1dedf041e7bc2e9d.tar.bz2
ASoC: SDP4430: Use ABE DC offset cancellation
Read headset and handsfree trimming values to compensate in ABE by reading HSOTRIM and HFOTRIM registers of TWL6040, passing these offsets to ABE for appropriate DC offset cancellation. According to Phoenix IC revision the trimming steps are different for the headset path. Change-Id: I2bef4208132eebe01353c148aad2b43bdd38d417 Signed-off-by: Sebastien Guiriec <s-guiriec@ti.com> Signed-off-by: Misael Lopez Cruz <misael.lopez@ti.com>
Diffstat (limited to 'sound')
-rwxr-xr-x[-rw-r--r--]sound/soc/omap/sdp4430.c30
1 files changed, 29 insertions, 1 deletions
diff --git a/sound/soc/omap/sdp4430.c b/sound/soc/omap/sdp4430.c
index 5079f1e..30ff72b 100644..100755
--- a/sound/soc/omap/sdp4430.c
+++ b/sound/soc/omap/sdp4430.c
@@ -37,6 +37,7 @@
#include "omap-mcpdm.h"
#include "omap-abe.h"
+#include "omap-abe-dsp.h"
#include "omap-pcm.h"
#include "omap-mcbsp.h"
#include "../codecs/twl6040.h"
@@ -247,6 +248,7 @@ static int sdp4430_set_power_mode(struct snd_kcontrol *kcontrol,
return 0;
twl6040_power_mode = ucontrol->value.integer.value[0];
+ abe_dsp_set_power_mode(twl6040_power_mode);
return 1;
}
@@ -321,8 +323,10 @@ static void sdp4430_mcpdm_twl6040_post(struct snd_pcm_substream *substream)
static int sdp4430_twl6040_init(struct snd_soc_pcm_runtime *rtd)
{
struct snd_soc_codec *codec = rtd->codec;
+ struct twl6040 *twl6040 = codec->control_data;
struct snd_soc_dapm_context *dapm = &codec->dapm;
- int ret;
+ int hsotrim, left_offset, right_offset, mode, ret;
+
/* Add SDP4430 specific controls */
ret = snd_soc_add_controls(codec, sdp4430_controls,
@@ -373,6 +377,20 @@ static int sdp4430_twl6040_init(struct snd_soc_pcm_runtime *rtd)
else
snd_soc_jack_report(&hs_jack, SND_JACK_HEADSET, SND_JACK_HEADSET);
+ /* DC offset cancellation computation */
+ hsotrim = snd_soc_read(codec, TWL6040_REG_HSOTRIM);
+ right_offset = (hsotrim & TWL6040_HSRO) >> TWL6040_HSRO_OFFSET;
+ left_offset = hsotrim & TWL6040_HSLO;
+
+ if (twl6040_get_icrev(twl6040) < TWL6040_REV_1_3)
+ /* For ES under ES_1.3 HS step is 2 mV */
+ mode = 2;
+ else
+ /* For ES_1.3 HS step is 1 mV */
+ mode = 1;
+
+ abe_dsp_set_hs_offset(left_offset, right_offset, mode);
+
/* don't wait before switching of HS power */
rtd->pmdown_time = 0;
@@ -381,6 +399,16 @@ static int sdp4430_twl6040_init(struct snd_soc_pcm_runtime *rtd)
static int sdp4430_twl6040_dl2_init(struct snd_soc_pcm_runtime *rtd)
{
+ struct snd_soc_codec *codec = rtd->codec;
+ int hfotrim, left_offset, right_offset;
+
+ /* DC offset cancellation computation */
+ hfotrim = snd_soc_read(codec, TWL6040_REG_HFOTRIM);
+ right_offset = (hfotrim & TWL6040_HFRO) >> TWL6040_HFRO_OFFSET;
+ left_offset = hfotrim & TWL6040_HFLO;
+
+ abe_dsp_set_hf_offset(left_offset, right_offset);
+
/* don't wait before switching of HF power */
rtd->pmdown_time = 0;