Skip to contentSkip to conversation

Seven segment display support

PATCH In review Jaghathiswari Rankappagounder Natarajan 2 participants 9 messages Nov 20, 2016 – Dec 14, 2016

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

v5 cover Seven segment display support

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 EVB AST2500 board and on Zaius board.

A changelog between versions is included in the individual patches. Please provide feedback.

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                      | 197 ++++++++++++++++++++
 drivers/misc/seven_seg_disp.h                      |  34 ++++
 drivers/misc/seven_seg_gpio.c                      | 206 +++++++++++++++++++++
 7 files changed, 490 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.8.0.rc3.226.g39d4020

#1 lore raw

PATCH v5 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.

---
v2:
- No changes made

v3:
- No changes made

v4:
- No changes made

v5:
- Made the binding documentation update as a separate patch

 .../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 0000000..9a4e255
@@ -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.8.0.rc3.226.g39d4020

#2 lore raw

PATCH v5 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.

---
v2:
- Renamed driver as suggested by Rick
- Made the character driver generic so that the character device can attach
- to any compatible display drivers as suggested by Rick

v3:
- Provide support for user to also read the current display data as suggested
- by Rick
- Picked more descriptive names for variables as suggested by Rick
- Made the header name same as .c file name as suggested by Rick
- Made the guards match header name as suggested by Rick
- Picked a more descriptive name for setup_cdev function as suggested by Rick

v4:
- Provided changelog entry as suggested by Joel

v5:
- Corrected the style of multi-line comments as suggested by Joel
- Removed the name of driver from the top of file as suggested by Joel
- Added GPL version 2 or later as suggested by Joel
- Added a bool variable which indicates if any valid value is written to the
- char device file; so that correct result is returned when value is read
- from the file.

 drivers/misc/Kconfig          |   8 ++
 drivers/misc/Makefile         |   1 +
 drivers/misc/seven_seg_disp.c | 197 ++++++++++++++++++++++++++++++++++++++++++
 drivers/misc/seven_seg_disp.h |  34 ++++++++
 4 files changed, 240 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 a216b46..a21aec1 100644
@@ -791,6 +791,14 @@ config PANEL_CHANGE_MESSAGE
 	  If you say 'Y' here, you'll be able to choose a message yourself. Otherwise,
 	  say 'N' and keep the default message with the version.
 
+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 PANEL_BOOT_MESSAGE
 	depends on PANEL && PANEL_CHANGE_MESSAGE="y"
 	string "New initialization message"
drivers/misc/Makefile +1 -0
index b2fb6dbf..c2defbd 100644
@@ -56,4 +56,5 @@ obj-$(CONFIG_GENWQE)		+= genwqe/
 obj-$(CONFIG_ECHO)		+= echo/
 obj-$(CONFIG_VEXPRESS_SYSCFG)	+= vexpress-syscfg.o
 obj-$(CONFIG_CXL_BASE)		+= cxl/
+obj-$(CONFIG_SEVEN_SEGMENT_DISPLAY)	+= seven_seg_disp.o
 obj-$(CONFIG_PANEL)             += panel.o
drivers/misc/seven_seg_disp.c new file +197 -0

197 lines not on this page · raw message

drivers/misc/seven_seg_disp.h new file +34 -0
new file mode 100644
index 0000000..b0f93c5
@@ -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 1000
+
+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.8.0.rc3.226.g39d4020

#3 lore raw

PATCH v5 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.

---
v2:
- Renamed driver as suggested by Rick, Xo, Joel
- Moved static data members to a struct and used platform_set_drvdata
- to save the struct as suggested by Rick, Xo
- Moved the conversion logic(string to LED pattern) to the seven segment
- display driver(character device driver) as suggested by Rick
- Included a device tree property for display refresh interval as suggested
- by Xo
- Made the delay value used in udelay as a constant as suggested by Xo
- Included copyright header as suggested by Joel
- Corrected the style for multi-line comments as suggested by Joel
- Dropped the @param/@return annotations as suggested by Joel
- Removed obvious comments as suggested by Joel
- Used del_timer_sync as suggested by Joel

v3:
- Included API for clearing display as suggested by Rick

