asoc: tegra: AIC3033: shutdown TPA2054D4A in idle
Chandrakanth Gorantla [Fri, 3 May 2013 13:09:29 +0000 (18:09 +0530)]
Enable bias off in codec and shutdown headphone amplifier in
bias off state.

bug 1265025

Change-Id: I6c575a79f554cf70bd97c6badb157d56bec3fe51
Signed-off-by: Chandrakanth Gorantla <cgorantla@nvidia.com>
Reviewed-on: http://git-master/r/222957
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Sumit Bhattacharya <sumitb@nvidia.com>

sound/soc/codecs/tlv320aic325x.c
sound/soc/tegra/tegra_aic325x.c

index 7c84169..e0ee34a 100644 (file)
@@ -1654,6 +1654,8 @@ static int aic325x_probe(struct snd_soc_codec *codec)
                }
        }
 
+        codec->dapm.idle_bias_off = 1;
+
        /* firmware load */
        ret = request_firmware_nowait(THIS_MODULE, FW_ACTION_HOTPLUG,
                                "tlv320aic3206_fw_v1.bin",
index a444a38..1565772 100644 (file)
@@ -1294,12 +1294,19 @@ static int tegra_aic325x_set_bias_level(struct snd_soc_card *card,
        struct snd_soc_dapm_context *dapm, enum snd_soc_bias_level level)
 {
        struct tegra_aic325x *machine = snd_soc_card_get_drvdata(card);
+       int val;
 
        if (machine->bias_level == SND_SOC_BIAS_OFF &&
                level != SND_SOC_BIAS_OFF && (!machine->clock_enabled)) {
                machine->clock_enabled = 1;
                tegra_asoc_utils_clk_enable(&machine->util_data);
                machine->bias_level = level;
+
+               tpa2054d4a_i2c_read_device(tpa2054d4a_client,
+                               TPA2054D4A_POWER_MGMT_REG, 1, &val);
+               val &= ~TPA2054D4A_SWS;
+               tpa2054d4a_i2c_write_device(machine->tpa2054d4a_client,
+                               TPA2054D4A_POWER_MGMT_REG, 1, &val);
        }
 
        return 0;
@@ -1309,11 +1316,18 @@ static int tegra_aic325x_set_bias_level_post(struct snd_soc_card *card,
        struct snd_soc_dapm_context *dapm, enum snd_soc_bias_level level)
 {
        struct tegra_aic325x *machine = snd_soc_card_get_drvdata(card);
+       int val;
 
        if (machine->bias_level != SND_SOC_BIAS_OFF &&
                level == SND_SOC_BIAS_OFF && machine->clock_enabled) {
                machine->clock_enabled = 0;
                tegra_asoc_utils_clk_disable(&machine->util_data);
+
+               tpa2054d4a_i2c_read_device(tpa2054d4a_client,
+                               TPA2054D4A_POWER_MGMT_REG, 1, &val);
+               val |= TPA2054D4A_SWS;
+               tpa2054d4a_i2c_write_device(machine->tpa2054d4a_client,
+                               TPA2054D4A_POWER_MGMT_REG, 1, &val);
        }
 
        machine->bias_level = level;