Skip to contentSkip to conversation

staging: fbtft: fb_st7789v: Initialize the Display

PATCH Superseded Oliver Graute 2 participants 6 messages Apr 9, 2020 – Apr 28, 2020

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: fbtft: fb_st7789v: Initialize the Display

From: Oliver Graute <[email protected]>

Set Gamma Values and Register Values for the HSD20_IPS

---
 drivers/staging/fbtft/fb_st7789v.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/staging/fbtft/fb_st7789v.c +6 -6
index 84c5af2dc9a0..b0aa96b703a8 100644
@@ -17,8 +17,8 @@
 #define DRVNAME "fb_st7789v"
 
 #define DEFAULT_GAMMA \
-	"70 2C 2E 15 10 09 48 33 53 0B 19 18 20 25\n" \
-	"70 2C 2E 15 10 09 48 33 53 0B 19 18 20 25"
+	"D0 05 0A 09 08 05 2E 44 45 0F 17 16 2B 33\n" \
+	"D0 05 0A 09 08 05 2E 43 45 0F 16 16 2B 33"
 
 /**
  * enum st7789v_command - ST7789V display controller commands
@@ -83,13 +83,13 @@ static int init_display(struct fbtft_par *par)
 	/* set pixel format to RGB-565 */
 	write_reg(par, MIPI_DCS_SET_PIXEL_FORMAT, MIPI_DCS_PIXEL_FMT_16BIT);
 
-	write_reg(par, PORCTRL, 0x08, 0x08, 0x00, 0x22, 0x22);
+	write_reg(par, PORCTRL, 0x05, 0x05, 0x00, 0x33, 0x33);
 
 	/*
 	 * VGH = 13.26V
 	 * VGL = -10.43V
 	 */
-	write_reg(par, GCTRL, 0x35);
+	write_reg(par, GCTRL, 0x75);
 
 	/*
 	 * VDV and VRH register values come from command write
@@ -101,13 +101,13 @@ static int init_display(struct fbtft_par *par)
 	 * VAP =  4.1V + (VCOM + VCOM offset + 0.5 * VDV)
 	 * VAN = -4.1V + (VCOM + VCOM offset + 0.5 * VDV)
 	 */
-	write_reg(par, VRHS, 0x0B);
+	write_reg(par, VRHS, 0x13);
 
 	/* VDV = 0V */
 	write_reg(par, VDVS, 0x20);
 
 	/* VCOM = 0.9V */
-	write_reg(par, VCOMS, 0x20);
+	write_reg(par, VCOMS, 0x22);
 
 	/* VCOM offset = 0V */
 	write_reg(par, VCMOFSET, 0x20);
Signature · 1 line
2.17.1
#1 lore raw
Quoted 14 lines · Oliver Graute

From: Oliver Graute <[email protected]>

Set Gamma Values and Register Values for the HSD20_IPS

---
 drivers/staging/fbtft/fb_st7789v.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/staging/fbtft/fb_st7789v.c +0 -0
index 84c5af2dc9a0..b0aa96b703a8 100644

drivers/staging/fbtft/fb_st7789v.c line 21

Quoted 7 lines
drivers/staging/fbtft/fb_st7789v.c +2 -2
@@ -17,8 +17,8 @@
 #define DRVNAME "fb_st7789v"
 
 #define DEFAULT_GAMMA \
-	"70 2C 2E 15 10 09 48 33 53 0B 19 18 20 25\n" \
-	"70 2C 2E 15 10 09 48 33 53 0B 19 18 20 25"
+	"D0 05 0A 09 08 05 2E 44 45 0F 17 16 2B 33\n" \
+	"D0 05 0A 09 08 05 2E 43 45 0F 16 16 2B 33"

How do you know this won't break someone else's setup?

drivers/staging/fbtft/fb_st7789v.c static int init_display(struct fbtft_par *par) · line 86

Quoted 9 lines
drivers/staging/fbtft/fb_st7789v.c +1 -1
 /**
  * enum st7789v_command - ST7789V display controller commands
@@ -83,13 +83,13 @@ static int init_display(struct fbtft_par *par)
 	/* set pixel format to RGB-565 */
 	write_reg(par, MIPI_DCS_SET_PIXEL_FORMAT, MIPI_DCS_PIXEL_FMT_16BIT);
 
