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
7 Many HD44780 LCD displays are connected via very common I2C
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.
12 Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
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
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) += \
26 + hd44780-i2c-lcd.dtbo \
28 hdmi-backlight-hwhack-gpio.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
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)
43 + pin_d5 GPIO pin for data pin D5 (default 5)
45 + pin_d6 GPIO pin for data pin D6 (default 6)
47 + pin_d7 GPIO pin for data pin D7 (default 7)
49 + pin_en GPIO pin for "Enable" (default 2)
51 + pin_rs GPIO pin for "Register Select" (default 0)
53 + pin_rw GPIO pin for R/W select (default 1)
55 + pin_bl GPIO pin for enabling/disabling the display
56 + backlight. (default 3)
58 + display_height Height of the display in characters (default 2)
60 + display_width Width of the display in characters (default 16)
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
67 +++ b/arch/arm/boot/dts/overlays/hd44780-i2c-lcd-overlay.dts
73 + compatible = "brcm,bcm2835";
76 + target = <&i2c_arm>;
80 + pcf857x: pcf857x@27 {
81 + compatible = "nxp,pcf8574";
93 + lcd_screen: auxdisplay {
94 + compatible = "hit,hd44780";
96 + data-gpios = <&pcf857x 4 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>;
105 + display-width-chars = <16>;
106 + display-height-chars = <2>;
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";