* [PATCH] staging: fbtft: fb_st7789v: support setting offset
@ 2024-04-05 16:57 purofle
2024-04-09 15:49 ` Greg KH
0 siblings, 1 reply; 5+ messages in thread
From: purofle @ 2024-04-05 16:57 UTC (permalink / raw)
To: linux-fbdev; +Cc: dri-devel, linux-staging, gregkh, purofle
Some screen sizes using st7789v chips are different from 240x320,
and offsets need to be set to display all images properly.
Signed-off-by: purofle <purofle@gmail.com>
---
drivers/staging/fbtft/fb_st7789v.c | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/drivers/staging/fbtft/fb_st7789v.c b/drivers/staging/fbtft/fb_st7789v.c
index 861a15414..d47ab4262 100644
--- a/drivers/staging/fbtft/fb_st7789v.c
+++ b/drivers/staging/fbtft/fb_st7789v.c
@@ -30,6 +30,12 @@
#define HSD20_IPS 1
+#define WIDTH 240
+#define HEIGHT 320
+
+#define LEFT_OFFSET 0
+#define TOP_OFFSET 0
+
/**
* enum st7789v_command - ST7789V display controller commands
*
@@ -349,6 +355,21 @@ static int set_gamma(struct fbtft_par *par, u32 *curves)
return 0;
}
+static void set_addr_win(struct fbtft_par *par, int xs, int ys, int xe, int ye)
+{
+ unsigned int x = xs + TOP_OFFSET, y = xe + TOP_OFFSET;
+
+ write_reg(par, MIPI_DCS_SET_COLUMN_ADDRESS, (x >> 8) & 0xFF, xs & 0xFF,
+ (y >> 8) & 0xFF, xe & 0xFF);
+
+ x = ys + LEFT_OFFSET, y = ye + LEFT_OFFSET;
+
+ write_reg(par, MIPI_DCS_SET_PAGE_ADDRESS, (x >> 8) & 0xFF, ys & 0xFF,
+ (y >> 8) & 0xFF, ye & 0xFF);
+
+ write_reg(par, MIPI_DCS_WRITE_MEMORY_START);
+}
+
/**
* blank() - blank the display
*
@@ -379,6 +400,7 @@ static struct fbtft_display display = {
.set_var = set_var,
.set_gamma = set_gamma,
.blank = blank,
+ .set_addr_win = set_addr_win,
},
};
--
2.44.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] staging: fbtft: fb_st7789v: support setting offset
2024-04-05 16:57 [PATCH] staging: fbtft: fb_st7789v: support setting offset purofle
@ 2024-04-09 15:49 ` Greg KH
2024-04-09 17:28 ` Yuguo Pei
0 siblings, 1 reply; 5+ messages in thread
From: Greg KH @ 2024-04-09 15:49 UTC (permalink / raw)
To: purofle; +Cc: linux-fbdev, dri-devel, linux-staging
On Sat, Apr 06, 2024 at 12:57:47AM +0800, purofle wrote:
> Some screen sizes using st7789v chips are different from 240x320,
> and offsets need to be set to display all images properly.
>
> Signed-off-by: purofle <purofle@gmail.com>
We need a semi-real name here please.
> ---
> drivers/staging/fbtft/fb_st7789v.c | 22 ++++++++++++++++++++++
> 1 file changed, 22 insertions(+)
>
> diff --git a/drivers/staging/fbtft/fb_st7789v.c b/drivers/staging/fbtft/fb_st7789v.c
> index 861a15414..d47ab4262 100644
> --- a/drivers/staging/fbtft/fb_st7789v.c
> +++ b/drivers/staging/fbtft/fb_st7789v.c
> @@ -30,6 +30,12 @@
>
> #define HSD20_IPS 1
>
> +#define WIDTH 240
> +#define HEIGHT 320
So you are now hard-coding the size?
> +
> +#define LEFT_OFFSET 0
> +#define TOP_OFFSET 0
Is this always going to be 0, if so, why need it at all?
thanks,
greg k-h
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] staging: fbtft: fb_st7789v: support setting offset
@ 2024-04-09 16:39 purofle
0 siblings, 0 replies; 5+ messages in thread
From: purofle @ 2024-04-09 16:39 UTC (permalink / raw)
To: gregkh; +Cc: dri-devel, linux-fbdev, linux-staging, purofle
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] staging: fbtft: fb_st7789v: support setting offset
2024-04-09 15:49 ` Greg KH
@ 2024-04-09 17:28 ` Yuguo Pei
2024-04-09 17:36 ` Greg KH
0 siblings, 1 reply; 5+ messages in thread
From: Yuguo Pei @ 2024-04-09 17:28 UTC (permalink / raw)
To: gregkh; +Cc: dri-devel, linux-fbdev, linux-staging, purofle
On Tue, 9 Apr 2024 17:49:25 +0200, Greg KH wrote:
> So you are now hard-coding the size?
Yes, the change just helps developers who want to adapt to different screen sizes.
> Is this always going to be 0, if so, why need it at all?
Not sure. For example, when HEIGHT and WIDTH are 240 and 280, LEFT_OFFSET is 20 and TOP_OFFSET is 0. Different screens may have different offsets.
In addition, do I need to resend the patch to modify the Signed-off-by?
thanks,
purofle
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] staging: fbtft: fb_st7789v: support setting offset
2024-04-09 17:28 ` Yuguo Pei
@ 2024-04-09 17:36 ` Greg KH
0 siblings, 0 replies; 5+ messages in thread
From: Greg KH @ 2024-04-09 17:36 UTC (permalink / raw)
To: Yuguo Pei; +Cc: dri-devel, linux-fbdev, linux-staging
On Wed, Apr 10, 2024 at 01:28:06AM +0800, Yuguo Pei wrote:
> On Tue, 9 Apr 2024 17:49:25 +0200, Greg KH wrote:
> > So you are now hard-coding the size?
>
> Yes, the change just helps developers who want to adapt to different screen sizes.
So there is no change? I don't understand.
> > Is this always going to be 0, if so, why need it at all?
>
> Not sure. For example, when HEIGHT and WIDTH are 240 and 280, LEFT_OFFSET is 20 and TOP_OFFSET is 0. Different screens may have different offsets.
Then why is this needed?
Don't make changes that are not needed by anyone, especially for code in
drivers/staging/
>
> In addition, do I need to resend the patch to modify the Signed-off-by?
Of course you do :)
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2024-04-09 17:36 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-05 16:57 [PATCH] staging: fbtft: fb_st7789v: support setting offset purofle
2024-04-09 15:49 ` Greg KH
2024-04-09 17:28 ` Yuguo Pei
2024-04-09 17:36 ` Greg KH
-- strict thread matches above, loose matches on Subject: below --
2024-04-09 16:39 purofle
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).