notro/fbtft

ADS7846 wont probe spi3.0 on rk3566

qNnOtTk opened this issue · 5 comments

Hello
I am trying to get the ili9341 module to run on startup without doing insmod (fbtft folder location)/fb_ili9341.ko but I dont know how
What i did:
I installed fbtft using dkms
I added fbtft to /etc/modules
Fbtft appears in lsmod on startup which is very good
I compiled fb_ili9341.ko and added my dts file but fb_ili9341.ko wont run on startup
How do I fix this?

notro commented

modalias is used for autoloading driver modules.
Make sure that the device has been added (this is for another driver) and that the modalias matches the one in the driver:

$ cat /sys/bus/spi/devices/spi0.0/modalias
spi:mi0283qt

$ modinfo mi0283qt
[...]
alias:          spi:mi0283qt
[...]

it isn't, but i have added it in /etc/modules anyway and it works fine now
even though fbtft works now, ads7846 doesn't want to
I keep getting this error in dmesg

ads7846: probe of spi3.0 failed with error -22

*if you're wondering why its looking for spi3.0, that's because im not using a raspberry pi, but a rock CM3 from radxa. I have connected it to the cm4io board, and the spi3 bus is located on the 40 gpio pin headers which im using for the screen, more on the cm3: https://wiki.radxa.com/Rock3/CM/CM3 *

its connected to CS0, this is the dts file i used

``
/dts-v1/;
/plugin/;

/ {
compatible = "radxa,radxa-cm3-io", "rockchip,rk3566";

    fragment@0 {
            target = <&spi3>;
            __overlay__ {
                    #address-cells = <1>;
                    #size-cells = <0>;
                    ads7846@0 {
                            compatible = "ti,ads7846";
                            reg = <0>;
                            pinctrl-names = "default";
                            pinctrl-0 = <&spi3m0_cs0 &spi3m0_pins>;
                            spi-max-frequency = <50000000>;
                            interrupts = <255 2>;
                            interrupt-parent = <&gpio0>;
                            pendown-gpio = <&gpio0 18 0>;
                            ti,x-min = [00 00];
                            ti,y-min = [00 00];
                            ti,x-max = [0f ff];
                            ti,y-max = [0f ff];
                            ti,pressure-min = [00 00];
                            ti,pressure-max = [ff ff];
                            ti,x-plate-ohms = [01 90];
                    };
            };
};

};
``

notro commented

You run the SPI clock at 50MHz, I don't think the chip can handle that. The rPi overlay uses 2MHz.

I have realized that the reason it can't probe spi is because of this
image

Pin gpio4-6 (a.k.a. SPI3 CS0) is already occupied

nevermind touchscreen works now, here is overlay i used
`
/dts-v1/;
/plugin/;

/ {
compatible = "radxa,radxa-cm3-io", "rockchip,rk3566";

    fragment@0 {
            target = <&spi3>;

            __overlay__ {
                    status = "okay";
            };
    };



    fragment@1 {
            target = <&gpio0>;
                    __overlay__{
                            ads7846_pins: ads7846_pins {
                                    rockchip,pins = <0 18 0 &pcfg_pull_up>;
                                    };
                    };
            };

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

                    ads7846: ads7846@0 {
                            compatible = "ti,ads7846";
                            reg = <0>;
                            spi-max-frequency = <2000000>;
                            interrupts = <18 2>; /* high-to-low edge triggered */
                            interrupt-parent = <&gpio0>;
                            pendown-gpio = <&gpio0 18 0>;

                            /* driver defaults */
                            ti,x-min = /bits/ 16 <0>;
                            ti,y-min = /bits/ 16 <0>;
                            ti,x-max = /bits/ 16 <0x0FFF>;
                            ti,y-max = /bits/ 16 <0x0FFF>;
                            ti,pressure-min = /bits/ 16 <0>;
                            ti,pressure-max = /bits/ 16 <0xFFFF>;
                            ti,x-plate-ohms = /bits/ 16 <400>;
                    };
            };
    };

};
`