aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/codecs/wm8903.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/wm8903.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/wm8903.c')
-rw-r--r--sound/soc/codecs/wm8903.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/sound/soc/codecs/wm8903.c b/sound/soc/codecs/wm8903.c
index 134b17532f23..5a2510c39c10 100644
--- a/sound/soc/codecs/wm8903.c
+++ b/sound/soc/codecs/wm8903.c
@@ -252,7 +252,7 @@ static int wm8903_run_sequence(struct snd_soc_codec *codec, unsigned int start)
252{ 252{
253 u16 reg[5]; 253 u16 reg[5];
254 struct i2c_client *i2c = codec->control_data; 254 struct i2c_client *i2c = codec->control_data;
255 struct wm8903_priv *wm8903 = codec->private_data; 255 struct wm8903_priv *wm8903 = snd_soc_codec_get_drvdata(codec);
256 256
257 BUG_ON(start > 48); 257 BUG_ON(start > 48);
258 258
@@ -420,7 +420,7 @@ static int wm8903_class_w_put(struct snd_kcontrol *kcontrol,
420{ 420{
421 struct snd_soc_dapm_widget *widget = snd_kcontrol_chip(kcontrol); 421 struct snd_soc_dapm_widget *widget = snd_kcontrol_chip(kcontrol);
422 struct snd_soc_codec *codec = widget->codec; 422 struct snd_soc_codec *codec = widget->codec;
423 struct wm8903_priv *wm8903 = codec->private_data; 423 struct wm8903_priv *wm8903 = snd_soc_codec_get_drvdata(codec);
424 struct i2c_client *i2c = codec->control_data; 424 struct i2c_client *i2c = codec->control_data;
425 u16 reg; 425 u16 reg;
426 int ret; 426 int ret;
@@ -1001,7 +1001,7 @@ static int wm8903_set_dai_sysclk(struct snd_soc_dai *codec_dai,
1001 int clk_id, unsigned int freq, int dir) 1001 int clk_id, unsigned int freq, int dir)
1002{ 1002{
1003 struct snd_soc_codec *codec = codec_dai->codec; 1003 struct snd_soc_codec *codec = codec_dai->codec;
1004 struct wm8903_priv *wm8903 = codec->private_data; 1004 struct wm8903_priv *wm8903 = snd_soc_codec_get_drvdata(codec);
1005 1005
1006 wm8903->sysclk = freq; 1006 wm8903->sysclk = freq;
1007 1007
@@ -1229,7 +1229,7 @@ static int wm8903_startup(struct snd_pcm_substream *substream,
1229 struct snd_soc_pcm_runtime *rtd = substream->private_data; 1229 struct snd_soc_pcm_runtime *rtd = substream->private_data;
1230 struct snd_soc_device *socdev = rtd->socdev; 1230 struct snd_soc_device *socdev = rtd->socdev;
1231 struct snd_soc_codec *codec = socdev->card->codec; 1231 struct snd_soc_codec *codec = socdev->card->codec;
1232 struct wm8903_priv *wm8903 = codec->private_data; 1232 struct wm8903_priv *wm8903 = snd_soc_codec_get_drvdata(codec);
1233 struct i2c_client *i2c = codec->control_data; 1233 struct i2c_client *i2c = codec->control_data;
1234 struct snd_pcm_runtime *master_runtime; 1234 struct snd_pcm_runtime *master_runtime;
1235 1235
@@ -1265,7 +1265,7 @@ static void wm8903_shutdown(struct snd_pcm_substream *substream,
1265 struct snd_soc_pcm_runtime *rtd = substream->private_data; 1265 struct snd_soc_pcm_runtime *rtd = substream->private_data;
1266 struct snd_soc_device *socdev = rtd->socdev; 1266 struct snd_soc_device *socdev = rtd->socdev;
1267 struct snd_soc_codec *codec = socdev->card->codec; 1267 struct snd_soc_codec *codec = socdev->card->codec;
1268 struct wm8903_priv *wm8903 = codec->private_data; 1268 struct wm8903_priv *wm8903 = snd_soc_codec_get_drvdata(codec);
1269 1269
1270 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) 1270 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
1271 wm8903->playback_active--; 1271 wm8903->playback_active--;
@@ -1285,7 +1285,7 @@ static int wm8903_hw_params(struct snd_pcm_substream *substream,
1285 struct snd_soc_pcm_runtime *rtd = substream->private_data; 1285 struct snd_soc_pcm_runtime *rtd = substream->private_data;
1286 struct snd_soc_device *socdev = rtd->socdev; 1286 struct snd_soc_device *socdev = rtd->socdev;
1287 struct snd_soc_codec *codec = socdev->card->codec; 1287 struct snd_soc_codec *codec = socdev->card->codec;
1288 struct wm8903_priv *wm8903 = codec->private_data; 1288 struct wm8903_priv *wm8903 = snd_soc_codec_get_drvdata(codec);
1289 struct i2c_client *i2c = codec->control_data; 1289 struct i2c_client *i2c = codec->control_data;
1290 int fs = params_rate(params); 1290 int fs = params_rate(params);
1291 int bclk; 1291 int bclk;
@@ -1464,7 +1464,7 @@ static int wm8903_hw_params(struct snd_pcm_substream *substream,
1464int wm8903_mic_detect(struct snd_soc_codec *codec, struct snd_soc_jack *jack, 1464int wm8903_mic_detect(struct snd_soc_codec *codec, struct snd_soc_jack *jack,
1465 int det, int shrt) 1465 int det, int shrt)
1466{ 1466{
1467 struct wm8903_priv *wm8903 = codec->private_data; 1467 struct wm8903_priv *wm8903 = snd_soc_codec_get_drvdata(codec);
1468 int irq_mask = WM8903_MICDET_EINT | WM8903_MICSHRT_EINT; 1468 int irq_mask = WM8903_MICDET_EINT | WM8903_MICSHRT_EINT;
1469 1469
1470 dev_dbg(codec->dev, "Enabling microphone detection: %x %x\n", 1470 dev_dbg(codec->dev, "Enabling microphone detection: %x %x\n",
@@ -1674,7 +1674,7 @@ static __devinit int wm8903_i2c_probe(struct i2c_client *i2c,
1674 codec->num_dai = 1; 1674 codec->num_dai = 1;
1675 codec->reg_cache_size = ARRAY_SIZE(wm8903->reg_cache); 1675 codec->reg_cache_size = ARRAY_SIZE(wm8903->reg_cache);
1676 codec->reg_cache = &wm8903->reg_cache[0]; 1676 codec->reg_cache = &wm8903->reg_cache[0];
1677 codec->private_data = wm8903; 1677 snd_soc_codec_set_drvdata(codec, wm8903);
1678 codec->volatile_register = wm8903_volatile_register; 1678 codec->volatile_register = wm8903_volatile_register;
1679 init_completion(&wm8903->wseq); 1679 init_completion(&wm8903->wseq);
1680 1680
@@ -1812,7 +1812,7 @@ err:
1812static __devexit int wm8903_i2c_remove(struct i2c_client *client) 1812static __devexit int wm8903_i2c_remove(struct i2c_client *client)
1813{ 1813{
1814 struct snd_soc_codec *codec = i2c_get_clientdata(client); 1814 struct snd_soc_codec *codec = i2c_get_clientdata(client);
1815 struct wm8903_priv *priv = codec->private_data; 1815 struct wm8903_priv *priv = snd_soc_codec_get_drvdata(codec);
1816 1816
1817 snd_soc_unregister_dai(&wm8903_dai); 1817 snd_soc_unregister_dai(&wm8903_dai);
1818 snd_soc_unregister_codec(codec); 1818 snd_soc_unregister_codec(codec);
@@ -1822,7 +1822,7 @@ static __devexit int wm8903_i2c_remove(struct i2c_client *client)
1822 if (client->irq) 1822 if (client->irq)
1823 free_irq(client->irq, priv); 1823 free_irq(client->irq, priv);
1824 1824
1825 kfree(codec->private_data); 1825 kfree(priv);
1826 1826
1827 wm8903_codec = NULL; 1827 wm8903_codec = NULL;
1828 wm8903_dai.dev = NULL; 1828 wm8903_dai.dev = NULL;