Commit fb387fcb authored by Tomi Valkeinen's avatar Tomi Valkeinen Committed by Mauro Carvalho Chehab
Browse files

media: imx-mipi-csis: Drop extra clock enable at probe()

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: 7807063b ("media: staging/imx7: add MIPI CSI-2 receiver subdev for i.MX7")
Signed-off-by: default avatarTomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Signed-off-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@kernel.org>
parent 5705b0e0
Loading
Loading
Loading
Loading
+2 −11
Original line number Diff line number Diff line
@@ -1439,24 +1439,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);

@@ -1490,8 +1484,6 @@ static int mipi_csis_probe(struct platform_device *pdev)
	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;
}
@@ -1510,7 +1502,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);