Skip to contentSkip to conversation

Raspberry Pi Sense HAT driver

PATCH In review Charles Mirabile 7 participants 24 messages Aug 23, 2022 – Sep 8, 2022

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

v10 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 v9:
- The driver for the sensehat joystick was accepted upstream so it is no longer included in this patchset.
- Some of the people involved in the development of earlier versions of these patches are no longer involved in the project so they have been removed from the list of maintainers and the patches.
- The code is completely unchanged and so based on the discussions from version 9 of the patches, it should be ready to be merged.

My appologies for the long delay between v9 and v10 especially given the fact that there are no changes to the code. We appreciate the maintainers' patience and guidance throughout all 10 versions of this sensehat patchset, and we are excited for this driver to hopefully be fully accepted.

Best - Charlie

Charles Mirabile (5):
drivers/mfd: sensehat: Add Raspberry Pi Sense HAT to simple_mfd_i2c 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         |  26 +++
 .../input/raspberrypi,sensehat-joystick.yaml  |  31 +++
 .../bindings/mfd/raspberrypi,sensehat.yaml    |  57 +++++
 MAINTAINERS                                   |  10 +
 drivers/auxdisplay/Kconfig                    |   8 +
 drivers/auxdisplay/Makefile                   |   1 +
 drivers/auxdisplay/sensehat-display.c         | 205 ++++++++++++++++++
 drivers/mfd/simple-mfd-i2c.c                  |   1 +
 sensehat.dtbs                                 |  52 +++++
 9 files changed, 391 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 sensehat.dtbs
Signature · 7 lines
2.31.1


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
#1 lore raw

PATCH 1/5 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

---
 drivers/mfd/simple-mfd-i2c.c | 1 +
 1 file changed, 1 insertion(+)
drivers/mfd/simple-mfd-i2c.c +1 -0
index f4c8fc3ee463..c47f36581f3f 100644
@@ -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
#2 lore raw

Re: [PATCH 1/5] drivers/mfd: sensehat: Add Raspberry Pi Sense HAT to simple_mfd_i2c

Quoted 10 lines · Charles Mirabile

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

---
 drivers/mfd/simple-mfd-i2c.c | 1 +
 1 file changed, 1 insertion(+)

If you have not already done so, please resend, Cc'ing my kernel.org address, as-per MAINTAINERS. Thank you.

Quoted 12 lines
drivers/mfd/simple-mfd-i2c.c +1 -0
index f4c8fc3ee463..c47f36581f3f 100644
@@ -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 · 1 line
DEPRECATED: Please use [email protected]
#3 lore raw

Re: [PATCH 1/5] drivers/mfd: sensehat: Add Raspberry Pi Sense HAT to simple_mfd_i2c

In reply to Charles Mirabile
Quoted 4 lines · Charles Mirabile

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

Better say "Add compatibe string for Sense HAT device. The device is compatible with silergy,sy7636a."

Thanks.

Signature · 1 line
An old man doll... just what I always wanted! - Clara
#4 lore raw

PATCH 2/5 drivers/auxdisplay: sensehat: Raspberry Pi Sense HAT display driver

In reply to Charles Mirabile

This 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 192 bytes large and contains 64 RGB triplets (3 bytes each) one for each pixel in row major order.

---
 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
index 64012cda4d12..9bad1aade7a0 100644
@@ -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
index 6968ed4d3f0a..30b2b7934046 100644
@@ -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
Reviewed-by on v1 2/5
#5 lore raw

Re: [PATCH 2/5] drivers/auxdisplay: sensehat: Raspberry Pi Sense HAT display driver

Quoted 8 lines · Charles Mirabile

This 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 192 bytes large and contains 64 RGB triplets (3 bytes each) one for each pixel in row major order.

As this is a 8x8 pixel display, I think it makes no sense to implement this as a tiny DRM driver, so:

Quoted 246 lines
---
  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
