On Wed, Oct 21, 2020 at 06:27:15PM -0400, Ashton Fagg wrote: > Ashton Fagg <ash...@fagg.id.au> writes: > > > (My first OpenBSD patch - sorry if it's terrible) > > > > Attached is a patch to make the audio chipset (Realtek ALC257) in a > > Thinkpad T14s get recognized by Azalia. It also sets the usual bits > > that get set for most other devices. > > > > Additionally, this also enabled pci-e snooping for the Renoir HDA > > (definition included in pcidevs.h). I am not sure if this is entirely > > necessary, I am merely following along with what other patches for > > similar things have done. Guidance on that would be appreciated. > > > > Tested locally, dmesg attached. azalia correctly registers device as > > "Realtek ALC257". > > > Someone was kind enough to point out that I had neglected to KNF the > patch. Apologies, see attached for a KNF'ed version.
pcidevs.h is a generated file. After pcidevs is modified 'make' is run in sys/dev/pci then pcidevs.h and pcidevs_data.h are created based on that. In this case it is already there though so you don't need to change it. > > diff --git a/sys/dev/pci/azalia.c b/sys/dev/pci/azalia.c > index 36e8ae36d27..9c8d8665b7d 100644 > --- a/sys/dev/pci/azalia.c > +++ b/sys/dev/pci/azalia.c > @@ -387,6 +387,7 @@ azalia_configure_pci(azalia_t *az) > case PCI_PRODUCT_ATI_SB450_HDA: > case PCI_PRODUCT_ATI_SBX00_HDA: > case PCI_PRODUCT_AMD_HUDSON2_HDA: > + case PCI_PRODUCT_AMD_RENOIR_HDA: > reg = azalia_pci_read(az->pc, az->tag, ATI_PCIE_SNOOP_REG); > reg &= ATI_PCIE_SNOOP_MASK; > reg |= ATI_PCIE_SNOOP_ENABLE; > diff --git a/sys/dev/pci/azalia_codec.c b/sys/dev/pci/azalia_codec.c > index 33833d2f8ea..9a1e000e5f3 100644 > --- a/sys/dev/pci/azalia_codec.c > +++ b/sys/dev/pci/azalia_codec.c > @@ -83,6 +83,10 @@ azalia_codec_init_vtbl(codec_t *this) > this->name = "Realtek ALC221"; > this->qrks |= AZ_QRK_WID_CDIN_1C | AZ_QRK_WID_BEEP_1D; > break; > + case 0x10ec0257: > + this->name = "Realtek ALC257"; > + this->qrks |= AZ_QRK_WID_CDIN_1C | AZ_QRK_WID_BEEP_1D; > + break; > case 0x10ec0260: > this->name = "Realtek ALC260"; > if (this->subid == 0x008f1025) > diff --git a/sys/dev/pci/pcidevs.h b/sys/dev/pci/pcidevs.h > index e5f74e84555..c09b1a6e521 100644 > --- a/sys/dev/pci/pcidevs.h > +++ b/sys/dev/pci/pcidevs.h > @@ -946,6 +946,7 @@ > #define PCI_PRODUCT_AMD_RS780_PCIE_7 0x9608 /* RS780 PCIE */ > #define PCI_PRODUCT_AMD_RS780_PCIE_8 0x9609 /* RS780 PCIE */ > #define PCI_PRODUCT_AMD_RS780_PCIE_9 0x960b /* RS780 PCIE */ > +#define PCI_PRODUCT_AMD_RENOIR_HDA 0x1637 /* Renoir HD Audio */ > > /* AMI */ > #define PCI_PRODUCT_AMI_MEGARAID 0x1960 /* MegaRAID */