aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/codecs/wm8994.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/wm8994.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/wm8994.c')
-rw-r--r--sound/soc/codecs/wm8994.c34
1 files changed, 17 insertions, 17 deletions
diff --git a/sound/soc/codecs/wm8994.c b/sound/soc/codecs/wm8994.c
index e00201e0820e..29c4cfccd6b9 100644
--- a/sound/soc/codecs/wm8994.c
+++ b/sound/soc/codecs/wm8994.c
@@ -1703,7 +1703,7 @@ static int wm8994_volatile(unsigned int reg)
1703static int wm8994_write(struct snd_soc_codec *codec, unsigned int reg, 1703static int wm8994_write(struct snd_soc_codec *codec, unsigned int reg,
1704 unsigned int value) 1704 unsigned int value)
1705{ 1705{
1706 struct wm8994_priv *wm8994 = codec->private_data; 1706 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec);
1707 1707
1708 BUG_ON(reg > WM8994_MAX_REGISTER); 1708 BUG_ON(reg > WM8994_MAX_REGISTER);
1709 1709
@@ -1728,7 +1728,7 @@ static unsigned int wm8994_read(struct snd_soc_codec *codec,
1728 1728
1729static int configure_aif_clock(struct snd_soc_codec *codec, int aif) 1729static int configure_aif_clock(struct snd_soc_codec *codec, int aif)
1730{ 1730{
1731 struct wm8994_priv *wm8994 = codec->private_data; 1731 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec);
1732 int rate; 1732 int rate;
1733 int reg1 = 0; 1733 int reg1 = 0;
1734 int offset; 1734 int offset;
@@ -1780,7 +1780,7 @@ static int configure_aif_clock(struct snd_soc_codec *codec, int aif)
1780 1780
1781static int configure_clock(struct snd_soc_codec *codec) 1781static int configure_clock(struct snd_soc_codec *codec)
1782{ 1782{
1783 struct wm8994_priv *wm8994 = codec->private_data; 1783 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec);
1784 int old, new; 1784 int old, new;
1785 1785
1786 /* Bring up the AIF clocks first */ 1786 /* Bring up the AIF clocks first */
@@ -1877,7 +1877,7 @@ static int wm8994_put_drc_sw(struct snd_kcontrol *kcontrol,
1877 1877
1878static void wm8994_set_drc(struct snd_soc_codec *codec, int drc) 1878static void wm8994_set_drc(struct snd_soc_codec *codec, int drc)
1879{ 1879{
1880 struct wm8994_priv *wm8994 = codec->private_data; 1880 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec);
1881 struct wm8994_pdata *pdata = wm8994->pdata; 1881 struct wm8994_pdata *pdata = wm8994->pdata;
1882 int base = wm8994_drc_base[drc]; 1882 int base = wm8994_drc_base[drc];
1883 int cfg = wm8994->drc_cfg[drc]; 1883 int cfg = wm8994->drc_cfg[drc];
@@ -1913,7 +1913,7 @@ static int wm8994_put_drc_enum(struct snd_kcontrol *kcontrol,
1913 struct snd_ctl_elem_value *ucontrol) 1913 struct snd_ctl_elem_value *ucontrol)
1914{ 1914{
1915 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); 1915 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
1916 struct wm8994_priv *wm8994 = codec->private_data; 1916 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec);
1917 struct wm8994_pdata *pdata = wm8994->pdata; 1917 struct wm8994_pdata *pdata = wm8994->pdata;
1918 int drc = wm8994_get_drc(kcontrol->id.name); 1918 int drc = wm8994_get_drc(kcontrol->id.name);
1919 int value = ucontrol->value.integer.value[0]; 1919 int value = ucontrol->value.integer.value[0];
@@ -1935,7 +1935,7 @@ static int wm8994_get_drc_enum(struct snd_kcontrol *kcontrol,
1935 struct snd_ctl_elem_value *ucontrol) 1935 struct snd_ctl_elem_value *ucontrol)
1936{ 1936{
1937 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); 1937 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
1938 struct wm8994_priv *wm8994 = codec->private_data; 1938 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec);
1939 int drc = wm8994_get_drc(kcontrol->id.name); 1939 int drc = wm8994_get_drc(kcontrol->id.name);
1940 1940
1941 ucontrol->value.enumerated.item[0] = wm8994->drc_cfg[drc]; 1941 ucontrol->value.enumerated.item[0] = wm8994->drc_cfg[drc];
@@ -1945,7 +1945,7 @@ static int wm8994_get_drc_enum(struct snd_kcontrol *kcontrol,
1945 1945
1946static void wm8994_set_retune_mobile(struct snd_soc_codec *codec, int block) 1946static void wm8994_set_retune_mobile(struct snd_soc_codec *codec, int block)
1947{ 1947{
1948 struct wm8994_priv *wm8994 = codec->private_data; 1948 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec);
1949 struct wm8994_pdata *pdata = wm8994->pdata; 1949 struct wm8994_pdata *pdata = wm8994->pdata;
1950 int base = wm8994_retune_mobile_base[block]; 1950 int base = wm8994_retune_mobile_base[block];
1951 int iface, best, best_val, save, i, cfg; 1951 int iface, best, best_val, save, i, cfg;
@@ -2016,7 +2016,7 @@ static int wm8994_put_retune_mobile_enum(struct snd_kcontrol *kcontrol,
2016 struct snd_ctl_elem_value *ucontrol) 2016 struct snd_ctl_elem_value *ucontrol)
2017{ 2017{
2018 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); 2018 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
2019 struct wm8994_priv *wm8994 = codec->private_data; 2019 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec);
2020 struct wm8994_pdata *pdata = wm8994->pdata; 2020 struct wm8994_pdata *pdata = wm8994->pdata;
2021 int block = wm8994_get_retune_mobile_block(kcontrol->id.name); 2021 int block = wm8994_get_retune_mobile_block(kcontrol->id.name);
2022 int value = ucontrol->value.integer.value[0]; 2022 int value = ucontrol->value.integer.value[0];
@@ -2038,7 +2038,7 @@ static int wm8994_get_retune_mobile_enum(struct snd_kcontrol *kcontrol,
2038 struct snd_ctl_elem_value *ucontrol) 2038 struct snd_ctl_elem_value *ucontrol)
2039{ 2039{
2040 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); 2040 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
2041 struct wm8994_priv *wm8994 = codec->private_data; 2041 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec);
2042 int block = wm8994_get_retune_mobile_block(kcontrol->id.name); 2042 int block = wm8994_get_retune_mobile_block(kcontrol->id.name);
2043 2043
2044 ucontrol->value.enumerated.item[0] = wm8994->retune_mobile_cfg[block]; 2044 ucontrol->value.enumerated.item[0] = wm8994->retune_mobile_cfg[block];
@@ -2819,7 +2819,7 @@ static int wm8994_set_fll(struct snd_soc_dai *dai, int id, int src,
2819 unsigned int freq_in, unsigned int freq_out) 2819 unsigned int freq_in, unsigned int freq_out)
2820{ 2820{
2821 struct snd_soc_codec *codec = dai->codec; 2821 struct snd_soc_codec *codec = dai->codec;
2822 struct wm8994_priv *wm8994 = codec->private_data; 2822 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec);
2823 int reg_offset, ret; 2823 int reg_offset, ret;
2824 struct fll_div fll; 2824 struct fll_div fll;
2825 u16 reg, aif1, aif2; 2825 u16 reg, aif1, aif2;
@@ -2915,7 +2915,7 @@ static int wm8994_set_dai_sysclk(struct snd_soc_dai *dai,
2915 int clk_id, unsigned int freq, int dir) 2915 int clk_id, unsigned int freq, int dir)
2916{ 2916{
2917 struct snd_soc_codec *codec = dai->codec; 2917 struct snd_soc_codec *codec = dai->codec;
2918 struct wm8994_priv *wm8994 = codec->private_data; 2918 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec);
2919 2919
2920 switch (dai->id) { 2920 switch (dai->id) {
2921 case 1: 2921 case 1:
@@ -3181,7 +3181,7 @@ static int wm8994_hw_params(struct snd_pcm_substream *substream,
3181 struct snd_soc_dai *dai) 3181 struct snd_soc_dai *dai)
3182{ 3182{
3183 struct snd_soc_codec *codec = dai->codec; 3183 struct snd_soc_codec *codec = dai->codec;
3184 struct wm8994_priv *wm8994 = codec->private_data; 3184 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec);
3185 int aif1_reg; 3185 int aif1_reg;
3186 int bclk_reg; 3186 int bclk_reg;
3187 int lrclk_reg; 3187 int lrclk_reg;
@@ -3468,7 +3468,7 @@ static int wm8994_suspend(struct platform_device *pdev, pm_message_t state)
3468{ 3468{
3469 struct snd_soc_device *socdev = platform_get_drvdata(pdev); 3469 struct snd_soc_device *socdev = platform_get_drvdata(pdev);
3470 struct snd_soc_codec *codec = socdev->card->codec; 3470 struct snd_soc_codec *codec = socdev->card->codec;
3471 struct wm8994_priv *wm8994 = codec->private_data; 3471 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec);
3472 int i, ret; 3472 int i, ret;
3473 3473
3474 for (i = 0; i < ARRAY_SIZE(wm8994->fll); i++) { 3474 for (i = 0; i < ARRAY_SIZE(wm8994->fll); i++) {
@@ -3489,7 +3489,7 @@ static int wm8994_resume(struct platform_device *pdev)
3489{ 3489{
3490 struct snd_soc_device *socdev = platform_get_drvdata(pdev); 3490 struct snd_soc_device *socdev = platform_get_drvdata(pdev);
3491 struct snd_soc_codec *codec = socdev->card->codec; 3491 struct snd_soc_codec *codec = socdev->card->codec;
3492 struct wm8994_priv *wm8994 = codec->private_data; 3492 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec);
3493 u16 *reg_cache = codec->reg_cache; 3493 u16 *reg_cache = codec->reg_cache;
3494 int i, ret; 3494 int i, ret;
3495 3495
@@ -3684,7 +3684,7 @@ static int wm8994_probe(struct platform_device *pdev)
3684 return ret; 3684 return ret;
3685 } 3685 }
3686 3686
3687 wm8994_handle_pdata(codec->private_data); 3687 wm8994_handle_pdata(snd_soc_codec_get_drvdata(codec));
3688 3688
3689 wm_hubs_add_analogue_controls(codec); 3689 wm_hubs_add_analogue_controls(codec);
3690 snd_soc_add_controls(codec, wm8994_snd_controls, 3690 snd_soc_add_controls(codec, wm8994_snd_controls,
@@ -3735,7 +3735,7 @@ EXPORT_SYMBOL_GPL(soc_codec_dev_wm8994);
3735int wm8994_mic_detect(struct snd_soc_codec *codec, struct snd_soc_jack *jack, 3735int wm8994_mic_detect(struct snd_soc_codec *codec, struct snd_soc_jack *jack,
3736 int micbias, int det, int shrt) 3736 int micbias, int det, int shrt)
3737{ 3737{
3738 struct wm8994_priv *wm8994 = codec->private_data; 3738 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec);
3739 struct wm8994_micdet *micdet; 3739 struct wm8994_micdet *micdet;
3740 int reg; 3740 int reg;
3741 3741
@@ -3830,7 +3830,7 @@ static int wm8994_codec_probe(struct platform_device *pdev)
3830 INIT_LIST_HEAD(&codec->dapm_widgets); 3830 INIT_LIST_HEAD(&codec->dapm_widgets);
3831 INIT_LIST_HEAD(&codec->dapm_paths); 3831 INIT_LIST_HEAD(&codec->dapm_paths);
3832 3832
3833 codec->private_data = wm8994; 3833 snd_soc_codec_set_drvdata(codec, wm8994);
3834 codec->control_data = dev_get_drvdata(pdev->dev.parent); 3834 codec->control_data = dev_get_drvdata(pdev->dev.parent);
3835 codec->name = "WM8994"; 3835 codec->name = "WM8994";
3836 codec->owner = THIS_MODULE; 3836 codec->owner = THIS_MODULE;