2024-03-01 21:45:32

by Chris Packham

[permalink] [raw]
Subject: [PATCH v3 0/4] auxdisplay: 7 segment LED display

This series adds a driver for a 7 segment LED display.

I haven't had a chance to look at the gpio changes that'd be required to
have multiple characters as subnodes. I wanted to get the code that
addressed Andy and Rob's comments out before my weekend.
--
[1] - https://lore.kernel.org/lkml/[email protected]/

Chris Packham (4):
auxdisplay: Add 7-segment LED display driver
dt-bindings: auxdisplay: Add bindings for generic 7-segment LED
ARM: dts: marvell: Add 7-segment LED display on x530
ARM: dts: marvell: Indicate USB activity on x530

.../bindings/auxdisplay/gpio-7-segment.yaml | 42 ++++++
.../boot/dts/marvell/armada-385-atl-x530.dts | 22 +++-
drivers/auxdisplay/Kconfig | 10 ++
drivers/auxdisplay/Makefile | 1 +
drivers/auxdisplay/seg-led-gpio.c | 122 ++++++++++++++++++
5 files changed, 196 insertions(+), 1 deletion(-)
create mode 100644 Documentation/devicetree/bindings/auxdisplay/gpio-7-segment.yaml
create mode 100644 drivers/auxdisplay/seg-led-gpio.c

--
2.43.2



2024-03-01 22:00:22

by Chris Packham

[permalink] [raw]
Subject: [PATCH v3 4/4] ARM: dts: marvell: Indicate USB activity on x530

Use the dot on the 7-segment LED block to indicate USB access on the
x530.

Signed-off-by: Chris Packham <[email protected]>
---

Notes:
Changes in v3:
- None
Changes in v2:
- New

arch/arm/boot/dts/marvell/armada-385-atl-x530.dts | 9 +++++++++
1 file changed, 9 insertions(+)

diff --git a/arch/arm/boot/dts/marvell/armada-385-atl-x530.dts b/arch/arm/boot/dts/marvell/armada-385-atl-x530.dts
index 60c2abf572b6..a53dd17d11b4 100644
--- a/arch/arm/boot/dts/marvell/armada-385-atl-x530.dts
+++ b/arch/arm/boot/dts/marvell/armada-385-atl-x530.dts
@@ -54,6 +54,15 @@ &led_7seg_gpio 4 GPIO_ACTIVE_LOW
&led_7seg_gpio 5 GPIO_ACTIVE_LOW
&led_7seg_gpio 6 GPIO_ACTIVE_LOW>;
};
+
+ leds {
+ compatible = "gpio-leds";
+ led-0 {
+ label = "usb";
+ gpios = <&led_7seg_gpio 7 GPIO_ACTIVE_LOW>;
+ linux,default-trigger = "usb-host";
+ };
+ };
};

&pciec {
--
2.43.2


2024-03-02 22:32:10

by Chris Packham

[permalink] [raw]
Subject: [PATCH v3 2/4] dt-bindings: auxdisplay: Add bindings for generic 7-segment LED

Add bindings for a generic 7-segment LED display using GPIOs.

Signed-off-by: Chris Packham <[email protected]>
---

Notes:
Changes in v3:
- Set maxItems: 7
- Expand description of segment-gpios property.
- Use compatible = "gpio-7-segment" as suggested by Rob
Changes in v2:
- Use compatible = "generic-gpio-7seg" to keep checkpatch.pl happy

.../bindings/auxdisplay/gpio-7-segment.yaml | 42 +++++++++++++++++++
1 file changed, 42 insertions(+)
create mode 100644 Documentation/devicetree/bindings/auxdisplay/gpio-7-segment.yaml

diff --git a/Documentation/devicetree/bindings/auxdisplay/gpio-7-segment.yaml b/Documentation/devicetree/bindings/auxdisplay/gpio-7-segment.yaml
new file mode 100644
index 000000000000..76af4bf4e9a6
--- /dev/null
+++ b/Documentation/devicetree/bindings/auxdisplay/gpio-7-segment.yaml
@@ -0,0 +1,42 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/auxdisplay/gpio-7-segment.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: GPIO based LED segment display
+
+maintainers:
+ - Chris Packham <[email protected]>
+
+properties:
+ compatible:
+ const: gpio-7-segment
+
+ segment-gpios:
+ description:
+ An array of GPIOs one per segment. The first GPIO corresponds to the A
+ segment the last GPIO corresponds to the G segment.
+ minItems: 7
+ maxItems: 7
+
+required:
+ - segment-gpios
+
+additionalProperties: false
+
+examples:
+ - |
+
+ #include <dt-bindings/gpio/gpio.h>
+
+ led-7seg {
+ compatible = "gpio-7-segment";
+ segment-gpios = <&gpio 0 GPIO_ACTIVE_LOW
+ &gpio 1 GPIO_ACTIVE_LOW
+ &gpio 2 GPIO_ACTIVE_LOW
+ &gpio 3 GPIO_ACTIVE_LOW
+ &gpio 4 GPIO_ACTIVE_LOW
+ &gpio 5 GPIO_ACTIVE_LOW
+ &gpio 6 GPIO_ACTIVE_LOW>;
+ };
--
2.43.2


2024-03-02 22:37:05

by Chris Packham

[permalink] [raw]
Subject: [PATCH v3 3/4] ARM: dts: marvell: Add 7-segment LED display on x530

The Allied Telesis x530 products have a 7-segment LED display which is
used for node identification when the devices are stacked. Represent
this as a generic-gpio-7seg device.

Signed-off-by: Chris Packham <[email protected]>
---

Notes:
Changes in v3:
- Use compatible = "gpio-7-segment" as suggested by Rob
Changes in v2:
- Use compatible = "generic-gpio-7seg" to keep checkpatch.pl happy

arch/arm/boot/dts/marvell/armada-385-atl-x530.dts | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/marvell/armada-385-atl-x530.dts b/arch/arm/boot/dts/marvell/armada-385-atl-x530.dts
index 5a9ab8410b7b..60c2abf572b6 100644
--- a/arch/arm/boot/dts/marvell/armada-385-atl-x530.dts
+++ b/arch/arm/boot/dts/marvell/armada-385-atl-x530.dts
@@ -43,6 +43,17 @@ uart0: serial@12000 {
};
};
};
+
+ led-7seg {
+ compatible = "gpio-7-segment";
+ segment-gpios = <&led_7seg_gpio 0 GPIO_ACTIVE_LOW
+ &led_7seg_gpio 1 GPIO_ACTIVE_LOW
+ &led_7seg_gpio 2 GPIO_ACTIVE_LOW
+ &led_7seg_gpio 3 GPIO_ACTIVE_LOW
+ &led_7seg_gpio 4 GPIO_ACTIVE_LOW
+ &led_7seg_gpio 5 GPIO_ACTIVE_LOW
+ &led_7seg_gpio 6 GPIO_ACTIVE_LOW>;
+ };
};

&pciec {
@@ -149,7 +160,7 @@ i2c@3 {
#size-cells = <0>;
reg = <3>;

- gpio@20 {
+ led_7seg_gpio: gpio@20 {
compatible = "nxp,pca9554";
gpio-controller;
#gpio-cells = <2>;
--
2.43.2