v4:
- Included changelog entry as suggested by Joel

v5:
- Corrected the style of multi-line comments as suggested by Joel
- Removed the name of driver from the top of file as suggested by Joel
- Added GPL version 2 or later as suggested by Joel
- Removed the variable which was used to indicate if

-  the user has given a valid display data; instead send data as 0(which
-  does not make the LED light up) before the user gives valid data;
-  after user gives valid data, send the valid data. Also removed the
-  mutex logic
 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 a21aec1..6508108 100644
@@ -812,6 +812,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_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 c2defbd..d9c0d20 100644
@@ -58,3 +58,4 @@ obj-$(CONFIG_VEXPRESS_SYSCFG)	+= vexpress-syscfg.o
 obj-$(CONFIG_CXL_BASE)		+= cxl/
 obj-$(CONFIG_SEVEN_SEGMENT_DISPLAY)	+= seven_seg_disp.o
 obj-$(CONFIG_PANEL)             += panel.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.8.0.rc3.226.g39d4020

#4 lore raw

PATCH v5 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.

---
v2:
- Moved the doc file to the same commit as the driver that it describes
- as suggested by Xo
- Removed abbreviation of names as suggested by Xo
- Corrected mismatch of property names between doc and actual usage
- as suggested by Xo
- Corrected the gpio designator in the second gpios property as suggested by
- Xo

v3:
- No changes made

v4:
- Included changelog entry as suggested by Joel

v5:
- No changes made

 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 8ef4ece..ccb8147 100644
@@ -43,6 +43,14 @@
 			gpios = <&gpio ASPEED_GPIO(H, 7) GPIO_ACTIVE_LOW>;
 		};
 	};
