Seven segment display support
v4 cover Seven segment display support
This patchset includes:
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.
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.
Adding clock, data and clear signal lines in the devicetree to control seven segment display on zaius platform.
A changelog between versions is included in the individual patches. Please provide feedback.
Thanks,
Jagha
Jaghathiswari Rankappagounder Natarajan (3):
drivers: misc: Character device driver for seven segment display
drivers: misc: Platform driver for seven segment display support
devicetree: Add devicetree changes to support seven segment display on
zaius
.../bindings/misc/seven_segment_gpio.txt | 23 +++ arch/arm/boot/dts/aspeed-bmc-opp-zaius.dts | 8 + drivers/misc/Kconfig | 16 ++ drivers/misc/Makefile | 2 + drivers/misc/seven_seg_disp.c | 198 ++++++++++++++++++ drivers/misc/seven_seg_disp.h | 35 ++++ drivers/misc/seven_seg_gpio.c | 225 +++++++++++++++++++++ 7 files changed, 507 insertions(+) create mode 100644 Documentation/devicetree/bindings/misc/seven_segment_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
PATCH v4 1/3 drivers: misc: Character device driver for seven segment display
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
drivers/misc/Kconfig | 8 ++ drivers/misc/Makefile | 1 + drivers/misc/seven_seg_disp.c | 198 ++++++++++++++++++++++++++++++++++++++++++ drivers/misc/seven_seg_disp.h | 35 ++++++++ 4 files changed, 242 insertions(+) create mode 100644 drivers/misc/seven_seg_disp.c create mode 100644 drivers/misc/seven_seg_disp.h
drivers/misc/Kconfig +8 -0
@@ -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_BT_IPMI_HOST tristate "BT IPMI host driver" help
drivers/misc/Makefile +1 -0
@@ -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_BT_IPMI_HOST) += bt-host.o
drivers/misc/seven_seg_disp.c new file +198 -0
198 lines not on this page · raw message
drivers/misc/seven_seg_disp.h new file +35 -0
@@ -0,0 +1,35 @@ +/* +* Seven segment display support +* * 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 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 1000 + +struct seven_seg_disp_dev { +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
PATCH v4 2/3 drivers: misc: Platform driver for seven segment display support
In reply to Jaghathiswari Rankappagounder NatarajanPlatform 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
.../bindings/misc/seven_segment_gpio.txt | 23 +++ drivers/misc/Kconfig | 8 + drivers/misc/Makefile | 1 + drivers/misc/seven_seg_gpio.c | 225 +++++++++++++++++++++ 4 files changed, 257 insertions(+) create mode 100644 Documentation/devicetree/bindings/misc/seven_segment_gpio.txt create mode 100644 drivers/misc/seven_seg_gpio.c
Documentation/devicetree/bindings/misc/seven_segment_gpio.txt new file +23 -0
@@ -0,0 +1,23 @@ +Seven segment display support connected to GPIO lines + +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>; +};
drivers/misc/Kconfig +8 -0
@@ -817,6 +817,14 @@ config ASPEED_BT_IPMI_HOST help Support for the Aspeed BT ipmi host. +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
@@ -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_BT_IPMI_HOST) += bt-host.o +obj-$(CONFIG_SEVEN_SEGMENT_GPIO) += seven_seg_gpio.o
drivers/misc/seven_seg_gpio.c new file +225 -0
225 lines not on this page · raw message
--
2.8.0.rc3.226.g39d4020
PATCH v4 3/3 devicetree: Add devicetree changes to support seven segment display on zaius
In reply to Jaghathiswari Rankappagounder NatarajanAdd clock, data and clear signal 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 suggetsed by Joel
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
@@ -83,6 +83,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>; + }; }; &uart5 {
--
2.8.0.rc3.226.g39d4020
Hi Joel,
Could you please provide feedback for this driver.
Thanks,
Jagha
Quoted 47 lines · Jaghathiswari Rankappagounder Natarajan
This patchset includes:
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.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.Adding clock, data and clear signal lines in the devicetree to control seven segment display on zaius platform.
A changelog between versions is included in the individual patches. Please provide feedback.
Thanks,
JaghaJaghathiswari Rankappagounder Natarajan (3):
drivers: misc: Character device driver for seven segment display
drivers: misc: Platform driver for seven segment display support
devicetree: Add devicetree changes to support seven segment display on
zaius.../bindings/misc/seven_segment_gpio.txt | 23 +++ arch/arm/boot/dts/aspeed-bmc-opp-zaius.dts | 8 + drivers/misc/Kconfig | 16 ++ drivers/misc/Makefile | 2 + drivers/misc/seven_seg_disp.c | 198 ++++++++++++++++++ drivers/misc/seven_seg_disp.h | 35 ++++ drivers/misc/seven_seg_gpio.c | 225 +++++++++++++++++++++ 7 files changed, 507 insertions(+) create mode 100644 Documentation/devicetree/bindings/misc/seven_segment_ 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
Joel Stanley
maintainerHello Jagha,
Quoted 3 lines · Jaghathiswari Rankappagounder Natarajan
Hi Joel,
Could you please provide feedback for this driver.
You have not addressed all of the comments from Rick in v4 of your patches. The first thing I noticed is he pointed out you need to separate out the device tree documentation from the code. I stopped reading at this point.
Please go back and re-read the previous review and ensure your patches address all comments.
Cheers,
Joel
Quoted 55 lines
Thanks,
JaghaQuoted 47 lines · Jaghathiswari Rankappagounder Natarajan
This patchset includes:
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.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.Adding clock, data and clear signal lines in the devicetree to control seven segment display on zaius platform.
A changelog between versions is included in the individual patches. Please provide feedback.
Thanks,
JaghaJaghathiswari Rankappagounder Natarajan (3):
drivers: misc: Character device driver for seven segment display
drivers: misc: Platform driver for seven segment display support
devicetree: Add devicetree changes to support seven segment display on
zaius.../bindings/misc/seven_segment_gpio.txt | 23 +++ arch/arm/boot/dts/aspeed-bmc-opp-zaius.dts | 8 + drivers/misc/Kconfig | 16 ++ drivers/misc/Makefile | 2 + drivers/misc/seven_seg_disp.c | 198 ++++++++++++++++++ drivers/misc/seven_seg_disp.h | 35 ++++ drivers/misc/seven_seg_gpio.c | 225 +++++++++++++++++++++ 7 files changed, 507 insertions(+) create mode 100644 Documentation/devicetree/bindings/misc/seven_segment_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