soc: tegra: rt5639: fix sysedp state notifications
Timo Alho [Wed, 30 Oct 2013 20:35:04 +0000 (22:35 +0200)]
System EDP state notifications (for revised framework) were introduced
to wrong if/else branch. This patch fixes the issue.

Bug 1398620

Change-Id: Iacf2929b2c73232c02e8df96e7a666cba091718c
Signed-off-by: Timo Alho <talho@nvidia.com>
Reviewed-on: http://git-master/r/331719
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Mitch Luban <mluban@nvidia.com>

sound/soc/tegra/tegra_rt5639.c

index 9974f4f..149491f 100644 (file)
@@ -562,10 +562,13 @@ static int tegra_rt5639_event_int_spk(struct snd_soc_dapm_widget *w,
 
        if (machine->spk_edp_client == NULL) {
                if (machine->spk_reg) {
-                       if (SND_SOC_DAPM_EVENT_ON(event))
+                       if (SND_SOC_DAPM_EVENT_ON(event)) {
+                               sysedp_set_state(machine->sysedpc, 1);
                                err = regulator_enable(machine->spk_reg);
-                       else
+                       } else {
                                regulator_disable(machine->spk_reg);
+                               sysedp_set_state(machine->sysedpc, 0);
+                       }
                }
                goto err_null_spk_edp_client;
        }
@@ -574,7 +577,6 @@ static int tegra_rt5639_event_int_spk(struct snd_soc_dapm_widget *w,
                ret = edp_update_client_request(machine->spk_edp_client,
                                                TEGRA_SPK_EDP_NEG_1,
                                                &approved);
-               sysedp_set_state(machine->sysedpc, 1);
                err = regulator_enable(machine->spk_reg);
                if (ret || approved != TEGRA_SPK_EDP_NEG_1) {
                        if (approved == TEGRA_SPK_EDP_ZERO)
@@ -588,7 +590,6 @@ static int tegra_rt5639_event_int_spk(struct snd_soc_dapm_widget *w,
                /* turn off codec volume,-46.5 dB, E1 state */
                tegra_speaker_edp_set_volume(codec, 0x27, 0x27);
                regulator_disable(machine->spk_reg);
-               sysedp_set_state(machine->sysedpc, 0);
                ret = edp_update_client_request(machine->spk_edp_client,
                                                TEGRA_SPK_EDP_1,
                                                NULL);