Skip to contentSkip to conversation

Seven segment display support

PATCH In review Jaghathiswari Rankappagounder Natarajan 2 participants 6 messages Feb 7, 2017 – Feb 9, 2017

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover Seven segment display support

Hi Joel,
Nancy mentioned this patch can be included into openbmc linux tree now. Some other member will take up the work of addressing the comments from upstream reviewers and send the patch upstream.

This patchset includes:

Documentation for the binding which provides an interface for adding clock, data and clear signal GPIO lines to control seven segment display.

The platform device driver provides an API for displaying on two 7-segment displays, and implements the required bit-banging. The hardware assumed is 74HC164 wired to two 7-segment displays.

The character device driver implements the user-space API for letting a user write to two 7-segment displays including any conversion methods necessary to map the user input to two 7-segment displays.

Adding clock, data and clear signal GPIO lines in the devicetree to control seven segment display on zaius platform.

The platform driver matches on the device tree node; the platform driver also initializes the character device.

Tested that the seven segment display works properly by writing to the character device file on a EVB AST2500 board which also has 74HC164 wired to two 7-segment displays.

Jaghathiswari Rankappagounder Natarajan (4):
Documentation: dt-bindings: Document bindings for seven segment
display support
drivers: misc: Character device driver for seven segment display
drivers: misc: Platform driver for seven segment display support
arm: dts: Add dt-binding to support seven segment display on zaius

 .../devicetree/bindings/misc/seven-seg-gpio.txt    |  27 +++
 arch/arm/boot/dts/aspeed-bmc-opp-zaius.dts         |   8 +
 drivers/misc/Kconfig                               |  16 ++
 drivers/misc/Makefile                              |   2 +
 drivers/misc/seven_seg_disp.c                      | 201 ++++++++++++++++++++
 drivers/misc/seven_seg_disp.h                      |  34 ++++
 drivers/misc/seven_seg_gpio.c                      | 206 +++++++++++++++++++++
 7 files changed, 494 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/misc/seven-seg-gpio.txt
 create mode 100644 drivers/misc/seven_seg_disp.c
 create mode 100644 drivers/misc/seven_seg_disp.h
 create mode 100644 drivers/misc/seven_seg_gpio.c

--
2.11.0.483.g087da7b7c-goog

#1 lore raw

PATCH 1/4 Documentation: dt-bindings: Document bindings for seven segment display support

This binding provides interface for adding clock, data and clear signal GPIO lines to control seven segment display.

---
 .../devicetree/bindings/misc/seven-seg-gpio.txt    | 27 ++++++++++++++++++++++
 1 file changed, 27 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/misc/seven-seg-gpio.txt
Documentation/devicetree/bindings/misc/seven-seg-gpio.txt new file +27 -0
new file mode 100644
index 000000000000..9a4e25540104
@@ -0,0 +1,27 @@
+This binding defines interface to add clock, data and clear GPIO lines required
+for seven segment display support.
+
+Required properties:
+- compatible : should be "seven-seg-gpio-dev".
+- clock-gpios :  Should specify the GPIO pin connected to the Clock line on the
+  hardware.
+- data-gpios : Should specify the GPIO pin connected to Data line on the
+  hardware.
+- clear-gpios : Should specify the GPIO pin connected to Clear line on the
+  hardware.
+
+Optional properties:
+- refresh-interval-ms : The interval at which to refresh the display.
+  If this property is not present, the default value is 1000.
+
+Examples:
+
+#include <dt-bindings/gpio/gpio.h>
+
+seven-seg-disp {
+	compatible = "seven-seg-gpio-dev";
+	refresh-interval-ms = "1000";
+	clock-gpios = <&gpio 0 GPIO_ACTIVE_LOW>;
+	data-gpios = <&gpio 1 GPIO_ACTIVE_HIGH>;
+	clear-gpios = <&gpio 2 GPIO_ACTIVE_HIGH>;
+};

--
2.11.0.483.g087da7b7c-goog

#2 lore raw

PATCH 2/4 drivers: misc: Character device driver for seven segment display

In reply to Jaghathiswari Rankappagounder Natarajan

Character device driver which implements the user-space API for letting a user write to two 7-segment displays including any conversion methods necessary to map the user input to two 7-segment displays.

---
 drivers/misc/Kconfig          |   8 ++
 drivers/misc/Makefile         |   1 +
 drivers/misc/seven_seg_disp.c | 201 ++++++++++++++++++++++++++++++++++++++++++
 drivers/misc/seven_seg_disp.h |  34 +++++++
 4 files changed, 244 insertions(+)
 create mode 100644 drivers/misc/seven_seg_disp.c
 create mode 100644 drivers/misc/seven_seg_disp.h
