|
5 | 5 | // Copyright (C) 2023 Cirrus Logic, Inc. and |
6 | 6 | // Cirrus Logic International Semiconductor Ltd. |
7 | 7 |
|
8 | | -#include <linux/acpi.h> |
9 | 8 | #include <linux/completion.h> |
10 | 9 | #include <linux/debugfs.h> |
11 | 10 | #include <linux/delay.h> |
@@ -1029,26 +1028,22 @@ static int cs35l56_dsp_init(struct cs35l56_private *cs35l56) |
1029 | 1028 | return 0; |
1030 | 1029 | } |
1031 | 1030 |
|
1032 | | -static int cs35l56_acpi_get_name(struct cs35l56_private *cs35l56) |
| 1031 | +static int cs35l56_get_firmware_uid(struct cs35l56_private *cs35l56) |
1033 | 1032 | { |
1034 | | - acpi_handle handle = ACPI_HANDLE(cs35l56->base.dev); |
1035 | | - const char *sub; |
| 1033 | + struct device *dev = cs35l56->base.dev; |
| 1034 | + const char *prop; |
| 1035 | + int ret; |
1036 | 1036 |
|
1037 | | - /* If there is no ACPI_HANDLE, there is no ACPI for this system, return 0 */ |
1038 | | - if (!handle) |
| 1037 | + ret = device_property_read_string(dev, "cirrus,firmware-uid", &prop); |
| 1038 | + /* If bad sw node property, return 0 and fallback to legacy firmware path */ |
| 1039 | + if (ret < 0) |
1039 | 1040 | return 0; |
1040 | 1041 |
|
1041 | | - sub = acpi_get_subsystem_id(handle); |
1042 | | - if (IS_ERR(sub)) { |
1043 | | - /* If bad ACPI, return 0 and fallback to legacy firmware path, otherwise fail */ |
1044 | | - if (PTR_ERR(sub) == -ENODATA) |
1045 | | - return 0; |
1046 | | - else |
1047 | | - return PTR_ERR(sub); |
1048 | | - } |
| 1042 | + cs35l56->dsp.system_name = devm_kstrdup(dev, prop, GFP_KERNEL); |
| 1043 | + if (cs35l56->dsp.system_name == NULL) |
| 1044 | + return -ENOMEM; |
1049 | 1045 |
|
1050 | | - cs35l56->dsp.system_name = sub; |
1051 | | - dev_dbg(cs35l56->base.dev, "Subsystem ID: %s\n", cs35l56->dsp.system_name); |
| 1046 | + dev_dbg(dev, "Firmware UID: %s\n", cs35l56->dsp.system_name); |
1052 | 1047 |
|
1053 | 1048 | return 0; |
1054 | 1049 | } |
@@ -1095,7 +1090,7 @@ int cs35l56_common_probe(struct cs35l56_private *cs35l56) |
1095 | 1090 | gpiod_set_value_cansleep(cs35l56->base.reset_gpio, 1); |
1096 | 1091 | } |
1097 | 1092 |
|
1098 | | - ret = cs35l56_acpi_get_name(cs35l56); |
| 1093 | + ret = cs35l56_get_firmware_uid(cs35l56); |
1099 | 1094 | if (ret != 0) |
1100 | 1095 | goto err; |
1101 | 1096 |
|
@@ -1217,8 +1212,6 @@ void cs35l56_remove(struct cs35l56_private *cs35l56) |
1217 | 1212 |
|
1218 | 1213 | regcache_cache_only(cs35l56->base.regmap, true); |
1219 | 1214 |
|
1220 | | - kfree(cs35l56->dsp.system_name); |
1221 | | - |
1222 | 1215 | gpiod_set_value_cansleep(cs35l56->base.reset_gpio, 0); |
1223 | 1216 | regulator_bulk_disable(ARRAY_SIZE(cs35l56->supplies), cs35l56->supplies); |
1224 | 1217 | } |
|
0 commit comments