From nobody Tue Dec 16 08:30:00 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 042A0C433F5 for ; Tue, 12 Apr 2022 23:26:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230194AbiDLX3F (ORCPT ); Tue, 12 Apr 2022 19:29:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38698 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231316AbiDLX2Q (ORCPT ); Tue, 12 Apr 2022 19:28:16 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 19A25E0AEC for ; Tue, 12 Apr 2022 15:34:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1649802841; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=QA0FeCUr4bLfjKoIaw8u1rHYCmWADNz6x1PRseUplPs=; b=ErJNn4OQVIBihGuNAhnL3bQp47BOECWayegniReH6ZslPNRmZKFOaHfa3MC174JGW0bnTD XzDaA8AVSXSJiK7hP4RC8CxpSRvo8nuovZ5ccSrPD/cb8D6GsMtbIFUA286e32Chjyob5i QJAZrY1kbJFo8lY8BOY5Hy8Tg2npZRY= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-48-WOdkxwytPo6lkFy_EgXcbw-1; Tue, 12 Apr 2022 16:14:16 -0400 X-MC-Unique: WOdkxwytPo6lkFy_EgXcbw-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 3F6281C05B0C; Tue, 12 Apr 2022 20:14:11 +0000 (UTC) Received: from cmirabil.remote.csb (unknown [10.22.32.76]) by smtp.corp.redhat.com (Postfix) with ESMTP id B04B2401DAC; Tue, 12 Apr 2022 20:14:10 +0000 (UTC) From: Charles Mirabile To: linux-kernel@vger.kernel.org Cc: Charles Mirabile , Serge Schneider , Stefan Wahren , Nicolas Saenz Julienne , Mattias Brugger , linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, fedora-rpi@googlegroups.com, Lee Jones , Mwesigwa Guma , Joel Savitz Subject: [PATCH v8 1/6] drivers/mfd: sensehat: Add Raspberry Pi Sense HAT to simple_mfd_i2c Date: Tue, 12 Apr 2022 16:13:38 -0400 Message-Id: <20220412201343.8074-2-cmirabil@redhat.com> In-Reply-To: <20220412201343.8074-1-cmirabil@redhat.com> References: <20220412201343.8074-1-cmirabil@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 2.85 on 10.11.54.10 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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 Signed-off-by: Mwesigwa Guma Co-developed-by: Joel Savitz Signed-off-by: Joel Savitz Signed-off-by: Charles Mirabile --- 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 f4c8fc3ee463..c47f36581f3f 100644 --- a/drivers/mfd/simple-mfd-i2c.c +++ b/drivers/mfd/simple-mfd-i2c.c @@ -75,6 +75,7 @@ static const struct simple_mfd_data silergy_sy7636a =3D { static const struct of_device_id simple_mfd_i2c_of_match[] =3D { { .compatible =3D "kontron,sl28cpld" }, { .compatible =3D "silergy,sy7636a", .data =3D &silergy_sy7636a}, + { .compatible =3D "raspberrypi,sensehat" }, {} }; MODULE_DEVICE_TABLE(of, simple_mfd_i2c_of_match); --=20 2.31.1 From nobody Tue Dec 16 08:30:00 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4D03FC433F5 for ; Tue, 12 Apr 2022 23:26:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230190AbiDLX2w (ORCPT ); Tue, 12 Apr 2022 19:28:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39036 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230416AbiDLX1z (ORCPT ); Tue, 12 Apr 2022 19:27:55 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id A266252B29 for ; Tue, 12 Apr 2022 15:35:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1649802927; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=/JqL0X3/KT3zDD+acZ4FetaC4TRfVdG3OQ6t4Ea+PBQ=; b=eePlWty0U8cKlu7uZyMvyPgaCJU6AmRXqIhRYnH+miWnEtfHBWTrvjXsmfxZM9b2joD5NU wD40F++53Tl8qvkRydJ5rezdwPonoVIW6hWeqtNXmsh+mFq4PQS+99Mkhd9AfBxZPetymt JY1Jo+jLe2cRzFPctSxpEah97ksnnrk= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-642-TLjuljRYP7OLihIosi6tQA-1; Tue, 12 Apr 2022 16:14:12 -0400 X-MC-Unique: TLjuljRYP7OLihIosi6tQA-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id D5049811E80; Tue, 12 Apr 2022 20:14:11 +0000 (UTC) Received: from cmirabil.remote.csb (unknown [10.22.32.76]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4ED05416363; Tue, 12 Apr 2022 20:14:11 +0000 (UTC) From: Charles Mirabile To: linux-kernel@vger.kernel.org Cc: Charles Mirabile , Serge Schneider , Stefan Wahren , Nicolas Saenz Julienne , Mattias Brugger , linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, fedora-rpi@googlegroups.com, Dmitry Torokhov , linux-input@vger.kernel.org, Daniel Bauman , Mwesigwa Guma , Joel Savitz Subject: [PATCH v8 2/6] drivers/input/joystick: sensehat: Raspberry Pi Sense HAT joystick driver Date: Tue, 12 Apr 2022 16:13:39 -0400 Message-Id: <20220412201343.8074-3-cmirabil@redhat.com> In-Reply-To: <20220412201343.8074-1-cmirabil@redhat.com> References: <20220412201343.8074-1-cmirabil@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 2.85 on 10.11.54.10 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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 Signed-off-by: Daniel Bauman Co-developed-by: Mwesigwa Guma Signed-off-by: Mwesigwa Guma Co-developed-by: Joel Savitz Signed-off-by: Joel Savitz Signed-off-by: Charles Mirabile --- 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 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. =20 +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/Makef= ile index 5174b8aba2dd..39c8b5c6e5ae 100644 --- a/drivers/input/joystick/Makefile +++ b/drivers/input/joystick/Makefile @@ -28,6 +28,7 @@ obj-$(CONFIG_JOYSTICK_N64) +=3D n64joy.o obj-$(CONFIG_JOYSTICK_PSXPAD_SPI) +=3D psxpad-spi.o obj-$(CONFIG_JOYSTICK_PXRC) +=3D pxrc.o obj-$(CONFIG_JOYSTICK_QWIIC) +=3D qwiic-joystick.o +obj-$(CONFIG_JOYSTICK_SENSEHAT) +=3D sensehat-joystick.o obj-$(CONFIG_JOYSTICK_SIDEWINDER) +=3D sidewinder.o obj-$(CONFIG_JOYSTICK_SPACEBALL) +=3D spaceball.o obj-$(CONFIG_JOYSTICK_SPACEORB) +=3D spaceorb.o diff --git a/drivers/input/joystick/sensehat-joystick.c b/drivers/input/joy= stick/sensehat-joystick.c new file mode 100644 index 000000000000..6fed6004f464 --- /dev/null +++ b/drivers/input/joystick/sensehat-joystick.c @@ -0,0 +1,137 @@ +// 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 Sa= vitz + */ + +#include +#include +#include +#include +#include +#include +#include + +#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[] =3D { + 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 =3D cookie; + unsigned long curr_states, changes; + + error =3D 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 =3D 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 =3D keys; + return IRQ_HANDLED; +} + +static int sensehat_joystick_probe(struct platform_device *pdev) +{ + int error, i, irq; + struct sensehat_joystick *sensehat_joystick =3D devm_kzalloc( + &pdev->dev, sizeof(*sensehat_joystick), GFP_KERNEL); + if (!sensehat_joystick) + return -ENOMEM; + + sensehat_joystick->pdev =3D pdev; + + sensehat_joystick->regmap =3D dev_get_regmap(sensehat_joystick->pdev->dev= .parent, NULL); + if (!sensehat_joystick->regmap) { + dev_err(&pdev->dev, + "unable to get sensehat regmap"); + return -ENODEV; + } + + + sensehat_joystick->keys_dev =3D devm_input_allocate_device(&pdev->dev); + if (!sensehat_joystick->keys_dev) { + dev_err(&pdev->dev, "Could not allocate input device."); + return -ENOMEM; + } + + for (i =3D 0; i < ARRAY_SIZE(keymap); i++) + set_bit(keymap[i], sensehat_joystick->keys_dev->keybit); + + sensehat_joystick->keys_dev->name =3D "Raspberry Pi Sense HAT Joystick"; + sensehat_joystick->keys_dev->phys =3D "sensehat-joystick/input0"; + sensehat_joystick->keys_dev->id.bustype =3D BUS_I2C; + sensehat_joystick->keys_dev->evbit[0] =3D + BIT_MASK(EV_KEY) | BIT_MASK(EV_REP); + + error =3D input_register_device(sensehat_joystick->keys_dev); + if (error) { + dev_err(&pdev->dev, "Could not register input device."); + return error; + } + + irq =3D platform_get_irq(pdev, 0); + if (irq < 0) { + dev_err(&pdev->dev, "Could not retrieve interrupt request."); + return irq; + } + + error =3D 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."); + return error; + } + + return 0; +} + +static const struct of_device_id sensehat_joystick_device_id[] =3D { + { .compatible =3D "raspberrypi,sensehat-joystick" }, + {}, +}; +MODULE_DEVICE_TABLE(of, sensehat_joystick_device_id); + +static struct platform_driver sensehat_joystick_driver =3D { + .probe =3D sensehat_joystick_probe, + .driver =3D { + .name =3D "sensehat-joystick", + .of_match_table =3D sensehat_joystick_device_id, + }, +}; + +module_platform_driver(sensehat_joystick_driver); + +MODULE_DESCRIPTION("Raspberry Pi Sense HAT joystick driver"); +MODULE_AUTHOR("Charles Mirabile "); +MODULE_AUTHOR("Serge Schneider "); +MODULE_LICENSE("GPL"); --=20 2.31.1 From nobody Tue Dec 16 08:30:00 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 81B74C433EF for ; Tue, 12 Apr 2022 20:20:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229922AbiDLUVv (ORCPT ); Tue, 12 Apr 2022 16:21:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38898 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229494AbiDLUVf (ORCPT ); Tue, 12 Apr 2022 16:21:35 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 55279C8BE1 for ; Tue, 12 Apr 2022 13:19:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1649794456; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=FjswEfzXi7w1n0wExTq7UMdgOf2WX0RDtN6oi5FS6V4=; b=YnLbV17zJJBLm2nPmcLeUUJiQ5hfbpxi8UnR55hYRcCMm9r7Kw7NGRDGeFiqp9yGFksMiG ryWh4GRVYkpZ+2x+a02iiFL+a14vVzTOl8mtzWFC8TpZ4e7WFiejFevAm4O3JkoaOVS2oc uI6aT1WuT5wonjvpwlN1Ub3Nzz6XNnc= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-369-2nP4A1a0MUSk1KbQv5q10w-1; Tue, 12 Apr 2022 16:14:13 -0400 X-MC-Unique: 2nP4A1a0MUSk1KbQv5q10w-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id AD1101C05B0F; Tue, 12 Apr 2022 20:14:12 +0000 (UTC) Received: from cmirabil.remote.csb (unknown [10.22.32.76]) by smtp.corp.redhat.com (Postfix) with ESMTP id E50BE416363; Tue, 12 Apr 2022 20:14:11 +0000 (UTC) From: Charles Mirabile To: linux-kernel@vger.kernel.org Cc: Charles Mirabile , Serge Schneider , Stefan Wahren , Nicolas Saenz Julienne , Mattias Brugger , linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, fedora-rpi@googlegroups.com, Miguel Ojeda , Daniel Bauman , Mwesigwa Guma , Joel Savitz Subject: [PATCH v8 3/6] drivers/auxdisplay: sensehat: Raspberry Pi Sense HAT display driver Date: Tue, 12 Apr 2022 16:13:40 -0400 Message-Id: <20220412201343.8074-4-cmirabil@redhat.com> In-Reply-To: <20220412201343.8074-1-cmirabil@redhat.com> References: <20220412201343.8074-1-cmirabil@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 2.85 on 10.11.54.10 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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 128 bytes large and contains 64 RGB565 triples (2 bytes each) one for each pixel. Co-developed-by: Daniel Bauman Signed-off-by: Daniel Bauman Co-developed-by: Mwesigwa Guma Signed-off-by: Mwesigwa Guma Co-developed-by: Joel Savitz Signed-off-by: Joel Savitz Signed-off-by: Charles Mirabile --- 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 diff --git a/drivers/auxdisplay/Kconfig b/drivers/auxdisplay/Kconfig index 64012cda4d12..9bad1aade7a0 100644 --- a/drivers/auxdisplay/Kconfig +++ b/drivers/auxdisplay/Kconfig @@ -203,6 +203,14 @@ config ARM_CHARLCD line and the Linux version on the second line, but that's still useful. =20 +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 diff --git a/drivers/auxdisplay/Makefile b/drivers/auxdisplay/Makefile index 6968ed4d3f0a..30b2b7934046 100644 --- a/drivers/auxdisplay/Makefile +++ b/drivers/auxdisplay/Makefile @@ -14,3 +14,4 @@ obj-$(CONFIG_HT16K33) +=3D ht16k33.o obj-$(CONFIG_PARPORT_PANEL) +=3D panel.o obj-$(CONFIG_LCD2S) +=3D lcd2s.o obj-$(CONFIG_LINEDISP) +=3D line-display.o +obj-$(CONFIG_SENSEHAT_DISPLAY) +=3D sensehat-display.o diff --git a/drivers/auxdisplay/sensehat-display.c b/drivers/auxdisplay/sen= sehat-display.c new file mode 100644 index 000000000000..9faaee5cde8a --- /dev/null +++ b/drivers/auxdisplay/sensehat-display.c @@ -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, Mwesigwa Guma, Joel Savitz + * + * Original Author: Serge Schneider + * Revised for upstream Linux by: Charles Mirabile, Mwesigwa Guma, Joel Sa= vitz + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#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 =3D 0; i < NUM_LEDS; ++i) + for (j =3D 0; j < NUM_LEDS; ++j) + for (k =3D 0; k < NUM_CHANNELS; ++k) + buff[i][k][j] =3D + display->vmem[i][j][k] & RGB_555_MASK; + + ret =3D 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 =3D + container_of(filp->private_data, struct sensehat_display, mdev); + ssize_t ret =3D -EFAULT; + + if (*f_pos < 0 || *f_pos >=3D VMEM_SIZE) + return 0; + count =3D 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 +=3D count; + ret =3D 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 =3D + container_of(filp->private_data, struct sensehat_display, mdev); + int ret =3D -EFAULT; + + if (*f_pos < 0 || *f_pos >=3D VMEM_SIZE) + return -EFBIG; + count =3D 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 =3D sensehat_update_display(sensehat_display); + if (ret < 0) { + ret =3D -EIO; + goto out; + } + *f_pos +=3D count; + ret =3D count; +out: + mutex_unlock(&sensehat_display->rw_mtx); + return ret; +} + +static const struct file_operations sensehat_display_fops =3D { + .owner =3D THIS_MODULE, + .llseek =3D sensehat_display_llseek, + .read =3D sensehat_display_read, + .write =3D sensehat_display_write, +}; + +static int sensehat_display_probe(struct platform_device *pdev) +{ + int ret; + + struct sensehat_display *sensehat_display =3D + devm_kmalloc(&pdev->dev, sizeof(*sensehat_display), GFP_KERNEL); + if (!sensehat_display) + return -ENOMEM; + + sensehat_display->pdev =3D pdev; + + dev_set_drvdata(&pdev->dev, sensehat_display); + + sensehat_display->regmap =3D 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 =3D sensehat_update_display(sensehat_display); + if (ret < 0) { + dev_err(&pdev->dev, + "Could not communicate with sensehat"); + return ret; + } + + sensehat_display->mdev =3D (struct miscdevice){ + .minor =3D MISC_DYNAMIC_MINOR, + .name =3D "sense-hat", + .mode =3D 0666, + .fops =3D &sensehat_display_fops, + }; + + ret =3D 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 =3D dev_get_drvdata(&pdev->dev); + + misc_deregister(&sensehat_display->mdev); + return 0; +} + +static const struct of_device_id sensehat_display_device_id[] =3D { + { .compatible =3D "raspberrypi,sensehat-display" }, + {}, +}; +MODULE_DEVICE_TABLE(of, sensehat_display_device_id); + +static struct platform_driver sensehat_display_driver =3D { + .probe =3D sensehat_display_probe, + .remove =3D sensehat_display_remove, + .driver =3D { + .name =3D "sensehat-display", + .of_match_table =3D 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 "); +MODULE_AUTHOR("Serge Schneider "); +MODULE_LICENSE("GPL"); --=20 2.31.1 From nobody Tue Dec 16 08:30:00 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C485EC4332F for ; Tue, 12 Apr 2022 23:27:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229900AbiDLX3n (ORCPT ); Tue, 12 Apr 2022 19:29:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51628 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231139AbiDLX2G (ORCPT ); Tue, 12 Apr 2022 19:28:06 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id A9AF619C27 for ; Tue, 12 Apr 2022 15:34:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1649802855; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Z+ent/yy95aJOm6DnI9kx/1sJTBsC05TLsSw4BZBHzs=; b=SeC0Mk7HbI8AUy0rgdAO4pUfy759ub4kmNn8RfMv4zk2dtjON/fgv7jmh3DGkewVjh5VUc 0PLJjPyyydwrKb+PrSzBV3KsxSS8uTjDgKKsD9CsOZdKJ3xQUpWuurtnJE2y5X6AwHBi4b 2C6XMa2237kRq3jVuuEMoUO502AZ5Ck= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-413-jV2QJMBaNQm-JZsySZMRTA-1; Tue, 12 Apr 2022 16:14:14 -0400 X-MC-Unique: jV2QJMBaNQm-JZsySZMRTA-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 6C51D85A5BE; Tue, 12 Apr 2022 20:14:13 +0000 (UTC) Received: from cmirabil.remote.csb (unknown [10.22.32.76]) by smtp.corp.redhat.com (Postfix) with ESMTP id BA279416363; Tue, 12 Apr 2022 20:14:12 +0000 (UTC) From: Charles Mirabile To: linux-kernel@vger.kernel.org Cc: Charles Mirabile , Serge Schneider , Stefan Wahren , Nicolas Saenz Julienne , Mattias Brugger , linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, fedora-rpi@googlegroups.com, Miguel Ojeda , Rob Herring , Krzysztof Kozlowski , Dmitry Torokhov , Lee Jones , devicetree@vger.kernel.org, linux-input@vger.kernel.org, Mwesigwa Guma , Joel Savitz Subject: [PATCH v8 4/6] dt-bindings: mfd: sensehat: Add Raspberry Pi Sense HAT schema Date: Tue, 12 Apr 2022 16:13:41 -0400 Message-Id: <20220412201343.8074-5-cmirabil@redhat.com> In-Reply-To: <20220412201343.8074-1-cmirabil@redhat.com> References: <20220412201343.8074-1-cmirabil@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 2.85 on 10.11.54.10 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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 Signed-off-by: Mwesigwa Guma Co-developed-by: Joel Savitz Signed-off-by: Joel Savitz Signed-off-by: Charles Mirabile --- .../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/raspberryp= i,sensehat-display.yaml create mode 100644 Documentation/devicetree/bindings/input/raspberrypi,sen= sehat-joystick.yaml create mode 100644 Documentation/devicetree/bindings/mfd/raspberrypi,sense= hat.yaml diff --git a/Documentation/devicetree/bindings/auxdisplay/raspberrypi,sense= hat-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-dis= play.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 + - Mwesigwa Guma + - Joel Savitz + +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-j= oystick.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.yam= l# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Raspberry Pi Sensehat Joystick + +maintainers: + - Charles Mirabile + - Mwesigwa Guma + - Joel Savitz + +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.yam= l 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 + - Mwesigwa Guma + - Joel Savitz + +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 + i2c { + #address-cells =3D <1>; + #size-cells =3D <0>; + sensehat@46 { + #address-cells =3D <1>; + #size-cells =3D <0>; + compatible =3D "raspberrypi,sensehat"; + reg =3D <0x46>; + display { + compatible =3D "raspberrypi,sensehat-display"; + }; + joystick { + compatible =3D "raspberrypi,sensehat-joystick"; + interrupts =3D <23 GPIO_ACTIVE_HIGH>; + }; + }; + }; --=20 2.31.1 From nobody Tue Dec 16 08:30:00 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 55453C433F5 for ; Tue, 12 Apr 2022 20:26:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229765AbiDLU2Z (ORCPT ); Tue, 12 Apr 2022 16:28:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43006 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232193AbiDLU1k (ORCPT ); Tue, 12 Apr 2022 16:27:40 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id E1E29DD972 for ; Tue, 12 Apr 2022 13:25:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1649794457; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=liyDBksEV8Ds9UUCGHCo4lLnPFrUOPH88WtIoxg4upQ=; b=ikjxQWgczlg9yB+Ghi2Se8M9YW5ksD7f5UW4xWvcb+39nDaOJqQJ5DNH1ODX8fc2m+AIOb XK6BtTg7oDHV94vTLKksTy0Tc1yRkeZ0u1prnpwdzJ5v7Fni9W+x0HU52sHVOEzBInI2cs 7R86l2KkZgHK7aBAcV69BSQtV/ewiGo= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-410-Au-6FQUQOHajVPJRVZWeNw-1; Tue, 12 Apr 2022 16:14:14 -0400 X-MC-Unique: Au-6FQUQOHajVPJRVZWeNw-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id E4BA4185A7B2; Tue, 12 Apr 2022 20:14:13 +0000 (UTC) Received: from cmirabil.remote.csb (unknown [10.22.32.76]) by smtp.corp.redhat.com (Postfix) with ESMTP id 79386416363; Tue, 12 Apr 2022 20:14:13 +0000 (UTC) From: Charles Mirabile To: linux-kernel@vger.kernel.org Cc: Charles Mirabile , Serge Schneider , Stefan Wahren , Nicolas Saenz Julienne , Mattias Brugger , linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, fedora-rpi@googlegroups.com, Mwesigwa Guma , Joel Savitz Subject: [PATCH v8 5/6] MAINTAINERS: Add sensehat driver authors to MAINTAINERS Date: Tue, 12 Apr 2022 16:13:42 -0400 Message-Id: <20220412201343.8074-6-cmirabil@redhat.com> In-Reply-To: <20220412201343.8074-1-cmirabil@redhat.com> References: <20220412201343.8074-1-cmirabil@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 2.85 on 10.11.54.10 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" This patch adds the driver authors to MAINAINERS. Co-developed-by: Mwesigwa Guma Signed-off-by: Mwesigwa Guma Co-developed-by: Joel Savitz Signed-off-by: Joel Savitz Signed-off-by: Charles Mirabile --- MAINTAINERS | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index 61d9f114c37f..708bdccee4b3 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -17745,6 +17745,17 @@ F: Documentation/ABI/testing/sysfs-bus-iio-chemica= l-sunrise-co2 F: Documentation/devicetree/bindings/iio/chemical/senseair,sunrise.yaml F: drivers/iio/chemical/sunrise_co2.c =20 +SENSEHAT DRIVER +M: Charles Mirabile +M: Mwesigwa Guma +M: Joel Savitz +S: Maintained +F: Documentation/devicetree/bindings/auxdisplay/raspberrypi,sensehat-displ= ay.yaml +F: Documentation/devicetree/bindings/input/raspberrypi,sensehat-joystick.y= aml +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 S: Maintained --=20 2.31.1 From nobody Tue Dec 16 08:30:00 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 630EDC433EF for ; Tue, 12 Apr 2022 20:26:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229665AbiDLU2u (ORCPT ); Tue, 12 Apr 2022 16:28:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43018 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232218AbiDLU1k (ORCPT ); Tue, 12 Apr 2022 16:27:40 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id E2599DD975 for ; Tue, 12 Apr 2022 13:25:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1649794458; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=wKeEjLPVCQWQYsPyoUlmVTqyS0GcmUXtUuQ8I/MM+9k=; b=d1APatTUtJgTTmLWKehB8mbBAuQPeaXhE7p9YFm+MmGo4ja/FFno4+FEofGTvyeX5gNU3P IOpT9zp0uU5PlCfeJBiFyaiIPlnbEP0e27O0YpzjcRS3YTqnLXVI9Z3lIISYYRMsYGZCy1 kKNK9DnhbhWryN9x3jlwQG+Mm0IzsN0= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-460-9r7wI2JXNEKUjGeycyMjeA-1; Tue, 12 Apr 2022 16:14:14 -0400 X-MC-Unique: 9r7wI2JXNEKUjGeycyMjeA-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 68A721C05155; Tue, 12 Apr 2022 20:14:14 +0000 (UTC) Received: from cmirabil.remote.csb (unknown [10.22.32.76]) by smtp.corp.redhat.com (Postfix) with ESMTP id F3397416363; Tue, 12 Apr 2022 20:14:13 +0000 (UTC) From: Charles Mirabile To: linux-kernel@vger.kernel.org Cc: Charles Mirabile , Serge Schneider , Stefan Wahren , Nicolas Saenz Julienne , Mattias Brugger , linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, fedora-rpi@googlegroups.com, Mwesigwa Guma , Joel Savitz Subject: [PATCH v8 6/6] DO NOT MERGE: full sensehat device tree overlay for raspberry pi 4 Date: Tue, 12 Apr 2022 16:13:43 -0400 Message-Id: <20220412201343.8074-7-cmirabil@redhat.com> In-Reply-To: <20220412201343.8074-1-cmirabil@redhat.com> References: <20220412201343.8074-1-cmirabil@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 2.85 on 10.11.54.10 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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=3D #suppress loading of default overlay for HAT dtoverlay=3Dsensehat #load custom overlay at the beginning before any other lines in config.txt Co-developed-by: Mwesigwa Guma Signed-off-by: Mwesigwa Guma Co-developed-by: Joel Savitz Signed-off-by: Joel Savitz Signed-off-by: Charles Mirabile --- 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 =3D "brcm,bcm2835"; +}; + +&i2c1 { + #address-cells =3D <0x01>; + #size-cells =3D <0x00>; + status =3D "okay"; + + sensehat@46 { + #address-cells =3D <0x01>; + #size-cells =3D <0x00>; + compatible =3D "raspberrypi,sensehat"; + reg =3D <0x46>; + interrupt-parent =3D <&gpio>; + status =3D "okay"; + display { + compatible =3D "raspberrypi,sensehat-display"; + status =3D "okay"; + }; + joystick { + compatible =3D "raspberrypi,sensehat-joystick"; + interrupts =3D <23 1>; + status =3D "okay"; + }; + }; + + lsm9ds1-magn@1c { + compatible =3D "st,lsm9ds1-magn"; + reg =3D <0x1c>; + status =3D "okay"; + }; + + lsm9ds1-accel@6a { + compatible =3D "st,lsm9ds1-accel"; + reg =3D <0x6a>; + status =3D "okay"; + }; + + lps25h-press@5c { + compatible =3D "st,lps25h-press"; + reg =3D <0x5c>; + status =3D "okay"; + }; + + hts221-humid@5f { + compatible =3D "st,hts221-humid\0st,hts221"; + reg =3D <0x5f>; + status =3D "okay"; + }; +}; --=20 2.31.1