index 64012cda4d12..9bad1aade7a0 100644
@@ -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
index 6968ed4d3f0a..30b2b7934046 100644
@@ -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
new file mode 100644
index 000000000000..08c0c4338f3e
@@ -0,0 +1,205 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Raspberry Pi Sense HAT 8x8 LED matrix display driver
+ * http://raspberrypi.org
+ *
+ * Copyright (C) 2015 Raspberry Pi
+ * Copyright (C) 2021 Charles Mirabile, Joel Savitz
+ *
+ * Original Author: Serge Schneider
+ * Revised for upstream Linux by: Charles Mirabile, Joel Savitz
+ */
+
+#include <linux/module.h>
+#include <linux/kernel.h>
+#include <linux/errno.h>
+#include <linux/string.h>
+#include <linux/mm.h>
+#include <linux/slab.h>
+#include <linux/uaccess.h>
+#include <linux/delay.h>
+#include <linux/init.h>
+#include <linux/platform_device.h>
+#include <linux/mod_devicetable.h>
+#include <linux/miscdevice.h>
+#include <linux/regmap.h>
+#include <linux/property.h>
+
+#define DISPLAY_SMB_REG 0x00
+#define RGB_555_MASK 0x1f
+#define NUM_LEDS 8
+#define NUM_CHANNELS 3
+
+struct sensehat_display {
+	struct platform_device *pdev;
+	struct miscdevice mdev;
+	struct mutex rw_mtx;
+	u8 vmem[NUM_LEDS][NUM_LEDS][NUM_CHANNELS];
+	struct regmap *regmap;
+};
+
+#define VMEM_SIZE sizeof_field(struct sensehat_display, vmem)
+
+
+static int sensehat_update_display(struct sensehat_display *display)
+{
+	int i, j, k, ret;
+	u8 buff[NUM_LEDS][NUM_CHANNELS][NUM_LEDS];
+
+	for (i = 0; i < NUM_LEDS; ++i)
+		for (j = 0; j < NUM_LEDS; ++j)
+			for (k = 0; k < NUM_CHANNELS; ++k)
+				buff[i][k][j] =
+					display->vmem[i][j][k] & RGB_555_MASK;
+
+	ret = regmap_bulk_write(display->regmap, DISPLAY_SMB_REG, buff,
+				VMEM_SIZE);
+	if (ret < 0)
+		dev_err(&display->pdev->dev,
+			"Update to 8x8 LED matrix display failed");
+	return ret;
+}
+
+static loff_t sensehat_display_llseek(struct file *filp, loff_t offset,
+				      int whence)
+{
+	return fixed_size_llseek(filp, offset, whence, VMEM_SIZE);
+}
+
+static ssize_t sensehat_display_read(struct file *filp, char __user *buf,
+				     size_t count, loff_t *f_pos)
+{
+	struct sensehat_display *sensehat_display =
+		container_of(filp->private_data, struct sensehat_display, mdev);
+	ssize_t ret = -EFAULT;
+
+	if (*f_pos < 0 || *f_pos >= VMEM_SIZE)
+		return 0;
+	count = min_t(size_t, count, VMEM_SIZE - *f_pos);
+
+	if (mutex_lock_interruptible(&sensehat_display->rw_mtx))
+		return -ERESTARTSYS;
+	if (copy_to_user(buf, *f_pos + (u8 *)sensehat_display->vmem, count))
+		goto out;
+	*f_pos += count;
+	ret = count;
+out:
+	mutex_unlock(&sensehat_display->rw_mtx);
+	return ret;
+}
+
+static ssize_t sensehat_display_write(struct file *filp, const char __user *buf,
+				      size_t count, loff_t *f_pos)
+{
+	struct sensehat_display *sensehat_display =
+		container_of(filp->private_data, struct sensehat_display, mdev);
+	int ret = -EFAULT;
+
+	if (*f_pos < 0 || *f_pos >= VMEM_SIZE)
+		return -EFBIG;
+	count = min_t(size_t, count, VMEM_SIZE - *f_pos);
+
+	if (mutex_lock_interruptible(&sensehat_display->rw_mtx))
+		return -ERESTARTSYS;
+	if (copy_from_user(*f_pos + (u8 *)sensehat_display->vmem, buf, count))
+		goto out;
+	ret = sensehat_update_display(sensehat_display);
+	if (ret < 0) {
+		ret = -EIO;
+		goto out;
+	}
+	*f_pos += count;
+	ret = count;
+out:
+	mutex_unlock(&sensehat_display->rw_mtx);
+	return ret;
+}
+
+static const struct file_operations sensehat_display_fops = {
+	.owner = THIS_MODULE,
+	.llseek = sensehat_display_llseek,
+	.read = sensehat_display_read,
+	.write = sensehat_display_write,
+};
+
+static int sensehat_display_probe(struct platform_device *pdev)
+{
+	int ret;
+
+	struct sensehat_display *sensehat_display =
+		devm_kmalloc(&pdev->dev, sizeof(*sensehat_display), GFP_KERNEL);
+	if (!sensehat_display)
+		return -ENOMEM;
+
+	sensehat_display->pdev = pdev;
+
+	dev_set_drvdata(&pdev->dev, sensehat_display);
+
+	sensehat_display->regmap = dev_get_regmap(pdev->dev.parent, NULL);
+	if (!sensehat_display->regmap) {
+		dev_err(&pdev->dev,
+			"unable to get sensehat regmap");
+		return -ENODEV;
+	}
+
+	memset(sensehat_display->vmem, 0, VMEM_SIZE);
+
+	mutex_init(&sensehat_display->rw_mtx);
+
+	ret = sensehat_update_display(sensehat_display);
+	if (ret < 0) {
+		dev_err(&pdev->dev,
+			"Could not communicate with sensehat");
+		return ret;
+	}
+
+	sensehat_display->mdev = (struct miscdevice){
+		.minor = MISC_DYNAMIC_MINOR,
+		.name = "sense-hat",
+		.mode = 0666,
+		.fops = &sensehat_display_fops,
+	};
+
+	ret = misc_register(&sensehat_display->mdev);
+	if (ret < 0) {
+		dev_err(&pdev->dev,
+			"Could not register 8x8 LED matrix display.");
+		return ret;
+	}
+
+	dev_info(&pdev->dev,
+		 "8x8 LED matrix display registered with minor number %i",
+		 sensehat_display->mdev.minor);
+
+	return 0;
+}
+
+static int sensehat_display_remove(struct platform_device *pdev)
+{
+	struct sensehat_display *sensehat_display = dev_get_drvdata(&pdev->dev);
+
+	misc_deregister(&sensehat_display->mdev);
+	return 0;
+}
+
+static const struct of_device_id sensehat_display_device_id[] = {
+	{ .compatible = "raspberrypi,sensehat-display" },
+	{},
+};
+MODULE_DEVICE_TABLE(of, sensehat_display_device_id);
+
+static struct platform_driver sensehat_display_driver = {
+	.probe = sensehat_display_probe,
+	.remove = sensehat_display_remove,
+	.driver = {
+		.name = "sensehat-display",
+		.of_match_table = sensehat_display_device_id,
+	},
+};
+
+module_platform_driver(sensehat_display_driver);
+
+MODULE_DESCRIPTION("Raspberry Pi Sense HAT 8x8 LED matrix display driver");
+MODULE_AUTHOR("Charles Mirabile <[email protected]>");
+MODULE_AUTHOR("Serge Schneider <[email protected]>");
+MODULE_LICENSE("GPL");
#6 lore raw

