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

Commit f1e8dfdc authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "ASoC: wcd: perform trim for only 1.0 HW"

parents cae0d941 6b5f77a9
Loading
Loading
Loading
Loading
+22 −0
Original line number Diff line number Diff line
@@ -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)
{
+3 −10
Original line number Diff line number Diff line
@@ -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) {
+1 −0
Original line number Diff line number Diff line
@@ -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 {