ASoC: Tegra: Harmony: Add switch control for speaker
authorStephen Warren <swarren@nvidia.com>
Thu, 3 Feb 2011 20:56:14 +0000 (13:56 -0700)
committerMark Brown <broonie@opensource.wolfsonmicro.com>
Wed, 9 Feb 2011 12:11:05 +0000 (12:11 +0000)
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
sound/soc/tegra/harmony.c

index fcd316e..be95405 100644 (file)
@@ -173,6 +173,10 @@ static const struct snd_soc_dapm_route harmony_audio_map[] = {
        {"IN1L", NULL, "Mic Bias"},
 };
 
+static const struct snd_kcontrol_new harmony_controls[] = {
+       SOC_DAPM_PIN_SWITCH("Int Spk"),
+};
+
 static int harmony_asoc_init(struct snd_soc_pcm_runtime *rtd)
 {
        struct snd_soc_codec *codec = rtd->codec;
@@ -191,13 +195,17 @@ static int harmony_asoc_init(struct snd_soc_pcm_runtime *rtd)
 
        gpio_direction_output(pdata->gpio_spkr_en, 0);
 
+       ret = snd_soc_add_controls(codec, harmony_controls,
+                                  ARRAY_SIZE(harmony_controls));
+       if (ret < 0)
+               return ret;
+
        snd_soc_dapm_new_controls(dapm, harmony_dapm_widgets,
                                        ARRAY_SIZE(harmony_dapm_widgets));
 
        snd_soc_dapm_add_routes(dapm, harmony_audio_map,
                                ARRAY_SIZE(harmony_audio_map));
 
-       snd_soc_dapm_enable_pin(dapm, "Int Spk");
        snd_soc_dapm_enable_pin(dapm, "Mic Jack");
        snd_soc_dapm_sync(dapm);