aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/codecs/wm9081.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/wm9081.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/wm9081.c')
-rw-r--r--sound/soc/codecs/wm9081.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/sound/soc/codecs/wm9081.c b/sound/soc/codecs/wm9081.c
index c468497314ba..87a87487d3f9 100644
--- a/sound/soc/codecs/wm9081.c
+++ b/sound/soc/codecs/wm9081.c
@@ -520,7 +520,7 @@ static int fll_factors(struct _fll_div *fll_div, unsigned int Fref,
520static int wm9081_set_fll(struct snd_soc_codec *codec, int fll_id, 520static int wm9081_set_fll(struct snd_soc_codec *codec, int fll_id,
521 unsigned int Fref, unsigned int Fout) 521 unsigned int Fref, unsigned int Fout)
522{ 522{
523 struct wm9081_priv *wm9081 = codec->private_data; 523 struct wm9081_priv *wm9081 = snd_soc_codec_get_drvdata(codec);
524 u16 reg1, reg4, reg5; 524 u16 reg1, reg4, reg5;
525 struct _fll_div fll_div; 525 struct _fll_div fll_div;
526 int ret; 526 int ret;
@@ -606,7 +606,7 @@ static int wm9081_set_fll(struct snd_soc_codec *codec, int fll_id,
606 606
607static int configure_clock(struct snd_soc_codec *codec) 607static int configure_clock(struct snd_soc_codec *codec)
608{ 608{
609 struct wm9081_priv *wm9081 = codec->private_data; 609 struct wm9081_priv *wm9081 = snd_soc_codec_get_drvdata(codec);
610 int new_sysclk, i, target; 610 int new_sysclk, i, target;
611 unsigned int reg; 611 unsigned int reg;
612 int ret = 0; 612 int ret = 0;
@@ -701,7 +701,7 @@ static int clk_sys_event(struct snd_soc_dapm_widget *w,
701 struct snd_kcontrol *kcontrol, int event) 701 struct snd_kcontrol *kcontrol, int event)
702{ 702{
703 struct snd_soc_codec *codec = w->codec; 703 struct snd_soc_codec *codec = w->codec;
704 struct wm9081_priv *wm9081 = codec->private_data; 704 struct wm9081_priv *wm9081 = snd_soc_codec_get_drvdata(codec);
705 705
706 /* This should be done on init() for bypass paths */ 706 /* This should be done on init() for bypass paths */
707 switch (wm9081->sysclk_source) { 707 switch (wm9081->sysclk_source) {
@@ -872,7 +872,7 @@ static int wm9081_set_dai_fmt(struct snd_soc_dai *dai,
872 unsigned int fmt) 872 unsigned int fmt)
873{ 873{
874 struct snd_soc_codec *codec = dai->codec; 874 struct snd_soc_codec *codec = dai->codec;
875 struct wm9081_priv *wm9081 = codec->private_data; 875 struct wm9081_priv *wm9081 = snd_soc_codec_get_drvdata(codec);
876 unsigned int aif2 = snd_soc_read(codec, WM9081_AUDIO_INTERFACE_2); 876 unsigned int aif2 = snd_soc_read(codec, WM9081_AUDIO_INTERFACE_2);
877 877
878 aif2 &= ~(WM9081_AIF_BCLK_INV | WM9081_AIF_LRCLK_INV | 878 aif2 &= ~(WM9081_AIF_BCLK_INV | WM9081_AIF_LRCLK_INV |
@@ -964,7 +964,7 @@ static int wm9081_hw_params(struct snd_pcm_substream *substream,
964 struct snd_soc_dai *dai) 964 struct snd_soc_dai *dai)
965{ 965{
966 struct snd_soc_codec *codec = dai->codec; 966 struct snd_soc_codec *codec = dai->codec;
967 struct wm9081_priv *wm9081 = codec->private_data; 967 struct wm9081_priv *wm9081 = snd_soc_codec_get_drvdata(codec);
968 int ret, i, best, best_val, cur_val; 968 int ret, i, best, best_val, cur_val;
969 unsigned int clk_ctrl2, aif1, aif2, aif3, aif4; 969 unsigned int clk_ctrl2, aif1, aif2, aif3, aif4;
970 970
@@ -1138,7 +1138,7 @@ static int wm9081_set_sysclk(struct snd_soc_dai *codec_dai,
1138 int clk_id, unsigned int freq, int dir) 1138 int clk_id, unsigned int freq, int dir)
1139{ 1139{
1140 struct snd_soc_codec *codec = codec_dai->codec; 1140 struct snd_soc_codec *codec = codec_dai->codec;
1141 struct wm9081_priv *wm9081 = codec->private_data; 1141 struct wm9081_priv *wm9081 = snd_soc_codec_get_drvdata(codec);
1142 1142
1143 switch (clk_id) { 1143 switch (clk_id) {
1144 case WM9081_SYSCLK_MCLK: 1144 case WM9081_SYSCLK_MCLK:
@@ -1158,7 +1158,7 @@ static int wm9081_set_tdm_slot(struct snd_soc_dai *dai,
1158 unsigned int tx_mask, unsigned int rx_mask, int slots, int slot_width) 1158 unsigned int tx_mask, unsigned int rx_mask, int slots, int slot_width)
1159{ 1159{
1160 struct snd_soc_codec *codec = dai->codec; 1160 struct snd_soc_codec *codec = dai->codec;
1161 struct wm9081_priv *wm9081 = codec->private_data; 1161 struct wm9081_priv *wm9081 = snd_soc_codec_get_drvdata(codec);
1162 unsigned int aif1 = snd_soc_read(codec, WM9081_AUDIO_INTERFACE_1); 1162 unsigned int aif1 = snd_soc_read(codec, WM9081_AUDIO_INTERFACE_1);
1163 1163
1164 aif1 &= ~(WM9081_AIFDAC_TDM_SLOT_MASK | WM9081_AIFDAC_TDM_MODE_MASK); 1164 aif1 &= ~(WM9081_AIFDAC_TDM_SLOT_MASK | WM9081_AIFDAC_TDM_MODE_MASK);
@@ -1241,7 +1241,7 @@ static int wm9081_probe(struct platform_device *pdev)
1241 1241
1242 socdev->card->codec = wm9081_codec; 1242 socdev->card->codec = wm9081_codec;
1243 codec = wm9081_codec; 1243 codec = wm9081_codec;
1244 wm9081 = codec->private_data; 1244 wm9081 = snd_soc_codec_get_drvdata(codec);
1245 1245
1246 /* register pcms */ 1246 /* register pcms */
1247 ret = snd_soc_new_pcms(socdev, SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1); 1247 ret = snd_soc_new_pcms(socdev, SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1);
@@ -1338,7 +1338,7 @@ static int wm9081_register(struct wm9081_priv *wm9081,
1338 INIT_LIST_HEAD(&codec->dapm_widgets); 1338 INIT_LIST_HEAD(&codec->dapm_widgets);
1339 INIT_LIST_HEAD(&codec->dapm_paths); 1339 INIT_LIST_HEAD(&codec->dapm_paths);
1340 1340
1341 codec->private_data = wm9081; 1341 snd_soc_codec_set_drvdata(codec, wm9081);
1342 codec->name = "WM9081"; 1342 codec->name = "WM9081";
1343 codec->owner = THIS_MODULE; 1343 codec->owner = THIS_MODULE;
1344 codec->dai = &wm9081_dai; 1344 codec->dai = &wm9081_dai;