DRAgon715205
Posts: 116
Joined: Wed Apr 02, 2014 11:46 am

1.54LCD ST7789v fbtft display at kernel 5.4

Mon Dec 14, 2020 6:51 am

https://www.aliexpress.com/item/3297003 ... 2970035492
I use this 1.54 lcd . work well with the driver at kernel 4.9

But when I use the lastest official raspbian os . then driver not work, so I do a dts by my self

Code: Select all

/dts-v1/;
/plugin/;

/ {
        compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709";

        fragment@0 {
                target = <&spi0>;
                __overlay__ {
                        status = "okay";

                        spidev@0{
                                status = "disabled";
                        };

                        spidev@1{
                                status = "disabled";
                        };
                };
        };

        fragment@1 {
                target = <&gpio>;
                __overlay__ {
                        pitft_pins: pitft_pins {
                                brcm,pins = <22 27>;
                                brcm,function = <1 1>; /* out */
                                brcm,pull = <0>; /* none */
                        };
                };
        };

        fragment@2 {
                target = <&spi0>;
                __overlay__ {
                        /* needed to avoid dtc warning */
                        #address-cells = <1>;
                        #size-cells = <0>;

                        pitft: pitft@0{
                		compatible = "sitronix,st7789v";
                                reg = <0>;
                                pinctrl-names = "default";
                                pinctrl-0 = <&pitft_pins>;
                                spi-max-frequency = <48000000>;
                                rotate = <0>;
                                width = <240>;
                                height = <240>;
				fps = <30>;
                                buswidth = <8>;
                                reset-gpios = <&gpio 27 1>;
				dc-gpios = <&gpio 22 0>;

                                debug = <0>;
					
				init = <0x1000011
					0x20000ff
					0x1000036 0x70
					0x100003a 0x05
					0x10000b2 0x0c 0x0c 0x00 0x33 0x33
					0x10000b7 0x35
					0x10000bb 0x1a
					0x10000c0 0x2c
					0x10000c2 0x01
					0x10000c3 0x0b
					0x10000c4 0x20
					0x10000c6 0x0f
					0x10000d0 0xa4 0xa1

					0x1000021 
					0x10000e0 0x00 0x19 0x1E 0x0A 0x09 0x15 0x3D 0x44 0x51 0x12 0x03 0x00 0x3F 0x3F				
					0x10000e1 0x00 0x18 0x1E 0x0A 0x09 0x25 0x3F 0x43 0x52 0x33 0x03 0x00 0x3F 0x3F
					0x1000029>;
                        };
                };
        };


        __overrides__ {
                speed =   <&pitft>,"spi-max-frequency:0";
                rotate =  <&pitft>,"rotate:0";
                width =   <&pitft>,"width:0";
                height =  <&pitft>,"height:0";
                fps =     <&pitft>,"fps:0";
                debug =   <&pitft>,"debug:0";
        };
};
But the color not right like this
Image

the old driver at /etc/rc.local work well

Code: Select all

sudo modprobe flexfb setaddrwin=0 buswidth=8  width=240 height=240 init=-1,0x11,-2,120,-1,0x36,0x00,-1,0x3A,0x05,-1,0xB2,0x0C,0x0C,0x00,0x33,0x33,-1,0xB7,0x35,-1,0xBB,0x1A,-1,0xC0,0x2C,-1,0xC2,0x01,-1,0xC3,0x0B,-1,0xC4,0x20,-1,0xC6,0x0F,-1,0xD0,0xA4,0xA1,-1,0x21,-1,0xE0,0x00,0x19,0x1E,0x0A,0x09,0x15,0x3D,0x44,0x51,0x12,0x03,0x00,0x3F,0x3F,-1,0xE1,0x00,0x18,0x1E,0x0A,0x09,0x25,0x3F,0x43,0x52,0x33,0x03,0x00,0x3F,0x3F,-1,0x29,-3
sudo modprobe fbtft_device debug=3 rotate=90 name=flexfb speed=48000000 gpios=reset:27,dc:22

DRAgon715205
Posts: 116
Joined: Wed Apr 02, 2014 11:46 am

Re: 1.54LCD ST7789v fbtft display at kernel 5.4

Mon Dec 14, 2020 6:52 am

why is it not different between kernel 4.9 and 5.4 with the same int code ?

DRAgon715205
Posts: 116
Joined: Wed Apr 02, 2014 11:46 am

Re: 1.54LCD ST7789v fbtft display at kernel 5.4

Mon Dec 14, 2020 6:53 am

kernel 5.4 need extra other code for st7789v >?

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 13004
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: 1.54LCD ST7789v fbtft display at kernel 5.4

Mon Dec 14, 2020 11:59 am

The fbtft driver has been deprecated by the mainline Linux developers. There was some API change internally to the kernel and that meant that it wasn't feasible to keep the driver going.

