summaryrefslogtreecommitdiff
path: root/sound/soc/codecs/cs35l56-shared.c
diff options
context:
space:
mode:
authorSimon Trimmer <simont@opensource.cirrus.com>2024-06-11 16:25:56 +0300
committerMark Brown <broonie@kernel.org>2024-06-11 19:13:59 +0300
commitc38082bf223fb4a3f2bdf1f79650af53d3499dea (patch)
tree712507ca9b008218355b5e07a41437b2c84cc22d /sound/soc/codecs/cs35l56-shared.c
parentb745dcf727f959c5fb08fa3ee08dc48c952b8553 (diff)
downloadlinux-c38082bf223fb4a3f2bdf1f79650af53d3499dea.tar.xz
ASoC: cs35l56: Attempt to read from cirrus,speaker-id device property first
When cs35l56 is connected via cs42l43 there isn't an ACPI node for the cs35l56 so all properties are under the cs42l43 ACPI node. We're adding a property as a way for the cs42l43 driver to pass this info in via a software node. Signed-off-by: Simon Trimmer <simont@opensource.cirrus.com> Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com> Link: https://lore.kernel.org/r/20240611132556.1557075-3-ckeepax@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/codecs/cs35l56-shared.c')
-rw-r--r--sound/soc/codecs/cs35l56-shared.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/sound/soc/codecs/cs35l56-shared.c b/sound/soc/codecs/cs35l56-shared.c
index 8af89a263594..e89027cd40d1 100644
--- a/sound/soc/codecs/cs35l56-shared.c
+++ b/sound/soc/codecs/cs35l56-shared.c
@@ -853,9 +853,16 @@ EXPORT_SYMBOL_NS_GPL(cs35l56_hw_init, SND_SOC_CS35L56_SHARED);
int cs35l56_get_speaker_id(struct cs35l56_base *cs35l56_base)
{
struct gpio_descs *descs;
- int speaker_id;
+ u32 speaker_id;
int i, ret;
+ /* Attempt to read the speaker type from a device property first */
+ 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);
+ return speaker_id;
+ }
+
/* Read the speaker type qualifier from the motherboard GPIOs */
descs = gpiod_get_array_optional(cs35l56_base->dev, "spk-id", GPIOD_IN);
if (!descs) {