Commit 979bb1f4 authored by Peter Ujfalusi's avatar Peter Ujfalusi Committed by Liam Girdwood

ASoC: TWL4030: Make offset cancellation path configurable

Add means for machine drivers to select the path for offset
cancellation.
Reset the reg cache value to the chip reset value at the
same time.

Machine drivers can specify which path need to be used for
offset cancellation via the twl4030_setup.offset_cncl_path.
For paths use the defines from
include/linux/mfd/twl4030-codec.h:
TWL4030_OFFSET_CNCL_SEL_*
Signed-off-by: default avatarPeter Ujfalusi <peter.ujfalusi@nokia.com>
Acked-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: default avatarLiam Girdwood <lrg@slimlogic.co.uk>
parent cbd2db12
...@@ -46,7 +46,7 @@ static const u8 twl4030_reg[TWL4030_CACHEREGNUM] = { ...@@ -46,7 +46,7 @@ static const u8 twl4030_reg[TWL4030_CACHEREGNUM] = {
0xc3, /* REG_OPTION (0x2) */ 0xc3, /* REG_OPTION (0x2) */
0x00, /* REG_UNKNOWN (0x3) */ 0x00, /* REG_UNKNOWN (0x3) */
0x00, /* REG_MICBIAS_CTL (0x4) */ 0x00, /* REG_MICBIAS_CTL (0x4) */
0x20, /* REG_ANAMICL (0x5) */ 0x00, /* REG_ANAMICL (0x5) */
0x00, /* REG_ANAMICR (0x6) */ 0x00, /* REG_ANAMICR (0x6) */
0x00, /* REG_AVADC_CTL (0x7) */ 0x00, /* REG_AVADC_CTL (0x7) */
0x00, /* REG_ADCMICSEL (0x8) */ 0x00, /* REG_ADCMICSEL (0x8) */
...@@ -281,6 +281,8 @@ static void twl4030_apll_enable(struct snd_soc_codec *codec, int enable) ...@@ -281,6 +281,8 @@ static void twl4030_apll_enable(struct snd_soc_codec *codec, int enable)
static void twl4030_power_up(struct snd_soc_codec *codec) static void twl4030_power_up(struct snd_soc_codec *codec)
{ {
struct snd_soc_device *socdev = codec->socdev;
struct twl4030_setup_data *setup = socdev->codec_data;
struct twl4030_priv *twl4030 = snd_soc_codec_get_drvdata(codec); struct twl4030_priv *twl4030 = snd_soc_codec_get_drvdata(codec);
u8 anamicl, regmisc1, byte; u8 anamicl, regmisc1, byte;
int i = 0; int i = 0;
...@@ -293,6 +295,8 @@ static void twl4030_power_up(struct snd_soc_codec *codec) ...@@ -293,6 +295,8 @@ static void twl4030_power_up(struct snd_soc_codec *codec)
/* initiate offset cancellation */ /* initiate offset cancellation */
anamicl = twl4030_read_reg_cache(codec, TWL4030_REG_ANAMICL); anamicl = twl4030_read_reg_cache(codec, TWL4030_REG_ANAMICL);
anamicl &= ~TWL4030_OFFSET_CNCL_SEL;
anamicl |= setup->offset_cncl_path;
twl4030_write(codec, TWL4030_REG_ANAMICL, twl4030_write(codec, TWL4030_REG_ANAMICL,
anamicl | TWL4030_CNCL_OFFSET_START); anamicl | TWL4030_CNCL_OFFSET_START);
......
...@@ -42,6 +42,7 @@ extern struct snd_soc_codec_device soc_codec_dev_twl4030; ...@@ -42,6 +42,7 @@ extern struct snd_soc_codec_device soc_codec_dev_twl4030;
struct twl4030_setup_data { struct twl4030_setup_data {
unsigned int ramp_delay_value; unsigned int ramp_delay_value;
unsigned int sysclk; unsigned int sysclk;
unsigned int offset_cncl_path;
unsigned int hs_extmute:1; unsigned int hs_extmute:1;
void (*set_hs_extmute)(int mute); void (*set_hs_extmute)(int mute);
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment