linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] ASoC: codecs: MBHC: Add support for special headset
@ 2021-11-15  7:11 Srinivasa Rao Mandadapu
  2021-11-15 16:55 ` Mark Brown
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Srinivasa Rao Mandadapu @ 2021-11-15  7:11 UTC (permalink / raw)
  To: agross, bjorn.andersson, lgirdwood, broonie, robh+dt, plai,
	bgoswami, perex, tiwai, srinivas.kandagatla, rohitkr,
	linux-arm-msm, alsa-devel, devicetree, linux-kernel, swboyd,
	judyhsiao
  Cc: Srinivasa Rao Mandadapu, Venkata Prasad Potturu

Update MBHC driver to support special headset such as apple
and huwawei headsets.

Changes Since V1:
    -- Fix typo errors.

Signed-off-by: Srinivasa Rao Mandadapu <srivasam@codeaurora.org>
Co-developed-by: Venkata Prasad Potturu <potturu@codeaurora.org>
Signed-off-by: Venkata Prasad Potturu <potturu@codeaurora.org>
Reviewed-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
---
 sound/soc/codecs/wcd-mbhc-v2.c | 75 +++++++++++++++++++++++++++++++++++++++---
 1 file changed, 71 insertions(+), 4 deletions(-)

diff --git a/sound/soc/codecs/wcd-mbhc-v2.c b/sound/soc/codecs/wcd-mbhc-v2.c
index 405128c..d6545e4 100644
--- a/sound/soc/codecs/wcd-mbhc-v2.c
+++ b/sound/soc/codecs/wcd-mbhc-v2.c
@@ -1022,6 +1022,56 @@ static int wcd_mbhc_get_plug_from_adc(struct wcd_mbhc *mbhc, int adc_result)
 	return plug_type;
 }
 
+static int wcd_mbhc_get_spl_hs_thres(struct wcd_mbhc *mbhc)
+{
+	int hs_threshold, micbias_mv;
+
+	micbias_mv = wcd_mbhc_get_micbias(mbhc);
+	if (mbhc->cfg->hs_thr && mbhc->cfg->micb_mv != WCD_MBHC_ADC_MICBIAS_MV) {
+		if (mbhc->cfg->micb_mv == micbias_mv)
+			hs_threshold = mbhc->cfg->hs_thr;
+		else
+			hs_threshold = (mbhc->cfg->hs_thr * micbias_mv) / mbhc->cfg->micb_mv;
+	} else {
+		hs_threshold = ((WCD_MBHC_ADC_HS_THRESHOLD_MV * micbias_mv) /
+							WCD_MBHC_ADC_MICBIAS_MV);
+	}
+	return hs_threshold;
+}
+
+static bool wcd_mbhc_check_for_spl_headset(struct wcd_mbhc *mbhc)
+{
+	bool is_spl_hs = false;
+	int output_mv, hs_threshold, hph_threshold;
+
+	if (!mbhc->mbhc_cb->mbhc_micb_ctrl_thr_mic)
+		return false;
+
+	/* Bump up MIC_BIAS2 to 2.7V */
+	mbhc->mbhc_cb->mbhc_micb_ctrl_thr_mic(mbhc->component, MIC_BIAS_2, true);
+	usleep_range(10000, 10100);
+
+	output_mv = wcd_measure_adc_once(mbhc, MUX_CTL_IN2P);
+	hs_threshold = wcd_mbhc_get_spl_hs_thres(mbhc);
+	hph_threshold = wcd_mbhc_adc_get_hph_thres(mbhc);
+
+	if (output_mv > hs_threshold || output_mv < hph_threshold) {
+		if (mbhc->force_linein == true)
+			is_spl_hs = false;
+	} else {
+		is_spl_hs = true;
+	}
+
+	/* Back MIC_BIAS2 to 1.8v if the type is not special headset */
+	if (!is_spl_hs) {
+		mbhc->mbhc_cb->mbhc_micb_ctrl_thr_mic(mbhc->component, MIC_BIAS_2, false);
+		/* Add 10ms delay for micbias to settle */
+		usleep_range(10000, 10100);
+	}
+
+	return is_spl_hs;
+}
+
 static void wcd_correct_swch_plug(struct work_struct *work)
 {
 	struct wcd_mbhc *mbhc;
@@ -1029,12 +1079,14 @@ static void wcd_correct_swch_plug(struct work_struct *work)
 	enum wcd_mbhc_plug_type plug_type = MBHC_PLUG_TYPE_INVALID;
 	unsigned long timeout;
 	int pt_gnd_mic_swap_cnt = 0;
-	int output_mv, cross_conn, hs_threshold, try = 0;
+	int output_mv, cross_conn, hs_threshold, try = 0, micbias_mv;
+	bool is_spl_hs = false;
 	bool is_pa_on;
 
 	mbhc = container_of(work, struct wcd_mbhc, correct_plug_swch);
 	component = mbhc->component;
 
+	micbias_mv = wcd_mbhc_get_micbias(mbhc);
 	hs_threshold = wcd_mbhc_adc_get_hs_thres(mbhc);
 
 	/* Mask ADC COMPLETE interrupt */
@@ -1097,6 +1149,16 @@ static void wcd_correct_swch_plug(struct work_struct *work)
 		plug_type = wcd_mbhc_get_plug_from_adc(mbhc, output_mv);
 		is_pa_on = wcd_mbhc_read_field(mbhc, WCD_MBHC_HPH_PA_EN);
 
+		if ((output_mv > hs_threshold) && (!is_spl_hs)) {
+			is_spl_hs = wcd_mbhc_check_for_spl_headset(mbhc);
+			output_mv = wcd_measure_adc_once(mbhc, MUX_CTL_IN2P);
+
+			if (is_spl_hs) {
+				hs_threshold = (hs_threshold * wcd_mbhc_get_micbias(mbhc)) /
+									micbias_mv;
+			}
+		}
+
 		if ((output_mv <= hs_threshold) && !is_pa_on) {
 			/* Check for cross connection*/
 			cross_conn = wcd_check_cross_conn(mbhc);
@@ -1122,14 +1184,19 @@ static void wcd_correct_swch_plug(struct work_struct *work)
 			}
 		}
 
-		if (output_mv > hs_threshold) /* cable is extension cable */
+		/* cable is extension cable */
+		if (output_mv > hs_threshold || mbhc->force_linein == true)
 			plug_type = MBHC_PLUG_TYPE_HIGH_HPH;
 	}
 
 	wcd_mbhc_bcs_enable(mbhc, plug_type, true);
 
-	if (plug_type == MBHC_PLUG_TYPE_HIGH_HPH)
-		wcd_mbhc_write_field(mbhc, WCD_MBHC_ELECT_ISRC_EN, 1);
+	if (plug_type == MBHC_PLUG_TYPE_HIGH_HPH) {
+		if (is_spl_hs)
+			plug_type = MBHC_PLUG_TYPE_HEADSET;
+		else
+			wcd_mbhc_write_field(mbhc, WCD_MBHC_ELECT_ISRC_EN, 1);
+	}
 
 	wcd_mbhc_write_field(mbhc, WCD_MBHC_ADC_MODE, 0);
 	wcd_mbhc_write_field(mbhc, WCD_MBHC_ADC_EN, 0);
-- 
Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc.,
is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] ASoC: codecs: MBHC: Add support for special headset
  2021-11-15  7:11 [PATCH v2] ASoC: codecs: MBHC: Add support for special headset Srinivasa Rao Mandadapu
@ 2021-11-15 16:55 ` Mark Brown
  2021-11-15 23:35 ` Mark Brown
  2021-11-15 23:36 ` Stephen Boyd
  2 siblings, 0 replies; 5+ messages in thread
