azalia: quirk for thinkpad x1c7

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

azalia: quirk for thinkpad x1c7

joshua stein-3
The ThinkPad X1 Carbon 7th generation has 4 speakers now, but the
default setup connects both speaker and speaker2 to the same DAC.  
The speaker2 set needs to be routed to a different DAC (dac-0:1) to
work properly.

This also adds the 300 Series HDA controller to the list of devices
where snooping is enabled.


Index: sys/dev/pci/azalia.c
===================================================================
RCS file: /cvs/src/sys/dev/pci/azalia.c,v
retrieving revision 1.249
diff -u -p -u -p -r1.249 azalia.c
--- sys/dev/pci/azalia.c 9 May 2019 14:50:46 -0000 1.249
+++ sys/dev/pci/azalia.c 10 Aug 2019 16:22:41 -0000
@@ -453,6 +453,7 @@ azalia_configure_pci(azalia_t *az)
  case PCI_PRODUCT_INTEL_100SERIES_LP_HDA:
  case PCI_PRODUCT_INTEL_200SERIES_HDA:
  case PCI_PRODUCT_INTEL_200SERIES_U_HDA:
+ case PCI_PRODUCT_INTEL_300SERIES_U_HDA:
  case PCI_PRODUCT_INTEL_C600_HDA:
  case PCI_PRODUCT_INTEL_C610_HDA:
  case PCI_PRODUCT_INTEL_BSW_HDA:
@@ -2220,7 +2221,12 @@ azalia_codec_select_spkrdac(codec_t *thi
  for (i = 0; i < w->nconnections; i++) {
  conv = azalia_codec_find_defdac(this,
     w->connections[i], 1);
- if (conv == this->spkr_dac) {
+ if (this->qrks & AZ_QRK_WID_SPKR2_DAC) {
+ if (conv != this->spkr_dac) {
+ conn = i;
+ break;
+ }
+ } else if (conv == this->spkr_dac) {
  conn = i;
  break;
  }
Index: sys/dev/pci/azalia.h
===================================================================
RCS file: /cvs/src/sys/dev/pci/azalia.h,v
retrieving revision 1.66
diff -u -p -u -p -r1.66 azalia.h
--- sys/dev/pci/azalia.h 24 Mar 2019 14:37:44 -0000 1.66
+++ sys/dev/pci/azalia.h 10 Aug 2019 16:22:41 -0000
@@ -514,6 +514,7 @@
 #define AZ_QRK_WID_TPDOCK2 0x00020000
 #define AZ_QRK_WID_TPDOCK3 0x00040000
 #define AZ_QRK_WID_DOLBY_ATMOS 0x00100000
+#define AZ_QRK_WID_SPKR2_DAC 0x00200000
 
 /* memory-mapped types */
 typedef struct {
Index: sys/dev/pci/azalia_codec.c
===================================================================
RCS file: /cvs/src/sys/dev/pci/azalia_codec.c,v
retrieving revision 1.175
diff -u -p -u -p -r1.175 azalia_codec.c
--- sys/dev/pci/azalia_codec.c 7 Aug 2019 22:03:43 -0000 1.175
+++ sys/dev/pci/azalia_codec.c 10 Aug 2019 16:22:42 -0000
@@ -126,6 +126,8 @@ azalia_codec_init_vtbl(codec_t *this)
  break;
  case 0x10ec0285:
  this->name = "Realtek ALC285";
+ if (this->subid == 0x229217aa) /* Thinkpad X1 Carbon 7 */
+ this->qrks |= AZ_QRK_WID_SPKR2_DAC;
  break;
  case 0x10ec0292:
  this->name = "Realtek ALC292";