thank you very much for checking my diff and going the extra mile  
of fixing the style. I have tested your diff and can confirm that 
sound still works as before. So all good! 

Regarding the subid dependent codec name string, I was “inspired”
by the cases on lines 95, 207, 213, and 241 which all seem to do 
that to accommodate for vendors using different (presumably OEM) 
codes names in their datasheets. But you are right, I also prefer 
to see which codec my kernel *actually* uses, and not what some 
vendor decided to call it. 


> On Apr 19, 2021, at 17:40, Alexandre Ratchov <a...@caoua.org> wrote:

> 
> Thanks for looking at this. Few comments:
> 
> - the "PCI_VENDOR(this->subid) == PCI_VENDOR_LENOVO" compares the 16
>  lower bits of the subid. It's not necessary because below we compare
>  the full 32 bits.
> 
> - the "name" field is the codec name; it is identified by the "vid"
>  field, so it shouldn't depend on the device subid.
> 
> - style: indentation is (8 char) TAB, see style(9).
> 
> With above tweaks, I ended up this diff. Could you confirm it still
> makes audio work?
> 
> Index: azalia.c
> ===================================================================
> RCS file: /cvs/src/sys/dev/pci/azalia.c,v
> retrieving revision 1.259
> diff -u -p -u -p -r1.259 azalia.c
> --- azalia.c  25 Oct 2020 07:22:06 -0000      1.259
> +++ azalia.c  19 Apr 2021 15:37:32 -0000
> @@ -490,7 +490,8 @@ azalia_configure_pci(azalia_t *az)
> 
> const struct pci_matchid azalia_pci_devices[] = {
>       { PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_200SERIES_U_HDA },
> -     { PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_300SERIES_U_HDA }
> +     { PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_300SERIES_U_HDA },
> +     { PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_400SERIES_CAVS }
> };
> 
> int
> Index: azalia_codec.c
> ===================================================================
> RCS file: /cvs/src/sys/dev/pci/azalia_codec.c,v
> retrieving revision 1.183
> diff -u -p -u -p -r1.183 azalia_codec.c
> --- azalia_codec.c    16 Jan 2021 07:02:39 -0000      1.183
> +++ azalia_codec.c    19 Apr 2021 15:37:32 -0000
> @@ -162,9 +162,15 @@ azalia_codec_init_vtbl(codec_t *this)
>               break;
>       case 0x10ec0285:
>               this->name = "Realtek ALC285";
> -             if (this->subid == 0x229217aa)           /* Thinkpad X1 Carbon 
> 7 */
> +             if (this->subid == 0x229217aa) {
> +                     /* Thinkpad X1 Carbon 7 */
>                       this->qrks |= AZ_QRK_ROUTE_SPKR2_DAC |
>                           AZ_QRK_WID_CLOSE_PCBEEP;
> +              } else if (this->subid == 0x22c017aa) {
> +                     /* Thinkpad X1 Extreme 3 */
> +                     this->qrks |= AZ_QRK_DOLBY_ATMOS |
> +                         AZ_QRK_ROUTE_SPKR2_DAC;
> +             }
>               break;
>       case 0x10ec0287:
>               this->name = "Realtek ALC287";
> 

Reply via email to