Skip to content

Commit 1933e6e

Browse files
chenhuacaigregkh
authored andcommitted
ALSA: hda/hdmi: Use 'AC_PINSENSE_ELDV' to detect pinsense for Loongson
commit 958e445 upstream. Due to a hardware defect, for Loongson PCI HDMI devices with a reversion ID of 2, the pin sense status must be determined via the ELD. Add a codec flag, eld_jack_detect, to indicate this case, and do special handlings in read_pin_sense(). Cc: stable@vger.kernel.org Signed-off-by: Baoqi Zhang <zhangbaoqi@loongson.cn> Signed-off-by: Haowei Zheng <zhenghaowei@loongson.cn> Signed-off-by: Huacai Chen <chenhuacai@loongson.cn> Link: https://patch.msgid.link/20260527140841.3407183-1-chenhuacai@loongson.cn Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 4dd2552 commit 1933e6e

3 files changed

Lines changed: 14 additions & 1 deletion

File tree

include/sound/hda_codec.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,7 @@ struct hda_codec {
259259
unsigned int forced_resume:1; /* forced resume for jack */
260260
unsigned int no_stream_clean_at_suspend:1; /* do not clean streams at suspend */
261261
unsigned int ctl_dev_id:1; /* old control element id build behaviour */
262+
unsigned int eld_jack_detect:1; /* Machine jack-detection by ELD */
262263

263264
unsigned long power_on_acct;
264265
unsigned long power_off_acct;

sound/hda/codecs/hdmi/hdmi.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2286,6 +2286,7 @@ EXPORT_SYMBOL_NS_GPL(snd_hda_hdmi_acomp_init, "SND_HDA_CODEC_HDMI");
22862286
enum {
22872287
MODEL_GENERIC,
22882288
MODEL_GF,
2289+
MODEL_LOONGSON,
22892290
};
22902291

22912292
static int generichdmi_probe(struct hda_codec *codec,
@@ -2303,6 +2304,11 @@ static int generichdmi_probe(struct hda_codec *codec,
23032304
if (id->driver_data == MODEL_GF)
23042305
codec->no_sticky_stream = 1;
23052306

2307+
if (id->driver_data == MODEL_LOONGSON) {
2308+
if (codec->bus && codec->bus->pci->revision == 0x2)
2309+
codec->eld_jack_detect = 1; /* Jack-detection by ELD */
2310+
}
2311+
23062312
return 0;
23072313
}
23082314

@@ -2320,7 +2326,7 @@ static const struct hda_codec_ops generichdmi_codec_ops = {
23202326
/*
23212327
*/
23222328
static const struct hda_device_id snd_hda_id_generichdmi[] = {
2323-
HDA_CODEC_ID_MODEL(0x00147a47, "Loongson HDMI", MODEL_GENERIC),
2329+
HDA_CODEC_ID_MODEL(0x00147a47, "Loongson HDMI", MODEL_LOONGSON),
23242330
HDA_CODEC_ID_MODEL(0x10951390, "SiI1390 HDMI", MODEL_GENERIC),
23252331
HDA_CODEC_ID_MODEL(0x10951392, "SiI1392 HDMI", MODEL_GENERIC),
23262332
HDA_CODEC_ID_MODEL(0x11069f84, "VX11 HDMI/DP", MODEL_GENERIC),

sound/hda/common/jack.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,12 @@ static u32 read_pin_sense(struct hda_codec *codec, hda_nid_t nid, int dev_id)
5858
AC_VERB_GET_PIN_SENSE, dev_id);
5959
if (codec->inv_jack_detect)
6060
val ^= AC_PINSENSE_PRESENCE;
61+
if (codec->eld_jack_detect) {
62+
if (val & AC_PINSENSE_ELDV)
63+
val |= AC_PINSENSE_PRESENCE;
64+
else
65+
val &= ~AC_PINSENSE_PRESENCE;
66+
}
6167
return val;
6268
}
6369

0 commit comments

Comments
 (0)