aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/codecs/cs4270.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/cs4270.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/cs4270.c')
-rw-r--r--sound/soc/codecs/cs4270.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/sound/soc/codecs/cs4270.c b/sound/soc/codecs/cs4270.c
index dfbeb2db61b3..a7f09f33c560 100644
--- a/sound/soc/codecs/cs4270.c
+++ b/sound/soc/codecs/cs4270.c
@@ -210,7 +210,7 @@ static int cs4270_set_dai_sysclk(struct snd_soc_dai *codec_dai,
210 int clk_id, unsigned int freq, int dir) 210 int clk_id, unsigned int freq, int dir)
211{ 211{
212 struct snd_soc_codec *codec = codec_dai->codec; 212 struct snd_soc_codec *codec = codec_dai->codec;
213 struct cs4270_private *cs4270 = codec->private_data; 213 struct cs4270_private *cs4270 = snd_soc_codec_get_drvdata(codec);
214 unsigned int rates = 0; 214 unsigned int rates = 0;
215 unsigned int rate_min = -1; 215 unsigned int rate_min = -1;
216 unsigned int rate_max = 0; 216 unsigned int rate_max = 0;
@@ -269,7 +269,7 @@ static int cs4270_set_dai_fmt(struct snd_soc_dai *codec_dai,
269 unsigned int format) 269 unsigned int format)
270{ 270{
271 struct snd_soc_codec *codec = codec_dai->codec; 271 struct snd_soc_codec *codec = codec_dai->codec;
272 struct cs4270_private *cs4270 = codec->private_data; 272 struct cs4270_private *cs4270 = snd_soc_codec_get_drvdata(codec);
273 int ret = 0; 273 int ret = 0;
274 274
275 /* set DAI format */ 275 /* set DAI format */
@@ -411,7 +411,7 @@ static int cs4270_hw_params(struct snd_pcm_substream *substream,
411 struct snd_soc_pcm_runtime *rtd = substream->private_data; 411 struct snd_soc_pcm_runtime *rtd = substream->private_data;
412 struct snd_soc_device *socdev = rtd->socdev; 412 struct snd_soc_device *socdev = rtd->socdev;
413 struct snd_soc_codec *codec = socdev->card->codec; 413 struct snd_soc_codec *codec = socdev->card->codec;
414 struct cs4270_private *cs4270 = codec->private_data; 414 struct cs4270_private *cs4270 = snd_soc_codec_get_drvdata(codec);
415 int ret; 415 int ret;
416 unsigned int i; 416 unsigned int i;
417 unsigned int rate; 417 unsigned int rate;
@@ -490,7 +490,7 @@ static int cs4270_hw_params(struct snd_pcm_substream *substream,
490static int cs4270_dai_mute(struct snd_soc_dai *dai, int mute) 490static int cs4270_dai_mute(struct snd_soc_dai *dai, int mute)
491{ 491{
492 struct snd_soc_codec *codec = dai->codec; 492 struct snd_soc_codec *codec = dai->codec;
493 struct cs4270_private *cs4270 = codec->private_data; 493 struct cs4270_private *cs4270 = snd_soc_codec_get_drvdata(codec);
494 int reg6; 494 int reg6;
495 495
496 reg6 = snd_soc_read(codec, CS4270_MUTE); 496 reg6 = snd_soc_read(codec, CS4270_MUTE);
@@ -523,7 +523,7 @@ static int cs4270_soc_put_mute(struct snd_kcontrol *kcontrol,
523 struct snd_ctl_elem_value *ucontrol) 523 struct snd_ctl_elem_value *ucontrol)
524{ 524{
525 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); 525 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
526 struct cs4270_private *cs4270 = codec->private_data; 526 struct cs4270_private *cs4270 = snd_soc_codec_get_drvdata(codec);
527 int left = !ucontrol->value.integer.value[0]; 527 int left = !ucontrol->value.integer.value[0];
528 int right = !ucontrol->value.integer.value[1]; 528 int right = !ucontrol->value.integer.value[1];
529 529
@@ -599,7 +599,7 @@ static int cs4270_probe(struct platform_device *pdev)
599{ 599{
600 struct snd_soc_device *socdev = platform_get_drvdata(pdev); 600 struct snd_soc_device *socdev = platform_get_drvdata(pdev);
601 struct snd_soc_codec *codec = cs4270_codec; 601 struct snd_soc_codec *codec = cs4270_codec;
602 struct cs4270_private *cs4270 = codec->private_data; 602 struct cs4270_private *cs4270 = snd_soc_codec_get_drvdata(codec);
603 int i, ret; 603 int i, ret;
604 604
605 /* Connect the codec to the socdev. snd_soc_new_pcms() needs this. */ 605 /* Connect the codec to the socdev. snd_soc_new_pcms() needs this. */
@@ -656,7 +656,7 @@ static int cs4270_remove(struct platform_device *pdev)
656{ 656{
657 struct snd_soc_device *socdev = platform_get_drvdata(pdev); 657 struct snd_soc_device *socdev = platform_get_drvdata(pdev);
658 struct snd_soc_codec *codec = cs4270_codec; 658 struct snd_soc_codec *codec = cs4270_codec;
659 struct cs4270_private *cs4270 = codec->private_data; 659 struct cs4270_private *cs4270 = snd_soc_codec_get_drvdata(codec);
660 660
661 snd_soc_free_pcms(socdev); 661 snd_soc_free_pcms(socdev);
662 regulator_bulk_disable(ARRAY_SIZE(cs4270->supplies), cs4270->supplies); 662 regulator_bulk_disable(ARRAY_SIZE(cs4270->supplies), cs4270->supplies);
@@ -729,7 +729,7 @@ static int cs4270_i2c_probe(struct i2c_client *i2c_client,
729 codec->owner = THIS_MODULE; 729 codec->owner = THIS_MODULE;
730 codec->dai = &cs4270_dai; 730 codec->dai = &cs4270_dai;
731 codec->num_dai = 1; 731 codec->num_dai = 1;
732 codec->private_data = cs4270; 732 snd_soc_codec_set_drvdata(codec, cs4270);
733 codec->control_data = i2c_client; 733 codec->control_data = i2c_client;
734 codec->read = cs4270_read_reg_cache; 734 codec->read = cs4270_read_reg_cache;
735 codec->write = cs4270_i2c_write; 735 codec->write = cs4270_i2c_write;
@@ -842,7 +842,7 @@ MODULE_DEVICE_TABLE(i2c, cs4270_id);
842static int cs4270_soc_suspend(struct platform_device *pdev, pm_message_t mesg) 842static int cs4270_soc_suspend(struct platform_device *pdev, pm_message_t mesg)
843{ 843{
844 struct snd_soc_codec *codec = cs4270_codec; 844 struct snd_soc_codec *codec = cs4270_codec;
845 struct cs4270_private *cs4270 = codec->private_data; 845 struct cs4270_private *cs4270 = snd_soc_codec_get_drvdata(codec);
846 int reg, ret; 846 int reg, ret;
847 847
848 reg = snd_soc_read(codec, CS4270_PWRCTL) | CS4270_PWRCTL_PDN_ALL; 848 reg = snd_soc_read(codec, CS4270_PWRCTL) | CS4270_PWRCTL_PDN_ALL;
@@ -862,7 +862,7 @@ static int cs4270_soc_suspend(struct platform_device *pdev, pm_message_t mesg)
862static int cs4270_soc_resume(struct platform_device *pdev) 862static int cs4270_soc_resume(struct platform_device *pdev)
863{ 863{
864 struct snd_soc_codec *codec = cs4270_codec; 864 struct snd_soc_codec *codec = cs4270_codec;
865 struct cs4270_private *cs4270 = codec->private_data; 865 struct cs4270_private *cs4270 = snd_soc_codec_get_drvdata(codec);
866 struct i2c_client *i2c_client = codec->control_data; 866 struct i2c_client *i2c_client = codec->control_data;
867 int reg; 867 int reg;
868 868