Raspberry Pi Sense HAT driver
Subsystems (6)
PATCH v8 5/6 MAINTAINERS: Add sensehat driver authors to MAINTAINERS
In reply to Charles MirabileThis patch adds the driver authors to MAINAINERS.
--- MAINTAINERS | 11 +++++++++++ 1 file changed, 11 insertions(+)
MAINTAINERS +11 -0
@@ -17745,6 +17745,17 @@ F: Documentation/ABI/testing/sysfs-bus-iio-chemical-sunrise-co2 F: Documentation/devicetree/bindings/iio/chemical/senseair,sunrise.yaml F: drivers/iio/chemical/sunrise_co2.c +SENSEHAT DRIVER +M: Charles Mirabile <[email protected]> +M: Mwesigwa Guma <[email protected]> +M: Joel Savitz <[email protected]> +S: Maintained +F: Documentation/devicetree/bindings/auxdisplay/raspberrypi,sensehat-display.yaml +F: Documentation/devicetree/bindings/input/raspberrypi,sensehat-joystick.yaml +F: Documentation/devicetree/bindings/mfd/raspberrypi,sensehat.yaml +F: drivers/auxdisplay/sensehat-display.c +F: drivers/input/joystick/sensehat-joystick.c + SENSIRION SCD30 CARBON DIOXIDE SENSOR DRIVER M: Tomasz Duszynski <[email protected]> S: Maintained
Signature · 7 lines
2.31.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
PATCH v8 6/6 DO NOT MERGE: full sensehat device tree overlay for raspberry pi 4
In reply to Charles MirabileThis patch shold not be merged - dtbs files are not stored in the kernel tree. We just provide this file so the code can be tested.
This overlay is suitable for testing the driver, it can be compiled with dtc and put in the /boot/overlays/ folder then specified in config.txt by putting the lines:
dtoverlay= #suppress loading of default overlay for HAT
dtoverlay=sensehat #load custom overlay
at the beginning before any other lines in config.txt
--- sensehat.dtbs | 54 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 sensehat.dtbs
sensehat.dtbs new file +54 -0
@@ -0,0 +1,54 @@ +/dts-v1/; +/plugin/; + +/ { + compatible = "brcm,bcm2835"; +}; + +&i2c1 { + #address-cells = <0x01>; + #size-cells = <0x00>; + status = "okay"; + + sensehat@46 { + #address-cells = <0x01>; + #size-cells = <0x00>; + compatible = "raspberrypi,sensehat"; + reg = <0x46>; + interrupt-parent = <&gpio>; + status = "okay"; + display { + compatible = "raspberrypi,sensehat-display"; + status = "okay"; + }; + joystick { + compatible = "raspberrypi,sensehat-joystick"; + interrupts = <23 1>; + status = "okay"; + }; + }; + + lsm9ds1-magn@1c { + compatible = "st,lsm9ds1-magn"; + reg = <0x1c>; + status = "okay"; + }; + + lsm9ds1-accel@6a { + compatible = "st,lsm9ds1-accel"; + reg = <0x6a>; + status = "okay"; + }; + + lps25h-press@5c { + compatible = "st,lps25h-press"; + reg = <0x5c>; + status = "okay"; + }; + + hts221-humid@5f { + compatible = "st,hts221-humid\0st,hts221"; + reg = <0x5f>; + status = "okay"; + }; +};
Signature · 7 lines
2.31.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
PATCH v8 3/6 drivers/auxdisplay: sensehat: Raspberry Pi Sense HAT display driver
In reply to Charles MirabileThis patch adds the driver for the 8x8 RGB LED matrix display on the Sense HAT. It appears as a character device named sense-hat in /dev/. That special file is 128 bytes large and contains 64 RGB565 triples (2 bytes each) one for each pixel.
--- drivers/auxdisplay/Kconfig | 8 + drivers/auxdisplay/Makefile | 1 + drivers/auxdisplay/sensehat-display.c | 205 ++++++++++++++++++++++++++ 3 files changed, 214 insertions(+) create mode 100644 drivers/auxdisplay/sensehat-display.c
drivers/auxdisplay/Kconfig +8 -0
@@ -203,6 +203,14 @@ config ARM_CHARLCD line and the Linux version on the second line, but that's still useful. +config SENSEHAT_DISPLAY + tristate "Raspberry Pi Sense HAT display driver" + depends on I2C + select MFD_SIMPLE_MFD_I2C + help + This is a driver for the Raspberry Pi Sensehat 8x8 RBG-LED matrix + you can access it as a misc device at /dev/sense-hat + menuconfig PARPORT_PANEL tristate "Parallel port LCD/Keypad Panel support" depends on PARPORT
drivers/auxdisplay/Makefile +1 -0
@@ -14,3 +14,4 @@ obj-$(CONFIG_HT16K33) += ht16k33.o obj-$(CONFIG_PARPORT_PANEL) += panel.o obj-$(CONFIG_LCD2S) += lcd2s.o obj-$(CONFIG_LINEDISP) += line-display.o +obj-$(CONFIG_SENSEHAT_DISPLAY) += sensehat-display.o
drivers/auxdisplay/sensehat-display.c new file +205 -0
205 lines not on this page · raw message
Signature · 7 lines
2.31.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
PATCH v8 4/6 dt-bindings: mfd: sensehat: Add Raspberry Pi Sense HAT schema
In reply to Charles MirabileThis patch adds the device tree bindings for the Sense HAT and each of its children devices in yaml form.
--- .../raspberrypi,sensehat-display.yaml | 27 ++++++++ .../input/raspberrypi,sensehat-joystick.yaml | 33 +++++++++ .../bindings/mfd/raspberrypi,sensehat.yaml | 69 +++++++++++++++++++ 3 files changed, 129 insertions(+) create mode 100644 Documentation/devicetree/bindings/auxdisplay/raspberrypi,sensehat-display.yaml create mode 100644 Documentation/devicetree/bindings/input/raspberrypi,sensehat-joystick.yaml create mode 100644 Documentation/devicetree/bindings/mfd/raspberrypi,sensehat.yaml
Documentation/devicetree/bindings/auxdisplay/raspberrypi,sensehat-display.yaml new file +27 -0
@@ -0,0 +1,27 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/auxdisplay/raspberrypi,sensehat-display.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Raspberry Pi Sensehat Display + +maintainers: + - Charles Mirabile <[email protected]> + - Mwesigwa Guma <[email protected]> + - Joel Savitz <[email protected]> + +description: + This device is part of the sensehat multi function device. + For more information see ../mfd/raspberrypi,sensehat.yaml. + + This device features a programmable 8x8 RGB LED matrix. + +properties: + compatible: + const: raspberrypi,sensehat-display + +required: + - compatible + +additionalProperties: false
Documentation/devicetree/bindings/input/raspberrypi,sensehat-joystick.yaml new file +33 -0
@@ -0,0 +1,33 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/input/raspberrypi,sensehat-joystick.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Raspberry Pi Sensehat Joystick + +maintainers: + - Charles Mirabile <[email protected]> + - Mwesigwa Guma <[email protected]> + - Joel Savitz <[email protected]> + +description: + This device is part of the sensehat multi function device. + For more information see ../mfd/raspberrypi,sensehat.yaml. + + This device features a five button joystick (up, down,left, + right, click) + +properties: + compatible: + const: raspberrypi,sensehat-joystick + + interrupts: + items: + - description: pin number for joystick interrupt + +required: + - compatible + - interrupts + +additionalProperties: false
Documentation/devicetree/bindings/mfd/raspberrypi,sensehat.yaml new file +69 -0
69 lines not on this page · raw message
Signature · 7 lines
2.31.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
PATCH v8 1/6 drivers/mfd: sensehat: Add Raspberry Pi Sense HAT to simple_mfd_i2c
In reply to Charles MirabileThis patch adds the compatible string for the Sense HAT device to the list of compatible strings in the simple_mfd_i2c driver so that it can match against the device and load its children and their drivers
--- drivers/mfd/simple-mfd-i2c.c | 1 + 1 file changed, 1 insertion(+)
drivers/mfd/simple-mfd-i2c.c +1 -0
@@ -75,6 +75,7 @@ static const struct simple_mfd_data silergy_sy7636a = {static const struct of_device_id simple_mfd_i2c_of_match[] = { { .compatible ="kontron,sl28cpld" }, { .compatible ="silergy,sy7636a" , .data = &silergy_sy7636a}, + { .compatible ="raspberrypi,sensehat" }, {} };MODULE_DEVICE_TABLE (of, simple_mfd_i2c_of_match);
Signature · 7 lines
2.31.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
v8 cover Raspberry Pi Sense HAT driver
This patch series adds a set of drivers for operating the Sense HAT peripheral device. This board is an add on for the Raspberry Pi that is designed to connect using the GPIO connector and communicate via I2C.
It features:
- a joystick
- an 8x8 RGB LED matrix display
- a whole bunch of environmental sensors with their own drivers (those are already in upstream Linux)
This is a refactor of the work of Serge Schneider, the author of a version of this driver that is currently in the Raspberry Pi downstream kernel. We modified his code to make it suitable for upstream Linux.
A couple of tests are available for the driver in the test folder in this repo: https://github.com/underground-software/sensehat.git
- sensehat_joystick_test logs the input events from the joystick to the console
- sensehat_display_test displays various solid colors on the LED panel.
- full_sensehat_test displays a single lit cell that can be moved with the joystick. Pressing the joystick ends the program.
For more information about the Sense HAT, visit:
https://www.raspberrypi.org/products/sense-hat/
Changes since v7:
- Added missing error checks to sensehat-display and sensehat-joystick probe functions (allocation failure, and failure to get regmap)
- Propogated potential error from regmap write out of the update display function so that an innability to connect with hardware can be detected during probe
- Changed the userspace format back to individual bytes one per color channel, three per pixel. They are now arranged as rgb triples instead of the native format for the hardware.
- Thanks to Miguel Ojeda for these suggestions.
Charles Mirabile (6):
drivers/mfd: sensehat: Add Raspberry Pi Sense HAT to simple_mfd_i2c drivers/input/joystick: sensehat: Raspberry Pi Sense HAT joystick
driver
drivers/auxdisplay: sensehat: Raspberry Pi Sense HAT display driver
dt-bindings: mfd: sensehat: Add Raspberry Pi Sense HAT schema
MAINTAINERS: Add sensehat driver authors to MAINTAINERS DO NOT MERGE: full sensehat device tree overlay for raspberry pi 4
.../raspberrypi,sensehat-display.yaml | 27 +++ .../input/raspberrypi,sensehat-joystick.yaml | 33 +++ .../bindings/mfd/raspberrypi,sensehat.yaml | 69 ++++++ MAINTAINERS | 11 + drivers/auxdisplay/Kconfig | 8 + drivers/auxdisplay/Makefile | 1 + drivers/auxdisplay/sensehat-display.c | 205 ++++++++++++++++++ drivers/input/joystick/Kconfig | 11 + drivers/input/joystick/Makefile | 1 + drivers/input/joystick/sensehat-joystick.c | 137 ++++++++++++ drivers/mfd/simple-mfd-i2c.c | 1 + sensehat.dtbs | 54 +++++ 12 files changed, 558 insertions(+) create mode 100644 Documentation/devicetree/bindings/auxdisplay/raspberrypi,sensehat-display.yaml create mode 100644 Documentation/devicetree/bindings/input/raspberrypi,sensehat-joystick.yaml create mode 100644 Documentation/devicetree/bindings/mfd/raspberrypi,sensehat.yaml create mode 100644 drivers/auxdisplay/sensehat-display.c create mode 100644 drivers/input/joystick/sensehat-joystick.c create mode 100644 sensehat.dtbs
Signature · 7 lines
2.31.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
PATCH v8 2/6 drivers/input/joystick: sensehat: Raspberry Pi Sense HAT joystick driver
This patch adds the driver for the Sense HAT joystick. It outputs BTN_DPAD key events when moved in any of the four directions and the BTN_SELECT event when depressed.
--- drivers/input/joystick/Kconfig | 11 ++ drivers/input/joystick/Makefile | 1 + drivers/input/joystick/sensehat-joystick.c | 137 +++++++++++++++++++++ 3 files changed, 149 insertions(+) create mode 100644 drivers/input/joystick/sensehat-joystick.c
drivers/input/joystick/Kconfig +11 -0
@@ -399,4 +399,15 @@ config JOYSTICK_N64 Say Y here if you want enable support for the four built-in controller ports on the Nintendo 64 console. +config JOYSTICK_SENSEHAT + tristate "Raspberry Pi Sense HAT joystick" + depends on INPUT && I2C + select MFD_SIMPLE_MFD_I2C + help + Say Y here if you want to enable the driver for the + the Raspberry Pi Sense HAT. + + To compile this driver as a module, choose M here: the + module will be called sensehat_joystick. + endif
drivers/input/joystick/Makefile +1 -0
@@ -28,6 +28,7 @@ obj-$(CONFIG_JOYSTICK_N64) += n64joy.o obj-$(CONFIG_JOYSTICK_PSXPAD_SPI) += psxpad-spi.o obj-$(CONFIG_JOYSTICK_PXRC) += pxrc.o obj-$(CONFIG_JOYSTICK_QWIIC) += qwiic-joystick.o +obj-$(CONFIG_JOYSTICK_SENSEHAT) += sensehat-joystick.o obj-$(CONFIG_JOYSTICK_SIDEWINDER) += sidewinder.o obj-$(CONFIG_JOYSTICK_SPACEBALL) += spaceball.o obj-$(CONFIG_JOYSTICK_SPACEORB) += spaceorb.o
drivers/input/joystick/sensehat-joystick.c new file +137 -0
137 lines not on this page · raw message
Signature · 7 lines
2.31.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Re: [PATCH v8 4/6] dt-bindings: mfd: sensehat: Add Raspberry Pi Sense HAT schema
In reply to Charles MirabileQuoted 3 lines · Charles Mirabile
This patch adds the device tree bindings for the Sense HAT and each of its children devices in yaml form.
Thank you for your patch. There is something to discuss/improve.
Documentation/devicetree/bindings/auxdisplay/raspberrypi,sensehat-display.yaml line 22
Quoted 9 lines
Documentation/devicetree/bindings/auxdisplay/raspberrypi,sensehat-display.yaml new file +9
-0+description: + This device is part of the sensehat multi function device. + For more information see ../mfd/raspberrypi,sensehat.yaml. + + This device features a programmable 8x8 RGB LED matrix. + +properties: + compatible: + const: raspberrypi,sensehat-display
This binding is practically empty, so I wonder what's is purpose? Do you plan to grow it? If this was already explained, sorry for bringing it up again... :)
Quoted 28 lines
Documentation/devicetree/bindings/auxdisplay/raspberrypi,sensehat-display.yaml new file +5
-0+ +required: + - compatible + +additionalProperties: falseDocumentation/devicetree/bindings/input/raspberrypi,sensehat-joystick.yaml new file +17
-0@@ -0,0 +1,33 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/input/raspberrypi,sensehat-joystick.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Raspberry Pi Sensehat Joystick + +maintainers: + - Charles Mirabile <[email protected]> + - Mwesigwa Guma <[email protected]> + - Joel Savitz <[email protected]> + +description: + This device is part of the sensehat multi function device. + For more information see ../mfd/raspberrypi,sensehat.yaml. +
Documentation/devicetree/bindings/input/raspberrypi,sensehat-joystick.yaml line 27
Quoted 10 lines
Documentation/devicetree/bindings/input/raspberrypi,sensehat-joystick.yaml new file +10
-0+ This device features a five button joystick (up, down,left, + right, click) + +properties: + compatible: + const: raspberrypi,sensehat-joystick + + interrupts: + items: + - description: pin number for joystick interrupt
Description is obvious, so just "maxItems: 1"
Quoted 28 lines
Documentation/devicetree/bindings/input/raspberrypi,sensehat-joystick.yaml new file +6
-0+ +required: + - compatible + - interrupts + +additionalProperties: falseDocumentation/devicetree/bindings/mfd/raspberrypi,sensehat.yaml new file +16
-0@@ -0,0 +1,69 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/mfd/raspberrypi,sensehat.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Raspberry Pi Sensehat + +maintainers: + - Charles Mirabile <[email protected]> + - Mwesigwa Guma <[email protected]> + - Joel Savitz <[email protected]> + +description: + The Raspberry Pi Sensehat is an addon board originally developed + for the Raspberry Pi that has a joystick and an 8x8 RGB LED display
Documentation/devicetree/bindings/mfd/raspberrypi,sensehat.yaml line 26
Quoted 10 lines
Documentation/devicetree/bindings/mfd/raspberrypi,sensehat.yaml new file +10
-0+ as well as several environmental sensors. It connects via i2c and + a gpio for irq. + +properties: + compatible: + const: raspberrypi,sensehat + + reg: + items: + - description: i2c device address
Description is obvious, so just "maxItems: 1"
Documentation/devicetree/bindings/mfd/raspberrypi,sensehat.yaml line 32
Quoted 6 lines
Documentation/devicetree/bindings/mfd/raspberrypi,sensehat.yaml new file +6
-0+ + "#address-cells": + const: 1 + + "#size-cells": + const: 0
Why do you need these? You are not allowing any children with unit addresses.
Documentation/devicetree/bindings/mfd/raspberrypi,sensehat.yaml line 35
Quoted 3 lines
Documentation/devicetree/bindings/mfd/raspberrypi,sensehat.yaml new file +3
-0+ + "joystick": + $ref: ../input/raspberrypi,sensehat-joystick.yaml
Full path, so "/schemas/input/raspberrypi,sensehat-joystick.yaml#"
Documentation/devicetree/bindings/mfd/raspberrypi,sensehat.yaml line 38
Quoted 3 lines
Documentation/devicetree/bindings/mfd/raspberrypi,sensehat.yaml new file +3
-0+ + "display": + $ref: ../auxdisplay/raspberrypi,sensehat-display.yaml
The same.
Quoted 8 lines
Documentation/devicetree/bindings/mfd/raspberrypi,sensehat.yaml new file +8
-0+ +required: + - compatible + - reg + - "#address-cells" + - "#size-cells" + - joystick + - display
Documentation/devicetree/bindings/mfd/raspberrypi,sensehat.yaml line 56
Quoted 10 lines
Documentation/devicetree/bindings/mfd/raspberrypi,sensehat.yaml new file +10
-0+ +additionalProperties: false + +examples: + - | + #include <dt-bindings/gpio/gpio.h> + i2c { + #address-cells = <1>; + #size-cells = <0>; + sensehat@46 {
Generic node names please, so "hat".
Documentation/devicetree/bindings/mfd/raspberrypi,sensehat.yaml line 60
Quoted 4 lines
Documentation/devicetree/bindings/mfd/raspberrypi,sensehat.yaml new file +4
-0+ #address-cells = <1>; + #size-cells = <0>; + compatible = "raspberrypi,sensehat"; + reg = <0x46>;
Could you put compatible and then reg at beginning of properties (before address/size)? It is more common convention and these are more important properties.
Documentation/devicetree/bindings/mfd/raspberrypi,sensehat.yaml line 66
Quoted 6 lines
Documentation/devicetree/bindings/mfd/raspberrypi,sensehat.yaml new file +6
-0+ display { + compatible = "raspberrypi,sensehat-display"; + }; + joystick { + compatible = "raspberrypi,sensehat-joystick"; + interrupts = <23 GPIO_ACTIVE_HIGH>;
This does not look like proper interrupt flag. Wrong constant.
Documentation/devicetree/bindings/mfd/raspberrypi,sensehat.yaml line 68
Quoted 3 lines
Documentation/devicetree/bindings/mfd/raspberrypi,sensehat.yaml new file +3
-0+ }; + }; + };
Best regards,
Krzysztof
Re: [PATCH v8 4/6] dt-bindings: mfd: sensehat: Add Raspberry Pi Sense HAT schema
Quoted 7 lines · Krzysztof Kozlowski
Quoted 3 lines · Charles Mirabile
This patch adds the device tree bindings for the Sense HAT and each of its children devices in yaml form.
Thank you for your patch. There is something to discuss/improve.
Quoted 14 lines
Documentation/devicetree/bindings/auxdisplay/raspberrypi,sensehat-display.yaml line 22
Quoted 9 lines
Documentation/devicetree/bindings/auxdisplay/raspberrypi,sensehat-display.yaml new file +9
-0+description: + This device is part of the sensehat multi function device. + For more information see ../mfd/raspberrypi,sensehat.yaml. + + This device features a programmable 8x8 RGB LED matrix. + +properties: + compatible: + const: raspberrypi,sensehat-displayThis binding is practically empty, so I wonder what's is purpose? Do you plan to grow it? If this was already explained, sorry for bringing it up again... :)
BTW, I see now you got review from Rob. What changed here that you did not include it? It is expected to document such case in patch changelog, so the reviewer will know he wasn't ignored. :)
Best regards,
Krzysztof