All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] venus: core: Parse firmware-name DT property
@ 2021-01-26  8:42 Stanimir Varbanov
  2021-01-26 14:07 ` AngeloGioacchino Del Regno
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Stanimir Varbanov @ 2021-01-26  8:42 UTC (permalink / raw)
  To: linux-media, linux-arm-msm, linux-kernel, devicetree
  Cc: Bjorn Andersson, Hans Verkuil, AngeloGioacchino Del Regno,
	Stanimir Varbanov

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>
---
 drivers/media/platform/qcom/venus/firmware.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/media/platform/qcom/venus/firmware.c b/drivers/media/platform/qcom/venus/firmware.c
index d03e2dd5808c..56c8fb5a019b 100644
--- a/drivers/media/platform/qcom/venus/firmware.c
+++ b/drivers/media/platform/qcom/venus/firmware.c
@@ -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;
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] venus: core: Parse firmware-name DT property
  2021-01-26  8:42 [PATCH] venus: core: Parse firmware-name DT property Stanimir Varbanov
@ 2021-01-26 14:07 ` AngeloGioacchino Del Regno
  2021-01-26 17:55 ` Bjorn Andersson
  2021-05-26 19:03 ` patchwork-bot+linux-arm-msm
  2 siblings, 0 replies; 4+ messages in thread
From: AngeloGioacchino Del Regno @ 2021-01-26 14:07 UTC (permalink / raw)
  To: Stanimir Varbanov, linux-media, linux-arm-msm, linux-kernel, devicetree
  Cc: Bjorn Andersson, Hans Verkuil

Il 26/01/21 09:42, Stanimir Varbanov ha scritto:
> 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>
> ---
>   drivers/media/platform/qcom/venus/firmware.c | 8 +++++++-
>   1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/media/platform/qcom/venus/firmware.c b/drivers/media/platform/qcom/venus/firmware.c
> index d03e2dd5808c..56c8fb5a019b 100644
> --- a/drivers/media/platform/qcom/venus/firmware.c
> +++ b/drivers/media/platform/qcom/venus/firmware.c
> @@ -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;
> 

Super! As you surely know, I totally agree.

It may not have huge value, but:
Reviewed-By: AngeloGioacchino Del Regno 
<angelogioacchino.delregno@somainline.org>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] venus: core: Parse firmware-name DT property
  2021-01-26  8:42 [PATCH] venus: core: Parse firmware-name DT property Stanimir Varbanov
  2021-01-26 14:07 ` AngeloGioacchino Del Regno
@ 2021-01-26 17:55 ` Bjorn Andersson
  2021-05-26 19:03 ` patchwork-bot+linux-arm-msm
  2 siblings, 0 replies; 4+ messages in thread
From: Bjorn Andersson @ 2021-01-26 17:55 UTC (permalink / raw)
  To: Stanimir Varbanov
  Cc: linux-media, linux-arm-msm, linux-kernel, devicetree,
	Hans Verkuil, AngeloGioacchino Del Regno

On Tue 26 Jan 02:42 CST 2021, Stanimir Varbanov wrote:

> 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.
> 

Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>

But firmware-name is not mentioned in the dt binding.

Regards,
Bjorn

> Signed-off-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>
> ---
>  drivers/media/platform/qcom/venus/firmware.c | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/media/platform/qcom/venus/firmware.c b/drivers/media/platform/qcom/venus/firmware.c
> index d03e2dd5808c..56c8fb5a019b 100644
> --- a/drivers/media/platform/qcom/venus/firmware.c
> +++ b/drivers/media/platform/qcom/venus/firmware.c
> @@ -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;
> -- 
> 2.25.1
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] venus: core: Parse firmware-name DT property
  2021-01-26  8:42 [PATCH] venus: core: Parse firmware-name DT property Stanimir Varbanov
  2021-01-26 14:07 ` AngeloGioacchino Del Regno
  2021-01-26 17:55 ` Bjorn Andersson
@ 2021-05-26 19:03 ` patchwork-bot+linux-arm-msm
  2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+linux-arm-msm @ 2021-05-26 19:03 UTC (permalink / raw)
  To: Stanimir Varbanov; +Cc: linux-arm-msm

Hello:

This patch was applied to qcom/linux.git (refs/heads/for-next):

On Tue, 26 Jan 2021 10:42:52 +0200 you wrote:
> 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.
> 
> [...]

Here is the summary with links:
  - venus: core: Parse firmware-name DT property
    https://git.kernel.org/qcom/c/18a6262b05f7

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-05-26 19:03 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-26  8:42 [PATCH] venus: core: Parse firmware-name DT property Stanimir Varbanov
2021-01-26 14:07 ` AngeloGioacchino Del Regno
2021-01-26 17:55 ` Bjorn Andersson
2021-05-26 19:03 ` patchwork-bot+linux-arm-msm

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.