2022-04-05 22:21:50

by Mauro Carvalho Chehab

[permalink] [raw]
Subject: [PATCH v2 0/2] Make headphone work on Huawei Matebook D15

At Huawei Matebook D15 two different GPIOs are used to control the output:
- gpio0 controls the speaker output;
- gpio1 controls the headphone output.

Changing both at the same time cause spurious events that are mis-interpreted
as input events, causing troubles on apps. So, a delay is needed before turning
on such gpios.

With this patch, plugging a headphone causes a jack event to trigger the speaker
supply, powering down the speaker and powering up the headphone output.
Removing the headphone also triggers the power supply, powering up the speaker
and powering down the headphone.

Mauro Carvalho Chehab (2):
ASoC: Intel: sof_es8336: support a separate gpio to control headphone
ASoC: Intel: sof_es8336: Huawei Matebook D15 uses a headphone gpio

sound/soc/intel/boards/sof_es8336.c | 68 ++++++++++++++++++++++++-----
1 file changed, 58 insertions(+), 10 deletions(-)

--
2.35.1



2022-04-06 02:07:13

by Hans de Goede

[permalink] [raw]
Subject: Re: [PATCH v2 0/2] Make headphone work on Huawei Matebook D15

Hi,

On 4/5/22 10:44, Mauro Carvalho Chehab wrote:
> At Huawei Matebook D15 two different GPIOs are used to control the output:
> - gpio0 controls the speaker output;
> - gpio1 controls the headphone output.
>
> Changing both at the same time cause spurious events that are mis-interpreted
> as input events, causing troubles on apps. So, a delay is needed before turning
> on such gpios.
>
> With this patch, plugging a headphone causes a jack event to trigger the speaker
> supply, powering down the speaker and powering up the headphone output.
> Removing the headphone also triggers the power supply, powering up the speaker
> and powering down the headphone.
>
> Mauro Carvalho Chehab (2):
> ASoC: Intel: sof_es8336: support a separate gpio to control headphone
> ASoC: Intel: sof_es8336: Huawei Matebook D15 uses a headphone gpio

There is something weird with the patches here, at least for me in Thunderbird
both patches show up as nameless attachments to emails with empty bodies.

After saving the attachments the patches look good to me, so:

Acked-by: Hans de Goede <[email protected]>

for the series.

Regards,

Hans

2022-04-06 04:41:36

by Mauro Carvalho Chehab

[permalink] [raw]
Subject: [PATCH v2 2/2] ASoC: Intel: sof_es8336: Huawei Matebook D15 uses a headphone gpio

From: Mauro Carvalho Chehab <[email protected]>

Based on experimental tests, Huawei Matebook D15 actually uses
both gpio0 and gpio1: the first one controls the speaker, while
the other one controls the headphone.

Add a quirk for that.

Signed-off-by: Mauro Carvalho Chehab <[email protected]>
Signed-off-by: Mauro Carvalho Chehab <[email protected]>
---

See [PATCH v2 0/2] at: https://lore.kernel.org/all/[email protected]/

sound/soc/intel/boards/sof_es8336.c | 8 ++++++++
1 file changed, 8 insertions(+)

diff --git a/sound/soc/intel/boards/sof_es8336.c b/sound/soc/intel/boards/sof_es8336.c
index bcd80870d252..79cf9777c4fc 100644
--- a/sound/soc/intel/boards/sof_es8336.c
+++ b/sound/soc/intel/boards/sof_es8336.c
@@ -292,6 +292,14 @@ static const struct dmi_system_id sof_es8336_quirk_table[] = {
},
.driver_data = (void *)(SOF_ES8336_TGL_GPIO_QUIRK)
},
+ {
+ .callback = sof_es8336_quirk_cb,
+ .matches = {
+ DMI_MATCH(DMI_SYS_VENDOR, "HUAWEI"),
+ DMI_MATCH(DMI_BOARD_NAME, "BOHB-WAX9-PCB-B2"),
+ },
+ .driver_data = (void *)(SOF_ES8336_HEADPHONE_GPIO)
+ },
{}
};

--
2.35.1

2022-04-06 13:29:44

by Hans de Goede

[permalink] [raw]
Subject: Re: [PATCH v2 0/2] Make headphone work on Huawei Matebook D15

Hi,

On 4/5/22 15:48, Mauro Carvalho Chehab wrote:
> Em Tue, 5 Apr 2022 11:00:44 +0200
> Hans de Goede <[email protected]> escreveu:
>
>> Hi,
>>
>> On 4/5/22 10:44, Mauro Carvalho Chehab wrote:
>>> At Huawei Matebook D15 two different GPIOs are used to control the output:
>>> - gpio0 controls the speaker output;
>>> - gpio1 controls the headphone output.
>>>
>>> Changing both at the same time cause spurious events that are mis-interpreted
>>> as input events, causing troubles on apps. So, a delay is needed before turning
>>> on such gpios.
>>>
>>> With this patch, plugging a headphone causes a jack event to trigger the speaker
>>> supply, powering down the speaker and powering up the headphone output.
>>> Removing the headphone also triggers the power supply, powering up the speaker
>>> and powering down the headphone.
>>>
>>> Mauro Carvalho Chehab (2):
>>> ASoC: Intel: sof_es8336: support a separate gpio to control headphone
>>> ASoC: Intel: sof_es8336: Huawei Matebook D15 uses a headphone gpio
>>
>> There is something weird with the patches here, at least for me in Thunderbird
>> both patches show up as nameless attachments to emails with empty bodies.
>
> Weird... I tested here on Thunderbird (Fedora 35), reading it from the ML
> and they opened ok here.

Yes I checked lore.kernel.org and they look fine there, so as you
said: weird.

> There *is* an issue on such patches though: they ended using my past
> e-mail :-)
>
> I'll re-send those with your ack using the right SoB/From
> [email protected].

And in the resend they look fine in my Thunderbird too.

Regards,

Hans

2022-04-06 13:59:16

by Mauro Carvalho Chehab

[permalink] [raw]
Subject: Re: [PATCH v2 0/2] Make headphone work on Huawei Matebook D15

Em Tue, 5 Apr 2022 11:00:44 +0200
Hans de Goede <[email protected]> escreveu:

> Hi,
>
> On 4/5/22 10:44, Mauro Carvalho Chehab wrote:
> > At Huawei Matebook D15 two different GPIOs are used to control the output:
> > - gpio0 controls the speaker output;
> > - gpio1 controls the headphone output.
> >
> > Changing both at the same time cause spurious events that are mis-interpreted
> > as input events, causing troubles on apps. So, a delay is needed before turning
> > on such gpios.
> >
> > With this patch, plugging a headphone causes a jack event to trigger the speaker
> > supply, powering down the speaker and powering up the headphone output.
> > Removing the headphone also triggers the power supply, powering up the speaker
> > and powering down the headphone.
> >
> > Mauro Carvalho Chehab (2):
> > ASoC: Intel: sof_es8336: support a separate gpio to control headphone
> > ASoC: Intel: sof_es8336: Huawei Matebook D15 uses a headphone gpio
>
> There is something weird with the patches here, at least for me in Thunderbird
> both patches show up as nameless attachments to emails with empty bodies.

Weird... I tested here on Thunderbird (Fedora 35), reading it from the ML
and they opened ok here.

There *is* an issue on such patches though: they ended using my past
e-mail :-)

I'll re-send those with your ack using the right SoB/From
[email protected].

>
> After saving the attachments the patches look good to me, so:
>
> Acked-by: Hans de Goede <[email protected]>

Thanks!

Regards,
Mauro