2022-03-03 19:14:33

by Charles Mirabile

[permalink] [raw]
Subject: [PATCH v7 0/6] 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 communicates 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 v6:
- we store the regmap for the sensehat inside the child structs
so that we don't need to look it up every time in the functions
that want to use it. Thanks to Nicolás Sáenz for the suggestion.
- Changed userspace layout of the display driver to rgb565 triples
and removed the gamma table lookup and the associated ioctl. If
the user wants to recreate linear brightness scaling, they can
use a lookup table on their end. Doing this also removes a lot
of error checking and general code complexity, so I think removing
this feature is actually for the better.
- Replaced if statement with call to `min_t` function in display
read and write functions.
- Replaced the custom llseek implementation with a call to
`fixed_size_llseek`. Thanks to Miguel Ojeda for all of these
great suggestions.
- Fixed issues with the yaml device tree bindings we missed last
time due to not having yamllint installed. Thanks for Rob Herring
(well his bot on his behalf :^)) for this suggestion.

Co-developed-by: Daniel Bauman <[email protected]>
Signed-off-by: Daniel Bauman <[email protected]>
Co-developed-by: Mwesigwa Guma <[email protected]>
Signed-off-by: Mwesigwa Guma <[email protected]>
Co-developed-by: Joel Savitz <[email protected]>
Signed-off-by: Joel Savitz <[email protected]>
Signed-off-by: Charles Mirabile <[email protected]>

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 | 188 ++++++++++++++++++
drivers/input/joystick/Kconfig | 11 +
drivers/input/joystick/Makefile | 1 +
drivers/input/joystick/sensehat-joystick.c | 128 ++++++++++++
drivers/mfd/simple-mfd-i2c.c | 1 +
sensehat.dtbs | 54 +++++
12 files changed, 532 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

--
2.31.1


2022-03-03 19:39:51

by Charles Mirabile

[permalink] [raw]
Subject: [PATCH v7 4/6] dt-bindings: mfd: sensehat: Add Raspberry Pi Sense HAT schema

This patch adds the device tree bindings for the Sense HAT
and each of its children devices in yaml form.

Co-developed-by: Mwesigwa Guma <[email protected]>
Signed-off-by: Mwesigwa Guma <[email protected]>
Co-developed-by: Joel Savitz <[email protected]>
Signed-off-by: Joel Savitz <[email protected]>
Signed-off-by: Charles Mirabile <[email protected]>
---
.../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

diff --git a/Documentation/devicetree/bindings/auxdisplay/raspberrypi,sensehat-display.yaml b/Documentation/devicetree/bindings/auxdisplay/raspberrypi,sensehat-display.yaml
new file mode 100644
index 000000000000..5e41d6b7817d
--- /dev/null
+++ b/Documentation/devicetree/bindings/auxdisplay/raspberrypi,sensehat-display.yaml
@@ -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
diff --git a/Documentation/devicetree/bindings/input/raspberrypi,sensehat-joystick.yaml b/Documentation/devicetree/bindings/input/raspberrypi,sensehat-joystick.yaml
new file mode 100644
index 000000000000..c97cd1d8eac6
--- /dev/null
+++ b/Documentation/devicetree/bindings/input/raspberrypi,sensehat-joystick.yaml
@@ -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
diff --git a/Documentation/devicetree/bindings/mfd/raspberrypi,sensehat.yaml b/Documentation/devicetree/bindings/mfd/raspberrypi,sensehat.yaml
new file mode 100644
index 000000000000..2484ec91b430
--- /dev/null
+++ b/Documentation/devicetree/bindings/mfd/raspberrypi,sensehat.yaml
@@ -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
+ 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
+
+ "#address-cells":
+ const: 1
+
+ "#size-cells":
+ const: 0
+
+ "joystick":
+ $ref: ../input/raspberrypi,sensehat-joystick.yaml
+
+ "display":
+ $ref: ../auxdisplay/raspberrypi,sensehat-display.yaml
+
+required:
+ - compatible
+ - reg
+ - "#address-cells"
+ - "#size-cells"
+ - joystick
+ - display
+
+additionalProperties: false
+
+examples:
+ - |
+ #include <dt-bindings/gpio/gpio.h>
+ i2c {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ sensehat@46 {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ compatible = "raspberrypi,sensehat";
+ reg = <0x46>;
+ display {
+ compatible = "raspberrypi,sensehat-display";
+ };
+ joystick {
+ compatible = "raspberrypi,sensehat-joystick";
+ interrupts = <23 GPIO_ACTIVE_HIGH>;
+ };
+ };
+ };
--
2.31.1

