diff mbox

[RfC] ALSA: hda/realtek Pin quirk for Fujitsu U7[25]7

Message ID dcac37ef-4319-9eb3-4652-17bc6aa8fbc9@fbihome.de (mailing list archive)
State New, archived
Headers show

Commit Message

Jan-Marek Glogowski Jan. 26, 2018, 3:12 p.m. UTC
Hi everybody,

I got new HW from our supplier, a Fujitsu U727 and a U757 laptop, which
have a headset jack. Attaching a headset, the microphone doesn't work.
After some reading and trying various tools to understand the problem, I
found hdajacksensetest, which showed a sense change for a seemingly
wrong unconnected pin.
Overriding this pins' config has fixed the headsets microphone, so now I
have the attached kernel patch with a SND_HDA_PIN_QUIRK.

After compiling the patched module (for 4.4), everything works as
expected, but hdajackretask still shows the pin as unconnected, so I'm
wondering,  if I need to do something in addition? Is this normal
behaviour? This is just a port to master, as we (Munich) are on Ubuntu
Trusty with Xenial HWE (4.4 kernel).

Thanks for the review.

Jan-Marek Glogowski

P.S. checkpatch.pl warned about too long lines for the
SND_HDA_PIN_QUIRK. Should I fix that?


From 69f1c296b22ab6dce93ba50de9cf05e279d52088 Mon Sep 17 00:00:00 2001
From: Jan-Marek Glogowski <glogow@fbihome.de>
Date: Wed, 24 Jan 2018 18:57:38 +0100
Subject: [PATCH] ALSA: hda/realtek Pin quirk for Fujitsu U7[25]7

These laptops have a combined jack to attach headsets, the U727 on
the left, the U757 on the right, but a headsets microphone doesn't
work. Using hdajacksensetest I found that pin 0x19 changed the
present state when plugging the headset, in addition to 0x21, but
didn't have the correct configuration (shown as "Not connected").

So this sets the configuration to the same values as the headphone
pin 0x21 except for the device type microphone, which makes it
work correctly. With the patch the configured pins for U727 are

Pin 0x12 (Internal Mic, Mobile-In): present = No
Pin 0x14 (Internal Speaker): present = No
Pin 0x19 (Black Mic, Left side): present = No
Pin 0x1d (Internal Aux): present = No
Pin 0x21 (Black Headphone, Left side): present = No

Signed-off-by: Jan-Marek Glogowski <glogow@fbihome.de>
---
 sound/pci/hda/patch_realtek.c | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

+		{0x21, 0x04211020}),
 	SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell",
ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
 		{0x12, 0x90a60130},
 		{0x14, 0x90170110},

Comments

Jan-Marek Glogowski Feb. 6, 2018, 8:55 a.m. UTC | #1
Dear maintainers,

I'm just replying to my own mail, since I didn't get any replies from
the alsa-devel mailing list; probably because I didn't include any of
the people listed in the get_maintainer output.
Please have a look at the patch and the questions in the original mail.

Thanks

Jan-Marek
Takashi Sakamoto Feb. 6, 2018, 9:43 a.m. UTC | #2
Hi,

On Feb 6 2018 17:55, Jan-Marek Glogowski wrote:
> Dear maintainers,
> 
> I'm just replying to my own mail, since I didn't get any replies from
> the alsa-devel mailing list; probably because I didn't include any of
> the people listed in the get_maintainer output.
> Please have a look at the patch and the questions in the original mail.

A subsystem maintainer is absent from this list now. Please wait for a
bit more till he gets back.


Thanks

Takashi (not a maintainer) Sakamoto
Takashi Iwai Feb. 13, 2018, 6:04 a.m. UTC | #3
On Fri, 26 Jan 2018 16:12:53 +0100,
Jan-Marek Glogowski wrote:
> 
> Hi everybody,
> 
> I got new HW from our supplier, a Fujitsu U727 and a U757 laptop, which
> have a headset jack. Attaching a headset, the microphone doesn't work.
> After some reading and trying various tools to understand the problem, I
> found hdajacksensetest, which showed a sense change for a seemingly
> wrong unconnected pin.
> Overriding this pins' config has fixed the headsets microphone, so now I
> have the attached kernel patch with a SND_HDA_PIN_QUIRK.

The pin config override itself looks OK, but the way to identify the
machine is an open question.  You've added the entries in
alc269_pin_fixup_tbl[].  This table is for matching with a group of
machines that have the same "fingerprint" by pin configs.  Usually
this is used for Dell laptops and such.

OTOH, if one quirk is needed only for one or two machines, using the
PCI SSID (or codec SSID) is the easier way to go, and it's done by
putting into alc269_fixup_tbl[].


> After compiling the patched module (for 4.4), everything works as
> expected, but hdajackretask still shows the pin as unconnected, so I'm
> wondering,  if I need to do something in addition?

If everything is working, why any more changes? :)


Takashi

> Is this normal
> behaviour? This is just a port to master, as we (Munich) are on Ubuntu
> Trusty with Xenial HWE (4.4 kernel).
> 
> Thanks for the review.
> 
> Jan-Marek Glogowski
> 
> P.S. checkpatch.pl warned about too long lines for the
> SND_HDA_PIN_QUIRK. Should I fix that?
> 
> 
> >From 69f1c296b22ab6dce93ba50de9cf05e279d52088 Mon Sep 17 00:00:00 2001
> From: Jan-Marek Glogowski <glogow@fbihome.de>
> Date: Wed, 24 Jan 2018 18:57:38 +0100
> Subject: [PATCH] ALSA: hda/realtek Pin quirk for Fujitsu U7[25]7
> 
> These laptops have a combined jack to attach headsets, the U727 on
> the left, the U757 on the right, but a headsets microphone doesn't
> work. Using hdajacksensetest I found that pin 0x19 changed the
> present state when plugging the headset, in addition to 0x21, but
> didn't have the correct configuration (shown as "Not connected").
> 
> So this sets the configuration to the same values as the headphone
> pin 0x21 except for the device type microphone, which makes it
> work correctly. With the patch the configured pins for U727 are
> 
> Pin 0x12 (Internal Mic, Mobile-In): present = No
> Pin 0x14 (Internal Speaker): present = No
> Pin 0x19 (Black Mic, Left side): present = No
> Pin 0x1d (Internal Aux): present = No
> Pin 0x21 (Black Headphone, Left side): present = No
> 
> Signed-off-by: Jan-Marek Glogowski <glogow@fbihome.de>
> ---
>  sound/pci/hda/patch_realtek.c | 28 ++++++++++++++++++++++++++++
>  1 file changed, 28 insertions(+)
> 
> diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
> index 9aafc6c..52c6beb 100644
> --- a/sound/pci/hda/patch_realtek.c
> +++ b/sound/pci/hda/patch_realtek.c
> @@ -5275,6 +5275,8 @@ enum {
>  	ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
>  	ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
>  	ALC255_FIXUP_DELL2_MIC_NO_PRESENCE,
> +	ALC255_FIXUP_FUJITSU_U727_MIC,
> +	ALC255_FIXUP_FUJITSU_U757_MIC,
>  	ALC255_FIXUP_HEADSET_MODE,
>  	ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC,
>  	ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
> @@ -5786,6 +5788,20 @@ static const struct hda_fixup alc269_fixups[] = {
>  		.chained = true,
>  		.chain_id = ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC
>  	},
> +	[ALC255_FIXUP_FUJITSU_U727_MIC] = {
> +		.type = HDA_FIXUP_PINS,
> +		.v.pins = (const struct hda_pintbl[]) {
> +			{ 0x19, 0x03a11020 }, /* detect headset mic, left */
> +			{ }
> +		},
> +	},
> +	[ALC255_FIXUP_FUJITSU_U757_MIC] = {
> +		.type = HDA_FIXUP_PINS,
> +		.v.pins = (const struct hda_pintbl[]) {
> +			{ 0x19, 0x04a11020 }, /* detect headset mic, right */
> +			{ }
> +		},
> +	},
>  	[ALC255_FIXUP_HEADSET_MODE] = {
>  		.type = HDA_FIXUP_FUNC,
>  		.v.func = alc_fixup_headset_mode_alc255,
> @@ -6589,6 +6605,18 @@ static const struct snd_hda_pin_quirk
> alc269_pin_fixup_tbl[] = {
>  	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell",
> ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
>  		{0x1b, 0x01011020},
>  		{0x21, 0x02211010}),
> +	SND_HDA_PIN_QUIRK(0x10ec0255, 0x10cf, "Fujitsu Lifebook U727",
> ALC255_FIXUP_FUJITSU_U727_MIC,
> +		{0x12, 0xb7a60130},
> +		{0x14, 0x90170110},
> +		{0x19, 0x411111f0},
> +		{0x1d, 0x909701f0},
> +		{0x21, 0x03211020}),
> +	SND_HDA_PIN_QUIRK(0x10ec0255, 0x10cf, "Fujitsu Livebook U757",
> ALC255_FIXUP_FUJITSU_U757_MIC,
> +		{0x12, 0xb7a60130},
> +		{0x14, 0x90170110},
> +		{0x19, 0x411111f0},
> +		{0x1d, 0x909701f0},
> +		{0x21, 0x04211020}),
>  	SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell",
> ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
>  		{0x12, 0x90a60130},
>  		{0x14, 0x90170110},
> -- 
> 2.1.4
> _______________________________________________
> Alsa-devel mailing list
> Alsa-devel@alsa-project.org
> http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
>
Jan-Marek Glogowski Feb. 13, 2018, 11 a.m. UTC | #4
Hi Takashi,

Am 13.02.2018 um 07:04 schrieb Takashi Iwai:
> On Fri, 26 Jan 2018 16:12:53 +0100,
> Jan-Marek Glogowski wrote:
>>
>> I got new HW from our supplier, a Fujitsu U727 and a U757 laptop, which
>> have a headset jack. Attaching a headset, the microphone doesn't work.
>> After some reading and trying various tools to understand the problem, I
>> found hdajacksensetest, which showed a sense change for a seemingly
>> wrong unconnected pin.
>> Overriding this pins' config has fixed the headsets microphone, so now I
>> have the attached kernel patch with a SND_HDA_PIN_QUIRK.
> 
> The pin config override itself looks OK, but the way to identify the
> machine is an open question.  You've added the entries in
> alc269_pin_fixup_tbl[].  This table is for matching with a group of
> machines that have the same "fingerprint" by pin configs.  Usually
> this is used for Dell laptops and such.
> 
> OTOH, if one quirk is needed only for one or two machines, using the
> PCI SSID (or codec SSID) is the easier way to go, and it's done by
> putting into alc269_fixup_tbl[].

So I re-check the hardware:

$ cat /proc/asound/card0/codec#0 | head
Codec: Realtek ALC255
Address: 0
AFG Function Id: 0x1 (unsol 1)
Vendor Id: 0x10ec0255
Subsystem Id: 0x10cf1629
Revision Id: 0x100002
No Modem Function Group found
Default PCM:
    rates [0x560]: 44100 48000 96000 192000
    bits [0xe]: 16 20 24

$ sudo lspci -vns 00:1f.3
00:1f.3 0403: 8086:9d70 (rev 21)
        Subsystem: 10cf:193e
        Flags: bus master, fast devsel, latency 32, IRQ 280
        Memory at c1240000 (64-bit, non-prefetchable) [size=16K]
        Memory at c1230000 (64-bit, non-prefetchable) [size=64K]
        Capabilities: [50] Power Management version 3
        Capabilities: [60] MSI: Enable+ Count=1/1 Maskable- 64bit+
        Kernel driver in use: snd_hda_intel

I ran and diff'ed the output on both laptops. It's the same for both notebook types, so AFAIK there is no other way to distinguish them, except for the Jack pin being on the left or right side. The only difference I see is in the DMI datas' product name, but that data is not used in the sound driver at all.

$ sudo dmidecode -t 1
Handle 0x0001, DMI type 1, 27 bytes
System Information
        Manufacturer: FUJITSU
        Product Name: LIFEBOOK U757
        Family: LIFEBOOK-FTS

>> After compiling the patched module (for 4.4), everything works as
>> expected, but hdajackretask still shows the pin as unconnected, so I'm
>> wondering,  if I need to do something in addition?
> 
> If everything is working, why any more changes? :)

Ok. I'm not familiar with the HDA codecs, and I was just wondering, if this should / can be patched.

>> Is this normal behaviour?

Jan-Marek

>> P.S. checkpatch.pl warned about too long lines for the SND_HDA_PIN_QUIRK. Should I fix that?
Takashi Iwai Feb. 13, 2018, 11:11 a.m. UTC | #5
On Tue, 13 Feb 2018 12:00:29 +0100,
Jan-Marek Glogowski wrote:
> 
> Hi Takashi,
> 
> Am 13.02.2018 um 07:04 schrieb Takashi Iwai:
> > On Fri, 26 Jan 2018 16:12:53 +0100,
> > Jan-Marek Glogowski wrote:
> >>
> >> I got new HW from our supplier, a Fujitsu U727 and a U757 laptop, which
> >> have a headset jack. Attaching a headset, the microphone doesn't work.
> >> After some reading and trying various tools to understand the problem, I
> >> found hdajacksensetest, which showed a sense change for a seemingly
> >> wrong unconnected pin.
> >> Overriding this pins' config has fixed the headsets microphone, so now I
> >> have the attached kernel patch with a SND_HDA_PIN_QUIRK.
> > 
> > The pin config override itself looks OK, but the way to identify the
> > machine is an open question.  You've added the entries in
> > alc269_pin_fixup_tbl[].  This table is for matching with a group of
> > machines that have the same "fingerprint" by pin configs.  Usually
> > this is used for Dell laptops and such.
> > 
> > OTOH, if one quirk is needed only for one or two machines, using the
> > PCI SSID (or codec SSID) is the easier way to go, and it's done by
> > putting into alc269_fixup_tbl[].
> 
> So I re-check the hardware:
> 
> $ cat /proc/asound/card0/codec#0 | head
> Codec: Realtek ALC255
> Address: 0
> AFG Function Id: 0x1 (unsol 1)
> Vendor Id: 0x10ec0255
> Subsystem Id: 0x10cf1629
> Revision Id: 0x100002
> No Modem Function Group found
> Default PCM:
>     rates [0x560]: 44100 48000 96000 192000
>     bits [0xe]: 16 20 24
> 
> $ sudo lspci -vns 00:1f.3
> 00:1f.3 0403: 8086:9d70 (rev 21)
>         Subsystem: 10cf:193e
>         Flags: bus master, fast devsel, latency 32, IRQ 280
>         Memory at c1240000 (64-bit, non-prefetchable) [size=16K]
>         Memory at c1230000 (64-bit, non-prefetchable) [size=64K]
>         Capabilities: [50] Power Management version 3
>         Capabilities: [60] MSI: Enable+ Count=1/1 Maskable- 64bit+
>         Kernel driver in use: snd_hda_intel
> 
> I ran and diff'ed the output on both laptops. It's the same for both notebook types, so AFAIK there is no other way to distinguish them, except for the Jack pin being on the left or right side. The only difference I see is in the DMI datas' product name, but that data is not used in the sound driver at all.
> 
> $ sudo dmidecode -t 1
> Handle 0x0001, DMI type 1, 27 bytes
> System Information
>         Manufacturer: FUJITSU
>         Product Name: LIFEBOOK U757
>         Family: LIFEBOOK-FTS

The driver doesn't check any difference of the position for
identifying the jack detection capability, so you can apply the same
quirk to both models.  Then I prefer putting with SND_PCI_QUIRK().


> >> After compiling the patched module (for 4.4), everything works as
> >> expected, but hdajackretask still shows the pin as unconnected, so I'm
> >> wondering,  if I need to do something in addition?
> > 
> > If everything is working, why any more changes? :)
> 
> Ok. I'm not familiar with the HDA codecs, and I was just wondering, if this should / can be patched.
> 
> >> Is this normal behaviour?
> 
> Jan-Marek
> 
> >> P.S. checkpatch.pl warned about too long lines for the SND_HDA_PIN_QUIRK. Should I fix that?

