thesofproject / linux

Linux kernel source tree
Other
89 stars 128 forks source link

[MTL] SoundWire: unreliable headset detection on Dell SKU 0CC7 #4872

Open plbossart opened 4 months ago

plbossart commented 4 months ago

When testing headset plug/unplug on Fedora, it's fairly common to see the headset not detected at all, but the headphone is always detected.

Typical setup: speakers are shown (no local mics on this SKU) insert headset, both output and input devices are shown unplug headset reinsert headset -> no input shown

example screen shot start: Screenshot from 2024-03-22 22-34-18

headset plugged Screenshot from 2024-03-22 22-34-54

headset unplugged/replugged Screenshot from 2024-03-22 22-34-35

plbossart commented 4 months ago

@bardliao @shumingfan FYI

bardliao commented 4 months ago

@plbossart Can you try https://github.com/thesofproject/linux/pull/4873? We didn't add quirk for SUK 0CC7, and based on my test, the JD source is JD2. @shumingfan Could you confirm the JD source?

bardliao commented 4 months ago

@plbossart Can you try #4873? We didn't add quirk for SUK 0CC7, and based on my test, the JD source is JD2. @shumingfan Could you confirm the JD source?

Hmm, the product uses rt713 codec not rt711, and the codec driver support JD1 only. So, closing #4873 and wait for Realtek's confirmation. @plbossart You could try options snd_soc_sof_sdw quirk=2 if you want to test with JD2.

plbossart commented 4 months ago

@bardliao if the codec driver only supports JD1, setting the quirk to JD2 will do absolutely nothing?

@shumingfan we really need your help on this one.

bardliao commented 4 months ago

@bardliao if the codec driver only supports JD1, setting the quirk to JD2 will do absolutely nothing?

Hmm, the codec driver will set a register if the JD source is set to JD1. I think the register will be the default value if the JD source is set to JD2 and it happens to work.

https://github.com/thesofproject/linux/blob/topic/sof-dev/sound/soc/codecs/rt712-sdca.c#L417

shumingfan commented 4 months ago

@plbossart @bardliao Could you try the patch below? If the problem still happens, please dump the registers including MBQ registers.

+++ b/sound/soc/codecs/rt712-sdca.c
@@ -405,6 +405,7 @@ static void rt712_sdca_jack_init(struct rt712_sdca_priv *rt712)
                        RT712_UMP_HID_CTL0, 0x1100, 0x1100);
                rt712_sdca_index_update_bits(rt712, RT712_VENDOR_HDA_CTL,
                        RT712_UMP_HID_CTL7, 0xf000, 0x0000);
+               rt712_sdca_index_write(rt712, RT712_VENDOR_REG, 0x09, 0x6002);

                /* detected_mode_change_event_en & hid1_push_button_event_en */
plbossart commented 4 months ago

@shumingfan I tried with this patch, I don't see a change. The mixers don't show the headset mic detected, so it's not a pipewire plumbing issue

root@fedora:~# amixer -Dhw:0 cget numid=25
numid=25,iface=CARD,name='Headphone Jack'
  ; type=BOOLEAN,access=r-------,values=1
  : values=on
root@fedora:~# amixer -Dhw:0 cget numid=26
numid=26,iface=CARD,name='Headset Mic Jack'
  ; type=BOOLEAN,access=r-------,values=1
  : values=off

i am not sure how to dump the registers, the command 'cat /sys/kernel/debug/regmap/sdw:0:0:025d:0713:01/registers' seem to hang for some reason. What do I need to do here?

shumingfan commented 4 months ago

@plbossart I checked the Windows settings of RT713. Two more settings are added. Would you please test again? If the issue still happens, I will try to borrow the same machine and test it on my side.

+++ b/sound/soc/codecs/rt712-sdca.c
@@ -405,6 +405,9 @@ static void rt712_sdca_jack_init(struct rt712_sdca_priv *rt712)
                        RT712_UMP_HID_CTL0, 0x1100, 0x1100);
                rt712_sdca_index_update_bits(rt712, RT712_VENDOR_HDA_CTL,
                        RT712_UMP_HID_CTL7, 0xf000, 0x0000);
+               rt712_sdca_index_write(rt712, RT712_VENDOR_REG, 0x09, 0x6002);
+               rt712_sdca_index_write(rt712, RT712_VENDOR_REG, 0x47, 0xa47a);
+               regmap_write(rt712->regmap, 0x2f59, 0x07);

                /* detected_mode_change_event_en & hid1_push_button_event_en */

i am not sure how to dump the registers, the command 'cat /sys/kernel/debug/regmap/sdw:0:0:025d:0713:01/registers' seem to hang for some reason. What do I need to do here?

Hmm, it will take some time about a few minutes. Please keep the DSP on, then dump the registers.

plbossart commented 4 months ago

Thanks @shumingfan, with the last patch the jack detection works reliably in my manual tests I didn't see any configuration where the mic is not detected.

Button detection doesn't seem to work though, I have a two button headphone and the volume does not adjust. It's likely a different problem though, and I am not sure if this is supposed to work on this SKU.

shumingfan commented 4 months ago

@plbossart Thanks for the testing. I will get the same machine from @bardliao. I need some time to check this and release the final patch.

shumingfan commented 4 months ago

@plbossart I could reproduce the same issue on SKU 0CC7, even using the patch (https://github.com/thesofproject/linux/issues/4872#issuecomment-2024315612). If the jack inserts into the socket slowly, the issue will happen. The hardware engineer checks the jack socket that the JD is triggered when the jack isn't even plugged into the mic ring. jack-socket1

Is it possible to report this situation to Dell? Realtek also tries to report this to Dell/ODM.

bardliao commented 3 months ago

@plbossart I could reproduce the same issue on SKU 0CC7, even using the patch (#4872 (comment)). If the jack inserts into the socket slowly, the issue will happen. The hardware engineer checks the jack socket that the JD is triggered when the jack isn't even plugged into the mic ring. jack-socket1

Is it possible to report this situation to Dell? Realtek also tries to report this to Dell/ODM.

I will report it to Dell

marc-hb commented 2 months ago

@shumingfan , can the "Selected Mode" approach in #4996 help here?

shumingfan commented 2 months ago

@shumingfan , can the "Selected Mode" approach in #4996 help here?

@marc-hb No, this is the problem with the jack socket. It is a hardware issue. The amixer control can't help. Realtek reported this problem to ODM already. But, we didn't get any feedback or action about this.