summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark A. Yoder <Mark.A.Yoder@Rose-Hulman.edu>2020-11-04 14:40:24 -0500
committerMark A. Yoder <Mark.A.Yoder@Rose-Hulman.edu>2020-11-04 14:40:24 -0500
commit40fe95563af25e06f236536c5dd81dcc830989ef (patch)
tree34cddc853b759537a0debf15ac09b3ad0e89dc87
parent676460cbf9e202d9d9444294f5aea8fe47815119 (diff)
Added 1.8" LCD Adafruit on SPI0
-rw-r--r--src/arm/BB-LCD-ADAFRUIT-18-SPI0-00A0.dts203
-rw-r--r--src/arm/BB-LCD-ADAFRUIT-24-SPI0-00A0.dts10
-rw-r--r--src/arm/BB-LCD-ADAFRUIT-24-SPI1-00A0.dts4
3 files changed, 210 insertions, 7 deletions
diff --git a/src/arm/BB-LCD-ADAFRUIT-18-SPI0-00A0.dts b/src/arm/BB-LCD-ADAFRUIT-18-SPI0-00A0.dts
new file mode 100644
index 0000000..2b958ba
--- /dev/null
+++ b/src/arm/BB-LCD-ADAFRUIT-18-SPI0-00A0.dts
@@ -0,0 +1,203 @@
+/*
+ * Copyright (C) 2013 CircuitCo
+ * Copyright (C) 2018 Drew Fustini <drew@beagleboard.org>
+ * Copyright (C) 2020 Mark A. Yoder <mark.a.yoder@beagleboard.org>
+ *
+ * Adafruit 21.8 TFT LCD on SPI0 bus using tinydrm ili9341 driver
+ *
+ * LICENSE:
+ * --------
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * DOCUMENTATION:
+ * --------------
+ * This file was copied from src/arm/BB-SPIDEV1-00A0.dts and modified
+ * by Drew Fustini based on an exmample from David Lechner.
+ * Later modified by Mark A. Yoder for the 2.4" LCD.
+ *
+ * This is the Adafruit 1.8" TFT LCD:
+ * https://www.adafruit.com/product/358
+ *
+ * It should be connected to BeagleBone SPI0 bus:
+ *
+ * P9.16 <--> lite (pwm) [OPTIONAL]
+ * P9.17 <--> tft_cs
+ * P9.18 <--> mosi
+ * P9.19 <--> dc
+ * P9.20 <--> reset
+ * P9.22 <--> clk
+ * P9.23 <--> lite (gpio) [OPTIONAL]
+ *
+ * This overlay will load the mainline tinydrm ili9341 driver by David Lechner:
+ * https://github.com/torvalds/linux/blob/master/drivers/gpu/drm/tiny/ili9341.c
+ *
+ * Tested with 4.19.59-ti-r26 kernel on Debian 10.1 image
+ *
+ * Mailing list post with more information:
+ * https://groups.google.com/d/msg/beagleboard/GuMQIP_XCW0/b3lxbx_8AwAJ
+ *
+ * Discussion with notro on how to test tinydrm driver:
+ * https://github.com/notro/tinydrm/issues/1#issuecomment-367279037
+ */
+
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/pinctrl/am33xx.h>
+#include <dt-bindings/board/am335x-bbw-bbb-base.h>
+
+/dts-v1/;
+/plugin/;
+
+/ {
+ /*
+ * Helper to show loaded overlays under: /proc/device-tree/chosen/overlays/
+ */
+ fragment@0 {
+ target-path="/";
+ __overlay__ {
+
+ chosen {
+ overlays {
+ BB-LCD-ADAFRUIT-18-SPI0-00A0 = __TIMESTAMP__;
+ };
+ };
+ };
+ };
+
+ /*
+ * Free up the pins used by the cape from the pinmux helpers.
+ */
+
+ fragment@1 {
+ target = <&ocp>;
+ __overlay__ {
+ P9_16_pinmux { status = "disabled"; }; /* lcd pwm backlight (OPTIONAL) */
+ P9_19_pinmux { status = "disabled"; }; /* lcd dc */
+ P9_20_pinmux { status = "disabled"; }; /* lcd reset */
+ // P9_23_pinmux { status = "disabled"; }; /* lcd gpio backlight (OPTIONAL) */
+ P9_17_pinmux { status = "disabled"; }; /* spi0_cs0 */
+ P9_21_pinmux { status = "disabled"; }; /* spi0_d0 */
+ P9_18_pinmux { status = "disabled"; }; /* spi0_d1 */
+ P9_22_pinmux { status = "disabled"; }; /* spi0_sclk */
+ };
+ };
+
+ fragment@2 {
+ target = <&am33xx_pinmux>;
+ __overlay__ {
+ /* default state has all gpios released and mode set to uart1 */
+ /* See page 1446 of am35xx TRM */
+ bb_spi0_pins: pinmux_bb_spi0_pins {
+ pinctrl-single,pins = <
+ BONE_P9_22 0x30 /* mcasp0_aclkx.spi0_sclk, INPUT_PULLUP | MODE0 */
+ BONE_P9_21 0x30 /* mcasp0_fsx.spi0_d0, INPUT_PULLUP | MODE0 */
+ BONE_P9_18 0x10 /* mcasp0_axr0.spi0_d1, OUTPUT_PULLUP | MODE0 */
+ BONE_P9_17 0x10 /* mcasp0_ahclkr.spi0_cs0, OUTPUT_PULLUP | MODE0 */
+ BONE_P9_19 0x17 /* gpio, dc, OUTPUT_PULLUP | MODE07*/
+ BONE_P9_20 0x17 /* gpio, reset, OUTPUT_PULLUP | MODE07*/
+ // No cs1 for spi0
+ >;
+ };
+
+ backlight_pwm_pins: pinmux_backlight_pwm_pins {
+ pinctrl-single,pins = <
+ BONE_P9_16 0x06 /* gpmc_a2.ehrpwm1b, OMAP_MUX_MODE6 | AM33XX_PIN_OUTPUT */
+ >;
+ }; /* gpmc_a2.ehrpwm1b */
+ };
+ };
+
+ fragment@3 {
+ target = <&epwmss1>;
+ __overlay__ {
+ status = "okay";
+ };
+ };
+
+ fragment@4 {
+ target = <&ehrpwm1>;
+ __overlay__ {
+ pinctrl-names = "default";
+ pinctrl-0 = <&backlight_pwm_pins>;
+ status = "okay";
+ };
+ };
+
+ fragment@5 {
+ target-path = "/";
+ __overlay__ {
+
+ bl_reg: backlight-regulator {
+ compatible = "regulator-fixed";
+ regulator-name = "backlight";
+ regulator-always-on;
+ regulator-boot-on;
+ };
+
+ /* backlight is optional */
+ backlight_gpio: backlight_gpio {
+ compatible = "gpio-backlight";
+ gpios = <&gpio1 17 GPIO_ACTIVE_HIGH>;
+ // connect lcd lite pin to P9.23 which is gpio1[17]
+ // refer to https://elinux.org/Beagleboard:Cape_Expansion_Headers
+ };
+
+ /*
+ * Turn the PWM backlight on by setting bl_power to 0:
+ * echo 0 > /sys/class/backlight/backlight_pwm/bl_power
+ */
+ backlight_pwm: backlight_pwm {
+ // P9.16 <--> lite (pwm-backlight EHRPWM1A)
+ status = "okay";
+ compatible = "pwm-backlight";
+ pwms = <&ehrpwm1 1 500000 0>; // First digit: 0 for A side of pwm, 1 for B side
+ // 500000 is the PWM period in ns
+ // https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/devicetree/bindings/pwm/pwm.txt
+ brightness-levels = <
+ 0 1 2 3 4 5 6 7 8 9
+ 10 11 12 13 14 15 16 17 18 19
+ 20 21 22 23 24 25 26 27 28 29
+ 30 31 32 33 34 35 36 37 38 39
+ 40 41 42 43 44 45 46 47 48 49
+ 50 51 52 53 54 55 56 57 58 59
+ 60 61 62 63 64 65 66 67 68 69
+ 70 71 72 73 74 75 76 77 78 79
+ 80 81 82 83 84 85 86 87 88 89
+ 90 91 92 93 94 95 96 97 98 99
+ 100
+ >;
+ default-brightness-level = <100>;
+ power-supply = <&bl_reg>;
+ };
+ };
+ };
+
+ fragment@6 {
+ target = <&spi0>;
+ __overlay__ {
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ status = "okay";
+ pinctrl-names = "default";
+ pinctrl-0 = <&bb_spi0_pins>;
+
+ display@0{
+ status = "okay";
+ compatible = "jianda,jd-t18003-t01", "sitronix,st7735r";
+ reg = <0>;
+ spi-max-frequency = <16000000>;
+ dc-gpios = <&gpio0 13 0>; // lcd dc P9.19 gpio0[13]
+ reset-gpios = <&gpio0 12 0>; // lcd reset P9.20 gpio0[12]
+ // backlight is optional
+ // choose either pwm or gpio control
+ //backlight = <&backlight_gpio>; // lcd lite P9.23 gpio1[17]
+ backlight = <&backlight_pwm>; // lcd lite P9.16 gpmc_a2.ehrpwm1b
+ // refer to https://elinux.org/Beagleboard:Cape_Expansion_Headers
+ // rotation is optional
+ rotation = <90>;
+ };
+ };
+ };
+};
diff --git a/src/arm/BB-LCD-ADAFRUIT-24-SPI0-00A0.dts b/src/arm/BB-LCD-ADAFRUIT-24-SPI0-00A0.dts
index cbbaf5b..568ff32 100644
--- a/src/arm/BB-LCD-ADAFRUIT-24-SPI0-00A0.dts
+++ b/src/arm/BB-LCD-ADAFRUIT-24-SPI0-00A0.dts
@@ -22,14 +22,14 @@
*
* It should be connected to BeagleBone SPI0 bus:
*
- * P9.20 <--> reset
* P9.16 <--> lite (pwm) [OPTIONAL]
- * P9.19 <--> dc
- * P9.23 <--> lite (gpio) [OPTIONAL]
* P9.17 <--> tft_cs
* P9.18 <--> mosi
+ * P9.19 <--> dc
+ * P9.20 <--> reset
* P9.21 <--> miso
* P9.22 <--> clk
+ * P9.23 <--> lite (gpio) [OPTIONAL]
*
* This overlay will load the mainline tinydrm ili9341 driver by David Lechner:
* https://github.com/torvalds/linux/blob/master/drivers/gpu/drm/tiny/ili9341.c
@@ -80,10 +80,10 @@
fragment@1 {
target = <&ocp>;
__overlay__ {
- P9_20_pinmux { status = "disabled"; }; /* lcd reset */
P9_16_pinmux { status = "disabled"; }; /* lcd pwm backlight (OPTIONAL) */
P9_19_pinmux { status = "disabled"; }; /* lcd dc */
- /* P9_23_pinmux { status = "disabled"; }; /* lcd gpio backlight (OPTIONAL) */
+ P9_20_pinmux { status = "disabled"; }; /* lcd reset */
+ // P9_23_pinmux { status = "disabled"; }; /* lcd gpio backlight (OPTIONAL) */
P9_17_pinmux { status = "disabled"; }; /* spi0_cs0 */
P9_21_pinmux { status = "disabled"; }; /* spi0_d0 */
P9_18_pinmux { status = "disabled"; }; /* spi0_d1 */
diff --git a/src/arm/BB-LCD-ADAFRUIT-24-SPI1-00A0.dts b/src/arm/BB-LCD-ADAFRUIT-24-SPI1-00A0.dts
index 05be7b7..3451ddd 100644
--- a/src/arm/BB-LCD-ADAFRUIT-24-SPI1-00A0.dts
+++ b/src/arm/BB-LCD-ADAFRUIT-24-SPI1-00A0.dts
@@ -22,10 +22,10 @@
*
* It should be connected to BeagleBone SPI1 bus:
*
- * P9.25 <--> reset
* P9.16 <--> lite (pwm) [OPTIONAL]
- * P9.27 <--> dc
* P9.23 <--> lite (gpio) [OPTIONAL]
+ * P9.25 <--> reset
+ * P9.27 <--> dc
* P9.28 <--> tft_cs
* P9.29 <--> miso
* P9.30 <--> mosi