|
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>
|
@@ -1354,26 +1353,22 @@ static int cs35l56_dsp_init(struct cs35l56_private *cs35l56)
|
1354 | 1353 | return 0;
|
1355 | 1354 | }
|
1356 | 1355 |
|
1357 |
| -static int cs35l56_acpi_get_name(struct cs35l56_private *cs35l56) |
| 1356 | +static int cs35l56_get_firmware_uid(struct cs35l56_private *cs35l56) |
1358 | 1357 | {
|
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; |
1361 | 1361 |
|
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) |
1364 | 1365 | return 0;
|
1365 | 1366 |
|
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; |
1374 | 1370 |
|
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); |
1377 | 1372 |
|
1378 | 1373 | return 0;
|
1379 | 1374 | }
|
@@ -1417,7 +1412,7 @@ int cs35l56_common_probe(struct cs35l56_private *cs35l56)
|
1417 | 1412 | gpiod_set_value_cansleep(cs35l56->reset_gpio, 1);
|
1418 | 1413 | }
|
1419 | 1414 |
|
1420 |
| - ret = cs35l56_acpi_get_name(cs35l56); |
| 1415 | + ret = cs35l56_get_firmware_uid(cs35l56); |
1421 | 1416 | if (ret != 0)
|
1422 | 1417 | goto err;
|
1423 | 1418 |
|
@@ -1604,8 +1599,6 @@ void cs35l56_remove(struct cs35l56_private *cs35l56)
|
1604 | 1599 |
|
1605 | 1600 | regcache_cache_only(cs35l56->regmap, true);
|
1606 | 1601 |
|
1607 |
| - kfree(cs35l56->dsp.system_name); |
1608 |
| - |
1609 | 1602 | gpiod_set_value_cansleep(cs35l56->reset_gpio, 0);
|
1610 | 1603 | regulator_bulk_disable(ARRAY_SIZE(cs35l56->supplies), cs35l56->supplies);
|
1611 | 1604 | }
|
|
0 commit comments