diff options
author | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2010-04-14 15:35:19 +0900 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2010-04-17 10:46:22 +0900 |
commit | b2c812e22de88bb79c290c0e718280f10b64a48d (patch) | |
tree | 4a5d967714cfb771db351cde525e6946897cca08 /sound/soc/codecs/cs4270.c | |
parent | 890c681275ab02623de1187f2d97fc355d76f372 (diff) | |
download | blackbird-op-linux-b2c812e22de88bb79c290c0e718280f10b64a48d.tar.gz blackbird-op-linux-b2c812e22de88bb79c290c0e718280f10b64a48d.zip |
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.c | 20 |
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, int clk_id, unsigned int freq, int dir) { struct snd_soc_codec *codec = codec_dai->codec; - struct cs4270_private *cs4270 = codec->private_data; + struct cs4270_private *cs4270 = snd_soc_codec_get_drvdata(codec); unsigned int rates = 0; unsigned int rate_min = -1; unsigned int rate_max = 0; @@ -269,7 +269,7 @@ static int cs4270_set_dai_fmt(struct snd_soc_dai *codec_dai, unsigned int format) { struct snd_soc_codec *codec = codec_dai->codec; - struct cs4270_private *cs4270 = codec->private_data; + struct cs4270_private *cs4270 = snd_soc_codec_get_drvdata(codec); int ret = 0; /* set DAI format */ @@ -411,7 +411,7 @@ static int cs4270_hw_params(struct snd_pcm_substream *substream, struct snd_soc_pcm_runtime *rtd = substream->private_data; struct snd_soc_device *socdev = rtd->socdev; struct snd_soc_codec *codec = socdev->card->codec; - struct cs4270_private *cs4270 = codec->private_data; + struct cs4270_private *cs4270 = snd_soc_codec_get_drvdata(codec); int ret; unsigned int i; unsigned int rate; @@ -490,7 +490,7 @@ static int cs4270_hw_params(struct snd_pcm_substream *substream, static int cs4270_dai_mute(struct snd_soc_dai *dai, int mute) { struct snd_soc_codec *codec = dai->codec; - struct cs4270_private *cs4270 = codec->private_data; + struct cs4270_private *cs4270 = snd_soc_codec_get_drvdata(codec); int reg6; reg6 = snd_soc_read(codec, CS4270_MUTE); @@ -523,7 +523,7 @@ static int cs4270_soc_put_mute(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); - struct cs4270_private *cs4270 = codec->private_data; + struct cs4270_private *cs4270 = snd_soc_codec_get_drvdata(codec); int left = !ucontrol->value.integer.value[0]; int right = !ucontrol->value.integer.value[1]; @@ -599,7 +599,7 @@ static int cs4270_probe(struct platform_device *pdev) { struct snd_soc_device *socdev = platform_get_drvdata(pdev); struct snd_soc_codec *codec = cs4270_codec; - struct cs4270_private *cs4270 = codec->private_data; + struct cs4270_private *cs4270 = snd_soc_codec_get_drvdata(codec); int i, ret; /* Connect the codec to the socdev. snd_soc_new_pcms() needs this. */ @@ -656,7 +656,7 @@ static int cs4270_remove(struct platform_device *pdev) { struct snd_soc_device *socdev = platform_get_drvdata(pdev); struct snd_soc_codec *codec = cs4270_codec; - struct cs4270_private *cs4270 = codec->private_data; + struct cs4270_private *cs4270 = snd_soc_codec_get_drvdata(codec); snd_soc_free_pcms(socdev); regulator_bulk_disable(ARRAY_SIZE(cs4270->supplies), cs4270->supplies); @@ -729,7 +729,7 @@ static int cs4270_i2c_probe(struct i2c_client *i2c_client, codec->owner = THIS_MODULE; codec->dai = &cs4270_dai; codec->num_dai = 1; - codec->private_data = cs4270; + snd_soc_codec_set_drvdata(codec, cs4270); codec->control_data = i2c_client; codec->read = cs4270_read_reg_cache; codec->write = cs4270_i2c_write; @@ -842,7 +842,7 @@ MODULE_DEVICE_TABLE(i2c, cs4270_id); static int cs4270_soc_suspend(struct platform_device *pdev, pm_message_t mesg) { struct snd_soc_codec *codec = cs4270_codec; - struct cs4270_private *cs4270 = codec->private_data; + struct cs4270_private *cs4270 = snd_soc_codec_get_drvdata(codec); int reg, ret; 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) static int cs4270_soc_resume(struct platform_device *pdev) { struct snd_soc_codec *codec = cs4270_codec; - struct cs4270_private *cs4270 = codec->private_data; + struct cs4270_private *cs4270 = snd_soc_codec_get_drvdata(codec); struct i2c_client *i2c_client = codec->control_data; int reg; |