[v2,4/5] dt-bindings: auxdisplay: Add bindings for Hitachi HD44780
diff mbox series

Message ID 1489155321-25666-5-git-send-email-geert@linux-m68k.org
State New, archived
Headers show
Series
  • Add HD44780 Character LCD support
Related show

Commit Message

Geert Uytterhoeven March 10, 2017, 2:15 p.m. UTC
Add DT bindings for an Hitachi HD44780 Character LCD Controller where
its M6800 bus interface is connected to GPIOs.

Memory-mapped configurations are not yet supported.

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
---
Memory-mapped configurations can be supported by amending the binding to
make mandatory either the {data,enable,rs}-gpios properties, or a "reg"
(and optional "reg-names") property.

As the driver doesn't support this yet, and there are different ways to
organize the register map (some wirings use different addresses for
reading and writing, to simplify bus glue logic), this is left for a
future improvement.

v2:
  - Added rationale below "---".
---
 .../devicetree/bindings/auxdisplay/hit,hd44780.txt | 44 ++++++++++++++++++++++
 1 file changed, 44 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/auxdisplay/hit,hd44780.txt

Comments

Rob Herring March 20, 2017, 3:15 p.m. UTC | #1
On Fri, Mar 10, 2017 at 03:15:20PM +0100, Geert Uytterhoeven wrote:
> Add DT bindings for an Hitachi HD44780 Character LCD Controller where
> its M6800 bus interface is connected to GPIOs.
> 
> Memory-mapped configurations are not yet supported.
> 
> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
> ---
> Memory-mapped configurations can be supported by amending the binding to
> make mandatory either the {data,enable,rs}-gpios properties, or a "reg"
> (and optional "reg-names") property.
> 
> As the driver doesn't support this yet, and there are different ways to
> organize the register map (some wirings use different addresses for
> reading and writing, to simplify bus glue logic), this is left for a
> future improvement.
> 
> v2:
>   - Added rationale below "---".
> ---
>  .../devicetree/bindings/auxdisplay/hit,hd44780.txt | 44 ++++++++++++++++++++++
>  1 file changed, 44 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/auxdisplay/hit,hd44780.txt
> 
> diff --git a/Documentation/devicetree/bindings/auxdisplay/hit,hd44780.txt b/Documentation/devicetree/bindings/auxdisplay/hit,hd44780.txt
> new file mode 100644
> index 0000000000000000..ee4054da458d412f
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/auxdisplay/hit,hd44780.txt
> @@ -0,0 +1,44 @@
> +DT bindings for the Hitachi HD44780 Character LCD Controller
> +
> +The Hitachi HD44780 Character LCD Controller is commonly used on character LCDs
> +that can display one or more lines of text. It exposes an M6800 bus interface,
> +which can be used in either 4-bit or 8-bit mode.
> +
> +Required properties:
> +  - compatible: Must contain "hit,hd44780",
> +  - data-gpios: Must contain an array of either 4 or 8 GPIO specifiers,
> +    referring to the GPIO pins connected to the data signal lines DB0-DB7
> +    (8-bit mode) or DB4-DB7 (4-bit mode) of the LCD Controller's bus interface,
> +  - enable-gpios: Must contain a GPIO specifier, referring to the GPIO pin
> +    connected to the "E" (Enable) signal line of the LCD Controller's bus
> +    interface,
> +  - rs-gpios: Must contain a GPIO specifier, referring to the GPIO pin
> +    connected to the "RS" (Register Select) signal line of the LCD Controller's
> +    bus interface,
> +  - display-height: Height of the display, in character cells,
> +  - display-width: Width of the display, in character cells.

display-{width,height}-chars

> +
> +Optional properties:
> +  - rw-gpios: Must contain a GPIO specifier, referring to the GPIO pin
> +    connected to the "RW" (Read/Write) signal line of the LCD Controller's bus
> +    interface,
> +  - backlight-gpios: Must contain a GPIO specifier, referring to the GPIO pin
> +    used for enabling the LCD's backlight,

Active state?

