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

Commit 3be5e206 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: Add HPH auto pull down support"

parents 3bc1fc8b 73f3c6c2
Loading
Loading
Loading
Loading
+20 −0
Original line number Diff line number Diff line
@@ -7675,6 +7675,25 @@ static void tomtom_mbhc_micb_pulldown_ctrl(struct wcd9xxx_mbhc *mbhc,
	}
}

static void tomtom_codec_hph_auto_pull_down(struct snd_soc_codec *codec,
					    bool enable)
{
	struct wcd9xxx *tomtom_core = dev_get_drvdata(codec->dev->parent);

	if (TOMTOM_IS_1_0(tomtom_core->version))
		return;

	dev_dbg(codec->dev, "%s: %s auto pull down\n", __func__,
			enable ? "enable" : "disable");
	if (enable) {
		snd_soc_update_bits(codec, TOMTOM_A_RX_HPH_L_TEST, 0x08, 0x08);
		snd_soc_update_bits(codec, TOMTOM_A_RX_HPH_R_TEST, 0x08, 0x08);
	} else {
		snd_soc_update_bits(codec, TOMTOM_A_RX_HPH_L_TEST, 0x08, 0x00);
		snd_soc_update_bits(codec, TOMTOM_A_RX_HPH_R_TEST, 0x08, 0x00);
	}
}

static const struct wcd9xxx_mbhc_cb mbhc_cb = {
	.get_cdc_type = tomtom_get_cdc_type,
	.setup_zdet = tomtom_setup_zdet,
@@ -7683,6 +7702,7 @@ static const struct wcd9xxx_mbhc_cb mbhc_cb = {
	.insert_rem_status = tomtom_mbhc_ins_rem_status,
	.micbias_pulldown_ctrl = tomtom_mbhc_micb_pulldown_ctrl,
	.codec_rco_ctrl = tomtom_codec_internal_rco_ctrl,
	.hph_auto_pulldown_ctrl = tomtom_codec_hph_auto_pull_down,
};

static const struct wcd9xxx_mbhc_intr cdc_intr_ids = {
+13 −0
Original line number Diff line number Diff line
@@ -881,6 +881,9 @@ static void wcd9xxx_report_plug(struct wcd9xxx_mbhc *mbhc, int insertion,
		hphlocp_off_report(mbhc, SND_JACK_OC_HPHL);
		mbhc->current_plug = PLUG_TYPE_NONE;
		mbhc->polling_active = false;
		if (mbhc->mbhc_cb && mbhc->mbhc_cb->hph_auto_pulldown_ctrl)
			mbhc->mbhc_cb->hph_auto_pulldown_ctrl(mbhc->codec,
								false);
	} else {
		/*
		 * Report removal of current jack type.
@@ -908,6 +911,11 @@ static void wcd9xxx_report_plug(struct wcd9xxx_mbhc *mbhc, int insertion,
						SND_JACK_LINEOUT |
						SND_JACK_ANC_HEADPHONE |
						SND_JACK_UNSUPPORTED);
			if (mbhc->mbhc_cb &&
				 mbhc->mbhc_cb->hph_auto_pulldown_ctrl)
				mbhc->mbhc_cb->hph_auto_pulldown_ctrl(
								mbhc->codec,
								false);
		}

		/* Report insertion */
@@ -3205,6 +3213,11 @@ static void wcd9xxx_correct_swch_plug(struct work_struct *work)
		WCD9XXX_BCL_UNLOCK(mbhc->resmgr);
	}

	if (plug_type == PLUG_TYPE_HEADPHONE) {
		if (mbhc->mbhc_cb && mbhc->mbhc_cb->hph_auto_pulldown_ctrl)
			mbhc->mbhc_cb->hph_auto_pulldown_ctrl(codec, true);
	}

	if (!correction && current_source_enable) {
		WCD9XXX_BCL_LOCK(mbhc->resmgr);
		wcd9xxx_turn_onoff_current_source(mbhc, &mbhc->mbhc_bias_regs,
+1 −0
Original line number Diff line number Diff line
@@ -317,6 +317,7 @@ struct wcd9xxx_mbhc_cb {
	bool (*insert_rem_status) (struct snd_soc_codec *);
	void (*micbias_pulldown_ctrl) (struct wcd9xxx_mbhc *, bool);
	int (*codec_rco_ctrl) (struct snd_soc_codec *, bool);
	void (*hph_auto_pulldown_ctrl) (struct snd_soc_codec *, bool);
};

struct wcd9xxx_mbhc {