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

Commit 8c9bd0f7 authored by Sudheer Papothi's avatar Sudheer Papothi Committed by Gerrit - the friendly Code Review server
Browse files

ASoC: wcd9xxx: Add new callback for headset pull up current



AQT1000 supports different headset detect pull up current source
values in MBHC. Add a callback function to handle new current
source values in MBHC driver.

Change-Id: I060af1aff3fe7c4dfd4aa4c480542efa54c2777c
Signed-off-by: default avatarSudheer Papothi <spapothi@codeaurora.org>
parent 7c53cb50
Loading
Loading
Loading
Loading
+9 −3
Original line number Diff line number Diff line
/* Copyright (c) 2015-2017, The Linux Foundation. All rights reserved.
/* Copyright (c) 2015-2018, 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
@@ -1274,7 +1274,10 @@ static int wcd_mbhc_initialise(struct wcd_mbhc *mbhc)
	WCD_MBHC_RSC_LOCK(mbhc);

	/* enable HS detection */
	if (mbhc->mbhc_cb->hph_pull_up_control)
	if (mbhc->mbhc_cb->hph_pull_up_control_v2)
		mbhc->mbhc_cb->hph_pull_up_control_v2(codec,
						      HS_PULLUP_I_DEFAULT);
	else if (mbhc->mbhc_cb->hph_pull_up_control)
		mbhc->mbhc_cb->hph_pull_up_control(codec, I_DEFAULT);
	else
		WCD_MBHC_REG_UPDATE_BITS(WCD_MBHC_HS_L_DET_PULL_UP_CTRL, 3);
@@ -1291,7 +1294,10 @@ static int wcd_mbhc_initialise(struct wcd_mbhc *mbhc)
		mbhc->hphl_swh = 1;
		mbhc->gnd_swh = 1;

		if (mbhc->mbhc_cb->hph_pull_up_control)
		if (mbhc->mbhc_cb->hph_pull_up_control_v2)
			mbhc->mbhc_cb->hph_pull_up_control_v2(codec,
							      HS_PULLUP_I_OFF);
		else if (mbhc->mbhc_cb->hph_pull_up_control)
			mbhc->mbhc_cb->hph_pull_up_control(codec, I_OFF);
		else
			WCD_MBHC_REG_UPDATE_BITS(WCD_MBHC_HS_L_DET_PULL_UP_CTRL,
+18 −1
Original line number Diff line number Diff line
/* Copyright (c) 2014-2017, The Linux Foundation. All rights reserved.
/* Copyright (c) 2014-2018, 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
@@ -399,6 +399,22 @@ enum mbhc_hs_pullup_iref {
	I_3P0_UA,
};

enum mbhc_hs_pullup_iref_v2 {
	HS_PULLUP_I_DEFAULT = -1,
	HS_PULLUP_I_3P0_UA = 0,
	HS_PULLUP_I_2P25_UA,
	HS_PULLUP_I_1P5_UA,
	HS_PULLUP_I_0P75_UA,
	HS_PULLUP_I_1P125_UA = 0x05,
	HS_PULLUP_I_0P375_UA = 0x07,
	HS_PULLUP_I_2P0_UA,
	HS_PULLUP_I_1P0_UA = 0x0A,
	HS_PULLUP_I_0P5_UA,
	HS_PULLUP_I_0P25_UA = 0x0F,
	HS_PULLUP_I_0P125_UA = 0x17,
	HS_PULLUP_I_OFF,
};

enum mbhc_moisture_rref {
	R_OFF,
	R_24_KOHM,
@@ -495,6 +511,7 @@ struct wcd_mbhc_cb {
	void (*update_anc_state)(struct snd_soc_codec *codec,
				 bool enable, int anc_num);
	bool (*is_anc_on)(struct wcd_mbhc *mbhc);
	void (*hph_pull_up_control_v2)(struct snd_soc_codec *, int);
};

struct wcd_mbhc_fn {