Re: [PATCH 2/5] drivers/auxdisplay: sensehat: Raspberry Pi Sense HAT display driver

In reply to Charles Mirabile
Quoted 5 lines · Charles Mirabile

This 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 192 bytes large and contains 64 RGB triplets (3 bytes each) one for each pixel in row major order.

Better say "Add driver for 8x8 RGB LED matrix display of Sense HAT. The character device exposed is /dev/sense-hat, which is 192 bytes large and contains 64 RGB triplets (3 byte each); one for each pixel in row major order."

Thanks.

Signature · 1 line
An old man doll... just what I always wanted! - Clara
#7 lore raw

Re: [PATCH 2/5] drivers/auxdisplay: sensehat: Raspberry Pi Sense HAT display driver

In reply to Charles Mirabile
Quoted 75 lines · Charles Mirabile

This 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 192 bytes large and contains 64 RGB triplets (3 bytes each) one for each pixel in row major order.

---
 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
index 64012cda4d12..9bad1aade7a0 100644
@@ -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
index 6968ed4d3f0a..30b2b7934046 100644
@@ -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 +26 -0
new file mode 100644
index 000000000000..08c0c4338f3e
@@ -0,0 +1,205 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Raspberry Pi Sense HAT 8x8 LED matrix display driver
+ * http://raspberrypi.org
+ *
+ * Copyright (C) 2015 Raspberry Pi
+ * Copyright (C) 2021 Charles Mirabile, Joel Savitz
+ *
+ * Original Author: Serge Schneider
+ * Revised for upstream Linux by: Charles Mirabile, Joel Savitz
+ */
+
+#include <linux/module.h>
+#include <linux/kernel.h>
+#include <linux/errno.h>
+#include <linux/string.h>
+#include <linux/mm.h>
+#include <linux/slab.h>
+#include <linux/uaccess.h>
+#include <linux/delay.h>
+#include <linux/init.h>
+#include <linux/platform_device.h>
+#include <linux/mod_devicetable.h>
+#include <linux/miscdevice.h>
+#include <linux/regmap.h>
+#include <linux/property.h>

drivers/auxdisplay/sensehat-display.c line 36

Quoted 10 lines
drivers/auxdisplay/sensehat-display.c new file +10 -0
+
+#define DISPLAY_SMB_REG 0x00
+#define RGB_555_MASK 0x1f
+#define NUM_LEDS 8
+#define NUM_CHANNELS 3
+
+struct sensehat_display {
+	struct platform_device *pdev;
+	struct miscdevice mdev;
+	struct mutex rw_mtx;

Calling this rw_mtx is misleading, since it is not a rw_mutex. We should rename it to mtx.

Quoted 31 lines
drivers/auxdisplay/sensehat-display.c new file +31 -0
+	u8 vmem[NUM_LEDS][NUM_LEDS][NUM_CHANNELS];
+	struct regmap *regmap;
+};
+
+#define VMEM_SIZE sizeof_field(struct sensehat_display, vmem)
+
+
+static int sensehat_update_display(struct sensehat_display *display)
+{
+	int i, j, k, ret;
+	u8 buff[NUM_LEDS][NUM_CHANNELS][NUM_LEDS];
+
+	for (i = 0; i < NUM_LEDS; ++i)
+		for (j = 0; j < NUM_LEDS; ++j)
+			for (k = 0; k < NUM_CHANNELS; ++k)
+				buff[i][k][j] =
+					display->vmem[i][j][k] & RGB_555_MASK;
+
+	ret = regmap_bulk_write(display->regmap, DISPLAY_SMB_REG, buff,
+				VMEM_SIZE);
+	if (ret < 0)
+		dev_err(&display->pdev->dev,
+			"Update to 8x8 LED matrix display failed");
+	return ret;
+}
+
+static loff_t sensehat_display_llseek(struct file *filp, loff_t offset,
+				      int whence)
+{
+	return fixed_size_llseek(filp, offset, whence, VMEM_SIZE);
+}

