From f88ec3154e94c005c307c9de3d67cc1647c36c35 Mon Sep 17 00:00:00 2001 From: Dave Stevenson Date: Wed, 2 Apr 2025 12:37:08 +0100 Subject: [PATCH 1/2] dtoverlays: Add invx and invy overrides to ads7846 touch overlay It had swapxy, but no way to trigger the X and Y inversions Also use the generic "touchscreen-swapped-x-y" for swapxy instead of the TI specific "ti,swap-xy". Signed-off-by: Dave Stevenson --- arch/arm/boot/dts/overlays/README | 2 ++ arch/arm/boot/dts/overlays/ads7846-overlay.dts | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/arch/arm/boot/dts/overlays/README b/arch/arm/boot/dts/overlays/README index 12e4a974937dfb..fb3667764c2834 100644 --- a/arch/arm/boot/dts/overlays/README +++ b/arch/arm/boot/dts/overlays/README @@ -602,6 +602,8 @@ Params: cs SPI bus Chip Select (default 1) pmax Maximum reported pressure value (default 65535) xohms Touchpanel sensitivity (X-plate resistance) (default 400) + invx Invert x axis + invy Invert y axis penirq is required and usually xohms (60-100) has to be set as well. Apart from that, pmax (255) and swapxy are also common. diff --git a/arch/arm/boot/dts/overlays/ads7846-overlay.dts b/arch/arm/boot/dts/overlays/ads7846-overlay.dts index 211a002c0b3447..cb3e3bf6c09830 100644 --- a/arch/arm/boot/dts/overlays/ads7846-overlay.dts +++ b/arch/arm/boot/dts/overlays/ads7846-overlay.dts @@ -77,7 +77,7 @@ <&ads7846>,"interrupts:0", <&ads7846>,"pendown-gpio:4"; penirq_pull = <&ads7846_pins>,"brcm,pull:0"; - swapxy = <&ads7846>,"ti,swap-xy?"; + swapxy = <&ads7846>,"touchscreen-swapped-x-y?"; xmin = <&ads7846>,"ti,x-min;0"; ymin = <&ads7846>,"ti,y-min;0"; xmax = <&ads7846>,"ti,x-max;0"; @@ -85,5 +85,7 @@ pmin = <&ads7846>,"ti,pressure-min;0"; pmax = <&ads7846>,"ti,pressure-max;0"; xohms = <&ads7846>,"ti,x-plate-ohms;0"; + invx = <&ads7846>,"touchscreen-inverted-x?"; + invy = <&ads7846>,"touchscreen-inverted-y?"; }; }; From ed8d56b2c74df9df04d699a0c0db0d4bef7e8649 Mon Sep 17 00:00:00 2001 From: Dave Stevenson Date: Wed, 2 Apr 2025 12:38:46 +0100 Subject: [PATCH 2/2] dtoverlays: Make piscreen consistent on swapxy The overlay had the TI proprietary "ti,swap-xy" defined by default, but the override for swapxy then used the generic "touchscreen-swapped-x-y" Swap the default to use "touchscreen-swapped-x-y" to make the configuration consistent. Signed-off-by: Dave Stevenson --- arch/arm/boot/dts/overlays/piscreen-overlay.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/boot/dts/overlays/piscreen-overlay.dts b/arch/arm/boot/dts/overlays/piscreen-overlay.dts index bd389c8a5e51f3..24302314323b37 100644 --- a/arch/arm/boot/dts/overlays/piscreen-overlay.dts +++ b/arch/arm/boot/dts/overlays/piscreen-overlay.dts @@ -88,7 +88,7 @@ interrupts = <17 2>; /* high-to-low edge triggered */ interrupt-parent = <&gpio>; pendown-gpio = <&gpio 17 GPIO_ACTIVE_LOW>; - ti,swap-xy; + touchscreen-swapped-x-y; ti,x-plate-ohms = /bits/ 16 <100>; ti,pressure-max = /bits/ 16 <255>; };