aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/codecs/ssm2602.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/ssm2602.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/ssm2602.c')
-rw-r--r--sound/soc/codecs/ssm2602.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/sound/soc/codecs/ssm2602.c b/sound/soc/codecs/ssm2602.c
index 942f5dc30801..99ddec7df614 100644
--- a/sound/soc/codecs/ssm2602.c
+++ b/sound/soc/codecs/ssm2602.c
@@ -277,7 +277,7 @@ static int ssm2602_hw_params(struct snd_pcm_substream *substream,
277 struct snd_soc_pcm_runtime *rtd = substream->private_data; 277 struct snd_soc_pcm_runtime *rtd = substream->private_data;
278 struct snd_soc_device *socdev = rtd->socdev; 278 struct snd_soc_device *socdev = rtd->socdev;
279 struct snd_soc_codec *codec = socdev->card->codec; 279 struct snd_soc_codec *codec = socdev->card->codec;
280 struct ssm2602_priv *ssm2602 = codec->private_data; 280 struct ssm2602_priv *ssm2602 = snd_soc_codec_get_drvdata(codec);
281 struct i2c_client *i2c = codec->control_data; 281 struct i2c_client *i2c = codec->control_data;
282 u16 iface = ssm2602_read_reg_cache(codec, SSM2602_IFACE) & 0xfff3; 282 u16 iface = ssm2602_read_reg_cache(codec, SSM2602_IFACE) & 0xfff3;
283 int i = get_coeff(ssm2602->sysclk, params_rate(params)); 283 int i = get_coeff(ssm2602->sysclk, params_rate(params));
@@ -322,7 +322,7 @@ static int ssm2602_startup(struct snd_pcm_substream *substream,
322 struct snd_soc_pcm_runtime *rtd = substream->private_data; 322 struct snd_soc_pcm_runtime *rtd = substream->private_data;
323 struct snd_soc_device *socdev = rtd->socdev; 323 struct snd_soc_device *socdev = rtd->socdev;
324 struct snd_soc_codec *codec = socdev->card->codec; 324 struct snd_soc_codec *codec = socdev->card->codec;
325 struct ssm2602_priv *ssm2602 = codec->private_data; 325 struct ssm2602_priv *ssm2602 = snd_soc_codec_get_drvdata(codec);
326 struct i2c_client *i2c = codec->control_data; 326 struct i2c_client *i2c = codec->control_data;
327 struct snd_pcm_runtime *master_runtime; 327 struct snd_pcm_runtime *master_runtime;
328 328
@@ -373,7 +373,7 @@ static void ssm2602_shutdown(struct snd_pcm_substream *substream,
373 struct snd_soc_pcm_runtime *rtd = substream->private_data; 373 struct snd_soc_pcm_runtime *rtd = substream->private_data;
374 struct snd_soc_device *socdev = rtd->socdev; 374 struct snd_soc_device *socdev = rtd->socdev;
375 struct snd_soc_codec *codec = socdev->card->codec; 375 struct snd_soc_codec *codec = socdev->card->codec;
376 struct ssm2602_priv *ssm2602 = codec->private_data; 376 struct ssm2602_priv *ssm2602 = snd_soc_codec_get_drvdata(codec);
377 377
378 /* deactivate */ 378 /* deactivate */
379 if (!codec->active) 379 if (!codec->active)
@@ -401,7 +401,7 @@ static int ssm2602_set_dai_sysclk(struct snd_soc_dai *codec_dai,
401 int clk_id, unsigned int freq, int dir) 401 int clk_id, unsigned int freq, int dir)
402{ 402{
403 struct snd_soc_codec *codec = codec_dai->codec; 403 struct snd_soc_codec *codec = codec_dai->codec;
404 struct ssm2602_priv *ssm2602 = codec->private_data; 404 struct ssm2602_priv *ssm2602 = snd_soc_codec_get_drvdata(codec);
405 switch (freq) { 405 switch (freq) {
406 case 11289600: 406 case 11289600:
407 case 12000000: 407 case 12000000:
@@ -726,7 +726,7 @@ static int ssm2602_probe(struct platform_device *pdev)
726 return -ENOMEM; 726 return -ENOMEM;
727 } 727 }
728 728
729 codec->private_data = ssm2602; 729 snd_soc_codec_set_drvdata(codec, ssm2602);
730 socdev->card->codec = codec; 730 socdev->card->codec = codec;
731 mutex_init(&codec->mutex); 731 mutex_init(&codec->mutex);
732 INIT_LIST_HEAD(&codec->dapm_widgets); 732 INIT_LIST_HEAD(&codec->dapm_widgets);
@@ -759,7 +759,7 @@ static int ssm2602_remove(struct platform_device *pdev)
759 i2c_unregister_device(codec->control_data); 759 i2c_unregister_device(codec->control_data);
760 i2c_del_driver(&ssm2602_i2c_driver); 760 i2c_del_driver(&ssm2602_i2c_driver);
761#endif 761#endif
762 kfree(codec->private_data); 762 kfree(snd_soc_codec_get_drvdata(codec));
763 kfree(codec); 763 kfree(codec);
764 764
765 return 0; 765 return 0;