From: Mark Brown @ 2021-11-15 16:55 UTC (permalink / raw)
  To: Srinivasa Rao Mandadapu
  Cc: agross, bjorn.andersson, lgirdwood, robh+dt, plai, bgoswami,
	perex, tiwai, srinivas.kandagatla, rohitkr, linux-arm-msm,
	alsa-devel, devicetree, linux-kernel, swboyd, judyhsiao,
	Venkata Prasad Potturu

[-- Attachment #1: Type: text/plain, Size: 359 bytes --]

On Mon, Nov 15, 2021 at 12:41:28PM +0530, Srinivasa Rao Mandadapu wrote:
> Update MBHC driver to support special headset such as apple
> and huwawei headsets.
> 
> Changes Since V1:
>     -- Fix typo errors.

As covered in submitting-patches.rst the inter-version changes should go
after the --- so they don't end up creating noise in the changelog.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] ASoC: codecs: MBHC: Add support for special headset
  2021-11-15  7:11 [PATCH v2] ASoC: codecs: MBHC: Add support for special headset Srinivasa Rao Mandadapu
  2021-11-15 16:55 ` Mark Brown
@ 2021-11-15 23:35 ` Mark Brown
  2021-11-15 23:36 ` Stephen Boyd
  2 siblings, 0 replies; 5+ messages in thread
From: Mark Brown @ 2021-11-15 23:35 UTC (permalink / raw)
  To: swboyd, devicetree, bjorn.andersson, linux-arm-msm, rohitkr,
	robh+dt, alsa-devel, plai, linux-kernel, perex, judyhsiao,
	lgirdwood, Srinivasa Rao Mandadapu, tiwai, bgoswami, agross,
	srinivas.kandagatla
  Cc: Venkata Prasad Potturu

On Mon, 15 Nov 2021 12:41:28 +0530, Srinivasa Rao Mandadapu wrote:
> Update MBHC driver to support special headset such as apple
> and huwawei headsets.
> 
> Changes Since V1:
>     -- Fix typo errors.
> 
> 
> [...]

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next

Thanks!

[1/1] ASoC: codecs: MBHC: Add support for special headset
      commit: 3c8a3ad4019126f06016ab0128dde11817502f52

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] ASoC: codecs: MBHC: Add support for special headset
  2021-11-15  7:11 [PATCH v2] ASoC: codecs: MBHC: Add support for special headset Srinivasa Rao Mandadapu
  2021-11-15 16:55 ` Mark Brown
  2021-11-15 23:35 ` Mark Brown
@ 2021-11-15 23:36 ` Stephen Boyd
  2021-11-18 10:51   ` Srinivasa Rao Mandadapu
  2 siblings, 1 reply; 5+ messages in thread
From: Stephen Boyd @ 2021-11-15 23:36 UTC (permalink / raw)
  To: Srinivasa Rao Mandadapu, agross, alsa-devel, bgoswami,
	bjorn.andersson, broonie, devicetree, judyhsiao, lgirdwood,
	linux-arm-msm, linux-kernel, perex, plai, robh+dt, rohitkr,
	srinivas.kandagatla, tiwai
  Cc: Venkata Prasad Potturu

Quoting Srinivasa Rao Mandadapu (2021-11-14 23:11:28)
> diff --git a/sound/soc/codecs/wcd-mbhc-v2.c b/sound/soc/codecs/wcd-mbhc-v2.c
> index 405128c..d6545e4 100644
> --- a/sound/soc/codecs/wcd-mbhc-v2.c
> +++ b/sound/soc/codecs/wcd-mbhc-v2.c
> @@ -1022,6 +1022,56 @@ static int wcd_mbhc_get_plug_from_adc(struct wcd_mbhc *mbhc, int adc_result)
>         return plug_type;
>  }
>
> +static int wcd_mbhc_get_spl_hs_thres(struct wcd_mbhc *mbhc)
> +{
> +       int hs_threshold, micbias_mv;
> +
> +       micbias_mv = wcd_mbhc_get_micbias(mbhc);
> +       if (mbhc->cfg->hs_thr && mbhc->cfg->micb_mv != WCD_MBHC_ADC_MICBIAS_MV) {
> +               if (mbhc->cfg->micb_mv == micbias_mv)
> +                       hs_threshold = mbhc->cfg->hs_thr;
> +               else
> +                       hs_threshold = (mbhc->cfg->hs_thr * micbias_mv) / mbhc->cfg->micb_mv;
> +       } else {
> +               hs_threshold = ((WCD_MBHC_ADC_HS_THRESHOLD_MV * micbias_mv) /
> +                                                       WCD_MBHC_ADC_MICBIAS_MV);
> +       }
> +       return hs_threshold;
> +}
> +
> +static bool wcd_mbhc_check_for_spl_headset(struct wcd_mbhc *mbhc)
> +{
> +       bool is_spl_hs = false;
> +       int output_mv, hs_threshold, hph_threshold;
> +
> +       if (!mbhc->mbhc_cb->mbhc_micb_ctrl_thr_mic)
> +               return false;
> +
> +       /* Bump up MIC_BIAS2 to 2.7V */
> +       mbhc->mbhc_cb->mbhc_micb_ctrl_thr_mic(mbhc->component, MIC_BIAS_2, true);
> +       usleep_range(10000, 10100);
> +
> +       output_mv = wcd_measure_adc_once(mbhc, MUX_CTL_IN2P);
> +       hs_threshold = wcd_mbhc_get_spl_hs_thres(mbhc);
> +       hph_threshold = wcd_mbhc_adc_get_hph_thres(mbhc);
> +
> +       if (output_mv > hs_threshold || output_mv < hph_threshold) {
> +               if (mbhc->force_linein == true)

Just 'if (mbhc->force_linein)'

Also, if this is false, then false is set above. So checking for
mbhc->force_linein is useless.

> +                       is_spl_hs = false;
> +       } else {
> +               is_spl_hs = true;
> +       }
> +
> +       /* Back MIC_BIAS2 to 1.8v if the type is not special headset */
> +       if (!is_spl_hs) {
> +               mbhc->mbhc_cb->mbhc_micb_ctrl_thr_mic(mbhc->component, MIC_BIAS_2, false);
> +               /* Add 10ms delay for micbias to settle */
> +               usleep_range(10000, 10100);
> +       }
> +
> +       return is_spl_hs;
> +}
> +
>  static void wcd_correct_swch_plug(struct work_struct *work)
>  {
>         struct wcd_mbhc *mbhc;
> @@ -1029,12 +1079,14 @@ static void wcd_correct_swch_plug(struct work_struct *work)
>         enum wcd_mbhc_plug_type plug_type = MBHC_PLUG_TYPE_INVALID;
>         unsigned long timeout;
>         int pt_gnd_mic_swap_cnt = 0;
> -       int output_mv, cross_conn, hs_threshold, try = 0;
> +       int output_mv, cross_conn, hs_threshold, try = 0, micbias_mv;
> +       bool is_spl_hs = false;
>         bool is_pa_on;
>
>         mbhc = container_of(work, struct wcd_mbhc, correct_plug_swch);
>         component = mbhc->component;
>
> +       micbias_mv = wcd_mbhc_get_micbias(mbhc);
>         hs_threshold = wcd_mbhc_adc_get_hs_thres(mbhc);
>
>         /* Mask ADC COMPLETE interrupt */
> @@ -1097,6 +1149,16 @@ static void wcd_correct_swch_plug(struct work_struct *work)
>                 plug_type = wcd_mbhc_get_plug_from_adc(mbhc, output_mv);
>                 is_pa_on = wcd_mbhc_read_field(mbhc, WCD_MBHC_HPH_PA_EN);
>
> +               if ((output_mv > hs_threshold) && (!is_spl_hs)) {

Please drop useless parenthesis

> +                       is_spl_hs = wcd_mbhc_check_for_spl_headset(mbhc);
> +                       output_mv = wcd_measure_adc_once(mbhc, MUX_CTL_IN2P);
> +
> +                       if (is_spl_hs) {
> +                               hs_threshold = (hs_threshold * wcd_mbhc_get_micbias(mbhc)) /
> +                                                                       micbias_mv;

Same. It may be good to split it to two assignments to clarify
overflow/underflow.

> +                       }
> +               }
> +
>                 if ((output_mv <= hs_threshold) && !is_pa_on) {
>                         /* Check for cross connection*/
>                         cross_conn = wcd_check_cross_conn(mbhc);
> @@ -1122,14 +1184,19 @@ static void wcd_correct_swch_plug(struct work_struct *work)
>                         }
>                 }
>
> -               if (output_mv > hs_threshold) /* cable is extension cable */
> +               /* cable is extension cable */
> +               if (output_mv > hs_threshold || mbhc->force_linein == true)

Drop the == true please.

>                         plug_type = MBHC_PLUG_TYPE_HIGH_HPH;
>         }
>
>         wcd_mbhc_bcs_enable(mbhc, plug_type, true);
>
> -       if (plug_type == MBHC_PLUG_TYPE_HIGH_HPH)
> -               wcd_mbhc_write_field(mbhc, WCD_MBHC_ELECT_ISRC_EN, 1);
> +       if (plug_type == MBHC_PLUG_TYPE_HIGH_HPH) {
> +               if (is_spl_hs)
> +                       plug_type = MBHC_PLUG_TYPE_HEADSET;
> +               else
> +                       wcd_mbhc_write_field(mbhc, WCD_MBHC_ELECT_ISRC_EN, 1);
> +       }
>
>         wcd_mbhc_write_field(mbhc, WCD_MBHC_ADC_MODE, 0);
>         wcd_mbhc_write_field(mbhc, WCD_MBHC_ADC_EN, 0);

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] ASoC: codecs: MBHC: Add support for special headset
  2021-11-15 23:36 ` Stephen Boyd
@ 2021-11-18 10:51   ` Srinivasa Rao Mandadapu
  0 siblings, 0 replies; 5+ messages in thread
From: Srinivasa Rao Mandadapu @ 2021-11-18 10:51 UTC (permalink / raw)
  To: Stephen Boyd, agross, alsa-devel, bgoswami, bjorn.andersson,
	broonie, devicetree, judyhsiao, lgirdwood, linux-arm-msm,
	linux-kernel, perex, plai, robh+dt, rohitkr, srinivas.kandagatla,
	tiwai
  Cc: Venkata Prasad Potturu


On 11/16/2021 5:06 AM, Stephen Boyd wrote:
Thanks for Your time Stephen!!!
As this patch is already accepted, will post your review comments as 
additional patch.
> Quoting Srinivasa Rao Mandadapu (2021-11-14 23:11:28)
>> diff --git a/sound/soc/codecs/wcd-mbhc-v2.c b/sound/soc/codecs/wcd-mbhc-v2.c
>> index 405128c..d6545e4 100644
>> --- a/sound/soc/codecs/wcd-mbhc-v2.c
>> +++ b/sound/soc/codecs/wcd-mbhc-v2.c
>> @@ -1022,6 +1022,56 @@ static int wcd_mbhc_get_plug_from_adc(struct wcd_mbhc *mbhc, int adc_result)
>>          return plug_type;
>>   }
>>
>> +static int wcd_mbhc_get_spl_hs_thres(struct wcd_mbhc *mbhc)
>> +{
>> +       int hs_threshold, micbias_mv;
>> +
>> +       micbias_mv = wcd_mbhc_get_micbias(mbhc);
>> +       if (mbhc->cfg->hs_thr && mbhc->cfg->micb_mv != WCD_MBHC_ADC_MICBIAS_MV) {
>> +               if (mbhc->cfg->micb_mv == micbias_mv)
>> +                       hs_threshold = mbhc->cfg->hs_thr;
>> +               else
>> +                       hs_threshold = (mbhc->cfg->hs_thr * micbias_mv) / mbhc->cfg->micb_mv;
>> +       } else {
>> +               hs_threshold = ((WCD_MBHC_ADC_HS_THRESHOLD_MV * micbias_mv) /
>> +                                                       WCD_MBHC_ADC_MICBIAS_MV);
>> +       }
>> +       return hs_threshold;
>> +}
>> +
>> +static bool wcd_mbhc_check_for_spl_headset(struct wcd_mbhc *mbhc)
>> +{
>> +       bool is_spl_hs = false;
>> +       int output_mv, hs_threshold, hph_threshold;
>> +
>> +       if (!mbhc->mbhc_cb->mbhc_micb_ctrl_thr_mic)
>> +               return false;
>> +
>> +       /* Bump up MIC_BIAS2 to 2.7V */
>> +       mbhc->mbhc_cb->mbhc_micb_ctrl_thr_mic(mbhc->component, MIC_BIAS_2, true);
>> +       usleep_range(10000, 10100);
>> +
>> +       output_mv = wcd_measure_adc_once(mbhc, MUX_CTL_IN2P);
>> +       hs_threshold = wcd_mbhc_get_spl_hs_thres(mbhc);
>> +       hph_threshold = wcd_mbhc_adc_get_hph_thres(mbhc);
>> +
>> +       if (output_mv > hs_threshold || output_mv < hph_threshold) {
>> +               if (mbhc->force_linein == true)
> Just 'if (mbhc->force_linein)'
>
> Also, if this is false, then false is set above. So checking for
> mbhc->force_linein is useless.
Okay. Will check and do changes.
>
>> +                       is_spl_hs = false;
>> +       } else {
>> +               is_spl_hs = true;
>> +       }
>> +
>> +       /* Back MIC_BIAS2 to 1.8v if the type is not special headset */
>> +       if (!is_spl_hs) {
>> +               mbhc->mbhc_cb->mbhc_micb_ctrl_thr_mic(mbhc->component, MIC_BIAS_2, false);
>> +               /* Add 10ms delay for micbias to settle */
>> +               usleep_range(10000, 10100);
>> +       }
>> +
>> +       return is_spl_hs;
>> +}
>> +
>>   static void wcd_correct_swch_plug(struct work_struct *work)
>>   {
>>          struct wcd_mbhc *mbhc;
>> @@ -1029,12 +1079,14 @@ static void wcd_correct_swch_plug(struct work_struct *work)
>>          enum wcd_mbhc_plug_type plug_type = MBHC_PLUG_TYPE_INVALID;
>>          unsigned long timeout;
>>          int pt_gnd_mic_swap_cnt = 0;
>> -       int output_mv, cross_conn, hs_threshold, try = 0;
>> +       int output_mv, cross_conn, hs_threshold, try = 0, micbias_mv;
>> +       bool is_spl_hs = false;
>>          bool is_pa_on;
>>
>>          mbhc = container_of(work, struct wcd_mbhc, correct_plug_swch);
>>          component = mbhc->component;
>>
>> +       micbias_mv = wcd_mbhc_get_micbias(mbhc);
>>          hs_threshold = wcd_mbhc_adc_get_hs_thres(mbhc);
>>
>>          /* Mask ADC COMPLETE interrupt */
>> @@ -1097,6 +1149,16 @@ static void wcd_correct_swch_plug(struct work_struct *work)
>>                  plug_type = wcd_mbhc_get_plug_from_adc(mbhc, output_mv);
>>                  is_pa_on = wcd_mbhc_read_field(mbhc, WCD_MBHC_HPH_PA_EN);
>>
>> +               if ((output_mv > hs_threshold) && (!is_spl_hs)) {
> Please drop useless parenthesis
Okay.
>
>> +                       is_spl_hs = wcd_mbhc_check_for_spl_headset(mbhc);
>> +                       output_mv = wcd_measure_adc_once(mbhc, MUX_CTL_IN2P);
>> +
>> +                       if (is_spl_hs) {
>> +                               hs_threshold = (hs_threshold * wcd_mbhc_get_micbias(mbhc)) /
>> +                                                                       micbias_mv;
> Same. It may be good to split it to two assignments to clarify
> overflow/underflow.
Okay.
>
>> +                       }
>> +               }
>> +
>>                  if ((output_mv <= hs_threshold) && !is_pa_on) {
>>                          /* Check for cross connection*/
>>                          cross_conn = wcd_check_cross_conn(mbhc);
>> @@ -1122,14 +1184,19 @@ static void wcd_correct_swch_plug(struct work_struct *work)
>>                          }
>>                  }
>>
>> -               if (output_mv > hs_threshold) /* cable is extension cable */
>> +               /* cable is extension cable */
>> +               if (output_mv > hs_threshold || mbhc->force_linein == true)
> Drop the == true please.
Okay.
>
>>                          plug_type = MBHC_PLUG_TYPE_HIGH_HPH;
>>          }
>>
>>          wcd_mbhc_bcs_enable(mbhc, plug_type, true);
>>
>> -       if (plug_type == MBHC_PLUG_TYPE_HIGH_HPH)
>> -               wcd_mbhc_write_field(mbhc, WCD_MBHC_ELECT_ISRC_EN, 1);
>> +       if (plug_type == MBHC_PLUG_TYPE_HIGH_HPH) {
>> +               if (is_spl_hs)
>> +                       plug_type = MBHC_PLUG_TYPE_HEADSET;
>> +               else
>> +                       wcd_mbhc_write_field(mbhc, WCD_MBHC_ELECT_ISRC_EN, 1);
>> +       }
>>
>>          wcd_mbhc_write_field(mbhc, WCD_MBHC_ADC_MODE, 0);
>>          wcd_mbhc_write_field(mbhc, WCD_MBHC_ADC_EN, 0);

-- 
Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc.,
is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-11-18 10:51 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-15  7:11 [PATCH v2] ASoC: codecs: MBHC: Add support for special headset Srinivasa Rao Mandadapu
2021-11-15 16:55 ` Mark Brown
2021-11-15 23:35 ` Mark Brown
2021-11-15 23:36 ` Stephen Boyd
2021-11-18 10:51   ` Srinivasa Rao Mandadapu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).