ASoC: core: Add support for DAI and machine kcontrols.
Liam Girdwood [Fri, 3 Feb 2012 17:43:09 +0000 (17:43 +0000)]
Currently ASoC can only add kcontrols using codec and platform component device
handles. It's also desirable to add kcontrols for DAIs (i.e. McBSP) and for
SoC card machine drivers too. This allows the kcontrol to have a direct handle to
the parent ASoC component DAI/SoC Card/Platform/Codec device and hence easily
get it's private data.

This change makes snd_soc_add_controls() static and wraps it in the folowing
calls (card and dai are new) :-

snd_soc_add_card_controls()
snd_soc_add_codec_controls()
snd_soc_add_dai_controls()
snd_soc_add_platform_controls()

This patch also does a lot of small mechanical changes in individual codec drivers
to replace snd_soc_add_controls() with snd_soc_add_codec_controls().

It also updates the McBSP DAI driver to use snd_soc_add_dai_controls().

Finally, it updates the existing machine drivers that register controls to either :-

1) Use snd_soc_add_card_controls() where no direct codec control is required.
2) Use snd_soc_add_codec_controls() where there is direct codec control.

In the case of 1) above we also update the machine drivers to get the correct
component data pointers from the kcontrol (rather than getting the machine pointer
via the codec pointer).

Signed-off-by: Liam Girdwood <lrg@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>

60 files changed:
include/sound/soc.h
sound/soc/codecs/ad1836.c
sound/soc/codecs/ad1980.c
sound/soc/codecs/adau1373.c
sound/soc/codecs/ak4535.c
sound/soc/codecs/ak4642.c
sound/soc/codecs/ak4671.c
sound/soc/codecs/alc5623.c
sound/soc/codecs/alc5632.c
sound/soc/codecs/cq93vc.c
sound/soc/codecs/cs4270.c
sound/soc/codecs/cs4271.c
sound/soc/codecs/lm4857.c
sound/soc/codecs/max98088.c
sound/soc/codecs/max98095.c
sound/soc/codecs/max9877.c
sound/soc/codecs/sn95031.c
sound/soc/codecs/ssm2602.c
sound/soc/codecs/stac9766.c
sound/soc/codecs/tlv320aic23.c
sound/soc/codecs/tlv320aic26.c
sound/soc/codecs/tlv320aic32x4.c
sound/soc/codecs/tlv320aic3x.c
sound/soc/codecs/tlv320dac33.c
sound/soc/codecs/tpa6130a2.c
sound/soc/codecs/uda134x.c
sound/soc/codecs/wl1273.c
sound/soc/codecs/wm8737.c
sound/soc/codecs/wm8770.c
sound/soc/codecs/wm8904.c
sound/soc/codecs/wm8940.c
sound/soc/codecs/wm8958-dsp2.c
sound/soc/codecs/wm8960.c
sound/soc/codecs/wm8961.c
sound/soc/codecs/wm8962.c
sound/soc/codecs/wm8990.c
sound/soc/codecs/wm8991.c
sound/soc/codecs/wm8993.c
sound/soc/codecs/wm8994.c
sound/soc/codecs/wm8995.c
sound/soc/codecs/wm8996.c
sound/soc/codecs/wm9081.c
sound/soc/codecs/wm9090.c
sound/soc/codecs/wm9705.c
sound/soc/codecs/wm9712.c
sound/soc/codecs/wm9713.c
sound/soc/codecs/wm_hubs.c
sound/soc/mid-x86/mfld_machine.c
sound/soc/omap/ams-delta.c
sound/soc/omap/n810.c
sound/soc/omap/omap-mcbsp.c
sound/soc/omap/omap-mcbsp.h
sound/soc/omap/rx51.c
sound/soc/pxa/corgi.c
sound/soc/pxa/magician.c
sound/soc/pxa/poodle.c
sound/soc/pxa/tosa.c
sound/soc/samsung/neo1973_wm8753.c
sound/soc/samsung/s3c24xx_simtec.c
sound/soc/soc-core.c

index 2f687ed..9348bed 100644 (file)
@@ -368,10 +368,14 @@ void snd_soc_free_ac97_codec(struct snd_soc_codec *codec);
 struct snd_kcontrol *snd_soc_cnew(const struct snd_kcontrol_new *_template,
                                  void *data, char *long_name,
                                  const char *prefix);
