[PATCH 4/6] video: panel: mot-panel: use common mipi_dsi_dcs_write_seq macro

Julien Stephan <[email protected]>
Newsgroups org.u-boot-project.lists.u-boot
Message-ID <20260806-add_mipi_dsi_write_seq_helper_macros-v1-4-6b533788d0ac@baylibre.com>
The current driver defines dsi_generic_write_seq as a wrapper around
mipi_dsi_dcs_write_buffer.

Now that mipi_dsi.h defines such macro, we can use the common one.
Note that we use mipi_dsi_dcs_write_seq instead of
mipi_dsi_generic_write_seq to keep the same behaviour.

No functional changes intended.

Signed-off-by: Julien Stephan <[email protected]>
---
 drivers/video/mot-panel.c | 140 ++++++++++++++++++++++------------------------
 1 file changed, 66 insertions(+), 74 deletions(-)

diff --git a/drivers/video/mot-panel.c b/drivers/video/mot-panel.c
index a9114957867..ee131133e1f 100644
--- a/drivers/video/mot-panel.c
+++ b/drivers/video/mot-panel.c
@@ -27,14 +27,6 @@ struct mot_panel_priv {
 	struct gpio_desc reset_gpio;
 };
 
-#define dsi_generic_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)
-
 static struct display_timing default_timing = {
 	.pixelclock.typ		= 38250000,
 	.hactive.typ		= 540,
@@ -51,7 +43,7 @@ static int mot_es2(struct mipi_dsi_device *dsi)
 {
 	int ret;
 
-	dsi_generic_write_seq(dsi, 0x55, 0x01);
+	mipi_dsi_dcs_write_seq(dsi, 0x55, 0x01);
 
 	ret = mipi_dsi_dcs_exit_sleep_mode(dsi);
 	if (ret < 0) {
@@ -60,45 +52,45 @@ static int mot_es2(struct mipi_dsi_device *dsi)
 	}
 	mdelay(120);
 
-	dsi_generic_write_seq(dsi, 0xf4, 0x00, 0xbb, 0x46, 0x53, 0x0c, 0x49,
-			      0x74, 0x29, 0x12, 0x15, 0x2f, 0x2f, 0x04);
-	dsi_generic_write_seq(dsi, 0xf8, 0x4b, 0x04, 0x10, 0x1a, 0x2c, 0x2c,
-			      0x2c, 0x2c, 0x14, 0x12);
+	mipi_dsi_dcs_write_seq(dsi, 0xf4, 0x00, 0xbb, 0x46, 0x53, 0x0c, 0x49,
+			       0x74, 0x29, 0x12, 0x15, 0x2f, 0x2f, 0x04);
+	mipi_dsi_dcs_write_seq(dsi, 0xf8, 0x4b, 0x04, 0x10, 0x1a, 0x2c, 0x2c,
+			       0x2c, 0x2c, 0x14, 0x12);
 
-	dsi_generic_write_seq(dsi, 0xb5, 0x03, 0x7f, 0x00, 0x80, 0xc7, 0x00);
-	dsi_generic_write_seq(dsi, 0xb7, 0x66, 0xf6, 0x46, 0x9f, 0x90, 0x99,
-			      0xff, 0x80, 0x6d, 0x01);
+	mipi_dsi_dcs_write_seq(dsi, 0xb5, 0x03, 0x7f, 0x00, 0x80, 0xc7, 0x00);
+	mipi_dsi_dcs_write_seq(dsi, 0xb7, 0x66, 0xf6, 0x46, 0x9f, 0x90, 0x99,
+			       0xff, 0x80, 0x6d, 0x01);
 
 	/* Gamma R */
-	dsi_generic_write_seq(dsi, 0xf9, 0x04);
-	dsi_generic_write_seq(dsi, 0xfa, 0x00, 0x2f, 0x30, 0x12, 0x0e, 0x0c,
-			      0x22, 0x27, 0x31, 0x2e, 0x07, 0x0f);
-	dsi_generic_write_seq(dsi, 0xfb, 0x00, 0x2f, 0x30, 0x12, 0x0e, 0x0c,
-			      0x22, 0x27, 0x31, 0x2e, 0x07, 0x0f);
+	mipi_dsi_dcs_write_seq(dsi, 0xf9, 0x04);
+	mipi_dsi_dcs_write_seq(dsi, 0xfa, 0x00, 0x2f, 0x30, 0x12, 0x0e, 0x0c,
+			       0x22, 0x27, 0x31, 0x2e, 0x07, 0x0f);
+	mipi_dsi_dcs_write_seq(dsi, 0xfb, 0x00, 0x2f, 0x30, 0x12, 0x0e, 0x0c,
+			       0x22, 0x27, 0x31, 0x2e, 0x07, 0x0f);
 
 	/* Gamma G */
-	dsi_generic_write_seq(dsi, 0xf9, 0x02);
-	dsi_generic_write_seq(dsi, 0xfa, 0x00, 0x2f, 0x37, 0x15, 0x15, 0x11,
-			      0x1f, 0x25, 0x2d, 0x2a, 0x05, 0x0f);
-	dsi_generic_write_seq(dsi, 0xfb, 0x00, 0x2f, 0x37, 0x15, 0x15, 0x11,
-			      0x1f, 0x25, 0x2d, 0x2a, 0x05, 0x0f);
+	mipi_dsi_dcs_write_seq(dsi, 0xf9, 0x02);
+	mipi_dsi_dcs_write_seq(dsi, 0xfa, 0x00, 0x2f, 0x37, 0x15, 0x15, 0x11,
+			       0x1f, 0x25, 0x2d, 0x2a, 0x05, 0x0f);
+	mipi_dsi_dcs_write_seq(dsi, 0xfb, 0x00, 0x2f, 0x37, 0x15, 0x15, 0x11,
+			       0x1f, 0x25, 0x2d, 0x2a, 0x05, 0x0f);
 
 	/* Gamma B */
-	dsi_generic_write_seq(dsi, 0xf9, 0x01);
-	dsi_generic_write_seq(dsi, 0xfa, 0x00, 0x2f, 0x3f, 0x16, 0x1f, 0x15,
-			      0x1f, 0x25, 0x2d, 0x2b, 0x06, 0x0b);
-	dsi_generic_write_seq(dsi, 0xfb, 0x00, 0x2f, 0x3f, 0x16, 0x1f, 0x15,
-			      0x1f, 0x25, 0x2d, 0x2b, 0x06, 0x0b);
+	mipi_dsi_dcs_write_seq(dsi, 0xf9, 0x01);
+	mipi_dsi_dcs_write_seq(dsi, 0xfa, 0x00, 0x2f, 0x3f, 0x16, 0x1f, 0x15,
+			       0x1f, 0x25, 0x2d, 0x2b, 0x06, 0x0b);
+	mipi_dsi_dcs_write_seq(dsi, 0xfb, 0x00, 0x2f, 0x3f, 0x16, 0x1f, 0x15,
+			       0x1f, 0x25, 0x2d, 0x2b, 0x06, 0x0b);
 
 	/* Gamma W */
-	dsi_generic_write_seq(dsi, 0xf9, 0x20);
-	dsi_generic_write_seq(dsi, 0xfa, 0x00, 0x2f, 0x34, 0x15, 0x1a, 0x11,
-			      0x1f, 0x23, 0x2d, 0x29, 0x02, 0x08);
-	dsi_generic_write_seq(dsi, 0xfb, 0x00, 0x2f, 0x34, 0x15, 0x1a, 0x11,
-			      0x1f, 0x23, 0x2d, 0x29, 0x02, 0x08);
+	mipi_dsi_dcs_write_seq(dsi, 0xf9, 0x20);
+	mipi_dsi_dcs_write_seq(dsi, 0xfa, 0x00, 0x2f, 0x34, 0x15, 0x1a, 0x11,
+			       0x1f, 0x23, 0x2d, 0x29, 0x02, 0x08);
+	mipi_dsi_dcs_write_seq(dsi, 0xfb, 0x00, 0x2f, 0x34, 0x15, 0x1a, 0x11,
+			       0x1f, 0x23, 0x2d, 0x29, 0x02, 0x08);
 
-	dsi_generic_write_seq(dsi, 0x53, 0x2c);
-	dsi_generic_write_seq(dsi, 0x35, 0x00);
+	mipi_dsi_dcs_write_seq(dsi, 0x53, 0x2c);
+	mipi_dsi_dcs_write_seq(dsi, 0x35, 0x00);
 
 	return 0;
 }
@@ -107,9 +99,9 @@ static int __maybe_unused mot_es4(struct mipi_dsi_device *dsi)
 {
 	int ret;
 
-	dsi_generic_write_seq(dsi, 0xd2, 0x04, 0x53);
-	dsi_generic_write_seq(dsi, 0xd2, 0x05, 0x53);
-	dsi_generic_write_seq(dsi, 0x55, 0x01);
+	mipi_dsi_dcs_write_seq(dsi, 0xd2, 0x04, 0x53);
+	mipi_dsi_dcs_write_seq(dsi, 0xd2, 0x05, 0x53);
+	mipi_dsi_dcs_write_seq(dsi, 0x55, 0x01);
 
 	ret = mipi_dsi_dcs_exit_sleep_mode(dsi);
 	if (ret < 0) {
@@ -118,45 +110,45 @@ static int __maybe_unused mot_es4(struct mipi_dsi_device *dsi)
 	}
 	mdelay(120);
 
-	dsi_generic_write_seq(dsi, 0xb5, 0x03, 0x7f, 0x0a, 0x80, 0xff, 0x00);
-	dsi_generic_write_seq(dsi, 0xb7, 0x7a, 0xf7, 0x4d, 0x91, 0x90, 0xb3,
-			      0xff, 0x80, 0x6d, 0x01);
-	dsi_generic_write_seq(dsi, 0xf4, 0x00, 0xbb, 0x46, 0x53, 0x0c, 0x49,
-			      0x74, 0x29, 0x12, 0x15, 0x37, 0x37, 0x04);
-	dsi_generic_write_seq(dsi, 0xf8, 0x0a, 0x04, 0x10, 0x2a, 0x35, 0x35,
-			      0x35, 0x35, 0x21, 0x1a);
+	mipi_dsi_dcs_write_seq(dsi, 0xb5, 0x03, 0x7f, 0x0a, 0x80, 0xff, 0x00);
+	mipi_dsi_dcs_write_seq(dsi, 0xb7, 0x7a, 0xf7, 0x4d, 0x91, 0x90, 0xb3,
+			       0xff, 0x80, 0x6d, 0x01);
+	mipi_dsi_dcs_write_seq(dsi, 0xf4, 0x00, 0xbb, 0x46, 0x53, 0x0c, 0x49,
+			       0x74, 0x29, 0x12, 0x15, 0x37, 0x37, 0x04);
+	mipi_dsi_dcs_write_seq(dsi, 0xf8, 0x0a, 0x04, 0x10, 0x2a, 0x35, 0x35,
+			       0x35, 0x35, 0x21, 0x1a);
 
 	/* Gamma R */
-	dsi_generic_write_seq(dsi, 0xf9, 0x04);
-	dsi_generic_write_seq(dsi, 0xfa, 0x08, 0x1c, 0x1b, 0x0f, 0x0f, 0x0a,
-			      0x1e, 0x22, 0x27, 0x26, 0x07, 0x0d);
-	dsi_generic_write_seq(dsi, 0xfb, 0x08, 0x3c, 0x27, 0x0f, 0x0f, 0x0a,
-			      0x1e, 0x26, 0x31, 0x2f, 0x07, 0x0b);
+	mipi_dsi_dcs_write_seq(dsi, 0xf9, 0x04);
+	mipi_dsi_dcs_write_seq(dsi, 0xfa, 0x08, 0x1c, 0x1b, 0x0f, 0x0f, 0x0a,
+			       0x1e, 0x22, 0x27, 0x26, 0x07, 0x0d);
+	mipi_dsi_dcs_write_seq(dsi, 0xfb, 0x08, 0x3c, 0x27, 0x0f, 0x0f, 0x0a,
+			       0x1e, 0x26, 0x31, 0x2f, 0x07, 0x0b);
 
 	/* Gamma G */
-	dsi_generic_write_seq(dsi, 0xf9, 0x02);
-	dsi_generic_write_seq(dsi, 0xfa, 0x30, 0x14, 0x0f, 0x00, 0x06, 0x02,
-			      0x1e, 0x22, 0x27, 0x27, 0x08, 0x10);
-	dsi_generic_write_seq(dsi, 0xfb, 0x30, 0x35, 0x0f, 0x00, 0x0a, 0x02,
-			      0x1c, 0x23, 0x31, 0x2f, 0x08, 0x0e);
+	mipi_dsi_dcs_write_seq(dsi, 0xf9, 0x02);
+	mipi_dsi_dcs_write_seq(dsi, 0xfa, 0x30, 0x14, 0x0f, 0x00, 0x06, 0x02,
+			       0x1e, 0x22, 0x27, 0x27, 0x08, 0x10);
+	mipi_dsi_dcs_write_seq(dsi, 0xfb, 0x30, 0x35, 0x0f, 0x00, 0x0a, 0x02,
+			       0x1c, 0x23, 0x31, 0x2f, 0x08, 0x0e);
 
 	/* Gamma B */
-	dsi_generic_write_seq(dsi, 0xf9, 0x01);
-	dsi_generic_write_seq(dsi, 0xfa, 0x12, 0x1b, 0x26, 0x0e, 0x12, 0x0b,
-			      0x1e, 0x22, 0x27, 0x27, 0x06, 0x0c);
-	dsi_generic_write_seq(dsi, 0xfb, 0x12, 0x3b, 0x2c, 0x12, 0x12, 0x0e,
-			      0x1e, 0x26, 0x31, 0x2f, 0x06, 0x0d);
+	mipi_dsi_dcs_write_seq(dsi, 0xf9, 0x01);
+	mipi_dsi_dcs_write_seq(dsi, 0xfa, 0x12, 0x1b, 0x26, 0x0e, 0x12, 0x0b,
+			       0x1e, 0x22, 0x27, 0x27, 0x06, 0x0c);
+	mipi_dsi_dcs_write_seq(dsi, 0xfb, 0x12, 0x3b, 0x2c, 0x12, 0x12, 0x0e,
+			       0x1e, 0x26, 0x31, 0x2f, 0x06, 0x0d);
 
 	/* Gamma W */
-	dsi_generic_write_seq(dsi, 0xf9, 0x20);
-	dsi_generic_write_seq(dsi, 0xfa, 0x37, 0x1b, 0x09, 0x01, 0x06, 0x04,
-			      0x19, 0x19, 0x22, 0x24, 0x04, 0x15);
-	dsi_generic_write_seq(dsi, 0xfb, 0x37, 0x3b, 0x17, 0x01, 0x0a, 0x04,
-			      0x19, 0x1d, 0x2c, 0x2c, 0x04, 0x13);
+	mipi_dsi_dcs_write_seq(dsi, 0xf9, 0x20);
+	mipi_dsi_dcs_write_seq(dsi, 0xfa, 0x37, 0x1b, 0x09, 0x01, 0x06, 0x04,
+			       0x19, 0x19, 0x22, 0x24, 0x04, 0x15);
+	mipi_dsi_dcs_write_seq(dsi, 0xfb, 0x37, 0x3b, 0x17, 0x01, 0x0a, 0x04,
+			       0x19, 0x1d, 0x2c, 0x2c, 0x04, 0x13);
 
-	dsi_generic_write_seq(dsi, 0x53, 0x2c);
-	dsi_generic_write_seq(dsi, 0x35, 0x00);
-	dsi_generic_write_seq(dsi, 0xc3, 0x01, 0x4e);
+	mipi_dsi_dcs_write_seq(dsi, 0x53, 0x2c);
+	mipi_dsi_dcs_write_seq(dsi, 0x35, 0x00);
+	mipi_dsi_dcs_write_seq(dsi, 0xc3, 0x01, 0x4e);
 
 	return 0;
 }
@@ -167,9 +159,9 @@ static int mot_panel_enable_backlight(struct udevice *dev)
 	struct mipi_dsi_device *dsi = plat->device;
 	int ret;
 
-	dsi_generic_write_seq(dsi, 0xf0, 0x5a, 0x5a);
-	dsi_generic_write_seq(dsi, 0xf1, 0x5a, 0x5a);
-	dsi_generic_write_seq(dsi, 0xd0, 0x8e);
+	mipi_dsi_dcs_write_seq(dsi, 0xf0, 0x5a, 0x5a);
+	mipi_dsi_dcs_write_seq(dsi, 0xf1, 0x5a, 0x5a);
+	mipi_dsi_dcs_write_seq(dsi, 0xd0, 0x8e);
 
 	ret = mot_es2(dsi);
 	if (ret)

-- 
2.54.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.