Commit ab0b5072 authored by Mark Brown's avatar Mark Brown

ASoC: cs35l56: Update ACPI HID and property

Merge series from Richard Fitzgerald <rf@opensource.cirrus.com>:

These two patches add an ACPI HID and update the way the platform-
specific firmware identifier is extracted from the ACPI.
parents 3d521f9f e8500a70
...@@ -62,10 +62,19 @@ static const struct i2c_device_id cs35l56_id_i2c[] = { ...@@ -62,10 +62,19 @@ static const struct i2c_device_id cs35l56_id_i2c[] = {
}; };
MODULE_DEVICE_TABLE(i2c, cs35l56_id_i2c); MODULE_DEVICE_TABLE(i2c, cs35l56_id_i2c);
#ifdef CONFIG_ACPI
static const struct acpi_device_id cs35l56_asoc_acpi_match[] = {
{ "CSC355C", 0 },
{},
};
MODULE_DEVICE_TABLE(acpi, cs35l56_asoc_acpi_match);
#endif
static struct i2c_driver cs35l56_i2c_driver = { static struct i2c_driver cs35l56_i2c_driver = {
.driver = { .driver = {
.name = "cs35l56", .name = "cs35l56",
.pm = &cs35l56_pm_ops_i2c_spi, .pm = &cs35l56_pm_ops_i2c_spi,
.acpi_match_table = ACPI_PTR(cs35l56_asoc_acpi_match),
}, },
.id_table = cs35l56_id_i2c, .id_table = cs35l56_id_i2c,
.probe = cs35l56_i2c_probe, .probe = cs35l56_i2c_probe,
......
...@@ -59,10 +59,19 @@ static const struct spi_device_id cs35l56_id_spi[] = { ...@@ -59,10 +59,19 @@ static const struct spi_device_id cs35l56_id_spi[] = {
}; };
MODULE_DEVICE_TABLE(spi, cs35l56_id_spi); MODULE_DEVICE_TABLE(spi, cs35l56_id_spi);
#ifdef CONFIG_ACPI
static const struct acpi_device_id cs35l56_asoc_acpi_match[] = {
{ "CSC355C", 0 },
{},
};
MODULE_DEVICE_TABLE(acpi, cs35l56_asoc_acpi_match);
#endif
static struct spi_driver cs35l56_spi_driver = { static struct spi_driver cs35l56_spi_driver = {
.driver = { .driver = {
.name = "cs35l56", .name = "cs35l56",
.pm = &cs35l56_pm_ops_i2c_spi, .pm = &cs35l56_pm_ops_i2c_spi,
.acpi_match_table = ACPI_PTR(cs35l56_asoc_acpi_match),
}, },
.id_table = cs35l56_id_spi, .id_table = cs35l56_id_spi,
.probe = cs35l56_spi_probe, .probe = cs35l56_spi_probe,
......
...@@ -5,7 +5,6 @@ ...@@ -5,7 +5,6 @@
// Copyright (C) 2023 Cirrus Logic, Inc. and // Copyright (C) 2023 Cirrus Logic, Inc. and
// Cirrus Logic International Semiconductor Ltd. // Cirrus Logic International Semiconductor Ltd.
#include <linux/acpi.h>
#include <linux/completion.h> #include <linux/completion.h>
#include <linux/debugfs.h> #include <linux/debugfs.h>
#include <linux/delay.h> #include <linux/delay.h>
...@@ -1354,26 +1353,22 @@ static int cs35l56_dsp_init(struct cs35l56_private *cs35l56) ...@@ -1354,26 +1353,22 @@ static int cs35l56_dsp_init(struct cs35l56_private *cs35l56)
return 0; return 0;
} }
static int cs35l56_acpi_get_name(struct cs35l56_private *cs35l56) static int cs35l56_get_firmware_uid(struct cs35l56_private *cs35l56)
{ {
acpi_handle handle = ACPI_HANDLE(cs35l56->dev); struct device *dev = cs35l56->dev;
const char *sub; const char *prop;
int ret;
/* If there is no ACPI_HANDLE, there is no ACPI for this system, return 0 */ ret = device_property_read_string(dev, "cirrus,firmware-uid", &prop);
if (!handle) /* If bad sw node property, return 0 and fallback to legacy firmware path */
if (ret < 0)
return 0; return 0;
sub = acpi_get_subsystem_id(handle); cs35l56->dsp.system_name = devm_kstrdup(dev, prop, GFP_KERNEL);
if (IS_ERR(sub)) { if (cs35l56->dsp.system_name == NULL)
/* If bad ACPI, return 0 and fallback to legacy firmware path, otherwise fail */ return -ENOMEM;
if (PTR_ERR(sub) == -ENODATA)
return 0;
else
return PTR_ERR(sub);
}
cs35l56->dsp.system_name = sub; dev_dbg(dev, "Firmware UID: %s\n", cs35l56->dsp.system_name);
dev_dbg(cs35l56->dev, "Subsystem ID: %s\n", cs35l56->dsp.system_name);
return 0; return 0;
} }
...@@ -1417,7 +1412,7 @@ int cs35l56_common_probe(struct cs35l56_private *cs35l56) ...@@ -1417,7 +1412,7 @@ int cs35l56_common_probe(struct cs35l56_private *cs35l56)
gpiod_set_value_cansleep(cs35l56->reset_gpio, 1); gpiod_set_value_cansleep(cs35l56->reset_gpio, 1);
} }
ret = cs35l56_acpi_get_name(cs35l56); ret = cs35l56_get_firmware_uid(cs35l56);
if (ret != 0) if (ret != 0)
goto err; goto err;
...@@ -1604,8 +1599,6 @@ void cs35l56_remove(struct cs35l56_private *cs35l56) ...@@ -1604,8 +1599,6 @@ void cs35l56_remove(struct cs35l56_private *cs35l56)
regcache_cache_only(cs35l56->regmap, true); regcache_cache_only(cs35l56->regmap, true);
kfree(cs35l56->dsp.system_name);
gpiod_set_value_cansleep(cs35l56->reset_gpio, 0); gpiod_set_value_cansleep(cs35l56->reset_gpio, 0);
regulator_bulk_disable(ARRAY_SIZE(cs35l56->supplies), cs35l56->supplies); regulator_bulk_disable(ARRAY_SIZE(cs35l56->supplies), cs35l56->supplies);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment