Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 21d1f864 authored by Karthikeyan Mani's avatar Karthikeyan Mani
Browse files

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: default avatarKarthikeyan Mani <kmani@codeaurora.org>
parent 7aa1be41
Loading
Loading
Loading
Loading
+28 −27
Original line number Diff line number Diff line
/*
 * 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
 * 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),
		is_enable ? "enable" : "disable");

	if (is_enable && (req_state == WCD_CLSH_STATE_LO)) {
		wcd_clsh_set_buck_regulator_mode(codec, CLS_AB);
	} else {
		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 (is_enable) {
		/* LO powerup is taken care in PA sequence.
		 * No need to change to class AB here.
		 */
		if (wcd_clsh_enable_status(codec)) {
			wcd_clsh_set_buck_regulator_mode(codec,
					CLS_H_NORMAL);
			goto end;
		}
		if (req_state == WCD_CLSH_STATE_EAR) {
			/* EAR powerup.*/
			if (!wcd_clsh_enable_status(codec)) {
				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_clsh_set_buck_regulator_mode(codec,
				CLS_H_NORMAL);
		wcd_clsh_set_buck_mode(codec, mode);
		wcd_clsh_set_flyback_mode(codec, mode);
		wcd_clsh_flyback_ctrl(codec, clsh_d, mode, true);
		wcd_clsh_buck_ctrl(codec, clsh_d, mode, true);
		}
end:
	return;
	} else {
		if (req_state == WCD_CLSH_STATE_EAR) {
			/* EAR powerdown.*/
			wcd_enable_clsh_block(codec, clsh_d, false);
			wcd_clsh_set_buck_mode(codec, CLS_H_NORMAL);
			wcd_clsh_set_flyback_mode(codec, CLS_H_NORMAL);
			snd_soc_update_bits(codec,
					WCD9XXX_A_CDC_RX0_RX_PATH_CFG0,
					0x40, 0x00);
		}
		/* LO powerdown is taken care in PA sequence.
		 * No need to change to class H here.
		 */
	}
}

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_HPHR_LO:
	case WCD_CLSH_STATE_HPH_ST_LO:
	case WCD_CLSH_STATE_EAR_LO:
		return true;
	default:
		return false;