No, it's not strictly needed.  It's a warning, not an error.


thanks,

Takashi
diff mbox

Patch

diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 9aafc6c..52c6beb 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -5275,6 +5275,8 @@  enum {
 	ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
 	ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
 	ALC255_FIXUP_DELL2_MIC_NO_PRESENCE,
+	ALC255_FIXUP_FUJITSU_U727_MIC,
+	ALC255_FIXUP_FUJITSU_U757_MIC,
 	ALC255_FIXUP_HEADSET_MODE,
 	ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC,
 	ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
@@ -5786,6 +5788,20 @@  static const struct hda_fixup alc269_fixups[] = {
 		.chained = true,
 		.chain_id = ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC
 	},
+	[ALC255_FIXUP_FUJITSU_U727_MIC] = {
+		.type = HDA_FIXUP_PINS,
+		.v.pins = (const struct hda_pintbl[]) {
+			{ 0x19, 0x03a11020 }, /* detect headset mic, left */
+			{ }
+		},
+	},
+	[ALC255_FIXUP_FUJITSU_U757_MIC] = {
+		.type = HDA_FIXUP_PINS,
+		.v.pins = (const struct hda_pintbl[]) {
+			{ 0x19, 0x04a11020 }, /* detect headset mic, right */
+			{ }
+		},
+	},
 	[ALC255_FIXUP_HEADSET_MODE] = {
 		.type = HDA_FIXUP_FUNC,
 		.v.func = alc_fixup_headset_mode_alc255,
@@ -6589,6 +6605,18 @@  static const struct snd_hda_pin_quirk
alc269_pin_fixup_tbl[] = {
 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell",
ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
 		{0x1b, 0x01011020},
 		{0x21, 0x02211010}),
+	SND_HDA_PIN_QUIRK(0x10ec0255, 0x10cf, "Fujitsu Lifebook U727",
ALC255_FIXUP_FUJITSU_U727_MIC,
+		{0x12, 0xb7a60130},
+		{0x14, 0x90170110},
+		{0x19, 0x411111f0},
+		{0x1d, 0x909701f0},
+		{0x21, 0x03211020}),
+	SND_HDA_PIN_QUIRK(0x10ec0255, 0x10cf, "Fujitsu Livebook U757",
ALC255_FIXUP_FUJITSU_U757_MIC,
+		{0x12, 0xb7a60130},
+		{0x14, 0x90170110},
+		{0x19, 0x411111f0},
+		{0x1d, 0x909701f0},