dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] staging: fbtft: add invert display parameter
@ 2025-05-28 15:42 Bram Vlerick
  2025-05-28 19:38 ` Dan Carpenter
  2025-05-28 20:25 ` Nam Cao
  0 siblings, 2 replies; 3+ messages in thread
From: Bram Vlerick @ 2025-05-28 15:42 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: dri-devel, linux-fbdev, linux-staging, linux-kernel, Bram Vlerick

Add devicetree parameter to enable or disable the invert feature of the
ili9341 display

Signed-off-by: Bram Vlerick <bram.vlerick@openpixelsystems.org>
---
 drivers/staging/fbtft/fb_ili9341.c | 3 +++
 drivers/staging/fbtft/fbtft-core.c | 2 ++
 drivers/staging/fbtft/fbtft.h      | 3 +++
 3 files changed, 8 insertions(+)

diff --git a/drivers/staging/fbtft/fb_ili9341.c b/drivers/staging/fbtft/fb_ili9341.c
index 47e72b87d76d996111aaadcf5e56dfdfc1c331ab..a184f57df12b5ad6612a2e83b664a8911c7c79be 100644
--- a/drivers/staging/fbtft/fb_ili9341.c
+++ b/drivers/staging/fbtft/fb_ili9341.c
@@ -103,6 +103,9 @@ static int set_var(struct fbtft_par *par)
 		break;
 	}
 
+	if (par->invert)
+		write_reg(par, 0x21);
+
 	return 0;
 }
 