+
+	seven-seg-disp {
+		compatible = "seven-seg-gpio-dev";
+		refresh-interval-ms = "1000";
+		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.8.0.rc3.226.g39d4020

maintainer
#5 lore raw
In reply to Jaghathiswari Rankappagounder Natarajan

We spoke on IRC about the clock changes. Lets wait until those issues are addressed before reviewing this series.

Cheers,

Joel

Quoted 48 lines · Jaghathiswari Rankappagounder Natarajan

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 EVB AST2500 board and on Zaius board.

A changelog between versions is included in the individual patches. Please provide feedback.

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                      | 197 ++++++++++++++++++++
 drivers/misc/seven_seg_disp.h                      |  34 ++++
 drivers/misc/seven_seg_gpio.c                      | 206 +++++++++++++++++++++
 7 files changed, 490 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.8.0.rc3.226.g39d4020

#6 lore raw

Hi Joel,
Could you please help review this patch series. Would like to have the seven segment display driver for testing out on zaius machine. (I am trying to get the fan tach driver to work and I hope to send that along with pwm driver for review soon.)

Also you had mentioned about writing the LPC driver. Is that checked in?

Thanks,
Jagha

Quoted 69 lines · Joel Stanley

We spoke on IRC about the clock changes. Lets wait until those issues are addressed before reviewing this series.

Cheers,

Joel

Quoted 3 lines · Jaghathiswari Rankappagounder Natarajan

This patchset includes:

Documentation for the binding which provides an interface for adding

clock,

Quoted 3 lines

data and clear signal GPIO lines to control seven segment display.

The platform device driver provides an API for displaying on two

7-segment

Quoted 1 line

displays, and implements the required bit-banging. The hardware assumed

is

Quoted 3 lines

74HC164 wired to two 7-segment displays.

The character device driver implements the user-space API for letting a

user

Quoted 1 line

write to two 7-segment displays including any conversion methods

necessary

Quoted 3 lines

to map the user input to two 7-segment displays.

Adding clock, data and clear signal GPIO lines in the devicetree to

control

Quoted 3 lines

seven segment display on zaius platform.

The platform driver matches on the device tree node; the platform driver

also

Quoted 6 lines

initializes the character device.

Tested that the seven segment display works properly by writing to the character device file on EVB AST2500 board and on Zaius board.

A changelog between versions is included in the individual patches.

Please

Quoted 9 lines

provide feedback.

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

Quoted 5 lines
 .../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                      | 197

++++++++++++++++++++

Quoted 2 lines
 drivers/misc/seven_seg_disp.h                      |  34 ++++
 drivers/misc/seven_seg_gpio.c                      | 206

+++++++++++++++++++++

Quoted 2 lines
 7 files changed, 490 insertions(+)
 create mode 100644 Documentation/devicetree/

bindings/misc/seven-seg-gpio.txt

Quoted 7 lines
 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.8.0.rc3.226.g39d4020

maintainer
#7 lore raw

Hi Jagha,

Quoted 3 lines · Jaghathiswari Rankappagounder Natarajan

Hi Joel,
Could you please help review this patch series. Would like to have the seven segment display driver for testing out on zaius machine.

I have spent a fair amount of time reading your code. It would be nice to see other developers take a look as well. Have you asked for review from your peers?

Quoted 1 line

(I am trying to get the fan tach driver to work and I hope to send that a> along with pwm driver for review soon.)

If you think this driver is ready to go, I suggest you send it upstream for wider community review. Same for the pwm driver. Make sure you cc me so I can help out.

Quoted 1 line

Also you had mentioned about writing the LPC driver. Is that checked in?

Andrew sent a proposed driver some time ago. Did you have time to review it?

http://patchwork.ozlabs.org/patch/693032/

I think we may prefer an ioctl based approach, but this is up for debate.

Cheers,

Joel

Quoted 76 lines

Thanks,
Jagha

Quoted 69 lines · Joel Stanley

We spoke on IRC about the clock changes. Lets wait until those issues are addressed before reviewing this series.

Cheers,

Joel

Quoted 59 lines · Jaghathiswari Rankappagounder Natarajan

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 EVB AST2500 board and on Zaius board.

A changelog between versions is included in the individual patches. Please
provide feedback.

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                      | 197
++++++++++++++++++++
 drivers/misc/seven_seg_disp.h                      |  34 ++++
 drivers/misc/seven_seg_gpio.c                      | 206
+++++++++++++++++++++
 7 files changed, 490 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.8.0.rc3.226.g39d4020

#8 lore raw

Ok. I will send this driver upstream. Thanks for the feedback. I haven't looked into the proposed lpc driver. I will look at that.

Quoted 113 lines · Joel Stanley

Hi Jagha,

Quoted 2 lines · Jaghathiswari Rankappagounder Natarajan

Hi Joel,
Could you please help review this patch series. Would like to have the

seven

Quoted 1 line

segment display driver for testing out on zaius machine.

I have spent a fair amount of time reading your code. It would be nice to see other developers take a look as well. Have you asked for review from your peers?

Quoted 1 line

(I am trying to get the fan tach driver to work and I hope to send that

a> along with pwm driver for review soon.)

If you think this driver is ready to go, I suggest you send it upstream for wider community review. Same for the pwm driver. Make sure you cc me so I can help out.

Quoted 1 line

Also you had mentioned about writing the LPC driver. Is that checked in?

Andrew sent a proposed driver some time ago. Did you have time to review it?

http://patchwork.ozlabs.org/patch/693032/

I think we may prefer an ioctl based approach, but this is up for debate.

Cheers,

Joel

Quoted 24 lines

Thanks,
Jagha

Quoted 19 lines · Joel Stanley

We spoke on IRC about the clock changes. Lets wait until those issues are addressed before reviewing this series.

Cheers,

Joel

Quoted 9 lines · Jaghathiswari Rankappagounder Natarajan

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

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

is
74HC164 wired to two 7-segment displays.

The character device driver implements the user-space API for letting

a

Quoted 10 lines
Quoted 10 lines
Quoted 10 lines

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

Quoted 38 lines
Quoted 36 lines
Quoted 36 lines

also
initializes the character device.

Tested that the seven segment display works properly by writing to the character device file on EVB AST2500 board and on Zaius board.

A changelog between versions is included in the individual patches. Please
provide feedback.

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                      | 197
++++++++++++++++++++
 drivers/misc/seven_seg_disp.h                      |  34 ++++
 drivers/misc/seven_seg_gpio.c                      | 206
+++++++++++++++++++++
 7 files changed, 490 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.8.0.rc3.226.g39d4020