Skip to contentSkip to conversation

ALSA: hda/tas2781: Add speaker id check for ASUS projects

PATCH Superseded Baojun Xu 3 participants 4 messages Nov 23, 2024 – Dec 30, 2024

Subsystems (2)

v6 of 7 Superseded Latest is v7 →

lore
Share & tools
lore

Baojun Xu

author maintainer
#0 lore raw

PATCH v6 1/1 ALSA: hda/tas2781: Add speaker id check for ASUS projects

Add speaker id check by gpio in ACPI for ASUS projects.
In other vendors, speaker id was checked by BIOS, and was applied in last bit of subsys id, so we can load corresponding firmware binary file for its speaker by subsys id.
But in ASUS project, the firmware binary name will be appended an extra number to tell the speakers from different vendors. And this single digit come from gpio level of speaker id in BIOS.

---
v6:
- Remove define for AUSU in tas2781.h.
- Add include linux/pci_ids.h for use public ASUS id define.
- Add subid for ASUS id save and check.
- Change comments to /* */ from //.
- Change next line indented to (.
- Change ASUS check from string compare to u16 compare.
v5:
- Change length in strncmp(), use strlen().
v4:
- Change strncasecmp() to strncmp().
- Add error debug message print for "add driver gpio".
- Put error information (PTR_ERR) to ret for get gpio.
- Change %01d to %d in snprintf().
v3:
- Change strstr() to strncasecmp() for compare subsystem id.
- Remove result check after devm_acpi_dev_add_driver_gpios().
- Remove spk_id > 1 check, as result of gpiod_get_value(), must be 0 or 1, or negative if error happend.
- Change scnprintf() to snprintf(), as didn't care the length.
- Remove changes which not relative current patch.
v2:
- Change ASUS id from 0x10430000 to "1043".
- Move gpio setting to tas2781_read_acpi() from probe.
- Remove interrupt gpio in acpi_gpio_mapping.
- Add sub and physdev in tas2781_read_acpi() for subsys id read.
- Add debug log for get acpi resource failed.
- Return error if get resource or subsys id failed.
- Return error if get gpio fail for speaker id with ASUS projects.
- Change fixed buffer lengh to sizeof().
- Change bits calculator to lower_16_bits().
- Remove unnecessary empty line in tas2781_hda_i2c_probe().

---
 include/sound/tas2781.h         |  1 +
 sound/pci/hda/tas2781_hda_i2c.c | 67 ++++++++++++++++++++++++++++++---
 2 files changed, 62 insertions(+), 6 deletions(-)
include/sound/tas2781.h +1 -0
index 8cd6da0480b7..72d2060904f6 100644
@@ -156,6 +156,7 @@ struct tasdevice_priv {
 	struct tasdevice_rca rcabin;
 	struct calidata cali_data;
 	struct tasdevice_fw *fmw;
+	struct gpio_desc *speaker_id;
 	struct gpio_desc *reset;
 	struct mutex codec_lock;
 	struct regmap *regmap;
sound/pci/hda/tas2781_hda_i2c.c +61 -6

110 lines not on this page · raw message

Signature · 1 line
2.43.0
#1 lore raw
Quoted 10 lines · Baojun Xu

Add speaker id check by gpio in ACPI for ASUS projects.
In other vendors, speaker id was checked by BIOS, and was applied in last bit of subsys id, so we can load corresponding firmware binary file for its speaker by subsys id.
But in ASUS project, the firmware binary name will be appended an extra number to tell the speakers from different vendors. And this single digit come from gpio level of speaker id in BIOS.

I applied this now, as it's been cooked for long time and we don't
want miss 6.12 merge. If any issue is found, let's fix on the top.

thanks,

Takashi

#2 lore raw

This is causing issues with the TAS2563 in my Yoga 7 Gen 7 (14ARB7):

```
[    7.264012] tas2781-hda i2c-INT8866:00: Failed to get SUBSYS ID.
[    7.264065] tas2781-hda i2c-INT8866:00: read acpi error, ret: -61
[    7.264109] tas2781-hda i2c-INT8866:00: error -ENODATA: Platform
not supported
[    7.264252] tas2781-hda i2c-INT8866:00: probe with driver
tas2781-hda failed with error -61
```
#3 lore raw
Quoted 11 lines · Stuart Hayhurst

This is causing issues with the TAS2563 in my Yoga 7 Gen 7 (14ARB7):

```
[    7.264012] tas2781-hda i2c-INT8866:00: Failed to get SUBSYS ID.
[    7.264065] tas2781-hda i2c-INT8866:00: read acpi error, ret: -61
[    7.264109] tas2781-hda i2c-INT8866:00: error -ENODATA: Platform
not supported
[    7.264252] tas2781-hda i2c-INT8866:00: probe with driver
tas2781-hda failed with error -61
```

FYI, this should be fixed with the recent patch:
https://lore.kernel.org/[email protected]

It's already in for-linus branch of sound git tree.

thanks,

Takashi