aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/codecs/twl4030.c
diff options
context:
space:
mode:
authorMark Brown <broonie@opensource.wolfsonmicro.com>2010-04-14 02:35:19 -0400
committerMark Brown <broonie@opensource.wolfsonmicro.com>2010-04-16 21:46:22 -0400
commitb2c812e22de88bb79c290c0e718280f10b64a48d (patch)
tree4a5d967714cfb771db351cde525e6946897cca08 /sound/soc/codecs/twl4030.c
parent890c681275ab02623de1187f2d97fc355d76f372 (diff)
ASoC: Add indirection for CODEC private data
One of the features of the multi CODEC work is that it embeds a struct device in the CODEC to provide diagnostics via a sysfs class rather than via the device tree, at which point it's much better to use the struct device private data rather than having two places to store it. Provide an accessor function to allow this change to be made more easily, and update all the CODEC drivers are updated. To ensure use of the accessor the private data structure member is renamed, meaning that if code developed with older an older core that still uses private_data is merged it will fail to build. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
Diffstat (limited to 'sound/soc/codecs/twl4030.c')
-rw-r--r--sound/soc/codecs/twl4030.c32
1 files changed, 16 insertions, 16 deletions
diff --git a/sound/soc/codecs/twl4030.c b/sound/soc/codecs/twl4030.c
index bf59b8a4d1d7..4eb5a2e59f3c 100644
--- a/sound/soc/codecs/twl4030.c
+++ b/sound/soc/codecs/twl4030.c
@@ -175,7 +175,7 @@ static inline void twl4030_write_reg_cache(struct snd_soc_codec *codec,
175static int twl4030_write(struct snd_soc_codec *codec, 175static int twl4030_write(struct snd_soc_codec *codec,
176 unsigned int reg, unsigned int value) 176 unsigned int reg, unsigned int value)
177{ 177{
178 struct twl4030_priv *twl4030 = codec->private_data; 178 struct twl4030_priv *twl4030 = snd_soc_codec_get_drvdata(codec);
179 int write_to_reg = 0; 179 int write_to_reg = 0;
180 180
181 twl4030_write_reg_cache(codec, reg, value); 181 twl4030_write_reg_cache(codec, reg, value);
@@ -220,7 +220,7 @@ static int twl4030_write(struct snd_soc_codec *codec,
220 220
221static void twl4030_codec_enable(struct snd_soc_codec *codec, int enable) 221static void twl4030_codec_enable(struct snd_soc_codec *codec, int enable)
222{ 222{
223 struct twl4030_priv *twl4030 = codec->private_data; 223 struct twl4030_priv *twl4030 = snd_soc_codec_get_drvdata(codec);
224 int mode; 224 int mode;
225 225
226 if (enable == twl4030->codec_powered) 226 if (enable == twl4030->codec_powered)
@@ -258,7 +258,7 @@ static void twl4030_init_chip(struct snd_soc_codec *codec)
258 258
259static void twl4030_apll_enable(struct snd_soc_codec *codec, int enable) 259static void twl4030_apll_enable(struct snd_soc_codec *codec, int enable)
260{ 260{
261 struct twl4030_priv *twl4030 = codec->private_data; 261 struct twl4030_priv *twl4030 = snd_soc_codec_get_drvdata(codec);
262 int status; 262 int status;
263 263
264 if (enable == twl4030->apll_enabled) 264 if (enable == twl4030->apll_enabled)
@@ -279,7 +279,7 @@ static void twl4030_apll_enable(struct snd_soc_codec *codec, int enable)
279 279
280static void twl4030_power_up(struct snd_soc_codec *codec) 280static void twl4030_power_up(struct snd_soc_codec *codec)
281{ 281{
282 struct twl4030_priv *twl4030 = codec->private_data; 282 struct twl4030_priv *twl4030 = snd_soc_codec_get_drvdata(codec);
283 u8 anamicl, regmisc1, byte; 283 u8 anamicl, regmisc1, byte;
284 int i = 0; 284 int i = 0;
285 285
@@ -570,7 +570,7 @@ static int micpath_event(struct snd_soc_dapm_widget *w,
570static int pin_name##pga_event(struct snd_soc_dapm_widget *w, \ 570static int pin_name##pga_event(struct snd_soc_dapm_widget *w, \
571 struct snd_kcontrol *kcontrol, int event) \ 571 struct snd_kcontrol *kcontrol, int event) \
572{ \ 572{ \
573 struct twl4030_priv *twl4030 = w->codec->private_data; \ 573 struct twl4030_priv *twl4030 = snd_soc_codec_get_drvdata(w->codec); \
574 \ 574 \
575 switch (event) { \ 575 switch (event) { \
576 case SND_SOC_DAPM_POST_PMU: \ 576 case SND_SOC_DAPM_POST_PMU: \
@@ -678,7 +678,7 @@ static void headset_ramp(struct snd_soc_codec *codec, int ramp)
678 struct twl4030_setup_data *setup = socdev->codec_data; 678 struct twl4030_setup_data *setup = socdev->codec_data;
679 679
680 unsigned char hs_gain, hs_pop; 680 unsigned char hs_gain, hs_pop;
681 struct twl4030_priv *twl4030 = codec->private_data; 681 struct twl4030_priv *twl4030 = snd_soc_codec_get_drvdata(codec);
682 /* Base values for ramp delay calculation: 2^19 - 2^26 */ 682 /* Base values for ramp delay calculation: 2^19 - 2^26 */
683 unsigned int ramp_base[] = {524288, 1048576, 2097152, 4194304, 683 unsigned int ramp_base[] = {524288, 1048576, 2097152, 4194304,
684 8388608, 16777216, 33554432, 67108864}; 684 8388608, 16777216, 33554432, 67108864};
@@ -741,7 +741,7 @@ static void headset_ramp(struct snd_soc_codec *codec, int ramp)
741static int headsetlpga_event(struct snd_soc_dapm_widget *w, 741static int headsetlpga_event(struct snd_soc_dapm_widget *w,
742 struct snd_kcontrol *kcontrol, int event) 742 struct snd_kcontrol *kcontrol, int event)
743{ 743{
744 struct twl4030_priv *twl4030 = w->codec->private_data; 744 struct twl4030_priv *twl4030 = snd_soc_codec_get_drvdata(w->codec);
745 745
746 switch (event) { 746 switch (event) {
747 case SND_SOC_DAPM_POST_PMU: 747 case SND_SOC_DAPM_POST_PMU:
@@ -765,7 +765,7 @@ static int headsetlpga_event(struct snd_soc_dapm_widget *w,
765static int headsetrpga_event(struct snd_soc_dapm_widget *w, 765static int headsetrpga_event(struct snd_soc_dapm_widget *w,
766 struct snd_kcontrol *kcontrol, int event) 766 struct snd_kcontrol *kcontrol, int event)
767{ 767{
768 struct twl4030_priv *twl4030 = w->codec->private_data; 768 struct twl4030_priv *twl4030 = snd_soc_codec_get_drvdata(w->codec);
769 769
770 switch (event) { 770 switch (event) {
771 case SND_SOC_DAPM_POST_PMU: 771 case SND_SOC_DAPM_POST_PMU:
@@ -957,7 +957,7 @@ static int snd_soc_put_twl4030_opmode_enum_double(struct snd_kcontrol *kcontrol,
957 struct snd_ctl_elem_value *ucontrol) 957 struct snd_ctl_elem_value *ucontrol)
958{ 958{
959 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); 959 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
960 struct twl4030_priv *twl4030 = codec->private_data; 960 struct twl4030_priv *twl4030 = snd_soc_codec_get_drvdata(codec);
961 struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; 961 struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
962 unsigned short val; 962 unsigned short val;
963 unsigned short mask, bitmask; 963 unsigned short mask, bitmask;
@@ -1627,7 +1627,7 @@ static int twl4030_startup(struct snd_pcm_substream *substream,
1627 struct snd_soc_pcm_runtime *rtd = substream->private_data; 1627 struct snd_soc_pcm_runtime *rtd = substream->private_data;
1628 struct snd_soc_device *socdev = rtd->socdev; 1628 struct snd_soc_device *socdev = rtd->socdev;
1629 struct snd_soc_codec *codec = socdev->card->codec; 1629 struct snd_soc_codec *codec = socdev->card->codec;
1630 struct twl4030_priv *twl4030 = codec->private_data; 1630 struct twl4030_priv *twl4030 = snd_soc_codec_get_drvdata(codec);
1631 1631
1632 if (twl4030->master_substream) { 1632 if (twl4030->master_substream) {
1633 twl4030->slave_substream = substream; 1633 twl4030->slave_substream = substream;
@@ -1658,7 +1658,7 @@ static void twl4030_shutdown(struct snd_pcm_substream *substream,
1658 struct snd_soc_pcm_runtime *rtd = substream->private_data; 1658 struct snd_soc_pcm_runtime *rtd = substream->private_data;
1659 struct snd_soc_device *socdev = rtd->socdev; 1659 struct snd_soc_device *socdev = rtd->socdev;
1660 struct snd_soc_codec *codec = socdev->card->codec; 1660 struct snd_soc_codec *codec = socdev->card->codec;
1661 struct twl4030_priv *twl4030 = codec->private_data; 1661 struct twl4030_priv *twl4030 = snd_soc_codec_get_drvdata(codec);
1662 1662
1663 if (twl4030->master_substream == substream) 1663 if (twl4030->master_substream == substream)
1664 twl4030->master_substream = twl4030->slave_substream; 1664 twl4030->master_substream = twl4030->slave_substream;
@@ -1684,7 +1684,7 @@ static int twl4030_hw_params(struct snd_pcm_substream *substream,
1684 struct snd_soc_pcm_runtime *rtd = substream->private_data; 1684 struct snd_soc_pcm_runtime *rtd = substream->private_data;
1685 struct snd_soc_device *socdev = rtd->socdev; 1685 struct snd_soc_device *socdev = rtd->socdev;
1686 struct snd_soc_codec *codec = socdev->card->codec; 1686 struct snd_soc_codec *codec = socdev->card->codec;
1687 struct twl4030_priv *twl4030 = codec->private_data; 1687 struct twl4030_priv *twl4030 = snd_soc_codec_get_drvdata(codec);
1688 u8 mode, old_mode, format, old_format; 1688 u8 mode, old_mode, format, old_format;
1689 1689
1690 /* If the substream has 4 channel, do the necessary setup */ 1690 /* If the substream has 4 channel, do the necessary setup */
@@ -1804,7 +1804,7 @@ static int twl4030_set_dai_sysclk(struct snd_soc_dai *codec_dai,
1804 int clk_id, unsigned int freq, int dir) 1804 int clk_id, unsigned int freq, int dir)
1805{ 1805{
1806 struct snd_soc_codec *codec = codec_dai->codec; 1806 struct snd_soc_codec *codec = codec_dai->codec;
1807 struct twl4030_priv *twl4030 = codec->private_data; 1807 struct twl4030_priv *twl4030 = snd_soc_codec_get_drvdata(codec);
1808 1808
1809 switch (freq) { 1809 switch (freq) {
1810 case 19200000: 1810 case 19200000:
@@ -1919,7 +1919,7 @@ static int twl4030_voice_startup(struct snd_pcm_substream *substream,
1919 struct snd_soc_pcm_runtime *rtd = substream->private_data; 1919 struct snd_soc_pcm_runtime *rtd = substream->private_data;
1920 struct snd_soc_device *socdev = rtd->socdev; 1920 struct snd_soc_device *socdev = rtd->socdev;
1921 struct snd_soc_codec *codec = socdev->card->codec; 1921 struct snd_soc_codec *codec = socdev->card->codec;
1922 struct twl4030_priv *twl4030 = codec->private_data; 1922 struct twl4030_priv *twl4030 = snd_soc_codec_get_drvdata(codec);
1923 u8 mode; 1923 u8 mode;
1924 1924
1925 /* If the system master clock is not 26MHz, the voice PCM interface is 1925 /* If the system master clock is not 26MHz, the voice PCM interface is
@@ -2164,7 +2164,7 @@ static int twl4030_soc_probe(struct platform_device *pdev)
2164 BUG_ON(!twl4030_codec); 2164 BUG_ON(!twl4030_codec);
2165 2165
2166 codec = twl4030_codec; 2166 codec = twl4030_codec;
2167 twl4030 = codec->private_data; 2167 twl4030 = snd_soc_codec_get_drvdata(codec);
2168 socdev->card->codec = codec; 2168 socdev->card->codec = codec;
2169 2169
2170 /* Configuration for headset ramp delay from setup data */ 2170 /* Configuration for headset ramp delay from setup data */
@@ -2227,7 +2227,7 @@ static int __devinit twl4030_codec_probe(struct platform_device *pdev)
2227 } 2227 }
2228 2228
2229 codec = &twl4030->codec; 2229 codec = &twl4030->codec;
2230 codec->private_data = twl4030; 2230 snd_soc_codec_set_drvdata(codec, twl4030);
2231 codec->dev = &pdev->dev; 2231 codec->dev = &pdev->dev;
2232 twl4030_dai[0].dev = &pdev->dev; 2232 twl4030_dai[0].dev = &pdev->dev;
2233 twl4030_dai[1].dev = &pdev->dev; 2233 twl4030_dai[1].dev = &pdev->dev;