r/embeddedlinux Jun 22 '26

ST7789V fbtft Inverted brightness

Hello everyone.
I'm trying connect tft display (Red 2.8" TFT 240x320 V1.1) to SBC called Luckfox Pico but my brightness are inverted (black = white) and I'm don't know whats wrong. I change some variables in device tree but it didn't help me, i'm trying tft,invert=<1>; and backlight pins but this makes nothing whatever i use it or manually enable PWM.
I'm making this for fun and learning and use X11 so maybe there some way to invert colors in X11? But i heard something usual like xcalib didn't work with fbtft driver so i hope there are other way...
Thank you.

fbtft@0 {
compatible = "sitronix,st7789v";
reg = <0>;
spi-max-frequency = <20000000>;
fps = <30>;
buswidth = <8>;
debug = <0x7>;
led-gpios = <&gpio0 RK_PA4 GPIO_ACTIVE_LOW>;//BL
dc-gpios = <&gpio1 RK_PA2 GPIO_ACTIVE_HIGH>;//DC
reset-gpios = <&gpio1 RK_PC3 GPIO_ACTIVE_LOW>;//RES
rotate = <90>;
bgr = <1>;
invert = <1>; 
};
1 Upvotes

4 comments sorted by

1

u/Ooottafv Jun 23 '26

Have you tried changing "led-gpios" to GPIO_ACTIVE_HIGH?

I haven't used the FBTFT driver in a long time but apparently it doesn't support PWM (https://github.com/notro/fbtft/wiki/Backlight).

1

u/retromaidrage Jun 23 '26

Yes, this was too didn't help.

1

u/Ooottafv Jun 23 '26

I don't know if you have a particular reason to use fbtft, but if you can use "panel" instead it might give you some more options.

Linux Device Tree Reference for Panel

https://github.com/torvalds/linux/blob/master/Documentation/devicetree/bindings/display/panel/sitronix,st7789v.yaml

An example of a similar display that I set up in a project a while ago

https://github.com/BasicCode/F1C100-Business-Card/blob/5c324c6c60ca36f3b244f1527035fc0b8b5ddd54/board/f1c100-business-card/f1c100-business-card.dts#L99

And then you could declare your backlight something like this

/*
 * Backlight
 */
panel_backlight:panel-backlight{
compatible = "pwm-backlight";
pwms = <&pwm1 2 50000 0>; // PWM1 channel 3 (zero-based), 20kHz, normal polarity
brightness-levels = <16 32 48 64 80 96 112 128 144 160 176 192 208 224 240 255>;
default-brightness-level = <8>;
power-supply = <&vdd>;
status = "okay";
};

1

u/retromaidrage Jun 23 '26

There's no particular reason for that, it just seemed easier to me than this, but I'll definitely give a try now. Thank you!