[v2,00/15] auxdisplay: linedisp: Clean up and add new driver

Message ID 20240212170423.2860895-1-andriy.shevchenko@linux.intel.com
Headers
Series auxdisplay: linedisp: Clean up and add new driver |

Message

Andy Shevchenko Feb. 12, 2024, 5:01 p.m. UTC
  Add a new initial driver for Maxim MAX6958/6959 chips.
While developing that driver I realised that there is a lot
of duplication between ht16k33 and a new one. Hence set of
cleanups and refactorings.

Note, the new driver has minimum support of the hardware and
I have plans to cover more features in the future.

In v2:
- updated DT bindings to follow specifications and requirements (Krzysztof)
- unified return code variable (err everywhere)
- left patches 10 and 13 untouched, we may amend later on (Robin)

Andy Shevchenko (15):
  auxdisplay: img-ascii-lcd: Make container_of() no-op for struct
    linedisp
  auxdisplay: linedisp: Free allocated resources in ->release()
  auxdisplay: linedisp: Use unique number for id
  auxdisplay: linedisp: Unshadow error codes in ->store()
  auxdisplay: linedisp: Add missing header(s)
  auxdisplay: linedisp: Move exported symbols to a namespace
  auxdisplay: linedisp: Group line display drivers together
  auxdisplay: linedisp: Provide struct linedisp_ops for future extension
  auxdisplay: linedisp: Add support for overriding character mapping
  auxdisplay: linedisp: Provide a small buffer in the struct linedisp
  auxdisplay: ht16k33: Move ht16k33_linedisp_ops down
  auxdisplay: ht16k33: Switch to use line display character mapping
  auxdisplay: ht16k33: Use buffer from struct linedisp
  dt-bindings: auxdisplay: Add Maxim MAX6958/6959
  auxdisplay: Add driver for MAX695x 7-segment LED controllers

 .../bindings/auxdisplay/maxim,max6959.yaml    |  35 +++
 drivers/auxdisplay/Kconfig                    |  40 ++--
 drivers/auxdisplay/Makefile                   |  13 +-
 drivers/auxdisplay/ht16k33.c                  | 145 +++++--------
 drivers/auxdisplay/img-ascii-lcd.c            |  24 ++-
 drivers/auxdisplay/line-display.c             | 162 ++++++++++++--
 drivers/auxdisplay/line-display.h             |  57 ++++-
 drivers/auxdisplay/max6959.c                  | 200 ++++++++++++++++++
 8 files changed, 530 insertions(+), 146 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/auxdisplay/maxim,max6959.yaml
 create mode 100644 drivers/auxdisplay/max6959.c
  

Comments

Andy Shevchenko Feb. 12, 2024, 5:14 p.m. UTC | #1
On Mon, Feb 12, 2024 at 07:01:47PM +0200, Andy Shevchenko wrote:
> Add initial device tree documentation for Maxim MAX6958/6959.

