All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/1] auxdisplay: Add I2C gpio expander example
@ 2021-01-06 11:37 Ralf Schlatterbeck
  2021-01-06 11:39 ` [PATCH 1/1] " Ralf Schlatterbeck
  2021-01-06 12:12 ` [PATCH 0/1] " Miguel Ojeda
  0 siblings, 2 replies; 13+ messages in thread
From: Ralf Schlatterbeck @ 2021-01-06 11:37 UTC (permalink / raw)
  To: linux-kernel, Willy Tarreau, Lars Poeschel, Linus Walleij, Miguel Ojeda

The Hitachi HD44780 is often used together with a PCF8574 based I2C
I/O expander. It was non-obvious to me that the existing parallel
connected version of the auxdisplay driver can already handle this
configuration with appropriate device tree magic. This patch documents
the necessary incantations in an example.

That this is not only non-obvious to me is documented by at least two
I2C kernel implementations for the display out there.

Thanks to Geert Uytterhoeven for pointing out how this is done.
Thanks to Miguel Ojeda for extensively commenting on my previous patch.

 .../bindings/auxdisplay/hit,hd44780.yaml      | 31 ++++++++++++++++++-
 1 file changed, 30 insertions(+), 1 deletion(-)

Ralf
-- 
Ralf Schlatterbeck                      Tel:   +43/2243/26465-16
Open Source Consulting                  www:   www.runtux.com
Reichergasse 131, A-3411 Weidling       email: office@runtux.com

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH 1/1] auxdisplay: Add I2C gpio expander example
  2021-01-06 11:37 [PATCH 0/1] auxdisplay: Add I2C gpio expander example Ralf Schlatterbeck
@ 2021-01-06 11:39 ` Ralf Schlatterbeck
  2021-01-06 12:18   ` Miguel Ojeda
  2021-01-06 12:12 ` [PATCH 0/1] " Miguel Ojeda
  1 sibling, 1 reply; 13+ messages in thread
From: Ralf Schlatterbeck @ 2021-01-06 11:39 UTC (permalink / raw)
  To: linux-kernel, Willy Tarreau, Lars Poeschel, Linus Walleij, Miguel Ojeda

The hd44780 displays are often used with pcf8574 based I/O expanders.
Add example to documentation.

Signed-off-by: Ralf Schlatterbeck <rsc@runtux.com>
---
 .../bindings/auxdisplay/hit,hd44780.yaml      | 31 ++++++++++++++++++-
 1 file changed, 30 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/auxdisplay/hit,hd44780.yaml b/Documentation/devicetree/bindings/auxdisplay/hit,hd44780.yaml
index 9222b06e93a0..0ec2ce7b1df1 100644
--- a/Documentation/devicetree/bindings/auxdisplay/hit,hd44780.yaml
+++ b/Documentation/devicetree/bindings/auxdisplay/hit,hd44780.yaml
@@ -12,7 +12,10 @@ maintainers:
 description:
   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.
+  interface, which can be used in either 4-bit or 8-bit mode. By using a
+  GPIO expander it is possible to use the driver with one of the popular I2C
+  expander boards based on the PCF8574 available for these displays. For
+  an example see below.
 
 properties:
   compatible:
@@ -94,3 +97,29 @@ examples:
             display-height-chars = <2>;
             display-width-chars = <16>;
     };
+  - |
+    #include <dt-bindings/gpio/gpio.h>
+    i2c@2000 {
+            #address-cells = <1>;
+            #size-cells = <0>;
+
+            pcf8574: pcf8574@27 {
+                    compatible = "nxp,pcf8574";
+                    reg = <0x27>;
+                    gpio-controller;
+                    #gpio-cells = <2>;
+            };
+    };
+    hd44780 {
+            compatible = "hit,hd44780";
+            display-height-chars = <2>;
+            display-width-chars  = <16>;
+            data-gpios = <&pcf8574 4 0>,
+                         <&pcf8574 5 0>,
+                         <&pcf8574 6 0>,
+                         <&pcf8574 7 0>;
+            enable-gpios = <&pcf8574 2 0>;
+            rs-gpios = <&pcf8574 0 0>;
+            rw-gpios = <&pcf8574 1 0>;
+            backlight-gpios = <&pcf8574 3 0>;
+    };
-- 
2.20.1

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [PATCH 0/1] auxdisplay: Add I2C gpio expander example
  2021-01-06 11:37 [PATCH 0/1] auxdisplay: Add I2C gpio expander example Ralf Schlatterbeck
  2021-01-06 11:39 ` [PATCH 1/1] " Ralf Schlatterbeck
