]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
ASoC: codecs: aw88261: Add firmware-name support
authorLuca Weiss <luca.weiss@fairphone.com>
Wed, 11 Feb 2026 10:27:34 +0000 (11:27 +0100)
committerMark Brown <broonie@kernel.org>
Sun, 22 Feb 2026 23:52:02 +0000 (23:52 +0000)
Since the aw88261_acf.bin file appears to be device-specific, add
firmware-name support so that devicetree users can point to a
device-specific path to not conflict with other devices that might also
ship a aw88261_acf.bin.

Read the "firmware-name" property if available, and otherwise fall back
to the generic name.

Signed-off-by: Luca Weiss <luca.weiss@fairphone.com>
Link: https://patch.msgid.link/20260211-aw88261-fwname-v1-3-e24e833a019d@fairphone.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/codecs/aw88261.c

index 43c03d3cb252f0209e87fe22c08c3a82e5f92c9e..02f8c2bb2569150d99cf3785e596f3cf53537cd1 100644 (file)
@@ -1094,17 +1094,22 @@ static int aw88261_dev_init(struct aw88261 *aw88261, struct aw_container *aw_cfg
 static int aw88261_request_firmware_file(struct aw88261 *aw88261)
 {
        const struct firmware *cont = NULL;
+       const char *fw_name;
        int ret;
 
        aw88261->aw_pa->fw_status = AW88261_DEV_FW_FAILED;
 
-       ret = request_firmware(&cont, AW88261_ACF_FILE, aw88261->aw_pa->dev);
+       ret = device_property_read_string(aw88261->aw_pa->dev, "firmware-name", &fw_name);
+       if (ret)
+               fw_name = AW88261_ACF_FILE;
+
+       ret = request_firmware(&cont, fw_name, aw88261->aw_pa->dev);
        if (ret)
                return dev_err_probe(aw88261->aw_pa->dev, ret,
-                                       "load [%s] failed!", AW88261_ACF_FILE);
+                                       "load [%s] failed!", fw_name);
 
        dev_info(aw88261->aw_pa->dev, "loaded %s - size: %zu\n",
-                       AW88261_ACF_FILE, cont ? cont->size : 0);
+                       fw_name, cont ? cont->size : 0);
 
        aw88261->aw_cfg = devm_kzalloc(aw88261->aw_pa->dev, cont->size + sizeof(int), GFP_KERNEL);
        if (!aw88261->aw_cfg) {
@@ -1117,7 +1122,7 @@ static int aw88261_request_firmware_file(struct aw88261 *aw88261)
 
        ret = aw88395_dev_load_acf_check(aw88261->aw_pa, aw88261->aw_cfg);
        if (ret) {
-               dev_err(aw88261->aw_pa->dev, "load [%s] failed !", AW88261_ACF_FILE);
+               dev_err(aw88261->aw_pa->dev, "load [%s] failed !", fw_name);
                return ret;
        }