Skip to contentSkip to conversation

Enable Realtek ALC671 Codec

PATCH In review Rainer Koenig 2 participants 6 messages Apr 3, 2013 Sound

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Enable Realtek ALC671 Codec

Hi,

working on a new mainboard generation with ALC671 codecs the first tests showed that the generic codec parser is just configuring the rear mic in for audio input, line-in and front-mic are missing.

I tried to understand the code of patch_realtek.c and after compiling with CONFIG_SND_DEBUG I saw that this module is not used at all for the ALC671 codec because its device-ID was missing.

So what I did is:
- adding the device id and assigned the ALC662 patches for it.
- Added the device id so that it enables 4 ports in alc662_parse_auto_config
- changed the conditional in alc_subsystem_id because it looked so strange to me when I tried to understand what is happening. :-)

Here is the patch:

sound/pci/hda/patch_realtek.c +1 -1
@@ -1283,7 +1283,7 @@ static int alc_subsystem_id(struct hda_codec *codec,
        }
 
        ass = codec->subsystem_id & 0xffff;
-       if ((ass != codec->bus->pci->subsystem_device) && (ass & 1))
+       if ((ass == codec->bus->pci->subsystem_device) && (ass & 1))
                goto do_sku;
 
        /* invalid SSID, check the special NID pin defcfg instead */
@@ -6663,7 +6663,8 @@ static int alc662_parse_auto_config(struct hda_codec *codec)
        const hda_nid_t *ssids;
 
        if (codec->vendor_id == 0x10ec0272 || codec->vendor_id == 
0x10ec0663 ||
-           codec->vendor_id == 0x10ec0665 || codec->vendor_id == 0x10ec0670)
+           codec->vendor_id == 0x10ec0665 || codec->vendor_id == 0x10ec0670 ||
+           codec->vendor_id == 0x10ec0671)
                ssids = alc663_ssids;
        else
                ssids = alc662_ssids;
@@ -7115,6 +7116,7 @@ static const struct hda_codec_preset snd_hda_preset_realtek[] = {
        { .id = 0x10ec0665, .name = "ALC665", .patch = patch_alc662 },
        { .id = 0x10ec0668, .name = "ALC668", .patch = patch_alc662 },
        { .id = 0x10ec0670, .name = "ALC670", .patch = patch_alc662 },
+       { .id = 0x10ec0671, .name = "ALC671", .patch = patch_alc662 },
        { .id = 0x10ec0680, .name = "ALC680", .patch = patch_alc680 },
        { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 },
        { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 },
Signature · 15 lines
Dipl.-Inf. (FH) Rainer Koenig
Project Manager Linux Clients
Dept. PDG WPS R&D SW OSE

Fujitsu Technology Solutions
Bürgermeister-Ullrich-Str. 100
86199 Augsburg
Germany

Telephone: +49-821-804-3321
Telefax:   +49-821-804-2131
Mail:      mailto:[email protected]

Internet         ts.fujtsu.com
Company Details  ts.fujitsu.com/imprint.html
#1 lore raw

At Wed, 03 Apr 2013 13:29:29 +0200,

Quoted 7 lines · Rainer Koenig

Hi,

working on a new mainboard generation with ALC671 codecs the first tests showed that the generic codec parser is just configuring the rear mic in for audio input, line-in and front-mic are missing.

Quoted 8 lines

I tried to understand the code of patch_realtek.c and after compiling with CONFIG_SND_DEBUG I saw that this module is not used at all for the ALC671 codec because its device-ID was missing.

So what I did is:
- adding the device id and assigned the ALC662 patches for it.
- Added the device id so that it enables 4 ports in alc662_parse_auto_config

These are fine to take, but

Quoted 2 lines

- changed the conditional in alc_subsystem_id because it looked so strange to me when I tried to understand what is happening. :-)

... this isn't. You should try to understand harder :)

Takashi

Quoted 37 lines

Here is the patch:

