Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp4756998rdb; Fri, 15 Sep 2023 11:13:22 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGRnT1aO60BM8WjDNBKyYkcnvUyproytfvY7FDh4WD1CYbAWP+c1rkmI1AhW6epcq0d6Ryo X-Received: by 2002:a17:902:e5ca:b0:1c1:fbec:bc3f with SMTP id u10-20020a170902e5ca00b001c1fbecbc3fmr2499414plf.5.1694801601868; Fri, 15 Sep 2023 11:13:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694801601; cv=none; d=google.com; s=arc-20160816; b=zYnL2XVhDleRF+KWS50RmscEbcqTXtzzPqt2PgibkxtMFTswtIz6dbJ5y7qt2Jb7g6 D6Y4LLHnXxHMTtW63PChpZW1xO66cOb7ODD8Op1FleDJpzOxib9UhphzHVOccFgAoEhP 1c8ORId929yTT1KUh/laxZKMEPAWH4s2oADbax7erJ/T8DmRfzIRDRRjbcdmkUJtEv6C iR7vw4zyGAhMgXh8Q2txI1SBFpKoMQsQwVBaSPqN4ZuP0q84ptcvycDfAiA5T6Xwqg1L APUIAR5yYIpazHLzy99xaBkk3+b7t8jIECrXHfZNOv/ZjG7cqSu7IDWal4oHXjiKoWCe hboA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=dQSldCgfqFTr6pccupqaBjDLOtzSbVgKyyGZrcCsXLY=; fh=HOZ++xgByVf3Y1mN52Nf7dh0bdfH9nbnbz77I3h5LUM=; b=f1eZ/wK1jrrE6qhqePDMku3DuqmLu/xmKg+r4R1tV43/5pakD5UGrKcrnstBfNfTvI OJaxiP6vQe9oJR62xSQjl9Ibe4SqCfqibOUSjjMyK6M6JmS+OsLZNg7EaUh0AJzUM28N Owm3K/GSaVFC7L1/EIqmNL33VDOEW2rgcfji0HT9ur0UUGCyKIbckVisKS2tB5JnzS9n XqzgmfVzz6rORELXzOkEo+U6kuaExn+BryYE+f+BuIcFKa1nOMVa8mu1p83QAiwp9Gjx gTBxH1x6Ieh1m1py3uIZ4rm2xJvptgRyzJbqs/qCxnq4P+CSQNMFGYQ5Hdn4fZEvXqUZ MDTA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=dLYRMZFm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id l15-20020a170903244f00b001b178baf356si3930987pls.95.2023.09.15.11.13.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Sep 2023 11:13:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=dLYRMZFm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id D74928077543; Fri, 15 Sep 2023 07:10:58 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235563AbjIOOK6 (ORCPT + 99 others); Fri, 15 Sep 2023 10:10:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55256 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234055AbjIOOK6 (ORCPT ); Fri, 15 Sep 2023 10:10:58 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C92891FD0; Fri, 15 Sep 2023 07:10:52 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5D5A2C433C9; Fri, 15 Sep 2023 14:10:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1694787052; bh=JgqigKeKn865Q196uxCOO5B3UhLulNuRopfW1IGHX/I=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=dLYRMZFmecxZO7OCH+M02gl2UwkGgwxH/vnzPqMEnfwsaaQ8b5jOaJYagcJN1+k4e HsLb+qOAUwJ6cfRrk3x/LxIp8rte28kYpVMf/b9o7m/P0sc5zeUXQQbpKEEAobd/ME WHwfozfy8fu19U9TuZu4gt9mu0e85aA4mC/W+wnkpfBghMxvUPZcAN7SUo+N9cAseR UYynEHFMaOFDURVS10OZvymGRdHFIMOKGiiEQj5gwcuQfNHRrRtLQ5OksU4HCrqaLq gyPpeFvMBk64m7DzxOvPt7wBpAi4JrSBpsx4lfGBdBRybE8a4wViV1c3PvWRRs32sv b7N8Fp61mxpwQ== Received: by mail-lf1-f51.google.com with SMTP id 2adb3069b0e04-502b0d23f28so3641819e87.2; Fri, 15 Sep 2023 07:10:52 -0700 (PDT) X-Gm-Message-State: AOJu0YxGd2MmlxU0KO24cl7JGaK+XGayNqfjqOZM87kb3AG395QHvKC7 9+js9+C5dESDtVPwjTfemcjMR+nI1kc6lw5qFQ== X-Received: by 2002:a19:4f08:0:b0:500:979e:8d8b with SMTP id d8-20020a194f08000000b00500979e8d8bmr1590402lfb.34.1694787050499; Fri, 15 Sep 2023 07:10:50 -0700 (PDT) MIME-Version: 1.0 References: <20230912-gpio-led-trigger-dt-v1-0-1b50e3756dda@linaro.org> <20230912-gpio-led-trigger-dt-v1-1-1b50e3756dda@linaro.org> <20230913133451.GA2841610-robh@kernel.org> In-Reply-To: From: Rob Herring Date: Fri, 15 Sep 2023 09:10:38 -0500 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 1/2] dt-bindings: leds: Mention GPIO triggers To: Linus Walleij Cc: =?UTF-8?B?SmFuIEt1bmRyw6F0?= , Pavel Machek , Lee Jones , Krzysztof Kozlowski , Conor Dooley , Jacek Anaszewski , linux-leds@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,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-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Fri, 15 Sep 2023 07:10:59 -0700 (PDT) On Fri, Sep 15, 2023 at 7:01=E2=80=AFAM Linus Walleij wrote: > > On Thu, Sep 14, 2023 at 4:27=E2=80=AFPM Rob Herring wro= te: > > On Thu, Sep 14, 2023 at 3:40=E2=80=AFAM Linus Walleij wrote: > > > On Wed, Sep 13, 2023 at 3:34=E2=80=AFPM Rob Herring = wrote: > > > > 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 =3D <2>; > > > > > interrupt-controller; > > > > > #interrupt-cells =3D <2>; > > > > > #trigger-source-cells =3D <2>; > > > > > > > > BTW, this is not documented for any GPIO binding. If we want to spe= cify > > > > the cell size, then it has to be added to every GPIO controller bin= ding. > > > > If not, we then need to reference gpio.yaml in every GPIO controlle= r > > > > binding (along with unevaluatedProperties). Doesn't have to be done= for > > > > this patch to go in though. > > > > > > Yeah I mean this trigger-sources =3D <...>; one-size-fits-all is a bi= t > > > weird in a way. > > > > > > My other idea was to simply add trigger-gpios to the normal way > > > and be done with it, but now the trigger binding has this weird > > > thing. > > > > > > Would trigger-gpios be better? > > > > Then GPIOs are different than everyone else. I think we have to think > > about other bindings too. While we could standardize the naming here > > with trigger-gpios, that won't work with the foos/foo-names style of > > bindings. > > > > trigger-sources is not widely used as it is just USB ATM and a few > > platforms. We could come up with something different. > > "trigger-sources-" is the only idea I have. Then the > > property name gives you the cell name to read. But variable property > > names have their own challenges. We would need to look at all the > > current trigger sources (i.e. the linux,default-trigger ones) and see > > what else might need this. > > I think it in a way is elegant with the trigger-sources phandle as it > is so I would stick with this. > > I can just add '#trigger-source-cells' to the existing GPIO > bindings and it's a bit tedious since we don't have a common file > for the GPIO chip stuff, but it's just lots of lines. We do, gpio.yaml in dtschema. We just didn't reference it in all controllers because at the time unevaluatedProperties didn't exist/work and you still have to list most properties to define their constraints. In general, we reference the common schema for ones with child nodes, but not ones which are just #foo-cells and other properties. For GPIO, it's evolved to the point that referencing the common schema makes sense mainly because we have the hog nodes now. I said before we still need '#trigger-source-cells' in each schema, but really I suppose if we just set it to 1 or 2 cells in the common schema, that would be good enough. It's so rarely used. I expect (because there's discussions on it) someday jsonschema will support data dependent schemas (i.e. if the value of prop is X, then apply schema). Actually, we can do that already with if/then schemas, but it would be kind of verbose. > I guess it would be better to break out gpio-common.yaml and > gpio-common-irq.yaml for GPIO controllers with or without > interrupt support and then add '#trigger-source-cells' to just > those supporting IRQs because I think only that makes sense, > polling for a line to change isn't quite a "trigger". No need to split them just for that: dependencies: '#trigger-source-cells': interrupt-controller Though maybe a split makes sense anyways. Rob