adsp-loader: Add support to load adsp firmware with image name

Use rproc_set_firmware API to load ADSP dtb firmware using
image name when adsp_dbt_name is set based on
fuse variant.

Change-Id: If5c592f160585871165d5c047e1c5acc59bfe1c1
Signed-off-by: Sarath Varma Ganapathiraju <quic_ganavarm@quicinc.com>
Cette révision appartient à :
Sarath Varma Ganapathiraju
2024-03-06 14:26:27 +05:30
Parent ddbe2ef0da
révision 0de4097061

Voir le fichier

@@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2012-2014, 2017-2021, The Linux Foundation. All rights reserved.
* Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
* Copyright (c) 2022-2024, Qualcomm Innovation Center, Inc. All rights reserved.
*/
#include <linux/init.h>
@@ -348,6 +348,7 @@ static int adsp_loader_probe(struct platform_device *pdev)
size_t len;
u32 *buf;
const char **adsp_fw_name_array = NULL;
const char **adsp_dtb_fw_name_array = NULL;
int adsp_fw_cnt;
u32* adsp_fw_bit_values = NULL;
int i;
@@ -504,6 +505,20 @@ static int adsp_loader_probe(struct platform_device *pdev)
goto wqueue;
}
adsp_dtb_fw_name_array = devm_kzalloc(&pdev->dev,
adsp_fw_cnt * sizeof(char *), GFP_KERNEL);
/* Read ADSP dtb firmware image names */
ret = of_property_read_string_array(pdev->dev.of_node,
"adsp-dtb-fw-names",
adsp_dtb_fw_name_array,
adsp_fw_cnt);
if (ret < 0) {
dev_dbg(&pdev->dev, "%s: unable to read adsp-dtb-fw-names\n",
__func__);
goto wqueue;
}
for (i = 0; i < adsp_fw_cnt; i++) {
if (adsp_fw_bit_values[i] == adsp_var_idx) {
fw_name_size = strlen(adsp_fw_name_array[i]) + 1;
@@ -514,6 +529,15 @@ static int adsp_loader_probe(struct platform_device *pdev)
goto wqueue;
strlcpy(priv->adsp_fw_name, adsp_fw_name_array[i],
fw_name_size);
fw_name_size = strlen(adsp_dtb_fw_name_array[i]) + 1;
priv->adsp_dtb_name = devm_kzalloc(&pdev->dev,
fw_name_size,
GFP_KERNEL);
if (!priv->adsp_dtb_name)
goto wqueue;
strscpy(priv->adsp_dtb_name, adsp_dtb_fw_name_array[i],
fw_name_size);
break;
}
}