]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commitdiff
ASoC: wm_hubs: Move CODEC stored in private data into wm_hubs
authorMark Brown <broonie@opensource.wolfsonmicro.com>
Wed, 25 Jul 2012 17:10:03 +0000 (18:10 +0100)
committerMark Brown <broonie@opensource.wolfsonmicro.com>
Fri, 3 Aug 2012 22:03:56 +0000 (23:03 +0100)
Further wm_hubs code will use this.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
sound/soc/codecs/wm8958-dsp2.c
sound/soc/codecs/wm8994.c
sound/soc/codecs/wm8994.h
sound/soc/codecs/wm_hubs.c
sound/soc/codecs/wm_hubs.h

index 1332692ef81bc9628e8cad04ccf65cd972c7fb8c..00121ba3659718ab4c4af6ff5135373762de4765 100644 (file)
@@ -946,7 +946,7 @@ void wm8958_dsp2_init(struct snd_soc_codec *codec)
                wm8994->mbc_texts = kmalloc(sizeof(char *)
                                            * pdata->num_mbc_cfgs, GFP_KERNEL);
                if (!wm8994->mbc_texts) {
-                       dev_err(wm8994->codec->dev,
+                       dev_err(wm8994->hubs.codec->dev,
                                "Failed to allocate %d MBC config texts\n",
                                pdata->num_mbc_cfgs);
                        return;
@@ -958,9 +958,10 @@ void wm8958_dsp2_init(struct snd_soc_codec *codec)
                wm8994->mbc_enum.max = pdata->num_mbc_cfgs;
                wm8994->mbc_enum.texts = wm8994->mbc_texts;
 
-               ret = snd_soc_add_codec_controls(wm8994->codec, control, 1);
+               ret = snd_soc_add_codec_controls(wm8994->hubs.codec,
+                                                control, 1);
                if (ret != 0)
-                       dev_err(wm8994->codec->dev,
+                       dev_err(wm8994->hubs.codec->dev,
                                "Failed to add MBC mode controls: %d\n", ret);
        }
 
@@ -974,7 +975,7 @@ void wm8958_dsp2_init(struct snd_soc_codec *codec)
                wm8994->vss_texts = kmalloc(sizeof(char *)
                                            * pdata->num_vss_cfgs, GFP_KERNEL);
                if (!wm8994->vss_texts) {
-                       dev_err(wm8994->codec->dev,
+                       dev_err(wm8994->hubs.codec->dev,
                                "Failed to allocate %d VSS config texts\n",
                                pdata->num_vss_cfgs);
                        return;
@@ -986,9 +987,10 @@ void wm8958_dsp2_init(struct snd_soc_codec *codec)
                wm8994->vss_enum.max = pdata->num_vss_cfgs;
                wm8994->vss_enum.texts = wm8994->vss_texts;
 
-               ret = snd_soc_add_codec_controls(wm8994->codec, control, 1);
+               ret = snd_soc_add_codec_controls(wm8994->hubs.codec,
+                                                control, 1);
                if (ret != 0)
-                       dev_err(wm8994->codec->dev,
+                       dev_err(wm8994->hubs.codec->dev,
                                "Failed to add VSS mode controls: %d\n", ret);
        }
 
@@ -1003,7 +1005,7 @@ void wm8958_dsp2_init(struct snd_soc_codec *codec)
                wm8994->vss_hpf_texts = kmalloc(sizeof(char *)
                                                * pdata->num_vss_hpf_cfgs, GFP_KERNEL);
                if (!wm8994->vss_hpf_texts) {
-                       dev_err(wm8994->codec->dev,
+                       dev_err(wm8994->hubs.codec->dev,
                                "Failed to allocate %d VSS HPF config texts\n",
                                pdata->num_vss_hpf_cfgs);
                        return;
@@ -1015,9 +1017,10 @@ void wm8958_dsp2_init(struct snd_soc_codec *codec)
                wm8994->vss_hpf_enum.max = pdata->num_vss_hpf_cfgs;
                wm8994->vss_hpf_enum.texts = wm8994->vss_hpf_texts;
 
-               ret = snd_soc_add_codec_controls(wm8994->codec, control, 1);
+               ret = snd_soc_add_codec_controls(wm8994->hubs.codec,
+                                                control, 1);
                if (ret != 0)
-                       dev_err(wm8994->codec->dev,
+                       dev_err(wm8994->hubs.codec->dev,
                                "Failed to add VSS HPFmode controls: %d\n",
                                ret);
        }
@@ -1033,7 +1036,7 @@ void wm8958_dsp2_init(struct snd_soc_codec *codec)
                wm8994->enh_eq_texts = kmalloc(sizeof(char *)
                                                * pdata->num_enh_eq_cfgs, GFP_KERNEL);
                if (!wm8994->enh_eq_texts) {
-                       dev_err(wm8994->codec->dev,
+                       dev_err(wm8994->hubs.codec->dev,
                                "Failed to allocate %d enhanced EQ config texts\n",
                                pdata->num_enh_eq_cfgs);
                        return;
@@ -1045,9 +1048,10 @@ void wm8958_dsp2_init(struct snd_soc_codec *codec)
                wm8994->enh_eq_enum.max = pdata->num_enh_eq_cfgs;
                wm8994->enh_eq_enum.texts = wm8994->enh_eq_texts;
 
-               ret = snd_soc_add_codec_controls(wm8994->codec, control, 1);
+               ret = snd_soc_add_codec_controls(wm8994->hubs.codec,
+                                                control, 1);
                if (ret != 0)
-                       dev_err(wm8994->codec->dev,
+                       dev_err(wm8994->hubs.codec->dev,
                                "Failed to add enhanced EQ controls: %d\n",
                                ret);
        }
index 2c9b8b7fdf3d07970e0c6fcb3a694e1d1ac1c18e..1237c11c8c35b6538a60bb8ca55cda3b35ef2f28 100644 (file)
@@ -3036,7 +3036,7 @@ static int wm8994_codec_resume(struct snd_soc_codec *codec)
 
 static void wm8994_handle_retune_mobile_pdata(struct wm8994_priv *wm8994)
 {
-       struct snd_soc_codec *codec = wm8994->codec;
+       struct snd_soc_codec *codec = wm8994->hubs.codec;
        struct wm8994_pdata *pdata = wm8994->pdata;
        struct snd_kcontrol_new controls[] = {
                SOC_ENUM_EXT("AIF1.1 EQ Mode",
@@ -3094,16 +3094,16 @@ static void wm8994_handle_retune_mobile_pdata(struct wm8994_priv *wm8994)
        wm8994->retune_mobile_enum.max = wm8994->num_retune_mobile_texts;
        wm8994->retune_mobile_enum.texts = wm8994->retune_mobile_texts;
 
-       ret = snd_soc_add_codec_controls(wm8994->codec, controls,
+       ret = snd_soc_add_codec_controls(wm8994->hubs.codec, controls,
                                   ARRAY_SIZE(controls));
        if (ret != 0)
-               dev_err(wm8994->codec->dev,
+               dev_err(wm8994->hubs.codec->dev,
                        "Failed to add ReTune Mobile controls: %d\n", ret);
 }
 
 static void wm8994_handle_pdata(struct wm8994_priv *wm8994)
 {
-       struct snd_soc_codec *codec = wm8994->codec;
+       struct snd_soc_codec *codec = wm8994->hubs.codec;
        struct wm8994_pdata *pdata = wm8994->pdata;
        int ret, i;
 
@@ -3132,10 +3132,10 @@ static void wm8994_handle_pdata(struct wm8994_priv *wm8994)
                };
 
                /* We need an array of texts for the enum API */
-               wm8994->drc_texts = devm_kzalloc(wm8994->codec->dev,
+               wm8994->drc_texts = devm_kzalloc(wm8994->hubs.codec->dev,
                            sizeof(char *) * pdata->num_drc_cfgs, GFP_KERNEL);
                if (!wm8994->drc_texts) {
-                       dev_err(wm8994->codec->dev,
+                       dev_err(wm8994->hubs.codec->dev,
                                "Failed to allocate %d DRC config texts\n",
                                pdata->num_drc_cfgs);
                        return;
@@ -3147,10 +3147,10 @@ static void wm8994_handle_pdata(struct wm8994_priv *wm8994)
                wm8994->drc_enum.max = pdata->num_drc_cfgs;
                wm8994->drc_enum.texts = wm8994->drc_texts;
 
-               ret = snd_soc_add_codec_controls(wm8994->codec, controls,
+               ret = snd_soc_add_codec_controls(wm8994->hubs.codec, controls,
                                           ARRAY_SIZE(controls));
                if (ret != 0)
-                       dev_err(wm8994->codec->dev,
+                       dev_err(wm8994->hubs.codec->dev,
                                "Failed to add DRC mode controls: %d\n", ret);
 
                for (i = 0; i < WM8994_NUM_DRC; i++)
@@ -3163,7 +3163,7 @@ static void wm8994_handle_pdata(struct wm8994_priv *wm8994)
        if (pdata->num_retune_mobile_cfgs)
                wm8994_handle_retune_mobile_pdata(wm8994);
        else
-               snd_soc_add_codec_controls(wm8994->codec, wm8994_eq_controls,
+               snd_soc_add_codec_controls(wm8994->hubs.codec, wm8994_eq_controls,
                                     ARRAY_SIZE(wm8994_eq_controls));
 
        for (i = 0; i < ARRAY_SIZE(pdata->micbias); i++) {
@@ -3318,7 +3318,7 @@ static void wm8994_mic_work(struct work_struct *work)
 static irqreturn_t wm8994_mic_irq(int irq, void *data)
 {
        struct wm8994_priv *priv = data;
-       struct snd_soc_codec *codec = priv->codec;
+       struct snd_soc_codec *codec = priv->hubs.codec;
 
 #ifndef CONFIG_SND_SOC_WM8994_MODULE
        trace_snd_soc_jack_irq(dev_name(codec->dev));
@@ -3431,7 +3431,7 @@ static void wm8958_default_micdet(u16 status, void *data)
 static irqreturn_t wm1811_jackdet_irq(int irq, void *data)
 {
        struct wm8994_priv *wm8994 = data;
-       struct snd_soc_codec *codec = wm8994->codec;
+       struct snd_soc_codec *codec = wm8994->hubs.codec;
        int reg;
        bool present;
 
@@ -3609,7 +3609,7 @@ EXPORT_SYMBOL_GPL(wm8958_mic_detect);
 static irqreturn_t wm8958_mic_irq(int irq, void *data)
 {
        struct wm8994_priv *wm8994 = data;
-       struct snd_soc_codec *codec = wm8994->codec;
+       struct snd_soc_codec *codec = wm8994->hubs.codec;
        int reg, count;
 
        /*
@@ -3699,13 +3699,11 @@ static int wm8994_codec_probe(struct snd_soc_codec *codec)
        unsigned int reg;
        int ret, i;
 
-       wm8994->codec = codec;
+       wm8994->hubs.codec = codec;
        codec->control_data = control->regmap;
 
        snd_soc_codec_set_cache_io(codec, 16, 16, SND_SOC_REGMAP);
 
-       wm8994->codec = codec;
-
        mutex_init(&wm8994->accdet_lock);
        INIT_DELAYED_WORK(&wm8994->mic_work, wm8994_mic_work);
 
index 19068d8fa3016ebf893ddd0bca3be9bdec346d22..e6d8209b8f29bfaac9f194a323800e8f692b69c1 100644 (file)
@@ -73,7 +73,6 @@ struct wm8994;
 struct wm8994_priv {
        struct wm_hubs_data hubs;
        struct wm8994 *wm8994;
-       struct snd_soc_codec *codec;
        int sysclk[2];
        int sysclk_rate[2];
        int mclk[2];
index 61baa48823cba20a7b8696824f333cb82bad2a1e..728a18010a49073b75945d251aebca5151530987 100644 (file)
@@ -1112,6 +1112,8 @@ int wm_hubs_add_analogue_routes(struct snd_soc_codec *codec,
        struct wm_hubs_data *hubs = snd_soc_codec_get_drvdata(codec);
        struct snd_soc_dapm_context *dapm = &codec->dapm;
 
+       hubs->codec = codec;
+
        INIT_LIST_HEAD(&hubs->dcs_cache);
        init_completion(&hubs->dcs_done);
 
index da2dc899ce6d58df7a4f34bd6f589ead6e4b2f3f..a5a09e6f87d56a466815e3ca3ef93e6027f7c42e 100644 (file)
@@ -46,6 +46,8 @@ struct wm_hubs_data {
 
        bool dcs_done_irq;
        struct completion dcs_done;
+
+       struct snd_soc_codec *codec;
 };
 
 extern int wm_hubs_add_analogue_controls(struct snd_soc_codec *);