sound/pci/hda/patch_realtek.c +1 -1
@@ -1283,7 +1283,7 @@ static int alc_subsystem_id(struct hda_codec *codec,
         }
 
         ass = codec->subsystem_id & 0xffff;
-       if ((ass != codec->bus->pci->subsystem_device) && (ass & 1))
+       if ((ass == codec->bus->pci->subsystem_device) && (ass & 1))
                 goto do_sku;
 
         /* invalid SSID, check the special NID pin defcfg instead */
@@ -6663,7 +6663,8 @@ static int alc662_parse_auto_config(struct 
 hda_codec *codec)
         const hda_nid_t *ssids;
 
         if (codec->vendor_id == 0x10ec0272 || codec->vendor_id == 

0x10ec0663 ||
- codec->vendor_id == 0x10ec0665 || codec->vendor_id ==
0x10ec0670)
+ codec->vendor_id == 0x10ec0665 || codec->vendor_id ==
0x10ec0670 ||

sound/pci/hda/patch_realtek.c +2 -0
+           codec->vendor_id == 0x10ec0671)
                 ssids = alc663_ssids;
         else
                 ssids = alc662_ssids;
@@ -7115,6 +7116,7 @@ static const struct hda_codec_preset 
 snd_hda_preset_realtek[] = {
         { .id = 0x10ec0665, .name = "ALC665", .patch = patch_alc662 },
         { .id = 0x10ec0668, .name = "ALC668", .patch = patch_alc662 },
         { .id = 0x10ec0670, .name = "ALC670", .patch = patch_alc662 },
+       { .id = 0x10ec0671, .name = "ALC671", .patch = patch_alc662 },
         { .id = 0x10ec0680, .name = "ALC680", .patch = patch_alc680 },
         { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 },
Quoted 24 lines
         { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 },
Signature · 19 lines
Dipl.-Inf. (FH) Rainer Koenig
Project Manager Linux Clients
Dept. PDG WPS R&D SW OSE

Fujitsu Technology Solutions
Bürgermeister-Ullrich-Str. 100
86199 Augsburg
Germany

Telephone: +49-821-804-3321
Telefax:   +49-821-804-2131
Mail:      mailto:[email protected]

Internet         ts.fujtsu.com
Company Details  ts.fujitsu.com/imprint.html
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

#2 lore raw

At Wed, 03 Apr 2013 14:25:19 +0200,

Quoted 19 lines · Takashi Iwai

At Wed, 03 Apr 2013 13:29:29 +0200,

Quoted 7 lines · Rainer Koenig

Hi,

working on a new mainboard generation with ALC671 codecs the first tests showed that the generic codec parser is just configuring the rear mic in for audio input, line-in and front-mic are missing.

Quoted 8 lines

I tried to understand the code of patch_realtek.c and after compiling with CONFIG_SND_DEBUG I saw that this module is not used at all for the ALC671 codec because its device-ID was missing.

So what I did is:
- adding the device id and assigned the ALC662 patches for it.
- Added the device id so that it enables 4 ports in alc662_parse_auto_config

Quoted 6 lines

These are fine to take, but

Quoted 2 lines

- changed the conditional in alc_subsystem_id because it looked so strange to me when I tried to understand what is happening. :-)

... this isn't. You should try to understand harder :)

A hint to understand better is that Realtek tries to get its own config bits given by BIOS. The first place to check is the lower 16bit of codec SSID, and if this is different from the PCI SSID, it's supposed to be such a value and taken to retrieve some information. If it's same as PCI SSID, the pin config of some special pin is referred as an alternative configuration.

In anyway, could you resend your patch only with the addition of ALC671? Also, run scripts/checkpatch.pl and fix the issues before submission.

thanks,

Takashi

Quoted 58 lines

Takashi

Quoted 54 lines

Here is the patch:

sound/pci/hda/patch_realtek.c +1 -1
@@ -1283,7 +1283,7 @@ static int alc_subsystem_id(struct hda_codec *codec,
         }
 
         ass = codec->subsystem_id & 0xffff;