> +  - internal-buffer-width: Internal buffer width (default is 40 for displays
> +    with 1 or 2 lines, and display-width for displays with more than 2 lines).
> +
> +Example:
> +
> +	auxdisplay {
> +		compatible = "hit,hd44780";
> +
> +		data-gpios = <&hc595 0 GPIO_ACTIVE_HIGH>,
> +			     <&hc595 1 GPIO_ACTIVE_HIGH>,
> +			     <&hc595 2 GPIO_ACTIVE_HIGH>,
> +			     <&hc595 3 GPIO_ACTIVE_HIGH>;
> +		enable-gpios = <&hc595 4 GPIO_ACTIVE_HIGH>;
> +		rs-gpios = <&hc595 5 GPIO_ACTIVE_HIGH>;
> +
> +		display-height = <2>;
> +		display-width = <16>;
> +	};
> -- 
> 2.7.4
>
Geert Uytterhoeven March 20, 2017, 3:27 p.m. UTC | #2
Hi Rob, Greg,

On Mon, Mar 20, 2017 at 4:15 PM, Rob Herring <robh@kernel.org> wrote:
> On Fri, Mar 10, 2017 at 03:15:20PM +0100, Geert Uytterhoeven wrote:
>> Add DT bindings for an Hitachi HD44780 Character LCD Controller where
>> its M6800 bus interface is connected to GPIOs.
>>
>> Memory-mapped configurations are not yet supported.
>>
>> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>

>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/auxdisplay/hit,hd44780.txt

>> +Required properties:
>> +  - compatible: Must contain "hit,hd44780",
>> +  - data-gpios: Must contain an array of either 4 or 8 GPIO specifiers,
>> +    referring to the GPIO pins connected to the data signal lines DB0-DB7
>> +    (8-bit mode) or DB4-DB7 (4-bit mode) of the LCD Controller's bus interface,
>> +  - enable-gpios: Must contain a GPIO specifier, referring to the GPIO pin
>> +    connected to the "E" (Enable) signal line of the LCD Controller's bus
>> +    interface,
>> +  - rs-gpios: Must contain a GPIO specifier, referring to the GPIO pin
>> +    connected to the "RS" (Register Select) signal line of the LCD Controller's
>> +    bus interface,
>> +  - display-height: Height of the display, in character cells,
>> +  - display-width: Width of the display, in character cells.
>
> display-{width,height}-chars

Makes sense.

Greg: As this is already in char-misc-next, shall I send an update for
the bindings
and the driver?

>> +Optional properties:
>> +  - rw-gpios: Must contain a GPIO specifier, referring to the GPIO pin
>> +    connected to the "RW" (Read/Write) signal line of the LCD Controller's bus
>> +    interface,
>> +  - backlight-gpios: Must contain a GPIO specifier, referring to the GPIO pin
>> +    used for enabling the LCD's backlight,
>
> Active state?

That's typically handled via the last cell of the GPIO specifier, cfr.
GPIO_ACTIVE_HIGH / GPIO_ACTIVE_LOW in <dt-bindings/gpio/gpio.h>.

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
Greg Kroah-Hartman March 20, 2017, 3:48 p.m. UTC | #3
On Mon, Mar 20, 2017 at 04:27:01PM +0100, Geert Uytterhoeven wrote:
> Hi Rob, Greg,
> 
> On Mon, Mar 20, 2017 at 4:15 PM, Rob Herring <robh@kernel.org> wrote:
> > On Fri, Mar 10, 2017 at 03:15:20PM +0100, Geert Uytterhoeven wrote:
> >> Add DT bindings for an Hitachi HD44780 Character LCD Controller where
> >> its M6800 bus interface is connected to GPIOs.
> >>
> >> Memory-mapped configurations are not yet supported.
> >>
> >> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
> 
> >> --- /dev/null
> >> +++ b/Documentation/devicetree/bindings/auxdisplay/hit,hd44780.txt
> 
> >> +Required properties:
> >> +  - compatible: Must contain "hit,hd44780",
> >> +  - data-gpios: Must contain an array of either 4 or 8 GPIO specifiers,
> >> +    referring to the GPIO pins connected to the data signal lines DB0-DB7
> >> +    (8-bit mode) or DB4-DB7 (4-bit mode) of the LCD Controller's bus interface,
> >> +  - enable-gpios: Must contain a GPIO specifier, referring to the GPIO pin
> >> +    connected to the "E" (Enable) signal line of the LCD Controller's bus
> >> +    interface,
> >> +  - rs-gpios: Must contain a GPIO specifier, referring to the GPIO pin
> >> +    connected to the "RS" (Register Select) signal line of the LCD Controller's
> >> +    bus interface,
> >> +  - display-height: Height of the display, in character cells,
> >> +  - display-width: Width of the display, in character cells.
> >
> > display-{width,height}-chars
> 
> Makes sense.
> 
> Greg: As this is already in char-misc-next, shall I send an update for
> the bindings and the driver?

