Skip to content

Instantly share code, notes, and snippets.

@piotrkundu
Forked from ankitdaf/BB-ADS7846-00A0.dts
Created November 8, 2021 10:15
Show Gist options
  • Save piotrkundu/8f1bcca5a6d9e46846b816bf5e8ce395 to your computer and use it in GitHub Desktop.
Save piotrkundu/8f1bcca5a6d9e46846b816bf5e8ce395 to your computer and use it in GitHub Desktop.
Adding XPT2046 ( ADS7846 ) Touchscreen Support to Beaglebone Black Kernel version 4.1.0-rc5-bone3
/dts-v1/;
/plugin/;
#include <dt-bindings/board/am335x-bbw-bbb-base.h>
#include <dt-bindings/pinctrl/am33xx.h>
/ {
compatible = "ti,beaglebone", "ti,beaglebone-black";
/* identification */
part-number = "BB-ADS7846";
version = "00A0";
/* state the resources this cape uses */
exclusive-use =
/* the pin header uses */
"P9.17", /* SPI0_CS0 */
"P9.18", /* SPI0_D1 */
"P9.21", /* SPI0_D0 */
"P9.22", /* SPI0_SCLK */
"P9.23"; /* pendown */
fragment@0 {
target = <&am33xx_pinmux>;
__overlay__ {
ads7846_pins:pinmux_spi0_pins {
pinctrl-single,pins = <
0x150 0x30 /* spi0_sclk, INPUT_PULLUP | MODE0 */
0x154 0x10 /* spi0_d0, OUTPUT_PULLUP | MODE0 */
0x158 0x30 /* spi0_d1, INPUT_PULLUP | MODE0 */
/* For ADS7846 */
0x15c 0x10 /* spi0_cs0, OUTPUT_PULLUP | MODE0 */
>;
};
};
};
fragment@1 {
target = <&spi0>;
__overlay__ {
#address-cells = <0x1>;
#size-cells = <0>;
status = "okay";
pinctrl-names = "default";
pinctrl-0 = <&ads7846_pins>;
ti,pindir-d0-out-d1-in = <1>;
ads7846@0 {
compatible = "ti,ads7846";
spi-max-frequency = <100000>; /* Higher frequency causes more jitter */
interrupts = <17 0>; /* pin number 17 and falling edge interrupt */
interrupt-parent = <&gpio1>;
pendown-gpio = <&gpio1 17 0>; /* This corresponds to pin no 23 = GPIO1[17]*/
reg = <0>; /* We are using chip select 0, so we enter 0 here */
#addr-size = <2>;
#page-size = <32>;
/* driver defaults */
ti,x-min = /bits/ 16 <0xB0>;
ti,y-min = /bits/ 16 <0x231>;
ti,x-max = /bits/ 16 <0xF49>;
ti,y-max = /bits/ 16 <0xF6B>;
ti,pressure-min = /bits/ 16 <0>;
ti,pressure-max = /bits/ 16 <0xFF>;
ti,x-plate-ohms = /bits/ 16 <0x96>;
ti,swap_xy = /bits/ 16 <0>;
ti,keep_vref_on = /bits/ 16 <0>;
ti,cs = /bits/ 16 <1>;
linux,wakeup;
};
};
};
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment