Skip to contentSkip to conversation

ALSA: hda - Add fixup_forced flag

PATCH In review Hui Wang 4 participants 16 messages May 26, 2014 – May 27, 2014 Sound

lore
Share & tools
lore

Hui Wang

author
#0 lore raw

PATCH 1/5 ALSA: hda - Add fixup_forced flag

From: David Henningsson <[email protected]>

The "fixup_forced" flag will indicate whether a specific fixup (or nofixup) has been set by the user, to override the driver's default.
This flag will help future patches.

---
 sound/pci/hda/hda_auto_parser.c | 9 ++++++---
 sound/pci/hda/hda_codec.h       | 1 +
 2 files changed, 7 insertions(+), 3 deletions(-)
sound/pci/hda/hda_auto_parser.c +6 -3
index 90d2fda..36961ab 100644
@@ -852,15 +852,17 @@ void snd_hda_pick_fixup(struct hda_codec *codec,
 	if (codec->modelname && !strcmp(codec->modelname, "nofixup")) {
 		codec->fixup_list = NULL;
 		codec->fixup_id = -1;
+		codec->fixup_forced = 1;
 		return;
 	}
 
 	if (codec->modelname && models) {
 		while (models->name) {
 			if (!strcmp(codec->modelname, models->name)) {
-				id = models->id;
-				name = models->name;
-				break;
+				codec->fixup_id = models->id;
+				codec->fixup_name = models->name;
+				codec->fixup_forced = 1;
+				return;
 			}
 			models++;
 		}
@@ -889,6 +891,7 @@ void snd_hda_pick_fixup(struct hda_codec *codec,
 		}
 	}
 
+	codec->fixup_forced = 0;
 	codec->fixup_id = id;
 	if (id >= 0) {
 		codec->fixup_list = fixlist;
sound/pci/hda/hda_codec.h +1 -0
index a423313..5825aa1 100644
@@ -402,6 +402,7 @@ struct hda_codec {
 
 	/* fix-up list */
 	int fixup_id;
+	unsigned int fixup_forced:1; /* fixup explicitly set by user */
 	const struct hda_fixup *fixup_list;
 	const char *fixup_name;
 
Signature · 1 line
1.8.1.2
author
#1 lore raw

PATCH 2/5 ALSA: hda - Add a new quirk match based on default pin configuration

From: David Henningsson <[email protected]>

Normally, we match on pci ssid only. This works but needs new code for every machine. To catch more machines in the same quirk, let's add a new type of quirk, where we match on
1) PCI Subvendor ID (i e, not device, just vendor)
2) Codec ID
3) Pin configuration default

If all these three match, we could be reasonably certain that the quirk should apply to the machine even though it might not be the exact same device.

---
 sound/pci/hda/hda_auto_parser.c | 37 +++++++++++++++++++++++++++++++++++++
 sound/pci/hda/hda_local.h       | 14 ++++++++++++++
 2 files changed, 51 insertions(+)
sound/pci/hda/hda_auto_parser.c +37 -0
index 36961ab..a142753 100644
@@ -839,6 +839,43 @@ void snd_hda_apply_fixup(struct hda_codec *codec, int action)
 }
 EXPORT_SYMBOL_GPL(snd_hda_apply_fixup);
 
+static bool pin_config_match(struct hda_codec *codec,
+			     const struct hda_pintbl *pins)
+{
+	for (; pins->nid; pins++) {
+		u32 def_conf = snd_hda_codec_get_pincfg(codec, pins->nid);
+		if (pins->val != def_conf)
+			return false;
+	}
+	return true;
+}
+
+void snd_hda_pick_pin_fixup(struct hda_codec *codec,
+			    const struct snd_hda_pin_quirk *pin_quirk,
+			    const struct hda_fixup *fixlist)
+{
+	const struct snd_hda_pin_quirk *pq;
+
+	if (codec->fixup_forced)
+		return;
+
+	for (pq = pin_quirk; pq->subvendor; pq++) {
+		if (codec->bus->pci->subsystem_vendor != pq->subvendor)
+			continue;
+		if (codec->vendor_id != pq->codec)
+			continue;
+		if (pin_config_match(codec, pq->pins)) {
+			codec->fixup_id = pq->value;
+#ifdef CONFIG_SND_DEBUG_VERBOSE
+			codec->fixup_name = pq->name;
+#endif
+			codec->fixup_list = fixlist;
+			return;
+		}
+	}
+}
+EXPORT_SYMBOL_GPL(snd_hda_pick_pin_fixup);
+
 void snd_hda_pick_fixup(struct hda_codec *codec,
 			const struct hda_model_fixup *models,
 			const struct snd_pci_quirk *quirk,
sound/pci/hda/hda_local.h +14 -0
index e51d155..ebd1fa6 100644
@@ -407,6 +407,16 @@ struct hda_fixup {
 	} v;
 };
 