ST7789V has a kernel driver - https://elixir.bootlin.com/linux/latest ... -st7789v.c
Half the parameters that you're inserting into your overlay are not supported by the driver and will just be ignored. You need to follow the device tree binding defined for the driver - https://elixir.bootlin.com/linux/v5.10- ... 7789v.yaml
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 13004
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: 1.54LCD ST7789v fbtft display at kernel 5.4

Mon Dec 14, 2020 12:08 pm

And please don't double post - viewtopic.php?f=107&t=279734
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

DRAgon715205
Posts: 116
Joined: Wed Apr 02, 2014 11:46 am

Re: 1.54LCD ST7789v fbtft display at kernel 5.4

Mon Dec 14, 2020 1:32 pm

sorry about that,

can you give a init code work well ??/

DRAgon715205
Posts: 116
Joined: Wed Apr 02, 2014 11:46 am

Re: 1.54LCD ST7789v fbtft display at kernel 5.4

Mon Dec 14, 2020 1:38 pm

see this

https://elixir.bootlin.com/linux/v5.10- ... 7789v.yaml

I not see this parameter
dc-gpios = <&gpio xx 0>;

DRAgon715205
Posts: 116
Joined: Wed Apr 02, 2014 11:46 am

Re: 1.54LCD ST7789v fbtft display at kernel 5.4

Tue Dec 15, 2020 2:58 am

I change the new int code

Code: Select all



reg = <0>;
                                pinctrl-names = "default";
                                pinctrl-0 = <&waveshare154_pins>;
                                spi-max-frequency = <48000000>;
                                rotate = <270>;
                                width = <240>;
                                height = <240>;
                                fps = <30>;
                                buswidth = <8>;

                                txbuflen = <32768>;
                                custom = <1> ;

                                reset-gpios = <&gpio 27 1>;
                                dc-gpios = <&gpio 22 0>;

                                spi-cpol;
                                spi-cpha;

                                bgr;

                                debug = <0>;

                                init = <0x1000011
                                        0x20000ff

                                        0x100003A 0x55
                                        0x10000C0 0x0C
                                        0x1000021
                                        0x1000029
                                        >;



DRAgon715205
Posts: 116
Joined: Wed Apr 02, 2014 11:46 am

Re: 1.54LCD ST7789v fbtft display at kernel 5.4

Tue Dec 15, 2020 3:02 am

change 0x10000C0 0x2C to 0x10000C0 0x0C and add bgr ;

or not change 0x10000C0 0x2C , keep it , but not add bgr ;

I get the same right color, but still have some problem. the yellow color Seems more brighter

like this

Image

DRAgon715205
Posts: 116
Joined: Wed Apr 02, 2014 11:46 am

Re: 1.54LCD ST7789v fbtft display at kernel 5.4

Tue Dec 15, 2020 3:07 am

I try to change compatible = "sitronix,st7789v"; to compatible = "ilitek,ili9340"; the color will all go right ,
but I can not change the right Display direction

DRAgon715205
Posts: 116
Joined: Wed Apr 02, 2014 11:46 am

Re: 1.54LCD ST7789v fbtft display at kernel 5.4

Wed Dec 16, 2020 7:04 am

QAQ > ? who have any idea ? thanks

xlla
Posts: 12
Joined: Tue Jul 23, 2019 4:20 pm

Re: 1.54LCD ST7789v fbtft display at kernel 5.4

Mon Dec 28, 2020 1:50 pm

I am run into same issue while upgrade to kernel 5.4.
After
change 0x10000C0 0x2C to 0x10000C0 0x0C and add bgr ;
, color looks right but the white looks slight grey.

Code: Select all

rpi4:~$ modinfo fb_st7789v
filename:       /lib/modules/5.4.83-v8/kernel/drivers/staging/fbtft/fb_st7789v.ko
license:        GPL
author:         Dennis Menschel
description:    FB driver for the ST7789V LCD Controller
alias:          platform:st7789v
alias:          spi:st7789v
alias:          platform:fb_st7789v
alias:          spi:fb_st7789v
srcversion:     7E2B0FCE6212EC23E7292BE
alias:          of:N*T*Csitronix,st7789vC*
alias:          of:N*T*Csitronix,st7789v
depends:        fbtft
staging:        Y
intree:         Y
name:           fb_st7789v
vermagic:       5.4.83-v8 SMP preempt mod_unload modversions aarch64
Should I choice
drivers/gpu/drm/panel/panel-sitronix-st7789v.c
instead of
drivers/staging/fbtft/fb_st7789v.ko
?

DRAgon715205
Posts: 116
Joined: Wed Apr 02, 2014 11:46 am

Re: 1.54LCD ST7789v fbtft display at kernel 5.4

Mon Jan 11, 2021 11:11 am

@xlla

Do you solve this problem??

Return to “Graphics, sound and multimedia”