@ 2021-01-06 12:12 ` Miguel Ojeda
  2021-01-06 12:14   ` Miguel Ojeda
  1 sibling, 1 reply; 13+ messages in thread
From: Miguel Ojeda @ 2021-01-06 12:12 UTC (permalink / raw)
  To: Ralf Schlatterbeck
  Cc: linux-kernel, Willy Tarreau, Lars Poeschel, Linus Walleij,
	Geert Uytterhoeven, devicetree

On Wed, Jan 6, 2021 at 12:37 PM Ralf Schlatterbeck <rsc@runtux.com> wrote:
>
> The Hitachi HD44780 is often used together with a PCF8574 based I2C
> I/O expander. It was non-obvious to me that the existing parallel
> connected version of the auxdisplay driver can already handle this
> configuration with appropriate device tree magic. This patch documents
> the necessary incantations in an example.
>
> That this is not only non-obvious to me is documented by at least two
> I2C kernel implementations for the display out there.
>
> Thanks to Geert Uytterhoeven for pointing out how this is done.
> Thanks to Miguel Ojeda for extensively commenting on my previous patch.

You're welcome!

A couple tips:
  - Normally, you will want to use scripts/get_maintainer.pl to know
to whom send a given change. In this case, I am Cc'ing Rob, Geert and
the devicetree mailing list which were missing.
  - Also, for single patches, typically you would want to send the
patch without a cover letter. If you want to put comments that
shouldn't go into the commit, you can write them just below the "---"
line.

Thank you for contributing to the kernel and welcome!

Cheers,
Miguel

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 0/1] auxdisplay: Add I2C gpio expander example
  2021-01-06 12:12 ` [PATCH 0/1] " Miguel Ojeda
@ 2021-01-06 12:14   ` Miguel Ojeda
  0 siblings, 0 replies; 13+ messages in thread
From: Miguel Ojeda @ 2021-01-06 12:14 UTC (permalink / raw)
  To: Ralf Schlatterbeck
  Cc: linux-kernel, Willy Tarreau, Lars Poeschel, Linus Walleij,
	Geert Uytterhoeven, devicetree, Rob Herring

On Wed, Jan 6, 2021 at 1:12 PM Miguel Ojeda
<miguel.ojeda.sandonis@gmail.com> wrote:
>
>   - Normally, you will want to use scripts/get_maintainer.pl to know
> to whom send a given change. In this case, I am Cc'ing Rob, Geert and
> the devicetree mailing list which were missing.

(Actually Cc'ing Rob.)

Cheers,
Miguel

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 1/1] auxdisplay: Add I2C gpio expander example
  2021-01-06 11:39 ` [PATCH 1/1] " Ralf Schlatterbeck
@ 2021-01-06 12:18   ` Miguel Ojeda
  2021-05-12 15:32     ` Geert Uytterhoeven
  0 siblings, 1 reply; 13+ messages in thread
From: Miguel Ojeda @ 2021-01-06 12:18 UTC (permalink / raw)
  To: Ralf Schlatterbeck
  Cc: linux-kernel, Willy Tarreau, Lars Poeschel, Linus Walleij,
	Geert Uytterhoeven, devicetree, Rob Herring

On Wed, Jan 6, 2021 at 12:39 PM Ralf Schlatterbeck <rsc@runtux.com> wrote:
>
> The hd44780 displays are often used with pcf8574 based I/O expanders.
> Add example to documentation.
>
> Signed-off-by: Ralf Schlatterbeck <rsc@runtux.com>

Since Geert suggested it, it is customary to write Suggested-by: Geert
Uytterhoeven <geert@linux-m68k.org> above your signature.

Rob, if you are taking this on your tree:

    Acked-by: Miguel Ojeda <ojeda@kernel.org>

Otherwise, I will pick it up.

Cheers,
Miguel

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 1/1] auxdisplay: Add I2C gpio expander example
  2021-01-06 12:18   ` Miguel Ojeda
@ 2021-05-12 15:32     ` Geert Uytterhoeven
  2021-05-12 15:49       ` Miguel Ojeda
  0 siblings, 1 reply; 13+ messages in thread
From: Geert Uytterhoeven @ 2021-05-12 15:32 UTC (permalink / raw)
  To: Miguel Ojeda
  Cc: Ralf Schlatterbeck, linux-kernel, Willy Tarreau, Lars Poeschel,
	Linus Walleij,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	Rob Herring

Hi Miguel,

On Wed, Jan 6, 2021 at 1:18 PM Miguel Ojeda
<miguel.ojeda.sandonis@gmail.com> wrote:
> On Wed, Jan 6, 2021 at 12:39 PM Ralf Schlatterbeck <rsc@runtux.com> wrote:
> > The hd44780 displays are often used with pcf8574 based I/O expanders.
> > Add example to documentation.
> >
> > Signed-off-by: Ralf Schlatterbeck <rsc@runtux.com>

> Rob, if you are taking this on your tree:
>
>     Acked-by: Miguel Ojeda <ojeda@kernel.org>
>
> Otherwise, I will pick it up.

Seems like so far no one has picked this up?

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

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 1/1] auxdisplay: Add I2C gpio expander example
  2021-05-12 15:32     ` Geert Uytterhoeven
@ 2021-05-12 15:49       ` Miguel Ojeda
  2021-05-17 15:20         ` Rob Herring
  0 siblings, 1 reply; 13+ messages in thread
From: Miguel Ojeda @ 2021-05-12 15:49 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Ralf Schlatterbeck, linux-kernel, Willy Tarreau, Lars Poeschel,
	Linus Walleij,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	Rob Herring

On Wed, May 12, 2021 at 5:32 PM Geert Uytterhoeven <geert@linux-m68k.org> wrote:
>
> Seems like so far no one has picked this up?

Queuing it then.

Cheers,
Miguel

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 1/1] auxdisplay: Add I2C gpio expander example
  2021-05-12 15:49       ` Miguel Ojeda
@ 2021-05-17 15:20         ` Rob Herring
  2021-05-19  9:00           ` Ralf Schlatterbeck
  0 siblings, 1 reply; 13+ messages in thread
From: Rob Herring @ 2021-05-17 15:20 UTC (permalink / raw)
  To: Miguel Ojeda
  Cc: Geert Uytterhoeven, Ralf Schlatterbeck, linux-kernel,
	Willy Tarreau, Lars Poeschel, Linus Walleij,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS

On Wed, May 12, 2021 at 05:49:02PM +0200, Miguel Ojeda wrote:
> On Wed, May 12, 2021 at 5:32 PM Geert Uytterhoeven <geert@linux-m68k.org> wrote:
> >
> > Seems like so far no one has picked this up?

Because DT patchwork never saw it.

> 
> Queuing it then.

Now it warns in linux-next:

Documentation/devicetree/bindings/auxdisplay/hit,hd44780.example.dts:52.18-62.11: Warning (unit_address_vs_reg): /example-1/i2c@2000: node has a unit name, but no reg or ranges property

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 1/1] auxdisplay: Add I2C gpio expander example
  2021-05-17 15:20         ` Rob Herring
@ 2021-05-19  9:00           ` Ralf Schlatterbeck
  2021-05-19  9:53             ` Geert Uytterhoeven
  0 siblings, 1 reply; 13+ messages in thread
From: Ralf Schlatterbeck @ 2021-05-19  9:00 UTC (permalink / raw)
  To: Rob Herring
  Cc: Miguel Ojeda, Geert Uytterhoeven, linux-kernel, Willy Tarreau,
	Lars Poeschel, Linus Walleij,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS

On Mon, May 17, 2021 at 10:20:35AM -0500, Rob Herring wrote:
> Now it warns in linux-next:
> 
> Documentation/devicetree/bindings/auxdisplay/hit,hd44780.example.dts:52.18-62.11: Warning (unit_address_vs_reg): /example-1/i2c@2000: node has a unit name, but no reg or ranges property

[I'm the author of that patch]
Can someone point me to the documentation of how to check a single
example against the dt schemata? I think I had that figured out how to
run the dt-checks over the whole tree in january but didn't bother with
warnings since the whole devtree was riddled with warnings at the time.
Docs on how to quickly check for warnings/errors would help me a lot. My
naive usage of dt-validate on an example yields a traceback, I've opened
a report on github because I think that even with gross mis-usage the
tool shouldn't traceback...

Thanks for your help and pointers.
Ralf
-- 
Dr. Ralf Schlatterbeck                  Tel:   +43/2243/26465-16
Open Source Consulting                  www:   www.runtux.com
Reichergasse 131, A-3411 Weidling       email: office@runtux.com

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 1/1] auxdisplay: Add I2C gpio expander example
  2021-05-19  9:00           ` Ralf Schlatterbeck