drivers/misc/Kconfig +8 -0
index c802d2245108..4a221c1667c1 100644
@@ -804,6 +804,14 @@ config PANEL_BOOT_MESSAGE
 	  An empty message will only clear the display at driver init time. Any other
 	  printf()-formatted message is valid with newline and escape codes.
 
+config SEVEN_SEGMENT_DISPLAY
+        tristate "Character driver for seven segment display support"
+        help
+          Character device driver which implements the user-space
+          API for letting a user write to two 7-segment displays including
+          any conversion methods necessary to map the user input
+          to two 7-segment displays.
+
 config ASPEED_LPC_CTRL
 	depends on (ARCH_ASPEED || COMPILE_TEST) && REGMAP && MFD_SYSCON
 	bool "Aspeed BMC to HOST LPC bus controller"
drivers/misc/Makefile +1 -0
index cdcd1af48971..5ac8b2637174 100644
@@ -57,4 +57,5 @@ obj-$(CONFIG_ECHO)		+= echo/
 obj-$(CONFIG_VEXPRESS_SYSCFG)	+= vexpress-syscfg.o
 obj-$(CONFIG_CXL_BASE)		+= cxl/
 obj-$(CONFIG_PANEL)             += panel.o
+obj-$(CONFIG_SEVEN_SEGMENT_DISPLAY)     += seven_seg_disp.o
 obj-$(CONFIG_ASPEED_LPC_CTRL)	+= aspeed-lpc-ctrl.o
drivers/misc/seven_seg_disp.c new file +201 -0

201 lines not on this page · raw message

drivers/misc/seven_seg_disp.h new file +34 -0
new file mode 100644
index 000000000000..e4432a420159
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2016 Google, Inc
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 or later as
+ * published by the Free Software Foundation.
+ */
+
+#ifndef SEVEN_SEG_DISP_H
+#define SEVEN_SEG_DISP_H
+
+#include <linux/device.h>
+#include <linux/cdev.h>
+
+#define MAX_DISP_CHAR_SIZE 3
+
+#define DEFAULT_REFRESH_INTERVAL_MS 400
+
+struct seven_seg_disp_dev {
+	bool disp_data_valid;
+	u16 current_seven_seg_disp_data;
+	char seven_seg_disp_data_array[MAX_DISP_CHAR_SIZE];
+	struct device parent;
+	struct device *dev;
+	struct cdev cdev;
+	void (*update_seven_seg_data)(struct device *, u16 data);
+};
+
+int seven_seg_setup_cdev(struct seven_seg_disp_dev *disp_dev,
+	void (*update_disp_data)(struct device *, u16 data));
+
+void seven_seg_rem_cdev(struct seven_seg_disp_dev *disp_dev);
+
+#endif

--
2.11.0.483.g087da7b7c-goog

#3 lore raw

PATCH 3/4 drivers: misc: Platform driver for seven segment display support

In reply to Jaghathiswari Rankappagounder Natarajan

Platform device driver which provides an API for displaying on two 7-segment displays, and implements the required bit-banging. The hardware assumed is 74HC164 wired to two 7-segment displays.

---
 drivers/misc/Kconfig          |   8 ++
 drivers/misc/Makefile         |   1 +
 drivers/misc/seven_seg_gpio.c | 206 ++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 215 insertions(+)
 create mode 100644 drivers/misc/seven_seg_gpio.c
drivers/misc/Kconfig +8 -0
index 4a221c1667c1..c2914476e49e 100644
@@ -820,6 +820,14 @@ config ASPEED_LPC_CTRL
 	  through ioctl()s, the driver aso provides a read/write interface to a
 	  BMC ram region where host LPC read/write region can be buffered.
 
+config SEVEN_SEGMENT_GPIO
+        tristate "Platform driver to update seven segment display"
+        depends on SEVEN_SEGMENT_DISPLAY
+        help
+          Platform device driver which provides an API for displaying on two
+          7-segment displays, and implements the required bit-banging.
+          The hardware assumed is 74HC164 wired to two 7-segment displays.
+
 source "drivers/misc/c2port/Kconfig"
 source "drivers/misc/eeprom/Kconfig"
 source "drivers/misc/cb710/Kconfig"
drivers/misc/Makefile +1 -0
index 5ac8b2637174..463798e395f1 100644
@@ -59,3 +59,4 @@ obj-$(CONFIG_CXL_BASE)		+= cxl/
 obj-$(CONFIG_PANEL)             += panel.o
 obj-$(CONFIG_SEVEN_SEGMENT_DISPLAY)     += seven_seg_disp.o
 obj-$(CONFIG_ASPEED_LPC_CTRL)	+= aspeed-lpc-ctrl.o
