Thank you, that helped me set up a very basic device-tree overlay that inverts the CS signal. I put here my device-tree so that other people with the same problem can benefit from this knowledge:Then changed the overlay for having CS configured ACTIVE_HIGH (cs-gpios = <&gpio 8 0>; 0 is the GPIO_ACTIVE_HIGH; also requires 'spi-cs-high' in the SPI device node (the 4in panel in my example))Code:
/* * spi0-1cs-4in-cs-high-overlay.dts *//dts-v1/;/plugin/;#include <dt-bindings/gpio/gpio.h>/ {compatible = "brcm,bcm2835";fragment@0 {target = <&spi0_cs_pins>;frag0: __overlay__ {brcm,pins = <8>;};};fragment@1 {target = <&spi0>;frag1: __overlay__ {cs-gpios = <&gpio 8 0>;status = "okay";};};fragment@2 {target = <&spidev0>;__overlay__ {status = "disabled";};};fragment@3 {target = <&spidev1>;__overlay__ {status = "disabled";};};fragment@4 {target = <&spi0_pins>;__dormant__ {brcm,pins = <10 11>;};};fragment@10 {target = <&gpio>;__overlay__ {control_lcd0: control_lcd0 {brcm,pins = <24 25>;brcm,function = <1 1>; /* out out*/};};};fragment@12 {target = <&spi0>;__overlay__ {/* needed to avoid dtc warning */#address-cells = <1>;#size-cells = <0>;status = "okay";panel_lcd0: panel@0 {compatible = "4in", "panel-mipi-dbi-spi";reg = <0>;pinctrl-names = "default";pinctrl-0 = <&control_lcd0>;spi-max-frequency = <48000000>;write-only;spi-cpha;spi-cpol;spi-cs-high;reset-gpios = <&gpio 24 GPIO_ACTIVE_HIGH>;dc-gpios = <&gpio 25 GPIO_ACTIVE_HIGH>;width-mm = <84>;height-mm = <56>;timing0: panel-timing {hactive = <480>;vactive = <320>;hback-porch = <0>;vback-porch = <0>;clock-frequency = <0>;hfront-porch = <0>;hsync-len = <0>;vfront-porch = <0>;vsync-len = <0>;};};};};fragment@100 {target = <&panel_lcd0>;__dormant__ {backlight = <&backlight>;};};fragment@101 {target-path = "/";__dormant__ {backlight: backlight@0 {reg = <0>;compatible = "gpio-backlight";status = "okay";};};};__overrides__ {compatible= <&panel_lcd0>, "compatible";cs0_pin= <&frag0>,"brcm,pins:0",<&frag1>,"cs-gpios:4";no_miso= <0>,"=3";speed = <&panel_lcd0>, "spi-max-frequency:0";cpha = <&panel_lcd0>, "spi-cpha?";cpol = <&panel_lcd0>, "spi-cpol?";write-only = <&panel_lcd0>, "write-only?";x-offset = <&timing0>, "hback-porch:0";y-offset = <&timing0>, "vback-porch:0";clock-frequency = <&timing0>, "clock-frequency:0";width-mm = <&panel_lcd0>, "width-mm:0";height-mm = <&panel_lcd0>, "height-mm:0";reset_pin= <&panel_lcd0>, "reset-gpios:0=", <&gpio>,<&panel_lcd0>, "reset-gpios:4",<&panel_lcd0>, "reset-gpios:8=0"; /* GPIO_ACTIVE_HIGH */dc_pin= <&panel_lcd0>, "dc-gpios:0=", <&gpio>,<&panel_lcd0>, "dc-gpios:4",<&panel_lcd0>, "dc-gpios:8=0"; /* GPIO_ACTIVE_HIGH */led_pin= <0>, "+100+101",<&backlight>, "gpios:0=", <&gpio>,<&backlight>, "gpios:4",<&backlight>, "gpios:8=0"; /* GPIO_ACTIVE_HIGH */};};
Code:
/dts-v1/;/plugin/;/ {compatible = "brcm,bcm2835";fragment@0 {target = <&spi0_cs_pins>;frag0: __overlay__ {brcm,pins = <8>;};};fragment@1 {target = <&spi0>;frag1: __overlay__ {cs-gpios = <&gpio 8 0>;status = "okay";};};fragment@2 {target = <&spidev1>;__overlay__ {status = "disabled";};};fragment@3 {target = <&spi0_pins>;__dormant__ {brcm,pins = <10 11>;};};fragment@4 {target = <&spidev0>;__overlay__ {write-only;spi-cs-high;};};__overrides__ {cs0_pin = <&frag0>,"brcm,pins:0", <&frag1>,"cs-gpios:4";no_miso = <0>,"=3";};};
Statistics: Posted by exxe — Wed Nov 06, 2024 10:00 am