Please do.

thanks,

greg k-h
Rob Herring March 20, 2017, 5 p.m. UTC | #4
On Mon, Mar 20, 2017 at 10:27 AM, Geert Uytterhoeven
<geert@linux-m68k.org> wrote:
> Hi Rob, Greg,
>
> On Mon, Mar 20, 2017 at 4:15 PM, Rob Herring <robh@kernel.org> wrote:
>> On Fri, Mar 10, 2017 at 03:15:20PM +0100, Geert Uytterhoeven wrote:
>>> Add DT bindings for an Hitachi HD44780 Character LCD Controller where
>>> its M6800 bus interface is connected to GPIOs.
>>>
>>> Memory-mapped configurations are not yet supported.
>>>
>>> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
>
>>> --- /dev/null
>>> +++ b/Documentation/devicetree/bindings/auxdisplay/hit,hd44780.txt
>
>>> +Required properties:
>>> +  - compatible: Must contain "hit,hd44780",
>>> +  - data-gpios: Must contain an array of either 4 or 8 GPIO specifiers,
>>> +    referring to the GPIO pins connected to the data signal lines DB0-DB7
>>> +    (8-bit mode) or DB4-DB7 (4-bit mode) of the LCD Controller's bus interface,
>>> +  - enable-gpios: Must contain a GPIO specifier, referring to the GPIO pin
>>> +    connected to the "E" (Enable) signal line of the LCD Controller's bus
>>> +    interface,
>>> +  - rs-gpios: Must contain a GPIO specifier, referring to the GPIO pin
>>> +    connected to the "RS" (Register Select) signal line of the LCD Controller's
>>> +    bus interface,
>>> +  - display-height: Height of the display, in character cells,
>>> +  - display-width: Width of the display, in character cells.
>>
>> display-{width,height}-chars
>
> Makes sense.
>
> Greg: As this is already in char-misc-next, shall I send an update for
> the bindings
> and the driver?
>
>>> +Optional properties:
>>> +  - rw-gpios: Must contain a GPIO specifier, referring to the GPIO pin
>>> +    connected to the "RW" (Read/Write) signal line of the LCD Controller's bus
>>> +    interface,
>>> +  - backlight-gpios: Must contain a GPIO specifier, referring to the GPIO pin
>>> +    used for enabling the LCD's backlight,
>>
>> Active state?
>
> That's typically handled via the last cell of the GPIO specifier, cfr.
> GPIO_ACTIVE_HIGH / GPIO_ACTIVE_LOW in <dt-bindings/gpio/gpio.h>.

Yes, I know. I want to be able to read the binding and validate the
dts file, so I need to know what is the correct flag.

Rob
Geert Uytterhoeven March 21, 2017, 8:07 a.m. UTC | #5
Hi Rob,

On Mon, Mar 20, 2017 at 6:00 PM, Rob Herring <robh@kernel.org> wrote:
> On Mon, Mar 20, 2017 at 10:27 AM, Geert Uytterhoeven
> <geert@linux-m68k.org> wrote:
>> On Mon, Mar 20, 2017 at 4:15 PM, Rob Herring <robh@kernel.org> wrote:
>>> On Fri, Mar 10, 2017 at 03:15:20PM +0100, Geert Uytterhoeven wrote:
>>>> Add DT bindings for an Hitachi HD44780 Character LCD Controller where
>>>> its M6800 bus interface is connected to GPIOs.
>>>>
>>>> Memory-mapped configurations are not yet supported.
>>>>
>>>> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
>>
>>>> --- /dev/null
>>>> +++ b/Documentation/devicetree/bindings/auxdisplay/hit,hd44780.txt
>>
>>>> +Required properties:
>>>> +  - compatible: Must contain "hit,hd44780",
>>>> +  - data-gpios: Must contain an array of either 4 or 8 GPIO specifiers,
>>>> +    referring to the GPIO pins connected to the data signal lines DB0-DB7
>>>> +    (8-bit mode) or DB4-DB7 (4-bit mode) of the LCD Controller's bus interface,
>>>> +  - enable-gpios: Must contain a GPIO specifier, referring to the GPIO pin
>>>> +    connected to the "E" (Enable) signal line of the LCD Controller's bus
>>>> +    interface,
>>>> +  - rs-gpios: Must contain a GPIO specifier, referring to the GPIO pin
>>>> +    connected to the "RS" (Register Select) signal line of the LCD Controller's
>>>> +    bus interface,
>>>> +  - display-height: Height of the display, in character cells,
>>>> +  - display-width: Width of the display, in character cells.
>>>
>>> display-{width,height}-chars
>>
>> Makes sense.
>>
>> Greg: As this is already in char-misc-next, shall I send an update for
>> the bindings
>> and the driver?
>>
>>>> +Optional properties:
>>>> +  - rw-gpios: Must contain a GPIO specifier, referring to the GPIO pin
>>>> +    connected to the "RW" (Read/Write) signal line of the LCD Controller's bus
>>>> +    interface,
>>>> +  - backlight-gpios: Must contain a GPIO specifier, referring to the GPIO pin
>>>> +    used for enabling the LCD's backlight,
>>>
>>> Active state?
>>
>> That's typically handled via the last cell of the GPIO specifier, cfr.
>> GPIO_ACTIVE_HIGH / GPIO_ACTIVE_LOW in <dt-bindings/gpio/gpio.h>.
>
> Yes, I know. I want to be able to read the binding and validate the
> dts file, so I need to know what is the correct flag.

For the LCD Controller's bus, the GPIOs are wired straight, so they should
be ACTIVE_HIGH (unless there's an inverting buffer in between :-).

The backlight is separate from the LCD Controller, hence the polarity
depends on the actual hardware configuration.

Is it worth documenting that?

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

Patch
diff mbox series

diff --git a/Documentation/devicetree/bindings/auxdisplay/hit,hd44780.txt b/Documentation/devicetree/bindings/auxdisplay/hit,hd44780.txt
new file mode 100644
index 0000000000000000..ee4054da458d412f
--- /dev/null
+++ b/Documentation/devicetree/bindings/auxdisplay/hit,hd44780.txt
@@ -0,0 +1,44 @@ 
+DT bindings for the Hitachi HD44780 Character LCD Controller
+
+The Hitachi HD44780 Character LCD Controller is commonly used on character LCDs
+that can display one or more lines of text. It exposes an M6800 bus interface,
+which can be used in either 4-bit or 8-bit mode.
+
+Required properties:
+  - compatible: Must contain "hit,hd44780",
+  - data-gpios: Must contain an array of either 4 or 8 GPIO specifiers,
+    referring to the GPIO pins connected to the data signal lines DB0-DB7
+    (8-bit mode) or DB4-DB7 (4-bit mode) of the LCD Controller's bus interface,
+  - enable-gpios: Must contain a GPIO specifier, referring to the GPIO pin
+    connected to the "E" (Enable) signal line of the LCD Controller's bus
+    interface,
+  - rs-gpios: Must contain a GPIO specifier, referring to the GPIO pin
+    connected to the "RS" (Register Select) signal line of the LCD Controller's
+    bus interface,
+  - display-height: Height of the display, in character cells,
+  - display-width: Width of the display, in character cells.
+
+Optional properties:
+  - rw-gpios: Must contain a GPIO specifier, referring to the GPIO pin
+    connected to the "RW" (Read/Write) signal line of the LCD Controller's bus
+    interface,
+  - backlight-gpios: Must contain a GPIO specifier, referring to the GPIO pin
+    used for enabling the LCD's backlight,
+  - internal-buffer-width: Internal buffer width (default is 40 for displays
+    with 1 or 2 lines, and display-width for displays with more than 2 lines).
+
+Example:
+
+	auxdisplay {
+		compatible = "hit,hd44780";
+
+		data-gpios = <&hc595 0 GPIO_ACTIVE_HIGH>,
+			     <&hc595 1 GPIO_ACTIVE_HIGH>,
+			     <&hc595 2 GPIO_ACTIVE_HIGH>,
+			     <&hc595 3 GPIO_ACTIVE_HIGH>;
+		enable-gpios = <&hc595 4 GPIO_ACTIVE_HIGH>;
+		rs-gpios = <&hc595 5 GPIO_ACTIVE_HIGH>;
+
+		display-height = <2>;
+		display-width = <16>;
+	};