2022-03-03 19:41:36

by Charles Mirabile

[permalink] [raw]
Subject: [PATCH v7 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.

Co-developed-by: Daniel Bauman <[email protected]>
Signed-off-by: Daniel Bauman <[email protected]>
Co-developed-by: Mwesigwa Guma <[email protected]>
Signed-off-by: Mwesigwa Guma <[email protected]>
Co-developed-by: Joel Savitz <[email protected]>
Signed-off-by: Joel Savitz <[email protected]>
Signed-off-by: Charles Mirabile <[email protected]>
---
drivers/input/joystick/Kconfig | 11 ++
drivers/input/joystick/Makefile | 1 +
drivers/input/joystick/sensehat-joystick.c | 128 +++++++++++++++++++++
3 files changed, 140 insertions(+)
create mode 100644 drivers/input/joystick/sensehat-joystick.c

diff --git a/drivers/input/joystick/Kconfig b/drivers/input/joystick/Kconfig
index 3b23078bc7b5..505a032e2786 100644
--- a/drivers/input/joystick/Kconfig
+++ b/drivers/input/joystick/Kconfig
@@ -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
diff --git a/drivers/input/joystick/Makefile b/drivers/input/joystick/Makefile
index 5174b8aba2dd..39c8b5c6e5ae 100644
--- a/drivers/input/joystick/Makefile
+++ b/drivers/input/joystick/Makefile
@@ -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
diff --git a/drivers/input/joystick/sensehat-joystick.c b/drivers/input/joystick/sensehat-joystick.c
new file mode 100644
index 000000000000..0a99cf0f3ba0
--- /dev/null
+++ b/drivers/input/joystick/sensehat-joystick.c
@@ -0,0 +1,128 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Raspberry Pi Sense HAT joystick driver
+ * http://raspberrypi.org
+ *
+ * Copyright (C) 2015 Raspberry Pi
+ * Copyright (C) 2021 Charles Mirabile, Mwesigwa Guma, Joel Savitz
+ *
+ * Original Author: Serge Schneider
+ * Revised for upstream Linux by: Charles Mirabile, Mwesigwa Guma, Joel Savitz
+ */
+
+#include <linux/module.h>
+#include <linux/input.h>
+#include <linux/i2c.h>
+#include <linux/interrupt.h>
+#include <linux/platform_device.h>
+#include <linux/regmap.h>
+#include <linux/property.h>
+
+#define JOYSTICK_SMB_REG 0xf2
+
+struct sensehat_joystick {
+ struct platform_device *pdev;
+ struct input_dev *keys_dev;
+ unsigned long prev_states;
+ struct regmap *regmap;
+};
+
+static const unsigned int keymap[] = {
+ BTN_DPAD_DOWN, BTN_DPAD_RIGHT, BTN_DPAD_UP, BTN_SELECT, BTN_DPAD_LEFT,
+};
+
+static irqreturn_t sensehat_joystick_report(int n, void *cookie)
+{
+ int i, error, keys;
+ struct sensehat_joystick *sensehat_joystick = cookie;
+ unsigned long curr_states, changes;
+
+ error = regmap_read(sensehat_joystick->regmap, JOYSTICK_SMB_REG, &keys);
+ if (error < 0) {
+ dev_err(&sensehat_joystick->pdev->dev,
+ "Failed to read joystick state: %d", error);
+ return IRQ_NONE;
+ }
+ curr_states = keys;
+ bitmap_xor(&changes, &curr_states, &sensehat_joystick->prev_states,
+ ARRAY_SIZE(keymap));
+
+ for_each_set_bit(i, &changes, ARRAY_SIZE(keymap)) {
+ input_report_key(sensehat_joystick->keys_dev, keymap[i],
+ curr_states & BIT(i));
+ }
+
+ input_sync(sensehat_joystick->keys_dev);
+ sensehat_joystick->prev_states = keys;
+ return IRQ_HANDLED;
+}
+
+static int sensehat_joystick_probe(struct platform_device *pdev)
+{
+ int error, i, irq;
+ struct sensehat_joystick *sensehat_joystick = devm_kzalloc(
+ &pdev->dev, sizeof(*sensehat_joystick), GFP_KERNEL);
+
+ sensehat_joystick->pdev = pdev;
+
+ sensehat_joystick->regmap = dev_get_regmap(sensehat_joystick->pdev->dev.parent, NULL);
+
+ sensehat_joystick->keys_dev = devm_input_allocate_device(&pdev->dev);
+ if (!sensehat_joystick->keys_dev) {
+ dev_err(&pdev->dev, "Could not allocate input device.\n");
+ return -ENOMEM;
+ }
+
+ for (i = 0; i < ARRAY_SIZE(keymap); i++)
+ set_bit(keymap[i], sensehat_joystick->keys_dev->keybit);
+
+ sensehat_joystick->keys_dev->name = "Raspberry Pi Sense HAT Joystick";
+ sensehat_joystick->keys_dev->phys = "sensehat-joystick/input0";
+ sensehat_joystick->keys_dev->id.bustype = BUS_I2C;
+ sensehat_joystick->keys_dev->evbit[0] =
+ BIT_MASK(EV_KEY) | BIT_MASK(EV_REP);
+
+ error = input_register_device(sensehat_joystick->keys_dev);
+ if (error) {
+ dev_err(&pdev->dev, "Could not register input device.\n");
+ return error;
+ }
+
+ irq = platform_get_irq(pdev, 0);
+ if (irq < 0) {
+ dev_err(&pdev->dev, "Could not retrieve interrupt request.\n");
+ return irq;
+ }
+
+ error = devm_request_threaded_irq(&pdev->dev, irq, NULL,
+ sensehat_joystick_report,
+ IRQF_ONESHOT, "keys",
+ sensehat_joystick);
+
+ if (error) {
+ dev_err(&pdev->dev, "IRQ request failed.\n");
+ return error;
+ }
+
+ return 0;
+}
+
+static const struct of_device_id sensehat_joystick_device_id[] = {
+ { .compatible = "raspberrypi,sensehat-joystick" },
+ {},
+};
+MODULE_DEVICE_TABLE(of, sensehat_joystick_device_id);
+
+static struct platform_driver sensehat_joystick_driver = {
+ .probe = sensehat_joystick_probe,
+ .driver = {
+ .name = "sensehat-joystick",
+ .of_match_table = sensehat_joystick_device_id,
+ },
+};
+
+module_platform_driver(sensehat_joystick_driver);
+
+MODULE_DESCRIPTION("Raspberry Pi Sense HAT joystick driver");
+MODULE_AUTHOR("Serge Schneider <[email protected]>");
+MODULE_LICENSE("GPL");
--
2.31.1

2022-03-03 21:05:34

by Charles Mirabile

[permalink] [raw]
Subject: [PATCH v7 1/6] drivers/mfd: sensehat: Add Raspberry Pi Sense HAT to simple_mfd_i2c

This 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.

Co-developed-by: Mwesigwa Guma <[email protected]>
Signed-off-by: Mwesigwa Guma <[email protected]>
Co-developed-by: Joel Savitz <[email protected]>
Signed-off-by: Joel Savitz <[email protected]>
Signed-off-by: Charles Mirabile <[email protected]>
---
drivers/mfd/simple-mfd-i2c.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/mfd/simple-mfd-i2c.c b/drivers/mfd/simple-mfd-i2c.c
index 51536691ad9d..f916a9c84563 100644
--- a/drivers/mfd/simple-mfd-i2c.c
+++ b/drivers/mfd/simple-mfd-i2c.c
@@ -64,6 +64,7 @@ static int simple_mfd_i2c_probe(struct i2c_client *i2c)

static const struct of_device_id simple_mfd_i2c_of_match[] = {
{ .compatible = "kontron,sl28cpld" },
+ { .compatible = "raspberrypi,sensehat" },
{}
};
MODULE_DEVICE_TABLE(of, simple_mfd_i2c_of_match);
--
2.31.1

2022-03-03 21:23:42

by Charles Mirabile

[permalink] [raw]
Subject: [PATCH v7 5/6] MAINTAINERS: Add sensehat driver authors to MAINTAINERS

This patch adds the driver authors to MAINAINERS.

Co-developed-by: Mwesigwa Guma <[email protected]>
Signed-off-by: Mwesigwa Guma <[email protected]>
Co-developed-by: Joel Savitz <[email protected]>
Signed-off-by: Joel Savitz <[email protected]>
Signed-off-by: Charles Mirabile <[email protected]>
---
MAINTAINERS | 11 +++++++++++
1 file changed, 11 insertions(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index 4383949ff654..d6cb046ff751 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -17417,6 +17417,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
--
2.31.1

2022-03-04 00:09:05

by Miguel Ojeda

[permalink] [raw]
Subject: Re: [PATCH v7 0/6] Raspberry Pi Sense HAT driver

On Thu, Mar 3, 2022 at 6:58 PM Charles Mirabile <[email protected]> wrote:
>
> - Changed userspace layout of the display driver to rgb565 triples
> and removed the gamma table lookup and the associated ioctl. If
> the user wants to recreate linear brightness scaling, they can
> use a lookup table on their end. Doing this also removes a lot
> of error checking and general code complexity, so I think removing
> this feature is actually for the better.

Sounds better indeed! If I understood correctly how it worked in the
previous round, it should also allow to use the hardware to a fuller
extent.

> - Replaced if statement with call to `min_t` function in display
> read and write functions.
> - Replaced the custom llseek implementation with a call to
> `fixed_size_llseek`. Thanks to Miguel Ojeda for all of these
> great suggestions.

You're very welcome!

Cheers,
Miguel

2022-03-04 02:39:47

by Charles Mirabile

[permalink] [raw]
Subject: [PATCH v7 6/6] DO NOT MERGE: full sensehat device tree overlay for raspberry pi 4

This patch should 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

Co-developed-by: Mwesigwa Guma <[email protected]>
Signed-off-by: Mwesigwa Guma <[email protected]>
Co-developed-by: Joel Savitz <[email protected]>
Signed-off-by: Joel Savitz <[email protected]>
Signed-off-by: Charles Mirabile <[email protected]>
---
sensehat.dtbs | 54 +++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 54 insertions(+)
create mode 100644 sensehat.dtbs

diff --git a/sensehat.dtbs b/sensehat.dtbs
new file mode 100644
index 000000000000..82d129c847fb
--- /dev/null
+++ b/sensehat.dtbs
@@ -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";
+ };
+};
--
2.31.1

