Skip to contentSkip to conversation

ALSA: hda: Replace numeric device IDs with constant values

PATCH Applied Rui Salvaterra 3 participants 5 messages Jan 22, 2024 – Jan 23, 2024 Sound

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 ALSA: hda: Replace numeric device IDs with constant values

We have self-explanatory constants for Intel HDA devices, let's use them instead of magic numbers and code comments.

---
 sound/pci/hda/hda_intel.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
sound/pci/hda/hda_intel.c +2 -2
index 2276adc84478..66f013ee160d 100644
@@ -1729,8 +1729,8 @@ static int default_bdl_pos_adj(struct azx *chip)
 	/* some exceptions: Atoms seem problematic with value 1 */
 	if (chip->pci->vendor == PCI_VENDOR_ID_INTEL) {
 		switch (chip->pci->device) {
-		case 0x0f04: /* Baytrail */
-		case 0x2284: /* Braswell */
+		case PCI_DEVICE_ID_INTEL_HDA_BYT:
+		case PCI_DEVICE_ID_INTEL_HDA_BSW:
 			return 32;
 		}
 	}
Signature · 1 line
2.43.0
#1 lore raw

PATCH 2/2 ALSA: hda: Increase default bdl_pos_adj for Apollo Lake

Apollo Lake seems to also suffer from IRQ timing issues. After being up for ~4 minutes, a Pentium N4200 system ends up falling back to workqueue-based IRQ handling:

[  208.019906] snd_hda_intel 0000:00:0e.0: IRQ timing workaround is activated

for card #0. Suggest a bigger bdl_pos_adj.

Unfortunately, the Baytrail and Braswell workaround value of 32 samples isn't enough to fix the issue here. Default to 64 samples.

---
 sound/pci/hda/hda_intel.c | 2 ++
 1 file changed, 2 insertions(+)
sound/pci/hda/hda_intel.c +2 -0
index 66f013ee160d..1b550c42db09 100644
@@ -1732,6 +1732,8 @@ static int default_bdl_pos_adj(struct azx *chip)
 		case PCI_DEVICE_ID_INTEL_HDA_BYT:
 		case PCI_DEVICE_ID_INTEL_HDA_BSW:
 			return 32;
+		case PCI_DEVICE_ID_INTEL_HDA_APL:
+			return 64;
 		}
 	}
 
Signature · 1 line
2.43.0
Reviewed-by on v1 2/2
#2 lore raw

Re: [PATCH 2/2] ALSA: hda: Increase default bdl_pos_adj for Apollo Lake

Quoted 20 lines · Rui Salvaterra

Apollo Lake seems to also suffer from IRQ timing issues. After being up for ~4 minutes, a Pentium N4200 system ends up falling back to workqueue-based IRQ handling:

[  208.019906] snd_hda_intel 0000:00:0e.0: IRQ timing workaround is activated

for card #0. Suggest a bigger bdl_pos_adj.

Unfortunately, the Baytrail and Braswell workaround value of 32 samples isn't enough to fix the issue here. Default to 64 samples.

---
  sound/pci/hda/hda_intel.c | 2 ++
  1 file changed, 2 insertions(+)
sound/pci/hda/hda_intel.c +0 -0
index 66f013ee160d..1b550c42db09 100644

sound/pci/hda/hda_intel.c static int default_bdl_pos_adj(struct azx *chip) · line 1739

Quoted 8 lines
sound/pci/hda/hda_intel.c +2 -0
@@ -1732,6 +1732,8 @@ static int default_bdl_pos_adj(struct azx *chip)
  		case PCI_DEVICE_ID_INTEL_HDA_BYT:
  		case PCI_DEVICE_ID_INTEL_HDA_BSW:
  			return 32;
+		case PCI_DEVICE_ID_INTEL_HDA_APL:
+			return 64;
  		}
  	}
 
Reviewed-by on v1 1/2
#3 lore raw
In reply to Rui Salvaterra
Quoted 13 lines · Rui Salvaterra

We have self-explanatory constants for Intel HDA devices, let's use them instead of magic numbers and code comments.

---
  sound/pci/hda/hda_intel.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
sound/pci/hda/hda_intel.c +0 -0
index 2276adc84478..66f013ee160d 100644

sound/pci/hda/hda_intel.c static int default_bdl_pos_adj(struct azx *chip) · line 1736

Quoted 10 lines
sound/pci/hda/hda_intel.c +2 -2
@@ -1729,8 +1729,8 @@ static int default_bdl_pos_adj(struct azx *chip)
  	/* some exceptions: Atoms seem problematic with value 1 */
  	if (chip->pci->vendor == PCI_VENDOR_ID_INTEL) {
  		switch (chip->pci->device) {
-		case 0x0f04: /* Baytrail */
-		case 0x2284: /* Braswell */
+		case PCI_DEVICE_ID_INTEL_HDA_BYT:
+		case PCI_DEVICE_ID_INTEL_HDA_BSW:
  			return 32;
  		}
  	}