From patchwork Fri Nov 4 06:10:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Torokhov X-Patchwork-Id: 1149 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp198540wru; Thu, 3 Nov 2022 23:12:19 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5YjV4oRT82ewDknjgFggeq1TXW8hzM2dGont4tl3Ev3ZFC/SmS27x5UjHO8XddpOH9oZ7s X-Received: by 2002:a17:90a:ba01:b0:212:e911:441a with SMTP id s1-20020a17090aba0100b00212e911441amr260522pjr.242.1667542338750; Thu, 03 Nov 2022 23:12:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667542338; cv=none; d=google.com; s=arc-20160816; b=M9vXagZEWLFrW7do6FFVE7W2XTGb7YLDBOL7at372TMDdo81HJ9ZU2P9M+ZPYdOyYe BwFK4fDy6JGQ5TUWrVKgzBBHbozcvEdNhuKemUMWDs30bc+REgnv2sLRgxpFx5/GPcFC vPg94qEglp0p0HeWE4N/ecvQwsSi171/WepE2VhUHs9Dy2RP6b3JyUOoq7XubsF3Prxt RranKywNXz1LyQt53I1yPVZvqqk9dKA9bCwpB0mjH7vqskH50cujn0lEEyMBG0puewbB ehJW9mdDNpJgnLtRPMRfv2/2okn6czG17lSJrOoyV4cAxdI+Q+SRkKE9pwNFuVFTxNzk G4+w== 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=TLME7jH56C8D1+m0LNBApvFwrtLDMdDD21KTM6uwzsE=; b=J6uTTWztlU7N5CSKIVSTQNMzHlsKCC83E4Gvp34Gx6dxNYDA3jbT2q/6yKA3a99d2+ VSXIloPuBV+fzsPEAY2A9Rb7+J/UMfMEuRKn6b36jCjLFeujprTe9JGSLrkNMab8VNd3 NhWtFQYibh4JJF2v9IhHAgrerZuFJG4Wi2uTfXwp+YZQaYtl5H/B+NJQ84SSY+YOrbDM qo8Q0/kGLxfwstH+/u1EsEMSgcygbJJzGLpbq9AXkbuMIR7Kef3gYYdstldqGr9nBn0z q+AF7h98enoY/rYMXOQTnCwCimwxlB9C8jQLx/hSj4wR2LBunoS33iV7DRqUTmckxf3q 88Rw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=I4A3+fMF; 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 28-20020a630b1c000000b0046aff3cb64dsi3648836pgl.410.2022.11.03.23.12.06; Thu, 03 Nov 2022 23:12:18 -0700 (PDT) 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=I4A3+fMF; 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 S230222AbiKDGKa (ORCPT + 99 others); Fri, 4 Nov 2022 02:10:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43452 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230008AbiKDGKW (ORCPT ); Fri, 4 Nov 2022 02:10:22 -0400 Received: from mail-pj1-x1035.google.com (mail-pj1-x1035.google.com [IPv6:2607:f8b0:4864:20::1035]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 376C028E30; Thu, 3 Nov 2022 23:10:21 -0700 (PDT) Received: by mail-pj1-x1035.google.com with SMTP id u8-20020a17090a5e4800b002106dcdd4a0so7322170pji.1; Thu, 03 Nov 2022 23:10:21 -0700 (PDT) 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=TLME7jH56C8D1+m0LNBApvFwrtLDMdDD21KTM6uwzsE=; b=I4A3+fMFdFrw1ItUiXAMXyb/dpRXhGT7joIpaNMQ0W+htpFOy8qm0RnLufRDNI/oee ui0A4rrd/yjdVcAr7RIQRAC8GqqUe6MjpRyPsyE5xs9v5xj+RlqS4CKsYpmj+ZubOiXz Gx3wkPoK/VqHXweC6RPk2oIOTW2xe7RrZON67KUHnXdUOaQbl5Z5wtboxg1mljZNhuNr tOxTvYcCQwEdwhMXmSqOlptpeIaCOuKQ5h6PtRtWQyeQuWyuVbo7TZb85bxWRsk7mzGJ WPPhy3mzkTrHkv94sEzsV4VUHaxz8Ij20JKxnCkC/id7+pDZmsMTKYMqav5JH7+eyWOQ McpQ== 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=TLME7jH56C8D1+m0LNBApvFwrtLDMdDD21KTM6uwzsE=; b=d85n0d9umkbTZ+cHMkAKSw7mWVP2z+qrd634cOLQ+DuoxNL+7MoKJC9V9ddp4lJfDW Z01YuS/+s/iZukx2FgrDU3jMC9ox74uxgl6fDROo9cM3IyFRrScd7FnysYgJeiVgczht i1joncTdCdx5bEZmK6YpQI+xfGwXmFffIueqmAOrHaz2WQ9hC3NNTb2Qk7KUrqANyQ5E GVK7nxc1HlMj+akcfJkuYLYXZ5XUhSkSxAYsTmlIUztLlq4xnhxNbyecrBVTlM/pAhxz fc2IKz64rTRTRQk1CqEVFqK8ZAvhIGqyVl3L1QS2oEvrgi+gVFA83Vbrr4kSgXeZcuhz d/Ww== X-Gm-Message-State: ACrzQf2gSFDWxhAQ4ePyVST8Qps71GJY6zoyhyoOnWymZqSBAB+mzsTE 1oVl9BqXDNrKefck8RzHejA= X-Received: by 2002:a17:90a:9c6:b0:213:b346:21dc with SMTP id 64-20020a17090a09c600b00213b34621dcmr32914249pjo.166.1667542220641; Thu, 03 Nov 2022 23:10:20 -0700 (PDT) Received: from dtor-ws.mtv.corp.google.com ([2620:15c:9d:2:a6ae:11ff:fe11:fcc3]) by smtp.gmail.com with ESMTPSA id x5-20020aa79ac5000000b0056bfd4a2702sm1791411pfp.45.2022.11.03.23.10.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Nov 2022 23:10:19 -0700 (PDT) From: Dmitry Torokhov To: Linus Walleij , Bartosz Golaszewski , Andy Shevchenko Cc: linux-acpi@vger.kernel.org, linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 0/6] Add support for software nodes to gpiolib Date: Thu, 3 Nov 2022 23:10:10 -0700 Message-Id: <20221031-gpiolib-swnode-v1-0-a0ab48d229c7@gmail.com> X-Mailer: git-send-email 2.38.1.431.g37b22c650d-goog MIME-Version: 1.0 X-Mailer: b4 0.11.0-dev-28747 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: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748544875695631596?= X-GMAIL-MSGID: =?utf-8?q?1748544875695631596?= 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 devicei 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. Note that kbuild robot is likely to complain about this patchset because it depends on patches removing [devm_]gpiod_get_from_of_node() and devm_fwnode_get_[index_]gpiod_from_child() APIs that are still pending. I pushed them to git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input.git tmp-gpiolib for your reference. To: Linus Walleij To: Bartosz Golaszewski To: Andy Shevchenko Cc: linux-gpio@vger.kernel.org Cc: linux-kernel@vger.kernel.org Cc: linux-acpi@vger.kernel.org Reviewed-by: Andy Shevchenko Acked-by: Linus Walleij --- 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 | 52 +-------- drivers/gpio/gpiolib-of.h | 16 +-- drivers/gpio/gpiolib-swnode.c | 106 +++++++++++++++++++ drivers/gpio/gpiolib-swnode.h | 13 +++ drivers/gpio/gpiolib.c | 239 ++++++++++++++++++++---------------------- 8 files changed, 316 insertions(+), 297 deletions(-) --- base-commit: dc04f5ab1b1114aa19b9026f816fc01ca9c9941d change-id: 20221031-gpiolib-swnode-948203f49b23 -- Dmitry