media: venus: core: Parse firmware-name DT property
authorStanimir Varbanov <stanimir.varbanov@linaro.org>
Tue, 26 Jan 2021 08:42:52 +0000 (09:42 +0100)
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Mon, 22 Mar 2021 08:38:46 +0000 (09:38 +0100)
On production devices the firmware could be located on different
places, this path could be provided by special firmware-name DT
property.

Here we check for existence of such DT property and if it exist
take the firmware path from there. Otherwise, if the property
is missing we fallback to the predefined path from driver resource
structure.

Signed-off-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@somainline.org>
Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
drivers/media/platform/qcom/venus/firmware.c

index 89defc21ea81e3c258e63edc34a7a8ecc1c6b129..2b1d95ecd3818422f2421ccdb81f3eebbac8d188 100644 (file)
@@ -187,6 +187,7 @@ int venus_boot(struct venus_core *core)
 {
        struct device *dev = core->dev;
        const struct venus_resources *res = core->res;
+       const char *fwpath = NULL;
        phys_addr_t mem_phys;
        size_t mem_size;
        int ret;
@@ -195,7 +196,12 @@ int venus_boot(struct venus_core *core)
            (core->use_tz && !qcom_scm_is_available()))
                return -EPROBE_DEFER;
 
-       ret = venus_load_fw(core, core->res->fwname, &mem_phys, &mem_size);
+       ret = of_property_read_string_index(dev->of_node, "firmware-name", 0,
+                                           &fwpath);
+       if (ret)
+               fwpath = core->res->fwname;
+
+       ret = venus_load_fw(core, fwpath, &mem_phys, &mem_size);
        if (ret) {
                dev_err(dev, "fail to load video firmware\n");
                return -EINVAL;