aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/codecs/wm8400.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/wm8400.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/wm8400.c')
-rw-r--r--sound/soc/codecs/wm8400.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/sound/soc/codecs/wm8400.c b/sound/soc/codecs/wm8400.c
index b432f4d4a324..a7506ae2b8cc 100644
--- a/sound/soc/codecs/wm8400.c
+++ b/sound/soc/codecs/wm8400.c
@@ -76,7 +76,7 @@ struct wm8400_priv {
76static inline unsigned int wm8400_read(struct snd_soc_codec *codec, 76static inline unsigned int wm8400_read(struct snd_soc_codec *codec,
77 unsigned int reg) 77 unsigned int reg)
78{ 78{
79 struct wm8400_priv *wm8400 = codec->private_data; 79 struct wm8400_priv *wm8400 = snd_soc_codec_get_drvdata(codec);
80 80
81 if (reg == WM8400_INTDRIVBITS) 81 if (reg == WM8400_INTDRIVBITS)
82 return wm8400->fake_register; 82 return wm8400->fake_register;
@@ -90,7 +90,7 @@ static inline unsigned int wm8400_read(struct snd_soc_codec *codec,
90static int wm8400_write(struct snd_soc_codec *codec, unsigned int reg, 90static int wm8400_write(struct snd_soc_codec *codec, unsigned int reg,
91 unsigned int value) 91 unsigned int value)
92{ 92{
93 struct wm8400_priv *wm8400 = codec->private_data; 93 struct wm8400_priv *wm8400 = snd_soc_codec_get_drvdata(codec);
94 94
95 if (reg == WM8400_INTDRIVBITS) { 95 if (reg == WM8400_INTDRIVBITS) {
96 wm8400->fake_register = value; 96 wm8400->fake_register = value;
@@ -101,7 +101,7 @@ static int wm8400_write(struct snd_soc_codec *codec, unsigned int reg,
101 101
102static void wm8400_codec_reset(struct snd_soc_codec *codec) 102static void wm8400_codec_reset(struct snd_soc_codec *codec)
103{ 103{
104 struct wm8400_priv *wm8400 = codec->private_data; 104 struct wm8400_priv *wm8400 = snd_soc_codec_get_drvdata(codec);
105 105
106 wm8400_reset_codec_reg_cache(wm8400->wm8400); 106 wm8400_reset_codec_reg_cache(wm8400->wm8400);
107} 107}
@@ -925,7 +925,7 @@ static int wm8400_set_dai_sysclk(struct snd_soc_dai *codec_dai,
925 int clk_id, unsigned int freq, int dir) 925 int clk_id, unsigned int freq, int dir)
926{ 926{
927 struct snd_soc_codec *codec = codec_dai->codec; 927 struct snd_soc_codec *codec = codec_dai->codec;
928 struct wm8400_priv *wm8400 = codec->private_data; 928 struct wm8400_priv *wm8400 = snd_soc_codec_get_drvdata(codec);
929 929
930 wm8400->sysclk = freq; 930 wm8400->sysclk = freq;
931 return 0; 931 return 0;
@@ -1014,7 +1014,7 @@ static int wm8400_set_dai_pll(struct snd_soc_dai *codec_dai, int pll_id,
1014 unsigned int freq_out) 1014 unsigned int freq_out)
1015{ 1015{
1016 struct snd_soc_codec *codec = codec_dai->codec; 1016 struct snd_soc_codec *codec = codec_dai->codec;
1017 struct wm8400_priv *wm8400 = codec->private_data; 1017 struct wm8400_priv *wm8400 = snd_soc_codec_get_drvdata(codec);
1018 struct fll_factors factors; 1018 struct fll_factors factors;
1019 int ret; 1019 int ret;
1020 u16 reg; 1020 u16 reg;
@@ -1203,7 +1203,7 @@ static int wm8400_mute(struct snd_soc_dai *dai, int mute)
1203static int wm8400_set_bias_level(struct snd_soc_codec *codec, 1203static int wm8400_set_bias_level(struct snd_soc_codec *codec,
1204 enum snd_soc_bias_level level) 1204 enum snd_soc_bias_level level)
1205{ 1205{
1206 struct wm8400_priv *wm8400 = codec->private_data; 1206 struct wm8400_priv *wm8400 = snd_soc_codec_get_drvdata(codec);
1207 u16 val; 1207 u16 val;
1208 int ret; 1208 int ret;
1209 1209
@@ -1466,7 +1466,7 @@ static int wm8400_codec_probe(struct platform_device *dev)
1466 return -ENOMEM; 1466 return -ENOMEM;
1467 1467
1468 codec = &priv->codec; 1468 codec = &priv->codec;
1469 codec->private_data = priv; 1469 snd_soc_codec_set_drvdata(codec, priv);
1470 codec->control_data = dev_get_drvdata(&dev->dev); 1470 codec->control_data = dev_get_drvdata(&dev->dev);
1471 priv->wm8400 = dev_get_drvdata(&dev->dev); 1471 priv->wm8400 = dev_get_drvdata(&dev->dev);
1472 1472
@@ -1529,7 +1529,7 @@ err:
1529 1529
1530static int __exit wm8400_codec_remove(struct platform_device *dev) 1530static int __exit wm8400_codec_remove(struct platform_device *dev)
1531{ 1531{
1532 struct wm8400_priv *priv = wm8400_codec->private_data; 1532 struct wm8400_priv *priv = snd_soc_codec_get_drvdata(wm8400_codec);
1533 u16 reg; 1533 u16 reg;
1534 1534
1535 snd_soc_unregister_dai(&wm8400_dai); 1535 snd_soc_unregister_dai(&wm8400_dai);