Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1253260 > unrolled thread

[PATCH 0/4] staging: fbtft: cleanup ST7789V and C-Berry28 drivers

Started byDennis Menschel <menschel-d@posteo.de>
First post2015-10-21 23:20 +0200
Last post2015-10-21 23:20 +0200
Articles 2 — 1 participant

Back to article view | Back to linux.kernel


Contents

  [PATCH 0/4] staging: fbtft: cleanup ST7789V and C-Berry28 drivers Dennis Menschel <menschel-d@posteo.de> - 2015-10-21 23:20 +0200
    [PATCH 1/4] staging: fbtft: use MIPI DCS for ST7789V and C-Berry28 Dennis Menschel <menschel-d@posteo.de> - 2015-10-21 23:20 +0200

#1253260 — [PATCH 0/4] staging: fbtft: cleanup ST7789V and C-Berry28 drivers

FromDennis Menschel <menschel-d@posteo.de>
Date2015-10-21 23:20 +0200
Subject[PATCH 0/4] staging: fbtft: cleanup ST7789V and C-Berry28 drivers
Message-ID<qm8XD-6Ci-11@gated-at.bofh.it>
This set of patches brings some improvements for the ST7789V display
controller driver based on suggestions by Noralf Trønnes.
In addition, the settings for the concrete C-Berry28 display have been
adjusted based on feedback by its vendor admatec.


Dennis Menschel (4):
  staging: fbtft: use MIPI DCS for ST7789V and C-Berry28
  staging: fbtft: remove redundant set_addr_win() function
  staging: fbtft: use init function instead of init sequence
  staging: fbtft: fix voltage settings for C-Berry28

 drivers/staging/fbtft/fb_st7789v.c   | 83 +++++++++++++-----------------------
 drivers/staging/fbtft/fbtft_device.c | 15 ++++---
 2 files changed, 37 insertions(+), 61 deletions(-)

-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1253261 — [PATCH 1/4] staging: fbtft: use MIPI DCS for ST7789V and C-Berry28

FromDennis Menschel <menschel-d@posteo.de>
Date2015-10-21 23:20 +0200
Subject[PATCH 1/4] staging: fbtft: use MIPI DCS for ST7789V and C-Berry28
Message-ID<qm8XF-6Ci-31@gated-at.bofh.it>
In reply to#1253260
This patch makes use of the standard MIPI Display Command Set to remove
redundant entries from the command enum of the ST7789V display controller
and also some of the magic constants found in the init sequence of the
C-Berry28 display.

Signed-off-by: Dennis Menschel <menschel-d@posteo.de>
---
 drivers/staging/fbtft/fb_st7789v.c   | 39 +++++++++++++-----------------------
 drivers/staging/fbtft/fbtft_device.c |  7 ++++---
 2 files changed, 18 insertions(+), 28 deletions(-)

diff --git a/drivers/staging/fbtft/fb_st7789v.c b/drivers/staging/fbtft/fb_st7789v.c
index dc7d304..22a7b5b 100644
--- a/drivers/staging/fbtft/fb_st7789v.c
+++ b/drivers/staging/fbtft/fb_st7789v.c
@@ -18,6 +18,7 @@
 #include <linux/init.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
+#include <video/mipi_display.h>
 
 #include "fbtft.h"
 
