diff options
author | Peter Ujfalusi <peter.ujfalusi@nokia.com> | 2009-05-22 03:13:15 -0400 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2009-05-22 05:23:22 -0400 |
commit | 9da28c7b38170882b1c43d7d133ddce34e25f161 (patch) | |
tree | dd9becd919b9fe743d6cebfbd4e212922bf338f0 /sound/soc | |
parent | 5c82f56736e4c3a9eaf53c94366b056c8622d79e (diff) |
ASoC: TWL4030: Add support for platform dependent configuration
twl4030_setup_data structure can be passed from platform drivers to
the codec via the snd_soc_device->codec_data pointer.
Currently the setup data has support for the Headset pop-removal
related configuration, which differs from board to board.
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc')
-rw-r--r-- | sound/soc/codecs/twl4030.c | 22 | ||||
-rw-r--r-- | sound/soc/codecs/twl4030.h | 5 |
2 files changed, 24 insertions, 3 deletions
diff --git a/sound/soc/codecs/twl4030.c b/sound/soc/codecs/twl4030.c index f554672f67c1..584507f71efb 100644 --- a/sound/soc/codecs/twl4030.c +++ b/sound/soc/codecs/twl4030.c | |||
@@ -1997,6 +1997,8 @@ static int twl4030_resume(struct platform_device *pdev) | |||
1997 | static int twl4030_init(struct snd_soc_device *socdev) | 1997 | static int twl4030_init(struct snd_soc_device *socdev) |
1998 | { | 1998 | { |
1999 | struct snd_soc_codec *codec = socdev->card->codec; | 1999 | struct snd_soc_codec *codec = socdev->card->codec; |
2000 | struct twl4030_setup_data *setup = socdev->codec_data; | ||
2001 | struct twl4030_priv *twl4030 = codec->private_data; | ||
2000 | int ret = 0; | 2002 | int ret = 0; |
2001 | 2003 | ||
2002 | printk(KERN_INFO "TWL4030 Audio Codec init \n"); | 2004 | printk(KERN_INFO "TWL4030 Audio Codec init \n"); |
@@ -2014,6 +2016,23 @@ static int twl4030_init(struct snd_soc_device *socdev) | |||
2014 | if (codec->reg_cache == NULL) | 2016 | if (codec->reg_cache == NULL) |
2015 | return -ENOMEM; | 2017 | return -ENOMEM; |
2016 | 2018 | ||
2019 | /* Configuration for headset ramp delay from setup data */ | ||
2020 | if (setup) { | ||
2021 | unsigned char hs_pop; | ||
2022 | |||
2023 | if (setup->sysclk) | ||
2024 | twl4030->sysclk = setup->sysclk; | ||
2025 | else | ||
2026 | twl4030->sysclk = 26000; | ||
2027 | |||
2028 | hs_pop = twl4030_read_reg_cache(codec, TWL4030_REG_HS_POPN_SET); | ||
2029 | hs_pop &= ~TWL4030_RAMP_DELAY; | ||
2030 | hs_pop |= (setup->ramp_delay_value << 2); | ||
2031 | twl4030_write_reg_cache(codec, TWL4030_REG_HS_POPN_SET, hs_pop); | ||
2032 | } else { | ||
2033 | twl4030->sysclk = 26000; | ||
2034 | } | ||
2035 | |||
2017 | /* register pcms */ | 2036 | /* register pcms */ |
2018 | ret = snd_soc_new_pcms(socdev, SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1); | 2037 | ret = snd_soc_new_pcms(socdev, SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1); |
2019 | if (ret < 0) { | 2038 | if (ret < 0) { |
@@ -2063,9 +2082,6 @@ static int twl4030_probe(struct platform_device *pdev) | |||
2063 | kfree(codec); | 2082 | kfree(codec); |
2064 | return -ENOMEM; | 2083 | return -ENOMEM; |
2065 | } | 2084 | } |
2066 | /* Set default sysclk (used by the headsetl/rpga_event callback for | ||
2067 | * pop-attenuation) */ | ||
2068 | twl4030->sysclk = 26000; | ||
2069 | 2085 | ||
2070 | codec->private_data = twl4030; | 2086 | codec->private_data = twl4030; |
2071 | socdev->card->codec = codec; | 2087 | socdev->card->codec = codec; |
diff --git a/sound/soc/codecs/twl4030.h b/sound/soc/codecs/twl4030.h index 9668bdf430fb..48326e2bd9de 100644 --- a/sound/soc/codecs/twl4030.h +++ b/sound/soc/codecs/twl4030.h | |||
@@ -266,4 +266,9 @@ | |||
266 | extern struct snd_soc_dai twl4030_dai[2]; | 266 | extern struct snd_soc_dai twl4030_dai[2]; |
267 | extern struct snd_soc_codec_device soc_codec_dev_twl4030; | 267 | extern struct snd_soc_codec_device soc_codec_dev_twl4030; |
268 | 268 | ||
269 | struct twl4030_setup_data { | ||
270 | unsigned int ramp_delay_value; | ||
271 | unsigned int sysclk; | ||
272 | }; | ||
273 | |||
269 | #endif /* End of __TWL4030_AUDIO_H__ */ | 274 | #endif /* End of __TWL4030_AUDIO_H__ */ |