Created
August 16, 2018 22:06
-
-
Save JasonLS/d72bbfa58cda8b5170f781cff8e920ff to your computer and use it in GitHub Desktop.
BBORG_DISPLAY18-00A2.txt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Copyright (C) 2013 CircuitCo | |
* Copyright (C) 2018 Drew Fustini <[email protected]> | |
* | |
* Adafruit 1.8" TFT LCD on SPI1 bus using tinydrm st7735r 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. | |
* | |
* This is the Adafruit 1.8" TFT LCD: | |
* https://www.adafruit.com/products/358 | |
* | |
* It should be connected to BeagleBone SPI1 bus: | |
* | |
* P9.12 <--> reset | |
* P9.14 <--> lite (pwm) [OPTIONAL] | |
* P9.15 <--> dc | |
* P9.23 <--> lite (gpio) [OPTIONAL] | |
* P9.28 <--> tft_cs | |
* P9.30 <--> mosi | |
* P9.31 <--> clk | |
* | |
* This overlay will load the mainline tinydrm st7735r driver by David Lechner: | |
* https://github.com/torvalds/linux/blob/master/drivers/gpu/drm/tinydrm/st7735r.c | |
* | |
* Tested with 4.16.0-rc2-bone3 kernel on Debian 9.3 image | |
* | |
* Run libdrm modetest for colorbar test based on instructions from: | |
* https://github.com/notro/tinydrm/wiki/Development#modetest | |
* | |
* modetest -M "st7735r" -c #this will display connector id | |
* modetest -M "st7735r" -s 28:128x160 #connector id and resolution | |
* # you should now see a color bar on the LCD | |
* | |
* Mailing list post with more information: | |
* https://groups.google.com/d/msg/beagleboard/GuMQIP_XCW0/b3lxbx_8AwAJ | |
* | |
* GitHub Gist with testing results: | |
* https://gist.github.com/pdp7/aee5664598059c9b9a9020f107957f80 | |
* | |
* 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/; | |
/ { | |
/* | |
* Free up the pins used by the cape from the pinmux helpers. | |
*/ | |
fragment@0 { | |
target = <&ocp>; | |
__overlay__ { | |
P8_35_pinmux { status = "disabled"; }; /* LEDs - 1 */ | |
P8_37_pinmux { status = "disabled"; }; /* LEDs - 2 */ | |
P9_17_pinmux { status = "disabled"; }; /* LCD - CS */ | |
P9_22_pinmux { status = "disabled"; }; /* LCD - SCLK */ | |
P9_18_pinmux { status = "disabled"; }; /* LCD - MOSI? */ | |
P9_21_pinmux { status = "disabled"; }; /* LCD - MISO? */ | |
P8_33_pinmux { status = "disabled"; }; /* LCD - DC */ | |
P8_31_pinmux { status = "disabled"; }; /* LCD - RST */ | |
P8_29_pinmux { status = "disabled"; }; /* button - 1 */ | |
P8_27_pinmux { status = "disabled"; }; /* button - 2 */ | |
P8_30_pinmux { status = "disabled"; }; /* button - 3 */ | |
P8_28_pinmux { status = "disabled"; }; /* button - 4 */ | |
P9_12_pinmux { status = "disabled"; }; /* button - 5 */ | |
P8_8_pinmux { status = "disabled"; }; /* button - 6 */ | |
P8_7_pinmux { status = "disabled"; }; /* button - 7 */ | |
P8_43_pinmux { status = "disabled"; }; /* button - 8 */ | |
}; | |
}; | |
fragment@1 { | |
target = <&am33xx_pinmux>; | |
__overlay__ { | |
/* default state has all gpios released and mode set to uart1 */ | |
bb_spi1_pins: pinmux_bb_spi1_pins { | |
pinctrl-single,pins = < | |
0x190 0x33 /* mcasp0_aclkx.spi1_sclk, INPUT_PULLUP | MODE3 */ | |
0x194 0x33 /* mcasp0_fsx.spi1_d0, INPUT_PULLUP | MODE3 */ | |
0x198 0x13 /* mcasp0_axr0.spi1_d1, OUTPUT_PULLUP | MODE3 */ | |
0x19c 0x13 /* mcasp0_ahclkr.spi1_cs0, OUTPUT_PULLUP | MODE3 */ | |
// 0x164 0x12 /* eCAP0_in_PWM0_out.spi1_cs1 OUTPUT_PULLUP | MODE2 */ | |
>; | |
}; | |
backlight_pwm_pins: pinmux_backlight_pwm_pins { | |
pinctrl-single,pins = < | |
BONE_P9_14 0x06 /* gpmc_a2.ehrpwm1a, OMAP_MUX_MODE6 | AM33XX_PIN_OUTPUT */ | |
>; | |
}; /* gpmc_a2.ehrpwm1a */ | |
}; | |
}; | |
fragment@2 { | |
target = <&epwmss1>; | |
__overlay__ { | |
status = "okay"; | |
}; | |
}; | |
fragment@3 { | |
target = <&ehrpwm1>; | |
__overlay__ { | |
pinctrl-names = "default"; | |
pinctrl-0 = <&backlight_pwm_pins>; | |
status = "okay"; | |
}; | |
}; | |
fragment@4 { | |
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/devices/platform/backlight_pwm/backlight/backlight_pwm/bl_power | |
*/ | |
backlight_pwm: backlight_pwm { | |
// P9.14 <--> lite (pwm-backlight EHRPWM1A) | |
status = "okay"; | |
compatible = "pwm-backlight"; | |
pwms = <&ehrpwm1 0 500000 0>; | |
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@5 { | |
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 = <&gpio4 9 0>; // lcd dc P8.33 gpio4[9] | |
reset-gpios = <&gpio4 10 0>; // lcd reset P8.31 gpio4[10] | |
// backlight is optional | |
// choose either pwm or gpio control | |
backlight = <&backlight_gpio>; // lcd lite P8.9 gpio2[69] | |
//backlight = <&backlight_pwm>; // lcd lite P9.14 gpmc_a2.ehrpwm1a | |
// refer to https://elinux.org/Beagleboard:Cape_Expansion_Headers | |
// rotation is optional | |
// rotation = <270>; | |
}; | |
}; | |
}; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment