Message ID | 20221031-gpiolib-swnode-v2-0-81f55af5fa0e@gmail.com |
---|---|
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp55133wru; Tue, 8 Nov 2022 16:28:13 -0800 (PST) X-Google-Smtp-Source: AMsMyM79fmnW7dXjRA1VHnhGAXwXJLtAeCMUUpM7/Lg1YPYEllPJO6wGhCYD/NsxMhVofQz4y8yn X-Received: by 2002:a05:6402:2802:b0:43a:9098:55a0 with SMTP id h2-20020a056402280200b0043a909855a0mr56999536ede.179.1667953693613; Tue, 08 Nov 2022 16:28:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667953693; cv=none; d=google.com; s=arc-20160816; b=Lt8aGfxhqZtZKz+UuvEzq5neBni6yMxbEEn3s+1osj1mR4qZnlyrv9o3vhne8MNTIr 5bfYRA704zQOiZS5P9cioD85xpVz5STnCqjd1Hq5n51tk1DPBhku7nBVyP1PCifPrSRf 5tdNQ+aWKJG1wRoTKzXg2HhL0aWoWcGprfbnyMPf2KWGggF3PBruo/ZehIYAKAegHdpN TZrhRPmyvtmhZq08ia+geFFbtauywwge/yb5V74xbISJq9yxmNmU3ZS5nb8lv1ZQKfML V+yEkTzsOt8gDMA+Pbu3xbu8vbvrAQZtbrbdHcJwk6ETkSZZzp38tzOjyG/7hHnWiUuO 5sDA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=rd9e65C2L1MaGoFoYCg3309gq69yAsyo4bc99h0REBg=; b=tYrxO5I7Hm3mf+Bes/Lq1nZHhLb62Yst1/PPwJg0gMqu+2q3+lmcyK0pCjZNzgp9sO V2mc9zfzC93jbM9+mvqCLrj0Dkv+smDDUkQ7flkbeSU5hK2TB0wGLsG7GlKcmEXJJQmF tcpJ/MLrtNo68R/i+QDnYUmY2Pi0fKghpXrYLsWJ2FdDw5Jc37oXGd1v7p/xcVXJQ0L8 Wyi3+jiieO/gUAlZPsGor8SoQDYInYVhCXqc/i9H7E4OyBnKoGclgMx2GobXAQ7CCoZt OMvM2FH999bHyUTToPsKXFspbVpZ2GRObSVduV7XslHDhWZiFGfZUTm2wqO0ruDqvZJR rsMQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=WQBHB3EE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h25-20020a170906399900b0078dcdbb3e87si11225981eje.530.2022.11.08.16.27.49; Tue, 08 Nov 2022 16:28:13 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=WQBHB3EE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229556AbiKIA07 (ORCPT <rfc822;dexuan.linux@gmail.com> + 99 others); Tue, 8 Nov 2022 19:26:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59980 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229464AbiKIA05 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 8 Nov 2022 19:26:57 -0500 Received: from mail-pg1-x533.google.com (mail-pg1-x533.google.com [IPv6:2607:f8b0:4864:20::533]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 396B122B09; Tue, 8 Nov 2022 16:26:56 -0800 (PST) Received: by mail-pg1-x533.google.com with SMTP id h193so14781016pgc.10; Tue, 08 Nov 2022 16:26:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=rd9e65C2L1MaGoFoYCg3309gq69yAsyo4bc99h0REBg=; b=WQBHB3EEgLGD0Peb3Dhu47EhbgvWkkxuf1lWtGGP8WDJf1zJ+j7532pEa8XkD3Br0a tFURJP63+WH0aCBjMN2xh0aladptn8+OXNq2wozfp4tJnVvDCTYeKNCIZKjHumK6R+xG 3ogLAn2pZzFxj60wVZBR3LbSs7xT0sb2sC+Y3+Scf/soJCBgPfgr8lTM/CLb2ygFhWdi mx7sYiKtVmO57xiA5zPghz+dqHEqdk6J5TB9enRv0XjEI4ylO9Bw6IMylrZHal3noXTi sJm2WbZavHoH1XCuSr7juxktPPoDRKO/WUnauXua9sNAzDO+BstlgVWpSavU03zR/KlY ndsw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=rd9e65C2L1MaGoFoYCg3309gq69yAsyo4bc99h0REBg=; b=4gE3GA4bmQwZFF72AWtiOW26rdF8YLHKm86OYiLNPcbSYkZ/xsLYJMoUsSqF6NXhjw 4eF/gxwXURiyX7cnVzSm09s6Dy3sHGSXlnhCfFlV7xCfksqWO8LKFyaaivZivVJ6+bQZ QnG3319blQRvj4bF1sMDJpbJasPA7hROU0A5Id3B91sOslfP3kq7eHGwP8d9kSmd+PbC JNILUKaiOeFUay+mV6uZh6kkHNT7z3MpkAsyRWGJGHDmsR6UaOBuc8zvOjOx6p0QtGqB VK5YJVThSUQ1nZFMkI5KpGA+hQ3ft6WolvzMVJWuH1Q4yafpTPeaFWioxLvYzGldgbOV 8ylA== X-Gm-Message-State: ACrzQf1zKGga6HzXt82ry67DjM0JqBPgXlQMjsOAdpbU6AQyrhbk8KTw Bf8FKiPXBmM8WOwjMaFFDPI= X-Received: by 2002:a05:6a00:1504:b0:56d:1ee8:973e with SMTP id q4-20020a056a00150400b0056d1ee8973emr36325685pfu.30.1667953615481; Tue, 08 Nov 2022 16:26:55 -0800 (PST) Received: from dtor-ws.mtv.corp.google.com ([2620:15c:9d:2:9f46:7242:26:f220]) by smtp.gmail.com with ESMTPSA id i65-20020a626d44000000b0056bd737fdf3sm6907324pfc.123.2022.11.08.16.26.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Nov 2022 16:26:54 -0800 (PST) From: Dmitry Torokhov <dmitry.torokhov@gmail.com> To: Linus Walleij <linus.walleij@linaro.org>, Andy Shevchenko <andriy.shevchenko@linux.intel.com>, Bartosz Golaszewski <brgl@bgdev.pl> Cc: linux-acpi@vger.kernel.org, linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 0/6] Add support for software nodes to gpiolib Date: Tue, 8 Nov 2022 16:26:45 -0800 Message-Id: <20221031-gpiolib-swnode-v2-0-81f55af5fa0e@gmail.com> X-Mailer: git-send-email 2.38.1.431.g37b22c650d-goog MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" X-Mailer: b4 0.11.0-dev-28747 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748976212226856252?= X-GMAIL-MSGID: =?utf-8?q?1748976212226856252?= |
Series |
Add support for software nodes to gpiolib
|
|
Message
Dmitry Torokhov
Nov. 9, 2022, 12:26 a.m. UTC
This series attempts to add support for software nodes to gpiolib, using software node references. This allows us to convert more drivers to the generic device properties and drop support for custom platform data. To describe a GPIO via software nodes we can create the following data items: /* Node representing the GPIO controller/GPIO bank */ static const struct software_node gpio_bank_b_node = { .name = "B", }; /* * Properties that will be assigned to a software node assigned to * the device that used platform data. */ static const struct property_entry simone_key_enter_props[] = { PROPERTY_ENTRY_U32("linux,code", KEY_ENTER), PROPERTY_ENTRY_STRING("label", "enter"), PROPERTY_ENTRY_REF("gpios", &gpio_bank_b_node, 123, GPIO_ACTIVE_LOW), { } }; The code in gpiolib handling software nodes uses the name in the software node representing GPIO controller to locate the actual instance of GPIO controller. To: Linus Walleij <linus.walleij@linaro.org> To: Bartosz Golaszewski <brgl@bgdev.pl> To: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Cc: linux-gpio@vger.kernel.org Cc: linux-kernel@vger.kernel.org Cc: linux-acpi@vger.kernel.org --- Changes in v2: - reworked the series to be independent of other in-flight patches. That meant keeping devm_gpiod_get_from_of_node() for now. - removed handling of secondary nodes, it deserves a separate patch series - fixed refcounting when handling swnodes (Andy) - added include/linux/gpio/property.h with PROPERTY_ENTRY_GPIO (Andy) - addressed most of the rest of Andy's comments - collected reviewed-by and acked-by - Link to v1: https://lore.kernel.org/r/20221031-gpiolib-swnode-v1-0-a0ab48d229c7@gmail.com --- Dmitry Torokhov (6): gpiolib: of: change of_find_gpio() to accept device node gpiolib: acpi: change acpi_find_gpio() to accept firmware node gpiolib: acpi: teach acpi_find_gpio() to handle data-only nodes gpiolib: acpi: avoid leaking ACPI details into upper gpiolib layers gpiolib: consolidate GPIO lookups gpiolib: add support for software nodes drivers/gpio/Makefile | 1 + drivers/gpio/gpiolib-acpi.c | 132 ++++++++++++++----------- drivers/gpio/gpiolib-acpi.h | 54 +---------- drivers/gpio/gpiolib-of.c | 7 +- drivers/gpio/gpiolib-of.h | 4 +- drivers/gpio/gpiolib-swnode.c | 128 ++++++++++++++++++++++++ drivers/gpio/gpiolib-swnode.h | 14 +++ drivers/gpio/gpiolib.c | 219 +++++++++++++++++------------------------- include/linux/gpio/property.h | 11 +++ 9 files changed, 329 insertions(+), 241 deletions(-) --- base-commit: b6fc3fddade7a194bd141a49f2689e50f796ef46 change-id: 20221031-gpiolib-swnode-948203f49b23 -- Dmitry
Comments
On Tue, Nov 08, 2022 at 04:26:45PM -0800, Dmitry Torokhov wrote: > This series attempts to add support for software nodes to gpiolib, using > software node references. This allows us to convert more drivers to the > generic device properties and drop support for custom platform data. > > To describe a GPIO via software nodes we can create the following data > items: > > /* Node representing the GPIO controller/GPIO bank */ > static const struct software_node gpio_bank_b_node = { > .name = "B", > }; > > /* > * Properties that will be assigned to a software node assigned to > * the device that used platform data. > */ > static const struct property_entry simone_key_enter_props[] = { > PROPERTY_ENTRY_U32("linux,code", KEY_ENTER), > PROPERTY_ENTRY_STRING("label", "enter"), > PROPERTY_ENTRY_REF("gpios", &gpio_bank_b_node, 123, GPIO_ACTIVE_LOW), > { } > }; > > The code in gpiolib handling software nodes uses the name in the > software node representing GPIO controller to locate the actual instance > of GPIO controller. Thank for an update! I have almost nothing serious except two nit-picks I think we can address: - dropping const qualifier for no (?) reason - having a superfluous check and extra dev_dbg() If you are are going to address them, feel free to add my Rb tag to the patches 5 & 6.
On Wed, Nov 09, 2022 at 01:29:41PM +0200, Andy Shevchenko wrote: > On Tue, Nov 08, 2022 at 04:26:45PM -0800, Dmitry Torokhov wrote: > > This series attempts to add support for software nodes to gpiolib, using > > software node references. This allows us to convert more drivers to the > > generic device properties and drop support for custom platform data. > > > > To describe a GPIO via software nodes we can create the following data > > items: > > > > /* Node representing the GPIO controller/GPIO bank */ > > static const struct software_node gpio_bank_b_node = { > > .name = "B", > > }; > > > > /* > > * Properties that will be assigned to a software node assigned to > > * the device that used platform data. > > */ > > static const struct property_entry simone_key_enter_props[] = { > > PROPERTY_ENTRY_U32("linux,code", KEY_ENTER), > > PROPERTY_ENTRY_STRING("label", "enter"), > > PROPERTY_ENTRY_REF("gpios", &gpio_bank_b_node, 123, GPIO_ACTIVE_LOW), > > { } > > }; > > > > The code in gpiolib handling software nodes uses the name in the > > software node representing GPIO controller to locate the actual instance > > of GPIO controller. > > Thank for an update! > > I have almost nothing serious except two nit-picks I think we can address: > - dropping const qualifier for no (?) reason > - having a superfluous check and extra dev_dbg() > > If you are are going to address them, feel free to add my Rb tag to > the patches 5 & 6. Thank you for the reviews. I addressed most of your comments, but because I still left the check you were concerned about in I'd like an explicit reviewed-by on the v3 if you OK giving it. Thank you.
On Wed, Nov 09, 2022 at 11:32:31AM -0800, Dmitry Torokhov wrote: > On Wed, Nov 09, 2022 at 01:29:41PM +0200, Andy Shevchenko wrote: > > On Tue, Nov 08, 2022 at 04:26:45PM -0800, Dmitry Torokhov wrote: ... > > Thank for an update! > > > > I have almost nothing serious except two nit-picks I think we can address: > > - dropping const qualifier for no (?) reason > > - having a superfluous check and extra dev_dbg() > > > > If you are are going to address them, feel free to add my Rb tag to > > the patches 5 & 6. > > Thank you for the reviews. I addressed most of your comments, but > because I still left the check you were concerned about in I'd like an > explicit reviewed-by on the v3 if you OK giving it. I gave for patch 6 and for patch 5 I still think we can get rid of the check.