summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulien Stephan <[email protected]>2026-08-06 11:27:07 +0200
committerDavid Lechner <[email protected]>2026-09-01 14:28:15 -0500
commit528be4beaeeb5ee5232ab7f97733ccb6049781aa (patch)
treea0312516e81abcb2dd17a83c37fb6621baa265f6
parent4a4bcb0ada8d43390e2819e62f4baee723631f5d (diff)
mipi_dsi: add mipi_dsi_{generic/dcs}_write_seq helper macros
Add wrapper mipi_dsi_generic_write_seq and mipi_dsi_dcs_write_seq helper macros around mipi_dsi_generic_write and mipi_dsi_dcs_write_buffer to mimic macros defined in the Kernel. This helps porting drivers from the Kernel and avoids the manual declaration of static arrays in drivers. Some drivers (hitachi-tx10d07vm0baa.c, lg-lh400wv3-sd04.c, mot-panel.c, renesas-r69328.c and himax-hx8394.c) already define such a macro, so this will avoid duplication. Signed-off-by: Julien Stephan <[email protected]> Link: https://patch.msgid.link/20260806-add_mipi_dsi_write_seq_helper_macros-v1-1-6b533788d0ac@baylibre.com Signed-off-by: David Lechner <[email protected]>
-rw-r--r--include/mipi_dsi.h35
1 files changed, 35 insertions, 0 deletions
diff --git a/include/mipi_dsi.h b/include/mipi_dsi.h
index 4ca05f71e29..69ee8d49812 100644
--- a/include/mipi_dsi.h
+++ b/include/mipi_dsi.h
@@ -267,6 +267,24 @@ int mipi_dsi_set_maximum_return_packet_size(struct mipi_dsi_device *dsi,
ssize_t mipi_dsi_generic_write(struct mipi_dsi_device *dsi, const void *payload,
size_t size);
+
+/**
+ * mipi_dsi_generic_write_seq - transmit data using a generic write packet
+ * @dsi: DSI peripheral device
+ * @cmd: Command
+ * @seq: buffer containing the payload
+ *
+ * This macro returns from the calling function with a negative error code on
+ * failure.
+ */
+#define mipi_dsi_generic_write_seq(dsi, cmd, seq...) do { \
+ static const u8 b[] = { cmd, seq }; \
+ int ret; \
+ ret = mipi_dsi_generic_write(dsi, b, ARRAY_SIZE(b)); \
+ if (ret < 0) \
+ return ret; \
+ } while (0)
+
ssize_t mipi_dsi_generic_read(struct mipi_dsi_device *dsi, const void *params,
size_t num_params, void *data, size_t size);
@@ -304,6 +322,23 @@ ssize_t mipi_dsi_dcs_write_buffer(struct mipi_dsi_device *dsi,
const void *data, size_t len);
/**
+ * mipi_dsi_dcs_write_seq - transmit a DCS command with payload
+ * @dsi: DSI peripheral device
+ * @cmd: DCS command
+ * @seq: buffer containing the payload
+ *
+ * This macro returns from the calling function with a negative error code on
+ * failure.
+ */
+#define mipi_dsi_dcs_write_seq(dsi, cmd, seq...) do { \
+ static const u8 b[] = { cmd, seq }; \
+ int ret; \
+ ret = mipi_dsi_dcs_write_buffer(dsi, b, ARRAY_SIZE(b)); \
+ if (ret < 0) \
+ return ret; \
+ } while (0)
+
+/**
* mipi_dsi_dcs_write() - send DCS write command
* @dsi: DSI peripheral device
* @cmd: DCS command