Re: [PATCH v8 2/4] media: imagination: e5010: Fix clk never enabled without CONFIG_PM
From: Thakkar, Devarsh
Date: Wed Nov 11 2026 - 05:36:38 EST
Hi,
On 11/10/2026 10:02 PM, Brnich, Brandon wrote:
> clk_prepare_enable is not called anywhere unless CONFIG_PM is set. This
> means without CONFIG_PM, the JPEG Encoder will not function properly.
>
> Add this call during the probe sequence to properly configure the device.
> If video_registration fails after clk is enabled, clk would be left on.
> Make a label to cover this case.
>
> Update e5010_remove to ensure that clock is getting disabled in the case
> where e5010 was not suspended when remove gets called.
>
> Fixes: a1e294045885 ("media: imagination: Add E5010 JPEG Encoder driver")
> Cc: stable@xxxxxxxxxxxxxxx
> Signed-off-by: Brandon Brnich <b-brnich@xxxxxx>
> ---
> .../platform/imagination/e5010-jpeg-enc.c | 20 +++++++++++++++++--
> 1 file changed, 18 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/media/platform/imagination/e5010-jpeg-enc.c b/drivers/media/platform/imagination/e5010-jpeg-enc.c
> index 23d06709a6929..17ea616ff1795 100644
> --- a/drivers/media/platform/imagination/e5010-jpeg-enc.c
> +++ b/drivers/media/platform/imagination/e5010-jpeg-enc.c
> @@ -1101,10 +1101,18 @@ static int e5010_probe(struct platform_device *pdev)
>
> pm_runtime_enable(dev);
>
> + if (!pm_runtime_enabled(dev)) {
> + ret = clk_prepare_enable(e5010->clk);
> + if (ret) {
> + dev_err_probe(dev, ret, "failed to enable clock\n");
> + goto fail_after_v4l2_m2m_init;
> + }
> + }
> +
> ret = video_register_device(e5010->vdev, VFL_TYPE_VIDEO, 0);
> if (ret) {
> dev_err_probe(dev, ret, "failed to register video device\n");
> - goto fail_after_v4l2_m2m_init;
> + goto fail_after_clock_enable;
> }
>
> v4l2_info(&e5010->v4l2_dev, "Device registered as /dev/video%d\n",
> @@ -1112,6 +1120,11 @@ static int e5010_probe(struct platform_device *pdev)
>
> return 0;
>
> +fail_after_clock_enable:
> + if (pm_runtime_enabled(dev))
> + pm_runtime_disable(dev);
> + else
> + clk_disable_unprepare(e5010->clk);
> fail_after_v4l2_m2m_init:
> v4l2_m2m_release(e5010->m2m_dev);
> fail_after_v4l2_register:
> @@ -1125,10 +1138,13 @@ static void e5010_remove(struct platform_device *pdev)
> {
> struct e5010_dev *e5010 = platform_get_drvdata(pdev);
>
> - pm_runtime_disable(e5010->dev);
> video_unregister_device(e5010->vdev);
> v4l2_m2m_release(e5010->m2m_dev);
> v4l2_device_unregister(&e5010->v4l2_dev);
> + pm_runtime_disable(e5010->dev);
> + if (!pm_runtime_status_suspended(&pdev->dev))
> + clk_disable_unprepare(e5010->clk);
> +
nit: Extra Line added.
With above fixed,
Reviewed-by: Devarsh Thakkar <devarsht@xxxxxx>
Regards
Devarsh
> }
>
> static void e5010_vb2_buffers_return(struct vb2_queue *q, enum vb2_buffer_state state)