@@ -103,6 +103,9 @@ static int set_var(struct fbtft_par *par)
break;
}
+ if (par->invert)
+ write_reg(par, 0x21);
+
return 0;
}
@@ -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");
@@ -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;
};
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(+) --- base-commit: 914873bc7df913db988284876c16257e6ab772c6 change-id: 20250528-ili9341-invert-dtb-07a5656e6dfd Best regards,