auxdisplay: Add support for the Titanmec TM1628 7 segment display controller
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.
To be decided is through which tree this series should go. I'd think SPI would be most suited, but that's a decision I leave up to the respective maintainers.
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.
Andreas Färber (2):
spi: gpio: Implement LSB First bitbang support
dt-bindings: vendor-prefixes: Add Titan Micro Electronics
Heiner Kallweit (4):
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
.../testing/sysfs-devices-auxdisplay-tm1628 | 7 + .../bindings/auxdisplay/titanmec,tm1628.yaml | 82 ++++ .../devicetree/bindings/vendor-prefixes.yaml | 2 + .../dts/amlogic/meson-gxl-s905w-tx3-mini.dts | 59 +++ drivers/auxdisplay/Kconfig | 10 + drivers/auxdisplay/Makefile | 1 + drivers/auxdisplay/tm1628.c | 368 ++++++++++++++++++ drivers/spi/spi-bitbang-txrx.h | 66 ++++ drivers/spi/spi-gpio.c | 42 +- 9 files changed, 628 insertions(+), 9 deletions(-) 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 1/6 spi: gpio: Implement LSB First bitbang support
From: Andreas Färber <[email protected]>
Add support for slave DT property spi-lsb-first, i.e., SPI_LSB_FIRST mode. Duplicate the inline helpers bitbang_txrx_be_cpha{0,1} as LE versions. Conditionally call them from all the spi-gpio txrx_word callbacks.
Some alternatives to this implementation approach were discussed back then [0], but eventually it was considered reasonable.
[0] https://lore.kernel.org/linux-arm-kernel/[email protected]/
--- drivers/spi/spi-bitbang-txrx.h | 66 ++++++++++++++++++++++++++++++++++ drivers/spi/spi-gpio.c | 42 +++++++++++++++++----- 2 files changed, 99 insertions(+), 9 deletions(-)
drivers/spi/spi-bitbang-txrx.h +66 -0
@@ -41,6 +41,8 @@* chips need ... there may be several reasons you'd need to tweak timings * in these routines, not just to make it faster or slower to match a * particular CPU clock rate. +* +* ToDo: Maybe the bitrev macros can be used to improve the code? */ static inline u32
@@ -106,3 +108,67 @@ bitbang_txrx_be_cpha1(struct spi_device *spi, }return word; } + +static inline u32 +bitbang_txrx_le_cpha0 (struct spi_device *spi, +unsigned int nsecs,unsigned int cpol,unsigned int flags, +u32 word,u8 bits) +{ +/* if (cpol == 0) this is SPI_MODE_0; else this is SPI_MODE_2 */ + +u32 oldbit = !(word &1 ); +/* clock starts at inactive polarity */ +for (;likely (bits); bits--) { + +/* setup LSB (to slave) on trailing edge */ +if ((flags &SPI_MASTER_NO_TX ) ==0 ) { +if ((word &1 ) != oldbit) { +setmosi (spi, word &1 ); + oldbit = word &1 ; + } + } +spidelay (nsecs);/* T(setup) */ + +setsck (spi, !cpol); +spidelay (nsecs); + +/* sample LSB (from slave) on leading edge */ + word >>=1 ; +if ((flags &SPI_MASTER_NO_RX ) ==0 ) + word |=getmiso (spi) << (bits -1 ); +setsck (spi, cpol); + } +return word; +} + +static inline u32 +bitbang_txrx_le_cpha1 (struct spi_device *spi, +unsigned int nsecs,unsigned int cpol,unsigned int flags, +u32 word,u8 bits) +{ +/* if (cpol == 0) this is SPI_MODE_1; else this is SPI_MODE_3 */ + +u32 oldbit = !(word &1 ); +/* clock starts at inactive polarity */ +for (;likely (bits); bits--) { + +/* setup LSB (to slave) on leading edge */ +setsck (spi, !cpol); +if ((flags &SPI_MASTER_NO_TX ) ==0 ) { +if ((word &1 ) != oldbit) { +setmosi (spi, word &1 ); + oldbit = word &1 ; + } + } +spidelay (nsecs);/* T(setup) */ + +setsck (spi, cpol); +spidelay (nsecs); + +/* sample LSB (from slave) on trailing edge */ + word >>=1 ; +if ((flags &SPI_MASTER_NO_RX ) ==0 ) + word |=getmiso (spi) << (bits -1 ); + } +return word; +}
drivers/spi/spi-gpio.c +33 -9
93 lines not on this page · raw message
Signature · 1 line
2.35.1
PATCH 2/6 dt-bindings: vendor-prefixes: Add Titan Micro Electronics
In reply to Heiner KallweitFrom: 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
@@ -1229,6 +1229,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 3/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 RFC work from Andreas Färber <[email protected]>.
--- .../bindings/auxdisplay/titanmec,tm1628.yaml | 82 +++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 Documentation/devicetree/bindings/auxdisplay/titanmec,tm1628.yaml
Documentation/devicetree/bindings/auxdisplay/titanmec,tm1628.yaml new file +82 -0
@@ -0,0 +1,82 @@ +# SPDX-License-Identifier: (GPL-2.0-or-later OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/leds/titanmec,tm1628.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Titan Micro Electronics TM1628 LED controller + +properties: + compatible: + enum: + - 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 + description: | + Properties for a single LED. + + properties: + reg: + description: | + 1-based grid number, followed by 1-based segment bit number. + maxItems: 1 + + required: + - reg + +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 4/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 5/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.
--- drivers/auxdisplay/Kconfig | 10 + drivers/auxdisplay/Makefile | 1 + drivers/auxdisplay/tm1628.c | 368 ++++++++++++++++++++++++++++++++++++ 3 files changed, 379 insertions(+) create mode 100644 drivers/auxdisplay/tm1628.c
drivers/auxdisplay/Kconfig +10 -0
@@ -203,6 +203,16 @@ 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 +368 -0
368 lines not on this page · raw message
Signature · 1 line
2.35.1
PATCH 6/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
Quoted 6 lines · Heiner Kallweit
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.
Could you please link to the discussion and/or summarize the rationale behind the NAK?
Cheers,
Miguel
Quoted 11 lines · Miguel Ojeda
Quoted 6 lines · Heiner Kallweit
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.
Could you please link to the discussion and/or summarize the rationale behind the NAK?
+Pavel
I didn't find an explicit reason, but I suppose Pavel sees this driver as one that makes use of the LED subsystem, but doesn't belong to it. In the following mail he's expressing his opinion that the driver should be best placed under auxdisplay.
https://lore.kernel.org/linux-arm-kernel/[email protected]/
Quoted 2 lines
Cheers,
Miguel
Heiner
Quoted 5 lines · Heiner Kallweit
I didn't find an explicit reason, but I suppose Pavel sees this driver as one that makes use of the LED subsystem, but doesn't belong to it. In the following mail he's expressing his opinion that the driver should be best placed under auxdisplay.
Ah, OK -- thanks!
Cheers,
Miguel
Hi,
Quoted 13 lines · Heiner Kallweit
Quoted 11 lines · Miguel Ojeda
Quoted 6 lines · Heiner Kallweit
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.
Could you please link to the discussion and/or summarize the rationale behind the NAK?
Quoted 8 lines
+Pavel
I didn't find an explicit reason, but I suppose Pavel sees this driver as one that makes use of the LED subsystem, but doesn't belong to it. In the following mail he's expressing his opinion that the driver should be best placed under auxdisplay.
And I disagreed. It does not fit with the other drivers in auxdisplay that were operating on a much higher level.
I'd also like to point out that I did implement the map_to_7segment API, as was suggested, as you will find in my tree - which you may have missed, referencing only the RFC patchset and putting your authorship on it exclusively? A move from one directory to another should not warrant my author and SoB getting removed from the actual driver.
Given that we need to manage a buffer with bits per segment or LED symbol, one idea that I haven't found time for yet was to implement it as framebuffer or drm device instead. (And most Realtek platforms got broken by removing the adjustable text base defines.)
Regards,
Andreas
Signature · 4 lines
SUSE Software Solutions Germany GmbH Maxfeldstr. 5, 90409 Nürnberg, Germany GF: Ivo Totev HRB 36809 (AG Nürnberg)
Quoted 23 lines · Andreas Färber
Hi,
Quoted 20 lines · Heiner Kallweit
Quoted 11 lines · Miguel Ojeda
Quoted 6 lines · Heiner Kallweit
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.
Could you please link to the discussion and/or summarize the rationale behind the NAK?
+Pavel
I didn't find an explicit reason, but I suppose Pavel sees this driver as one that makes use of the LED subsystem, but doesn't belong to it. In the following mail he's expressing his opinion that the driver should be best placed under auxdisplay.
Quoted 5 lines
And I disagreed. It does not fit with the other drivers in auxdisplay that were operating on a much higher level.
We need to find a place. And if Pavel has good reasons that it doesn't fit into the LED subsystem, and Miguel should be fine with having it in auxdisplay, then I'd see no reason to not go this way.
Quoted 1 line
I'd also like to point out that I did implement the
map_to_7segmentAPI,
Looking at the history of include/uapi/linux/map_to_7segment.h I see no commit from you. Seems I'm missing something here.
Quoted 5 lines
as was suggested, as you will find in my tree - which you may have missed, referencing only the RFC patchset and putting your authorship on it exclusively? A move from one directory to another should not warrant my author and SoB getting removed from the actual driver.
The driver includes major changes and I mentioned your work in the commit message. Also your still listed as MODULE_AUTHOR. My intention is to get a driver upstream, not to earn credits for something.
So sure, your SoB can be (re-)added.
Quoted 5 lines
Given that we need to manage a buffer with bits per segment or LED symbol, one idea that I haven't found time for yet was to implement it as framebuffer or drm device instead. (And most Realtek platforms got broken by removing the adjustable text base defines.)
I'm not aware of the Realtek platform issue, do you have a link to a related discussion? And wouldn't you think it's overengineering to write a DRM driver for a 7 segment display with 4 digits? Framebuffer seems to be deprecated based on my experience with pygame / SDL2.
Quoted 3 lines
Regards,
Andreas
Heiner
Rob Herring
maintainerRe: [PATCH 3/6] dt-bindings: auxdisplay: Add Titan Micro Electronics TM1628
In reply to Heiner KallweitQuoted 12 lines · Heiner Kallweit
Add a YAML schema binding for TM1628 auxdisplay
(7/11-segment LED) controller.This patch is partially based on previous RFC work from Andreas Färber <[email protected]>.
Signed-off-by Heiner Kallweit <[email protected]>--- .../bindings/auxdisplay/titanmec,tm1628.yaml | 82 +++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 Documentation/devicetree/bindings/auxdisplay/titanmec,tm1628.yaml
My bot found errors running 'make DT_CHECKER_FLAGS=-m dt_binding_check' on your patch (DT_CHECKER_FLAGS is new in v5.13):
yamllint warnings/errors:./Documentation/devicetree/bindings/auxdisplay/titanmec,tm1628.yaml:12:5: [warning] wrong indentation: expected 6 but found 4 (indentation)
dtschema/dtc warnings/errors:
/builds/robherring/linux-dt-review/Documentation/devicetree/bindings/auxdisplay/titanmec,tm1628.yaml: 'maintainers' is a required property
hint: Metaschema for devicetree binding documentation
from schema $id: http://devicetree.org/meta-schemas/base.yaml#
/builds/robherring/linux-dt-review/Documentation/devicetree/bindings/auxdisplay/titanmec,tm1628.yaml: 'additionalProperties' is a required property
hint: A schema without a "$ref" to another schema must define all properties and use "additionalProperties"
from schema $id: http://devicetree.org/meta-schemas/base.yaml#./Documentation/devicetree/bindings/auxdisplay/titanmec,tm1628.yaml: $id: relative path/filename doesn't match actual path or filename
expected: http://devicetree.org/schemas/auxdisplay/titanmec,tm1628.yaml#
/builds/robherring/linux-dt-review/Documentation/devicetree/bindings/auxdisplay/titanmec,tm1628.yaml: ignoring, error in schema:Documentation/devicetree/bindings/auxdisplay/titanmec,tm1628.example.dt.yaml:0:0: /example-0/spi/led-controller@0: failed to match any schema with compatible: ['titanmec,tm1628']
doc reference errors (make refcheckdocs):
See https://patchwork.ozlabs.org/patch/1595016
This check can fail if there are any dependencies. The base for a patch series is generally the most recent rc1.
If you already ran 'make dt_binding_check' and didn't see the above error(s), then make sure 'yamllint' is installed and dt-schema is up to date:
pip3 install dtschema --upgrade
Please check and re-submit.
resend from correct mail account:
Quoted 29 lines · Heiner Kallweit
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.
To be decided is through which tree this series should go. I'd think SPI would be most suited, but that's a decision I leave up to the respective maintainers.
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 inuapi/linux/map_to_7segment.has 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.
Quoted 2 lines
Successfully tested on a TX3 Mini TV box that has an SM1628C and a display with 4 digits and 7 symbols.
Thanks for dusting off sources and working on this! - it’s another piece of the upstream puzzle for distros that install on Android boxes.
I needed the following patch to address compile issues (missing include, and the recent void/int change in linux-next (I’m using 5.17.y):
drivers/auxdisplay/tm1628.c +0 -0
@@ -5,6 +5,7 @@
* Copyright (c) 2019 Andreas Färber
*/
+#include <linux/ctype.h>
#include <linux/delay.h>
#include <linux/leds.h>
#include <linux/module.h>
@@ -327,10 +328,11 @@ static int tm1628_spi_probe(struct spi_device *spi)
return device_create_file(&spi->dev, &dev_attr_display_text); }
-static void tm1628_spi_remove(struct spi_device *spi) +static int tm1628_spi_remove(struct spi_device *spi)
{
device_remove_file(&spi->dev, &dev_attr_display_text);
tm1628_set_display_ctrl(spi, false);+ return 0;
}
static void tm1628_spi_shutdown(struct spi_device *spi)
I also needed CONFIG_SPI_GPIO=y in kernel config. With this added the driver probes on my TX3 mini box and the display goes dark overwriting the default ‘boot’ text. The following systemd service and script sets the clock and flashes the colon separator on/off to count seconds:
https://github.com/chewitt/LibreELEC.tv/commit/c8f1ebe6f6c366188f18f9d2b401de6c2979fdd7
With the include fixup and maybe a Kconfig tweak, for the series:
Quoted 30 lines · Heiner Kallweit
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.
To be decided is through which tree this series should go. I'd think SPI would be most suited, but that's a decision I leave up to the respective maintainers.
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 inuapi/linux/map_to_7segment.has 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.
Quoted 2 lines
Successfully tested on a TX3 Mini TV box that has an SM1628C and a display with 4 digits and 7 symbols.
Thanks for dusting off sources and working on this! - it’s another piece of the upstream puzzle for distros that install on Android boxes.
I needed the following patch to address compile issues (missing include, and the recent void/int change in linux-next (I’m using 5.17.y):
drivers/auxdisplay/tm1628.c +1 -0
@@ -5,6 +5,7 @@* Copyright (c) 2019 Andreas Färber */ +#include <linux/ctype.h>
#include <linux/delay.h>
#include <linux/leds.h>
#include <linux/module.h>
@@ -327,10 +328,11 @@ static int tm1628_spi_probe(struct spi_device *spi)
return device_create_file(&spi->dev, &dev_attr_display_text); }
-static void tm1628_spi_remove(struct spi_device *spi) +static int tm1628_spi_remove(struct spi_device *spi)
{
device_remove_file(&spi->dev, &dev_attr_display_text);
tm1628_set_display_ctrl(spi, false);+ return 0;
}
static void tm1628_spi_shutdown(struct spi_device *spi)
I also needed CONFIG_SPI_GPIO=y in kernel config. With this added the driver probes on my TX3 mini box and the display goes dark overwriting the default ‘boot’ text. The following systemd service and script sets the clock and flashes the colon separator on/off to count seconds:
https://github.com/chewitt/LibreELEC.tv/commit/c8f1ebe6f6c366188f18f9d2b401de6c2979fdd7
With the include fixup and maybe a Kconfig tweak, for the series:
Re: [PATCH 3/6] dt-bindings: auxdisplay: Add Titan Micro Electronics TM1628
In reply to Rob HerringQuoted 39 lines · Rob Herring
Quoted 12 lines · Heiner Kallweit
Add a YAML schema binding for TM1628 auxdisplay
(7/11-segment LED) controller.This patch is partially based on previous RFC work from Andreas Färber <[email protected]>.
Signed-off-by Heiner Kallweit <[email protected]>--- .../bindings/auxdisplay/titanmec,tm1628.yaml | 82 +++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 Documentation/devicetree/bindings/auxdisplay/titanmec,tm1628.yamlMy bot found errors running 'make DT_CHECKER_FLAGS=-m
dt_binding_check' on your patch (DT_CHECKER_FLAGSis new in v5.13):yamllint warnings/errors:
./Documentation/devicetree/bindings/auxdisplay/titanmec,tm1628.yaml:12:5: [warning] wrong indentation: expected 6 but found 4 (indentation)dtschema/dtc warnings/errors:
/builds/robherring/linux-dt-review/Documentation/devicetree/bindings/auxdisplay/titanmec,tm1628.yaml: 'maintainers' is a required property
hint: Metaschema for devicetree binding documentation
from schema $id: http://devicetree.org/meta-schemas/base.yaml#
/builds/robherring/linux-dt-review/Documentation/devicetree/bindings/auxdisplay/titanmec,tm1628.yaml: 'additionalProperties' is a required property
hint: A schema without a "$ref" to another schema must define all properties and use "additionalProperties"
from schema $id: http://devicetree.org/meta-schemas/base.yaml#./Documentation/devicetree/bindings/auxdisplay/titanmec,tm1628.yaml: $id: relative path/filename doesn't match actual path or filename
expected: http://devicetree.org/schemas/auxdisplay/titanmec,tm1628.yaml#
/builds/robherring/linux-dt-review/Documentation/devicetree/bindings/auxdisplay/titanmec,tm1628.yaml: ignoring, error in schema:Documentation/devicetree/bindings/auxdisplay/titanmec,tm1628.example.dt.yaml:0:0: /example-0/spi/led-controller@0: failed to match any schema with compatible: ['titanmec,tm1628']doc reference errors (make refcheckdocs):
See https://patchwork.ozlabs.org/patch/1595016
This check can fail if there are any dependencies. The base for a patch series is generally the most recent rc1.
Quoted 8 lines
If you already ran 'make
dt_binding_check' and didn't see the above error(s), then make sure 'yamllint' is installed and dt-schema is up to date:pip3 install dtschema --upgrade
Please check and re-submit.
Thanks for the feedback. Will check and consider it in v2.
_______________________________________________
linux-amlogic mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-amlogic
Quoted 71 lines · Christian Hewitt
resend from correct mail account:
Quoted 29 lines · Heiner Kallweit
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.
To be decided is through which tree this series should go. I'd think SPI would be most suited, but that's a decision I leave up to the respective maintainers.
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 inuapi/linux/map_to_7segment.has 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.Quoted 2 lines
Successfully tested on a TX3 Mini TV box that has an SM1628C and a display with 4 digits and 7 symbols.
Thanks for dusting off sources and working on this! - it’s another piece of the upstream puzzle for distros that install on Android boxes.
I needed the following patch to address compile issues (missing include, and the recent void/int change in linux-next (I’m using 5.17.y):
drivers/auxdisplay/tm1628.c +3
-1@@ -5,6 +5,7 @@* Copyright (c) 2019 Andreas Färber */ +#include <linux/ctype.h> #include <linux/delay.h> #include <linux/leds.h> #include <linux/module.h> @@ -327,10 +328,11 @@ static int tm1628_spi_probe(struct spi_device *spi)return device_create_file (&spi->dev, &dev_attr_display_text); } -static void tm1628_spi_remove (struct spi_device *spi) +static int tm1628_spi_remove (struct spi_device *spi) {device_remove_file (&spi->dev, &dev_attr_display_text);tm1628_set_display_ctrl (spi, false); +return 0 ; }static void tm1628_spi_shutdown (struct spi_device *spi)I also needed
CONFIG_SPI_GPIO=yin kernel config. With this added the driver probes on my TX3 mini box and the display goes dark overwriting the default ‘boot’ text. The following systemd service and script sets the clock and flashes the colon separator on/off to count seconds:
Quoted 5 lines
https://github.com/chewitt/LibreELEC.tv/commit/c8f1ebe6f6c366188f18f9d2b401de6c2979fdd7
With the include fixup and maybe a
Kconfigtweak, for the series:Tested-by Christian Hewitt <[email protected]>
Thanks for testing!
On some systems the display controller may be connected to a HW SPI interface not using GPIO's. Therefore I'd prefer to not make the driver dependent on CONFIG_SPI_GPIO.
Quoted 30 lines · Heiner Kallweit
Quoted 23 lines · Andreas Färber
Hi,
Quoted 20 lines · Heiner Kallweit
Quoted 11 lines · Miguel Ojeda
Quoted 6 lines · Heiner Kallweit
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.
Could you please link to the discussion and/or summarize the rationale behind the NAK?
+Pavel
I didn't find an explicit reason, but I suppose Pavel sees this driver as one that makes use of the LED subsystem, but doesn't belong to it. In the following mail he's expressing his opinion that the driver should be best placed under auxdisplay.
Quoted 5 lines
And I disagreed. It does not fit with the other drivers in auxdisplay that were operating on a much higher level.
Quoted 8 lines
We need to find a place. And if Pavel has good reasons that it doesn't fit into the LED subsystem, and Miguel should be fine with having it in auxdisplay, then I'd see no reason to not go this way.
Quoted 1 line
I'd also like to point out that I did implement the
map_to_7segmentAPI,Looking at the history of
include/uapi/linux/map_to_7segment.hI see no commit from you. Seems I'm missing something here.
You're replying inline too early:
Quoted 1 line
Quoted 1 line
as was suggested, as you will find in my tree
As I said, I implemented it in my driver:
https://github.com/afaerber/linux/commit/bbecf951348c7de8ba922c6c002a09369b717d82
Thus me saying you are unnecessarily duplicating work that I already did, without ping'ing the thread or me and claiming the credit for an implementation change which I already did myself.
Quoted 9 lines
Quoted 5 lines
- which you may have
missed, referencing only the RFC patchset and putting your authorship on it exclusively? A move from one directory to another should not warrant my author and SoB getting removed from the actual driver.The driver includes major changes and I mentioned your work in the commit message. Also your still listed as
MODULE_AUTHOR. My intention is to get a driver upstream, not to earn credits for something.
So sure, your SoB can be (re-)added.
https://github.com/afaerber/linux/commits/rtd1295-next
Also note this 5-in-4 optimization:
https://github.com/afaerber/linux/commit/ff8284b6ed9dc1e354c35840afdaf50b1cd97fea
And several more chipsets being covered.
Quoted 7 lines
Quoted 5 lines
Given that we need to manage a buffer with bits per segment or LED symbol, one idea that I haven't found time for yet was to implement it as framebuffer or drm device instead. (And most Realtek platforms got broken by removing the adjustable text base defines.)
I'm not aware of the Realtek platform issue, do you have a link to a related discussion?
Realtek has a boot ROM at the beginning of memory space, which has been a problem from the first RFC and for most bootloaders required to tweak the kernel's text offset for successful boot. (Some not Open Source (LK) and/or not openly flashable.)
http://lists.infradead.org/pipermail/linux-arm-kernel/2017-February/487718.html
In 2020 that arm64 feature got removed without any further discussion:
https://lore.kernel.org/all/[email protected]/
I've tried to revert it, but that's been a pain:
https://github.com/afaerber/linux/commit/0d2c647781bc89ee95bfa7b80d71237c7ebea230
Quoted 4 lines
And wouldn't you think it's overengineering to
write a DRM driver for a 7 segment display with 4 digits? Framebuffer seems to be deprecated based on my experience with pygame / SDL2.
Is there any other API that would allow userspace to write to the buffer and bitblt parts to the SPI device?
Thinking of some optimizations I implemented in my driver to avoid unnecessary SPI transfers:
https://github.com/afaerber/linux/commit/46c40209db163a81474c6894ebbd90b5e238ce60
Regards,
Andreas
Signature · 4 lines
SUSE Software Solutions Germany GmbH Maxfeldstr. 5, 90409 Nürnberg, Germany GF: Ivo Totev HRB 36809 (AG Nürnberg)
Quoted 83 lines · Andreas Färber
Quoted 30 lines · Heiner Kallweit
Quoted 23 lines · Andreas Färber
Hi,
Quoted 20 lines · Heiner Kallweit
Quoted 11 lines · Miguel Ojeda
Quoted 6 lines · Heiner Kallweit
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.
Could you please link to the discussion and/or summarize the rationale behind the NAK?
+Pavel
I didn't find an explicit reason, but I suppose Pavel sees this driver as one that makes use of the LED subsystem, but doesn't belong to it. In the following mail he's expressing his opinion that the driver should be best placed under auxdisplay.
Quoted 5 lines
And I disagreed. It does not fit with the other drivers in auxdisplay that were operating on a much higher level.
Quoted 8 lines
We need to find a place. And if Pavel has good reasons that it doesn't fit into the LED subsystem, and Miguel should be fine with having it in auxdisplay, then I'd see no reason to not go this way.
Quoted 1 line
I'd also like to point out that I did implement the
map_to_7segmentAPI,Looking at the history of
include/uapi/linux/map_to_7segment.hI see no commit from you. Seems I'm missing something here.You're replying inline too early:
Quoted 1 line
Quoted 1 line
as was suggested, as you will find in my tree
As I said, I implemented it in my driver:
https://github.com/afaerber/linux/commit/bbecf951348c7de8ba922c6c002a09369b717d82
Thus me saying you are unnecessarily duplicating work that I already did, without ping'ing the thread or me and claiming the credit for an implementation change which I already did myself.
Quoted 9 lines
Quoted 5 lines
- which you may have
missed, referencing only the RFC patchset and putting your authorship on it exclusively? A move from one directory to another should not warrant my author and SoB getting removed from the actual driver.The driver includes major changes and I mentioned your work in the commit message. Also your still listed as
MODULE_AUTHOR. My intention is to get a driver upstream, not to earn credits for something.
So sure, your SoB can be (re-)added.https://github.com/afaerber/linux/commits/rtd1295-next
Also note this 5-in-4 optimization:
https://github.com/afaerber/linux/commit/ff8284b6ed9dc1e354c35840afdaf50b1cd97fea
And several more chipsets being covered.
Quoted 7 lines
Quoted 5 lines
Given that we need to manage a buffer with bits per segment or LED symbol, one idea that I haven't found time for yet was to implement it as framebuffer or drm device instead. (And most Realtek platforms got broken by removing the adjustable text base defines.)
I'm not aware of the Realtek platform issue, do you have a link to a related discussion?
Realtek has a boot ROM at the beginning of memory space, which has been a problem from the first RFC and for most bootloaders required to tweak the kernel's text offset for successful boot. (Some not Open Source (LK) and/or not openly flashable.)
Quoted 5 lines
http://lists.infradead.org/pipermail/linux-arm-kernel/2017-February/487718.html
In 2020 that arm64 feature got removed without any further discussion:
Note the TEXT_OFFSET is only an issue with Amlogic vendor bootloader, it has never been an issue with mainline U-Boot.
Neil
Quoted 21 lines
I've tried to revert it, but that's been a pain:
https://github.com/afaerber/linux/commit/0d2c647781bc89ee95bfa7b80d71237c7ebea230
Quoted 4 lines
And wouldn't you think it's overengineering to
write a DRM driver for a 7 segment display with 4 digits? Framebuffer seems to be deprecated based on my experience with pygame / SDL2.Is there any other API that would allow userspace to write to the buffer and bitblt parts to the SPI device?
Thinking of some optimizations I implemented in my driver to avoid unnecessary SPI transfers:
https://github.com/afaerber/linux/commit/46c40209db163a81474c6894ebbd90b5e238ce60
Regards,
Andreas
Quoted 17 lines · Neil Armstrong
Quoted 16 lines · Andreas Färber
Quoted 6 lines · Heiner Kallweit
Quoted 3 lines · Andreas Färber
[...] (And most Realtek platforms got
broken by removing the adjustable text base defines.)I'm not aware of the Realtek platform issue, do you have a link to a related discussion?
Realtek has a boot ROM at the beginning of memory space, which has been a problem from the first RFC and for most bootloaders required to tweak the kernel's text offset for successful boot. (Some not Open Source (LK) and/or not openly flashable.)
http://lists.infradead.org/pipermail/linux-arm-kernel/2017-February/487718.html
Quoted 6 lines
Quoted 3 lines
In 2020 that arm64 feature got removed without any further discussion:
Note the
TEXT_OFFSETis only an issue with Amlogic vendor bootloader, it has never been an issue with mainline U-Boot.
There is no mainline U-Boot for Realtek DHC (!= Amlogic Meson) though!
More important drivers than LED got blocked here, too, like MMC and USB and pinctrl and clk.
And as hinted above, some Realtek boards come with a vendor LK that I can't even patch a downstream version of.
Regards,
Andreas
Signature · 4 lines
SUSE Software Solutions Germany GmbH Maxfeldstr. 5, 90409 Nürnberg, Germany GF: Ivo Totev HRB 36809 (AG Nürnberg)
Mark Brown
maintainerRe: (subset) [PATCH 0/6] auxdisplay: Add support for the Titanmec TM1628 7 segment display controller
In reply to Heiner KallweitQuoted 11 lines · Heiner Kallweit
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.
To be decided is through which tree this series should go. I'd think SPI would be most suited, but that's a decision I leave up to the respective maintainers.
[...]
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-next
Thanks!
[1/6] spi: gpio: Implement LSB First bitbang support
commit: 1847e3046c528bd85bd51e2860f4139bd9052d6c
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks,
Mark
_______________________________________________
linux-amlogic mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-amlogic