-       if ((ass != codec->bus->pci->subsystem_device) && (ass & 1))
+       if ((ass == codec->bus->pci->subsystem_device) && (ass & 1))
                 goto do_sku;
 
         /* invalid SSID, check the special NID pin defcfg instead */
@@ -6663,7 +6663,8 @@ static int alc662_parse_auto_config(struct 
 hda_codec *codec)
         const hda_nid_t *ssids;
 
         if (codec->vendor_id == 0x10ec0272 || codec->vendor_id == 

0x10ec0663 ||
- codec->vendor_id == 0x10ec0665 || codec->vendor_id ==
0x10ec0670)
+ codec->vendor_id == 0x10ec0665 || codec->vendor_id ==
0x10ec0670 ||

sound/pci/hda/patch_realtek.c +2 -0
+           codec->vendor_id == 0x10ec0671)
                 ssids = alc663_ssids;
         else
                 ssids = alc662_ssids;
@@ -7115,6 +7116,7 @@ static const struct hda_codec_preset 
 snd_hda_preset_realtek[] = {
         { .id = 0x10ec0665, .name = "ALC665", .patch = patch_alc662 },
         { .id = 0x10ec0668, .name = "ALC668", .patch = patch_alc662 },
         { .id = 0x10ec0670, .name = "ALC670", .patch = patch_alc662 },
+       { .id = 0x10ec0671, .name = "ALC671", .patch = patch_alc662 },
         { .id = 0x10ec0680, .name = "ALC680", .patch = patch_alc680 },
         { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 },
         { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 },
Signature · 12 lines
Dipl.-Inf. (FH) Rainer Koenig
Project Manager Linux Clients
Dept. PDG WPS R&D SW OSE

Fujitsu Technology Solutions
Bürgermeister-Ullrich-Str. 100
86199 Augsburg
Germany

Telephone: +49-821-804-3321
Telefax:   +49-821-804-2131
Mail:      mailto:[email protected]
Quoted 7 lines
Quoted 7 lines

Internet ts.fujtsu.com
Company Details ts.fujitsu.com/imprint.html
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

#3 lore raw
In reply to Takashi Iwai
Quoted 4 lines · Takashi Iwai
Quoted 2 lines

- changed the conditional in alc_subsystem_id because it looked so strange to me when I tried to understand what is happening. :-)

... this isn't. You should try to understand harder :)

I'm really trying hard to understand. The original source says that

	ass = codec->subsystem_id & 0xffff;

Masking out the lower 16bit of codecs subsytem-id in my case ass would be 11eb

	if ((ass != codec->bus->pci->subsystem_device) && (ass & 1))

comparing ((11eb != 11eb) would fail so the whole if-construct fails and we don't do the next line that is

		goto do_sku;

Instead we complain about an invalid subsystem-id...?

Really, that is somewhat difficult to understand. Why is the subsystem ID that I find in /proc/asound/card0/codec#2 and that matches the subsystem device that I can see with 'lspci -vn' invalid???

What stuff do I need to take to understand this? ;-)

Regards
Rainer

Signature · 19 lines
Dipl.-Inf. (FH) Rainer Koenig
Project Manager Linux Clients
Dept. PDG WPS R&D SW OSE

Fujitsu Technology Solutions
Bürgermeister-Ullrich-Str. 100
86199 Augsburg
Germany

Telephone: +49-821-804-3321
Telefax:   +49-821-804-2131
Mail:      mailto:[email protected]

Internet         ts.fujtsu.com
Company Details  ts.fujitsu.com/imprint.html
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
#4 lore raw

Resend of the patch (as asked by Takashi Iwai):

sound/pci/hda/patch_realtek.c +3 -1
index 7743775..fcbf4c9 100644
@@ -6663,7 +6663,8 @@ static int alc662_parse_auto_config(struct hda_codec *codec)
 	const hda_nid_t *ssids;
 
 	if (codec->vendor_id == 0x10ec0272 || codec->vendor_id == 0x10ec0663 ||
-	    codec->vendor_id == 0x10ec0665 || codec->vendor_id == 0x10ec0670)
+	    codec->vendor_id == 0x10ec0665 || codec->vendor_id == 0x10ec0670 ||
+	    codec->vendor_id == 0x10ec0671)
 		ssids = alc663_ssids;
 	else
 		ssids = alc662_ssids;
