aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/codecs/wm8993.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/wm8993.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/wm8993.c')
-rw-r--r--sound/soc/codecs/wm8993.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/sound/soc/codecs/wm8993.c b/sound/soc/codecs/wm8993.c
index bf022f68b84f..e739c5008b1b 100644
--- a/sound/soc/codecs/wm8993.c
+++ b/sound/soc/codecs/wm8993.c
@@ -370,7 +370,7 @@ static int wm8993_set_fll(struct snd_soc_dai *dai, int fll_id, int source,
370 unsigned int Fref, unsigned int Fout) 370 unsigned int Fref, unsigned int Fout)
371{ 371{
372 struct snd_soc_codec *codec = dai->codec; 372 struct snd_soc_codec *codec = dai->codec;
373 struct wm8993_priv *wm8993 = codec->private_data; 373 struct wm8993_priv *wm8993 = snd_soc_codec_get_drvdata(codec);
374 u16 reg1, reg4, reg5; 374 u16 reg1, reg4, reg5;
375 struct _fll_div fll_div; 375 struct _fll_div fll_div;
376 int ret; 376 int ret;
@@ -457,7 +457,7 @@ static int wm8993_set_fll(struct snd_soc_dai *dai, int fll_id, int source,
457 457
458static int configure_clock(struct snd_soc_codec *codec) 458static int configure_clock(struct snd_soc_codec *codec)
459{ 459{
460 struct wm8993_priv *wm8993 = codec->private_data; 460 struct wm8993_priv *wm8993 = snd_soc_codec_get_drvdata(codec);
461 unsigned int reg; 461 unsigned int reg;
462 462
463 /* This should be done on init() for bypass paths */ 463 /* This should be done on init() for bypass paths */
@@ -716,7 +716,7 @@ static int class_w_put(struct snd_kcontrol *kcontrol,
716{ 716{
717 struct snd_soc_dapm_widget *widget = snd_kcontrol_chip(kcontrol); 717 struct snd_soc_dapm_widget *widget = snd_kcontrol_chip(kcontrol);
718 struct snd_soc_codec *codec = widget->codec; 718 struct snd_soc_codec *codec = widget->codec;
719 struct wm8993_priv *wm8993 = codec->private_data; 719 struct wm8993_priv *wm8993 = snd_soc_codec_get_drvdata(codec);
720 int ret; 720 int ret;
721 721
722 /* Turn it off if we're using the main output mixer */ 722 /* Turn it off if we're using the main output mixer */
@@ -948,7 +948,7 @@ static void wm8993_cache_restore(struct snd_soc_codec *codec)
948static int wm8993_set_bias_level(struct snd_soc_codec *codec, 948static int wm8993_set_bias_level(struct snd_soc_codec *codec,
949 enum snd_soc_bias_level level) 949 enum snd_soc_bias_level level)
950{ 950{
951 struct wm8993_priv *wm8993 = codec->private_data; 951 struct wm8993_priv *wm8993 = snd_soc_codec_get_drvdata(codec);
952 int ret; 952 int ret;
953 953
954 switch (level) { 954 switch (level) {
@@ -1046,7 +1046,7 @@ static int wm8993_set_sysclk(struct snd_soc_dai *codec_dai,
1046 int clk_id, unsigned int freq, int dir) 1046 int clk_id, unsigned int freq, int dir)
1047{ 1047{
1048 struct snd_soc_codec *codec = codec_dai->codec; 1048 struct snd_soc_codec *codec = codec_dai->codec;
1049 struct wm8993_priv *wm8993 = codec->private_data; 1049 struct wm8993_priv *wm8993 = snd_soc_codec_get_drvdata(codec);
1050 1050
1051 switch (clk_id) { 1051 switch (clk_id) {
1052 case WM8993_SYSCLK_MCLK: 1052 case WM8993_SYSCLK_MCLK:
@@ -1066,7 +1066,7 @@ static int wm8993_set_dai_fmt(struct snd_soc_dai *dai,
1066 unsigned int fmt) 1066 unsigned int fmt)
1067{ 1067{
1068 struct snd_soc_codec *codec = dai->codec; 1068 struct snd_soc_codec *codec = dai->codec;
1069 struct wm8993_priv *wm8993 = codec->private_data; 1069 struct wm8993_priv *wm8993 = snd_soc_codec_get_drvdata(codec);
1070 unsigned int aif1 = snd_soc_read(codec, WM8993_AUDIO_INTERFACE_1); 1070 unsigned int aif1 = snd_soc_read(codec, WM8993_AUDIO_INTERFACE_1);
1071 unsigned int aif4 = snd_soc_read(codec, WM8993_AUDIO_INTERFACE_4); 1071 unsigned int aif4 = snd_soc_read(codec, WM8993_AUDIO_INTERFACE_4);
1072 1072
@@ -1162,7 +1162,7 @@ static int wm8993_hw_params(struct snd_pcm_substream *substream,
1162 struct snd_soc_dai *dai) 1162 struct snd_soc_dai *dai)
1163{ 1163{
1164 struct snd_soc_codec *codec = dai->codec; 1164 struct snd_soc_codec *codec = dai->codec;
1165 struct wm8993_priv *wm8993 = codec->private_data; 1165 struct wm8993_priv *wm8993 = snd_soc_codec_get_drvdata(codec);
1166 int ret, i, best, best_val, cur_val; 1166 int ret, i, best, best_val, cur_val;
1167 unsigned int clocking1, clocking3, aif1, aif4; 1167 unsigned int clocking1, clocking3, aif1, aif4;
1168 1168
@@ -1327,7 +1327,7 @@ static int wm8993_set_tdm_slot(struct snd_soc_dai *dai, unsigned int tx_mask,
1327 unsigned int rx_mask, int slots, int slot_width) 1327 unsigned int rx_mask, int slots, int slot_width)
1328{ 1328{
1329 struct snd_soc_codec *codec = dai->codec; 1329 struct snd_soc_codec *codec = dai->codec;
1330 struct wm8993_priv *wm8993 = codec->private_data; 1330 struct wm8993_priv *wm8993 = snd_soc_codec_get_drvdata(codec);
1331 int aif1 = 0; 1331 int aif1 = 0;
1332 int aif2 = 0; 1332 int aif2 = 0;
1333 1333
@@ -1430,7 +1430,7 @@ static int wm8993_probe(struct platform_device *pdev)
1430 1430
1431 socdev->card->codec = wm8993_codec; 1431 socdev->card->codec = wm8993_codec;
1432 codec = wm8993_codec; 1432 codec = wm8993_codec;
1433 wm8993 = codec->private_data; 1433 wm8993 = snd_soc_codec_get_drvdata(codec);
1434 1434
1435 ret = snd_soc_new_pcms(socdev, SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1); 1435 ret = snd_soc_new_pcms(socdev, SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1);
1436 if (ret < 0) { 1436 if (ret < 0) {
@@ -1477,7 +1477,7 @@ static int wm8993_suspend(struct platform_device *pdev, pm_message_t state)
1477{ 1477{
1478 struct snd_soc_device *socdev = platform_get_drvdata(pdev); 1478 struct snd_soc_device *socdev = platform_get_drvdata(pdev);
1479 struct snd_soc_codec *codec = socdev->card->codec; 1479 struct snd_soc_codec *codec = socdev->card->codec;
1480 struct wm8993_priv *wm8993 = codec->private_data; 1480 struct wm8993_priv *wm8993 = snd_soc_codec_get_drvdata(codec);
1481 int fll_fout = wm8993->fll_fout; 1481 int fll_fout = wm8993->fll_fout;
1482 int fll_fref = wm8993->fll_fref; 1482 int fll_fref = wm8993->fll_fref;
1483 int ret; 1483 int ret;
@@ -1501,7 +1501,7 @@ static int wm8993_resume(struct platform_device *pdev)
1501{ 1501{
1502 struct snd_soc_device *socdev = platform_get_drvdata(pdev); 1502 struct snd_soc_device *socdev = platform_get_drvdata(pdev);
1503 struct snd_soc_codec *codec = socdev->card->codec; 1503 struct snd_soc_codec *codec = socdev->card->codec;
1504 struct wm8993_priv *wm8993 = codec->private_data; 1504 struct wm8993_priv *wm8993 = snd_soc_codec_get_drvdata(codec);
1505 int ret; 1505 int ret;
1506 1506
1507 wm8993_set_bias_level(codec, SND_SOC_BIAS_STANDBY); 1507 wm8993_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
@@ -1570,7 +1570,7 @@ static int wm8993_i2c_probe(struct i2c_client *i2c,
1570 codec->set_bias_level = wm8993_set_bias_level; 1570 codec->set_bias_level = wm8993_set_bias_level;
1571 codec->dai = &wm8993_dai; 1571 codec->dai = &wm8993_dai;
1572 codec->num_dai = 1; 1572 codec->num_dai = 1;
1573 codec->private_data = wm8993; 1573 snd_soc_codec_set_drvdata(codec, wm8993);
1574 1574
1575 wm8993->hubs_data.hp_startup_mode = 1; 1575 wm8993->hubs_data.hp_startup_mode = 1;
1576 wm8993->hubs_data.dcs_codes = -2; 1576 wm8993->hubs_data.dcs_codes = -2;