aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/codecs/wm8904.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/wm8904.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/wm8904.c')
-rw-r--r--sound/soc/codecs/wm8904.c42
1 files changed, 21 insertions, 21 deletions
diff --git a/sound/soc/codecs/wm8904.c b/sound/soc/codecs/wm8904.c
index c5b50d73f2d5..a022ca7e7585 100644
--- a/sound/soc/codecs/wm8904.c
+++ b/sound/soc/codecs/wm8904.c
@@ -612,7 +612,7 @@ static int wm8904_reset(struct snd_soc_codec *codec)
612 612
613static int wm8904_configure_clocking(struct snd_soc_codec *codec) 613static int wm8904_configure_clocking(struct snd_soc_codec *codec)
614{ 614{
615 struct wm8904_priv *wm8904 = codec->private_data; 615 struct wm8904_priv *wm8904 = snd_soc_codec_get_drvdata(codec);
616 unsigned int clock0, clock2, rate; 616 unsigned int clock0, clock2, rate;
617 617
618 /* Gate the clock while we're updating to avoid misclocking */ 618 /* Gate the clock while we're updating to avoid misclocking */
@@ -668,7 +668,7 @@ static int wm8904_configure_clocking(struct snd_soc_codec *codec)
668 668
669static void wm8904_set_drc(struct snd_soc_codec *codec) 669static void wm8904_set_drc(struct snd_soc_codec *codec)
670{ 670{
671 struct wm8904_priv *wm8904 = codec->private_data; 671 struct wm8904_priv *wm8904 = snd_soc_codec_get_drvdata(codec);
672 struct wm8904_pdata *pdata = wm8904->pdata; 672 struct wm8904_pdata *pdata = wm8904->pdata;
673 int save, i; 673 int save, i;
674 674
@@ -688,7 +688,7 @@ static int wm8904_put_drc_enum(struct snd_kcontrol *kcontrol,
688 struct snd_ctl_elem_value *ucontrol) 688 struct snd_ctl_elem_value *ucontrol)
689{ 689{
690 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); 690 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
691 struct wm8904_priv *wm8904 = codec->private_data; 691 struct wm8904_priv *wm8904 = snd_soc_codec_get_drvdata(codec);
692 struct wm8904_pdata *pdata = wm8904->pdata; 692 struct wm8904_pdata *pdata = wm8904->pdata;
693 int value = ucontrol->value.integer.value[0]; 693 int value = ucontrol->value.integer.value[0];
694 694
@@ -706,7 +706,7 @@ static int wm8904_get_drc_enum(struct snd_kcontrol *kcontrol,
706 struct snd_ctl_elem_value *ucontrol) 706 struct snd_ctl_elem_value *ucontrol)
707{ 707{
708 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); 708 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
709 struct wm8904_priv *wm8904 = codec->private_data; 709 struct wm8904_priv *wm8904 = snd_soc_codec_get_drvdata(codec);
710 710
711 ucontrol->value.enumerated.item[0] = wm8904->drc_cfg; 711 ucontrol->value.enumerated.item[0] = wm8904->drc_cfg;
712 712
@@ -715,7 +715,7 @@ static int wm8904_get_drc_enum(struct snd_kcontrol *kcontrol,
715 715
716static void wm8904_set_retune_mobile(struct snd_soc_codec *codec) 716static void wm8904_set_retune_mobile(struct snd_soc_codec *codec)
717{ 717{
718 struct wm8904_priv *wm8904 = codec->private_data; 718 struct wm8904_priv *wm8904 = snd_soc_codec_get_drvdata(codec);
719 struct wm8904_pdata *pdata = wm8904->pdata; 719 struct wm8904_pdata *pdata = wm8904->pdata;
720 int best, best_val, save, i, cfg; 720 int best, best_val, save, i, cfg;
721 721
@@ -759,7 +759,7 @@ static int wm8904_put_retune_mobile_enum(struct snd_kcontrol *kcontrol,
759 struct snd_ctl_elem_value *ucontrol) 759 struct snd_ctl_elem_value *ucontrol)
760{ 760{
761 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); 761 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
762 struct wm8904_priv *wm8904 = codec->private_data; 762 struct wm8904_priv *wm8904 = snd_soc_codec_get_drvdata(codec);
763 struct wm8904_pdata *pdata = wm8904->pdata; 763 struct wm8904_pdata *pdata = wm8904->pdata;
764 int value = ucontrol->value.integer.value[0]; 764 int value = ucontrol->value.integer.value[0];
765 765
@@ -777,7 +777,7 @@ static int wm8904_get_retune_mobile_enum(struct snd_kcontrol *kcontrol,
777 struct snd_ctl_elem_value *ucontrol) 777 struct snd_ctl_elem_value *ucontrol)
778{ 778{
779 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); 779 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
780 struct wm8904_priv *wm8904 = codec->private_data; 780 struct wm8904_priv *wm8904 = snd_soc_codec_get_drvdata(codec);
781 781
782 ucontrol->value.enumerated.item[0] = wm8904->retune_mobile_cfg; 782 ucontrol->value.enumerated.item[0] = wm8904->retune_mobile_cfg;
783 783
@@ -788,7 +788,7 @@ static int deemph_settings[] = { 0, 32000, 44100, 48000 };
788 788
789static int wm8904_set_deemph(struct snd_soc_codec *codec) 789static int wm8904_set_deemph(struct snd_soc_codec *codec)
790{ 790{
791 struct wm8904_priv *wm8904 = codec->private_data; 791 struct wm8904_priv *wm8904 = snd_soc_codec_get_drvdata(codec);
792 int val, i, best; 792 int val, i, best;
793 793
794 /* If we're using deemphasis select the nearest available sample 794 /* If we're using deemphasis select the nearest available sample
@@ -817,7 +817,7 @@ static int wm8904_get_deemph(struct snd_kcontrol *kcontrol,
817 struct snd_ctl_elem_value *ucontrol) 817 struct snd_ctl_elem_value *ucontrol)
818{ 818{
819 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); 819 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
820 struct wm8904_priv *wm8904 = codec->private_data; 820 struct wm8904_priv *wm8904 = snd_soc_codec_get_drvdata(codec);
821 821
822 return wm8904->deemph; 822 return wm8904->deemph;
823} 823}
@@ -826,7 +826,7 @@ static int wm8904_put_deemph(struct snd_kcontrol *kcontrol,
826 struct snd_ctl_elem_value *ucontrol) 826 struct snd_ctl_elem_value *ucontrol)
827{ 827{
828 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); 828 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
829 struct wm8904_priv *wm8904 = codec->private_data; 829 struct wm8904_priv *wm8904 = snd_soc_codec_get_drvdata(codec);
830 int deemph = ucontrol->value.enumerated.item[0]; 830 int deemph = ucontrol->value.enumerated.item[0];
831 831
832 if (deemph > 1) 832 if (deemph > 1)
@@ -942,7 +942,7 @@ static int sysclk_event(struct snd_soc_dapm_widget *w,
942 struct snd_kcontrol *kcontrol, int event) 942 struct snd_kcontrol *kcontrol, int event)
943{ 943{
944 struct snd_soc_codec *codec = w->codec; 944 struct snd_soc_codec *codec = w->codec;
945 struct wm8904_priv *wm8904 = codec->private_data; 945 struct wm8904_priv *wm8904 = snd_soc_codec_get_drvdata(codec);
946 946
947 switch (event) { 947 switch (event) {
948 case SND_SOC_DAPM_PRE_PMU: 948 case SND_SOC_DAPM_PRE_PMU:
@@ -980,7 +980,7 @@ static int out_pga_event(struct snd_soc_dapm_widget *w,
980 struct snd_kcontrol *kcontrol, int event) 980 struct snd_kcontrol *kcontrol, int event)
981{ 981{
982 struct snd_soc_codec *codec = w->codec; 982 struct snd_soc_codec *codec = w->codec;
983 struct wm8904_priv *wm8904 = codec->private_data; 983 struct wm8904_priv *wm8904 = snd_soc_codec_get_drvdata(codec);
984 int reg, val; 984 int reg, val;
985 int dcs_mask; 985 int dcs_mask;
986 int dcs_l, dcs_r; 986 int dcs_l, dcs_r;
@@ -1428,7 +1428,7 @@ static const struct snd_soc_dapm_route wm8912_intercon[] = {
1428 1428
1429static int wm8904_add_widgets(struct snd_soc_codec *codec) 1429static int wm8904_add_widgets(struct snd_soc_codec *codec)
1430{ 1430{
1431 struct wm8904_priv *wm8904 = codec->private_data; 1431 struct wm8904_priv *wm8904 = snd_soc_codec_get_drvdata(codec);
1432 1432
1433 snd_soc_dapm_new_controls(codec, wm8904_core_dapm_widgets, 1433 snd_soc_dapm_new_controls(codec, wm8904_core_dapm_widgets,
1434 ARRAY_SIZE(wm8904_core_dapm_widgets)); 1434 ARRAY_SIZE(wm8904_core_dapm_widgets));
@@ -1542,7 +1542,7 @@ static int wm8904_hw_params(struct snd_pcm_substream *substream,
1542 struct snd_soc_dai *dai) 1542 struct snd_soc_dai *dai)
1543{ 1543{
1544 struct snd_soc_codec *codec = dai->codec; 1544 struct snd_soc_codec *codec = dai->codec;
1545 struct wm8904_priv *wm8904 = codec->private_data; 1545 struct wm8904_priv *wm8904 = snd_soc_codec_get_drvdata(codec);
1546 int ret, i, best, best_val, cur_val; 1546 int ret, i, best, best_val, cur_val;
1547 unsigned int aif1 = 0; 1547 unsigned int aif1 = 0;
1548 unsigned int aif2 = 0; 1548 unsigned int aif2 = 0;
@@ -1669,7 +1669,7 @@ static int wm8904_set_sysclk(struct snd_soc_dai *dai, int clk_id,
1669 unsigned int freq, int dir) 1669 unsigned int freq, int dir)
1670{ 1670{
1671 struct snd_soc_codec *codec = dai->codec; 1671 struct snd_soc_codec *codec = dai->codec;
1672 struct wm8904_priv *priv = codec->private_data; 1672 struct wm8904_priv *priv = snd_soc_codec_get_drvdata(codec);
1673 1673
1674 switch (clk_id) { 1674 switch (clk_id) {
1675 case WM8904_CLK_MCLK: 1675 case WM8904_CLK_MCLK:
@@ -1785,7 +1785,7 @@ static int wm8904_set_tdm_slot(struct snd_soc_dai *dai, unsigned int tx_mask,
1785 unsigned int rx_mask, int slots, int slot_width) 1785 unsigned int rx_mask, int slots, int slot_width)
1786{ 1786{
1787 struct snd_soc_codec *codec = dai->codec; 1787 struct snd_soc_codec *codec = dai->codec;
1788 struct wm8904_priv *wm8904 = codec->private_data; 1788 struct wm8904_priv *wm8904 = snd_soc_codec_get_drvdata(codec);
1789 int aif1 = 0; 1789 int aif1 = 0;
1790 1790
1791 /* Don't need to validate anything if we're turning off TDM */ 1791 /* Don't need to validate anything if we're turning off TDM */
@@ -1942,7 +1942,7 @@ static int wm8904_set_fll(struct snd_soc_dai *dai, int fll_id, int source,
1942 unsigned int Fref, unsigned int Fout) 1942 unsigned int Fref, unsigned int Fout)
1943{ 1943{
1944 struct snd_soc_codec *codec = dai->codec; 1944 struct snd_soc_codec *codec = dai->codec;
1945 struct wm8904_priv *wm8904 = codec->private_data; 1945 struct wm8904_priv *wm8904 = snd_soc_codec_get_drvdata(codec);
1946 struct _fll_div fll_div; 1946 struct _fll_div fll_div;
1947 int ret, val; 1947 int ret, val;
1948 int clock2, fll1; 1948 int clock2, fll1;
@@ -2094,7 +2094,7 @@ static int wm8904_digital_mute(struct snd_soc_dai *codec_dai, int mute)
2094 2094
2095static void wm8904_sync_cache(struct snd_soc_codec *codec) 2095static void wm8904_sync_cache(struct snd_soc_codec *codec)
2096{ 2096{
2097 struct wm8904_priv *wm8904 = codec->private_data; 2097 struct wm8904_priv *wm8904 = snd_soc_codec_get_drvdata(codec);
2098 int i; 2098 int i;
2099 2099
2100 if (!codec->cache_sync) 2100 if (!codec->cache_sync)
@@ -2121,7 +2121,7 @@ static void wm8904_sync_cache(struct snd_soc_codec *codec)
2121static int wm8904_set_bias_level(struct snd_soc_codec *codec, 2121static int wm8904_set_bias_level(struct snd_soc_codec *codec,
2122 enum snd_soc_bias_level level) 2122 enum snd_soc_bias_level level)
2123{ 2123{
2124 struct wm8904_priv *wm8904 = codec->private_data; 2124 struct wm8904_priv *wm8904 = snd_soc_codec_get_drvdata(codec);
2125 int ret; 2125 int ret;
2126 2126
2127 switch (level) { 2127 switch (level) {
@@ -2394,7 +2394,7 @@ static int wm8904_probe(struct platform_device *pdev)
2394 goto pcm_err; 2394 goto pcm_err;
2395 } 2395 }
2396 2396
2397 wm8904_handle_pdata(codec->private_data); 2397 wm8904_handle_pdata(snd_soc_codec_get_drvdata(codec));
2398 2398
2399 wm8904_add_widgets(codec); 2399 wm8904_add_widgets(codec);
2400 2400
@@ -2439,7 +2439,7 @@ static int wm8904_register(struct wm8904_priv *wm8904,
2439 INIT_LIST_HEAD(&codec->dapm_widgets); 2439 INIT_LIST_HEAD(&codec->dapm_widgets);
2440 INIT_LIST_HEAD(&codec->dapm_paths); 2440 INIT_LIST_HEAD(&codec->dapm_paths);
2441 2441
2442 codec->private_data = wm8904; 2442 snd_soc_codec_set_drvdata(codec, wm8904);
2443 codec->name = "WM8904"; 2443 codec->name = "WM8904";
2444 codec->owner = THIS_MODULE; 2444 codec->owner = THIS_MODULE;
2445 codec->bias_level = SND_SOC_BIAS_OFF; 2445 codec->bias_level = SND_SOC_BIAS_OFF;