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

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

Merge "ASoC: wcd9xxx: Handle codec register config if MBHC is disabled"

parents 5c0c1076 a1a8b5dc
Loading
Loading
Loading
Loading
+14 −3
Original line number Diff line number Diff line
@@ -7662,9 +7662,20 @@ int tomtom_hs_detect(struct snd_soc_codec *codec,
{
	int rc;
	struct tomtom_priv *tomtom = snd_soc_codec_get_drvdata(codec);

	if (mbhc_cfg->insert_detect) {
		rc = wcd9xxx_mbhc_start(&tomtom->mbhc, mbhc_cfg);
		if (!rc)
			tomtom->mbhc_started = true;
	} else {
		/* MBHC is disabled, so disable Auto pulldown */
		snd_soc_update_bits(codec, TOMTOM_A_MBHC_INSERT_DETECT2, 0xC0,
				    0x00);
		snd_soc_update_bits(codec, TOMTOM_A_MICB_CFILT_2_CTL, 0x01,
				    0x00);
		tomtom->mbhc.mbhc_cfg = NULL;
		rc = 0;
	}
	return rc;
}
EXPORT_SYMBOL(tomtom_hs_detect);
+11 −4
Original line number Diff line number Diff line
@@ -1146,14 +1146,16 @@ static s32 __wcd9xxx_codec_sta_dce_v(struct wcd9xxx_mbhc *mbhc, s8 dce,
				     u16 bias_value, s16 z, u32 micb_mv)
{
	s16 value, mb;
	s32 mv;
	s32 mv = 0;

	value = bias_value;
	if (dce) {
		mb = (mbhc->mbhc_data.dce_mb);
		if (mb - z)
			mv = (value - z) * (s32)micb_mv / (mb - z);
	} else {
		mb = (mbhc->mbhc_data.sta_mb);
		if (mb - z)
			mv = (value - z) * (s32)micb_mv / (mb - z);
	}

@@ -4736,12 +4738,17 @@ static int wcd9xxx_event_notify(struct notifier_block *self, unsigned long val,
{
	int ret = 0;
	struct wcd9xxx_mbhc *mbhc = ((struct wcd9xxx_resmgr *)data)->mbhc;
	struct snd_soc_codec *codec = mbhc->codec;
	struct snd_soc_codec *codec;
	enum wcd9xxx_notify_event event = (enum wcd9xxx_notify_event)val;

	pr_debug("%s: enter event %s(%d)\n", __func__,
		 wcd9xxx_get_event_string(event), event);

	if (!mbhc || !mbhc->mbhc_cfg) {
		pr_debug("mbhc not initialized\n");
		return 0;
	}
	codec = mbhc->codec;
	mutex_lock(&mbhc->mbhc_lock);
	switch (event) {
	/* MICBIAS usage change */