Skip to contentSkip to conversation

ALSA: hda: cs35l56: Fix missing RESET GPIO if _SUB is missing

PATCH Superseded Richard Fitzgerald 2 participants 2 messages Sep 14, 2023 Sound

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ALSA: hda: cs35l56: Fix missing RESET GPIO if _SUB is missing

In cs35l56_hda_read_acpi() do not return if ACPI _SUB is missing.

A missing _SUB means that the driver cannot load a system-specific firmware, because the firmware is identified by the _SUB. But it can fallback to a generic firmware. Unfortunately this was being handled by immediately returning 0, which would skip the remaining ACPI configuration in cs35l56_hda_read_acpi() and so it would not get the RESET GPIO.

Fixes 73cfbfa9caea ("ALSA: hda/cs35l56: Add driver for Cirrus Logic CS35L56 amplifier")
---
 sound/pci/hda/cs35l56_hda.c | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)
sound/pci/hda/cs35l56_hda.c +5 -9
index 9e4976bdb5e0..a9844336bdc9 100644
@@ -864,15 +864,11 @@ static int cs35l56_hda_read_acpi(struct cs35l56_hda *cs35l56, int id)
 
 	sub = acpi_get_subsystem_id(ACPI_HANDLE(cs35l56->base.dev));
 
-	if (IS_ERR(sub)) {
-		/* If no ACPI SUB, return 0 and fallback to legacy firmware path, otherwise fail */
-		if (PTR_ERR(sub) == -ENODATA)
-			return 0;
-		else
-			return PTR_ERR(sub);
-	}
-
-	cs35l56->system_name = sub;
+	if (IS_ERR(sub))
+		dev_err_probe(cs35l56->base.dev, PTR_ERR(sub),
+			      "Read ACPI _SUB failed: fallback to generic firmware\n");
+	else
+		cs35l56->system_name = sub;
 
 	cs35l56->base.reset_gpio = devm_gpiod_get_index_optional(cs35l56->base.dev,
 								 "reset",
Signature · 1 line
2.30.2
#1 lore raw
Quoted 26 lines · Richard Fitzgerald

In cs35l56_hda_read_acpi() do not return if ACPI _SUB is missing.

A missing _SUB means that the driver cannot load a system-specific firmware, because the firmware is identified by the _SUB. But it can fallback to a generic firmware. Unfortunately this was being handled by immediately returning 0, which would skip the remaining ACPI configuration in cs35l56_hda_read_acpi() and so it would not get the RESET GPIO.

Fixes 73cfbfa9caea ("ALSA: hda/cs35l56: Add driver for Cirrus Logic CS35L56 amplifier")
---
 sound/pci/hda/cs35l56_hda.c | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)
sound/pci/hda/cs35l56_hda.c +0 -2
index 9e4976bdb5e0..a9844336bdc9 100644
@@ -864,15 +864,11 @@ static int cs35l56_hda_read_acpi(struct cs35l56_hda *cs35l56, int id)
 
 	sub = acpi_get_subsystem_id(ACPI_HANDLE(cs35l56->base.dev));
 
-	if (IS_ERR(sub)) {
-		/* If no ACPI SUB, return 0 and fallback to legacy firmware path, otherwise fail */

sound/pci/hda/cs35l56_hda.c static int cs35l56_hda_read_acpi(struct cs35l56_hda *cs35l56, int id) · line 869

Quoted 10 lines
sound/pci/hda/cs35l56_hda.c +3 -7
-		if (PTR_ERR(sub) == -ENODATA)
-			return 0;
-		else
-			return PTR_ERR(sub);
-	}
-
-	cs35l56->system_name = sub;
+	if (IS_ERR(sub))
+		dev_err_probe(cs35l56->base.dev, PTR_ERR(sub),
+			      "Read ACPI _SUB failed: fallback to generic firmware\n");

Do we want to show as an error? Since the driver continue to work, it could be rather dev_info()?

thanks,

Takashi