@ 2021-05-19  9:53             ` Geert Uytterhoeven
  2021-05-19 11:54               ` Ralf Schlatterbeck
  0 siblings, 1 reply; 13+ messages in thread
From: Geert Uytterhoeven @ 2021-05-19  9:53 UTC (permalink / raw)
  To: Ralf Schlatterbeck
  Cc: Rob Herring, Miguel Ojeda, linux-kernel, Willy Tarreau,
	Lars Poeschel, Linus Walleij,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS

Hi Ralf,

On Wed, May 19, 2021 at 11:00 AM Ralf Schlatterbeck <rsc@runtux.com> wrote:
> On Mon, May 17, 2021 at 10:20:35AM -0500, Rob Herring wrote:
> > Now it warns in linux-next:
> >
> > Documentation/devicetree/bindings/auxdisplay/hit,hd44780.example.dts:52.18-62.11: Warning (unit_address_vs_reg): /example-1/i2c@2000: node has a unit name, but no reg or ranges property
>
> [I'm the author of that patch]
> Can someone point me to the documentation of how to check a single
> example against the dt schemata? I think I had that figured out how to
> run the dt-checks over the whole tree in january but didn't bother with
> warnings since the whole devtree was riddled with warnings at the time.

It's much better in v5.13-rc2.

> Docs on how to quickly check for warnings/errors would help me a lot. My
> naive usage of dt-validate on an example yields a traceback, I've opened
> a report on github because I think that even with gross mis-usage the
> tool shouldn't traceback...

make dt_binding_check
DT_SCHEMA_FILES=Documentation/devicetree/bindings/auxdisplay/hit,hd44780.yaml

That still runs some checks on all files, unless you apply
https://lore.kernel.org/linux-devicetree/20210309112148.2309116-1-geert+renesas@glider.be/
first

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

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 1/1] auxdisplay: Add I2C gpio expander example
  2021-05-19  9:53             ` Geert Uytterhoeven
@ 2021-05-19 11:54               ` Ralf Schlatterbeck
  2021-06-09 13:55                 ` Miguel Ojeda
  0 siblings, 1 reply; 13+ messages in thread
From: Ralf Schlatterbeck @ 2021-05-19 11:54 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Rob Herring, Miguel Ojeda, linux-kernel, Willy Tarreau,
	Lars Poeschel, Linus Walleij,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS

The hd44780 displays are often used with pcf8574 based I/O expanders.
Add example to documentation.

Signed-off-by: Ralf Schlatterbeck <rsc@runtux.com>
---
Updated Patch, thanks to Geert Uytterhoeven for his tip on how to
reproduce the warning. I've removed the address from the i2c stanza
which fixes it. Let me know if I should re-post the patch in a separate
thread.

 .../bindings/auxdisplay/hit,hd44780.yaml      | 31 ++++++++++++++++++-
 1 file changed, 30 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/auxdisplay/hit,hd44780.yaml b/Documentation/devicetree/bindings/auxdisplay/hit,hd44780.yaml
index 9222b06e93a0..fde07e4b119d 100644
--- a/Documentation/devicetree/bindings/auxdisplay/hit,hd44780.yaml
+++ b/Documentation/devicetree/bindings/auxdisplay/hit,hd44780.yaml
@@ -12,7 +12,10 @@ maintainers:
 description:
   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.
+  interface, which can be used in either 4-bit or 8-bit mode. By using a
+  GPIO expander it is possible to use the driver with one of the popular I2C
+  expander boards based on the PCF8574 available for these displays. For
+  an example see below.
 
 properties:
   compatible:
@@ -94,3 +97,29 @@ examples:
             display-height-chars = <2>;
             display-width-chars = <16>;
     };
+  - |
+    #include <dt-bindings/gpio/gpio.h>
+    i2c {
+            #address-cells = <1>;
+            #size-cells = <0>;
+
+            pcf8574: pcf8574@27 {
+                    compatible = "nxp,pcf8574";
+                    reg = <0x27>;
+                    gpio-controller;
+                    #gpio-cells = <2>;
+            };
+    };
+    hd44780 {
+            compatible = "hit,hd44780";
+            display-height-chars = <2>;
+            display-width-chars  = <16>;
+            data-gpios = <&pcf8574 4 0>,
+                         <&pcf8574 5 0>,
+                         <&pcf8574 6 0>,
+                         <&pcf8574 7 0>;
+            enable-gpios = <&pcf8574 2 0>;
+            rs-gpios = <&pcf8574 0 0>;
+            rw-gpios = <&pcf8574 1 0>;
+            backlight-gpios = <&pcf8574 3 0>;
+    };
-- 
2.20.1

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [PATCH 1/1] auxdisplay: Add I2C gpio expander example
  2021-05-19 11:54               ` Ralf Schlatterbeck
