2020-04-09 09:35:15

by Oliver Graute

[permalink] [raw]
Subject: [PATCH v1] staging: fbtft: fb_st7789v: Initialize the Display

From: Oliver Graute <[email protected]>

Set Gamma Values and Register Values for the HSD20_IPS

Signed-off-by: Oliver Graute <[email protected]>
---
drivers/staging/fbtft/fb_st7789v.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/fbtft/fb_st7789v.c b/drivers/staging/fbtft/fb_st7789v.c
index 84c5af2dc9a0..b0aa96b703a8 100644
--- a/drivers/staging/fbtft/fb_st7789v.c
+++ b/drivers/staging/fbtft/fb_st7789v.c
@@ -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);
--
2.17.1


2020-04-09 10:23:15

by Dan Carpenter

[permalink] [raw]
Subject: Re: [PATCH v1] staging: fbtft: fb_st7789v: Initialize the Display

On Thu, Apr 09, 2020 at 11:25:32AM +0200, Oliver Graute wrote:
> From: Oliver Graute <[email protected]>
>
> Set Gamma Values and Register Values for the HSD20_IPS
>
> Signed-off-by: Oliver Graute <[email protected]>
> ---
> drivers/staging/fbtft/fb_st7789v.c | 12 ++++++------
> 1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/staging/fbtft/fb_st7789v.c b/drivers/staging/fbtft/fb_st7789v.c
> index 84c5af2dc9a0..b0aa96b703a8 100644
> --- a/drivers/staging/fbtft/fb_st7789v.c
> +++ b/drivers/staging/fbtft/fb_st7789v.c
> @@ -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?

>
> /**
> * 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

2020-04-27 08:38:47

by Oliver Graute

[permalink] [raw]
Subject: Re: [PATCH v1] staging: fbtft: fb_st7789v: Initialize the Display

On 09/04/20, Dan Carpenter wrote:
> On Thu, Apr 09, 2020 at 11:25:32AM +0200, Oliver Graute wrote:
> > From: Oliver Graute <[email protected]>
> >
> > Set Gamma Values and Register Values for the HSD20_IPS
> >
> > Signed-off-by: Oliver Graute <[email protected]>
> > ---
> > drivers/staging/fbtft/fb_st7789v.c | 12 ++++++------
> > 1 file changed, 6 insertions(+), 6 deletions(-)
> >
> > diff --git a/drivers/staging/fbtft/fb_st7789v.c b/drivers/staging/fbtft/fb_st7789v.c
> > index 84c5af2dc9a0..b0aa96b703a8 100644
> > --- a/drivers/staging/fbtft/fb_st7789v.c
> > +++ b/drivers/staging/fbtft/fb_st7789v.c
> > @@ -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?

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"

>
> 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

2020-04-27 09:35:31

by Dan Carpenter

[permalink] [raw]
Subject: Re: [PATCH v1] staging: fbtft: fb_st7789v: Initialize the Display

On Mon, Apr 27, 2020 at 10:36:42AM +0200, Oliver Graute wrote:
> On 09/04/20, Dan Carpenter wrote:
> > On Thu, Apr 09, 2020 at 11:25:32AM +0200, Oliver Graute wrote:
> > > From: Oliver Graute <[email protected]>
> > >
> > > Set Gamma Values and Register Values for the HSD20_IPS
> > >
> > > Signed-off-by: Oliver Graute <[email protected]>
> > > ---
> > > drivers/staging/fbtft/fb_st7789v.c | 12 ++++++------
> > > 1 file changed, 6 insertions(+), 6 deletions(-)
> > >
> > > diff --git a/drivers/staging/fbtft/fb_st7789v.c b/drivers/staging/fbtft/fb_st7789v.c
> > > index 84c5af2dc9a0..b0aa96b703a8 100644
> > > --- a/drivers/staging/fbtft/fb_st7789v.c
> > > +++ b/drivers/staging/fbtft/fb_st7789v.c
> > > @@ -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?
>
> 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"
>

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


2020-04-27 12:39:02

by Oliver Graute

[permalink] [raw]
Subject: Re: [PATCH v1] staging: fbtft: fb_st7789v: Initialize the Display

On 27/04/20, Dan Carpenter wrote:
> On Mon, Apr 27, 2020 at 10:36:42AM +0200, Oliver Graute wrote:
> > On 09/04/20, Dan Carpenter wrote:
> > > On Thu, Apr 09, 2020 at 11:25:32AM +0200, Oliver Graute wrote:
> > > > From: Oliver Graute <[email protected]>
> > > >
> > > > Set Gamma Values and Register Values for the HSD20_IPS
> > > >
> > > > Signed-off-by: Oliver Graute <[email protected]>
> > > > ---
> > > > drivers/staging/fbtft/fb_st7789v.c | 12 ++++++------
> > > > 1 file changed, 6 insertions(+), 6 deletions(-)
> > > >
> > > > diff --git a/drivers/staging/fbtft/fb_st7789v.c b/drivers/staging/fbtft/fb_st7789v.c
> > > > index 84c5af2dc9a0..b0aa96b703a8 100644
> > > > --- a/drivers/staging/fbtft/fb_st7789v.c
> > > > +++ b/drivers/staging/fbtft/fb_st7789v.c
> > > > @@ -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?
> >
> > 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"
> >
>
> 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

2020-04-28 19:04:05

by Dan Carpenter

[permalink] [raw]
Subject: Re: [PATCH v1] staging: fbtft: fb_st7789v: Initialize the Display

On Mon, Apr 27, 2020 at 02:36:25PM +0200, Oliver Graute wrote:
> On 27/04/20, Dan Carpenter wrote:
> > On Mon, Apr 27, 2020 at 10:36:42AM +0200, Oliver Graute wrote:
> > > On 09/04/20, Dan Carpenter wrote:
> > > > On Thu, Apr 09, 2020 at 11:25:32AM +0200, Oliver Graute wrote:
> > > > > From: Oliver Graute <[email protected]>
> > > > >
> > > > > Set Gamma Values and Register Values for the HSD20_IPS
> > > > >
> > > > > Signed-off-by: Oliver Graute <[email protected]>
> > > > > ---
> > > > > drivers/staging/fbtft/fb_st7789v.c | 12 ++++++------
> > > > > 1 file changed, 6 insertions(+), 6 deletions(-)
> > > > >
> > > > > diff --git a/drivers/staging/fbtft/fb_st7789v.c b/drivers/staging/fbtft/fb_st7789v.c
> > > > > index 84c5af2dc9a0..b0aa96b703a8 100644
> > > > > --- a/drivers/staging/fbtft/fb_st7789v.c
> > > > > +++ b/drivers/staging/fbtft/fb_st7789v.c
> > > > > @@ -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?
> > >
> > > 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"
> > >
> >
> > 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?

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

regards,
dan carpenter