2022-03-08 04:36:51

by Rob Herring

[permalink] [raw]
Subject: Re: [PATCH v7 4/6] dt-bindings: mfd: sensehat: Add Raspberry Pi Sense HAT schema

On Thu, 03 Mar 2022 12:39:33 -0500, Charles Mirabile wrote:
> This patch adds the device tree bindings for the Sense HAT
> and each of its children devices in yaml form.
>
> Co-developed-by: Mwesigwa Guma <[email protected]>
> Signed-off-by: Mwesigwa Guma <[email protected]>
> Co-developed-by: Joel Savitz <[email protected]>
> Signed-off-by: Joel Savitz <[email protected]>
> Signed-off-by: Charles Mirabile <[email protected]>
> ---
> .../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
>

Reviewed-by: Rob Herring <[email protected]>

2022-03-10 14:54:53

by Linus Walleij

[permalink] [raw]
Subject: Re: [PATCH v7 6/6] DO NOT MERGE: full sensehat device tree overlay for raspberry pi 4

On Thu, Mar 3, 2022 at 6:43 PM Charles Mirabile <[email protected]> wrote:

> This patch should not be merged - dtbs files are not stored in the
> kernel tree. We just provide this file so the code can be tested.

A problem with that approach is that the DTS files are not reviewed
and that causes quality problems, and another problem is that the
kernel lack examples of real-world systems so people have to scout
to find those and that costs developer time.

I know many people are opposed to having this kind of stuff in the
kernel tree, but I am *for* having this kind of stuff in the kernel tree.

Mainly because there is no working community to shepherd it
otherwise, while we (the kernel maintainers) are still dependent on
there being one.

> + lsm9ds1-magn@1c {
> + compatible = "st,lsm9ds1-magn";
> + reg = <0x1c>;
> + status = "okay";
> + };
> +
> + lsm9ds1-accel@6a {
> + compatible = "st,lsm9ds1-accel";
> + reg = <0x6a>;
> + status = "okay";
> + };

These should typically have mounting matrices. I doubt they
are mounted according to the identity matrix, because electronics
designers usually have other concerns when layouting PCBs.

See
Documentation/devicetree/bindings/iio/mount-matrix.txt

Yours,
Linus Walleij

Yours,
Linus Walleij