Oh, this is an old version :-(
  
Andy Shevchenko Feb. 12, 2024, 5:16 p.m. UTC | #2
On Mon, Feb 12, 2024 at 07:14:53PM +0200, Andy Shevchenko wrote:
> On Mon, Feb 12, 2024 at 07:01:47PM +0200, Andy Shevchenko wrote:
> > Add initial device tree documentation for Maxim MAX6958/6959.
> 
> Oh, this is an old version :-(

Here is a new one:

From d8c826e06cf9237cd5fc6b2bb0b1cac5aff4fd8a Mon Sep 17 00:00:00 2001
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Date: Thu, 8 Feb 2024 17:23:38 +0200
Subject: [PATCH 1/1] dt-bindings: auxdisplay: Add Maxim MAX6958/6959

Add initial device tree documentation for Maxim MAX6958/6959.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 .../bindings/auxdisplay/maxim,max6959.yaml    | 44 +++++++++++++++++++
 1 file changed, 44 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/auxdisplay/maxim,max6959.yaml

diff --git a/Documentation/devicetree/bindings/auxdisplay/maxim,max6959.yaml b/Documentation/devicetree/bindings/auxdisplay/maxim,max6959.yaml
new file mode 100644
index 000000000000..e7d602d02df1
--- /dev/null
+++ b/Documentation/devicetree/bindings/auxdisplay/maxim,max6959.yaml
@@ -0,0 +1,44 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/auxdisplay/maxim,max6959.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: MAX6958/6959 7-segment LED display controller with keyscan
+
+maintainers:
+  - Andy Shevchenko <andriy.shevchenko@linux.intel.com>
+
+description:
+  The Maxim MAX6958/6959 7-segment LED display controller provides
+  an I2C interface to up to four 7-segment LED digits. The MAX6959
+  in comparison to MAX6958 has the debounce and interrupt support.
+  Type of the chip can be autodetected via specific register read,
+  and hence the features may be enabled in the driver at run-time.
+  Given hardware is simple and does not provide any additional pins,
+  such as reset or enable.
+
+properties:
+  compatible:
+    const: maxim,max6959
+
+  reg:
+    maxItems: 1
+
+required:
+  - compatible
+  - reg
+
+additionalProperties: false
+
+examples:
+  - |
+    i2c {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        display-controller@38 {
+            compatible = "maxim,max6959";
+            reg = <0x38>;
+        };
+    };
  
Andy Shevchenko Feb. 14, 2024, 5:57 p.m. UTC | #3
On Mon, Feb 12, 2024 at 07:01:33PM +0200, Andy Shevchenko wrote:
> Add a new initial driver for Maxim MAX6958/6959 chips.
> While developing that driver I realised that there is a lot
> of duplication between ht16k33 and a new one. Hence set of
> cleanups and refactorings.
> 
> Note, the new driver has minimum support of the hardware and
> I have plans to cover more features in the future.
> 
> In v2:
> - updated DT bindings to follow specifications and requirements (Krzysztof)
> - unified return code variable (err everywhere)
> - left patches 10 and 13 untouched, we may amend later on (Robin)

Geert, I would like to apply at least the first 13 patches.
Do you have any comments or even possibility to perform a regression test?
  
Geert Uytterhoeven Feb. 14, 2024, 6:45 p.m. UTC | #4
Hi Andy,

On Wed, Feb 14, 2024 at 6:57 PM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
> On Mon, Feb 12, 2024 at 07:01:33PM +0200, Andy Shevchenko wrote:
> > Add a new initial driver for Maxim MAX6958/6959 chips.
> > While developing that driver I realised that there is a lot
> > of duplication between ht16k33 and a new one. Hence set of
> > cleanups and refactorings.
> >
> > Note, the new driver has minimum support of the hardware and
> > I have plans to cover more features in the future.
> >
> > In v2:
> > - updated DT bindings to follow specifications and requirements (Krzysztof)
> > - unified return code variable (err everywhere)
> > - left patches 10 and 13 untouched, we may amend later on (Robin)
>
> Geert, I would like to apply at least the first 13 patches.
> Do you have any comments or even possibility to perform a regression test?

I'll try to give it a try on my Adafruit Quad 14-segment display tomorrow...

Gr{oetje,eeting}s,

                        Geert
  
Andy Shevchenko Feb. 14, 2024, 6:51 p.m. UTC | #5
On Wed, Feb 14, 2024 at 07:45:01PM +0100, Geert Uytterhoeven wrote:
> On Wed, Feb 14, 2024 at 6:57 PM Andy Shevchenko
> <andriy.shevchenko@linux.intel.com> wrote:
> > On Mon, Feb 12, 2024 at 07:01:33PM +0200, Andy Shevchenko wrote:

..

> > Geert, I would like to apply at least the first 13 patches.
> > Do you have any comments or even possibility to perform a regression test?
> 
> I'll try to give it a try on my Adafruit Quad 14-segment display tomorrow...

Thank you!
  
Geert Uytterhoeven Feb. 15, 2024, 11:05 a.m. UTC | #6
Hi Andy,

On Wed, Feb 14, 2024 at 7:45 PM Geert Uytterhoeven <geert@linux-m68k.org> wrote:
> On Wed, Feb 14, 2024 at 6:57 PM Andy Shevchenko
> <andriy.shevchenko@linux.intel.com> wrote:
> > On Mon, Feb 12, 2024 at 07:01:33PM +0200, Andy Shevchenko wrote:
> > > Add a new initial driver for Maxim MAX6958/6959 chips.
> > > While developing that driver I realised that there is a lot
> > > of duplication between ht16k33 and a new one. Hence set of
> > > cleanups and refactorings.
> > >
> > > Note, the new driver has minimum support of the hardware and
> > > I have plans to cover more features in the future.
> > >
> > > In v2:
> > > - updated DT bindings to follow specifications and requirements (Krzysztof)
> > > - unified return code variable (err everywhere)
> > > - left patches 10 and 13 untouched, we may amend later on (Robin)
> >
> > Geert, I would like to apply at least the first 13 patches.
> > Do you have any comments or even possibility to perform a regression test?
>
> I'll try to give it a try on my Adafruit Quad 14-segment display tomorrow..

With the missing return-statement added, the ht16k33 driver builds
and works fine: the kernel version is happily scrolling by.
I didn't test userspace line display control, as there is an issue
with the uSD interface on my OrangeCrab, preventing it from booting
into userspace.

Tested-by: Geert Uytterhoeven <geert@linux-m68k.org>

Gr{oetje,eeting}s,

                        Geert
  
Andy Shevchenko Feb. 15, 2024, 12:38 p.m. UTC | #7
On Thu, Feb 15, 2024 at 12:05:37PM +0100, Geert Uytterhoeven wrote:
> On Wed, Feb 14, 2024 at 7:45 PM Geert Uytterhoeven <geert@linux-m68k.org> wrote:
> > On Wed, Feb 14, 2024 at 6:57 PM Andy Shevchenko
> > <andriy.shevchenko@linux.intel.com> wrote:
> > > On Mon, Feb 12, 2024 at 07:01:33PM +0200, Andy Shevchenko wrote:
> > > > Add a new initial driver for Maxim MAX6958/6959 chips.
> > > > While developing that driver I realised that there is a lot
> > > > of duplication between ht16k33 and a new one. Hence set of
> > > > cleanups and refactorings.
> > > >
> > > > Note, the new driver has minimum support of the hardware and
> > > > I have plans to cover more features in the future.
> > > >
> > > > In v2:
> > > > - updated DT bindings to follow specifications and requirements (Krzysztof)
> > > > - unified return code variable (err everywhere)
> > > > - left patches 10 and 13 untouched, we may amend later on (Robin)
> > >
> > > Geert, I would like to apply at least the first 13 patches.
> > > Do you have any comments or even possibility to perform a regression test?
> >
> > I'll try to give it a try on my Adafruit Quad 14-segment display tomorrow...
> 
> With the missing return-statement added, the ht16k33 driver builds
> and works fine: the kernel version is happily scrolling by.
> I didn't test userspace line display control, as there is an issue
> with the uSD interface on my OrangeCrab, preventing it from booting
> into userspace.
> 
> Tested-by: Geert Uytterhoeven <geert@linux-m68k.org>

Thank you!

So far I have applied patches 1-6,8-9 with the respective suggestions
implemented.