Re: [PATCH v5] ALSA: hda/tas2781: Add speaker id check for ASUS projects

From: Christophe JAILLET
Date: Sat Nov 16 2024 - 03:05:54 EST


Le 16/11/2024 à 08:50, Baojun Xu a écrit :
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.

Signed-off-by: Baojun Xu <baojun.xu@xxxxxx>

...

+ sub = acpi_get_subsystem_id(ACPI_HANDLE(physdev));
+ if (IS_ERR(sub)) {
+ dev_err(p->dev, "Failed to get SUBSYS ID.\n");
+ goto err;
+ }
+ // Speaker id was needed for ASUS projects.

Comments in this file are all /* */.
Why introduce // in many places?

CJ

+ if (!strncmp(sub, TAS2781_ASUS_ID, strlen(TAS2781_ASUS_ID))) {
+ ret = devm_acpi_dev_add_driver_gpios(p->dev,
+ tas2781_speaker_id_gpios);
+ if (ret < 0)
+ dev_err(p->dev, "Failed to add driver gpio %d.\n",
+ ret);

ret should be indented below the ( to ease reading.

+ p->speaker_id = devm_gpiod_get(p->dev, "speakerid", GPIOD_IN);
+ if (IS_ERR(p->speaker_id)) {
+ dev_err(p->dev, "Failed to get Speaker id.\n");
+ ret = PTR_ERR(p->speaker_id);
+ goto err;
+ }
+ } else {
+ p->speaker_id = NULL;
+ }

...