diff --git a/drivers/staging/fbtft/fbtft-core.c b/drivers/staging/fbtft/fbtft-core.c
index da9c64152a606dc4a176f5a37fa59f6a7d3a2af3..4e827e9899e32313f2e4a9bf12ff49283a63fed3 100644
--- a/drivers/staging/fbtft/fbtft-core.c
+++ b/drivers/staging/fbtft/fbtft-core.c
@@ -641,6 +641,7 @@ struct fb_info *fbtft_framebuffer_alloc(struct fbtft_display *display,
 	par->buf = buf;
 	spin_lock_init(&par->dirty_lock);
 	par->bgr = pdata->bgr;
+	par->invert = pdata->invert;
 	par->startbyte = pdata->startbyte;
 	par->init_sequence = init_sequence;
 	par->gamma.curves = gamma_curves;
@@ -1107,6 +1108,7 @@ static struct fbtft_platform_data *fbtft_properties_read(struct device *dev)
 	pdata->display.bpp = fbtft_property_value(dev, "bpp");
 	pdata->display.debug = fbtft_property_value(dev, "debug");
 	pdata->rotate = fbtft_property_value(dev, "rotate");
+	pdata->invert = device_property_read_bool(dev, "invert");
 	pdata->bgr = device_property_read_bool(dev, "bgr");
 	pdata->fps = fbtft_property_value(dev, "fps");
 	pdata->txbuflen = fbtft_property_value(dev, "txbuflen");
diff --git a/drivers/staging/fbtft/fbtft.h b/drivers/staging/fbtft/fbtft.h
index 317be17b95c1672404fc6aecda24d0a1f563685d..71c9c35e7548de314088ac3aeb160d6c6aaf75c9 100644
--- a/drivers/staging/fbtft/fbtft.h
+++ b/drivers/staging/fbtft/fbtft.h
@@ -125,6 +125,7 @@ struct fbtft_display {
  * @display: Display properties
  * @gpios: Pointer to an array of pinname to gpio mappings
  * @rotate: Display rotation angle
+ * @invert: Invert display colors
  * @bgr: LCD Controller BGR bit
  * @fps: Frames per second (this will go away, use @fps in @fbtft_display)
  * @txbuflen: Size of transmit buffer
@@ -135,6 +136,7 @@ struct fbtft_display {
 struct fbtft_platform_data {
 	struct fbtft_display display;
 	unsigned int rotate;
+	bool invert;
 	bool bgr;
 	unsigned int fps;
 	int txbuflen;
@@ -229,6 +231,7 @@ struct fbtft_par {
 	bool first_update_done;
 	ktime_t update_time;
 	bool bgr;
+	bool invert;
 	void *extra;
 	bool polarity;
 };

---
base-commit: 914873bc7df913db988284876c16257e6ab772c6
change-id: 20250528-ili9341-invert-dtb-07a5656e6dfd

Best regards,
-- 
Bram Vlerick <bram.vlerick@openpixelsystems.org>


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] staging: fbtft: add invert display parameter
  2025-05-28 15:42 [PATCH] staging: fbtft: add invert display parameter Bram Vlerick
@ 2025-05-28 19:38 ` Dan Carpenter
  2025-05-28 20:25 ` Nam Cao
  1 sibling, 0 replies; 3+ messages in thread
From: Dan Carpenter @ 2025-05-28 19:38 UTC (permalink / raw)
  To: Bram Vlerick
  Cc: Greg Kroah-Hartman, dri-devel, linux-fbdev, linux-staging,
	linux-kernel

On Wed, May 28, 2025 at 05:42:30PM +0200, Bram Vlerick wrote:
> Add devicetree parameter to enable or disable the invert feature of the
> ili9341 display
> 

This commit message is so unclear.  The parameter doesn't let you
--and this is a direct quote.  LOL-- "disable the invert feature".  It
would be better to say "Add devicetree parameter to invert the display
on a ili9341 device."

regards,
dan carpenter


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] staging: fbtft: add invert display parameter
  2025-05-28 15:42 [PATCH] staging: fbtft: add invert display parameter Bram Vlerick
  2025-05-28 19:38 ` Dan Carpenter
@ 2025-05-28 20:25 ` Nam Cao
  1 sibling, 0 replies; 3+ messages in thread
From: Nam Cao @ 2025-05-28 20:25 UTC (permalink / raw)
  To: Bram Vlerick
  Cc: Greg Kroah-Hartman, dri-devel, linux-fbdev, linux-staging,
	linux-kernel

On Wed, May 28, 2025 at 05:42:30PM +0200, Bram Vlerick wrote:
> Add devicetree parameter to enable or disable the invert feature of the
> ili9341 display

Can't/shouldn't this be done by userspace application? Why would someone
want to invert the color by default.

Also, this driver is built on top of the deprecated framebuffer, it will
never get out of staging/. For new feature, you probably want to send it to
drivers/gpu/drm/panel/panel-ilitek-ili9341.c instead.

> Signed-off-by: Bram Vlerick <bram.vlerick@openpixelsystems.org>
> ---
>  drivers/staging/fbtft/fb_ili9341.c | 3 +++
>  drivers/staging/fbtft/fbtft-core.c | 2 ++
>  drivers/staging/fbtft/fbtft.h      | 3 +++
>  3 files changed, 8 insertions(+)
> 
> diff --git a/drivers/staging/fbtft/fb_ili9341.c b/drivers/staging/fbtft/fb_ili9341.c
> index 47e72b87d76d996111aaadcf5e56dfdfc1c331ab..a184f57df12b5ad6612a2e83b664a8911c7c79be 100644
> --- a/drivers/staging/fbtft/fb_ili9341.c
> +++ b/drivers/staging/fbtft/fb_ili9341.c
> @@ -103,6 +103,9 @@ static int set_var(struct fbtft_par *par)
>  		break;
>  	}
>  
> +	if (par->invert)
> +		write_reg(par, 0x21);

Use MIPI_DCS_ENTER_INVERT_MODE instead of the magic number.

Best regards,
Nam

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-05-29  8:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-28 15:42 [PATCH] staging: fbtft: add invert display parameter Bram Vlerick
2025-05-28 19:38 ` Dan Carpenter
2025-05-28 20:25 ` Nam Cao

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