-int snd_soc_add_controls(struct snd_soc_codec *codec,
+int snd_soc_add_codec_controls(struct snd_soc_codec *codec,
        const struct snd_kcontrol_new *controls, int num_controls);
 int snd_soc_add_platform_controls(struct snd_soc_platform *platform,
        const struct snd_kcontrol_new *controls, int num_controls);
+int snd_soc_add_card_controls(struct snd_soc_card *soc_card,
+       const struct snd_kcontrol_new *controls, int num_controls);
+int snd_soc_add_dai_controls(struct snd_soc_dai *dai,
+       const struct snd_kcontrol_new *controls, int num_controls);
 int snd_soc_info_enum_double(struct snd_kcontrol *kcontrol,
        struct snd_ctl_elem_info *uinfo);
 int snd_soc_info_enum_ext(struct snd_kcontrol *kcontrol,
index 982d201..12e3b41 100644 (file)
@@ -277,7 +277,7 @@ static int ad1836_probe(struct snd_soc_codec *codec)
        if (ad1836->type == AD1836) {
                /* left/right diff:PGA/MUX */
                snd_soc_write(codec, AD1836_ADC_CTRL3, 0x3A);
-               ret = snd_soc_add_controls(codec, ad1836_controls,
+               ret = snd_soc_add_codec_controls(codec, ad1836_controls,
                                ARRAY_SIZE(ad1836_controls));
                if (ret)
                        return ret;
@@ -285,11 +285,11 @@ static int ad1836_probe(struct snd_soc_codec *codec)
                snd_soc_write(codec, AD1836_ADC_CTRL3, 0x00);
        }
 
-       ret = snd_soc_add_controls(codec, ad183x_dac_controls, num_dacs * 2);
+       ret = snd_soc_add_codec_controls(codec, ad183x_dac_controls, num_dacs * 2);
        if (ret)
                return ret;
 
-       ret = snd_soc_add_controls(codec, ad183x_adc_controls, num_adcs);
+       ret = snd_soc_add_codec_controls(codec, ad183x_adc_controls, num_adcs);
        if (ret)
                return ret;
 
index 9bba7f8..8c39ddd 100644 (file)
@@ -228,7 +228,7 @@ static int ad1980_soc_probe(struct snd_soc_codec *codec)
        ext_status = ac97_read(codec, AC97_EXTENDED_STATUS);
        ac97_write(codec, AC97_EXTENDED_STATUS, ext_status&~0x3800);
 
-       snd_soc_add_controls(codec, ad1980_snd_ac97_controls,
+       snd_soc_add_codec_controls(codec, ad1980_snd_ac97_controls,
                                ARRAY_SIZE(ad1980_snd_ac97_controls));
 
        return 0;
index facda33..44f5906 100644 (file)
@@ -1257,7 +1257,7 @@ static int adau1373_probe(struct snd_soc_codec *codec)
                                pdata->drc_setting[i]);
                }
 
-               snd_soc_add_controls(codec, adau1373_drc_controls,
+               snd_soc_add_codec_controls(codec, adau1373_drc_controls,
                        pdata->num_drc);
 
                val = 0;
@@ -1282,7 +1282,7 @@ static int adau1373_probe(struct snd_soc_codec *codec)
        }
 
        if (!lineout_differential) {
-               snd_soc_add_controls(codec, adau1373_lineout2_controls,
+               snd_soc_add_codec_controls(codec, adau1373_lineout2_controls,
                        ARRAY_SIZE(adau1373_lineout2_controls));
        }
 
index 9e809e0..dd15516 100644 (file)
@@ -382,7 +382,7 @@ static int ak4535_probe(struct snd_soc_codec *codec)
        /* power on device */
        ak4535_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
 
-       snd_soc_add_controls(codec, ak4535_snd_controls,
+       snd_soc_add_codec_controls(codec, ak4535_snd_controls,
                                ARRAY_SIZE(ak4535_snd_controls));
        return 0;
 }
index 5ef70b5..16bd1e7 100644 (file)
@@ -476,7 +476,7 @@ static int ak4642_probe(struct snd_soc_codec *codec)
                return ret;
        }
 
-       snd_soc_add_controls(codec, ak4642_snd_controls,
+       snd_soc_add_codec_controls(codec, ak4642_snd_controls,
                             ARRAY_SIZE(ak4642_snd_controls));
 
        ak4642_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
index a53b152..5fb7c2a 100644 (file)
@@ -628,7 +628,7 @@ static int ak4671_probe(struct snd_soc_codec *codec)
                return ret;
        }
 
-       snd_soc_add_controls(codec, ak4671_snd_controls,
+       snd_soc_add_codec_controls(codec, ak4671_snd_controls,
                             ARRAY_SIZE(ak4671_snd_controls));
 
        ak4671_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
index 08f2419..d47b62d 100644 (file)
@@ -925,22 +925,22 @@ static int alc5623_probe(struct snd_soc_codec *codec)
 
        switch (alc5623->id) {
        case 0x21:
-               snd_soc_add_controls(codec, alc5621_vol_snd_controls,
+               snd_soc_add_codec_controls(codec, alc5621_vol_snd_controls,
                        ARRAY_SIZE(alc5621_vol_snd_controls));
                break;
        case 0x22:
-               snd_soc_add_controls(codec, alc5622_vol_snd_controls,
+               snd_soc_add_codec_controls(codec, alc5622_vol_snd_controls,
                        ARRAY_SIZE(alc5622_vol_snd_controls));
                break;
        case 0x23:
-               snd_soc_add_controls(codec, alc5623_vol_snd_controls,
+               snd_soc_add_codec_controls(codec, alc5623_vol_snd_controls,
                        ARRAY_SIZE(alc5623_vol_snd_controls));
                break;
        default:
                return -EINVAL;
        }
 
-       snd_soc_add_controls(codec, alc5623_snd_controls,
+       snd_soc_add_codec_controls(codec, alc5623_snd_controls,
                        ARRAY_SIZE(alc5623_snd_controls));
 
        snd_soc_dapm_new_controls(dapm, alc5623_dapm_widgets,
index af9c27a..f69fb42 100644 (file)
@@ -994,7 +994,7 @@ static int alc5632_probe(struct snd_soc_codec *codec)
 
        switch (alc5632->id) {
        case 0x5c:
-               snd_soc_add_controls(codec, alc5632_vol_snd_controls,
+               snd_soc_add_codec_controls(codec, alc5632_vol_snd_controls,
                        ARRAY_SIZE(alc5632_vol_snd_controls));
                break;
        default:
index 06d2ea1..064cd6a 100644 (file)
@@ -157,7 +157,7 @@ static int cq93vc_probe(struct snd_soc_codec *codec)
        codec->control_data = davinci_vc;
 
        /* Set controls */
-       snd_soc_add_controls(codec, cq93vc_snd_controls,
+       snd_soc_add_codec_controls(codec, cq93vc_snd_controls,
                             ARRAY_SIZE(cq93vc_snd_controls));
 
        /* Off, with power on */
index 0555366..6baccd2 100644 (file)
@@ -521,7 +521,7 @@ static int cs4270_probe(struct snd_soc_codec *codec)
        }
 
        /* Add the non-DAPM controls */
-       ret = snd_soc_add_controls(codec, cs4270_snd_controls,
+       ret = snd_soc_add_codec_controls(codec, cs4270_snd_controls,
                                ARRAY_SIZE(cs4270_snd_controls));
        if (ret < 0) {
                dev_err(codec->dev, "failed to add controls\n");
index f6fe846..bf71412 100644 (file)
@@ -513,7 +513,7 @@ static int cs4271_probe(struct snd_soc_codec *codec)
        /* Power-up sequence requires 85 uS */
        udelay(85);
 
-       return snd_soc_add_controls(codec, cs4271_snd_controls,
+       return snd_soc_add_codec_controls(codec, cs4271_snd_controls,
                ARRAY_SIZE(cs4271_snd_controls));
 }
 
index 3190392..ba4fafb 100644 (file)
@@ -179,7 +179,7 @@ static int lm4857_probe(struct snd_soc_codec *codec)
 
        codec->control_data = lm4857->i2c;
 
-       ret = snd_soc_add_controls(codec, lm4857_controls,
+       ret = snd_soc_add_codec_controls(codec, lm4857_controls,
                        ARRAY_SIZE(lm4857_controls));
        if (ret)
                return ret;
index 006efcf..af7324b 100644 (file)
@@ -1908,7 +1908,7 @@ static void max98088_handle_eq_pdata(struct snd_soc_codec *codec)
        max98088->eq_enum.texts = max98088->eq_texts;
        max98088->eq_enum.max = max98088->eq_textcnt;
 
-       ret = snd_soc_add_controls(codec, controls, ARRAY_SIZE(controls));
+       ret = snd_soc_add_codec_controls(codec, controls, ARRAY_SIZE(controls));
        if (ret != 0)
                dev_err(codec->dev, "Failed to add EQ control: %d\n", ret);
 }
@@ -2030,7 +2030,7 @@ static int max98088_probe(struct snd_soc_codec *codec)
 
        max98088_handle_pdata(codec);
 
-       snd_soc_add_controls(codec, max98088_snd_controls,
+       snd_soc_add_codec_controls(codec, max98088_snd_controls,
                             ARRAY_SIZE(max98088_snd_controls));
 
 err_access:
index fcfa749..0bb511a 100644 (file)
@@ -1284,7 +1284,7 @@ static const struct snd_soc_dapm_route max98095_audio_map[] = {
 
 static int max98095_add_widgets(struct snd_soc_codec *codec)
 {
-       snd_soc_add_controls(codec, max98095_snd_controls,
+       snd_soc_add_codec_controls(codec, max98095_snd_controls,
                             ARRAY_SIZE(max98095_snd_controls));
 
        return 0;
@@ -1984,7 +1984,7 @@ static void max98095_handle_eq_pdata(struct snd_soc_codec *codec)
        max98095->eq_enum.texts = max98095->eq_texts;
        max98095->eq_enum.max = max98095->eq_textcnt;
 
-       ret = snd_soc_add_controls(codec, controls, ARRAY_SIZE(controls));
+       ret = snd_soc_add_codec_controls(codec, controls, ARRAY_SIZE(controls));
        if (ret != 0)
                dev_err(codec->dev, "Failed to add EQ control: %d\n", ret);
 }
@@ -2139,7 +2139,7 @@ static void max98095_handle_bq_pdata(struct snd_soc_codec *codec)
        max98095->bq_enum.texts = max98095->bq_texts;
        max98095->bq_enum.max = max98095->bq_textcnt;
 
-       ret = snd_soc_add_controls(codec, controls, ARRAY_SIZE(controls));
+       ret = snd_soc_add_codec_controls(codec, controls, ARRAY_SIZE(controls));
        if (ret != 0)
                dev_err(codec->dev, "Failed to add Biquad control: %d\n", ret);
 }
index dcf6f2a..3a2ba3d 100644 (file)
@@ -253,7 +253,7 @@ static const struct snd_kcontrol_new max9877_controls[] = {
 /* This function is called from ASoC machine driver */
 int max9877_add_controls(struct snd_soc_codec *codec)
 {
-       return snd_soc_add_controls(codec, max9877_controls,
+       return snd_soc_add_codec_controls(codec, max9877_controls,
                        ARRAY_SIZE(max9877_controls));
 }
 EXPORT_SYMBOL_GPL(max9877_add_controls);
index aa03923..50dbdb9 100644 (file)
@@ -869,7 +869,7 @@ static int sn95031_codec_probe(struct snd_soc_codec *codec)
        snd_soc_write(codec, SN95031_SSR2, 0x10);
        snd_soc_write(codec, SN95031_SSR3, 0x40);
 
-       snd_soc_add_controls(codec, sn95031_snd_controls,
+       snd_soc_add_codec_controls(codec, sn95031_snd_controls,
                             ARRAY_SIZE(sn95031_snd_controls));
 
        return 0;
index 333dd98..de2b205 100644 (file)
@@ -548,7 +548,7 @@ static int ssm2602_probe(struct snd_soc_codec *codec)
        snd_soc_update_bits(codec, SSM2602_ROUT1V,
                            ROUT1V_RLHP_BOTH, ROUT1V_RLHP_BOTH);
 
-       ret = snd_soc_add_controls(codec, ssm2602_snd_controls,
+       ret = snd_soc_add_codec_controls(codec, ssm2602_snd_controls,
                        ARRAY_SIZE(ssm2602_snd_controls));
        if (ret)
                return ret;
index cc0566c..982e437 100644 (file)
@@ -355,7 +355,7 @@ static int stac9766_codec_probe(struct snd_soc_codec *codec)
 
        stac9766_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
 
-       snd_soc_add_controls(codec, stac9766_snd_ac97_controls,
+       snd_soc_add_codec_controls(codec, stac9766_snd_ac97_controls,
                             ARRAY_SIZE(stac9766_snd_ac97_controls));
 
        return 0;
index dfa41a9..16d55f9 100644 (file)
@@ -593,7 +593,7 @@ static int tlv320aic23_probe(struct snd_soc_codec *codec)
 
        snd_soc_write(codec, TLV320AIC23_ACTIVE, 0x1);
 
-       snd_soc_add_controls(codec, tlv320aic23_snd_controls,
+       snd_soc_add_codec_controls(codec, tlv320aic23_snd_controls,
                                ARRAY_SIZE(tlv320aic23_snd_controls));
 
        return 0;
index a038dae..802064b 100644 (file)
@@ -389,7 +389,7 @@ static int aic26_probe(struct snd_soc_codec *codec)
 
        /* register controls */
        dev_dbg(codec->dev, "Registering controls\n");
-       err = snd_soc_add_controls(codec, aic26_snd_controls,
+       err = snd_soc_add_codec_controls(codec, aic26_snd_controls,
                        ARRAY_SIZE(aic26_snd_controls));
        WARN_ON(err < 0);
 
index 372b0b8..b0a73d3 100644 (file)
@@ -671,7 +671,7 @@ static int aic32x4_probe(struct snd_soc_codec *codec)
        }
 
        aic32x4_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
-       snd_soc_add_controls(codec, aic32x4_snd_controls,
+       snd_soc_add_codec_controls(codec, aic32x4_snd_controls,
                             ARRAY_SIZE(aic32x4_snd_controls));
        aic32x4_add_widgets(codec);
 
index 285b7a2..0bb7cb8 100644 (file)
@@ -1425,10 +1425,10 @@ static int aic3x_probe(struct snd_soc_codec *codec)
                              (aic3x->setup->gpio_func[1] & 0xf) << 4);
        }
 
-       snd_soc_add_controls(codec, aic3x_snd_controls,
+       snd_soc_add_codec_controls(codec, aic3x_snd_controls,
                             ARRAY_SIZE(aic3x_snd_controls));
        if (aic3x->model == AIC3X_MODEL_3007)
-               snd_soc_add_controls(codec, &aic3x_classd_amp_gain_ctrl, 1);
+               snd_soc_add_codec_controls(codec, &aic3x_classd_amp_gain_ctrl, 1);
 
        aic3x_add_widgets(codec);
        list_add(&aic3x->list, &reset_list);
index 2c957c8..4587ddd 100644 (file)
@@ -1437,7 +1437,7 @@ static int dac33_soc_probe(struct snd_soc_codec *codec)
 
        /* Only add the FIFO controls, if we have valid IRQ number */
        if (dac33->irq >= 0)
-               snd_soc_add_controls(codec, dac33_mode_snd_controls,
+               snd_soc_add_codec_controls(codec, dac33_mode_snd_controls,
                                     ARRAY_SIZE(dac33_mode_snd_controls));
 
 err_power:
index 363b99d..6fe4aa3 100644 (file)
@@ -351,10 +351,10 @@ int tpa6130a2_add_controls(struct snd_soc_codec *codec)
        data = i2c_get_clientdata(tpa6130a2_client);
 
        if (data->id == TPA6140A2)
-               return snd_soc_add_controls(codec, tpa6140a2_controls,
+               return snd_soc_add_codec_controls(codec, tpa6140a2_controls,
                                                ARRAY_SIZE(tpa6140a2_controls));
        else
-               return snd_soc_add_controls(codec, tpa6130a2_controls,
+               return snd_soc_add_codec_controls(codec, tpa6130a2_controls,
                                                ARRAY_SIZE(tpa6130a2_controls));
 }
 EXPORT_SYMBOL_GPL(tpa6130a2_add_controls);
index 8f4f469..797b0dd 100644 (file)
@@ -531,15 +531,15 @@ static int uda134x_soc_probe(struct snd_soc_codec *codec)
        switch (pd->model) {
        case UDA134X_UDA1340:
        case UDA134X_UDA1344:
-               ret = snd_soc_add_controls(codec, uda1340_snd_controls,
+               ret = snd_soc_add_codec_controls(codec, uda1340_snd_controls,
                                        ARRAY_SIZE(uda1340_snd_controls));
        break;
        case UDA134X_UDA1341:
-               ret = snd_soc_add_controls(codec, uda1341_snd_controls,
+               ret = snd_soc_add_codec_controls(codec, uda1341_snd_controls,
                                        ARRAY_SIZE(uda1341_snd_controls));
        break;
        case UDA134X_UDA1345:
-               ret = snd_soc_add_controls(codec, uda1345_snd_controls,
+               ret = snd_soc_add_codec_controls(codec, uda1345_snd_controls,
                                        ARRAY_SIZE(uda1345_snd_controls));
        break;
        default:
index 44aacf9..3d868dc 100644 (file)
@@ -464,7 +464,7 @@ static int wl1273_probe(struct snd_soc_codec *codec)
 
        snd_soc_codec_set_drvdata(codec, wl1273);
 
-       r = snd_soc_add_controls(codec, wl1273_controls,
+       r = snd_soc_add_codec_controls(codec, wl1273_controls,
                                 ARRAY_SIZE(wl1273_controls));
        if (r)
                kfree(wl1273);
index ff95e62..4fe9d19 100644 (file)
@@ -599,7 +599,7 @@ static int wm8737_probe(struct snd_soc_codec *codec)
        /* Bias level configuration will have done an extra enable */
        regulator_bulk_disable(ARRAY_SIZE(wm8737->supplies), wm8737->supplies);
 
-       snd_soc_add_controls(codec, wm8737_snd_controls,
+       snd_soc_add_codec_controls(codec, wm8737_snd_controls,
                             ARRAY_SIZE(wm8737_snd_controls));
        wm8737_add_widgets(codec);
 
index bd60f84..a5127b4 100644 (file)
@@ -641,7 +641,7 @@ static int wm8770_probe(struct snd_soc_codec *codec)
        /* mute all DACs */
        snd_soc_update_bits(codec, WM8770_DACMUTE, 0x10, 0x10);
 
-       snd_soc_add_controls(codec, wm8770_snd_controls,
+       snd_soc_add_codec_controls(codec, wm8770_snd_controls,
                             ARRAY_SIZE(wm8770_snd_controls));
        snd_soc_dapm_new_controls(&codec->dapm, wm8770_dapm_widgets,
                                  ARRAY_SIZE(wm8770_dapm_widgets));
index 37079ea..65d525d 100644 (file)
@@ -1176,11 +1176,11 @@ static int wm8904_add_widgets(struct snd_soc_codec *codec)
 
        switch (wm8904->devtype) {
        case WM8904:
-               snd_soc_add_controls(codec, wm8904_adc_snd_controls,
+               snd_soc_add_codec_controls(codec, wm8904_adc_snd_controls,
                                     ARRAY_SIZE(wm8904_adc_snd_controls));
-               snd_soc_add_controls(codec, wm8904_dac_snd_controls,
+               snd_soc_add_codec_controls(codec, wm8904_dac_snd_controls,
                                     ARRAY_SIZE(wm8904_dac_snd_controls));
-               snd_soc_add_controls(codec, wm8904_snd_controls,
+               snd_soc_add_codec_controls(codec, wm8904_snd_controls,
                                     ARRAY_SIZE(wm8904_snd_controls));
 
                snd_soc_dapm_new_controls(dapm, wm8904_adc_dapm_widgets,
@@ -1201,7 +1201,7 @@ static int wm8904_add_widgets(struct snd_soc_codec *codec)
                break;
 
        case WM8912:
-               snd_soc_add_controls(codec, wm8904_dac_snd_controls,
+               snd_soc_add_codec_controls(codec, wm8904_dac_snd_controls,
                                     ARRAY_SIZE(wm8904_dac_snd_controls));
 
                snd_soc_dapm_new_controls(dapm, wm8904_dac_dapm_widgets,
@@ -2020,7 +2020,7 @@ static void wm8904_handle_retune_mobile_pdata(struct snd_soc_codec *codec)
        wm8904->retune_mobile_enum.max = wm8904->num_retune_mobile_texts;
        wm8904->retune_mobile_enum.texts = wm8904->retune_mobile_texts;
 
-       ret = snd_soc_add_controls(codec, &control, 1);
+       ret = snd_soc_add_codec_controls(codec, &control, 1);
        if (ret != 0)
                dev_err(codec->dev,
                        "Failed to add ReTune Mobile control: %d\n", ret);
@@ -2033,7 +2033,7 @@ static void wm8904_handle_pdata(struct snd_soc_codec *codec)
        int ret, i;
 
        if (!pdata) {
-               snd_soc_add_controls(codec, wm8904_eq_controls,
+               snd_soc_add_codec_controls(codec, wm8904_eq_controls,
                                     ARRAY_SIZE(wm8904_eq_controls));
                return;
        }
@@ -2061,7 +2061,7 @@ static void wm8904_handle_pdata(struct snd_soc_codec *codec)
                wm8904->drc_enum.max = pdata->num_drc_cfgs;
                wm8904->drc_enum.texts = wm8904->drc_texts;
 
-               ret = snd_soc_add_controls(codec, &control, 1);
+               ret = snd_soc_add_codec_controls(codec, &control, 1);
                if (ret != 0)
                        dev_err(codec->dev,
                                "Failed to add DRC mode control: %d\n", ret);
@@ -2075,7 +2075,7 @@ static void wm8904_handle_pdata(struct snd_soc_codec *codec)
        if (pdata->num_retune_mobile_cfgs)
                wm8904_handle_retune_mobile_pdata(codec);
        else
-               snd_soc_add_controls(codec, wm8904_eq_controls,
+               snd_soc_add_codec_controls(codec, wm8904_eq_controls,
                                     ARRAY_SIZE(wm8904_eq_controls));
 }
 
index ae1933e..d2883af 100644 (file)
@@ -717,7 +717,7 @@ static int wm8940_probe(struct snd_soc_codec *codec)
                        return ret;
        }
 
-       ret = snd_soc_add_controls(codec, wm8940_snd_controls,
+       ret = snd_soc_add_codec_controls(codec, wm8940_snd_controls,
                             ARRAY_SIZE(wm8940_snd_controls));
        if (ret)
                return ret;
index 40ac888..1332692 100644 (file)
@@ -920,11 +920,11 @@ void wm8958_dsp2_init(struct snd_soc_codec *codec)
 
        wm8994->dsp_active = -1;
 
-       snd_soc_add_controls(codec, wm8958_mbc_snd_controls,
+       snd_soc_add_codec_controls(codec, wm8958_mbc_snd_controls,
                             ARRAY_SIZE(wm8958_mbc_snd_controls));
-       snd_soc_add_controls(codec, wm8958_vss_snd_controls,
+       snd_soc_add_codec_controls(codec, wm8958_vss_snd_controls,
                             ARRAY_SIZE(wm8958_vss_snd_controls));
-       snd_soc_add_controls(codec, wm8958_enh_eq_snd_controls,
+       snd_soc_add_codec_controls(codec, wm8958_enh_eq_snd_controls,
                             ARRAY_SIZE(wm8958_enh_eq_snd_controls));
 
 
@@ -958,7 +958,7 @@ 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_controls(wm8994->codec, control, 1);
+               ret = snd_soc_add_codec_controls(wm8994->codec, control, 1);
                if (ret != 0)
                        dev_err(wm8994->codec->dev,
                                "Failed to add MBC mode controls: %d\n", ret);
@@ -986,7 +986,7 @@ 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_controls(wm8994->codec, control, 1);
+               ret = snd_soc_add_codec_controls(wm8994->codec, control, 1);
                if (ret != 0)
                        dev_err(wm8994->codec->dev,
                                "Failed to add VSS mode controls: %d\n", ret);
@@ -1015,7 +1015,7 @@ 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_controls(wm8994->codec, control, 1);
+               ret = snd_soc_add_codec_controls(wm8994->codec, control, 1);
                if (ret != 0)
                        dev_err(wm8994->codec->dev,
                                "Failed to add VSS HPFmode controls: %d\n",
@@ -1045,7 +1045,7 @@ 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_controls(wm8994->codec, control, 1);
+               ret = snd_soc_add_codec_controls(wm8994->codec, control, 1);
                if (ret != 0)
                        dev_err(wm8994->codec->dev,
                                "Failed to add enhanced EQ controls: %d\n",
index e5caae3..840d720 100644 (file)
@@ -940,7 +940,7 @@ static int wm8960_probe(struct snd_soc_codec *codec)
        snd_soc_update_bits(codec, WM8960_LOUT2, 0x100, 0x100);
        snd_soc_update_bits(codec, WM8960_ROUT2, 0x100, 0x100);
 
-       snd_soc_add_controls(codec, wm8960_snd_controls,
+       snd_soc_add_codec_controls(codec, wm8960_snd_controls,
                                     ARRAY_SIZE(wm8960_snd_controls));
        wm8960_add_widgets(codec);
 
index 4f20c72..05ea7c2 100644 (file)
@@ -1022,7 +1022,7 @@ static int wm8961_probe(struct snd_soc_codec *codec)
 
        wm8961_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
 
-       snd_soc_add_controls(codec, wm8961_snd_controls,
+       snd_soc_add_codec_controls(codec, wm8961_snd_controls,
                                ARRAY_SIZE(wm8961_snd_controls));
        snd_soc_dapm_new_controls(dapm, wm8961_dapm_widgets,
                                  ARRAY_SIZE(wm8961_dapm_widgets));
index b6fcdcc..25b6bae 100644 (file)
@@ -2405,13 +2405,13 @@ static int wm8962_add_widgets(struct snd_soc_codec *codec)
        struct wm8962_pdata *pdata = dev_get_platdata(codec->dev);
        struct snd_soc_dapm_context *dapm = &codec->dapm;
 
-       snd_soc_add_controls(codec, wm8962_snd_controls,
+       snd_soc_add_codec_controls(codec, wm8962_snd_controls,
                             ARRAY_SIZE(wm8962_snd_controls));
        if (pdata && pdata->spk_mono)
-               snd_soc_add_controls(codec, wm8962_spk_mono_controls,
+               snd_soc_add_codec_controls(codec, wm8962_spk_mono_controls,
                                     ARRAY_SIZE(wm8962_spk_mono_controls));
        else
-               snd_soc_add_controls(codec, wm8962_spk_stereo_controls,
+               snd_soc_add_codec_controls(codec, wm8962_spk_stereo_controls,
                                     ARRAY_SIZE(wm8962_spk_stereo_controls));
 
 
index e538eda..9d24235 100644 (file)
@@ -1356,7 +1356,7 @@ static int wm8990_probe(struct snd_soc_codec *codec)
        snd_soc_write(codec, WM8990_LEFT_OUTPUT_VOLUME, 0x50 | (1<<8));
        snd_soc_write(codec, WM8990_RIGHT_OUTPUT_VOLUME, 0x50 | (1<<8));
 
-       snd_soc_add_controls(codec, wm8990_snd_controls,
+       snd_soc_add_codec_controls(codec, wm8990_snd_controls,
                                ARRAY_SIZE(wm8990_snd_controls));
        wm8990_add_widgets(codec);
 
index 7ee40da..9ac31ba 100644 (file)
@@ -1297,7 +1297,7 @@ static int wm8991_probe(struct snd_soc_codec *codec)
        snd_soc_write(codec, WM8991_LEFT_OUTPUT_VOLUME, 0x50 | (1<<8));
        snd_soc_write(codec, WM8991_RIGHT_OUTPUT_VOLUME, 0x50 | (1<<8));
 
-       snd_soc_add_controls(codec, wm8991_snd_controls,
+       snd_soc_add_codec_controls(codec, wm8991_snd_controls,
                             ARRAY_SIZE(wm8991_snd_controls));
 
        snd_soc_dapm_new_controls(&codec->dapm, wm8991_dapm_widgets,
index db51007..f814d27 100644 (file)
@@ -1604,13 +1604,13 @@ static int wm8993_probe(struct snd_soc_codec *codec)
        if (ret != 0)
                return ret;
 
-       snd_soc_add_controls(codec, wm8993_snd_controls,
+       snd_soc_add_codec_controls(codec, wm8993_snd_controls,
                             ARRAY_SIZE(wm8993_snd_controls));
        if (wm8993->pdata.num_retune_configs != 0) {
                dev_dbg(codec->dev, "Using ReTune Mobile\n");
        } else {
                dev_dbg(codec->dev, "No ReTune Mobile, using normal EQ\n");
-               snd_soc_add_controls(codec, wm8993_eq_controls,
+               snd_soc_add_codec_controls(codec, wm8993_eq_controls,
                                     ARRAY_SIZE(wm8993_eq_controls));
        }
 
index c262918..8ae6585 100644 (file)
@@ -2867,7 +2867,7 @@ 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_controls(wm8994->codec, controls,
+       ret = snd_soc_add_codec_controls(wm8994->codec, controls,
                                   ARRAY_SIZE(controls));
        if (ret != 0)
                dev_err(wm8994->codec->dev,
@@ -2920,7 +2920,7 @@ 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_controls(wm8994->codec, controls,
+               ret = snd_soc_add_codec_controls(wm8994->codec, controls,
                                           ARRAY_SIZE(controls));
                if (ret != 0)
                        dev_err(wm8994->codec->dev,
@@ -2936,7 +2936,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_controls(wm8994->codec, wm8994_eq_controls,
+               snd_soc_add_codec_controls(wm8994->codec, wm8994_eq_controls,
                                     ARRAY_SIZE(wm8994_eq_controls));
 
        for (i = 0; i < ARRAY_SIZE(pdata->micbias); i++) {
@@ -3652,7 +3652,7 @@ static int wm8994_codec_probe(struct snd_soc_codec *codec)
        wm8994_handle_pdata(wm8994);
 
        wm_hubs_add_analogue_controls(codec);
-       snd_soc_add_controls(codec, wm8994_snd_controls,
+       snd_soc_add_codec_controls(codec, wm8994_snd_controls,
                             ARRAY_SIZE(wm8994_snd_controls));
        snd_soc_dapm_new_controls(dapm, wm8994_dapm_widgets,
                                  ARRAY_SIZE(wm8994_dapm_widgets));
@@ -3678,7 +3678,7 @@ static int wm8994_codec_probe(struct snd_soc_codec *codec)
                }
                break;
        case WM8958:
-               snd_soc_add_controls(codec, wm8958_snd_controls,
+               snd_soc_add_codec_controls(codec, wm8958_snd_controls,
                                     ARRAY_SIZE(wm8958_snd_controls));
                snd_soc_dapm_new_controls(dapm, wm8958_dapm_widgets,
                                          ARRAY_SIZE(wm8958_dapm_widgets));
@@ -3700,7 +3700,7 @@ static int wm8994_codec_probe(struct snd_soc_codec *codec)
                break;
 
        case WM1811:
-               snd_soc_add_controls(codec, wm8958_snd_controls,
+               snd_soc_add_codec_controls(codec, wm8958_snd_controls,
                                     ARRAY_SIZE(wm8958_snd_controls));
                snd_soc_dapm_new_controls(dapm, wm8958_dapm_widgets,
                                          ARRAY_SIZE(wm8958_dapm_widgets));
index 89a8642..28c89b0 100644 (file)
@@ -2136,7 +2136,7 @@ static int wm8995_probe(struct snd_soc_codec *codec)
 
        wm8995_update_class_w(codec);
 
-       snd_soc_add_controls(codec, wm8995_snd_controls,
+       snd_soc_add_codec_controls(codec, wm8995_snd_controls,
                             ARRAY_SIZE(wm8995_snd_controls));
        snd_soc_dapm_new_controls(&codec->dapm, wm8995_dapm_widgets,
                                  ARRAY_SIZE(wm8995_dapm_widgets));
index 10f41c8..86f449c 100644 (file)
@@ -2771,7 +2771,7 @@ static void wm8996_retune_mobile_pdata(struct snd_soc_codec *codec)
        wm8996->retune_mobile_enum.max = wm8996->num_retune_mobile_texts;
        wm8996->retune_mobile_enum.texts = wm8996->retune_mobile_texts;
 
-       ret = snd_soc_add_controls(codec, controls, ARRAY_SIZE(controls));
+       ret = snd_soc_add_codec_controls(codec, controls, ARRAY_SIZE(controls));
        if (ret != 0)
                dev_err(codec->dev,
                        "Failed to add ReTune Mobile controls: %d\n", ret);
@@ -2966,7 +2966,7 @@ static int wm8996_probe(struct snd_soc_codec *codec)
        if (wm8996->pdata.num_retune_mobile_cfgs)
                wm8996_retune_mobile_pdata(codec);
        else
-               snd_soc_add_controls(codec, wm8996_eq_controls,
+               snd_soc_add_codec_controls(codec, wm8996_eq_controls,
                                     ARRAY_SIZE(wm8996_eq_controls));
 
        /* If the TX LRCLK pins are not in LRCLK mode configure the
index a6bab39..7b09b1f 100644 (file)
@@ -1287,7 +1287,7 @@ static int wm9081_probe(struct snd_soc_codec *codec)
        if (!wm9081->pdata.num_retune_configs) {
                dev_dbg(codec->dev,
                        "No ReTune Mobile data, using normal EQ\n");
-               snd_soc_add_controls(codec, wm9081_eq_controls,
+               snd_soc_add_codec_controls(codec, wm9081_eq_controls,
                                     ARRAY_SIZE(wm9081_eq_controls));
        }
 
index a2b9208..e8280ee 100644 (file)
@@ -433,7 +433,7 @@ static int wm9090_add_controls(struct snd_soc_codec *codec)
 
        snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
 
-       snd_soc_add_controls(codec, wm9090_controls,
+       snd_soc_add_codec_controls(codec, wm9090_controls,
                             ARRAY_SIZE(wm9090_controls));
 
        if (wm9090->pdata.lin1_diff) {
@@ -442,7 +442,7 @@ static int wm9090_add_controls(struct snd_soc_codec *codec)
        } else {
                snd_soc_dapm_add_routes(dapm, audio_map_in1_se,
                                        ARRAY_SIZE(audio_map_in1_se));
-               snd_soc_add_controls(codec, wm9090_in1_se_controls,
+               snd_soc_add_codec_controls(codec, wm9090_in1_se_controls,
                                     ARRAY_SIZE(wm9090_in1_se_controls));
        }
 
@@ -452,7 +452,7 @@ static int wm9090_add_controls(struct snd_soc_codec *codec)
        } else {
                snd_soc_dapm_add_routes(dapm, audio_map_in2_se,
                                        ARRAY_SIZE(audio_map_in2_se));
-               snd_soc_add_controls(codec, wm9090_in2_se_controls,
+               snd_soc_add_codec_controls(codec, wm9090_in2_se_controls,
                                     ARRAY_SIZE(wm9090_in2_se_controls));
        }
 
index 40c92ea..cacc6a8 100644 (file)
@@ -351,7 +351,7 @@ static int wm9705_soc_probe(struct snd_soc_codec *codec)
        if (ret)
                goto reset_err;
 
-       snd_soc_add_controls(codec, wm9705_snd_ac97_controls,
+       snd_soc_add_codec_controls(codec, wm9705_snd_ac97_controls,
                                ARRAY_SIZE(wm9705_snd_ac97_controls));
 
        return 0;
index 7291eab..b342ae5 100644 (file)
@@ -637,7 +637,7 @@ static int wm9712_soc_probe(struct snd_soc_codec *codec)
        ac97_write(codec, AC97_VIDEO, ac97_read(codec, AC97_VIDEO) | 0x3000);
 
        wm9712_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
-       snd_soc_add_controls(codec, wm9712_snd_ac97_controls,
+       snd_soc_add_codec_controls(codec, wm9712_snd_ac97_controls,
                                ARRAY_SIZE(wm9712_snd_ac97_controls));
 
        return 0;
index 2b8479b..2d22cc7 100644 (file)
@@ -1216,7 +1216,7 @@ static int wm9713_soc_probe(struct snd_soc_codec *codec)
        reg = ac97_read(codec, AC97_CD) & 0x7fff;
        ac97_write(codec, AC97_CD, reg);
 
-       snd_soc_add_controls(codec, wm9713_snd_ac97_controls,
+       snd_soc_add_codec_controls(codec, wm9713_snd_ac97_controls,
                                ARRAY_SIZE(wm9713_snd_ac97_controls));
 
        return 0;
index ec7d490..c509911 100644 (file)
@@ -895,7 +895,7 @@ int wm_hubs_add_analogue_controls(struct snd_soc_codec *codec)
                            WM8993_MIXOUTR_ZC | WM8993_MIXOUT_VU,
                            WM8993_MIXOUTR_ZC | WM8993_MIXOUT_VU);
 
-       snd_soc_add_controls(codec, analogue_snd_controls,
+       snd_soc_add_codec_controls(codec, analogue_snd_controls,
                             ARRAY_SIZE(analogue_snd_controls));
 
        snd_soc_dapm_new_controls(dapm, analogue_dapm_widgets,
index 6f77eef..2937e54 100644 (file)
@@ -235,7 +235,7 @@ static int mfld_init(struct snd_soc_pcm_runtime *runtime)
        snd_soc_dapm_enable_pin(dapm, "Headphones");
        snd_soc_dapm_enable_pin(dapm, "Mic");
 
-       ret_val = snd_soc_add_controls(codec, mfld_snd_controls,
+       ret_val = snd_soc_add_codec_controls(codec, mfld_snd_controls,
                                ARRAY_SIZE(mfld_snd_controls));
        if (ret_val) {
                pr_err("soc_add_controls failed %d", ret_val);
index a67f437..78563bb 100644 (file)
@@ -570,7 +570,7 @@ static int ams_delta_cx20442_init(struct snd_soc_pcm_runtime *rtd)
        snd_soc_dapm_disable_pin(dapm, "AGCOUT");
 
        /* Add virtual switch */
-       ret = snd_soc_add_controls(codec, ams_delta_audio_controls,
+       ret = snd_soc_add_codec_controls(codec, ams_delta_audio_controls,
                                        ARRAY_SIZE(ams_delta_audio_controls));
        if (ret)
                dev_warn(card->dev,
index 597be41..1490227 100644 (file)
@@ -55,9 +55,8 @@ static int n810_spk_func;
 static int n810_jack_func;
 static int n810_dmic_func;
 
-static void n810_ext_control(struct snd_soc_codec *codec)
+static void n810_ext_control(struct snd_soc_dapm_context *dapm)
 {
-       struct snd_soc_dapm_context *dapm = &codec->dapm;
        int hp = 0, line1l = 0;
 
        switch (n810_jack_func) {
@@ -102,7 +101,7 @@ static int n810_startup(struct snd_pcm_substream *substream)
        snd_pcm_hw_constraint_minmax(runtime,
                                     SNDRV_PCM_HW_PARAM_CHANNELS, 2, 2);
 
-       n810_ext_control(codec);
+       n810_ext_control(&codec->dapm);
        return clk_enable(sys_clkout2);
 }
 
@@ -142,13 +141,13 @@ static int n810_get_spk(struct snd_kcontrol *kcontrol,
 static int n810_set_spk(struct snd_kcontrol *kcontrol,
                        struct snd_ctl_elem_value *ucontrol)
 {
-       struct snd_soc_codec *codec =  snd_kcontrol_chip(kcontrol);
+       struct snd_soc_card *card =  snd_kcontrol_chip(kcontrol);
 
        if (n810_spk_func == ucontrol->value.integer.value[0])
                return 0;
 
        n810_spk_func = ucontrol->value.integer.value[0];
-       n810_ext_control(codec);
+       n810_ext_control(&card->dapm);
 
        return 1;
 }
@@ -164,13 +163,13 @@ static int n810_get_jack(struct snd_kcontrol *kcontrol,
 static int n810_set_jack(struct snd_kcontrol *kcontrol,
                         struct snd_ctl_elem_value *ucontrol)
 {
-       struct snd_soc_codec *codec =  snd_kcontrol_chip(kcontrol);
+       struct snd_soc_card *card =  snd_kcontrol_chip(kcontrol);
 
        if (n810_jack_func == ucontrol->value.integer.value[0])
                return 0;
 
        n810_jack_func = ucontrol->value.integer.value[0];
-       n810_ext_control(codec);
+       n810_ext_control(&card->dapm);
 
        return 1;
 }
@@ -186,7 +185,7 @@ static int n810_get_input(struct snd_kcontrol *kcontrol,
 static int n810_set_input(struct snd_kcontrol *kcontrol,
                          struct snd_ctl_elem_value *ucontrol)
 {
-       struct snd_soc_codec *codec =  snd_kcontrol_chip(kcontrol);
+       struct snd_soc_card *card =  snd_kcontrol_chip(kcontrol);
 
        if (n810_dmic_func == ucontrol->value.integer.value[0])
                return 0;
index 0173719..1287b87 100644 (file)
@@ -744,17 +744,17 @@ static const struct snd_kcontrol_new omap_mcbsp3_st_controls[] = {
                                      omap_mcbsp3_set_st_ch1_volume),
 };
 
-int omap_mcbsp_st_add_controls(struct snd_soc_codec *codec, int mcbsp_id)
+int omap_mcbsp_st_add_controls(struct snd_soc_dai *dai)
 {
        if (!cpu_is_omap34xx())
                return -ENODEV;
 
-       switch (mcbsp_id) {
+       switch (dai->id) {
        case 1: /* McBSP 2 */
-               return snd_soc_add_controls(codec, omap_mcbsp2_st_controls,
+               return snd_soc_add_dai_controls(dai, omap_mcbsp2_st_controls,
                                        ARRAY_SIZE(omap_mcbsp2_st_controls));
        case 2: /* McBSP 3 */
-               return snd_soc_add_controls(codec, omap_mcbsp3_st_controls,
+               return snd_soc_add_dai_controls(dai, omap_mcbsp3_st_controls,
                                        ARRAY_SIZE(omap_mcbsp3_st_controls));
        default:
                break;
index 65cde9d..476fe2a 100644 (file)
@@ -59,6 +59,6 @@ enum omap_mcbsp_div {
 #define NUM_LINKS      5
 #endif
 
-int omap_mcbsp_st_add_controls(struct snd_soc_codec *codec, int mcbsp_id);
+int omap_mcbsp_st_add_controls(struct snd_soc_dai *dai);
 
 #endif
index fada6ef..58936c7 100644 (file)
@@ -59,9 +59,8 @@ static int rx51_spk_func;
 static int rx51_dmic_func;
 static int rx51_jack_func;
 
-static void rx51_ext_control(struct snd_soc_codec *codec)
+static void rx51_ext_control(struct snd_soc_dapm_context *dapm)
 {
-       struct snd_soc_dapm_context *dapm = &codec->dapm;
        int hp = 0, hs = 0, tvout = 0;
 
        switch (rx51_jack_func) {
@@ -102,11 +101,11 @@ static int rx51_startup(struct snd_pcm_substream *substream)
 {
        struct snd_pcm_runtime *runtime = substream->runtime;
        struct snd_soc_pcm_runtime *rtd = substream->private_data;
-       struct snd_soc_codec *codec = rtd->codec;
+       struct snd_soc_card *card = rtd->card;
 
        snd_pcm_hw_constraint_minmax(runtime,
                                     SNDRV_PCM_HW_PARAM_CHANNELS, 2, 2);
-       rx51_ext_control(codec);
+       rx51_ext_control(&card->dapm);
 
        return 0;
 }
@@ -138,13 +137,13 @@ static int rx51_get_spk(struct snd_kcontrol *kcontrol,
 static int rx51_set_spk(struct snd_kcontrol *kcontrol,
                        struct snd_ctl_elem_value *ucontrol)
 {
-       struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
+       struct snd_soc_card *card = snd_kcontrol_chip(kcontrol);
 
        if (rx51_spk_func == ucontrol->value.integer.value[0])
                return 0;
 
        rx51_spk_func = ucontrol->value.integer.value[0];
-       rx51_ext_control(codec);
+       rx51_ext_control(&card->dapm);
 
        return 1;
 }
@@ -184,13 +183,13 @@ static int rx51_get_input(struct snd_kcontrol *kcontrol,
 static int rx51_set_input(struct snd_kcontrol *kcontrol,
                          struct snd_ctl_elem_value *ucontrol)
 {
-       struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
+       struct snd_soc_card *card = snd_kcontrol_chip(kcontrol);
 
        if (rx51_dmic_func == ucontrol->value.integer.value[0])
                return 0;
 
        rx51_dmic_func = ucontrol->value.integer.value[0];
-       rx51_ext_control(codec);
+       rx51_ext_control(&card->dapm);
 
        return 1;
 }
@@ -206,13 +205,13 @@ static int rx51_get_jack(struct snd_kcontrol *kcontrol,
 static int rx51_set_jack(struct snd_kcontrol *kcontrol,
                         struct snd_ctl_elem_value *ucontrol)
 {
-       struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
+       struct snd_soc_card *card = snd_kcontrol_chip(kcontrol);
 
        if (rx51_jack_func == ucontrol->value.integer.value[0])
                return 0;
 
        rx51_jack_func = ucontrol->value.integer.value[0];
-       rx51_ext_control(codec);
+       rx51_ext_control(&card->dapm);
 
        return 1;
 }
@@ -297,7 +296,7 @@ static int rx51_aic34_init(struct snd_soc_pcm_runtime *rtd)
        snd_soc_dapm_nc_pin(dapm, "LINE1R");
 
        /* Add RX-51 specific controls */
-       err = snd_soc_add_controls(codec, aic34_rx51_controls,
+       err = snd_soc_add_card_controls(rtd->card, aic34_rx51_controls,
                                   ARRAY_SIZE(aic34_rx51_controls));
        if (err < 0)
                return err;
@@ -314,7 +313,7 @@ static int rx51_aic34_init(struct snd_soc_pcm_runtime *rtd)
                return err;
        snd_soc_limit_volume(codec, "TPA6130A2 Headphone Playback Volume", 42);
 
-       err = omap_mcbsp_st_add_controls(codec, 1);
+       err = omap_mcbsp_st_add_controls(rtd->cpu_dai);
        if (err < 0)
                return err;
 
@@ -335,7 +334,7 @@ static int rx51_aic34b_init(struct snd_soc_dapm_context *dapm)
 {
        int err;
 
-       err = snd_soc_add_controls(dapm->codec, aic34_rx51_controlsb,
+       err = snd_soc_add_card_controls(dapm->card, aic34_rx51_controlsb,
                                   ARRAY_SIZE(aic34_rx51_controlsb));
        if (err < 0)
                return err;
index bc21944..863367a 100644 (file)
 static int corgi_jack_func;
 static int corgi_spk_func;
 
-static void corgi_ext_control(struct snd_soc_codec *codec)
+static void corgi_ext_control(struct snd_soc_dapm_context *dapm)
 {
-       struct snd_soc_dapm_context *dapm = &codec->dapm;
-
        /* set up jack connection */
        switch (corgi_jack_func) {
        case CORGI_HP:
@@ -104,7 +102,7 @@ static int corgi_startup(struct snd_pcm_substream *substream)
        mutex_lock(&codec->mutex);
 
        /* check the jack status at stream startup */
-       corgi_ext_control(codec);
+       corgi_ext_control(&codec->dapm);
 
        mutex_unlock(&codec->mutex);
 
@@ -173,13 +171,13 @@ static int corgi_get_jack(struct snd_kcontrol *kcontrol,
 static int corgi_set_jack(struct snd_kcontrol *kcontrol,
        struct snd_ctl_elem_value *ucontrol)
 {
-       struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
+       struct snd_soc_card *card = snd_kcontrol_chip(kcontrol);
 
        if (corgi_jack_func == ucontrol->value.integer.value[0])
                return 0;
 
        corgi_jack_func = ucontrol->value.integer.value[0];
-       corgi_ext_control(codec);
+       corgi_ext_control(&card->dapm);
        return 1;
 }
 
@@ -193,13 +191,13 @@ static int corgi_get_spk(struct snd_kcontrol *kcontrol,
 static int corgi_set_spk(struct snd_kcontrol *kcontrol,
        struct snd_ctl_elem_value *ucontrol)
 {
-       struct snd_soc_codec *codec =  snd_kcontrol_chip(kcontrol);
+       struct snd_soc_card *card =  snd_kcontrol_chip(kcontrol);
 
        if (corgi_spk_func == ucontrol->value.integer.value[0])
                return 0;
 
        corgi_spk_func = ucontrol->value.integer.value[0];
-       corgi_ext_control(codec);
+       corgi_ext_control(&card->dapm);
        return 1;
 }
 
index 3f7a8ec..aace19e 100644 (file)
@@ -411,7 +411,7 @@ static int magician_uda1380_init(struct snd_soc_pcm_runtime *rtd)
        snd_soc_dapm_nc_pin(dapm, "VINR");
 
        /* Add magician specific controls */
-       err = snd_soc_add_controls(codec, uda1380_magician_controls,
+       err = snd_soc_add_codec_controls(codec, uda1380_magician_controls,
                                ARRAY_SIZE(uda1380_magician_controls));
        if (err < 0)
                return err;
index fd0ed10..d2cc817 100644 (file)
 static int poodle_jack_func;
 static int poodle_spk_func;
 
-static void poodle_ext_control(struct snd_soc_codec *codec)
+static void poodle_ext_control(struct snd_soc_dapm_context *dapm)
 {
-       struct snd_soc_dapm_context *dapm = &codec->dapm;
-
        /* set up jack connection */
        if (poodle_jack_func == POODLE_HP) {
                /* set = unmute headphone */
@@ -81,7 +79,7 @@ static int poodle_startup(struct snd_pcm_substream *substream)
        mutex_lock(&codec->mutex);
 
        /* check the jack status at stream startup */
-       poodle_ext_control(codec);
+       poodle_ext_control(&codec->dapm);
 
        mutex_unlock(&codec->mutex);
 
@@ -152,13 +150,13 @@ static int poodle_get_jack(struct snd_kcontrol *kcontrol,
 static int poodle_set_jack(struct snd_kcontrol *kcontrol,
        struct snd_ctl_elem_value *ucontrol)
 {
-       struct snd_soc_codec *codec =  snd_kcontrol_chip(kcontrol);
+       struct snd_soc_card *card =  snd_kcontrol_chip(kcontrol);
 
        if (poodle_jack_func == ucontrol->value.integer.value[0])
                return 0;
 
        poodle_jack_func = ucontrol->value.integer.value[0];
-       poodle_ext_control(codec);
+       poodle_ext_control(&card->dapm);
        return 1;
 }
 
@@ -172,13 +170,13 @@ static int poodle_get_spk(struct snd_kcontrol *kcontrol,
 static int poodle_set_spk(struct snd_kcontrol *kcontrol,
        struct snd_ctl_elem_value *ucontrol)
 {
-       struct snd_soc_codec *codec =  snd_kcontrol_chip(kcontrol);
+       struct snd_soc_card *card =  snd_kcontrol_chip(kcontrol);
 
        if (poodle_spk_func == ucontrol->value.integer.value[0])
                return 0;
 
        poodle_spk_func = ucontrol->value.integer.value[0];
-       poodle_ext_control(codec);
+       poodle_ext_control(&card->dapm);
        return 1;
 }
 
index 564ef08..2aec63f 100644 (file)
@@ -197,7 +197,7 @@ static int tosa_ac97_init(struct snd_soc_pcm_runtime *rtd)
        snd_soc_dapm_nc_pin(dapm, "MONOOUT");
 
        /* add tosa specific controls */
-       err = snd_soc_add_controls(codec, tosa_controls,
+       err = snd_soc_add_codec_controls(codec, tosa_controls,
                                ARRAY_SIZE(tosa_controls));
        if (err < 0)
                return err;
index 7ac0ba2..e34f4e8 100644 (file)
@@ -298,7 +298,7 @@ static int neo1973_gta02_wm8753_init(struct snd_soc_codec *codec)
        if (ret)
                return ret;
 
-       ret = snd_soc_add_controls(codec, neo1973_gta02_wm8753_controls,
+       ret = snd_soc_add_card_controls(codec->card, neo1973_gta02_wm8753_controls,
                        ARRAY_SIZE(neo1973_gta02_wm8753_controls));
        if (ret)
                return ret;
@@ -338,7 +338,7 @@ static int neo1973_wm8753_init(struct snd_soc_pcm_runtime *rtd)
                return ret;
 
        /* add neo1973 specific controls */
-       ret = snd_soc_add_controls(codec, neo1973_wm8753_controls,
+       ret = snd_soc_add_card_controls(rtd->card, neo1973_wm8753_controls,
                        ARRAY_SIZE(neo1973_wm8753_controls));
        if (ret)
                return ret;
index a253bcc..656d5af 100644 (file)
@@ -134,18 +134,18 @@ static const struct snd_kcontrol_new amp_unmute_controls[] = {
 
 void simtec_audio_init(struct snd_soc_pcm_runtime *rtd)
 {
-       struct snd_soc_codec *codec = rtd->codec;
+       struct snd_soc_card *card = rtd->card;
 
        if (pdata->amp_gpio > 0) {
                pr_debug("%s: adding amp routes\n", __func__);
 
-               snd_soc_add_controls(codec, amp_unmute_controls,
+               snd_soc_add_card_controls(card, amp_unmute_controls,
                                     ARRAY_SIZE(amp_unmute_controls));
        }
 
        if (pdata->amp_gain[0] > 0) {
                pr_debug("%s: adding amp controls\n", __func__);
-               snd_soc_add_controls(codec, amp_gain_controls,
+               snd_soc_add_card_controls(card, amp_gain_controls,
                                     ARRAY_SIZE(amp_gain_controls));
        }
 }
index 091d5f3..a3a47cd 100644 (file)
@@ -996,7 +996,7 @@ static int soc_probe_codec(struct snd_soc_card *card,
        }
 
        if (driver->controls)
-               snd_soc_add_controls(codec, driver->controls,
+               snd_soc_add_codec_controls(codec, driver->controls,
                                     driver->num_controls);
        if (driver->dapm_routes)
                snd_soc_dapm_add_routes(&codec->dapm, driver->dapm_routes,
@@ -1457,13 +1457,8 @@ static void snd_soc_instantiate_card(struct snd_soc_card *card)
                }
        }
 
-       /* We should have a non-codec control add function but we don't */
        if (card->controls)
-               snd_soc_add_controls(list_first_entry(&card->codec_dev_list,
-                                                     struct snd_soc_codec,
-                                                     card_list),
-                                    card->controls,
-                                    card->num_controls);
+               snd_soc_add_card_controls(card, card->controls, card->num_controls);
 
        if (card->dapm_routes)
                snd_soc_dapm_add_routes(&card->dapm, card->dapm_routes,
@@ -2015,9 +2010,28 @@ struct snd_kcontrol *snd_soc_cnew(const struct snd_kcontrol_new *_template,
 }
 EXPORT_SYMBOL_GPL(snd_soc_cnew);
 
+static int snd_soc_add_controls(struct snd_card *card, struct device *dev,
+       const struct snd_kcontrol_new *controls, int num_controls,
+       const char *prefix, void *data)
+{
+       int err, i;
+
+       for (i = 0; i < num_controls; i++) {
+               const struct snd_kcontrol_new *control = &controls[i];
+               err = snd_ctl_add(card, snd_soc_cnew(control, data,
+                                                    control->name, prefix));
+               if (err < 0) {
+                       dev_err(dev, "Failed to add %s: %d\n", control->name, err);
+                       return err;
+               }
+       }
+
+       return 0;
+}
+
 /**
- * snd_soc_add_controls - add an array of controls to a codec.
- * Convienience function to add a list of controls. Many codecs were
+ * snd_soc_add_codec_controls - add an array of controls to a codec.
+ * Convenience function to add a list of controls. Many codecs were
  * duplicating this code.
  *
  * @codec: codec to add controls to
@@ -2026,31 +2040,19 @@ EXPORT_SYMBOL_GPL(snd_soc_cnew);
  *
  * Return 0 for success, else error.
  */
-int snd_soc_add_controls(struct snd_soc_codec *codec,
+int snd_soc_add_codec_controls(struct snd_soc_codec *codec,
        const struct snd_kcontrol_new *controls, int num_controls)
 {
        struct snd_card *card = codec->card->snd_card;
-       int err, i;
 
-       for (i = 0; i < num_controls; i++) {
-               const struct snd_kcontrol_new *control = &controls[i];
-               err = snd_ctl_add(card, snd_soc_cnew(control, codec,
-                                                    control->name,
-                                                    codec->name_prefix));
-               if (err < 0) {
-                       dev_err(codec->dev, "%s: Failed to add %s: %d\n",
-                               codec->name, control->name, err);
-                       return err;
-               }
-       }
-
-       return 0;
+       return snd_soc_add_controls(card, codec->dev, controls, num_controls,
+                       codec->name_prefix, codec);
 }
-EXPORT_SYMBOL_GPL(snd_soc_add_controls);
+EXPORT_SYMBOL_GPL(snd_soc_add_codec_controls);
 
 /**
  * snd_soc_add_platform_controls - add an array of controls to a platform.
- * Convienience function to add a list of controls.
+ * Convenience function to add a list of controls.
  *
  * @platform: platform to add controls to
  * @controls: array of controls to add
@@ -2062,23 +2064,53 @@ int snd_soc_add_platform_controls(struct snd_soc_platform *platform,
        const struct snd_kcontrol_new *controls, int num_controls)
 {
        struct snd_card *card = platform->card->snd_card;
-       int err, i;
 
-       for (i = 0; i < num_controls; i++) {
-               const struct snd_kcontrol_new *control = &controls[i];
-               err = snd_ctl_add(card, snd_soc_cnew(control, platform,
-                               control->name, NULL));
-               if (err < 0) {
-                       dev_err(platform->dev, "Failed to add %s %d\n",control->name, err);
-                       return err;
-               }
-       }
-
-       return 0;
+       return snd_soc_add_controls(card, platform->dev, controls, num_controls,
+                       NULL, platform);
 }
 EXPORT_SYMBOL_GPL(snd_soc_add_platform_controls);
 
 /**
+ * snd_soc_add_card_controls - add an array of controls to a SoC card.
+ * Convenience function to add a list of controls.
+ *
+ * @soc_card: SoC card to add controls to
+ * @controls: array of controls to add
+ * @num_controls: number of elements in the array
+ *
+ * Return 0 for success, else error.
+ */
+int snd_soc_add_card_controls(struct snd_soc_card *soc_card,
+       const struct snd_kcontrol_new *controls, int num_controls)
+{
+       struct snd_card *card = soc_card->snd_card;
+
+       return snd_soc_add_controls(card, soc_card->dev, controls, num_controls,
+                       NULL, soc_card);
+}
+EXPORT_SYMBOL_GPL(snd_soc_add_card_controls);
+
+/**
+ * snd_soc_add_dai_controls - add an array of controls to a DAI.
+ * Convienience function to add a list of controls.
+ *
+ * @dai: DAI to add controls to
+ * @controls: array of controls to add
+ * @num_controls: number of elements in the array
+ *
+ * Return 0 for success, else error.
+ */
+int snd_soc_add_dai_controls(struct snd_soc_dai *dai,
+       const struct snd_kcontrol_new *controls, int num_controls)
+{
+       struct snd_card *card = dai->card->snd_card;
+
+       return snd_soc_add_controls(card, dai->dev, controls, num_controls,
+                       NULL, dai);
+}
+EXPORT_SYMBOL_GPL(snd_soc_add_dai_controls);
+
+/**
  * snd_soc_info_enum_double - enumerated double mixer info callback
  * @kcontrol: mixer control
  * @uinfo: control element information