@@ -7115,6 +7116,7 @@ static const struct hda_codec_preset snd_hda_preset_realtek[] = {
 	{ .id = 0x10ec0665, .name = "ALC665", .patch = patch_alc662 },
 	{ .id = 0x10ec0668, .name = "ALC668", .patch = patch_alc662 },
 	{ .id = 0x10ec0670, .name = "ALC670", .patch = patch_alc662 },
+	{ .id = 0x10ec0671, .name = "ALC671", .patch = patch_alc662 },
 	{ .id = 0x10ec0680, .name = "ALC680", .patch = patch_alc680 },
 	{ .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 },
 	{ .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 },
Signature · 19 lines
Dipl.-Inf. (FH) Rainer Koenig
Project Manager Linux Clients
Dept. PDG WPS R&D SW OSE

Fujitsu Technology Solutions
Bürgermeister-Ullrich-Str. 100
86199 Augsburg
Germany

Telephone: +49-821-804-3321
Telefax:   +49-821-804-2131
Mail:      mailto:[email protected]

Internet         ts.fujtsu.com
Company Details  ts.fujitsu.com/imprint.html
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
#5 lore raw

At Wed, 03 Apr 2013 15:25:25 +0200,

Quoted 2 lines · Rainer Koenig

Resend of the patch (as asked by Takashi Iwai):

Keep the patch description. Resending a patch means to send a comprehensive patch that can be applied directly.

Also, check how other patches look like. Usually there are specific pattern of the subject line depending on the path.

And, last but not least, always give maintainers (in this case, me) to Cc when you submit a patch. Maintainers may overlook if it's sent only to ML.

thanks,

Takashi

Quoted 25 lines
sound/pci/hda/patch_realtek.c +2 -1
index 7743775..fcbf4c9 100644
@@ -6663,7 +6663,8 @@ static int alc662_parse_auto_config(struct 
 hda_codec *codec)
  	const hda_nid_t *ssids;
 
  	if (codec->vendor_id == 0x10ec0272 || codec->vendor_id == 0x10ec0663 ||
-	    codec->vendor_id == 0x10ec0665 || codec->vendor_id == 0x10ec0670)
+	    codec->vendor_id == 0x10ec0665 || codec->vendor_id == 0x10ec0670 ||
+	    codec->vendor_id == 0x10ec0671)
  		ssids = alc663_ssids;
  	else
  		ssids = alc662_ssids;
sound/pci/hda/patch_realtek.c +1 -0
@@ -7115,6 +7116,7 @@ static const struct hda_codec_preset 
 snd_hda_preset_realtek[] = {
  	{ .id = 0x10ec0665, .name = "ALC665", .patch = patch_alc662 },
  	{ .id = 0x10ec0668, .name = "ALC668", .patch = patch_alc662 },
  	{ .id = 0x10ec0670, .name = "ALC670", .patch = patch_alc662 },
+	{ .id = 0x10ec0671, .name = "ALC671", .patch = patch_alc662 },
  	{ .id = 0x10ec0680, .name = "ALC680", .patch = patch_alc680 },
  	{ .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 },
Quoted 24 lines

{ .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 },

Signature · 19 lines
Dipl.-Inf. (FH) Rainer Koenig
Project Manager Linux Clients
Dept. PDG WPS R&D SW OSE

Fujitsu Technology Solutions
Bürgermeister-Ullrich-Str. 100
86199 Augsburg
Germany

Telephone: +49-821-804-3321
Telefax:   +49-821-804-2131
Mail:      mailto:[email protected]

Internet         ts.fujtsu.com
Company Details  ts.fujitsu.com/imprint.html
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel