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