From nobody Mon May 6 01:50:45 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1574844642; cv=none; d=zohomail.com; s=zohoarc; b=kjjgSLF5+nalqjJEvUb222aV9LT1AdM8TBDa3Qq76JOrEYAn7+YDqAt8N0ZyRsuGsGVyaZh34UGC2xQidFxQzWTXBgcKoIarwopTP9Kq6rOFKs+X9hkkvDY7DwjIM6xyd/VCQXyah94RkhDW8pBzmFzUYmpNKdm9Vyf0UkGzIkE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1574844642; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=3zJLhsIDNIBB8R92SGrNQkumLjHBCGDJbzFfTQdczeA=; b=TOjVYbvX4qntCudgCgDMKnCLpOvKDIef4E6C16UPUIdvcX1GxoPc0QqhoagbWdG+dYgeqCU3EFXBFlAIpy3c9Fyptqn/FkYG/ARXE9fJgBYFbCNLIX/p8C7DUyJqpARFgrT9I2DbKQthAd6rCZ5KEnX8qIcRxXy2Erkto3OuF5g= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1574844642441897.512714905828; Wed, 27 Nov 2019 00:50:42 -0800 (PST) Received: from localhost ([::1]:35838 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iZt1y-0002LR-0h for importer@patchew.org; Wed, 27 Nov 2019 03:50:38 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:42174) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iZsx4-0005i4-4L for qemu-devel@nongnu.org; Wed, 27 Nov 2019 03:45:39 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iZsum-0002nh-Hw for qemu-devel@nongnu.org; Wed, 27 Nov 2019 03:43:13 -0500 Received: from michel.telenet-ops.be ([2a02:1800:110:4::f00:18]:58536) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iZsum-0002lm-9n for qemu-devel@nongnu.org; Wed, 27 Nov 2019 03:43:12 -0500 Received: from ramsan ([84.195.182.253]) by michel.telenet-ops.be with bizsmtp id Wwiu2100e5USYZQ06wiuWY; Wed, 27 Nov 2019 09:43:08 +0100 Received: from rox.of.borg ([192.168.97.57]) by ramsan with esmtp (Exim 4.90_1) (envelope-from ) id 1iZsuU-0000xe-KQ; Wed, 27 Nov 2019 09:42:54 +0100 Received: from geert by rox.of.borg with local (Exim 4.90_1) (envelope-from ) id 1iZsuU-0004OJ-IG; Wed, 27 Nov 2019 09:42:54 +0100 From: Geert Uytterhoeven To: Linus Walleij , Bartosz Golaszewski , Jonathan Corbet , Rob Herring , Mark Rutland , Harish Jenny K N , Eugeniu Rosca Subject: [PATCH v3 1/7] gpiolib: Add GPIOCHIP_NAME definition Date: Wed, 27 Nov 2019 09:42:47 +0100 Message-Id: <20191127084253.16356-2-geert+renesas@glider.be> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191127084253.16356-1-geert+renesas@glider.be> References: <20191127084253.16356-1-geert+renesas@glider.be> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 2a02:1800:110:4::f00:18 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , qemu-devel@nongnu.org, Geert Uytterhoeven , linux-doc@vger.kernel.org, Marc Zyngier , Magnus Damm , Christoffer Dall , linux-kernel@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-gpio@vger.kernel.org, devicetree@vger.kernel.org, Alexander Graf , Paolo Bonzini , Phil Reid Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" The string literal "gpiochip" is used in several places. Add a definition for it, and use it everywhere, to make sure everything stays in sync. Signed-off-by: Geert Uytterhoeven Reviewed-by: Eugeniu Rosca Reviewed-by: Ulrich Hecht Tested-by: Eugeniu Rosca --- v3: - New. --- drivers/gpio/gpiolib-sysfs.c | 7 +++---- drivers/gpio/gpiolib.c | 4 ++-- drivers/gpio/gpiolib.h | 2 ++ 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/gpio/gpiolib-sysfs.c b/drivers/gpio/gpiolib-sysfs.c index fbf6b1a0a4fae6ce..23e3d335cd543d53 100644 --- a/drivers/gpio/gpiolib-sysfs.c +++ b/drivers/gpio/gpiolib-sysfs.c @@ -762,10 +762,9 @@ int gpiochip_sysfs_register(struct gpio_device *gdev) parent =3D &gdev->dev; =20 /* use chip->base for the ID; it's already known to be unique */ - dev =3D device_create_with_groups(&gpio_class, parent, - MKDEV(0, 0), - chip, gpiochip_groups, - "gpiochip%d", chip->base); + dev =3D device_create_with_groups(&gpio_class, parent, MKDEV(0, 0), chip, + gpiochip_groups, GPIOCHIP_NAME "%d", + chip->base); if (IS_ERR(dev)) return PTR_ERR(dev); =20 diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index dce0b31f4125a6b3..c9e47620d2434983 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c @@ -1419,7 +1419,7 @@ int gpiochip_add_data_with_key(struct gpio_chip *chip= , void *data, ret =3D gdev->id; goto err_free_gdev; } - dev_set_name(&gdev->dev, "gpiochip%d", gdev->id); + dev_set_name(&gdev->dev, GPIOCHIP_NAME "%d", gdev->id); device_initialize(&gdev->dev); dev_set_drvdata(&gdev->dev, gdev); if (chip->parent && chip->parent->driver) @@ -5105,7 +5105,7 @@ static int __init gpiolib_dev_init(void) return ret; } =20 - ret =3D alloc_chrdev_region(&gpio_devt, 0, GPIO_DEV_MAX, "gpiochip"); + ret =3D alloc_chrdev_region(&gpio_devt, 0, GPIO_DEV_MAX, GPIOCHIP_NAME); if (ret < 0) { pr_err("gpiolib: failed to allocate char dev region\n"); bus_unregister(&gpio_bus_type); diff --git a/drivers/gpio/gpiolib.h b/drivers/gpio/gpiolib.h index ca9bc1e4803c2979..a4a759920faa48ab 100644 --- a/drivers/gpio/gpiolib.h +++ b/drivers/gpio/gpiolib.h @@ -16,6 +16,8 @@ #include #include =20 +#define GPIOCHIP_NAME "gpiochip" + /** * struct gpio_device - internal state container for GPIO devices * @id: numerical ID number for the GPIO chip --=20 2.17.1 From nobody Mon May 6 01:50:45 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1574844462; cv=none; d=zohomail.com; s=zohoarc; b=OL87pArd4ZIukKlyQ2/9FP+k9Hs/wzHrHFkO7FmKEw6IYBwjZFKJ715SB9UjHksbO685V6LOvBgbf/tTnX/jJRTscYH/LOuOTAI1gUO6Iy6r6qYdg37pnnajJdHTdoeydANX+C8ikkXdZMDdh7YmcBCvM+gz3V2MJ7axvMUz3XA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1574844462; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=PGNmlIkKuMyZwPUh3HbvHtB/axdNFG0Qe9OTQzg7Wts=; b=lYHOWLDfAM+q+sCwleiEHaHuWq6PbGIQdpuC3HSHogT6LT8/NepE/1UsYbJQMRVb1ZKkz4Z8WvSeU4A29+ktIiZvh+0KpTuymgS+tadsY0LGnGAROexidfe34zAs7oF7LDKduj+XWe4bf0AsguQ5YqND4pYh8pYshN0h2gkfGEM= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1574844462361759.375247156607; Wed, 27 Nov 2019 00:47:42 -0800 (PST) Received: from localhost ([::1]:35816 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iZsz4-0007k1-Ix for importer@patchew.org; Wed, 27 Nov 2019 03:47:38 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:41832) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iZsx4-0005gl-54 for qemu-devel@nongnu.org; Wed, 27 Nov 2019 03:45:39 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iZsum-0002nm-IK for qemu-devel@nongnu.org; Wed, 27 Nov 2019 03:43:13 -0500 Received: from xavier.telenet-ops.be ([2a02:1800:120:4::f00:14]:36338) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iZsum-0002lD-AQ for qemu-devel@nongnu.org; Wed, 27 Nov 2019 03:43:12 -0500 Received: from ramsan ([84.195.182.253]) by xavier.telenet-ops.be with bizsmtp id Wwiu2100T5USYZQ01wiuc1; Wed, 27 Nov 2019 09:43:07 +0100 Received: from rox.of.borg ([192.168.97.57]) by ramsan with esmtp (Exim 4.90_1) (envelope-from ) id 1iZsuU-0000xh-LV; Wed, 27 Nov 2019 09:42:54 +0100 Received: from geert by rox.of.borg with local (Exim 4.90_1) (envelope-from ) id 1iZsuU-0004OX-JP; Wed, 27 Nov 2019 09:42:54 +0100 From: Geert Uytterhoeven To: Linus Walleij , Bartosz Golaszewski , Jonathan Corbet , Rob Herring , Mark Rutland , Harish Jenny K N , Eugeniu Rosca Subject: [PATCH v3 2/7] gpiolib: Add support for gpiochipN-based table lookup Date: Wed, 27 Nov 2019 09:42:48 +0100 Message-Id: <20191127084253.16356-3-geert+renesas@glider.be> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191127084253.16356-1-geert+renesas@glider.be> References: <20191127084253.16356-1-geert+renesas@glider.be> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 2a02:1800:120:4::f00:14 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , qemu-devel@nongnu.org, Geert Uytterhoeven , linux-doc@vger.kernel.org, Marc Zyngier , Magnus Damm , Christoffer Dall , linux-kernel@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-gpio@vger.kernel.org, devicetree@vger.kernel.org, Alexander Graf , Paolo Bonzini , Phil Reid Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Currently GPIO controllers can only be referred to by label in GPIO lookup tables. Add support for looking them up by "gpiochipN" name, with "N" either the corresponding GPIO device's ID number, or the GPIO controller's first GPIO number. Signed-off-by: Geert Uytterhoeven Reviewed-by: Eugeniu Rosca Reviewed-by: Ulrich Hecht Tested-by: Eugeniu Rosca --- If this is rejected, the GPIO Aggregator documentation must be updated. The second variant is currently used by the legacy sysfs interface only, so perhaps the chip->base check should be dropped? v3: - New. --- drivers/gpio/gpiolib.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index c9e47620d2434983..d24a3d79dcfe69ad 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c @@ -1746,9 +1746,29 @@ static int gpiochip_match_name(struct gpio_chip *chi= p, void *data) return !strcmp(chip->label, name); } =20 +static int gpiochip_match_id(struct gpio_chip *chip, void *data) +{ + int id =3D (uintptr_t)data; + + return id =3D=3D chip->base || id =3D=3D chip->gpiodev->id; +} + static struct gpio_chip *find_chip_by_name(const char *name) { - return gpiochip_find((void *)name, gpiochip_match_name); + struct gpio_chip *chip; + int id; + + chip =3D gpiochip_find((void *)name, gpiochip_match_name); + if (chip) + return chip; + + if (!str_has_prefix(name, GPIOCHIP_NAME)) + return NULL; + + if (kstrtoint(name + strlen(GPIOCHIP_NAME), 10, &id)) + return NULL; + + return gpiochip_find((void *)(uintptr_t)id, gpiochip_match_id); } =20 #ifdef CONFIG_GPIOLIB_IRQCHIP --=20 2.17.1 From nobody Mon May 6 01:50:45 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1574844454; cv=none; d=zohomail.com; s=zohoarc; b=n2BIB02KpnyvcayVEKc1a6tJcT5009SVUqXORQ5LqjqS3Wmas5t9YaqUq/EtysSp+AWD2qZA1JQ6FoBpGWjqd/nnugDtl1Oy/4rvC0eaXQuHaCZTPt6mKrCkHAPB9LZXCiGFWNNZ5jZwE9N/9xsrV/KXamLHnwTZltCWLrk2xd4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1574844454; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=E6eVZKoTRGU13u529XlXm5reS+sXGykXdptTiFhP6fo=; b=UL+NyQZugSRDe+eOw7BUgARxMA238MOVKP+aduSKts1lkoCdVQG5IKnXAS5MdYpqExfuBdeWhgLWLUafJg86DaHC+HiayAznYAlyUgEU7xr951zU3xvytYPyLGDpful3N6h9IgV5HufwBjQQHuaRcmBqddUdd3Yt/ozVn0EDTRU= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1574844454281533.9344795814039; Wed, 27 Nov 2019 00:47:34 -0800 (PST) Received: from localhost ([::1]:35814 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iZsyy-0007dW-SY for importer@patchew.org; Wed, 27 Nov 2019 03:47:32 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:42160) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iZsx3-0005hv-Ok for qemu-devel@nongnu.org; Wed, 27 Nov 2019 03:45:39 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iZsun-0002oH-1c for qemu-devel@nongnu.org; Wed, 27 Nov 2019 03:43:14 -0500 Received: from baptiste.telenet-ops.be ([2a02:1800:120:4::f00:13]:60918) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iZsum-0002mK-Qv for qemu-devel@nongnu.org; Wed, 27 Nov 2019 03:43:12 -0500 Received: from ramsan ([84.195.182.253]) by baptiste.telenet-ops.be with bizsmtp id Wwiu2100W5USYZQ01wiua3; Wed, 27 Nov 2019 09:43:09 +0100 Received: from rox.of.borg ([192.168.97.57]) by ramsan with esmtp (Exim 4.90_1) (envelope-from ) id 1iZsuU-0000xj-Mm; Wed, 27 Nov 2019 09:42:54 +0100 Received: from geert by rox.of.borg with local (Exim 4.90_1) (envelope-from ) id 1iZsuU-0004Ol-KQ; Wed, 27 Nov 2019 09:42:54 +0100 From: Geert Uytterhoeven To: Linus Walleij , Bartosz Golaszewski , Jonathan Corbet , Rob Herring , Mark Rutland , Harish Jenny K N , Eugeniu Rosca Subject: [PATCH v3 3/7] gpiolib: Add support for GPIO line table lookup Date: Wed, 27 Nov 2019 09:42:49 +0100 Message-Id: <20191127084253.16356-4-geert+renesas@glider.be> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191127084253.16356-1-geert+renesas@glider.be> References: <20191127084253.16356-1-geert+renesas@glider.be> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 2a02:1800:120:4::f00:13 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , qemu-devel@nongnu.org, Geert Uytterhoeven , linux-doc@vger.kernel.org, Marc Zyngier , Magnus Damm , Christoffer Dall , linux-kernel@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-gpio@vger.kernel.org, devicetree@vger.kernel.org, Alexander Graf , Paolo Bonzini , Phil Reid Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Currently GPIOs can only be referred to by GPIO controller and offset in GPIO lookup tables. Add support for looking them up by line name. Signed-off-by: Geert Uytterhoeven Reviewed-by: Eugeniu Rosca Reviewed-by: Ulrich Hecht Tested-by: Eugeniu Rosca --- If this is rejected, the GPIO Aggregator documentation and code must be updated. v3: - New. --- drivers/gpio/gpiolib.c | 12 ++++++++++++ include/linux/gpio/machine.h | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index d24a3d79dcfe69ad..cb608512ad6bbded 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c @@ -4475,6 +4475,18 @@ static struct gpio_desc *gpiod_find(struct device *d= ev, const char *con_id, if (p->con_id && (!con_id || strcmp(p->con_id, con_id))) continue; =20 + if (p->chip_hwnum =3D=3D (u16)-1) { + desc =3D gpio_name_to_desc(p->chip_label); + if (desc) { + *flags =3D p->flags; + return desc; + } + + dev_warn(dev, "cannot find GPIO line %s, deferring\n", + p->chip_label); + return ERR_PTR(-EPROBE_DEFER); + } + chip =3D find_chip_by_name(p->chip_label); =20 if (!chip) { diff --git a/include/linux/gpio/machine.h b/include/linux/gpio/machine.h index 1ebe5be05d5f81fa..84c1c097e55eefaf 100644 --- a/include/linux/gpio/machine.h +++ b/include/linux/gpio/machine.h @@ -31,7 +31,7 @@ enum gpio_lookup_flags { */ struct gpiod_lookup { const char *chip_label; - u16 chip_hwnum; + u16 chip_hwnum; /* if -1, chip_label is named line */ const char *con_id; unsigned int idx; unsigned long flags; --=20 2.17.1 From nobody Mon May 6 01:50:45 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1574844672; cv=none; d=zohomail.com; s=zohoarc; b=Bg4L0jbDfcV8ILeRiAk//d1yvf3nwJD4hUNEFgPI8nRVgLDtpX0pkFwjL9+vLCGTGc6ycdHbjr3k1jo9bu+bjEiSr2GXLamKdOoOzfadcPJAphhWeZaQnP5eCrVPufAvFD3m3FUAPbmoGnq/rc1bcIyqeLrSez+uBwgUJxjPVrU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1574844672; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=WlDIw1WmOEv0vC/4nmp2KMK+DuyTGnoFF0dz0y6E7/Q=; b=iWNe9q5hlI/xmRtOdUMSe94sYLd6KnOL8IQ1k8jZlNUlZICgL/CVWJ0RzEeTRgQP2dnfeuJEPft8UUSagvIvUdQ3wrj7pDjQrufLg0rfsmm8Mhxz/5LVQrCPhTECQ4CDP4SvJh8Dg0tO8Zqw1pjskAIxDvae4PxaG/ox65R4/gs= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1574844672877706.3295506349355; Wed, 27 Nov 2019 00:51:12 -0800 (PST) Received: from localhost ([::1]:35840 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iZt2U-0002hT-RM for importer@patchew.org; Wed, 27 Nov 2019 03:51:10 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:41840) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iZsx3-0005gm-Sx for qemu-devel@nongnu.org; Wed, 27 Nov 2019 03:45:39 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iZsum-0002nY-Gy for qemu-devel@nongnu.org; Wed, 27 Nov 2019 03:43:13 -0500 Received: from xavier.telenet-ops.be ([2a02:1800:120:4::f00:14]:36340) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iZsum-0002lC-9U for qemu-devel@nongnu.org; Wed, 27 Nov 2019 03:43:12 -0500 Received: from ramsan ([84.195.182.253]) by xavier.telenet-ops.be with bizsmtp id Wwiu2100X5USYZQ01wiuc6; Wed, 27 Nov 2019 09:43:07 +0100 Received: from rox.of.borg ([192.168.97.57]) by ramsan with esmtp (Exim 4.90_1) (envelope-from ) id 1iZsuU-0000xl-Oj; Wed, 27 Nov 2019 09:42:54 +0100 Received: from geert by rox.of.borg with local (Exim 4.90_1) (envelope-from ) id 1iZsuU-0004Or-Ld; Wed, 27 Nov 2019 09:42:54 +0100 From: Geert Uytterhoeven To: Linus Walleij , Bartosz Golaszewski , Jonathan Corbet , Rob Herring , Mark Rutland , Harish Jenny K N , Eugeniu Rosca Subject: [PATCH v3 4/7] dt-bindings: gpio: Add gpio-repeater bindings Date: Wed, 27 Nov 2019 09:42:50 +0100 Message-Id: <20191127084253.16356-5-geert+renesas@glider.be> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191127084253.16356-1-geert+renesas@glider.be> References: <20191127084253.16356-1-geert+renesas@glider.be> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 2a02:1800:120:4::f00:14 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , qemu-devel@nongnu.org, Geert Uytterhoeven , linux-doc@vger.kernel.org, Marc Zyngier , Magnus Damm , Christoffer Dall , linux-kernel@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-gpio@vger.kernel.org, devicetree@vger.kernel.org, Alexander Graf , Paolo Bonzini , Phil Reid Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Add Device Tree bindings for a GPIO repeater, with optional translation of physical signal properties. This is useful for describing explicitly the presence of e.g. an inverter on a GPIO line, and was inspired by the non-YAML gpio-inverter bindings by Harish Jenny K N [1]. Note that this is different from a GPIO Nexus Node[2], which cannot do physical signal property translation. While an inverter can be described implicitly by exchanging the GPIO_ACTIVE_HIGH and GPIO_ACTIVE_LOW flags, this has its limitations. Each GPIO line has only a single GPIO_ACTIVE_* flag, but applies to both th provider and consumer sides: 1. The GPIO provider (controller) looks at the flags to know the polarity, so it can translate between logical (active/not active) and physical (high/low) signal levels. 2. While the signal polarity is usually fixed on the GPIO consumer side (e.g. an LED is tied to either the supply voltage or GND), it may be configurable on some devices, and both sides need to agree. Hence the GPIO_ACTIVE_* flag as seen by the consumer must match the actual polarity. There exists a similar issue with interrupt flags, where both the interrupt controller and the device generating the interrupt need to agree, which breaks in the presence of a physical inverter not described in DT (see e.g. [3]). [1] "[PATCH V4 2/2] gpio: inverter: document the inverter bindings" https://lore.kernel.org/linux-gpio/1561699236-18620-3-git-send-email-ha= rish_kandiga@mentor.com/ [2] Devicetree Specification v0.3-rc2, Section 2.5 https://github.com/devicetree-org/devicetree-specification/releases/tag= /v0.3-rc2 [3] "[PATCH] wlcore/wl18xx: Add invert-irq OF property for physically inverted IRQ" https://lore.kernel.org/linux-renesas-soc/20190607172958.20745-1-erosca= @de.adit-jv.com/ Signed-off-by: Geert Uytterhoeven Reviewed-by: Eugeniu Rosca Reviewed-by: Ulrich Hecht Tested-by: Eugeniu Rosca --- v3: - New. --- .../bindings/gpio/gpio-repeater.yaml | 53 +++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 Documentation/devicetree/bindings/gpio/gpio-repeater.ya= ml diff --git a/Documentation/devicetree/bindings/gpio/gpio-repeater.yaml b/Do= cumentation/devicetree/bindings/gpio/gpio-repeater.yaml new file mode 100644 index 0000000000000000..efdee0c3be43f731 --- /dev/null +++ b/Documentation/devicetree/bindings/gpio/gpio-repeater.yaml @@ -0,0 +1,53 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/gpio/gpio-repeater.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: GPIO Repeater + +maintainers: + - Harish Jenny K N + - Geert Uytterhoeven + +description: + This represents a repeater for one or more GPIOs, possibly including phy= sical + signal property translation (e.g. polarity inversion). + +properties: + compatible: + const: gpio-repeater + + "#gpio-cells": + const: 2 + + gpio-controller: true + + gpios: + description: + Phandle and specifier, one for each repeated GPIO. + + gpio-line-names: + description: + Strings defining the names of the GPIO lines going out of the GPIO + controller. + +required: + - compatible + - "#gpio-cells" + - gpio-controller + - gpios + +additionalProperties: false + +examples: + # Device node describing a polarity inverter for a single GPIO + - | + #include + + inverter: gpio-repeater { + compatible =3D "gpio-repeater"; + #gpio-cells =3D <2>; + gpio-controller; + gpios =3D <&gpio 95 GPIO_ACTIVE_LOW>; + }; --=20 2.17.1 From nobody Mon May 6 01:50:45 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1574844806; cv=none; d=zohomail.com; s=zohoarc; b=IRSryUEwKn1kVj3uupGqOeAHxp+rPU2xkaeo6JCw5JQ2D1ApXWUT1GZtV41rLB/AP/6xFC4iBpF3ZudtpwFiVTdPTTva4RhfKwoWqyCJVs7YExkW1PZ/BSaOwGMC6/XMn3MWCzoB0vur8tmFX0npTxgunSykp9whOSip94AQJM8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1574844806; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=YwoIH87K4t6DvxROmDpV3KzzdvQKIWYqv3V4rDftAYE=; b=eZJuhnpipmAW2oWB0ypVxch5V0j2fGZPdwsOxnxHBDal9iOXINsn/ZOpOa4/ilpqluzjcg72d5K6YcthVPQOkMPcWkmMJubU16yGsgwZu8ayufJzYUYHW9i5xSRPrBhYsBENCn28QBxpLQJAU0wxPpWmcypof/hVxbcZnlor7vI= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1574844806738493.5452684814404; Wed, 27 Nov 2019 00:53:26 -0800 (PST) Received: from localhost ([::1]:35878 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iZt4f-0005ny-7L for importer@patchew.org; Wed, 27 Nov 2019 03:53:25 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:41798) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iZsx3-0005gj-Ly for qemu-devel@nongnu.org; Wed, 27 Nov 2019 03:45:41 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iZsum-0002o4-Lt for qemu-devel@nongnu.org; Wed, 27 Nov 2019 03:43:15 -0500 Received: from andre.telenet-ops.be ([2a02:1800:120:4::f00:15]:45648) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iZsum-0002lW-9n for qemu-devel@nongnu.org; Wed, 27 Nov 2019 03:43:12 -0500 Received: from ramsan ([84.195.182.253]) by andre.telenet-ops.be with bizsmtp id Wwiu2100c5USYZQ01wiuXT; Wed, 27 Nov 2019 09:43:07 +0100 Received: from rox.of.borg ([192.168.97.57]) by ramsan with esmtp (Exim 4.90_1) (envelope-from ) id 1iZsuU-0000xr-Pe; Wed, 27 Nov 2019 09:42:54 +0100 Received: from geert by rox.of.borg with local (Exim 4.90_1) (envelope-from ) id 1iZsuU-0004Ox-Ms; Wed, 27 Nov 2019 09:42:54 +0100 From: Geert Uytterhoeven To: Linus Walleij , Bartosz Golaszewski , Jonathan Corbet , Rob Herring , Mark Rutland , Harish Jenny K N , Eugeniu Rosca Subject: [PATCH v3 5/7] gpio: Add GPIO Aggregator/Repeater driver Date: Wed, 27 Nov 2019 09:42:51 +0100 Message-Id: <20191127084253.16356-6-geert+renesas@glider.be> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191127084253.16356-1-geert+renesas@glider.be> References: <20191127084253.16356-1-geert+renesas@glider.be> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 2a02:1800:120:4::f00:15 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , qemu-devel@nongnu.org, Geert Uytterhoeven , linux-doc@vger.kernel.org, Marc Zyngier , Magnus Damm , Christoffer Dall , linux-kernel@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-gpio@vger.kernel.org, devicetree@vger.kernel.org, Alexander Graf , Paolo Bonzini , Phil Reid Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" GPIO controllers are exported to userspace using /dev/gpiochip* character devices. Access control to these devices is provided by standard UNIX file system permissions, on an all-or-nothing basis: either a GPIO controller is accessible for a user, or it is not. Currently no mechanism exists to control access to individual GPIOs. Hence add a GPIO driver to aggregate existing GPIOs, and expose them as a new gpiochip. This supports the following use cases: 1. Aggregating GPIOs using Sysfs This is useful for implementing access control, and assigning a set of GPIOs to a specific user or virtual machine. 2. GPIO Repeater in Device Tree This supports modelling e.g. GPIO inverters in DT. 3. Generic GPIO Driver This provides userspace access to a simple GPIO-operated device described in DT, cfr. e.g. spidev for SPI-operated devices. Signed-off-by: Geert Uytterhoeven Reviewed-by: Eugeniu Rosca Tested-by: Eugeniu Rosca --- v3: - Absorb GPIO forwarder, - Integrate GPIO Repeater and Generic GPIO driver functionality, - Use the aggregator parameters to create a GPIO lookup table instead of an array of GPIO descriptors, which allows to simplify the code: 1. This removes the need for calling gpio_name_to_desc(), gpiochip_find(), gpiochip_get_desc(), and gpiod_request(), 2. This allows the platform device to always use devm_gpiod_get_index(), regardless of the origin of the GPIOs, - Move parameter parsing from platform device probe to sysfs attribute store, removing the need for platform data passing, - Use more devm_*() functions to simplify cleanup, - Add pr_fmt(), - General refactoring. v2: - Add missing initialization of i in gpio_virt_agg_probe(), - Update for removed .need_valid_mask field and changed .init_valid_mask() signature, - Drop "virtual", rename to gpio-aggregator, - Drop bogus FIXME related to gpiod_set_transitory() expectations, - Use new GPIO Forwarder Helper, - Lift limit on the maximum number of GPIOs, - Improve parsing: - add support for specifying GPIOs by line name, - add support for specifying GPIO chips by ID, - add support for GPIO offset ranges, - names and offset specifiers must be separated by whitespace, - GPIO offsets must separated by spaces, - Use str_has_prefix() and kstrtouint(). --- drivers/gpio/Kconfig | 13 + drivers/gpio/Makefile | 1 + drivers/gpio/gpio-aggregator.c | 587 +++++++++++++++++++++++++++++++++ 3 files changed, 601 insertions(+) create mode 100644 drivers/gpio/gpio-aggregator.c diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig index 8adffd42f8cb0559..36b6b57a6b05e906 100644 --- a/drivers/gpio/Kconfig +++ b/drivers/gpio/Kconfig @@ -1507,6 +1507,19 @@ config GPIO_VIPERBOARD =20 endmenu =20 +config GPIO_AGGREGATOR + tristate "GPIO Aggregator/Repeater" + help + Say yes here to enable the GPIO Aggregator and repeater, which + provides a way to aggregate and/or repeat existing GPIOs into a new + GPIO device. + This can serve the following purposes: + 1. Assign a collection of GPIOs to a user, or export them to a + virtual machine, + 2. Support GPIOs that are connected to a physical inverter, + 3. Provide a generic driver for a GPIO-operated device, to be + controlled from userspace using the GPIO chardev interface. + config GPIO_MOCKUP tristate "GPIO Testing Driver" select IRQ_SIM diff --git a/drivers/gpio/Makefile b/drivers/gpio/Makefile index 34eb8b2b12dd656c..f9971eeb1f32335f 100644 --- a/drivers/gpio/Makefile +++ b/drivers/gpio/Makefile @@ -25,6 +25,7 @@ obj-$(CONFIG_GPIO_74XX_MMIO) +=3D gpio-74xx-mmio.o obj-$(CONFIG_GPIO_ADNP) +=3D gpio-adnp.o obj-$(CONFIG_GPIO_ADP5520) +=3D gpio-adp5520.o obj-$(CONFIG_GPIO_ADP5588) +=3D gpio-adp5588.o +obj-$(CONFIG_GPIO_AGGREGATOR) +=3D gpio-aggregator.o obj-$(CONFIG_GPIO_ALTERA_A10SR) +=3D gpio-altera-a10sr.o obj-$(CONFIG_GPIO_ALTERA) +=3D gpio-altera.o obj-$(CONFIG_GPIO_AMD8111) +=3D gpio-amd8111.o diff --git a/drivers/gpio/gpio-aggregator.c b/drivers/gpio/gpio-aggregator.c new file mode 100644 index 0000000000000000..873578c6f9683db8 --- /dev/null +++ b/drivers/gpio/gpio-aggregator.c @@ -0,0 +1,587 @@ +// SPDX-License-Identifier: GPL-2.0-only +// +// GPIO Aggregator and Repeater +// +// Copyright (C) 2019 Glider bvba + +#define DRV_NAME "gpio-aggregator" +#define pr_fmt(fmt) DRV_NAME ": " fmt + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "gpiolib.h" + + + /* + * GPIO Aggregator sysfs interface + */ + +struct gpio_aggregator { + struct gpiod_lookup_table *lookups; + struct platform_device *pdev; + char args[]; +}; + +static DEFINE_MUTEX(gpio_aggregator_lock); /* protects idr */ +static DEFINE_IDR(gpio_aggregator_idr); + +static char *get_arg(char **args) +{ + char *start =3D *args, *end; + + while (isspace(*start)) + start++; + + if (!*start) + return NULL; + + if (*start =3D=3D '"') { + /* Quoted arg */ + end =3D strchr(++start, '"'); + if (!end) + return ERR_PTR(-EINVAL); + } else { + /* Unquoted arg */ + for (end =3D start; *end && !isspace(*end); end++) ; + } + + if (*end) + *end++ =3D '\0'; + + *args =3D end; + return start; +} + +static bool isrange(const char *s) +{ + size_t n =3D strlen(s); + + if (IS_ERR_OR_NULL(s)) + return false; + + while (1) { + n =3D strspn(s, "0123456789"); + if (!n) + return false; + + s +=3D n; + + switch (*s++) { + case '\0': + return true; + + case '-': + case ',': + break; + + default: + return false; + } + } +} + +static int aggr_add_gpio(struct gpio_aggregator *aggr, const char *label, + int hwnum, unsigned int *n) +{ + struct gpiod_lookup_table *lookups; + + lookups =3D krealloc(aggr->lookups, struct_size(lookups, table, *n + 2), + GFP_KERNEL); + if (!lookups) + return -ENOMEM; + + lookups->table[*n].chip_label =3D label; + lookups->table[*n].chip_hwnum =3D hwnum; + lookups->table[*n].idx =3D *n; + + (*n)++; + memset(&lookups->table[*n], 0, sizeof(lookups->table[*n])); + + aggr->lookups =3D lookups; + return 0; +} + +static int aggr_parse(struct gpio_aggregator *aggr) +{ + char *name, *offsets, *first, *last, *next; + unsigned int a, b, i, n =3D 0; + char *args =3D aggr->args; + int error; + + for (name =3D get_arg(&args), offsets =3D get_arg(&args); name; + offsets =3D get_arg(&args)) { + if (IS_ERR(name)) { + pr_err("Cannot get GPIO specifier: %ld\n", + PTR_ERR(name)); + return PTR_ERR(name); + } + + if (!isrange(offsets)) { + /* Named GPIO line */ + error =3D aggr_add_gpio(aggr, name, -1, &n); + if (error) + return error; + + name =3D offsets; + continue; + } + + /* GPIO chip + offset(s) */ + for (first =3D offsets; *first; first =3D next) { + next =3D strchrnul(first, ','); + if (*next) + *next++ =3D '\0'; + + last =3D strchr(first, '-'); + if (last) + *last++ =3D '\0'; + + if (kstrtouint(first, 10, &a)) { + pr_err("Cannot parse GPIO index %s\n", first); + return -EINVAL; + } + + if (!last) { + b =3D a; + } else if (kstrtouint(last, 10, &b)) { + pr_err("Cannot parse GPIO index %s\n", last); + return -EINVAL; + } + + for (i =3D a; i <=3D b; i++) { + error =3D aggr_add_gpio(aggr, name, i, &n); + if (error) + return error; + } + } + + name =3D get_arg(&args); + } + + if (!n) { + pr_err("No GPIOs specified\n"); + return -EINVAL; + } + + return 0; +} + +static ssize_t new_device_store(struct device_driver *driver, const char *= buf, + size_t count) +{ + struct gpio_aggregator *aggr; + struct platform_device *pdev; + int res, id; + + /* kernfs guarantees string termination, so count + 1 is safe */ + aggr =3D kzalloc(sizeof(*aggr) + count + 1, GFP_KERNEL); + if (!aggr) + return -ENOMEM; + + memcpy(aggr->args, buf, count + 1); + + aggr->lookups =3D kzalloc(struct_size(aggr->lookups, table, 1), + GFP_KERNEL); + if (!aggr->lookups) { + res =3D -ENOMEM; + goto free_ga; + } + + mutex_lock(&gpio_aggregator_lock); + id =3D idr_alloc(&gpio_aggregator_idr, aggr, 0, 0, GFP_KERNEL); + mutex_unlock(&gpio_aggregator_lock); + + if (id < 0) { + res =3D id; + goto free_table; + } + + aggr->lookups->dev_id =3D kasprintf(GFP_KERNEL, "%s.%d", DRV_NAME, id); + if (!aggr->lookups) { + res =3D -ENOMEM; + goto remove_idr; + } + + res =3D aggr_parse(aggr); + if (res) + goto free_dev_id; + + gpiod_add_lookup_table(aggr->lookups); + + pdev =3D platform_device_register_simple(DRV_NAME, id, NULL, 0); + if (IS_ERR(pdev)) { + res =3D PTR_ERR(pdev); + goto remove_table; + } + + aggr->pdev =3D pdev; + return count; + +remove_table: + gpiod_remove_lookup_table(aggr->lookups); +free_dev_id: + kfree(aggr->lookups->dev_id); +remove_idr: + mutex_lock(&gpio_aggregator_lock); + idr_remove(&gpio_aggregator_idr, id); + mutex_unlock(&gpio_aggregator_lock); +free_table: + kfree(aggr->lookups); +free_ga: + kfree(aggr); + return res; +} + +static DRIVER_ATTR_WO(new_device); + +static void gpio_aggregator_free(struct gpio_aggregator *aggr) +{ + platform_device_unregister(aggr->pdev); + gpiod_remove_lookup_table(aggr->lookups); + kfree(aggr->lookups->dev_id); + kfree(aggr->lookups); + kfree(aggr); +} + +static ssize_t delete_device_store(struct device_driver *driver, + const char *buf, size_t count) +{ + struct gpio_aggregator *aggr; + unsigned int id; + int error; + + if (!str_has_prefix(buf, DRV_NAME ".")) + return -EINVAL; + + error =3D kstrtouint(buf + strlen(DRV_NAME "."), 10, &id); + if (error) + return error; + + mutex_lock(&gpio_aggregator_lock); + aggr =3D idr_remove(&gpio_aggregator_idr, id); + mutex_unlock(&gpio_aggregator_lock); + if (!aggr) + return -ENOENT; + + gpio_aggregator_free(aggr); + return count; +} +static DRIVER_ATTR_WO(delete_device); + +static struct attribute *gpio_aggregator_attrs[] =3D { + &driver_attr_new_device.attr, + &driver_attr_delete_device.attr, + NULL, +}; +ATTRIBUTE_GROUPS(gpio_aggregator); + +static int __exit gpio_aggregator_idr_remove(int id, void *p, void *data) +{ + gpio_aggregator_free(p); + return 0; +} + +static void __exit gpio_aggregator_remove_all(void) +{ + mutex_lock(&gpio_aggregator_lock); + idr_for_each(&gpio_aggregator_idr, gpio_aggregator_idr_remove, NULL); + idr_destroy(&gpio_aggregator_idr); + mutex_unlock(&gpio_aggregator_lock); +} + + + /* + * Common GPIO Forwarder + */ + +struct gpiochip_fwd { + struct gpio_chip chip; + struct gpio_desc **descs; + union { + struct mutex mlock; /* protects tmp[] if can_sleep */ + spinlock_t slock; /* protects tmp[] if !can_sleep */ + }; + unsigned long tmp[]; /* values and descs for multiple ops */ +}; + +static int gpio_fwd_get_direction(struct gpio_chip *chip, unsigned int off= set) +{ + struct gpiochip_fwd *fwd =3D gpiochip_get_data(chip); + + return gpiod_get_direction(fwd->descs[offset]); +} + +static int gpio_fwd_direction_input(struct gpio_chip *chip, unsigned int o= ffset) +{ + struct gpiochip_fwd *fwd =3D gpiochip_get_data(chip); + + return gpiod_direction_input(fwd->descs[offset]); +} + +static int gpio_fwd_direction_output(struct gpio_chip *chip, + unsigned int offset, int value) +{ + struct gpiochip_fwd *fwd =3D gpiochip_get_data(chip); + + return gpiod_direction_output(fwd->descs[offset], value); +} + +static int gpio_fwd_get(struct gpio_chip *chip, unsigned int offset) +{ + struct gpiochip_fwd *fwd =3D gpiochip_get_data(chip); + + return gpiod_get_value(fwd->descs[offset]); +} + +static int gpio_fwd_get_multiple(struct gpio_chip *chip, unsigned long *ma= sk, + unsigned long *bits) +{ + struct gpiochip_fwd *fwd =3D gpiochip_get_data(chip); + unsigned long *values, flags; + struct gpio_desc **descs; + unsigned int i, j =3D 0; + int error; + + if (chip->can_sleep) + mutex_lock(&fwd->mlock); + else + spin_lock_irqsave(&fwd->slock, flags); + + values =3D &fwd->tmp[0]; + bitmap_clear(values, 0, fwd->chip.ngpio); + descs =3D (void *)&fwd->tmp[BITS_TO_LONGS(fwd->chip.ngpio)]; + + for_each_set_bit(i, mask, fwd->chip.ngpio) + descs[j++] =3D fwd->descs[i]; + + error =3D gpiod_get_array_value(j, descs, NULL, values); + if (!error) { + j =3D 0; + for_each_set_bit(i, mask, fwd->chip.ngpio) + __assign_bit(i, bits, test_bit(j++, values)); + } + + if (chip->can_sleep) + mutex_unlock(&fwd->mlock); + else + spin_unlock_irqrestore(&fwd->slock, flags); + + return error; +} + +static void gpio_fwd_set(struct gpio_chip *chip, unsigned int offset, int = value) +{ + struct gpiochip_fwd *fwd =3D gpiochip_get_data(chip); + + gpiod_set_value(fwd->descs[offset], value); +} + +static void gpio_fwd_set_multiple(struct gpio_chip *chip, unsigned long *m= ask, + unsigned long *bits) +{ + struct gpiochip_fwd *fwd =3D gpiochip_get_data(chip); + unsigned long *values, flags; + struct gpio_desc **descs; + unsigned int i, j =3D 0; + + if (chip->can_sleep) + mutex_lock(&fwd->mlock); + else + spin_lock_irqsave(&fwd->slock, flags); + + values =3D &fwd->tmp[0]; + descs =3D (void *)&fwd->tmp[BITS_TO_LONGS(fwd->chip.ngpio)]; + + for_each_set_bit(i, mask, fwd->chip.ngpio) { + __assign_bit(j, values, test_bit(i, bits)); + descs[j++] =3D fwd->descs[i]; + } + + gpiod_set_array_value(j, descs, NULL, values); + + if (chip->can_sleep) + mutex_unlock(&fwd->mlock); + else + spin_unlock_irqrestore(&fwd->slock, flags); +} + +static int gpio_fwd_set_config(struct gpio_chip *chip, unsigned int offset, + unsigned long config) +{ + struct gpiochip_fwd *fwd =3D gpiochip_get_data(chip); + + chip =3D fwd->descs[offset]->gdev->chip; + if (chip->set_config) + return chip->set_config(chip, offset, config); + + return -ENOTSUPP; +} + +static int gpio_fwd_init_valid_mask(struct gpio_chip *chip, + unsigned long *valid_mask, + unsigned int ngpios) +{ + struct gpiochip_fwd *fwd =3D gpiochip_get_data(chip); + unsigned int i; + + for (i =3D 0; i < ngpios; i++) { + if (!gpiochip_line_is_valid(fwd->descs[i]->gdev->chip, + gpio_chip_hwgpio(fwd->descs[i]))) + clear_bit(i, valid_mask); + } + + return 0; +} + +/** + * gpiochip_fwd_create() - Create a new GPIO forwarder + * @dev: Parent device pointer + * @ngpios: Number of GPIOs in the forwarder. + * @descs: Array containing the GPIO descriptors to forward to. + * This array must contain @ngpios entries, and must not be deallo= cated + * before the forwarder has been destroyed again. + * + * This function creates a new gpiochip, which forwards all GPIO operation= s to + * the passed GPIO descriptors. + * + * Return: An opaque object pointer, or an ERR_PTR()-encoded negative error + * code on failure. + */ +static struct gpiochip_fwd *gpiochip_fwd_create(struct device *dev, + unsigned int ngpios, + struct gpio_desc *descs[]) +{ + const char *label =3D dev_name(dev); + struct gpiochip_fwd *fwd; + struct gpio_chip *chip; + unsigned int i; + int error; + + fwd =3D devm_kzalloc(dev, struct_size(fwd, tmp, + BITS_TO_LONGS(ngpios) + ngpios), GFP_KERNEL); + if (!fwd) + return ERR_PTR(-ENOMEM); + + chip =3D &fwd->chip; + + for (i =3D 0; i < ngpios; i++) { + dev_dbg(dev, "gpio %u =3D> gpio-%d (%s)\n", i, + desc_to_gpio(descs[i]), descs[i]->label ? : "?"); + + if (gpiod_cansleep(descs[i])) + chip->can_sleep =3D true; + if (descs[i]->gdev->chip->set_config) + chip->set_config =3D gpio_fwd_set_config; + if (descs[i]->gdev->chip->init_valid_mask) + chip->init_valid_mask =3D gpio_fwd_init_valid_mask; + } + + chip->label =3D label; + chip->parent =3D dev; + chip->owner =3D THIS_MODULE; + chip->get_direction =3D gpio_fwd_get_direction; + chip->direction_input =3D gpio_fwd_direction_input; + chip->direction_output =3D gpio_fwd_direction_output; + chip->get =3D gpio_fwd_get; + chip->get_multiple =3D gpio_fwd_get_multiple; + chip->set =3D gpio_fwd_set; + chip->set_multiple =3D gpio_fwd_set_multiple; + chip->base =3D -1; + chip->ngpio =3D ngpios; + fwd->descs =3D descs; + + if (chip->can_sleep) + mutex_init(&fwd->mlock); + else + spin_lock_init(&fwd->slock); + + error =3D devm_gpiochip_add_data(dev, chip, fwd); + if (error) + return ERR_PTR(error); + + return fwd; +} + + + /* + * Common GPIO Aggregator/Repeater platform device + */ + +static int gpio_aggregator_probe(struct platform_device *pdev) +{ + struct device *dev =3D &pdev->dev; + struct gpio_desc **descs; + struct gpiochip_fwd *fwd; + int i, n; + + n =3D gpiod_count(dev, NULL); + if (n < 0) + return n; + + descs =3D devm_kmalloc_array(dev, n, sizeof(*descs), GFP_KERNEL); + if (!descs) + return -ENOMEM; + + for (i =3D 0; i < n; i++) { + descs[i] =3D devm_gpiod_get_index(dev, NULL, i, GPIOD_ASIS); + if (IS_ERR(descs[i])) + return PTR_ERR(descs[i]); + } + + fwd =3D gpiochip_fwd_create(dev, n, descs); + if (IS_ERR(fwd)) + return PTR_ERR(fwd); + + platform_set_drvdata(pdev, fwd); + return 0; +} + +#ifdef CONFIG_OF +static const struct of_device_id gpio_aggregator_dt_ids[] =3D { + { .compatible =3D "gpio-repeater" }, + /* + * Add GPIO-operated devices controlled from userspace below, + * or use "driver_override" in sysfs + */ + {}, +}; +MODULE_DEVICE_TABLE(of, gpio_aggregator_dt_ids); +#endif + +static struct platform_driver gpio_aggregator_driver =3D { + .probe =3D gpio_aggregator_probe, + .driver =3D { + .name =3D DRV_NAME, + .groups =3D gpio_aggregator_groups, + .of_match_table =3D of_match_ptr(gpio_aggregator_dt_ids), + }, +}; + +static int __init gpio_aggregator_init(void) +{ + return platform_driver_register(&gpio_aggregator_driver); +} +module_init(gpio_aggregator_init); + +static void __exit gpio_aggregator_exit(void) +{ + gpio_aggregator_remove_all(); + platform_driver_unregister(&gpio_aggregator_driver); +} +module_exit(gpio_aggregator_exit); + +MODULE_AUTHOR("Geert Uytterhoeven "); +MODULE_DESCRIPTION("GPIO Aggregator/Repeater"); +MODULE_LICENSE("GPL v2"); --=20 2.17.1 From nobody Mon May 6 01:50:45 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1574844716; cv=none; d=zohomail.com; s=zohoarc; b=ALcvdeM+PBHDg8nHHCdj8GpU4vhh7GVF3WYXdaREytC3BSEr8qJoBqOphatexONJaLRVxSEtZxL++dZ5LA7bwPd2ristXgrAZ+02xBBdZTH+OMEzjimpuei4ZfbYN1rsuPGh7BNVt89KR9hidC5UDL1jhVbLVVgXocNCQGxFIjc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1574844716; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=JEzrqgiYmftzla7SpTVpLzWa2mA//ELYhlviCWQ18OI=; b=hT4Gir+YOPd4uNeaw6s7gPmVJxOnJ3fmmAnYEpBtOBX/wkHCkCMivFrCv0PMgc7DsG2rHhT+NvT3uSnj1M6Exy8Yijk2Uocf1Rc3k4GRr9KuWNLArmUQwzC6wwtB+X+yjtB0RRpFlmFfMeFcTkod2L87ZOeot/GvcOQBLTDYeWo= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1574844716868532.7463275636455; Wed, 27 Nov 2019 00:51:56 -0800 (PST) Received: from localhost ([::1]:35848 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iZt3D-0003qa-87 for importer@patchew.org; Wed, 27 Nov 2019 03:51:55 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:42161) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iZsx3-0005hw-TH for qemu-devel@nongnu.org; Wed, 27 Nov 2019 03:45:40 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iZsum-0002nw-Ig for qemu-devel@nongnu.org; Wed, 27 Nov 2019 03:43:13 -0500 Received: from andre.telenet-ops.be ([2a02:1800:120:4::f00:15]:45652) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iZsum-0002lU-AT for qemu-devel@nongnu.org; Wed, 27 Nov 2019 03:43:12 -0500 Received: from ramsan ([84.195.182.253]) by andre.telenet-ops.be with bizsmtp id Wwiu2100e5USYZQ01wiuXV; Wed, 27 Nov 2019 09:43:07 +0100 Received: from rox.of.borg ([192.168.97.57]) by ramsan with esmtp (Exim 4.90_1) (envelope-from ) id 1iZsuU-0000xt-QR; Wed, 27 Nov 2019 09:42:54 +0100 Received: from geert by rox.of.borg with local (Exim 4.90_1) (envelope-from ) id 1iZsuU-0004P0-Ny; Wed, 27 Nov 2019 09:42:54 +0100 From: Geert Uytterhoeven To: Linus Walleij , Bartosz Golaszewski , Jonathan Corbet , Rob Herring , Mark Rutland , Harish Jenny K N , Eugeniu Rosca Subject: [PATCH v3 6/7] docs: gpio: Add GPIO Aggregator/Repeater documentation Date: Wed, 27 Nov 2019 09:42:52 +0100 Message-Id: <20191127084253.16356-7-geert+renesas@glider.be> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191127084253.16356-1-geert+renesas@glider.be> References: <20191127084253.16356-1-geert+renesas@glider.be> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 2a02:1800:120:4::f00:15 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , qemu-devel@nongnu.org, Geert Uytterhoeven , linux-doc@vger.kernel.org, Marc Zyngier , Magnus Damm , Christoffer Dall , linux-kernel@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-gpio@vger.kernel.org, devicetree@vger.kernel.org, Alexander Graf , Paolo Bonzini , Phil Reid Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Document the GPIO Aggregator/Repeater, and the three typical use-cases. Signed-off-by: Geert Uytterhoeven Reviewed-by: Eugeniu Rosca Reviewed-by: Ulrich Hecht Tested-by: Eugeniu Rosca --- v3: - New. --- .../admin-guide/gpio/gpio-aggregator.rst | 111 ++++++++++++++++++ Documentation/admin-guide/gpio/index.rst | 1 + 2 files changed, 112 insertions(+) create mode 100644 Documentation/admin-guide/gpio/gpio-aggregator.rst diff --git a/Documentation/admin-guide/gpio/gpio-aggregator.rst b/Documenta= tion/admin-guide/gpio/gpio-aggregator.rst new file mode 100644 index 0000000000000000..826146e260253299 --- /dev/null +++ b/Documentation/admin-guide/gpio/gpio-aggregator.rst @@ -0,0 +1,111 @@ +.. SPDX-License-Identifier: GPL-2.0-only + +GPIO Aggregator/Repeater +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D + +The GPIO Aggregator/Repeater allows to aggregate GPIOs, and expose them as= a +new gpio_chip. This supports the following use cases. + + +Aggregating GPIOs using Sysfs +----------------------------- + +GPIO controllers are exported to userspace using /dev/gpiochip* character +devices. Access control to these devices is provided by standard UNIX file +system permissions, on an all-or-nothing basis: either a GPIO controller is +accessible for a user, or it is not. + +The GPIO Aggregator allows access control for individual GPIOs, by aggrega= ting +them into a new gpio_chip, which can be assigned to a group or user using +standard UNIX file ownership and permissions. Furthermore, this simplifie= s and +hardens exporting GPIOs to a virtual machine, as the VM can just grab the = full +GPIO controller, and no longer needs to care about which GPIOs to grab and +which not, reducing the attack surface. + +Aggregated GPIO controllers are instantiated and destroyed by writing to +write-only attribute files in sysfs. + + /sys/bus/platform/drivers/gpio-aggregator/ + + "new_device" ... + Userspace may ask the kernel to instantiate an aggregated GPIO + controller by writing a string describing the GPIOs to + aggregate to the "new_device" file, using the format + + .. code-block:: none + + [] [ ] ... + + Where: + + "" ... + is a GPIO line name, + + "" ... + is a GPIO chip label or name, and + + "" ... + is a comma-separated list of GPIO offsets and/or + GPIO offset ranges denoted by dashes. + + Example: Instantiate a new GPIO aggregator by aggregating GPIO + 19 of "e6052000.gpio" and GPIOs 20-21 of "gpiochip2" into a new + gpio_chip: + + .. code-block:: bash + + echo 'e6052000.gpio 19 gpiochip2 20-21' > new_device + + "delete_device" ... + Userspace may ask the kernel to destroy an aggregated GPIO + controller after use by writing its device name to the + "delete_device" file. + + Example: Destroy the previously-created aggregated GPIO + controller "gpio-aggregator.0": + + .. code-block:: bash + + echo gpio-aggregator.0 > delete_device + + +GPIO Repeater in Device Tree +---------------------------- + +A GPIO Repeater is a node in a Device Tree representing a repeater for one= or +more GPIOs, possibly including physical signal property translation (e.g. +polarity inversion). This allows to model e.g. inverters in DT. + +See Documentation/devicetree/bindings/gpio/gpio-repeater.yaml + + +Generic GPIO Driver +------------------- + +The GPIO Aggregator can also be used as a generic driver for a simple +GPIO-operated device described in DT, without a dedicated in-kernel driver. +This is not unlike e.g. spidev, which allows to communicated with an SPI d= evice +from userspace. + +Binding a device to the GPIO Aggregator is performed either by modifying t= he +gpio-aggregator driver, or by writing to the "driver_override" file in Sys= fs. + +Example: If "frobnicator" is a GPIO-operated device described in DT, using= its +own compatible value:: + + frobnicator { + compatible =3D "myvendor,frobnicator"; + + gpios =3D <&gpio2 19 GPIO_ACTIVE_HIGH>, + <&gpio2 20 GPIO_ACTIVE_LOW>; + }; + +it can be bound to the GPIO Aggregator by either: + +1. Adding its compatible value to ``gpio_aggregator_dt_ids[]``, +2. Binding manually using "driver_override": + +.. code-block:: bash + + echo gpio-aggregator > /sys/bus/platform/devices/frobnicator/driver_ov= erride + echo frobnicator > /sys/bus/platform/drivers/gpio-aggregator/bind diff --git a/Documentation/admin-guide/gpio/index.rst b/Documentation/admin= -guide/gpio/index.rst index a244ba4e87d5398a..ef2838638e967777 100644 --- a/Documentation/admin-guide/gpio/index.rst +++ b/Documentation/admin-guide/gpio/index.rst @@ -7,6 +7,7 @@ gpio .. toctree:: :maxdepth: 1 =20 + gpio-aggregator sysfs =20 .. only:: subproject and html --=20 2.17.1 From nobody Mon May 6 01:50:45 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1574844446; cv=none; d=zohomail.com; s=zohoarc; b=DyR3iKmLpMqnoa1lg5wl1LNKlNelaTrxJYhOeTqZmFZB2e/gjyeT1Q8bH5HNgljp3JS/Jva4trM452nZ8AVkO2y+f0r1HeHwn3WAybN/I5PhJXQ/Az3hsol0AEuMfq8Bgw6y6RODRc6qICeshFpe0UKI563UgQKkdwe//IriO0Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1574844446; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=S+qm6TeeFOPTa79Q+sQuyuyz4S9TOqyEokXoyCnAJ4M=; b=NYV9QFWctvUVZmf2gN+zzbAaB10WRQoYtYjYOpNEy4BnPLoppmj8mo5Hc4+wK26UOMZLjlrokVqtMXLNyUF7cI8tvVmTZN/+reElQVVaVMZ7ELo4Fzs4RhZb0k9PSlsopnIrvyYdMEZdfKSRfJmbCbHNeNKy8gwHUQ6Et+o/3Fc= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1574844446206718.3409723282068; Wed, 27 Nov 2019 00:47:26 -0800 (PST) Received: from localhost ([::1]:35812 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iZsyq-0007Q1-4h for importer@patchew.org; Wed, 27 Nov 2019 03:47:24 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:41823) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iZsx3-0005gk-My for qemu-devel@nongnu.org; Wed, 27 Nov 2019 03:45:38 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iZsun-0002od-E4 for qemu-devel@nongnu.org; Wed, 27 Nov 2019 03:43:14 -0500 Received: from baptiste.telenet-ops.be ([2a02:1800:120:4::f00:13]:60916) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iZsun-0002mJ-7t for qemu-devel@nongnu.org; Wed, 27 Nov 2019 03:43:13 -0500 Received: from ramsan ([84.195.182.253]) by baptiste.telenet-ops.be with bizsmtp id Wwiu2100b5USYZQ01wiua4; Wed, 27 Nov 2019 09:43:09 +0100 Received: from rox.of.borg ([192.168.97.57]) by ramsan with esmtp (Exim 4.90_1) (envelope-from ) id 1iZsuU-0000xw-RV; Wed, 27 Nov 2019 09:42:54 +0100 Received: from geert by rox.of.borg with local (Exim 4.90_1) (envelope-from ) id 1iZsuU-0004PA-P7; Wed, 27 Nov 2019 09:42:54 +0100 From: Geert Uytterhoeven To: Linus Walleij , Bartosz Golaszewski , Jonathan Corbet , Rob Herring , Mark Rutland , Harish Jenny K N , Eugeniu Rosca Subject: [PATCH v3 7/7] MAINTAINERS: Add GPIO Aggregator/Repeater section Date: Wed, 27 Nov 2019 09:42:53 +0100 Message-Id: <20191127084253.16356-8-geert+renesas@glider.be> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191127084253.16356-1-geert+renesas@glider.be> References: <20191127084253.16356-1-geert+renesas@glider.be> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 2a02:1800:120:4::f00:13 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , qemu-devel@nongnu.org, Geert Uytterhoeven , linux-doc@vger.kernel.org, Marc Zyngier , Magnus Damm , Christoffer Dall , linux-kernel@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-gpio@vger.kernel.org, devicetree@vger.kernel.org, Alexander Graf , Paolo Bonzini , Phil Reid Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Add a maintainership section for the GPIO Aggregator/Repeater, covering documentation, Device Tree bindings, and driver source code. Signed-off-by: Geert Uytterhoeven Reviewed-by: Eugeniu Rosca Tested-by: Eugeniu Rosca --- Harish: Do you want to be listed as maintainer, too? v3: - New. --- MAINTAINERS | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index e5949b6827b72f2b..0f12ebdaa8faa76b 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -7043,6 +7043,14 @@ S: Maintained F: Documentation/firmware-guide/acpi/gpio-properties.rst F: drivers/gpio/gpiolib-acpi.c =20 +GPIO AGGREGATOR/REPEATER +M: Geert Uytterhoeven +L: linux-gpio@vger.kernel.org +S: Maintained +F: Documentation/admin-guide/gpio/gpio-aggregator.rst +F: Documentation/devicetree/bindings/gpio/gpio-repeater.yaml +F: drivers/gpio/gpio-aggregator.c + GPIO IR Transmitter M: Sean Young L: linux-media@vger.kernel.org --=20 2.17.1