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

Commit 8b60b114 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: mbhc: Report SW_LINEOUT_INSERT"

parents 898a9b2f b432cb82
Loading
Loading
Loading
Loading
+20 −5
Original line number Diff line number Diff line
@@ -140,6 +140,12 @@
#define WCD9XXX_BOX_CAR_AVRG_MIN 1
#define WCD9XXX_BOX_CAR_AVRG_MAX 10

/*
 * Need to report LINEIN if H/L impedance
 * is larger than 5K ohm
 */
#define WCD9XXX_LINEIN_THRESHOLD 5000000

static int impedance_detect_en;
module_param(impedance_detect_en, int,
			S_IRUGO | S_IWUSR | S_IWGRP);
@@ -933,8 +939,6 @@ static void wcd9xxx_report_plug(struct wcd9xxx_mbhc *mbhc, int insertion,
		}

		/* Report insertion */
		mbhc->hph_status |= jack_type;

		if (jack_type == SND_JACK_HEADPHONE) {
			mbhc->current_plug = PLUG_TYPE_HEADPHONE;
		} else if (jack_type == SND_JACK_UNSUPPORTED) {
@@ -950,15 +954,26 @@ static void wcd9xxx_report_plug(struct wcd9xxx_mbhc *mbhc, int insertion,
			mbhc->current_plug = PLUG_TYPE_ANC_HEADPHONE;
		}

		if (mbhc->impedance_detect && impedance_detect_en) {
			wcd9xxx_detect_impedance(mbhc,
					&mbhc->zl, &mbhc->zr);
			if ((mbhc->zl > WCD9XXX_LINEIN_THRESHOLD) &&
				(mbhc->zr > WCD9XXX_LINEIN_THRESHOLD)) {
				jack_type = SND_JACK_LINEOUT;
				mbhc->current_plug = PLUG_TYPE_HIGH_HPH;
				pr_debug("%s: Replace with SND_JACK_LINEOUT\n",
				__func__);
			}
		}

		mbhc->hph_status |= jack_type;

		if (mbhc->micbias_enable && mbhc->micbias_enable_cb) {
			pr_debug("%s: Enabling micbias\n", __func__);
			mbhc->micbias_enable_cb(mbhc->codec, true,
						mbhc->mbhc_cfg->micbias);
		}

		if (mbhc->impedance_detect && impedance_detect_en)
			wcd9xxx_detect_impedance(mbhc, &mbhc->zl, &mbhc->zr);

		pr_debug("%s: Reporting insertion %d(%x)\n", __func__,
			 jack_type, mbhc->hph_status);
		wcd9xxx_jack_report(mbhc, &mbhc->headset_jack,