diff mbox series

[13/16] drm/exynos: add callback for tearing effect handler

Message ID 20200903165717.1272492-14-m.tretter@pengutronix.de (mailing list archive)
State Not Applicable
Headers show
Series drm/exynos: Convert driver to drm bridge | expand

Commit Message

Michael Tretter Sept. 3, 2020, 4:57 p.m. UTC
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 <m.tretter@pengutronix.de>
---
 drivers/gpu/drm/exynos/exynos_drm_dsi.c | 19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/drivers/gpu/drm/exynos/exynos_drm_dsi.c b/drivers/gpu/drm/exynos/exynos_drm_dsi.c
index 287bc6e9b3ca..993402f1f7c7 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_dsi.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_dsi.c
@@ -254,6 +254,7 @@  struct exynos_dsi_driver_data {
 	unsigned int wait_for_reset;
 	unsigned int num_bits_resol;
 	const unsigned int *reg_values;
+	void (*te_handler)(struct drm_encoder *encoder);
 };
 
 struct exynos_dsi {
@@ -465,6 +466,11 @@  static const unsigned int exynos5433_reg_values[] = {
 	[PHYTIMING_HS_TRAIL] = 0x0c,
 };
 
+static void exynos_dsi_te_handler(struct drm_encoder *encoder)
+{
+	exynos_drm_crtc_te_handler(encoder->crtc);
+}
+
 static const struct exynos_dsi_driver_data exynos3_dsi_driver_data = {
 	.reg_ofs = EXYNOS_REG_OFS,
 	.plltmr_reg = 0x50,
@@ -475,6 +481,7 @@  static const struct exynos_dsi_driver_data exynos3_dsi_driver_data = {
 	.wait_for_reset = 1,
 	.num_bits_resol = 11,
 	.reg_values = reg_values,
+	.te_handler = exynos_dsi_te_handler,
 };
 
 static const struct exynos_dsi_driver_data exynos4_dsi_driver_data = {
@@ -487,6 +494,7 @@  static const struct exynos_dsi_driver_data exynos4_dsi_driver_data = {
 	.wait_for_reset = 1,
 	.num_bits_resol = 11,
 	.reg_values = reg_values,
+	.te_handler = exynos_dsi_te_handler,
 };
 
 static const struct exynos_dsi_driver_data exynos5_dsi_driver_data = {
@@ -497,6 +505,7 @@  static const struct exynos_dsi_driver_data exynos5_dsi_driver_data = {
 	.wait_for_reset = 1,
 	.num_bits_resol = 11,
 	.reg_values = reg_values,
+	.te_handler = exynos_dsi_te_handler,
 };
 
 static const struct exynos_dsi_driver_data exynos5433_dsi_driver_data = {
@@ -508,6 +517,7 @@  static const struct exynos_dsi_driver_data exynos5433_dsi_driver_data = {
 	.wait_for_reset = 0,
 	.num_bits_resol = 12,
 	.reg_values = exynos5433_reg_values,
+	.te_handler = exynos_dsi_te_handler,
 };
 
 static const struct exynos_dsi_driver_data exynos5422_dsi_driver_data = {
@@ -519,6 +529,7 @@  static const struct exynos_dsi_driver_data exynos5422_dsi_driver_data = {
 	.wait_for_reset = 1,
 	.num_bits_resol = 12,
 	.reg_values = exynos5422_reg_values,
+	.te_handler = exynos_dsi_te_handler,
 };
 
 static const struct of_device_id exynos_dsi_of_match[] = {
@@ -1305,11 +1316,13 @@  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 exynos_dsi *dsi = dev_id;
+	const struct exynos_dsi_driver_data *driver_data = dsi->driver_data;
 	struct drm_encoder *encoder = dsi->bridge.encoder;
 
-	if (dsi->state & DSIM_STATE_VIDOUT_AVAILABLE)
-		exynos_drm_crtc_te_handler(encoder->crtc);
+	if (driver_data->te_handler &&
+	    (dsi->state & DSIM_STATE_VIDOUT_AVAILABLE))
+		driver_data->te_handler(encoder);
 
 	return IRQ_HANDLED;
 }