public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/mipi-dsi: Add a mipi_dual_dsi_dcs_write_seq() macro
@ 2023-03-10 11:05 Jianhua Lu
  2023-03-10 11:54 ` Jani Nikula
  0 siblings, 1 reply; 5+ messages in thread
From: Jianhua Lu @ 2023-03-10 11:05 UTC (permalink / raw)
  To: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
	Daniel Vetter
  Cc: dri-devel, linux-kernel, ~postmarketos/upstreaming, phone-devel,
	Jianhua Lu

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@gmail.com>
---
 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


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-03-10 23:06 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-03-10 11:05 [PATCH] drm/mipi-dsi: Add a mipi_dual_dsi_dcs_write_seq() macro Jianhua Lu
2023-03-10 11:54 ` Jani Nikula
2023-03-10 12:20   ` Jianhua Lu
2023-03-10 13:52     ` Jani Nikula
2023-03-10 23:05       ` Linus Walleij

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox