Linux Sound subsystem development
 help / color / mirror / Atom feed
From: Richard Fitzgerald <rf@opensource.cirrus.com>
To: broonie@kernel.org
Cc: linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org,
	patches@opensource.cirrus.com
Subject: [PATCH v2 3/6] ASoC: cs35l56: Check for vendor-specific speaker ID value
Date: Tue,  9 Sep 2025 12:30:36 +0100	[thread overview]
Message-ID: <20250909113039.922065-4-rf@opensource.cirrus.com> (raw)
In-Reply-To: <20250909113039.922065-1-rf@opensource.cirrus.com>

Call cs_amp_get_vendor_spkid() to get use a vendor-specific speaker ID
value, if one exists.

The speaker ID is used to load an appropriate set of firmware files for the
speakers, and is usually read from a GPIO. Some manufacturers are instead
using a custom UEFI variable for the speaker ID.

Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
---
 sound/soc/codecs/cs35l56-shared.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/sound/soc/codecs/cs35l56-shared.c b/sound/soc/codecs/cs35l56-shared.c
index 850fcf385996..95d018ecb953 100644
--- a/sound/soc/codecs/cs35l56-shared.c
+++ b/sound/soc/codecs/cs35l56-shared.c
@@ -1054,7 +1054,17 @@ int cs35l56_get_speaker_id(struct cs35l56_base *cs35l56_base)
 	u32 speaker_id;
 	int i, ret;
 
-	/* Attempt to read the speaker type from a device property first */
+	/* Check for vendor-specific speaker ID method */
+	ret = cs_amp_get_vendor_spkid(cs35l56_base->dev);
+	if (ret >= 0) {
+		dev_dbg(cs35l56_base->dev, "Vendor Speaker ID = %d\n", ret);
+		return ret;
+	} else if (ret != -ENOENT) {
+		dev_err(cs35l56_base->dev, "Error getting vendor Speaker ID: %d\n", ret);
+		return ret;
+	}
+
+	/* Attempt to read the speaker type from a device property */
 	ret = device_property_read_u32(cs35l56_base->dev, "cirrus,speaker-id", &speaker_id);
 	if (!ret) {
 		dev_dbg(cs35l56_base->dev, "Speaker ID = %d\n", speaker_id);
-- 
2.39.5


  parent reply	other threads:[~2025-09-09 11:30 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-09 11:30 [PATCH v2 0/6] ASoC: cs35l56: Handle vendor-specific UEFI variables Richard Fitzgerald
2025-09-09 11:30 ` [PATCH v2 1/6] ASoC: cs-amp-lib: Rename defines for Cirrus Logic EFI Richard Fitzgerald
2025-09-09 11:30 ` [PATCH v2 2/6] ASoC: cs-amp-lib: Add handling for Lenovo and HP UEFI speaker ID Richard Fitzgerald
2025-09-09 11:30 ` Richard Fitzgerald [this message]
2025-09-09 11:30 ` [PATCH v2 4/6] ASoC: cs-amp-lib-test: Add tests for cs_amp_get_vendor_spkid() Richard Fitzgerald
2025-09-09 11:30 ` [PATCH v2 5/6] ASoC: cs-amp-lib: Add HP-specific EFI variable for calibration data Richard Fitzgerald
2025-09-09 11:30 ` [PATCH v2 6/6] ASoC: cs-amp-lib-test: Add test for getting cal data from HP EFI Richard Fitzgerald

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250909113039.922065-4-rf@opensource.cirrus.com \
    --to=rf@opensource.cirrus.com \
    --cc=broonie@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=patches@opensource.cirrus.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox