From f2c47234fbe0eeaeeeca4d0b4361f36b4666ceb5 Mon Sep 17 00:00:00 2001 From: Michael Tretter Date: Fri, 11 Sep 2020 15:54:06 +0200 Subject: drm/exynos: add callback for tearing effect handler The tearing effect interrupts are not handled by the MIPI DSI bridge driver, but the display controller driver. Allow platforms to register a callback for the tearing effect interrupt. Signed-off-by: Michael Tretter --- drivers/gpu/drm/exynos/exynos_drm_dsi.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_drm_dsi.c b/drivers/gpu/drm/exynos/exynos_drm_dsi.c index 3b2a3111c63f..3f5cabe07e09 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_dsi.c +++ b/drivers/gpu/drm/exynos/exynos_drm_dsi.c @@ -243,6 +243,7 @@ struct exynos_dsi; struct exynos_dsi_host_ops { int (*attach)(struct device *dev, struct mipi_dsi_device *device); int (*detach)(struct device *dev, struct mipi_dsi_device *device); + void (*te_handler)(struct device *dev); }; enum exynos_reg_offset { @@ -504,9 +505,17 @@ static int __exynos_dsi_host_detach(struct device *dev, return 0; } +static void __exynos_dsi_te_handler(struct device *dev) +{ + struct exynos_dsi *dsi = dev_get_drvdata(dev); + + exynos_drm_crtc_te_handler(dsi->encoder.crtc); +} + static const struct exynos_dsi_host_ops exynos_dsi_host_ops = { .attach = __exynos_dsi_host_attach, .detach = __exynos_dsi_host_detach, + .te_handler = __exynos_dsi_te_handler, }; static const struct exynos_dsi_driver_data exynos3_dsi_driver_data = { @@ -1354,11 +1363,12 @@ static irqreturn_t exynos_dsi_irq(int irq, void *dev_id) static irqreturn_t exynos_dsi_te_irq_handler(int irq, void *dev_id) { - struct exynos_dsi *dsi = (struct exynos_dsi *)dev_id; - struct drm_encoder *encoder = &dsi->encoder; + struct exynos_dsi *dsi = dev_id; + const struct exynos_dsi_host_ops *ops = dsi->driver_data->host_ops; - if (dsi->state & DSIM_STATE_VIDOUT_AVAILABLE) - exynos_drm_crtc_te_handler(encoder->crtc); + if (ops && ops->te_handler && + (dsi->state & DSIM_STATE_VIDOUT_AVAILABLE)) + ops->te_handler(dsi->dsi_host.dev); return IRQ_HANDLED; } -- cgit v1.2.3