ASoC: wcd9xxx: Enable EAR LO concurrency in codec

Add support for ear-lineout concurrency for
wcd934x audio codec. Add LO path power up, power
down, EAR path power up, power down sequences.
Avoid using class H when both EAR and LO enabled.

CRs-fixed: 1107183
Change-Id: I60099381cbf042b795f703b673717ab5ff4bd88f
Signed-off-by: Karthikeyan Mani <kmani@codeaurora.org>
This commit is contained in:
Karthikeyan Mani 2016-12-28 12:26:51 -08:00
parent 7aa1be4147
commit 21d1f86446

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2015-2016, The Linux Foundation. All rights reserved. * Copyright (c) 2015-2017, The Linux Foundation. All rights reserved.
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and * it under the terms of the GNU General Public License version 2 and
@ -758,35 +758,35 @@ static void wcd_clsh_state_ear_lo(struct snd_soc_codec *codec,
dev_dbg(codec->dev, "%s: mode: %s, %s\n", __func__, mode_to_str(mode), dev_dbg(codec->dev, "%s: mode: %s, %s\n", __func__, mode_to_str(mode),
is_enable ? "enable" : "disable"); is_enable ? "enable" : "disable");
if (is_enable && (req_state == WCD_CLSH_STATE_LO)) { if (is_enable) {
wcd_clsh_set_buck_regulator_mode(codec, CLS_AB); /* LO powerup is taken care in PA sequence.
} else { * No need to change to class AB here.
if (req_state == WCD_CLSH_STATE_EAR)
goto end;
/* LO powerdown.
* If EAR Class-H is already enabled, just
* turn on regulator other enable Class-H
* configuration
*/ */
if (wcd_clsh_enable_status(codec)) { if (req_state == WCD_CLSH_STATE_EAR) {
wcd_clsh_set_buck_regulator_mode(codec, /* EAR powerup.*/
CLS_H_NORMAL); if (!wcd_clsh_enable_status(codec)) {
goto end; wcd_enable_clsh_block(codec, clsh_d, true);
wcd_clsh_set_buck_mode(codec, mode);
wcd_clsh_set_flyback_mode(codec, mode);
}
snd_soc_update_bits(codec,
WCD9XXX_A_CDC_RX0_RX_PATH_CFG0,
0x40, 0x40);
} }
wcd_enable_clsh_block(codec, clsh_d, true); } else {
snd_soc_update_bits(codec, if (req_state == WCD_CLSH_STATE_EAR) {
WCD9XXX_A_CDC_RX0_RX_PATH_CFG0, /* EAR powerdown.*/
0x40, 0x40); wcd_enable_clsh_block(codec, clsh_d, false);
wcd_clsh_set_buck_regulator_mode(codec, wcd_clsh_set_buck_mode(codec, CLS_H_NORMAL);
CLS_H_NORMAL); wcd_clsh_set_flyback_mode(codec, CLS_H_NORMAL);
wcd_clsh_set_buck_mode(codec, mode); snd_soc_update_bits(codec,
wcd_clsh_set_flyback_mode(codec, mode); WCD9XXX_A_CDC_RX0_RX_PATH_CFG0,
wcd_clsh_flyback_ctrl(codec, clsh_d, mode, true); 0x40, 0x00);
wcd_clsh_buck_ctrl(codec, clsh_d, mode, true); }
/* LO powerdown is taken care in PA sequence.
* No need to change to class H here.
*/
} }
end:
return;
} }
static void wcd_clsh_state_hph_lo(struct snd_soc_codec *codec, static void wcd_clsh_state_hph_lo(struct snd_soc_codec *codec,
@ -1135,6 +1135,7 @@ static bool wcd_clsh_is_state_valid(u8 state)
case WCD_CLSH_STATE_HPHL_LO: case WCD_CLSH_STATE_HPHL_LO:
case WCD_CLSH_STATE_HPHR_LO: case WCD_CLSH_STATE_HPHR_LO:
case WCD_CLSH_STATE_HPH_ST_LO: case WCD_CLSH_STATE_HPH_ST_LO:
case WCD_CLSH_STATE_EAR_LO:
return true; return true;
default: default:
return false; return false;