+obj-$(CONFIG_SEVEN_SEGMENT_GPIO)        += seven_seg_gpio.o
drivers/misc/seven_seg_gpio.c new file +206 -0

206 lines not on this page · raw message

--
2.11.0.483.g087da7b7c-goog

#4 lore raw

PATCH 4/4 arm: dts: Add dt-binding to support seven segment display on zaius

In reply to Jaghathiswari Rankappagounder Natarajan

Add clock, data and clear signal GPIO lines to control seven segment display on zaius platform.

---
 arch/arm/boot/dts/aspeed-bmc-opp-zaius.dts | 8 ++++++++
 1 file changed, 8 insertions(+)
arch/arm/boot/dts/aspeed-bmc-opp-zaius.dts +8 -0
index e2195a641414..2c3297bec9b7 100644
@@ -74,6 +74,14 @@
 			gpios = <&gpio ASPEED_GPIO(AA, 2) GPIO_ACTIVE_LOW>;
 		};
 	};
+
+	seven-seg-disp {
+		compatible = "seven-seg-gpio-dev";
+		refresh-interval-ms = "400";
+		clock-gpios = <&gpio ASPEED_GPIO(J, 0) GPIO_ACTIVE_HIGH>;
+		data-gpios = <&gpio ASPEED_GPIO(J, 2) GPIO_ACTIVE_HIGH>;
+		clear-gpios = <&gpio ASPEED_GPIO(J, 1) GPIO_ACTIVE_HIGH>;
+	};
 };
 
 &fmc {

--
2.11.0.483.g087da7b7c-goog

maintainer
#5 lore raw
In reply to Jaghathiswari Rankappagounder Natarajan

Hello Jagha,

Quoted 4 lines · Jaghathiswari Rankappagounder Natarajan

Hi Joel,
Nancy mentioned this patch can be included into openbmc linux tree now. Some other member will take up the work of addressing the comments from upstream reviewers and send the patch upstream.

Just before you sent these patches we had a chat on the topic. I thought we decided to give the rest of this week for people to review the new process, and then on Monday I would publish a tree based on 4.10 that you could submit patches to. Sorry for not making this clear.

I suspect this set will apply to 4.10 as-is, so I will consider this your submission for the 4.10 tree next week.

Next time please have a read of the development process[1] and the rules for submitting patches[2] before sending patches. In particular, you need to set the target branch in the subject line so I know where you want the patches applied. If you you have any questions about the process please let me know so I can update the documentation.

[1] https://github.com/openbmc/linux/wiki/DevelopmentProcess
[2] https://github.com/openbmc/linux/wiki/SubmittingPatches

Cheers,

Joel

Quoted 47 lines

This patchset includes:

Documentation for the binding which provides an interface for adding clock, data and clear signal GPIO lines to control seven segment display.

The platform device driver provides an API for displaying on two 7-segment displays, and implements the required bit-banging. The hardware assumed is 74HC164 wired to two 7-segment displays.

The character device driver implements the user-space API for letting a user write to two 7-segment displays including any conversion methods necessary to map the user input to two 7-segment displays.

Adding clock, data and clear signal GPIO lines in the devicetree to control seven segment display on zaius platform.

The platform driver matches on the device tree node; the platform driver also initializes the character device.

Tested that the seven segment display works properly by writing to the character device file on a EVB AST2500 board which also has 74HC164 wired to two 7-segment displays.

Jaghathiswari Rankappagounder Natarajan (4):
Documentation: dt-bindings: Document bindings for seven segment
display support
drivers: misc: Character device driver for seven segment display
drivers: misc: Platform driver for seven segment display support
arm: dts: Add dt-binding to support seven segment display on zaius

 .../devicetree/bindings/misc/seven-seg-gpio.txt    |  27 +++
 arch/arm/boot/dts/aspeed-bmc-opp-zaius.dts         |   8 +
 drivers/misc/Kconfig                               |  16 ++
 drivers/misc/Makefile                              |   2 +
 drivers/misc/seven_seg_disp.c                      | 201 ++++++++++++++++++++
 drivers/misc/seven_seg_disp.h                      |  34 ++++
 drivers/misc/seven_seg_gpio.c                      | 206 +++++++++++++++++++++
 7 files changed, 494 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/misc/seven-seg-gpio.txt
 create mode 100644 drivers/misc/seven_seg_disp.c
 create mode 100644 drivers/misc/seven_seg_disp.h
 create mode 100644 drivers/misc/seven_seg_gpio.c

--
2.11.0.483.g087da7b7c-goog