]> git.ipfire.org Git - thirdparty/openwrt.git/blob
db5f472ff0be8214eddbf15f25002a134142a38a
[thirdparty/openwrt.git] /
1 From e94e761305fa2281718adcf625d78f3cf662e12d Mon Sep 17 00:00:00 2001
2 From: Dave Stevenson <dave.stevenson@raspberrypi.com>
3 Date: Thu, 1 Aug 2024 18:12:50 +0100
4 Subject: [PATCH 1206/1215] dtoverlays: Add overlay for HD44780 via I2C PCF8574
5 backpack
6
7 Many HD44780 LCD displays are connected via very common I2C
8 GPIO expander.
9 We have an overlay for connecting the displays directly to GPIOs,
10 but not one for it connected via a backpack. Add such an overlay.
11
12 Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
13 ---
14 arch/arm/boot/dts/overlays/Makefile | 1 +
15 arch/arm/boot/dts/overlays/README | 27 +++++++++
16 .../dts/overlays/hd44780-i2c-lcd-overlay.dts | 57 +++++++++++++++++++
17 3 files changed, 85 insertions(+)
18 create mode 100644 arch/arm/boot/dts/overlays/hd44780-i2c-lcd-overlay.dts
19
20 --- a/arch/arm/boot/dts/overlays/Makefile
21 +++ b/arch/arm/boot/dts/overlays/Makefile
22 @@ -82,6 +82,7 @@ dtbo-$(CONFIG_ARCH_BCM2835) += \
23 gpio-no-irq.dtbo \
24 gpio-poweroff.dtbo \
25 gpio-shutdown.dtbo \
26 + hd44780-i2c-lcd.dtbo \
27 hd44780-lcd.dtbo \
28 hdmi-backlight-hwhack-gpio.dtbo \
29 hifiberry-amp.dtbo \
30 --- a/arch/arm/boot/dts/overlays/README
31 +++ b/arch/arm/boot/dts/overlays/README
32 @@ -1705,6 +1705,33 @@ Params: gpio_pin GPIO pin
33 (default 100)
34
35
36 +Name: hd44780-i2c-lcd
37 +Info: Configures an HD44780 compatible LCD display connected via a PCF8574 as
38 + is often found as a backpack interface for these displays.
39 +Load: dtoverlay=hd44780-i2c-lcd,<param>=<val>
40 +Params: addr I2C address of PCF8574
41 + pin_d4 GPIO pin for data pin D4 (default 4)
42 +
43 + pin_d5 GPIO pin for data pin D5 (default 5)
44 +
45 + pin_d6 GPIO pin for data pin D6 (default 6)
46 +
47 + pin_d7 GPIO pin for data pin D7 (default 7)
48 +
49 + pin_en GPIO pin for "Enable" (default 2)
50 +
51 + pin_rs GPIO pin for "Register Select" (default 0)
52 +
53 + pin_rw GPIO pin for R/W select (default 1)
54 +
55 + pin_bl GPIO pin for enabling/disabling the display
56 + backlight. (default 3)
57 +
58 + display_height Height of the display in characters (default 2)
59 +
60 + display_width Width of the display in characters (default 16)
61 +
62 +
63 Name: hd44780-lcd
64 Info: Configures an HD44780 compatible LCD display. Uses 4 gpio pins for
65 data, 2 gpio pins for enable and register select and 1 optional pin
66 --- /dev/null
67 +++ b/arch/arm/boot/dts/overlays/hd44780-i2c-lcd-overlay.dts
68 @@ -0,0 +1,57 @@
69 +/dts-v1/;
70 +/plugin/;
71 +
72 +/ {
73 + compatible = "brcm,bcm2835";
74 +
75 + fragment@0 {
76 + target = <&i2c_arm>;
77 + __overlay__ {
78 + status = "okay";
79 +
80 + pcf857x: pcf857x@27 {
81 + compatible = "nxp,pcf8574";
82 + reg = <0x27>;
83 + gpio-controller;
84 + #gpio-cells = <2>;
85 + status = "okay";
86 + };
87 + };
88 + };
89 +
90 + fragment@1 {
91 + target-path = "/";
92 + __overlay__ {
93 + lcd_screen: auxdisplay {
94 + compatible = "hit,hd44780";
95 +
96 + data-gpios = <&pcf857x 4 0>,
97 + <&pcf857x 5 0>,
98 + <&pcf857x 6 0>,
99 + <&pcf857x 7 0>;
100 + enable-gpios = <&pcf857x 2 0>;
101 + rs-gpios = <&pcf857x 0 0>;
102 + rw-gpios = <&pcf857x 1 0>;
103 + backlight-gpios = <&pcf857x 3 0>;
104 +
105 + display-width-chars = <16>;
106 + display-height-chars = <2>;
107 + };
108 + };
109 + };
110 +
111 + __overrides__ {
112 + pin_d4 = <&lcd_screen>,"data-gpios:4";
113 + pin_d5 = <&lcd_screen>,"data-gpios:16";
114 + pin_d6 = <&lcd_screen>,"data-gpios:28";
115 + pin_d7 = <&lcd_screen>,"data-gpios:40";
116 + pin_en = <&lcd_screen>,"enable-gpios:4";
117 + pin_rs = <&lcd_screen>,"rs-gpios:4";
118 + pin_rw = <&lcd_screen>,"rw-gpios:4";
119 + pin_bl = <&lcd_screen>,"backlight-gpios:4";
120 + display_height = <&lcd_screen>,"display-height-chars:0";
121 + display_width = <&lcd_screen>,"display-width-chars:0";
122 + addr = <&pcf857x>,"reg:0";
123 + };
124 +
125 +};