drivers/auxdisplay/sensehat-display.c line 77

Quoted 10 lines
drivers/auxdisplay/sensehat-display.c new file +10 -0
+
+static ssize_t sensehat_display_read(struct file *filp, char __user *buf,
+				     size_t count, loff_t *f_pos)
+{
+	struct sensehat_display *sensehat_display =
+		container_of(filp->private_data, struct sensehat_display, mdev);
+	ssize_t ret = -EFAULT;
+
+	if (*f_pos < 0 || *f_pos >= VMEM_SIZE)
+		return 0;

Maybe it should return -EINVAL?

Quoted 132 lines
drivers/auxdisplay/sensehat-display.c new file +128 -0
+	count = min_t(size_t, count, VMEM_SIZE - *f_pos);
+
+	if (mutex_lock_interruptible(&sensehat_display->rw_mtx))
+		return -ERESTARTSYS;
+	if (copy_to_user(buf, *f_pos + (u8 *)sensehat_display->vmem, count))
+		goto out;
+	*f_pos += count;
+	ret = count;
+out:
+	mutex_unlock(&sensehat_display->rw_mtx);
+	return ret;
+}
+
+static ssize_t sensehat_display_write(struct file *filp, const char __user *buf,
+				      size_t count, loff_t *f_pos)
+{
+	struct sensehat_display *sensehat_display =
+		container_of(filp->private_data, struct sensehat_display, mdev);
+	int ret = -EFAULT;
+
+	if (*f_pos < 0 || *f_pos >= VMEM_SIZE)
+		return -EFBIG;
+	count = min_t(size_t, count, VMEM_SIZE - *f_pos);
+
+	if (mutex_lock_interruptible(&sensehat_display->rw_mtx))
+		return -ERESTARTSYS;
+	if (copy_from_user(*f_pos + (u8 *)sensehat_display->vmem, buf, count))
+		goto out;
+	ret = sensehat_update_display(sensehat_display);
+	if (ret < 0) {
+		ret = -EIO;
+		goto out;
+	}
+	*f_pos += count;
+	ret = count;
+out:
+	mutex_unlock(&sensehat_display->rw_mtx);
+	return ret;
+}
+
+static const struct file_operations sensehat_display_fops = {
+	.owner = THIS_MODULE,
+	.llseek = sensehat_display_llseek,
+	.read = sensehat_display_read,
+	.write = sensehat_display_write,
+};
+
+static int sensehat_display_probe(struct platform_device *pdev)
+{
+	int ret;
+
+	struct sensehat_display *sensehat_display =
+		devm_kmalloc(&pdev->dev, sizeof(*sensehat_display), GFP_KERNEL);
+	if (!sensehat_display)
+		return -ENOMEM;
+
+	sensehat_display->pdev = pdev;
+
+	dev_set_drvdata(&pdev->dev, sensehat_display);
+
+	sensehat_display->regmap = dev_get_regmap(pdev->dev.parent, NULL);
+	if (!sensehat_display->regmap) {
+		dev_err(&pdev->dev,
+			"unable to get sensehat regmap");
+		return -ENODEV;
+	}
+
+	memset(sensehat_display->vmem, 0, VMEM_SIZE);
+
+	mutex_init(&sensehat_display->rw_mtx);
+
+	ret = sensehat_update_display(sensehat_display);
+	if (ret < 0) {
+		dev_err(&pdev->dev,
+			"Could not communicate with sensehat");
+		return ret;
+	}
+
+	sensehat_display->mdev = (struct miscdevice){
+		.minor = MISC_DYNAMIC_MINOR,
+		.name = "sense-hat",
+		.mode = 0666,
+		.fops = &sensehat_display_fops,
+	};
+
+	ret = misc_register(&sensehat_display->mdev);
+	if (ret < 0) {
+		dev_err(&pdev->dev,
+			"Could not register 8x8 LED matrix display.");
+		return ret;
+	}
+
+	dev_info(&pdev->dev,
+		 "8x8 LED matrix display registered with minor number %i",
+		 sensehat_display->mdev.minor);
+
+	return 0;
+}
+
+static int sensehat_display_remove(struct platform_device *pdev)
+{
+	struct sensehat_display *sensehat_display = dev_get_drvdata(&pdev->dev);
+
+	misc_deregister(&sensehat_display->mdev);
+	return 0;
+}
+
+static const struct of_device_id sensehat_display_device_id[] = {
+	{ .compatible = "raspberrypi,sensehat-display" },
+	{},
+};
+MODULE_DEVICE_TABLE(of, sensehat_display_device_id);
+
+static struct platform_driver sensehat_display_driver = {
+	.probe = sensehat_display_probe,
+	.remove = sensehat_display_remove,
+	.driver = {
+		.name = "sensehat-display",
+		.of_match_table = sensehat_display_device_id,
+	},
+};
+
+module_platform_driver(sensehat_display_driver);
+
+MODULE_DESCRIPTION("Raspberry Pi Sense HAT 8x8 LED matrix display driver");
+MODULE_AUTHOR("Charles Mirabile <[email protected]>");
+MODULE_AUTHOR("Serge Schneider <[email protected]>");
+MODULE_LICENSE("GPL");
Signature · 1 line
2.31.1
#8 lore raw

