asoc: tegra: aic326x: Fix LP1 power for VDDIO_AUDIO
Rahul Mittal [Fri, 15 Mar 2013 11:46:57 +0000 (16:46 +0530)]
- Register DAPM map/widgets with snd_soc_card structure
- Enable idle bias off for TI codec
- Correct an error in handling bias level setting

Bug 1251424

Change-Id: Id1ed89955a2b8e705c3fd8b0557ca51afeef616d
Signed-off-by: Rahul Mittal <rmittal@nvidia.com>
Reviewed-on: http://git-master/r/209997
Reviewed-by: Vijay Mali <vmali@nvidia.com>
Reviewed-by: Scott Peterson <speterson@nvidia.com>
Reviewed-by: Sumit Bhattacharya <sumitb@nvidia.com>
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>

sound/soc/codecs/tlv320aic326x.c
sound/soc/tegra/tegra_aic326x.c

index 38380a8..6b0fcbd 100644 (file)
@@ -2574,6 +2574,9 @@ static int aic3262_codec_probe(struct snd_soc_codec *codec)
                        AIC3262_HEADSET_IN_MASK, AIC3262_HEADSET_IN_MASK);
                }
        }
+
+       codec->dapm.idle_bias_off = 1;
+
        /* Keep the reference voltage ON while in$
           STANDBY mode for fast power up */
 
@@ -2658,6 +2661,7 @@ static struct snd_soc_codec_driver soc_codec_driver_aic326x = {
        .dapm_routes = aic3262_dapm_routes,
        .num_dapm_routes = ARRAY_SIZE(aic3262_dapm_routes),
        .set_bias_level = aic3262_set_bias_level,
+       .idle_bias_off = true,
        .reg_cache_size = 0,
        .reg_word_size = sizeof(u8),
        .reg_cache_default = NULL,
index d66fcba..9f3119f 100644 (file)
@@ -1301,17 +1301,6 @@ static int tegra_aic326x_init(struct snd_soc_pcm_runtime *rtd)
                gpio_direction_output(pdata->gpio_ext_mic_en, 0);
        }
 
-       ret = snd_soc_add_card_controls(card, tegra_aic326x_controls,
-                                  ARRAY_SIZE(tegra_aic326x_controls));
-       if (ret < 0)
-               return ret;
-
-       snd_soc_dapm_new_controls(dapm, tegra_aic326x_dapm_widgets,
-                                       ARRAY_SIZE(tegra_aic326x_dapm_widgets));
-
-       snd_soc_dapm_add_routes(dapm, aic326x_audio_map,
-                                       ARRAY_SIZE(aic326x_audio_map));
-
        ret = snd_soc_jack_new(codec, "Headset Jack", SND_JACK_HEADSET,
                        &tegra_aic326x_hp_jack);
        if (ret < 0)
@@ -1355,6 +1344,8 @@ static int tegra_aic326x_init(struct snd_soc_pcm_runtime *rtd)
        if (ret < 0)
                return ret;
 
+       snd_soc_dapm_sync(dapm);
+
        return 0;
 }
 
@@ -1483,15 +1474,12 @@ static int tegra_aic326x_set_bias_level_post(struct snd_soc_card *card,
                level == SND_SOC_BIAS_OFF && machine->clock_enabled) {
                machine->clock_enabled = 0;
                tegra_asoc_utils_clk_disable(&machine->util_data);
+               machine->bias_level = level;
        }
 
-       machine->bias_level = level;
-
        return 0 ;
 }
 
-
-
 static struct snd_soc_card snd_soc_tegra_aic326x = {
        .name = "tegra-aic326x",
        .owner = THIS_MODULE,
@@ -1501,6 +1489,13 @@ static struct snd_soc_card snd_soc_tegra_aic326x = {
        .set_bias_level_post = tegra_aic326x_set_bias_level_post,
        .suspend_post = tegra_aic326x_suspend_post,
        .resume_pre = tegra_aic326x_resume_pre,
+       .controls = tegra_aic326x_controls,
+       .num_controls = ARRAY_SIZE(tegra_aic326x_controls),
+       .dapm_widgets = tegra_aic326x_dapm_widgets,
+       .num_dapm_widgets = ARRAY_SIZE(tegra_aic326x_dapm_widgets),
+       .dapm_routes = aic326x_audio_map,
+       .num_dapm_routes = ARRAY_SIZE(aic326x_audio_map),
+       .fully_routed = true,
 };
 
 static __devinit int tegra_aic326x_driver_probe(struct platform_device *pdev)
@@ -1527,6 +1522,8 @@ static __devinit int tegra_aic326x_driver_probe(struct platform_device *pdev)
        }
 
        machine->pdata = pdata;
+       machine->bias_level = SND_SOC_BIAS_STANDBY;
+       machine->clock_enabled = 1;
 
        ret = tegra_asoc_utils_init(&machine->util_data, &pdev->dev, card);
        if (ret)