+struct snd_hda_pin_quirk {
+	unsigned int codec;             /* Codec vendor/device ID */
+	unsigned short subvendor;	/* PCI subvendor ID */
+	const struct hda_pintbl *pins;  /* list of matching pins */
+#ifdef CONFIG_SND_DEBUG_VERBOSE
+	const char *name;
+#endif
+	int value;			/* quirk value */
+};
+
 /* fixup types */
 enum {
 	HDA_FIXUP_INVALID,
@@ -434,6 +444,10 @@ void snd_hda_pick_fixup(struct hda_codec *codec,
 			const struct hda_model_fixup *models,
 			const struct snd_pci_quirk *quirk,
 			const struct hda_fixup *fixlist);
+void snd_hda_pick_pin_fixup(struct hda_codec *codec,
+			    const struct snd_hda_pin_quirk *pin_quirk,
+			    const struct hda_fixup *fixlist);
+
 
 /*
  * unsolicited event handler
Signature · 1 line
1.8.1.2
author
#2 lore raw

PATCH 3/5 ALSA: hda - get subvendor from codec rather than pci_dev

In reply to Hui Wang

It is safer for non-pci situation.

---
 sound/pci/hda/hda_auto_parser.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
sound/pci/hda/hda_auto_parser.c +1 -1
index a142753..b684c6e 100644
@@ -860,7 +860,7 @@ void snd_hda_pick_pin_fixup(struct hda_codec *codec,
 		return;
 
 	for (pq = pin_quirk; pq->subvendor; pq++) {
-		if (codec->bus->pci->subsystem_vendor != pq->subvendor)
+		if ((codec->subsystem_id & 0xffff0000) != (pq->subvendor << 16))
 			continue;
 		if (codec->vendor_id != pq->codec)
 			continue;
Signature · 1 line
1.8.1.2
author
#3 lore raw

PATCH 4/5 ALSA: hda - drop def association and sequence from pinconf comparing

In reply to Hui Wang

A lot a machine have the same codec, but they have different default pinconf setting just because the def association and sequence is different, as a result they can't share a hda_pintbl[], to overcome it, we don't compare def association and sequence in the pinconf matching.

---
 sound/pci/hda/hda_auto_parser.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
sound/pci/hda/hda_auto_parser.c +2 -1
index b684c6e..3cf9137 100644
@@ -844,7 +844,8 @@ static bool pin_config_match(struct hda_codec *codec,
 {
 	for (; pins->nid; pins++) {
 		u32 def_conf = snd_hda_codec_get_pincfg(codec, pins->nid);
-		if (pins->val != def_conf)
+		u32 mask = 0xffffff00;
+		if ((pins->val & mask) != (def_conf & mask))
 			return false;
 	}
 	return true;
Signature · 1 line
1.8.1.2
#4 lore raw

Re: [PATCH 4/5] ALSA: hda - drop def association and sequence from pinconf comparing

(Add Alex Hung to CC)

Quoted 5 lines · Hui Wang

A lot a machine have the same codec, but they have different default pinconf setting just because the def association and sequence is different, as a result they can't share a hda_pintbl[], to overcome it, we don't compare def association and sequence in the pinconf matching.

Uhm, really? Alex, does this seem reasonable from a BIOS perspective, i e, that BIOS people normally would set def association and sequence different while leaving everything else unchanged?

Quoted 21 lines
---
  sound/pci/hda/hda_auto_parser.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
sound/pci/hda/hda_auto_parser.c +2 -1
index b684c6e..3cf9137 100644
@@ -844,7 +844,8 @@ static bool pin_config_match(struct hda_codec *codec,
  {
  	for (; pins->nid; pins++) {
  		u32 def_conf = snd_hda_codec_get_pincfg(codec, pins->nid);
-		if (pins->val != def_conf)
+		u32 mask = 0xffffff00;
+		if ((pins->val & mask) != (def_conf & mask))
  			return false;
  	}
  	return true;
Signature · 2 lines
David Henningsson, Canonical Ltd.
https://launchpad.net/~diwic
#5 lore raw

Re: [PATCH 4/5] ALSA: hda - drop def association and sequence from pinconf comparing

Hi David,

BIOS today implements verbtable which is provided by codec vendor based on hardware design, and it is indeed not uncommon that the verbtable includes used pin only and leaves unused pins untouched.

Quoted 41 lines · David Henningsson

(Add Alex Hung to CC)

Quoted 6 lines · Hui Wang

A lot a machine have the same codec, but they have different default pinconf setting just because the def association and sequence is different, as a result they can't share a hda_pintbl[], to overcome it, we don't compare def association and sequence in the pinconf matching.

Uhm, really? Alex, does this seem reasonable from a BIOS perspective, i e, that BIOS people normally would set def association and sequence different while leaving everything else unchanged?

Quoted 13 lines
---
  sound/pci/hda/hda_auto_parser.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
sound/pci/hda/hda_auto_parser.c +0 -0
index b684c6e..3cf9137 100644

sound/pci/hda/hda_auto_parser.c static bool pin_config_match(struct hda_codec *codec, · line 851

Quoted 9 lines
sound/pci/hda/hda_auto_parser.c +2 -1
@@ -844,7 +844,8 @@ static bool pin_config_match(struct hda_codec *codec,
  {
        for (; pins->nid; pins++) {
                u32 def_conf = snd_hda_codec_get_pincfg(codec, pins->nid);
-               if (pins->val != def_conf)
+               u32 mask = 0xffffff00;
+               if ((pins->val & mask) != (def_conf & mask))
                        return false;
        }
        return true;

--
David Henningsson, Canonical Ltd.
https://launchpad.net/~diwic

Signature · 2 lines
Cheers,
Alex Hung
#6 lore raw

Re: [PATCH 4/5] ALSA: hda - drop def association and sequence from pinconf comparing

Quoted 5 lines · Alex Hung

Hi David,

BIOS today implements verbtable which is provided by codec vendor based on hardware design, and it is indeed not uncommon that the verbtable includes used pin only and leaves unused pins untouched.

Sure, but those unused pins would then have the same default value that the codec initializes it with.

Also, it wouldn't be uncommon for BIOS (or codec vendors) to use the same verbtable for several machines if they share the same audio hardware.

But none of this explains why anyone would just change def association and sequence value between machines? It makes no sense.

Quoted 47 lines
Quoted 41 lines · David Henningsson

(Add Alex Hung to CC)

Quoted 6 lines · Hui Wang

A lot a machine have the same codec, but they have different default pinconf setting just because the def association and sequence is different, as a result they can't share a hda_pintbl[], to overcome it, we don't compare def association and sequence in the pinconf matching.

Uhm, really? Alex, does this seem reasonable from a BIOS perspective, i e, that BIOS people normally would set def association and sequence different while leaving everything else unchanged?

Quoted 13 lines
---
   sound/pci/hda/hda_auto_parser.c | 3 ++-
   1 file changed, 2 insertions(+), 1 deletion(-)
sound/pci/hda/hda_auto_parser.c +0 -0
index b684c6e..3cf9137 100644

sound/pci/hda/hda_auto_parser.c static bool pin_config_match(struct hda_codec *codec, · line 851

Quoted 9 lines
sound/pci/hda/hda_auto_parser.c +2 -1
@@ -844,7 +844,8 @@ static bool pin_config_match(struct hda_codec *codec,
   {
         for (; pins->nid; pins++) {
                 u32 def_conf = snd_hda_codec_get_pincfg(codec, pins->nid);
-               if (pins->val != def_conf)
+               u32 mask = 0xffffff00;
+               if ((pins->val & mask) != (def_conf & mask))
                         return false;
         }
         return true;

--
David Henningsson, Canonical Ltd.
https://launchpad.net/~diwic

Signature · 2 lines
David Henningsson, Canonical Ltd.
https://launchpad.net/~diwic
author
#7 lore raw

Re: [PATCH 4/5] ALSA: hda - drop def association and sequence from pinconf comparing

Quoted 9 lines · David Henningsson
Quoted 5 lines · Alex Hung

Hi David,

BIOS today implements verbtable which is provided by codec vendor based on hardware design, and it is indeed not uncommon that the verbtable includes used pin only and leaves unused pins untouched.

Quoted 5 lines

Sure, but those unused pins would then have the same default value that the codec initializes it with.

Also, it wouldn't be uncommon for BIOS (or codec vendors) to use the same verbtable for several machines if they share the same audio hardware.

But none of this explains why anyone would just change def association and sequence value between machines? It makes no sense.

So far, I met one example for this case:

the Dell laptops with the same 0x10ec0255 codec,

On some machines:
pin 0x12, 0x90a60170
pin 0x14, 0x90170120
pin 0x21, 0x02211030

On another machine:
pin 0x12, 0x90a60140
pin 0x14, 0x90170110
pin 0x21, 0x02211020

The def config of the rest pins are same.

Regards,
Hui.

Quoted 51 lines
Quoted 50 lines
Quoted 43 lines · David Henningsson

(Add Alex Hung to CC)

Quoted 6 lines · Hui Wang

A lot a machine have the same codec, but they have different default pinconf setting just because the def association and sequence is different, as a result they can't share a hda_pintbl[], to overcome it, we don't compare def association and sequence in the pinconf matching.

Uhm, really? Alex, does this seem reasonable from a BIOS perspective, i e, that BIOS people normally would set def association and sequence different while leaving everything else unchanged?

Quoted 24 lines
---
   sound/pci/hda/hda_auto_parser.c | 3 ++-
   1 file changed, 2 insertions(+), 1 deletion(-)
sound/pci/hda/hda_auto_parser.c +2 -1
index b684c6e..3cf9137 100644
@@ -844,7 +844,8 @@ static bool pin_config_match(struct hda_codec 
 *codec,
   {
         for (; pins->nid; pins++) {
                 u32 def_conf = snd_hda_codec_get_pincfg(codec, 
 pins->nid);
-               if (pins->val != def_conf)
+               u32 mask = 0xffffff00;
+               if ((pins->val & mask) != (def_conf & mask))
                         return false;
         }
         return true;
Signature · 2 lines
David Henningsson, Canonical Ltd.
https://launchpad.net/~diwic
#8 lore raw

Re: [PATCH 4/5] ALSA: hda - drop def association and sequence from pinconf comparing

Quoted 29 lines · Hui Wang
Quoted 12 lines · David Henningsson
Quoted 5 lines · Alex Hung

Hi David,

BIOS today implements verbtable which is provided by codec vendor based on hardware design, and it is indeed not uncommon that the verbtable includes used pin only and leaves unused pins untouched.

Sure, but those unused pins would then have the same default value that the codec initializes it with.

Quoted 6 lines

Also, it wouldn't be uncommon for BIOS (or codec vendors) to use the same verbtable for several machines if they share the same audio hardware.

But none of this explains why anyone would just change def association and sequence value between machines? It makes no sense.

So far, I met one example for this case:

the Dell laptops with the same 0x10ec0255 codec,

On some machines:
pin 0x12, 0x90a60170
pin 0x14, 0x90170120
pin 0x21, 0x02211030

Quoted 7 lines

On another machine:
pin 0x12, 0x90a60140
pin 0x14, 0x90170110
pin 0x21, 0x02211020

The def config of the rest pins are same.

If there is only one example (and only two different options), I think we should revert this patch and use two different pin-matching quirks instead.

After all, ignoring the def assoc/sequence values also means a greater risk of catching unwanted machines. Better err on the more careful side.

This is IMO, what do others think?

Quoted 58 lines

Regards,
Hui.

Quoted 53 lines
Quoted 52 lines
Quoted 45 lines · David Henningsson

(Add Alex Hung to CC)

Quoted 6 lines · Hui Wang

A lot a machine have the same codec, but they have different default pinconf setting just because the def association and sequence is different, as a result they can't share a hda_pintbl[], to overcome it, we don't compare def association and sequence in the pinconf matching.

Uhm, really? Alex, does this seem reasonable from a BIOS perspective, i e,
that BIOS people normally would set def association and sequence different
while leaving everything else unchanged?

Quoted 21 lines
---
   sound/pci/hda/hda_auto_parser.c | 3 ++-
   1 file changed, 2 insertions(+), 1 deletion(-)
sound/pci/hda/hda_auto_parser.c +2 -1
index b684c6e..3cf9137 100644
@@ -844,7 +844,8 @@ static bool pin_config_match(struct hda_codec
 *codec,
   {
         for (; pins->nid; pins++) {
                 u32 def_conf = snd_hda_codec_get_pincfg(codec,
 pins->nid);
-               if (pins->val != def_conf)
+               u32 mask = 0xffffff00;
+               if ((pins->val & mask) != (def_conf & mask))
                         return false;
Quoted 3 lines
         }
         return true;

--
David Henningsson, Canonical Ltd.
https://launchpad.net/~diwic

Signature · 2 lines
David Henningsson, Canonical Ltd.
https://launchpad.net/~diwic
#9 lore raw

Re: [PATCH 4/5] ALSA: hda - drop def association and sequence from pinconf comparing

At Tue, 27 May 2014 08:47:33 +0200,

Quoted 41 lines · David Henningsson
Quoted 29 lines · Hui Wang
Quoted 12 lines · David Henningsson
Quoted 5 lines · Alex Hung

Hi David,

BIOS today implements verbtable which is provided by codec vendor based on hardware design, and it is indeed not uncommon that the verbtable includes used pin only and leaves unused pins untouched.

Sure, but those unused pins would then have the same default value that the codec initializes it with.

Quoted 6 lines

Also, it wouldn't be uncommon for BIOS (or codec vendors) to use the same verbtable for several machines if they share the same audio hardware.

But none of this explains why anyone would just change def association and sequence value between machines? It makes no sense.

So far, I met one example for this case:

the Dell laptops with the same 0x10ec0255 codec,

On some machines:
pin 0x12, 0x90a60170
pin 0x14, 0x90170120
pin 0x21, 0x02211030

Quoted 7 lines

On another machine:
pin 0x12, 0x90a60140
pin 0x14, 0x90170110
pin 0x21, 0x02211020

The def config of the rest pins are same.

Quoted 8 lines

If there is only one example (and only two different options), I think we should revert this patch and use two different pin-matching quirks instead.

After all, ignoring the def assoc/sequence values also means a greater risk of catching unwanted machines. Better err on the more careful side.

This is IMO, what do others think?

I'm for the safer side, too.

Takashi

Quoted 64 lines
Quoted 59 lines

Regards,
Hui.

Quoted 53 lines
Quoted 52 lines
Quoted 45 lines · David Henningsson

(Add Alex Hung to CC)

Quoted 6 lines · Hui Wang

A lot a machine have the same codec, but they have different default pinconf setting just because the def association and sequence is different, as a result they can't share a hda_pintbl[], to overcome it, we don't compare def association and sequence in the pinconf matching.

Uhm, really? Alex, does this seem reasonable from a BIOS perspective, i e,
that BIOS people normally would set def association and sequence different
while leaving everything else unchanged?

Quoted 21 lines
---
   sound/pci/hda/hda_auto_parser.c | 3 ++-
   1 file changed, 2 insertions(+), 1 deletion(-)
sound/pci/hda/hda_auto_parser.c +2 -1
index b684c6e..3cf9137 100644
@@ -844,7 +844,8 @@ static bool pin_config_match(struct hda_codec
 *codec,
   {
         for (; pins->nid; pins++) {
                 u32 def_conf = snd_hda_codec_get_pincfg(codec,
 pins->nid);
-               if (pins->val != def_conf)
+               u32 mask = 0xffffff00;
+               if ((pins->val & mask) != (def_conf & mask))
                         return false;
Quoted 3 lines
         }
         return true;

--
David Henningsson, Canonical Ltd.
https://launchpad.net/~diwic

Signature · 2 lines
David Henningsson, Canonical Ltd.
https://launchpad.net/~diwic
author
#10 lore raw

Re: [PATCH 4/5] ALSA: hda - drop def association and sequence from pinconf comparing

Quoted 42 lines · Takashi Iwai

At Tue, 27 May 2014 08:47:33 +0200,

Quoted 40 lines · David Henningsson
Quoted 26 lines · Hui Wang
Quoted 10 lines · David Henningsson
Quoted 5 lines · Alex Hung

Hi David,

BIOS today implements verbtable which is provided by codec vendor based on hardware design, and it is indeed not uncommon that the verbtable includes used pin only and leaves unused pins untouched.

Sure, but those unused pins would then have the same default value that the codec initializes it with.

Quoted 6 lines

Also, it wouldn't be uncommon for BIOS (or codec vendors) to use the same verbtable for several machines if they share the same audio hardware.

But none of this explains why anyone would just change def association and sequence value between machines? It makes no sense.

So far, I met one example for this case:

the Dell laptops with the same 0x10ec0255 codec,

On some machines:
pin 0x12, 0x90a60170
pin 0x14, 0x90170120
pin 0x21, 0x02211030

Quoted 7 lines

On another machine:
pin 0x12, 0x90a60140
pin 0x14, 0x90170110
pin 0x21, 0x02211020

The def config of the rest pins are same.

If there is only one example (and only two different options), I think we should revert this patch and use two different pin-matching quirks instead.

Quoted 8 lines
Quoted 4 lines

After all, ignoring the def assoc/sequence values also means a greater risk of catching unwanted machines. Better err on the more careful side.

This is IMO, what do others think?

I'm for the safer side, too.

Takashi

OK, agree to revert it.

Regards,
Hui.

Quoted 53 lines
Quoted 52 lines
Quoted 48 lines

Regards,
Hui.

Quoted 45 lines
Quoted 45 lines
Quoted 41 lines · David Henningsson

(Add Alex Hung to CC)

Quoted 5 lines · Hui Wang

A lot a machine have the same codec, but they have different default pinconf setting just because the def association and sequence is different, as a result they can't share a hda_pintbl[], to overcome it, we don't compare def association and sequence in the pinconf matching.

Uhm, really? Alex, does this seem reasonable from a BIOS perspective, i e,
that BIOS people normally would set def association and sequence different
while leaving everything else unchanged?

Quoted 20 lines
---
    sound/pci/hda/hda_auto_parser.c | 3 ++-
    1 file changed, 2 insertions(+), 1 deletion(-)
sound/pci/hda/hda_auto_parser.c +2 -1
index b684c6e..3cf9137 100644
@@ -844,7 +844,8 @@ static bool pin_config_match(struct hda_codec
 *codec,
    {
          for (; pins->nid; pins++) {
                  u32 def_conf = snd_hda_codec_get_pincfg(codec,
 pins->nid);
-               if (pins->val != def_conf)
+               u32 mask = 0xffffff00;
+               if ((pins->val & mask) != (def_conf & mask))
                          return false;
Quoted 3 lines
          }
          return true;

--
David Henningsson, Canonical Ltd.
https://launchpad.net/~diwic

Signature · 2 lines
David Henningsson, Canonical Ltd.
https://launchpad.net/~diwic
author
#11 lore raw

Re: [PATCH 4/5] ALSA: hda - drop def association and sequence from pinconf comparing

In reply to Takashi Iwai
Quoted 42 lines · Takashi Iwai

At Tue, 27 May 2014 08:47:33 +0200,

Quoted 40 lines · David Henningsson
Quoted 26 lines · Hui Wang
Quoted 10 lines · David Henningsson
Quoted 5 lines · Alex Hung

Hi David,

BIOS today implements verbtable which is provided by codec vendor based on hardware design, and it is indeed not uncommon that the verbtable includes used pin only and leaves unused pins untouched.

Sure, but those unused pins would then have the same default value that the codec initializes it with.

Quoted 6 lines

Also, it wouldn't be uncommon for BIOS (or codec vendors) to use the same verbtable for several machines if they share the same audio hardware.

But none of this explains why anyone would just change def association and sequence value between machines? It makes no sense.

So far, I met one example for this case:

the Dell laptops with the same 0x10ec0255 codec,

On some machines:
pin 0x12, 0x90a60170
pin 0x14, 0x90170120
pin 0x21, 0x02211030

Quoted 7 lines

On another machine:
pin 0x12, 0x90a60140
pin 0x14, 0x90170110
pin 0x21, 0x02211020

The def config of the rest pins are same.

If there is only one example (and only two different options), I think we should revert this patch and use two different pin-matching quirks instead.

Quoted 8 lines
Quoted 4 lines

After all, ignoring the def assoc/sequence values also means a greater risk of catching unwanted machines. Better err on the more careful side.

This is IMO, what do others think?

I'm for the safer side, too.

Takashi

I will write a reverting patch within this week, and send it out accompany with the patch moving the some existing machines from old quirk matching table to new quirk matching table.

Quoted 53 lines
Quoted 52 lines
Quoted 48 lines

Regards,
Hui.

Quoted 45 lines
Quoted 45 lines
Quoted 41 lines · David Henningsson

(Add Alex Hung to CC)

Quoted 5 lines · Hui Wang

A lot a machine have the same codec, but they have different default pinconf setting just because the def association and sequence is different, as a result they can't share a hda_pintbl[], to overcome it, we don't compare def association and sequence in the pinconf matching.

Uhm, really? Alex, does this seem reasonable from a BIOS perspective, i e,
that BIOS people normally would set def association and sequence different
while leaving everything else unchanged?

Quoted 20 lines
---
    sound/pci/hda/hda_auto_parser.c | 3 ++-
    1 file changed, 2 insertions(+), 1 deletion(-)
sound/pci/hda/hda_auto_parser.c +2 -1
index b684c6e..3cf9137 100644
@@ -844,7 +844,8 @@ static bool pin_config_match(struct hda_codec
 *codec,
    {
          for (; pins->nid; pins++) {
                  u32 def_conf = snd_hda_codec_get_pincfg(codec,
 pins->nid);
-               if (pins->val != def_conf)
+               u32 mask = 0xffffff00;
+               if ((pins->val & mask) != (def_conf & mask))
                          return false;
Quoted 3 lines
          }
          return true;

--
David Henningsson, Canonical Ltd.
https://launchpad.net/~diwic

Signature · 2 lines
David Henningsson, Canonical Ltd.
https://launchpad.net/~diwic
author
#12 lore raw

PATCH 5/5 ALSA: hda - add an instance to use snd_hda_pick_pin_fixup

In reply to Hui Wang

Just two members in the alc269_pin_fixup_tbl[] can cover more than 10 Dell laptop models.

---
 sound/pci/hda/patch_realtek.c | 47 +++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 45 insertions(+), 2 deletions(-)
sound/pci/hda/patch_realtek.c +45 -2
index c0b16de..992949c 100644
@@ -4725,8 +4725,6 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
 	SND_PCI_QUIRK(0x1028, 0x061f, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
 	SND_PCI_QUIRK(0x1028, 0x0629, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
 	SND_PCI_QUIRK(0x1028, 0x062c, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
-	SND_PCI_QUIRK(0x1028, 0x062e, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
-	SND_PCI_QUIRK(0x1028, 0x0632, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
 	SND_PCI_QUIRK(0x1028, 0x0638, "Dell Inspiron 5439", ALC290_FIXUP_MONO_SPEAKERS_HSJACK),
 	SND_PCI_QUIRK(0x1028, 0x063e, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
 	SND_PCI_QUIRK(0x1028, 0x063f, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
@@ -4924,6 +4922,50 @@ static const struct hda_model_fixup alc269_fixup_models[] = {
 	{}
 };
 
+static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = {
+	{
+		.codec = 0x10ec0293,
+		.subvendor = 0x1028,
+#ifdef CONFIG_SND_DEBUG_VERBOSE
+		.name = "Dell",
+#endif
+		.pins = (const struct hda_pintbl[]) {
+			{0x12, 0x40000000},
+			{0x13, 0x90a60140},
+			{0x14, 0x90170110},
+			{0x15, 0x0221401f},
+			{0x16, 0x21014020},
+			{0x18, 0x411111f0},
+			{0x19, 0x21a19030},
+			{0x1a, 0x411111f0},
+			{0x1b, 0x411111f0},
+			{0x1d, 0x40700001},
+			{0x1e, 0x411111f0},
+		},
+		.value = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
+	},
+	{
+		.codec = 0x10ec0255,
+		.subvendor = 0x1028,
+#ifdef CONFIG_SND_DEBUG_VERBOSE
+		.name = "Dell",
+#endif
+		.pins = (const struct hda_pintbl[]) {
+			{0x12, 0x90a60140},
+			{0x14, 0x90170110},
+			{0x17, 0x40000000},
+			{0x18, 0x411111f0},
+			{0x19, 0x411111f0},
+			{0x1a, 0x411111f0},
+			{0x1b, 0x411111f0},
+			{0x1d, 0x40700001},
+			{0x1e, 0x411111f0},
+			{0x21, 0x02211020},
+		},
+		.value = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
+	},
+	{}
+};
 
 static void alc269_fill_coef(struct hda_codec *codec)
 {
@@ -4985,6 +5027,7 @@ static int patch_alc269(struct hda_codec *codec)
 
 	snd_hda_pick_fixup(codec, alc269_fixup_models,
 		       alc269_fixup_tbl, alc269_fixups);
+	snd_hda_pick_pin_fixup(codec, alc269_pin_fixup_tbl, alc269_fixups);
 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
 
 	alc_auto_parse_customize_define(codec);
Signature · 1 line
1.8.1.2
#13 lore raw

Re: [PATCH 5/5] ALSA: hda - add an instance to use snd_hda_pick_pin_fixup

Quoted 2 lines · Hui Wang

Just two members in the alc269_pin_fixup_tbl[] can cover more than 10 Dell laptop models.

Shouldn't then 10 lines be removed from alc269_fixup_tbl? Right now only two lines are removed.

Quoted 79 lines
---
  sound/pci/hda/patch_realtek.c | 47 +++++++++++++++++++++++++++++++++++++++++--
  1 file changed, 45 insertions(+), 2 deletions(-)
sound/pci/hda/patch_realtek.c +45 -2
index c0b16de..992949c 100644
@@ -4725,8 +4725,6 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
  	SND_PCI_QUIRK(0x1028, 0x061f, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
  	SND_PCI_QUIRK(0x1028, 0x0629, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
  	SND_PCI_QUIRK(0x1028, 0x062c, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
-	SND_PCI_QUIRK(0x1028, 0x062e, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
-	SND_PCI_QUIRK(0x1028, 0x0632, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
  	SND_PCI_QUIRK(0x1028, 0x0638, "Dell Inspiron 5439", ALC290_FIXUP_MONO_SPEAKERS_HSJACK),
  	SND_PCI_QUIRK(0x1028, 0x063e, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
  	SND_PCI_QUIRK(0x1028, 0x063f, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
@@ -4924,6 +4922,50 @@ static const struct hda_model_fixup alc269_fixup_models[] = {
  	{}
  };
 
+static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = {
+	{
+		.codec = 0x10ec0293,
+		.subvendor = 0x1028,
+#ifdef CONFIG_SND_DEBUG_VERBOSE
+		.name = "Dell",
+#endif
+		.pins = (const struct hda_pintbl[]) {
+			{0x12, 0x40000000},
+			{0x13, 0x90a60140},
+			{0x14, 0x90170110},
+			{0x15, 0x0221401f},
+			{0x16, 0x21014020},
+			{0x18, 0x411111f0},
+			{0x19, 0x21a19030},
+			{0x1a, 0x411111f0},
+			{0x1b, 0x411111f0},
+			{0x1d, 0x40700001},
+			{0x1e, 0x411111f0},
+		},
+		.value = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
+	},
+	{
+		.codec = 0x10ec0255,
+		.subvendor = 0x1028,
+#ifdef CONFIG_SND_DEBUG_VERBOSE
+		.name = "Dell",
+#endif
+		.pins = (const struct hda_pintbl[]) {
+			{0x12, 0x90a60140},
+			{0x14, 0x90170110},
+			{0x17, 0x40000000},
+			{0x18, 0x411111f0},
+			{0x19, 0x411111f0},
+			{0x1a, 0x411111f0},
+			{0x1b, 0x411111f0},
+			{0x1d, 0x40700001},
+			{0x1e, 0x411111f0},
+			{0x21, 0x02211020},
+		},
+		.value = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
+	},
+	{}
+};
 
  static void alc269_fill_coef(struct hda_codec *codec)
  {
@@ -4985,6 +5027,7 @@ static int patch_alc269(struct hda_codec *codec)
 
  	snd_hda_pick_fixup(codec, alc269_fixup_models,
  		       alc269_fixup_tbl, alc269_fixups);
+	snd_hda_pick_pin_fixup(codec, alc269_pin_fixup_tbl, alc269_fixups);
  	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
 
  	alc_auto_parse_customize_define(codec);
Signature · 2 lines
David Henningsson, Canonical Ltd.
https://launchpad.net/~diwic
author
#14 lore raw

Re: [PATCH 5/5] ALSA: hda - add an instance to use snd_hda_pick_pin_fixup

Quoted 7 lines · David Henningsson
Quoted 2 lines · Hui Wang

Just two members in the alc269_pin_fixup_tbl[] can cover more than 10 Dell laptop models.

Shouldn't then 10 lines be removed from alc269_fixup_tbl? Right now only two lines are removed.

I mean the 10 new Dell laptops which have not been in the Linux kernel yet.

Please see a new bug #1321179, there are 7 laptops in this bug, In the past, we need to add 7 lines to fix them, but now all of them can be fixed by this patch.

Removing the existing lines is the next step plan.

Quoted 92 lines
Quoted 91 lines
---
  sound/pci/hda/patch_realtek.c | 47 
+++++++++++++++++++++++++++++++++++++++++--
  1 file changed, 45 insertions(+), 2 deletions(-)
sound/pci/hda/patch_realtek.c +0 -0
index c0b16de..992949c 100644
@@ -4725,8 +4725,6 @@ static const struct snd_pci_quirk 
 alc269_fixup_tbl[] = {
      SND_PCI_QUIRK(0x1028, 0x061f, "Dell", 
 ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
      SND_PCI_QUIRK(0x1028, 0x0629, "Dell", 
 ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
      SND_PCI_QUIRK(0x1028, 0x062c, "Dell", 

ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
- SND_PCI_QUIRK(0x1028, 0x062e, "Dell",
ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
- SND_PCI_QUIRK(0x1028, 0x0632, "Dell",
ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),

      SND_PCI_QUIRK(0x1028, 0x0638, "Dell Inspiron 5439", 
ALC290_FIXUP_MONO_SPEAKERS_HSJACK),
      SND_PCI_QUIRK(0x1028, 0x063e, "Dell", 
ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
      SND_PCI_QUIRK(0x1028, 0x063f, "Dell", 

ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),

sound/pci/hda/patch_realtek.c +44 -0
@@ -4924,6 +4922,50 @@ static const struct hda_model_fixup 
 alc269_fixup_models[] = {
      {}
  };
 
+static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = {
+    {
+        .codec = 0x10ec0293,
+        .subvendor = 0x1028,
+#ifdef CONFIG_SND_DEBUG_VERBOSE
+        .name = "Dell",
+#endif
+        .pins = (const struct hda_pintbl[]) {
+            {0x12, 0x40000000},
+            {0x13, 0x90a60140},
+            {0x14, 0x90170110},
+            {0x15, 0x0221401f},
+            {0x16, 0x21014020},
+            {0x18, 0x411111f0},
+            {0x19, 0x21a19030},
+            {0x1a, 0x411111f0},
+            {0x1b, 0x411111f0},
+            {0x1d, 0x40700001},
+            {0x1e, 0x411111f0},
+        },
+        .value = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
+    },
+    {
+        .codec = 0x10ec0255,
+        .subvendor = 0x1028,
+#ifdef CONFIG_SND_DEBUG_VERBOSE
+        .name = "Dell",
+#endif
+        .pins = (const struct hda_pintbl[]) {
+            {0x12, 0x90a60140},
+            {0x14, 0x90170110},
+            {0x17, 0x40000000},
+            {0x18, 0x411111f0},
+            {0x19, 0x411111f0},
+            {0x1a, 0x411111f0},
+            {0x1b, 0x411111f0},
+            {0x1d, 0x40700001},
+            {0x1e, 0x411111f0},
+            {0x21, 0x02211020},
+        },
+        .value = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
+    },
+    {}
+};
 
  static void alc269_fill_coef(struct hda_codec *codec)
  {
sound/pci/hda/patch_realtek.c +1 -0
@@ -4985,6 +5027,7 @@ static int patch_alc269(struct hda_codec *codec)
 
      snd_hda_pick_fixup(codec, alc269_fixup_models,
                 alc269_fixup_tbl, alc269_fixups);
+    snd_hda_pick_pin_fixup(codec, alc269_pin_fixup_tbl, alc269_fixups);
      snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
 
      alc_auto_parse_customize_define(codec);
#15 lore raw
In reply to Hui Wang

At Mon, 26 May 2014 16:22:40 +0800,

Quoted 9 lines · Hui Wang

From: David Henningsson <[email protected]>

The "fixup_forced" flag will indicate whether a specific fixup (or nofixup) has been set by the user, to override the driver's default.
This flag will help future patches.

In general, when you submit a patch, *you* need to sign off the patch in addition. It's no big problem in this case since I already got the same patches from David, though.

In anyway, I applied all patches now. Thanks.

Takashi

Quoted 53 lines
---
 sound/pci/hda/hda_auto_parser.c | 9 ++++++---
 sound/pci/hda/hda_codec.h       | 1 +
 2 files changed, 7 insertions(+), 3 deletions(-)
sound/pci/hda/hda_auto_parser.c +6 -3
index 90d2fda..36961ab 100644
@@ -852,15 +852,17 @@ void snd_hda_pick_fixup(struct hda_codec *codec,
 	if (codec->modelname && !strcmp(codec->modelname, "nofixup")) {
 		codec->fixup_list = NULL;
 		codec->fixup_id = -1;
+		codec->fixup_forced = 1;
 		return;
 	}
 
 	if (codec->modelname && models) {
 		while (models->name) {
 			if (!strcmp(codec->modelname, models->name)) {
-				id = models->id;
-				name = models->name;
-				break;
+				codec->fixup_id = models->id;
+				codec->fixup_name = models->name;
+				codec->fixup_forced = 1;
+				return;
 			}
 			models++;
 		}
@@ -889,6 +891,7 @@ void snd_hda_pick_fixup(struct hda_codec *codec,
 		}
 	}
 
+	codec->fixup_forced = 0;
 	codec->fixup_id = id;
 	if (id >= 0) {
 		codec->fixup_list = fixlist;
sound/pci/hda/hda_codec.h +1 -0
index a423313..5825aa1 100644
@@ -402,6 +402,7 @@ struct hda_codec {
 
 	/* fix-up list */
 	int fixup_id;
+	unsigned int fixup_forced:1; /* fixup explicitly set by user */
 	const struct hda_fixup *fixup_list;
 	const char *fixup_name;
 
Signature · 1 line
1.8.1.2