[PATCH] drm/mipi-dsi: Add a mipi_dual_dsi_dcs_write_seq() macro

From: Jianhua Lu
Date: Fri Mar 10 2023 - 06:05:57 EST


The panels with two dsi connected (sync dual dsi mode) need to transmit
dcs command to the two dsi host simultaneously, let's add
mipi_dual_dsi_dcs_write_seq() macro for this kind of panels.

Signed-off-by: Jianhua Lu <lujianhua000@xxxxxxxxx>
---
include/drm/drm_mipi_dsi.h | 15 +++++++++++++++
1 file changed, 15 insertions(+)

diff --git a/include/drm/drm_mipi_dsi.h b/include/drm/drm_mipi_dsi.h
index c9df0407980c..d0f0f75d4d83 100644
--- a/include/drm/drm_mipi_dsi.h
+++ b/include/drm/drm_mipi_dsi.h
@@ -336,6 +336,21 @@ int mipi_dsi_dcs_get_display_brightness_large(struct mipi_dsi_device *dsi,
} \
} while (0)

+/**
+ * mipi_dsi_dcs_write_seq - transmit a DCS command with payload
+ * @dsi: array of 2 DSI peripheral devices
+ * @cmd: Command
+ * @seq: buffer containing data to be transmitted
+ */
+#define mipi_dual_dsi_dcs_write_seq(dsi, cmd, seq...) \
+ do { \
+ if (ARRAY_SIZE(dsi) > 2) \
+ return -EINVAL; \
+ int i; \
+ for (i = 0; i < ARRAY_SIZE(dsi); i++) \
+ mipi_dsi_dcs_write_seq(dsi[i], cmd, seq); \
+ } while (0)
+
/**
* struct mipi_dsi_driver - DSI driver
* @driver: device driver model driver
--
2.39.2