media: imx-mipi-csis: Drop extra clock enable at probe()
authorTomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Wed, 22 Nov 2023 15:21:35 +0000 (16:21 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 25 Jan 2024 23:35:35 +0000 (15:35 -0800)
[ Upstream commit fb387fcb5cdd0384ba04a5d15a3605e2dccdab2a ]

The driver always enables the clocks at probe() and disables them only
at remove(). It is not clear why the driver does this, as it supports
runtime PM, and enables and disables the clocks in the runtime resume
and suspend callbacks. Also, in the case runtime PM is not available,
the driver calls the resume and suspend callbacks manually from probe()
and remove().

Drop the unnecessary clock enable, thus enabling the clocks only when
actually needed.

Link: https://lore.kernel.org/r/20231122-imx-csis-v2-2-e44b8dc4cb66@ideasonboard.com
Fixes: 7807063b862b ("media: staging/imx7: add MIPI CSI-2 receiver subdev for i.MX7")
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/media/platform/nxp/imx-mipi-csis.c

index e7629c9..142ac7b 100644 (file)
@@ -1437,24 +1437,18 @@ static int mipi_csis_probe(struct platform_device *pdev)
        /* Reset PHY and enable the clocks. */
        mipi_csis_phy_reset(csis);
 
-       ret = mipi_csis_clk_enable(csis);
-       if (ret < 0) {
-               dev_err(csis->dev, "failed to enable clocks: %d\n", ret);
-               return ret;
-       }
-
        /* Now that the hardware is initialized, request the interrupt. */
        ret = devm_request_irq(dev, irq, mipi_csis_irq_handler, 0,
                               dev_name(dev), csis);
        if (ret) {
                dev_err(dev, "Interrupt request failed\n");
-               goto err_disable_clock;
+               return ret;
        }
 
        /* Initialize and register the subdev. */
        ret = mipi_csis_subdev_init(csis);
        if (ret < 0)
-               goto err_disable_clock;
+               return ret;
 
        platform_set_drvdata(pdev, &csis->sd);
 
@@ -1488,8 +1482,6 @@ err_cleanup:
        v4l2_async_nf_unregister(&csis->notifier);
        v4l2_async_nf_cleanup(&csis->notifier);
        v4l2_async_unregister_subdev(&csis->sd);
-err_disable_clock:
-       mipi_csis_clk_disable(csis);
 
        return ret;
 }
@@ -1508,7 +1500,6 @@ static void mipi_csis_remove(struct platform_device *pdev)
                mipi_csis_runtime_suspend(&pdev->dev);
 
        pm_runtime_disable(&pdev->dev);
-       mipi_csis_clk_disable(csis);
        v4l2_subdev_cleanup(&csis->sd);
        media_entity_cleanup(&csis->sd.entity);
        pm_runtime_set_suspended(&pdev->dev);