Commit ad71693f authored by Rui Wang's avatar Rui Wang Committed by Mauro Carvalho Chehab

media: mtk-vpu: load vpu firmware from the new location

mt8173 VPU firmware has been moved to a sub-folder of
linux-firmware, so load vpu-fw from the new location first,
if it fails, then from the old one.
Signed-off-by: default avatarRui Wang <gtk_ruiwang@mediatek.com>
Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
parent 64d4fc99
...@@ -46,6 +46,8 @@ ...@@ -46,6 +46,8 @@
/* binary firmware name */ /* binary firmware name */
#define VPU_P_FW "vpu_p.bin" #define VPU_P_FW "vpu_p.bin"
#define VPU_D_FW "vpu_d.bin" #define VPU_D_FW "vpu_d.bin"
#define VPU_P_FW_NEW "mediatek/mt8173/vpu_p.bin"
#define VPU_D_FW_NEW "mediatek/mt8173/vpu_d.bin"
#define VPU_RESET 0x0 #define VPU_RESET 0x0
#define VPU_TCM_CFG 0x0008 #define VPU_TCM_CFG 0x0008
...@@ -477,17 +479,25 @@ static int load_requested_vpu(struct mtk_vpu *vpu, ...@@ -477,17 +479,25 @@ static int load_requested_vpu(struct mtk_vpu *vpu,
size_t tcm_size = fw_type ? VPU_DTCM_SIZE : VPU_PTCM_SIZE; size_t tcm_size = fw_type ? VPU_DTCM_SIZE : VPU_PTCM_SIZE;
size_t fw_size = fw_type ? VPU_D_FW_SIZE : VPU_P_FW_SIZE; size_t fw_size = fw_type ? VPU_D_FW_SIZE : VPU_P_FW_SIZE;
char *fw_name = fw_type ? VPU_D_FW : VPU_P_FW; char *fw_name = fw_type ? VPU_D_FW : VPU_P_FW;
char *fw_new_name = fw_type ? VPU_D_FW_NEW : VPU_P_FW_NEW;
const struct firmware *vpu_fw; const struct firmware *vpu_fw;
size_t dl_size = 0; size_t dl_size = 0;
size_t extra_fw_size = 0; size_t extra_fw_size = 0;
void *dest; void *dest;
int ret; int ret;
ret = request_firmware(&vpu_fw, fw_new_name, vpu->dev);
if (ret < 0) {
dev_info(vpu->dev, "Failed to load %s, %d, retry\n",
fw_new_name, ret);
ret = request_firmware(&vpu_fw, fw_name, vpu->dev); ret = request_firmware(&vpu_fw, fw_name, vpu->dev);
if (ret < 0) { if (ret < 0) {
dev_err(vpu->dev, "Failed to load %s, %d\n", fw_name, ret); dev_err(vpu->dev, "Failed to load %s, %d\n", fw_name,
ret);
return ret; return ret;
} }
}
dl_size = vpu_fw->size; dl_size = vpu_fw->size;
if (dl_size > fw_size) { if (dl_size > fw_size) {
dev_err(vpu->dev, "fw %s size %zu is abnormal\n", fw_name, dev_err(vpu->dev, "fw %s size %zu is abnormal\n", fw_name,
......
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