auxdisplay: Add support for the Titanmec TM1628 7 segment display controller
v4 cover auxdisplay: Add support for the Titanmec TM1628 7 segment display controller
This series adds support for the Titanmec TM1628 7 segment display controller. It's based on previous RFC work from Andreas Färber. The RFC version placed the driver in the LED subsystem, but this was NAK'ed by the LED maintainer. Therefore I moved the driver to /drivers/auxdisplay what seems most reasonable to me.
Further changes to the RFC version:
- Driver can be built also w/o LED class support, for displays that don't have any symbols to be exposed as LED's.
- Simplified the code and rewrote a lot of it.
- Driver is now kind of a MVP, but functionality should be sufficient for most use cases.
- Use the existing 7 segment support in uapi/linux/map_to_7segment.h as suggested by Geert Uytterhoeven.
Note: There's a number of chips from other manufacturers that are
almost identical, e.g. FD628, SM1628. Only difference I saw so far is that they partially support other display modes.
TM1628: 6x12, 7x11
SM1628C: 4x13, 5x12, 6x11, 7x10
For typical displays on devices using these chips this difference shouldn't matter.
Successfully tested on a TX3 Mini TV box that has an SM1628C and a display with 4 digits and 7 symbols.
v2:
- (re-)add Andreas' SoB to two patches
- fix YAML issues
- include ctype.h explicitly
- add info message in probe()
v3:
- remove patch 1 because it has been applied via the SPI tree already
- fix remaining YAML issues in patch 2
- follow Miguel's suggestion on usage of Co-Developed-by
v4:
- add patch for MAINTAINERS entry
- incorporate Miguel's review comments
- Replace Co-Developed-by with Co-developed-by (checkpatch)
Andreas Färber (1):
dt-bindings: vendor-prefixes: Add Titan Micro Electronics
Heiner Kallweit (5):
dt-bindings: auxdisplay: Add Titan Micro Electronics TM1628
docs: ABI: document tm1628 attribute display-text
auxdisplay: add support for Titanmec TM1628 7 segment display
controller
arm64: dts: meson-gxl-s905w-tx3-mini: add support for the 7 segment
display
MAINTAINERS: Add entry for tm1628 auxdisplay driver
.../testing/sysfs-devices-auxdisplay-tm1628 | 7 + .../bindings/auxdisplay/titanmec,tm1628.yaml | 92 +++++ .../devicetree/bindings/vendor-prefixes.yaml | 2 + MAINTAINERS | 7 + .../dts/amlogic/meson-gxl-s905w-tx3-mini.dts | 59 +++ drivers/auxdisplay/Kconfig | 11 + drivers/auxdisplay/Makefile | 1 + drivers/auxdisplay/tm1628.c | 376 ++++++++++++++++++ 8 files changed, 555 insertions(+) create mode 100644 Documentation/ABI/testing/sysfs-devices-auxdisplay-tm1628 create mode 100644 Documentation/devicetree/bindings/auxdisplay/titanmec,tm1628.yaml create mode 100644 drivers/auxdisplay/tm1628.c
Signature · 1 line
2.35.1
PATCH v4 1/6 dt-bindings: vendor-prefixes: Add Titan Micro Electronics
From: Andreas Färber <[email protected]>
Assign vendor prefix "titanmec", matching their domain name.
--- Documentation/devicetree/bindings/vendor-prefixes.yaml | 2 ++ 1 file changed, 2 insertions(+)
Documentation/devicetree/bindings/vendor-prefixes.yaml +2 -0
@@ -1238,6 +1238,8 @@ patternProperties: description: Texas Instruments "^tianma,.*": description: Tianma Micro-electronics Co., Ltd. + "^titanmec,.*": + description: Shenzhen Titan Micro Electronics Co., Ltd. "^tlm,.*": description: Trusted Logic Mobility "^tmt,.*":
Signature · 1 line
2.35.1
PATCH v4 2/6 dt-bindings: auxdisplay: Add Titan Micro Electronics TM1628
In reply to Heiner KallweitAdd a YAML schema binding for TM1628 auxdisplay
(7/11-segment LED) controller.
This patch is partially based on previous work from Andreas Färber <[email protected]>.
--- .../bindings/auxdisplay/titanmec,tm1628.yaml | 92 +++++++++++++++++++ 1 file changed, 92 insertions(+) create mode 100644 Documentation/devicetree/bindings/auxdisplay/titanmec,tm1628.yaml
Documentation/devicetree/bindings/auxdisplay/titanmec,tm1628.yaml new file +92 -0
@@ -0,0 +1,92 @@ +# SPDX-License-Identifier: (GPL-2.0-or-later OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/auxdisplay/titanmec,tm1628.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Titan Micro Electronics TM1628 LED controller + +maintainers: + - Andreas Färber <[email protected]> + - Heiner Kallweit <[email protected]> + +allOf: + - $ref: /schemas/spi/spi-peripheral-props.yaml# + +properties: + compatible: + const: titanmec,tm1628 + + reg: + maxItems: 1 + + grid: + description: + Mapping of display digit position to grid number. + This implicitly defines the display size. + $ref: /schemas/types.yaml#/definitions/uint8-array + minItems: 1 + maxItems: 7 + + segment-mapping: + description: + Mapping of 7 segment display segments A-G to bit numbers 1-12. + $ref: /schemas/types.yaml#/definitions/uint8-array + minItems: 7 + maxItems: 7 + + "#address-cells": + const: 2 + + "#size-cells": + const: 0 + +required: + - compatible + - reg + +patternProperties: + "^.*@[1-7],([1-9]|1[0-6])$": + type: object + $ref: /schemas/leds/common.yaml# + unevaluatedProperties: false + description: | + Properties for a single LED. + + properties: + reg: + description: | + 1-based grid number, followed by 1-based segment bit number. + maxItems: 1 + + required: + - reg + +unevaluatedProperties: false + +examples: + - | + #include <dt-bindings/leds/common.h> + + spi { + #address-cells = <1>; + #size-cells = <0>; + + led-controller@0 { + compatible = "titanmec,tm1628"; + reg = <0>; + spi-3-wire; + spi-lsb-first; + spi-max-frequency = <500000>; + grid = /bits/ 8 <4 3 2 1>; + segment-mapping = /bits/ 8 <4 5 6 1 2 3 7>; + #address-cells = <2>; + #size-cells = <0>; + + alarmn@5,4 { + reg = <5 4>; + function = LED_FUNCTION_ALARM; + }; + }; + }; +...
Signature · 1 line
2.35.1
PATCH v4 3/6 docs: ABI: document tm1628 attribute display_text
In reply to Heiner KallweitDocument the attribute for reading / writing the text to be displayed on the 7 segment display.
--- Documentation/ABI/testing/sysfs-devices-auxdisplay-tm1628 | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 Documentation/ABI/testing/sysfs-devices-auxdisplay-tm1628
Documentation/ABI/testing/sysfs-devices-auxdisplay-tm1628 new file +7 -0
@@ -0,0 +1,7 @@ +What: /sys/devices/.../display_text +Date: February 2022 +Contact: Heiner Kallweit <[email protected]> +Description: + The text to be displayed on the 7 segment display. + Any printable character is allowed as input, but some + can not be displayed in a readable way with 7 segments.
Signature · 1 line
2.35.1
PATCH v4 4/6 auxdisplay: add support for Titanmec TM1628 7 segment display controller
In reply to Heiner KallweitThis patch adds support for the Titanmec TM1628 7 segment display controller. It's based on previous RFC work from Andreas Färber. The RFC version placed the driver in the LED subsystem, but this was NAK'ed by the LED maintainer. Therefore I moved the driver to /drivers/auxdisplay what seems most reasonable to me.
Further changes to the RFC version:
- Driver can be built also w/o LED class support, for displays that don't have any symbols to be exposed as LED's.
- Simplified the code and rewrote a lot of it.
- Driver is now kind of a MVP, but functionality should be sufficient for most use cases.
- Use the existing 7 segment support in uapi/linux/map_to_7segment.h as suggested by Geert Uytterhoeven.
Note: There's a number of chips from other manufacturers that are
almost identical, e.g. FD628, SM1628. Only difference I saw so far is that they partially support other display modes.
TM1628: 6x12, 7x11
SM1628C: 4x13, 5x12, 6x11, 7x10
For typical displays on devices using these chips this difference shouldn't matter.
Successfully tested on a TX3 Mini TV box that has an SM1628C and a display with 4 digits and 7 symbols.
---
v3:
- use Co-Developed-by
v4:
- switch to Co-developed-by
- style fixes
- fix potential write beyond end in display_text_store()
--- drivers/auxdisplay/Kconfig | 11 ++ drivers/auxdisplay/Makefile | 1 + drivers/auxdisplay/tm1628.c | 376 ++++++++++++++++++++++++++++++++++++ 3 files changed, 388 insertions(+) create mode 100644 drivers/auxdisplay/tm1628.c
drivers/auxdisplay/Kconfig +11 -0
@@ -203,6 +203,17 @@ config ARM_CHARLCD line and the Linux version on the second line, but that's still useful. +config TM1628 + tristate "TM1628 driver for LED 7/11 segment displays" + depends on SPI + depends on OF || COMPILE_TEST + help + Say Y to enable support for Titan Micro Electronics TM1628 + LED controller. + + It's a 3-wire SPI device controlling a two-dimensional grid of + LEDs. Dimming is applied to all outputs through an internal PWM. + menuconfig PARPORT_PANEL tristate "Parallel port LCD/Keypad Panel support" depends on PARPORT
drivers/auxdisplay/Makefile +1 -0
@@ -14,3 +14,4 @@ obj-$(CONFIG_HT16K33) += ht16k33.o obj-$(CONFIG_PARPORT_PANEL) += panel.o obj-$(CONFIG_LCD2S) += lcd2s.o obj-$(CONFIG_LINEDISP) += line-display.o +obj-$(CONFIG_TM1628) += tm1628.o
drivers/auxdisplay/tm1628.c new file +376 -0
376 lines not on this page · raw message
Signature · 1 line
2.35.1
PATCH v4 5/6 arm64: dts: meson-gxl-s905w-tx3-mini: add support for the 7 segment display
In reply to Heiner KallweitThis patch adds support for the 7 segment display of the device.
--- .../dts/amlogic/meson-gxl-s905w-tx3-mini.dts | 59 +++++++++++++++++++ 1 file changed, 59 insertions(+)
arch/arm64/boot/dts/amlogic/meson-gxl-s905w-tx3-mini.dts +59 -0
@@ -10,6 +10,7 @@ #include "meson-gxl-s905x.dtsi" #include "meson-gx-p23x-q20x.dtsi" +#include <dt-bindings/leds/common.h> / { compatible = "oranth,tx3-mini", "amlogic,s905w", "amlogic,meson-gxl";
@@ -19,6 +20,64 @@ memory@0 { device_type = "memory"; reg = <0x0 0x0 0x0 0x40000000>; /* 1 GiB or 2 GiB */ }; + + spi { + compatible = "spi-gpio"; + sck-gpios = <&gpio GPIODV_27 GPIO_ACTIVE_HIGH>; + mosi-gpios = <&gpio GPIODV_26 GPIO_ACTIVE_HIGH>; + cs-gpios = <&gpio_ao GPIOAO_4 GPIO_ACTIVE_LOW>; + num-chipselects = <1>; + #address-cells = <1>; + #size-cells = <0>; + + tm1628: led-controller@0 { + compatible = "titanmec,tm1628"; + reg = <0>; + spi-3wire; + spi-lsb-first; + spi-rx-delay-us = <1>; + spi-max-frequency = <500000>; + #address-cells = <2>; + #size-cells = <0>; + + segment-mapping = /bits/ 8 <4 5 6 1 2 3 7>; + grid = /bits/ 8 <4 3 2 1>; + + alarm@5,1 { + reg = <5 1>; + function = LED_FUNCTION_ALARM; + }; + + usb@5,2 { + reg = <5 2>; + function = LED_FUNCTION_USB; + }; + play@5,3 { + reg = <5 3>; + function = "play"; + }; + + pause@5,4 { + reg = <5 4>; + function = "pause"; + }; + + colon@5,5 { + reg = <5 5>; + function = "colon"; + }; + + lan@5,6 { + reg = <5 6>; + function = LED_FUNCTION_LAN; + }; + + wlan@5,7 { + reg = <5 7>; + function = LED_FUNCTION_WLAN; + }; + }; + }; }; &ir {
Signature · 1 line
2.35.1
PATCH v4 6/6 MAINTAINERS: Add entry for tm1628 auxdisplay driver
In reply to Heiner KallweitAdd maintainer entry for tm1628 7-segment LED display driver.
--- MAINTAINERS | 7 +++++++ 1 file changed, 7 insertions(+)
MAINTAINERS +7 -0
@@ -19672,6 +19672,13 @@ W: http://sourceforge.net/projects/tlan/ F: Documentation/networking/device_drivers/ethernet/ti/tlan.rst F: drivers/net/ethernet/ti/tlan.* +TM1628 LED CONTROLLER DRIVER +M: Heiner Kallweit <[email protected]> +S: Maintained +F: Documentation/devicetree/bindings/auxdisplay/titanmec,tm1628.yaml +F: Documentation/ABI/testing/sysfs-devices-auxdisplay-tm1628 +F: drivers/auxdisplay/tm1628.c + TM6000 VIDEO4LINUX DRIVER M: Mauro Carvalho Chehab <[email protected]> L: [email protected]
Signature · 1 line
2.35.1