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 | 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
@@ -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>;+};--
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.
Signed-off-by: Jaghathiswari Rankappagounder Natarajan <redacted>
---
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
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.
Signed-off-by: Jaghathiswari Rankappagounder Natarajan <redacted>
---
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
According to your introductory mail, the interface is assumed to be
a 74HC164. Should we use that ID in the compatible string?
We can always add other strings later if we want to support multiple
wire formats.
Arnd
On Wednesday, December 14, 2016 9:55:47 AM CET Arnd Bergmann wrote:
According to your introductory mail, the interface is assumed to be
a 74HC164. Should we use that ID in the compatible string?
We can always add other strings later if we want to support multiple
wire formats.
Actually, looking up 74hc164, that seems to be a gpio expander,
so maybe a more flexible way to do the same is to put a driver
for the expander into drivers/gpio/ and have the main driver
access the outputs of that using the gpiolib interface.
Arnd
From: Joel Stanley <joel@jms.id.au> Date: 2016-12-14 09:02:42
Hello Jagha,
On Wed, Dec 14, 2016 at 6:25 PM, Jaghathiswari Rankappagounder
Natarajan [off-list ref] wrote:
Add clock, data and clear signal GPIO lines to control seven segment display on
zaius platform.
Signed-off-by: Jaghathiswari Rankappagounder Natarajan <redacted>
The Zaius device tree is not upstream. I suggest you submit it through
the Aspeed maintainer's tree (me!) for inclusion in the next merge
window.
For the time being, drop this patch from your series as it will not
apply to the upstream kernel.
As a general rule make sure you're basing the patches you send
upstream on a tag from an upstream tree. Linus' v4.9 tag would be the
best one at this point in time.
Cheers,
Joel
From: Russell King - ARM Linux <linux@armlinux.org.uk> Date: 2016-12-14 11:07:06
On Wed, Dec 14, 2016 at 10:00:46AM +0100, Arnd Bergmann wrote:
On Wednesday, December 14, 2016 9:55:47 AM CET Arnd Bergmann wrote:
quoted
According to your introductory mail, the interface is assumed to be
a 74HC164. Should we use that ID in the compatible string?
We can always add other strings later if we want to support multiple
wire formats.
Actually, looking up 74hc164, that seems to be a gpio expander,
so maybe a more flexible way to do the same is to put a driver
for the expander into drivers/gpio/ and have the main driver
access the outputs of that using the gpiolib interface.
There already is - drivers/gpio/gpio-74x164.c
--
RMK's Patch system: http://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up
according to speedtest.net.
From: Russell King - ARM Linux <linux@armlinux.org.uk> Date: 2016-12-14 11:41:08
On Wed, Dec 14, 2016 at 11:06:35AM +0000, Russell King - ARM Linux wrote:
On Wed, Dec 14, 2016 at 10:00:46AM +0100, Arnd Bergmann wrote:
quoted
On Wednesday, December 14, 2016 9:55:47 AM CET Arnd Bergmann wrote:
quoted
According to your introductory mail, the interface is assumed to be
a 74HC164. Should we use that ID in the compatible string?
We can always add other strings later if we want to support multiple
wire formats.
Actually, looking up 74hc164, that seems to be a gpio expander,
so maybe a more flexible way to do the same is to put a driver
for the expander into drivers/gpio/ and have the main driver
access the outputs of that using the gpiolib interface.
There already is - drivers/gpio/gpio-74x164.c
Looking at this more, it's a SPI driver, presumably because the first
case where it appeared was on a SPI bus.
However, it's not a SPI device as such, it's a piece of standard,
general purpose logic that's been around for many years, pre-dating
the SPI bus.
Now, as for DT, we have this "DT represents the hardware, not the
implementation" edict, which now brings up an interesting problem.
If we want to use this driver in its existing form, we need to:
- declare in DT a spi-gpio driver to provide a SPI bus on the GPIO
pins connected to the 74HC164.
- attach the 74HC164 to the SPI bus.
The problem with that is it's not representative of the hardware -
what we're saying is that we want to reuse our existing implementation
and make DT conform to the implementation. At that point, we might as
well scrap our "DT is implementation independent" edict above.
What if, tomorrow, we end up with 74HC164 connected to via a different
method?
I think a much more sensible approach would be to turn the GPIO side
of the 74x164 driver into a library, which can be re-used by multiple
bus-specific drivers - one for SPI which allows it to be used in its
current form, one for our platform bus which takes the GPIO lines for
the data, clock and clear signals.
I also don't see why they shouldn't use the same compatible - they're
the same _device_ at the end of the day, just wired up differently.
It makes the binding documentation a little fun wrt what are required
and optional properties, but nothing that shouldn't be too difficult.
--
RMK's Patch system: http://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up
according to speedtest.net.
Do not use return -1 in kernel code.
(Look up what an errno value of '1' means. Negative values returned from
functions are interpreted as negated errno values.)
Always propagate error codes, or select an appropriate errno value to
return.
--
RMK's Patch system: http://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up
according to speedtest.net.
From: Thomas Petazzoni <hidden> Date: 2016-12-14 12:45:47
Hello,
On Tue, 13 Dec 2016 23:55:00 -0800, Jaghathiswari Rankappagounder
Natarajan wrote:
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.
On Wed, Dec 14, 2016 at 01:45:30PM +0100, Thomas Petazzoni wrote:
Hello,
On Tue, 13 Dec 2016 23:55:00 -0800, Jaghathiswari Rankappagounder
Natarajan wrote:
quoted
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.
Did anyone ever write a library for this type of thing?
Again, I don't want to see one-off drivers for random devices like this
that should be able to all be controlled from userspace in a common
manner. Much like we did for fingerprint readers a long long time
ago...
thanks,
greg k-h
From: Neil Armstrong <hidden> Date: 2016-12-14 13:14:04
On 12/14/2016 01:56 PM, Greg KH wrote:
On Wed, Dec 14, 2016 at 01:45:30PM +0100, Thomas Petazzoni wrote:
quoted
Hello,
On Tue, 13 Dec 2016 23:55:00 -0800, Jaghathiswari Rankappagounder
Natarajan wrote:
quoted
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.
Did anyone ever write a library for this type of thing?
Again, I don't want to see one-off drivers for random devices like this
that should be able to all be controlled from userspace in a common
manner. Much like we did for fingerprint readers a long long time
ago...
thanks,
greg k-h
Hi Greg,
Actually, it's more than a random interface, a lot of SoCs and boards actually have such displays
and it's a pity to use UIO, sysfs gpio bitbanging and all sort of ugly stuff to only print a few
characters a simple and clean driver could achieve.
Some very well known SoCs even have integrated registers to lower the BOM and bypass the need for
a 74HC164 like component and avoid gpio bit banging.
My personal concern is that you could also need to drive more segments, thus 7-segments
is too restrictive.
But this driver is well structured, the gpio-bitbanging sub-driver is welcome.
Neil
On Wednesday, December 14, 2016 2:12:41 PM CET Neil Armstrong wrote:
On 12/14/2016 01:56 PM, Greg KH wrote:
quoted
On Wed, Dec 14, 2016 at 01:45:30PM +0100, Thomas Petazzoni wrote:
quoted
Hello,
On Tue, 13 Dec 2016 23:55:00 -0800, Jaghathiswari Rankappagounder
Natarajan wrote:
quoted
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.
Did anyone ever write a library for this type of thing?
Again, I don't want to see one-off drivers for random devices like this
that should be able to all be controlled from userspace in a common
manner. Much like we did for fingerprint readers a long long time
ago...
Actually, it's more than a random interface, a lot of SoCs and boards actually have such displays
and it's a pity to use UIO, sysfs gpio bitbanging and all sort of ugly stuff to only print a few
characters a simple and clean driver could achieve.
Some very well known SoCs even have integrated registers to lower the BOM and bypass the need for
a 74HC164 like component and avoid gpio bit banging.
My personal concern is that you could also need to drive more segments, thus 7-segments
is too restrictive.
But this driver is well structured, the gpio-bitbanging sub-driver is welcome.
Maybe we can find a way to fit this into the existing drivers/leds/ subsystem?
That already supports blinking, brightness and colour attributes of LEDs,
so could this be extended to support (one of) digit, number, character
or string with a common sysfs attribute and a way to hook up a led driver
to that?
Arnd
On Wed, Dec 14, 2016 at 02:12:41PM +0100, Neil Armstrong wrote:
On 12/14/2016 01:56 PM, Greg KH wrote:
quoted
On Wed, Dec 14, 2016 at 01:45:30PM +0100, Thomas Petazzoni wrote:
quoted
Hello,
On Tue, 13 Dec 2016 23:55:00 -0800, Jaghathiswari Rankappagounder
Natarajan wrote:
quoted
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.
Did anyone ever write a library for this type of thing?
Again, I don't want to see one-off drivers for random devices like this
that should be able to all be controlled from userspace in a common
manner. Much like we did for fingerprint readers a long long time
ago...
thanks,
greg k-h
Hi Greg,
Actually, it's more than a random interface, a lot of SoCs and boards actually have such displays
and it's a pity to use UIO, sysfs gpio bitbanging and all sort of ugly stuff to only print a few
characters a simple and clean driver could achieve.
Great, then let's make an API that all devices of this type could use,
and not just take individual drivers that all have a custom char or
sysfs interface which requires custom userspace code to be able to drive
all of the different devices in a common way (i.e. a library would have
to be written anyways...)
thanks,
greg k-h
From: David Daney <hidden> Date: 2016-12-14 21:10:48
On 12/14/2016 06:15 AM, Arnd Bergmann wrote:
On Wednesday, December 14, 2016 2:12:41 PM CET Neil Armstrong wrote:
quoted
On 12/14/2016 01:56 PM, Greg KH wrote:
quoted
On Wed, Dec 14, 2016 at 01:45:30PM +0100, Thomas Petazzoni wrote:
quoted
Hello,
On Tue, 13 Dec 2016 23:55:00 -0800, Jaghathiswari Rankappagounder
Natarajan wrote:
quoted
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.
Did anyone ever write a library for this type of thing?
Again, I don't want to see one-off drivers for random devices like this
that should be able to all be controlled from userspace in a common
manner. Much like we did for fingerprint readers a long long time
ago...
quoted
Actually, it's more than a random interface, a lot of SoCs and boards actually have such displays
and it's a pity to use UIO, sysfs gpio bitbanging and all sort of ugly stuff to only print a few
characters a simple and clean driver could achieve.
Some very well known SoCs even have integrated registers to lower the BOM and bypass the need for
a 74HC164 like component and avoid gpio bit banging.
My personal concern is that you could also need to drive more segments, thus 7-segments
is too restrictive.
But this driver is well structured, the gpio-bitbanging sub-driver is welcome.
Maybe we can find a way to fit this into the existing drivers/leds/ subsystem?
That already supports blinking, brightness and colour attributes of LEDs,
so could this be extended to support (one of) digit, number, character
or string with a common sysfs attribute and a way to hook up a led driver
to that?
We have a lot of boards with an 8-cell dot matrix LED. Each cell is
programmed with an 8-bit value. The mapping of these values to the dots
defaults to ASCII character rendering, but there is the facility to
install other bitmaps as well.
Really I view these things not as part of the LED subsystem, but more as
a very small frame buffer.
We like to display entire words, and the most useful interface from a
user point of view is something that consumes entire strings rather than
having to manage each cell independently.
You could imagine that if the text to be displayed were longer than the
display, that the driver would make it continuously scroll. I would
like to see a framework where a simple character device were exposed,
and from userspace you could do: "echo message > /dev/small-display" and
get something sensible.
On Wed, Dec 14, 2016 at 12:40 PM, Russell King - ARM Linux
[off-list ref] wrote:
Looking at this more, it's a SPI driver, presumably because the first
case where it appeared was on a SPI bus.
However, it's not a SPI device as such, it's a piece of standard,
general purpose logic that's been around for many years, pre-dating
the SPI bus.
Indeed.
I think a much more sensible approach would be to turn the GPIO side
of the 74x164 driver into a library, which can be re-used by multiple
bus-specific drivers - one for SPI which allows it to be used in its
current form, one for our platform bus which takes the GPIO lines for
the data, clock and clear signals.
I also don't see why they shouldn't use the same compatible - they're
the same _device_ at the end of the day, just wired up differently.
It makes the binding documentation a little fun wrt what are required
and optional properties, but nothing that shouldn't be too difficult.
I agree on both accounts.
Sorry for not seeing this in the first place, I was well aware that this
is a standard component and may be connected in a myriad of ways,
so I should have known better :(
Yours,
Linus Walleij