@@ -30,14 +31,6 @@
 /**
  * enum st7789v_command - ST7789V display controller commands
  *
- * @SLPOUT: sleep out
- * @DISPOFF: display off
- * @DISPON: display on
- * @CASET: column address set
- * @RASET: row address set
- * @RAMRW: memory write
- * @MADCTL: memory data access control
- * @COLMOD: interface pixel format
  * @PORCTRL: porch setting
  * @GCTRL: gate control
  * @VCOMS: VCOM setting
@@ -54,16 +47,10 @@
  *
  * Note that the ST7789V display controller offers quite a few more commands
  * which have been omitted from this list as they are not used at the moment.
+ * Furthermore, commands that are compliant with the MIPI DCS have been left
+ * out as well to avoid duplicate entries.
  */
 enum st7789v_command {
-	SLPOUT = 0x11,
-	DISPOFF = 0x28,
-	DISPON = 0x29,
-	CASET = 0x2A,
-	RASET = 0x2B,
-	RAMRW = 0x2C,
-	MADCTL = 0x36,
-	COLMOD = 0x3A,
 	PORCTRL = 0xB2,
 	GCTRL = 0xB7,
 	VCOMS = 0xBB,
@@ -93,11 +80,11 @@ enum st7789v_command {
  */
 static int default_init_sequence[] = {
 	/* turn off sleep mode */
-	-1, SLPOUT,
+	-1, MIPI_DCS_EXIT_SLEEP_MODE,
 	-2, 120,
 
 	/* set pixel format to RGB-565 */
-	-1, COLMOD, 0x05,
+	-1, MIPI_DCS_SET_PIXEL_FORMAT, MIPI_DCS_PIXEL_FMT_16BIT,
 
 	-1, PORCTRL, 0x08, 0x08, 0x00, 0x22, 0x22,
 
@@ -135,7 +122,7 @@ static int default_init_sequence[] = {
 	 */
 	-1, PWCTRL1, 0xA4, 0xA1,
 
-	-1, DISPON,
+	-1, MIPI_DCS_SET_DISPLAY_ON,
 
 	-3,
 };
@@ -151,9 +138,11 @@ static int default_init_sequence[] = {
  */
 static void set_addr_win(struct fbtft_par *par, int xs, int ys, int xe, int ye)
 {
-	write_reg(par, CASET, xs >> 8, xs & 0xFF, xe >> 8, xe & 0xFF);
-	write_reg(par, RASET, ys >> 8, ys & 0xFF, ye >> 8, ye & 0xFF);
-	write_reg(par, RAMRW);
+	write_reg(par, MIPI_DCS_SET_COLUMN_ADDRESS,
+		  xs >> 8, xs & 0xFF, xe >> 8, xe & 0xFF);
+	write_reg(par, MIPI_DCS_SET_PAGE_ADDRESS,
+		  ys >> 8, ys & 0xFF, ye >> 8, ye & 0xFF);
+	write_reg(par, MIPI_DCS_WRITE_MEMORY_START);
 }
 
 /**
@@ -184,7 +173,7 @@ static int set_var(struct fbtft_par *par)
 	default:
 		return -EINVAL;
 	}
-	write_reg(par, MADCTL, madctl_par);
+	write_reg(par, MIPI_DCS_SET_ADDRESS_MODE, madctl_par);
 	return 0;
 }
 
@@ -256,9 +245,9 @@ static int set_gamma(struct fbtft_par *par, unsigned long *curves)
 static int blank(struct fbtft_par *par, bool on)
 {
 	if (on)
-		write_reg(par, DISPOFF);
+		write_reg(par, MIPI_DCS_SET_DISPLAY_OFF);
 	else
-		write_reg(par, DISPON);
+		write_reg(par, MIPI_DCS_SET_DISPLAY_ON);
 	return 0;
 }
 
diff --git a/drivers/staging/fbtft/fbtft_device.c b/drivers/staging/fbtft/fbtft_device.c
index 0e501d0..d7475d7 100644
--- a/drivers/staging/fbtft/fbtft_device.c
+++ b/drivers/staging/fbtft/fbtft_device.c
@@ -19,6 +19,7 @@
 #include <linux/init.h>
 #include <linux/gpio.h>
 #include <linux/spi/spi.h>
+#include <video/mipi_display.h>
 
 #include "fbtft.h"
 
@@ -132,11 +133,11 @@ static void adafruit18_green_tab_set_addr_win(struct fbtft_par *par,
 
 static int cberry28_init_sequence[] = {
 	/* turn off sleep mode */
-	-1, 0x11,
+	-1, MIPI_DCS_EXIT_SLEEP_MODE,
 	-2, 120,
 
 	/* set pixel format to RGB-565 */
-	-1, 0x3A, 0x05,
+	-1, MIPI_DCS_SET_PIXEL_FORMAT, MIPI_DCS_PIXEL_FMT_16BIT,
 
 	-1, 0xB2, 0x0C, 0x0C, 0x00, 0x33, 0x33,
 
@@ -174,7 +175,7 @@ static int cberry28_init_sequence[] = {
 	 */
 	-1, 0xD0, 0xA4, 0x61,
 
-	-1, 0x29,
+	-1, MIPI_DCS_SET_DISPLAY_ON,
 
 	-3,
 };
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web