Message ID | 20230912-gpio-led-trigger-dt-v1-0-1b50e3756dda@linaro.org |
---|---|
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9ecd:0:b0:3f2:4152:657d with SMTP id t13csp457629vqx; Tue, 12 Sep 2023 07:46:02 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHEH8jBuZEgDjjUilxT1vyQvwoV7LbsKld9IItqGZykhaUSdvr4OaiXQGlYp1Q1Q/gxieyQ X-Received: by 2002:a05:6a00:1da2:b0:68f:cc47:fcc8 with SMTP id z34-20020a056a001da200b0068fcc47fcc8mr4422498pfw.14.1694529961691; Tue, 12 Sep 2023 07:46:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694529961; cv=none; d=google.com; s=arc-20160816; b=uzRaxMmVqKwQ7mh7MxizknjQ/e3Z38njPWs0oeekA10MP6+x3F5B/j0KvxnfJbgHRI GsLOO2ljjL3DyOx0w10u1fY4z2weDefBXFEkL/wcml3v202rMt6BCn2ogNWRnAiXpXZm EHa+stG46RZHPidrrLPEr9dz98vFO35zoPm7qXNhHnL8dMVP/QoRQ0R2Q6LpQUFxepsR rN/DJr0w/oQVIdr5Gwv+RauqoH8e0srPJfNJ3hw2WzFg+wIt1BaOotH/Mi2ff20cd5CC 2wIICS4YPXEprZrUVGGbA7Fm4zNkMe/Ue11nQ3sh4GdOTtuAOi/cv2vQipEnlFyOAvnW 3jhg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:content-transfer-encoding:mime-version :message-id:date:subject:from:dkim-signature; bh=LqEXetn7S/Qdpis0iF4PB46W2IEBIemF0WMhXfkuJNg=; fh=vOR+f+ec2RFJcjj3G0dAoFd095oyBG31moK1iVhdblk=; b=pRsjwNlOQOG7Z3ogT7U7hXAi/DPsr6TrO+g5fm7jpcTM23b3DabZGjM4HURAdsd1ad frlsSLpnVgOZkhi/CBJcVxyGMjiNlNfBrHaaGX4Domv0a8S47EJCPUIM91qT6Hi2U0sH 2WgbGvXkNYWeUnezBGsjbM035zs9y2FjLxKrKc7+tFVaWjmBzo2vqsfRzEZLcX7tnvRn drZvX/zmLTYpUN/StE+kpEEbL4EUNsfrBN29ntftrUsgEcNkG9wJRHBwthFvTUU/FVRD JIiB3JZb0oMXNV+A07wQr0WaWsYyJBdq8C4MmgnN6FIhdTtbZBLFCgDwZ529n5iBSj1H 6Npw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=WX+dwjcl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id c11-20020a056a00248b00b0068a52819fd2si8353278pfv.331.2023.09.12.07.46.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Sep 2023 07:46:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=WX+dwjcl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 949ED819BB43; Tue, 12 Sep 2023 06:44:51 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235672AbjILNok (ORCPT <rfc822;pwkd43@gmail.com> + 37 others); Tue, 12 Sep 2023 09:44:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44504 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235562AbjILNoh (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 12 Sep 2023 09:44:37 -0400 Received: from mail-lj1-x233.google.com (mail-lj1-x233.google.com [IPv6:2a00:1450:4864:20::233]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 60DC110D1 for <linux-kernel@vger.kernel.org>; Tue, 12 Sep 2023 06:44:33 -0700 (PDT) Received: by mail-lj1-x233.google.com with SMTP id 38308e7fff4ca-2b9d07a8d84so94535171fa.3 for <linux-kernel@vger.kernel.org>; Tue, 12 Sep 2023 06:44:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1694526271; x=1695131071; darn=vger.kernel.org; h=cc:to:content-transfer-encoding:mime-version:message-id:date :subject:from:from:to:cc:subject:date:message-id:reply-to; bh=LqEXetn7S/Qdpis0iF4PB46W2IEBIemF0WMhXfkuJNg=; b=WX+dwjclAPwOUZ4WmmxGfCkvvMhyCxYZ5PeCtK7SNBvc3KG7/yIHeJUq9+Mo2hZL/O Sb0oCqkwsfNNztN2vBGrQfaypqR+L1WJQWY9hf9r9xJK2TcYRyE5zeWbzQilRxyG6Hbk nHMcH7pbcOolTf5nzk908Us1QYPiUKBU25GcAKj++5iw2XVq2q1DjZI7Cmy8B5QrIV0Q 2ULQscYsJ37nv9LmO53D9f2aIPnE6ToZ9WKjDCBOyDc8VDW1bbaNmQrgd0kxTeZxIHNn 4/Lcs14pEn4JHEEC4nNPAivU1uG0Kw9cP7BG+LD8Os/2iTqA9KcRe5IdQPeFlirzGonU pqwA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694526271; x=1695131071; h=cc:to:content-transfer-encoding:mime-version:message-id:date :subject:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=LqEXetn7S/Qdpis0iF4PB46W2IEBIemF0WMhXfkuJNg=; b=o4IOhEfqq5g3wXNaOU+X4GkyJAU0oriwF6lG6ZZiKvYZfzPE0KSSlN3wPxHfHkJm0L HtL2l/14kMSqiZe0A3dZSZ9p5s1WFWH+kYnj7yjSUduNCZrh1g1EBx8pARRvTLmk63Jq SxLWWtBZdmqoVXnIn9k7IrjDKlEJn6AV/P8idZBlLsbR5sifeQyts3fffP7L+E48kAmu 4DhR/nXfkpw/PHiSksglD9BHBskM3Wnll2hj1E4OjreqJEiYmSJxSJYp7lNIN7t5oTxb FRtMLwiQ+X2cJULSn/KCK7KVYvk3rLWyju4U/PtquNEtaOcB0Z/2B+9hvohwsxllTQb5 6OGw== X-Gm-Message-State: AOJu0YyB6lBTvJhiGXwdcOadnCD2ivxHyv60t5b4nmiufK1xMRM26tqh 4q+x5mqHgHfIP24HQCvDQ1z2oO8zIe33XiSWI/c= X-Received: by 2002:a05:6512:3189:b0:500:b0e8:a899 with SMTP id i9-20020a056512318900b00500b0e8a899mr11452651lfe.30.1694526271445; Tue, 12 Sep 2023 06:44:31 -0700 (PDT) Received: from [127.0.1.1] ([85.235.12.238]) by smtp.gmail.com with ESMTPSA id y6-20020ac255a6000000b00500a2091e30sm1755020lfg.115.2023.09.12.06.44.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Sep 2023 06:44:31 -0700 (PDT) From: Linus Walleij <linus.walleij@linaro.org> Subject: [PATCH 0/2] Rewrite GPIO LED trigger to use trigger-sources Date: Tue, 12 Sep 2023 15:44:29 +0200 Message-Id: <20230912-gpio-led-trigger-dt-v1-0-1b50e3756dda@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-B4-Tracking: v=1; b=H4sIAD1rAGUC/x3MMQqAMAxA0atIZgNtnPQq4mBtrAFpJS0iSO9uc XzD/y9kVuEMU/eC8i1ZUmywfQfbscbAKL4ZyNBgRmsxXJLwZI9FJQRW9AVHIueY7L4SQSsv5V2 e/zovtX4cyOn/ZQAAAA== To: =?utf-8?q?Jan_Kundr=C3=A1t?= <jan.kundrat@cesnet.cz>, Pavel Machek <pavel@ucw.cz>, Lee Jones <lee@kernel.org>, Rob Herring <robh+dt@kernel.org>, Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>, Conor Dooley <conor+dt@kernel.org>, Jacek Anaszewski <jacek.anaszewski@gmail.com> Cc: linux-leds@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Linus Walleij <linus.walleij@linaro.org> X-Mailer: b4 0.12.3 Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Tue, 12 Sep 2023 06:44:51 -0700 (PDT) X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1776843449192518245 X-GMAIL-MSGID: 1776843449192518245 |
Series |
Rewrite GPIO LED trigger to use trigger-sources
|
|
Message
Linus Walleij
Sept. 12, 2023, 1:44 p.m. UTC
This rewrites the platform-data GPIO LED trigger to instead
use fwnode trigger-sources to describe the LED used.
This will work out-of-the-box with e.g. device tree.
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
Linus Walleij (2):
dt-bindings: leds: Mention GPIO triggers
leds: triggers: gpio: Rewrite to use trigger-sources
Documentation/devicetree/bindings/leds/common.yaml | 2 +
drivers/leds/trigger/Kconfig | 5 +-
drivers/leds/trigger/ledtrig-gpio.c | 136 ++++++---------------
3 files changed, 42 insertions(+), 101 deletions(-)
---
base-commit: 0bb80ecc33a8fb5a682236443c1e740d5c917d1d
change-id: 20230911-gpio-led-trigger-dt-922bbe21fa22
Best regards,
Comments
On Tue, Sep 12, 2023 at 03:44:30PM +0200, Linus Walleij wrote: > We reuse the trigger-sources phandle to just point to > GPIOs we may want to use as LED triggers. > > Example: > > gpio: gpio@0 { > compatible "my-gpio"; > gpio-controller; > #gpio-cells = <2>; > interrupt-controller; > #interrupt-cells = <2>; > #trigger-source-cells = <2>; > }; > > leds { > compatible = "gpio-leds"; > led-my-gpio { > label = "device:blue:myled"; > gpios = <&gpio 0 GPIO_ACTIVE_HIGH>; > default-state = "off"; > linux,default-trigger = "gpio"; > trigger-sources = <&gpio 1 GPIO_ACTIVE_HIGH>; > }; > }; > > Signed-off-by: Linus Walleij <linus.walleij@linaro.org> > --- > Documentation/devicetree/bindings/leds/common.yaml | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/Documentation/devicetree/bindings/leds/common.yaml b/Documentation/devicetree/bindings/leds/common.yaml > index 5fb7007f3618..b42950643b9d 100644 > --- a/Documentation/devicetree/bindings/leds/common.yaml > +++ b/Documentation/devicetree/bindings/leds/common.yaml > @@ -191,6 +191,8 @@ properties: > each of them having its own LED assigned (assuming they are not > hardwired). In such cases this property should contain phandle(s) of > related source device(s). > + Another example is a GPIO line that will be monitored and mirror the > + state of the line (with or without inversion flags) to the LED. > In many cases LED can be related to more than one device (e.g. one USB LED > vs. multiple USB ports). Each source should be represented by a node in > the device tree and be referenced by a phandle and a set of phandle > Acked-by: Conor Dooley <conor.dooley@microchip.com> Thanks, Conor.