mirror of
https://github.com/followmsi/android_kernel_google_msm.git
synced 2024-11-06 23:17:41 +00:00
ASoC: wcd: perform trim for only 1.0 HW
PMIC 1.0 hardwares need trimming of 2.2k internal resisitor. From 2.0 HW trimming is expected to be done at Factory. So perform trim only for 1.0 HW. CRs-Fixed: 691749 Change-Id: Ia765962da68ece20770db24b88ce3fde6ecda104 Signed-off-by: Yeleswarapu Nagaradhesh <nagaradh@codeaurora.org>
This commit is contained in:
parent
eb1bce7340
commit
6b5f77a9eb
3 changed files with 26 additions and 10 deletions
|
@ -170,6 +170,7 @@ static struct msm8x16_wcd_pdata *msm8x16_wcd_populate_dt_pdata(
|
|||
struct device *dev);
|
||||
static int msm8x16_wcd_enable_ext_mb_source(struct snd_soc_codec *codec,
|
||||
bool turn_on);
|
||||
static void msm8x16_trim_btn_reg(struct snd_soc_codec *codec);
|
||||
|
||||
struct msm8x16_wcd_spmi msm8x16_wcd_modules[MAX_MSM8X16_WCD_DEVICE];
|
||||
|
||||
|
@ -179,6 +180,7 @@ static struct snd_soc_codec *registered_codec;
|
|||
|
||||
static const struct wcd_mbhc_cb mbhc_cb = {
|
||||
.enable_mb_source = msm8x16_wcd_enable_ext_mb_source,
|
||||
.trim_btn_reg = msm8x16_trim_btn_reg,
|
||||
};
|
||||
|
||||
int msm8x16_unregister_notifier(struct snd_soc_codec *codec,
|
||||
|
@ -1812,6 +1814,26 @@ static int msm8x16_wcd_codec_enable_dmic(struct snd_soc_dapm_widget *w,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void msm8x16_trim_btn_reg(struct snd_soc_codec *codec)
|
||||
{
|
||||
struct msm8x16_wcd_priv *msm8x16_wcd = snd_soc_codec_get_drvdata(codec);
|
||||
|
||||
if (TOMBAK_IS_1_0(msm8x16_wcd->pmic_rev)) {
|
||||
pr_debug("%s: This device needs to be trimmed\n", __func__);
|
||||
/*
|
||||
* Calculate the trim value for each device used
|
||||
* till is comes in production by hardware team
|
||||
*/
|
||||
snd_soc_update_bits(codec,
|
||||
MSM8X16_WCD_A_ANALOG_SEC_ACCESS,
|
||||
0xA5, 0xA5);
|
||||
snd_soc_update_bits(codec,
|
||||
MSM8X16_WCD_A_ANALOG_TRIM_CTRL2,
|
||||
0xFF, 0x30);
|
||||
} else {
|
||||
pr_debug("%s: This device is trimmed at ATE\n", __func__);
|
||||
}
|
||||
}
|
||||
static int msm8x16_wcd_enable_ext_mb_source(struct snd_soc_codec *codec,
|
||||
bool turn_on)
|
||||
{
|
||||
|
|
|
@ -1121,16 +1121,9 @@ static void wcd_mbhc_swch_irq_handler(struct wcd_mbhc *mbhc)
|
|||
snd_soc_update_bits(codec,
|
||||
MSM8X16_WCD_A_ANALOG_MBHC_FSM_CTL,
|
||||
0x80, 0x80);
|
||||
/*
|
||||
* Calculate the trim value for each device used
|
||||
* till is comes in production by hardware team.
|
||||
*/
|
||||
snd_soc_update_bits(codec,
|
||||
MSM8X16_WCD_A_ANALOG_SEC_ACCESS,
|
||||
0xA5, 0xA5);
|
||||
snd_soc_update_bits(codec,
|
||||
MSM8X16_WCD_A_ANALOG_TRIM_CTRL2,
|
||||
0xFF, 0x30);
|
||||
/* Apply trim if needed on the device */
|
||||
if (mbhc->mbhc_cb && mbhc->mbhc_cb->trim_btn_reg)
|
||||
mbhc->mbhc_cb->trim_btn_reg(codec);
|
||||
wcd_mbhc_detect_plug_type(mbhc);
|
||||
} else if ((mbhc->current_plug != MBHC_PLUG_TYPE_NONE)
|
||||
&& !detection_type) {
|
||||
|
|
|
@ -64,6 +64,7 @@ struct wcd_mbhc_intr {
|
|||
|
||||
struct wcd_mbhc_cb {
|
||||
int (*enable_mb_source) (struct snd_soc_codec *, bool);
|
||||
void (*trim_btn_reg) (struct snd_soc_codec *);
|
||||
};
|
||||
|
||||
struct wcd_mbhc {
|
||||
|
|
Loading…
Reference in a new issue