Message ID | 20221031-gpiolib-swnode-v3-0-0282162b0fa4@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 l7csp523137wru; Wed, 9 Nov 2022 11:33:48 -0800 (PST) X-Google-Smtp-Source: AMsMyM60SvF2u3I1ltTvuWl/5GwfCPytWY5A5BPSaMwp3NFWDxTUXfOXpvAUTb7/4dVGuT3SKvw6 X-Received: by 2002:a17:906:25ca:b0:7a1:b555:6f1 with SMTP id n10-20020a17090625ca00b007a1b55506f1mr1701176ejb.29.1668022428648; Wed, 09 Nov 2022 11:33:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668022428; cv=none; d=google.com; s=arc-20160816; b=Pf5YpVn0k4lp6FWDoaKuddtV38JV5Fofk1Rwul2vs+jYIKlPEp7QIL7nqnPjeH1hK0 c+qWzPoki2UB2CY46zWstyNOSdKcQjFBSsFoRBs0SUOEbvQESiFlv/mZXMeyR4bllTIt /sqjoJHuWvYaQN11RoayZi100AFu3O8f7gKKnwq3xveGJZPgCi4cD7/mPjb7LX8upBOW OKhDqPJG4l9BEHKrQHGJygYQcU/StRoCUJPl1l6T/ZwyAodJTvxG42rLTiAGsylmgu0d hM7BFGEQ8ufH/UeeLN1TZzm9p7cLAwF9ju5hevlHAKmzH/s6STyDq0u3YMDz+mu4Ixb8 7vHw== 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=Lnle8lMV56XQau4jCvU7SPGxEKG97XKxs8od3dMkLCg=; b=PNQ3KcYBi8vgg6Zgr8vDvujN0mEv3r6kiLh8FHsCX9WvOmO03v8jLs7FrrIYAtlsxN +i0ImUlKbLKtyHOE8RnsMwkZFznDV9/ETMf+5mpeTLnY9TsdWzqmY2LcUI6dfFSJklhm XDr8LWJs9kdn3sOStXJvSbLdf9YYE75BNlHPdbowN/1U6QiR58RvoXxwXJPJdZiN9qge C23PF5+UI0fgpkkbBcZ4gODX2YdUBTTr/ssylnHwLyOXY/WAaiD/xXAqeKpO27AHbhfV FNoQIeZE9Wk2wJpvjytaJTpN6P4QcmN5FuJElKJsP1W7AU9qGKfB3FZY9Eoog2wXg1Im jSTg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=DQGYIMyN; 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 he44-20020a1709073dac00b007ae0e8f59a6si16464279ejc.821.2022.11.09.11.33.23; Wed, 09 Nov 2022 11:33:48 -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=DQGYIMyN; 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 S231201AbiKITaw (ORCPT <rfc822;dexuan.linux@gmail.com> + 99 others); Wed, 9 Nov 2022 14:30:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33946 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229551AbiKITau (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 9 Nov 2022 14:30:50 -0500 Received: from mail-pj1-x1030.google.com (mail-pj1-x1030.google.com [IPv6:2607:f8b0:4864:20::1030]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1775926558; Wed, 9 Nov 2022 11:30:49 -0800 (PST) Received: by mail-pj1-x1030.google.com with SMTP id l6so17676969pjj.0; Wed, 09 Nov 2022 11:30:49 -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=Lnle8lMV56XQau4jCvU7SPGxEKG97XKxs8od3dMkLCg=; b=DQGYIMyN6k+qRFSIQdQrSA7Fxg32QuZXoUzGz4iaueCclRKOjcztwpQsBBRReaah3r 6B2r7RbW5+cFnlfiZ2hhFVHtbk96NVP5cGMm54/wz8KEW+f3FGoDImOLMtOOL5Fc8b21 15eg5pmOteR++0WTIJmWhvzf3YX0l6LVWD6cEZKNO8/3U4dGkEFpyQs8nu0hurptIG2P HRnDi5fwAYl7o5lyb/kXcIv3XSkEZFqcJbCk0reQLXwYvYzwETAmqEE7JhAmwDs8NXwC /tj96wu9SpQy7wh5i9IoCQDf8HDeL7QOYJdVmLZaBb6DFmAxmS9CjAIU0w1EZWHWBJqJ bG+A== 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=Lnle8lMV56XQau4jCvU7SPGxEKG97XKxs8od3dMkLCg=; b=fEPZUAtPa9LFPVW102CS8Kl23BWz96orUUp1WcD2FopmG5I0ZM7fMb1aWBolC3utcW ZIMB3212q3k6BBN7J7CLMwV9bBOAJPzBnYCv94yHySncBpLNtBwSrQas0bk/dtRGgvfJ 1/LZ0xp7WUsHt/dAia0g64gNX8nDkzt37N/NUFRzidxRtl2zxzIAZN9dnn3Gkqpw1Kv0 ZcsjLjgqbFQRwYAAVGtnFbz0+KY6nn+PNK8vxCfc3IrZ/PjZjRnjgJDA0xynUo88MPMB Fc43ADdHPZj56qnrLhkWRHx2zZyDbDcB3PDHW+grdkp87gLAPJAfj78GsMOQlMfKQrCa ZglA== X-Gm-Message-State: ACrzQf3StDiVmpP9b4x9he4WvUYynJQLDs3CLc1Aje4/53GCym/azrIu Y5nb8huAI9weMHJIPiaL2Os= X-Received: by 2002:a17:902:9b88:b0:188:620d:90fc with SMTP id y8-20020a1709029b8800b00188620d90fcmr32387279plp.61.1668022248374; Wed, 09 Nov 2022 11:30:48 -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 l2-20020a170902f68200b00186ac4b21cfsm9567462plg.230.2022.11.09.11.30.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Nov 2022 11:30:47 -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-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, linux-gpio@vger.kernel.org Subject: [PATCH v3 0/6] Add support for software nodes to gpiolib Date: Wed, 9 Nov 2022 11:30:38 -0800 Message-Id: <20221031-gpiolib-swnode-v3-0-0282162b0fa4@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?1749048285697078345?= X-GMAIL-MSGID: =?utf-8?q?1749048285697078345?= |
Series |
Add support for software nodes to gpiolib
|
|
Message
Dmitry Torokhov
Nov. 9, 2022, 7:30 p.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 v3: - Addressed more Andy's comments - Link to v2: https://lore.kernel.org/r/20221031-gpiolib-swnode-v2-0-81f55af5fa0e@gmail.com 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 | 123 +++++++++++++++++++++++++ drivers/gpio/gpiolib-swnode.h | 14 +++ drivers/gpio/gpiolib.c | 209 ++++++++++++++++-------------------------- include/linux/gpio/property.h | 11 +++ 9 files changed, 315 insertions(+), 240 deletions(-) --- base-commit: b6fc3fddade7a194bd141a49f2689e50f796ef46 change-id: 20221031-gpiolib-swnode-948203f49b23 -- Dmitry
Comments
On Wed, Nov 9, 2022 at 8:30 PM Dmitry Torokhov <dmitry.torokhov@gmail.com> 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. > > 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 v3: > - Addressed more Andy's comments > - Link to v2: https://lore.kernel.org/r/20221031-gpiolib-swnode-v2-0-81f55af5fa0e@gmail.com > > 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 | 123 +++++++++++++++++++++++++ > drivers/gpio/gpiolib-swnode.h | 14 +++ > drivers/gpio/gpiolib.c | 209 ++++++++++++++++-------------------------- > include/linux/gpio/property.h | 11 +++ > 9 files changed, 315 insertions(+), 240 deletions(-) > --- > base-commit: b6fc3fddade7a194bd141a49f2689e50f796ef46 > change-id: 20221031-gpiolib-swnode-948203f49b23 > > -- > Dmitry > Hi Dmitry, What are the prerequisites of this series as it doesn't apply to my gpio/for-next branch? Bart
On Fri, Nov 11, 2022 at 10:49:32PM +0100, Bartosz Golaszewski wrote: > On Wed, Nov 9, 2022 at 8:30 PM Dmitry Torokhov > <dmitry.torokhov@gmail.com> 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. > > > > 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 v3: > > - Addressed more Andy's comments > > - Link to v2: https://lore.kernel.org/r/20221031-gpiolib-swnode-v2-0-81f55af5fa0e@gmail.com > > > > 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 | 123 +++++++++++++++++++++++++ > > drivers/gpio/gpiolib-swnode.h | 14 +++ > > drivers/gpio/gpiolib.c | 209 ++++++++++++++++-------------------------- > > include/linux/gpio/property.h | 11 +++ > > 9 files changed, 315 insertions(+), 240 deletions(-) > > --- > > base-commit: b6fc3fddade7a194bd141a49f2689e50f796ef46 > > change-id: 20221031-gpiolib-swnode-948203f49b23 > > > > -- > > Dmitry > > > > Hi Dmitry, > > What are the prerequisites of this series as it doesn't apply to my > gpio/for-next branch? Hi Bart, No prereqs, must be just a small context changes now that you merged leds changes and the patch removing devm_fwnode_get_[index_]gpiod_from_child(). Let me rebase it on top of latest next tree and resend.