]> rtime.felk.cvut.cz Git - sojka/nv-tegra/linux-3.10.git/commitdiff
ASoc: rt5639: Fixed delay requirement for LDO1_EN
authorAsha T <atalambedu@nvidia.com>
Wed, 3 Jun 2015 11:41:05 +0000 (17:11 +0530)
committerDara Ramesh <dramesh@nvidia.com>
Wed, 24 Jun 2015 05:38:17 +0000 (22:38 -0700)
Realtek recommended >400ms delay after LDO1_EN is pulled up. This
is to ensure that codec digital circuitry is ready for the
subsequent i2c trasactions. And 200ms delay is needed after LDO1_EN
is pulled low after deregistering sound card. Made changes to the
machine driver taking poweroff sequence in ALC5639 datasheet into
consideration.

Bug 200107647

Reviewed-on: http://git-master/r/751887
(cherry picked from commit 166f93d046e3a0722a9ecc5a266c36c0bd2d5565)
Change-Id: I7b21144e307d823f6ce680386f07dbed7fd71bf0
Signed-off-by: Asha T <atalambedu@nvidia.com>
Reviewed-on: http://git-master/r/758964
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Ravindra Lokhande <rlokhande@nvidia.com>
Reviewed-by: Dara Ramesh <dramesh@nvidia.com>
sound/soc/tegra/tegra_rt5639.c

index 8c6ba73c0dc522fbf235d4375f3ab4ca3b768fe3..2e02ba19c57121a9c09729f999175f2fa5b344ce 100644 (file)
@@ -62,6 +62,8 @@
 #define DAI_LINK_I2S_OFFLOAD_BE        8
 #define NUM_DAI_LINKS          9
 
+#define DELAY_AFTR_LDO1_EN_UP   450
+#define DELAY_BFR_LDO1_EN_DOWN  250
 extern int g_is_call_mode;
 
 const char *tegra_rt5639_i2s_dai_name[TEGRA30_NR_I2S_IFC] = {
@@ -1327,7 +1329,7 @@ static int tegra_rt5639_driver_probe(struct platform_device *pdev)
                        if (ret)
                                dev_err(&pdev->dev, "Fail gpio_direction AUDIO_LDO1\n");
                }
-               msleep(200);
+               msleep(DELAY_AFTR_LDO1_EN_UP);
        }
 
        machine->pdata = pdata;
@@ -1474,6 +1476,11 @@ static int tegra_rt5639_driver_probe(struct platform_device *pdev)
 err_unregister_card:
        snd_soc_unregister_card(card);
 err_unregister_switch:
+       msleep(DELAY_BFR_LDO1_EN_DOWN);
+       if (gpio_is_valid(pdata->gpio_ldo1_en)) {
+               gpio_set_value(pdata->gpio_ldo1_en, 0);
+               gpio_free(pdata->gpio_ldo1_en);
+       }
 #ifdef CONFIG_SWITCH
        tegra_asoc_switch_unregister(&tegra_rt5639_headset_switch);
 err_fini_utils:
@@ -1512,6 +1519,13 @@ static int tegra_rt5639_driver_remove(struct platform_device *pdev)
        struct tegra_asoc_platform_data *pdata = machine->pdata;
        struct device_node *np = pdev->dev.of_node;
 
+       snd_soc_unregister_card(card);
+
+       msleep(DELAY_BFR_LDO1_EN_DOWN);
+       if (gpio_is_valid(pdata->gpio_ldo1_en)) {
+               gpio_set_value(pdata->gpio_ldo1_en, 0);
+               gpio_free(pdata->gpio_ldo1_en);
+       }
        if (machine->gpio_requested & GPIO_HP_DET)
                snd_soc_jack_free_gpios(&tegra_rt5639_hp_jack,
                                        1,
@@ -1535,12 +1549,6 @@ static int tegra_rt5639_driver_remove(struct platform_device *pdev)
                regulator_put(machine->codec_reg);
        }
 
-       if (gpio_is_valid(pdata->gpio_ldo1_en)) {
-               gpio_set_value(pdata->gpio_ldo1_en, 0);
-               gpio_free(pdata->gpio_ldo1_en);
-       }
-
-       snd_soc_unregister_card(card);
 
        tegra_asoc_utils_fini(&machine->util_data);