Skip to content

Commit ab0b507

Browse files
committed
ASoC: cs35l56: Update ACPI HID and property
Merge series from Richard Fitzgerald <[email protected]>: These two patches add an ACPI HID and update the way the platform- specific firmware identifier is extracted from the ACPI.
2 parents 3d521f9 + e8500a7 commit ab0b507

File tree

3 files changed

+30
-19
lines changed

3 files changed

+30
-19
lines changed

sound/soc/codecs/cs35l56-i2c.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,19 @@ static const struct i2c_device_id cs35l56_id_i2c[] = {
6262
};
6363
MODULE_DEVICE_TABLE(i2c, cs35l56_id_i2c);
6464

65+
#ifdef CONFIG_ACPI
66+
static const struct acpi_device_id cs35l56_asoc_acpi_match[] = {
67+
{ "CSC355C", 0 },
68+
{},
69+
};
70+
MODULE_DEVICE_TABLE(acpi, cs35l56_asoc_acpi_match);
71+
#endif
72+
6573
static struct i2c_driver cs35l56_i2c_driver = {
6674
.driver = {
6775
.name = "cs35l56",
6876
.pm = &cs35l56_pm_ops_i2c_spi,
77+
.acpi_match_table = ACPI_PTR(cs35l56_asoc_acpi_match),
6978
},
7079
.id_table = cs35l56_id_i2c,
7180
.probe = cs35l56_i2c_probe,

sound/soc/codecs/cs35l56-spi.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,19 @@ static const struct spi_device_id cs35l56_id_spi[] = {
5959
};
6060
MODULE_DEVICE_TABLE(spi, cs35l56_id_spi);
6161

62+
#ifdef CONFIG_ACPI
63+
static const struct acpi_device_id cs35l56_asoc_acpi_match[] = {
64+
{ "CSC355C", 0 },
65+
{},
66+
};
67+
MODULE_DEVICE_TABLE(acpi, cs35l56_asoc_acpi_match);
68+
#endif
69+
6270
static struct spi_driver cs35l56_spi_driver = {
6371
.driver = {
6472
.name = "cs35l56",
6573
.pm = &cs35l56_pm_ops_i2c_spi,
74+
.acpi_match_table = ACPI_PTR(cs35l56_asoc_acpi_match),
6675
},
6776
.id_table = cs35l56_id_spi,
6877
.probe = cs35l56_spi_probe,

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)