summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMaxime Ripard <maxime@cerno.tech>2022-07-11 19:38:58 +0200
committerMaxime Ripard <maxime@cerno.tech>2022-07-13 10:46:08 +0200
commit77932adf2a2c9625da8bc8885b626690ee500601 (patch)
tree4e08327b7b32feabb4c6e93686f90baa947afd44
parent5801eda938f5f98cbdb6bc83e2c35499735f006a (diff)
downloadlinux-77932adf2a2c9625da8bc8885b626690ee500601.tar.bz2
drm/vc4: dpi: Add action to disable the clock
The DPI controller has two clocks called core and pixel, the core clock being enabled at bind time. Adding a device-managed action will make the error path easier, so let's create one to disable it. Acked-by: Thomas Zimmermann <tzimmermann@suse.de> Reviewed-by: Dave Stevenson <dave.stevenson@raspberrypi.com> Signed-off-by: Maxime Ripard <maxime@cerno.tech> Link: https://lore.kernel.org/r/20220711173939.1132294-29-maxime@cerno.tech
-rw-r--r--drivers/gpu/drm/vc4/vc4_dpi.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/drivers/gpu/drm/vc4/vc4_dpi.c b/drivers/gpu/drm/vc4/vc4_dpi.c
index f18b05cee8bc..c4ea99f85e5b 100644
--- a/drivers/gpu/drm/vc4/vc4_dpi.c
+++ b/drivers/gpu/drm/vc4/vc4_dpi.c
@@ -257,6 +257,13 @@ static int vc4_dpi_init_bridge(struct vc4_dpi *dpi)
return drm_bridge_attach(&dpi->encoder.base, bridge, NULL, 0);
}
+static void vc4_dpi_disable_clock(void *ptr)
+{
+ struct vc4_dpi *dpi = ptr;
+
+ clk_disable_unprepare(dpi->core_clock);
+}
+
static int vc4_dpi_bind(struct device *dev, struct device *master, void *data)
{
struct platform_device *pdev = to_platform_device(dev);
@@ -305,6 +312,10 @@ static int vc4_dpi_bind(struct device *dev, struct device *master, void *data)
return ret;
}
+ ret = devm_add_action_or_reset(dev, vc4_dpi_disable_clock, dpi);
+ if (ret)
+ return ret;
+
drm_simple_encoder_init(drm, &dpi->encoder.base, DRM_MODE_ENCODER_DPI);
drm_encoder_helper_add(&dpi->encoder.base, &vc4_dpi_encoder_helper_funcs);
@@ -320,7 +331,6 @@ static int vc4_dpi_bind(struct device *dev, struct device *master, void *data)
err_destroy_encoder:
drm_encoder_cleanup(&dpi->encoder.base);
- clk_disable_unprepare(dpi->core_clock);
return ret;
}
@@ -330,8 +340,6 @@ static void vc4_dpi_unbind(struct device *dev, struct device *master,
struct vc4_dpi *dpi = dev_get_drvdata(dev);
drm_encoder_cleanup(&dpi->encoder.base);
-
- clk_disable_unprepare(dpi->core_clock);
}
static const struct component_ops vc4_dpi_ops = {