Skip to content

Commit 897a6b5

Browse files
mstrozekbroonie
authored andcommitted
ASoC: cs35l56: Read firmware uuid from a device property instead of _SUB
Use a device property "cirrus,firmware-uid" to get the unique firmware identifier instead of using ACPI _SUB. There aren't any products that use _SUB. There will not usually be a _SUB in Soundwire nodes. The ACPI can use a _DSD section for custom properties. There is also a need to support instantiating this driver using software nodes. This is for systems where the CS35L56 is a back-end device and the ACPI refers only to the front-end audio device - there will not be any ACPI references to CS35L56. Fixes: e496112 ("ASoC: cs35l56: Add driver for Cirrus Logic CS35L56") Signed-off-by: Maciej Strozek <mstrozek@opensource.cirrus.com> Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com> Link: https://lore.kernel.org/r/20230817112712.16637-2-rf@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent 2d218b4 commit 897a6b5

File tree

1 file changed

+12
-19
lines changed

1 file changed

+12
-19
lines changed

sound/soc/codecs/cs35l56.c

Lines changed: 12 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
// Copyright (C) 2023 Cirrus Logic, Inc. and
66
// Cirrus Logic International Semiconductor Ltd.
77

8-
#include <linux/acpi.h>
98
#include <linux/completion.h>
109
#include <linux/debugfs.h>
1110
#include <linux/delay.h>
@@ -1354,26 +1353,22 @@ static int cs35l56_dsp_init(struct cs35l56_private *cs35l56)
13541353
return 0;
13551354
}
13561355

1357-
static int cs35l56_acpi_get_name(struct cs35l56_private *cs35l56)
1356+
static int cs35l56_get_firmware_uid(struct cs35l56_private *cs35l56)
13581357
{
1359-
acpi_handle handle = ACPI_HANDLE(cs35l56->dev);
1360-
const char *sub;
1358+
struct device *dev = cs35l56->dev;
1359+
const char *prop;
1360+
int ret;
13611361

1362-
/* If there is no ACPI_HANDLE, there is no ACPI for this system, return 0 */
1363-
if (!handle)
1362+
ret = device_property_read_string(dev, "cirrus,firmware-uid", &prop);
1363+
/* If bad sw node property, return 0 and fallback to legacy firmware path */
1364+
if (ret < 0)
13641365
return 0;
13651366

1366-
sub = acpi_get_subsystem_id(handle);
1367-
if (IS_ERR(sub)) {
1368-
/* If bad ACPI, return 0 and fallback to legacy firmware path, otherwise fail */
1369-
if (PTR_ERR(sub) == -ENODATA)
1370-
return 0;
1371-
else
1372-
return PTR_ERR(sub);
1373-
}
1367+
cs35l56->dsp.system_name = devm_kstrdup(dev, prop, GFP_KERNEL);
1368+
if (cs35l56->dsp.system_name == NULL)
1369+
return -ENOMEM;
13741370

1375-
cs35l56->dsp.system_name = sub;
1376-
dev_dbg(cs35l56->dev, "Subsystem ID: %s\n", cs35l56->dsp.system_name);
1371+
dev_dbg(dev, "Firmware UID: %s\n", cs35l56->dsp.system_name);
13771372

13781373
return 0;
13791374
}
@@ -1417,7 +1412,7 @@ int cs35l56_common_probe(struct cs35l56_private *cs35l56)
14171412
gpiod_set_value_cansleep(cs35l56->reset_gpio, 1);
14181413
}
14191414

1420-
ret = cs35l56_acpi_get_name(cs35l56);
1415+
ret = cs35l56_get_firmware_uid(cs35l56);
14211416
if (ret != 0)
14221417
goto err;
14231418

@@ -1604,8 +1599,6 @@ void cs35l56_remove(struct cs35l56_private *cs35l56)
16041599

16051600
regcache_cache_only(cs35l56->regmap, true);
16061601

1607-
kfree(cs35l56->dsp.system_name);
1608-
16091602
gpiod_set_value_cansleep(cs35l56->reset_gpio, 0);
16101603
regulator_bulk_disable(ARRAY_SIZE(cs35l56->supplies), cs35l56->supplies);
16111604
}

0 commit comments

Comments
 (0)