@ 2021-06-09 13:55                 ` Miguel Ojeda
  2021-06-09 15:49                   ` Ralf Schlatterbeck
  0 siblings, 1 reply; 13+ messages in thread
From: Miguel Ojeda @ 2021-06-09 13:55 UTC (permalink / raw)
  To: Ralf Schlatterbeck
  Cc: Geert Uytterhoeven, Rob Herring, linux-kernel, Willy Tarreau,
	Lars Poeschel, Linus Walleij,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS

Hi Ralf, Rob,

On Wed, May 19, 2021 at 1:54 PM Ralf Schlatterbeck <rsc@runtux.com> wrote:
>
> The hd44780 displays are often used with pcf8574 based I/O expanders.
> Add example to documentation.
>
> Signed-off-by: Ralf Schlatterbeck <rsc@runtux.com>

I have queued this one into -next, adding the `Suggested-by` tag.

Cheers,
Miguel

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 1/1] auxdisplay: Add I2C gpio expander example
  2021-06-09 13:55                 ` Miguel Ojeda
@ 2021-06-09 15:49                   ` Ralf Schlatterbeck
  0 siblings, 0 replies; 13+ messages in thread
From: Ralf Schlatterbeck @ 2021-06-09 15:49 UTC (permalink / raw)
  To: Miguel Ojeda
  Cc: Geert Uytterhoeven, Rob Herring, linux-kernel, Willy Tarreau,
	Lars Poeschel, Linus Walleij,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS

On Wed, Jun 09, 2021 at 03:55:10PM +0200, Miguel Ojeda wrote:
> Hi Ralf, Rob,
> 
> On Wed, May 19, 2021 at 1:54 PM Ralf Schlatterbeck <rsc@runtux.com> wrote:
> >
> > The hd44780 displays are often used with pcf8574 based I/O expanders.
> > Add example to documentation.
> >
> > Signed-off-by: Ralf Schlatterbeck <rsc@runtux.com>
> 
> I have queued this one into -next, adding the `Suggested-by` tag.

Thanks!

Ralf
-- 
Dr. Ralf Schlatterbeck                  Tel:   +43/2243/26465-16
Open Source Consulting                  www:   www.runtux.com
Reichergasse 131, A-3411 Weidling       email: office@runtux.com

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2021-06-09 15:50 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-06 11:37 [PATCH 0/1] auxdisplay: Add I2C gpio expander example Ralf Schlatterbeck
2021-01-06 11:39 ` [PATCH 1/1] " Ralf Schlatterbeck
2021-01-06 12:18   ` Miguel Ojeda
2021-05-12 15:32     ` Geert Uytterhoeven
2021-05-12 15:49       ` Miguel Ojeda
2021-05-17 15:20         ` Rob Herring
2021-05-19  9:00           ` Ralf Schlatterbeck
2021-05-19  9:53             ` Geert Uytterhoeven
2021-05-19 11:54               ` Ralf Schlatterbeck
2021-06-09 13:55                 ` Miguel Ojeda
2021-06-09 15:49                   ` Ralf Schlatterbeck
2021-01-06 12:12 ` [PATCH 0/1] " Miguel Ojeda
2021-01-06 12:14   ` Miguel Ojeda

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.