-	write_reg(par, PORCTRL, 0x08, 0x08, 0x00, 0x22, 0x22);
+	write_reg(par, PORCTRL, 0x05, 0x05, 0x00, 0x33, 0x33);

Without knowing anything at all about this driver, it feels like this should be:

	if (new_hardware)
		write_reg(par, PORCTRL, 0x05, 0x05, 0x00, 0x33, 0x33);
	else
		write_reg(par, PORCTRL, 0x08, 0x08, 0x00, 0x22, 0x22);

Same comment for the rest of the patch.

regards,
dan carpenter

#2 lore raw
Quoted 17 lines · Dan Carpenter
Quoted 16 lines · Oliver Graute

From: Oliver Graute <[email protected]>

Set Gamma Values and Register Values for the HSD20_IPS

---
 drivers/staging/fbtft/fb_st7789v.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/staging/fbtft/fb_st7789v.c +0 -0
index 84c5af2dc9a0..b0aa96b703a8 100644
@@ -17,8 +17,8 @@
 #define DRVNAME "fb_st7789v"
 
Quoted 7 lines

drivers/staging/fbtft/fb_st7789v.c line 21

Quoted 5 lines
drivers/staging/fbtft/fb_st7789v.c +2 -2
 #define DEFAULT_GAMMA \
-	"70 2C 2E 15 10 09 48 33 53 0B 19 18 20 25\n" \
-	"70 2C 2E 15 10 09 48 33 53 0B 19 18 20 25"
+	"D0 05 0A 09 08 05 2E 44 45 0F 17 16 2B 33\n" \
+	"D0 05 0A 09 08 05 2E 43 45 0F 16 16 2B 33"

How do you know this won't break someone else's setup?

Should I declare an extra define for my values?

+#define HSD20_IPS_GAMMA \
+ "D0 05 0A 09 08 05 2E 44 45 0F 17 16 2B 33\n" \
+ "D0 05 0A 09 08 05 2E 43 45 0F 16 16 2B 33"

Quoted 8 lines

Without knowing anything at all about this driver, it feels like this should be:

	if (new_hardware)
		write_reg(par, PORCTRL, 0x05, 0x05, 0x00, 0x33, 0x33);
	else
		write_reg(par, PORCTRL, 0x08, 0x08, 0x00, 0x22, 0x22);

ok, I'll update this.

Best regards,

Oliver

#3 lore raw
Quoted 29 lines · Oliver Graute
Quoted 17 lines · Dan Carpenter
Quoted 16 lines · Oliver Graute

From: Oliver Graute <[email protected]>

Set Gamma Values and Register Values for the HSD20_IPS

---
 drivers/staging/fbtft/fb_st7789v.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/staging/fbtft/fb_st7789v.c +0 -0
index 84c5af2dc9a0..b0aa96b703a8 100644
@@ -17,8 +17,8 @@
 #define DRVNAME "fb_st7789v"
 
Quoted 7 lines

drivers/staging/fbtft/fb_st7789v.c line 21

Quoted 5 lines
drivers/staging/fbtft/fb_st7789v.c +2 -2
 #define DEFAULT_GAMMA \
-	"70 2C 2E 15 10 09 48 33 53 0B 19 18 20 25\n" \
-	"70 2C 2E 15 10 09 48 33 53 0B 19 18 20 25"
+	"D0 05 0A 09 08 05 2E 44 45 0F 17 16 2B 33\n" \
+	"D0 05 0A 09 08 05 2E 43 45 0F 16 16 2B 33"

How do you know this won't break someone else's setup?

Should I declare an extra define for my values?

drivers/staging/fbtft/fb_st7789v.c line 21

Quoted 3 lines
drivers/staging/fbtft/fb_st7789v.c +3 -0
+#define HSD20_IPS_GAMMA \
+	"D0 05 0A 09 08 05 2E 44 45 0F 17 16 2B 33\n" \
+	"D0 05 0A 09 08 05 2E 43 45 0F 16 16 2B 33"