PATCH 3/5 dt-bindings: mfd: sensehat: Add Raspberry Pi Sense HAT schema

In reply to Charles Mirabile

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

---
 .../raspberrypi,sensehat-display.yaml         | 26 +++++++++
 .../input/raspberrypi,sensehat-joystick.yaml  | 31 ++++++++++
 .../bindings/mfd/raspberrypi,sensehat.yaml    | 57 +++++++++++++++++++
 3 files changed, 114 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 +26 -0
new file mode 100644
index 000000000000..0cf59b0a519c
@@ -0,0 +1,26 @@
+# 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]>
+  - 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 +31 -0
new file mode 100644
index 000000000000..98b03878a570
@@ -0,0 +1,31 @@
+# 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]>
+  - 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:
+    maxItems: 1
+
+required:
+  - compatible
+  - interrupts
+
+additionalProperties: false
Documentation/devicetree/bindings/mfd/raspberrypi,sensehat.yaml new file +57 -0

57 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
#9 lore raw

Re: [PATCH 3/5] dt-bindings: mfd: sensehat: Add Raspberry Pi Sense HAT schema

Quoted 7 lines · Charles Mirabile

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

When doing a v11, maybe decide if you want to split this patch up. This way every maintainer (MFD, auxdisplay, input) can take his part of the binding description through his tree. Otherwise you will need Acked-by tags from them and one maintainer to volunteer, maybe provide a stable tag... Having it split up seems easier to me.

Regards,
Matthias

Quoted 141 lines
---
  .../raspberrypi,sensehat-display.yaml         | 26 +++++++++
  .../input/raspberrypi,sensehat-joystick.yaml  | 31 ++++++++++
  .../bindings/mfd/raspberrypi,sensehat.yaml    | 57 +++++++++++++++++++
  3 files changed, 114 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 +26 -0
new file mode 100644
index 000000000000..0cf59b0a519c
@@ -0,0 +1,26 @@
+# 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]>
+  - 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 +31 -0
new file mode 100644
index 000000000000..98b03878a570
@@ -0,0 +1,31 @@
+# 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]>
+  - 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:
+    maxItems: 1
+
+required:
+  - compatible
+  - interrupts
+
+additionalProperties: false
Documentation/devicetree/bindings/mfd/raspberrypi,sensehat.yaml new file +57 -0
new file mode 100644
index 000000000000..bc53834fbaa7
@@ -0,0 +1,57 @@
+# 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]>
+  - 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:
+    maxItems: 1
+
+  joystick:
+    $ref: /schemas/input/raspberrypi,sensehat-joystick.yaml#
+
+  display:
+    $ref: /schemas/auxdisplay/raspberrypi,sensehat-display.yaml#
+
+required:
+  - compatible
+  - reg
+  - joystick
+  - display
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/interrupt-controller/irq.h>
+    i2c {
+      #address-cells = <1>;
+      #size-cells = <0>;
+      hat@46 {
+        compatible = "raspberrypi,sensehat";
+        reg = <0x46>;
+        display {
+          compatible = "raspberrypi,sensehat-display";
+        };
+        joystick {
+          compatible = "raspberrypi,sensehat-joystick";
+          interrupts = <23 IRQ_TYPE_EDGE_RISING>;
+        };
+      };
+    };
#10 lore raw

Re: [PATCH 3/5] dt-bindings: mfd: sensehat: Add Raspberry Pi Sense HAT schema

In reply to Charles Mirabile
Quoted 2 lines · Charles Mirabile

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

Better say "Add DT bindings for Sense HAT and its subdrivers."

Thanks.

Signature · 1 line
An old man doll... just what I always wanted! - Clara
#11 lore raw

PATCH 4/5 MAINTAINERS: Add sensehat driver authors to MAINTAINERS

In reply to Charles Mirabile

This patch adds the driver authors to MAINAINERS.

---
 MAINTAINERS | 10 ++++++++++
 1 file changed, 10 insertions(+)
MAINTAINERS +10 -0
index 96f47a7865d6..3af3238a1535 100644
@@ -18344,6 +18344,16 @@ 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:	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
#12 lore raw

Re: [PATCH 4/5] MAINTAINERS: Add sensehat driver authors to MAINTAINERS

Quoted 1 line · Charles Mirabile

This patch adds the driver authors to MAINAINERS.

Better say "Add MAINTAINERS entry for Sense HAT driver."

Thanks.

Signature · 1 line
An old man doll... just what I always wanted! - Clara
#13 lore raw

PATCH 5/5 DO NOT MERGE: full sensehat device tree overlay for raspberry pi 4

In reply to Charles Mirabile

This 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 | 52 +++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 52 insertions(+)
 create mode 100644 sensehat.dtbs
sensehat.dtbs new file +52 -0
new file mode 100644
index 000000000000..9e5a6d9229b1
@@ -0,0 +1,52 @@
+/dts-v1/;
+/plugin/;
+
+/ {
+	compatible = "brcm,bcm2835";
+};
+
+&i2c1 {
+	#address-cells = <0x01>;
+	#size-cells = <0x00>;
+	status = "okay";
+
+	sensehat@46 {
+		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
#14 lore raw

Re: [PATCH 5/5] DO NOT MERGE: full sensehat device tree overlay for raspberry pi 4

Quoted 3 lines · Charles Mirabile

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

Hmm, if this is DO NOT MERGE patch due to build artifacts (in this case dtbs), then how testing of this driver can be done with just DT source (like other drivers)? Does providing custom overlay needed for testing it?

Thanks.

Signature · 1 line
An old man doll... just what I always wanted! - Clara
#15 lore raw

Re: [PATCH 5/5] DO NOT MERGE: full sensehat device tree overlay for raspberry pi 4

Quoted 10 lines · Bagas Sanjaya
Quoted 3 lines · Charles Mirabile

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

Hmm, if this is DO NOT MERGE patch due to build artifacts (in this case dtbs), then how testing of this driver can be done with just DT source (like other drivers)? Does providing custom overlay needed for testing it?

As it's a extension board to the RaspberryPi the DTs are not included into the Linux kernel. Instead an overlay is build which can be loaded to the base DT via a special mechanism of the RPi FW.

Adding this file helps anybody who wants to test the drivers to do so without any hustle.

Regards,
Matthias

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

#16 lore raw
In reply to Charles Mirabile

Hi Charles,

+ Maxime & Noralf

Am 23.08.22 um 19:41 schrieb Charles Mirabile:

Quoted 3 lines

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.

thanks for sending a new version of this series.

Quoted 41 lines

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 v9:
- The driver for the sensehat joystick was accepted upstream so it is no longer included in this patchset.
- Some of the people involved in the development of earlier versions of these patches are no longer involved in the project so they have been removed from the list of maintainers and the patches.
- The code is completely unchanged and so based on the discussions from version 9 of the patches, it should be ready to be merged.

My appologies for the long delay between v9 and v10 especially given the fact that there are no changes to the code. We appreciate the maintainers' patience and guidance throughout all 10 versions of this sensehat patchset, and we are excited for this driver to hopefully be fully accepted.

Best - Charlie

Quoted 8 lines

Charles Mirabile (5):
drivers/mfd: sensehat: Add Raspberry Pi Sense HAT to simple_mfd_i2c

AFAIK Lee Jones has a new kernel.org address the old linaro address shouldn't be used anymore. We don't get any further without him.

Quoted 1 line

drivers/auxdisplay: sensehat: Raspberry Pi Sense HAT display driver

We don't have an Ack for this display driver. Maybe we should ask Maxime Ripard and Noralf Trønnes especially Pavel Machek had concerns about the right subsystem?

Quoted 3 lines

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

In case you want to send a new version it would be nice to enable the driver in bcm2835_defconfig for better test coverage. But this is not a show stopper.

Best regards

Quoted 17 lines
  .../raspberrypi,sensehat-display.yaml         |  26 +++
  .../input/raspberrypi,sensehat-joystick.yaml  |  31 +++
  .../bindings/mfd/raspberrypi,sensehat.yaml    |  57 +++++
  MAINTAINERS                                   |  10 +
  drivers/auxdisplay/Kconfig                    |   8 +
  drivers/auxdisplay/Makefile                   |   1 +
  drivers/auxdisplay/sensehat-display.c         | 205 ++++++++++++++++++
  drivers/mfd/simple-mfd-i2c.c                  |   1 +
  sensehat.dtbs                                 |  52 +++++
  9 files changed, 391 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 sensehat.dtbs

#17 lore raw
Quoted 57 lines · Stefan Wahren

Hi Charles,

+ Maxime & Noralf

Am 23.08.22 um 19:41 schrieb Charles Mirabile:

Quoted 3 lines

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.

thanks for sending a new version of this series.

Quoted 47 lines

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 v9:
- The driver for the sensehat joystick was accepted upstream so it is no longer included in this patchset.
- Some of the people involved in the development of earlier versions of these patches are no longer involved in the project so they have been removed from the list of maintainers and the patches.
- The code is completely unchanged and so based on the discussions from version 9 of the patches, it should be ready to be merged.

My appologies for the long delay between v9 and v10 especially given the fact that there are no changes to the code. We appreciate the maintainers' patience and guidance throughout all 10 versions of this sensehat patchset, and we are excited for this driver to hopefully be fully accepted.

Best - Charlie

Quoted 4 lines
Quoted 2 lines

Charles Mirabile (5):
drivers/mfd: sensehat: Add Raspberry Pi Sense HAT to simple_mfd_i2c

AFAIK Lee Jones has a new kernel.org address the old linaro address shouldn't be used anymore. We don't get any further without him.

oops - my bad. Copied the old one from the previous CC list, but I see the new one was being output properly by get_maintainer.pl, I just wasn't paying enough attention

Quoted 4 lines
Quoted 1 line

drivers/auxdisplay: sensehat: Raspberry Pi Sense HAT display driver

We don't have an Ack for this display driver. Maybe we should ask Maxime Ripard and Noralf Trønnes especially Pavel Machek had concerns about the right subsystem?

I just looked back at the comments from Pavel on v9. I had meant to reply to him, and I actually drafted something but it got lost in the shuffle and I never sent it (also my bad).
The driver is an fbdev in the raspberry pi tree, and that is where we started when upstreaming, but right from the outset we were told that it couldn't be an fbdev since that subsystem is being deprecated the replacement is the DRM subsystem, but (as Matthias Brugger suggests) that is probably overkill for an 8x8 display. Does that settle the subsystem question?
Also, Is Matthias's review acceptable, or do we need someone else's ack? It was my understanding based on his comments on v9 that Miguel Ojeda was also basically ready to ack it, but I don't want to speak for him.

Quoted 7 lines
Quoted 3 lines

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

In case you want to send a new version it would be nice to enable the driver in bcm2835_defconfig for better test coverage. But this is not a show stopper.

Since I am going to have to send a v11 to fix Lee's email address I will look into this. Is it as simple as adding another patch that puts CONFIG_SENSEHAT_DISPLAY=y into the next version?
Presumably I would also want to enable CONFIG_JOYSTICK_SENSEHAT right? Do I have to do anything special since both of those options have decencies (namely CONFIG_I2C for both and CONFIG_INPUT for the latter, and both select MFD_SIMPLE_MFD_I2C)?

Quoted 21 lines

Best regards

Quoted 17 lines
  .../raspberrypi,sensehat-display.yaml         |  26 +++
  .../input/raspberrypi,sensehat-joystick.yaml  |  31 +++
  .../bindings/mfd/raspberrypi,sensehat.yaml    |  57 +++++
  MAINTAINERS                                   |  10 +
  drivers/auxdisplay/Kconfig                    |   8 +
  drivers/auxdisplay/Makefile                   |   1 +
  drivers/auxdisplay/sensehat-display.c         | 205 ++++++++++++++++++
  drivers/mfd/simple-mfd-i2c.c                  |   1 +
  sensehat.dtbs                                 |  52 +++++
  9 files changed, 391 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 sensehat.dtbs

#18 lore raw
Quoted 6 lines · Charles Mirabile
Quoted 4 lines · Stefan Wahren
Quoted 1 line

drivers/auxdisplay: sensehat: Raspberry Pi Sense HAT display driver

We don't have an Ack for this display driver. Maybe we should ask Maxime Ripard and Noralf Trønnes especially Pavel Machek had concerns about the right subsystem?

Quoted 8 lines

I just looked back at the comments from Pavel on v9. I had meant to reply to him, and I actually drafted something but it got lost in the shuffle and I never sent it (also my bad).

The driver is an fbdev in the raspberry pi tree, and that is where we started when upstreaming, but right from the outset we were told that it couldn't be an fbdev since that subsystem is being deprecated the replacement is the DRM subsystem

Indeed

Quoted 2 lines

but (as Matthias Brugger suggests) that is probably overkill for an 8x8 display. Does that settle the subsystem question?

If you were aiming for an fbdev driver, a KMS driver these days would be notably simpler.

We've added simpler and simpler devices, such as the SSD1306 recently, so I can't see anything wrong with using KMS either.

Maxime

#19 lore raw
In reply to Charles Mirabile

Am 24.08.22 um 14:06 schrieb Charles Mirabile:

Quoted 10 lines
Quoted 3 lines

In case you want to send a new version it would be nice to enable the driver in bcm2835_defconfig for better test coverage. But this is not a show stopper.

Since I am going to have to send a v11 to fix Lee's email address I will look into this. Is it as simple as adding another patch that puts CONFIG_SENSEHAT_DISPLAY=y into the next version?
Presumably I would also want to enable CONFIG_JOYSTICK_SENSEHAT right? Do I have to do anything special since both of those options have decencies (namely CONFIG_I2C for both and CONFIG_INPUT for the latter, and both select MFD_SIMPLE_MFD_I2C)?

make bcm2835_defconfig

enable both driver via make menuconfig

make savedefconfig

mv defconfig arch/arm/configs/bcm2835_defconfig.2

diff -u arch/arm/configs/bcm2835_defconfig arch/arm/configs/bcm2835_defconfig.2 > config.patch

manually add only the relevant changes from config.patch in arch/arm/configs/bcm2835_defconfig

generate the patch as usual

goal is to have simple patch which only contains the 2 driver changes without any clean-up changes

#20 lore raw
In reply to Charles Mirabile
Quoted 27 lines · Charles Mirabile

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/

Quoted 7 lines

Changes since v9:
- The driver for the sensehat joystick was accepted upstream so it is no longer included in this patchset.
- Some of the people involved in the development of earlier versions of these patches are no longer involved in the project so they have been removed from the list of maintainers and the patches.

I'd would expect the patches to honor their involvement in the past, but if they are fine from being dropped, I will not object...

Regards,
Matthias

Quoted 39 lines

- The code is completely unchanged and so based on the discussions from version 9 of the patches, it should be ready to be merged.

My appologies for the long delay between v9 and v10 especially given the fact that there are no changes to the code. We appreciate the maintainers' patience and guidance throughout all 10 versions of this sensehat patchset, and we are excited for this driver to hopefully be fully accepted.

Best - Charlie

Charles Mirabile (5):
drivers/mfd: sensehat: Add Raspberry Pi Sense HAT to simple_mfd_i2c 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         |  26 +++
  .../input/raspberrypi,sensehat-joystick.yaml  |  31 +++
  .../bindings/mfd/raspberrypi,sensehat.yaml    |  57 +++++
  MAINTAINERS                                   |  10 +
  drivers/auxdisplay/Kconfig                    |   8 +
  drivers/auxdisplay/Makefile                   |   1 +
  drivers/auxdisplay/sensehat-display.c         | 205 ++++++++++++++++++
  drivers/mfd/simple-mfd-i2c.c                  |   1 +
  sensehat.dtbs                                 |  52 +++++
  9 files changed, 391 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 sensehat.dtbs

#21 lore raw
Quoted 39 lines · Matthias Brugger
Quoted 27 lines · Charles Mirabile

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/

Quoted 7 lines

Changes since v9:
- The driver for the sensehat joystick was accepted upstream so it is no longer included in this patchset.
- Some of the people involved in the development of earlier versions of these patches are no longer involved in the project so they have been removed from the list of maintainers and the patches.

Quoted 2 lines

I'd would expect the patches to honor their involvement in the past, but if they are fine from being dropped, I will not object...

Since I am sending a v11 I will try to get in touch with them and see if they want
to be involved and find proper emails (they no longer work at Red Hat). I will also look into how much / to which parts of the code they contributed and see
where it is appropriate to include them if they do want to be included. I should have
done this before sending v10, but I didn't have the proper emails and wasn't sure
about the correct etiquette.

Quoted 44 lines

Regards,
Matthias

Quoted 39 lines

- The code is completely unchanged and so based on the discussions from version 9 of the patches, it should be ready to be merged.

My appologies for the long delay between v9 and v10 especially given the fact that there are no changes to the code. We appreciate the maintainers' patience and guidance throughout all 10 versions of this sensehat patchset, and we are excited for this driver to hopefully be fully accepted.

Best - Charlie

Charles Mirabile (5):
drivers/mfd: sensehat: Add Raspberry Pi Sense HAT to simple_mfd_i2c 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         |  26 +++
  .../input/raspberrypi,sensehat-joystick.yaml  |  31 +++
  .../bindings/mfd/raspberrypi,sensehat.yaml    |  57 +++++
  MAINTAINERS                                   |  10 +
  drivers/auxdisplay/Kconfig                    |   8 +
  drivers/auxdisplay/Makefile                   |   1 +
  drivers/auxdisplay/sensehat-display.c         | 205 ++++++++++++++++++
  drivers/mfd/simple-mfd-i2c.c                  |   1 +
  sensehat.dtbs                                 |  52 +++++
  9 files changed, 391 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 sensehat.dtbs

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

#22 lore raw
In reply to Charles Mirabile
Quoted 4 lines · Charles Mirabile

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.

Better say "Add a set of drivers for Sense HAT peripheral add-on device for Raspberry Pi. The device is connected using GPIO connector and communicate via I2C".

Quoted 4 lines

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.

s/We modified his code/The driver code is modified/

Also, I see that description of individual patches is written in descriptive mood. However, it is preferable to write in imperative instead (see "Describe your changes" in Documentation/process/submitting-patches.rst). The specific suggested wordings are in reply to each patch.

Thanks.

Signature · 1 line
An old man doll... just what I always wanted! - Clara
#23 lore raw
Quoted 10 lines · Bagas Sanjaya
Quoted 4 lines · Charles Mirabile

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.

Better say "Add a set of drivers for Sense HAT peripheral add-on device for Raspberry Pi. The device is connected using GPIO connector and communicate via I2C".

The cover letter won't be part of the git log, so as long as it's understandable it's OK. It makes no sense to review the wording...

Regards,
Matthias

Quoted 15 lines
Quoted 4 lines

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.

s/We modified his code/The driver code is modified/

Also, I see that description of individual patches is written in descriptive mood. However, it is preferable to write in imperative instead (see "Describe your changes" in Documentation/process/submitting-patches.rst). The specific suggested wordings are in reply to each patch.

Thanks.