That's fine, but it can't be a compile time thing. Both types of hardware have to be working/available at run time.

regards,
dan carpenter

#4 lore raw
Quoted 29 lines · Dan Carpenter
Quoted 28 lines · Oliver Graute
Quoted 17 lines · Dan Carpenter
Quoted 16 lines · Oliver Graute

From: Oliver Graute <[email protected]>

Set Gamma Values and Register Values for the HSD20_IPS

---
 drivers/staging/fbtft/fb_st7789v.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/staging/fbtft/fb_st7789v.c +0 -0
index 84c5af2dc9a0..b0aa96b703a8 100644
@@ -17,8 +17,8 @@
 #define DRVNAME "fb_st7789v"
 
Quoted 7 lines

drivers/staging/fbtft/fb_st7789v.c line 21

Quoted 5 lines
drivers/staging/fbtft/fb_st7789v.c +2 -2
 #define DEFAULT_GAMMA \
-	"70 2C 2E 15 10 09 48 33 53 0B 19 18 20 25\n" \
-	"70 2C 2E 15 10 09 48 33 53 0B 19 18 20 25"
+	"D0 05 0A 09 08 05 2E 44 45 0F 17 16 2B 33\n" \
+	"D0 05 0A 09 08 05 2E 43 45 0F 16 16 2B 33"

How do you know this won't break someone else's setup?

Should I declare an extra define for my values?

Quoted 7 lines

drivers/staging/fbtft/fb_st7789v.c line 21

Quoted 4 lines
drivers/staging/fbtft/fb_st7789v.c +3 -0
+#define HSD20_IPS_GAMMA \
+	"D0 05 0A 09 08 05 2E 44 45 0F 17 16 2B 33\n" \
+	"D0 05 0A 09 08 05 2E 43 45 0F 16 16 2B 33"

That's fine, but it can't be a compile time thing. Both types of hardware have to be working/available at run time.

ok, what is the proper way to handover the gamma values during run time?

Best Regards,

Oliver

#5 lore raw
Quoted 38 lines · Oliver Graute
Quoted 29 lines · Dan Carpenter
Quoted 28 lines · Oliver Graute
Quoted 17 lines · Dan Carpenter
Quoted 16 lines · Oliver Graute

From: Oliver Graute <[email protected]>

Set Gamma Values and Register Values for the HSD20_IPS

---
 drivers/staging/fbtft/fb_st7789v.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/staging/fbtft/fb_st7789v.c +0 -0
index 84c5af2dc9a0..b0aa96b703a8 100644
@@ -17,8 +17,8 @@
 #define DRVNAME "fb_st7789v"
 
Quoted 7 lines

drivers/staging/fbtft/fb_st7789v.c line 21

Quoted 5 lines
drivers/staging/fbtft/fb_st7789v.c +2 -2
 #define DEFAULT_GAMMA \
-	"70 2C 2E 15 10 09 48 33 53 0B 19 18 20 25\n" \
-	"70 2C 2E 15 10 09 48 33 53 0B 19 18 20 25"
+	"D0 05 0A 09 08 05 2E 44 45 0F 17 16 2B 33\n" \
+	"D0 05 0A 09 08 05 2E 43 45 0F 16 16 2B 33"

How do you know this won't break someone else's setup?

Should I declare an extra define for my values?

Quoted 7 lines

drivers/staging/fbtft/fb_st7789v.c line 21

Quoted 4 lines
drivers/staging/fbtft/fb_st7789v.c +3 -0
+#define HSD20_IPS_GAMMA \
+	"D0 05 0A 09 08 05 2E 44 45 0F 17 16 2B 33\n" \
+	"D0 05 0A 09 08 05 2E 43 45 0F 16 16 2B 33"

That's fine, but it can't be a compile time thing. Both types of hardware have to be working/available at run time.

Quoted 1 line

ok, what is the proper way to handover the gamma values during run time?

Can you detect which are appropriate and set that in the probe() function?

regards,
dan carpenter