Received: by 2002:a05:7412:251c:b0:e2:908c:2ebd with SMTP id w28csp1768392rda; Tue, 24 Oct 2023 02:41:36 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEhXOEe+rU9tfutEilsjUv+YJ+Idi91d1GVsA085Z/mFZdq0B0NHS0XUpk0/XD+U+ilV+mi X-Received: by 2002:a17:90b:1c08:b0:27d:3a2a:1e2c with SMTP id oc8-20020a17090b1c0800b0027d3a2a1e2cmr9520382pjb.15.1698140495699; Tue, 24 Oct 2023 02:41:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698140495; cv=none; d=google.com; s=arc-20160816; b=WML7DnfGXprO453Y59sPSHV1ZRA+bnA6m69rpu1CLaiha0LUqoIndOYumUgTM09xcU E2iCe8IInqAJxM6x9rx2nEhnHDoMVhajZRleFQ1D887eljR8bmQ5CgptBn+xfVJb+bjL MQ46SQQWuisQioY0MyVijSAlo1yfBjqZ8Yd08hhcDi3Gt/kGOhJFTQ/d7OzQ6hDtlioz LYgq3nBDFDGzitCcwgSpelTEi2oW3J3PUHmOnwje5jINEE622XrtuquLgMw1/kHaO5Ch oWu6ey1kXNVJbzSZTcYleTEKLlLJ8H6Ai5GDcq36tLyEm0iR2q0m15kIVql7UJAkFfiC f3bg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:to:subject:message-id :date:from:in-reply-to:references:mime-version:dkim-signature; bh=nrczhLGD57ThZZUAC+aPmJYkJuVGn0gGizSYS9IZ/6k=; fh=q0M+SJH09aQ1S2GQ7DNSA1z41Pd6bv9Rq5Ovrz1uxPA=; b=0/SlpgwGbSdmGFzH7uubCo3ATFsDXvlHaLKIYyvr9T3PAV7W68Kv2a0orb/fbkZdck 7bYhyIezrSdJKI9nRTXX90gNOOe7gPWpjL3MF6rZrcgJF4avhpQ7opO+Q8l3R6OXRmGk 4HjndQHHwd2BV5KpZqr2FihdeP9uCx24hg4l2MvbyOgiYTOMNQZ5Qq2v3YgeypIVGIwn 3uZ0rEsbMbUcu1nMyqBpu34ToUYoFV9ORTT4vlgCVZFmAZ8AuJI59votapmJU6LDy9Ze dlGBod/ub8R8UEDzSMvfd+75WL9aZrzuUstmhPu9utM7rRY3AZkVlK7Ocu50rgqvaf9Z 20oQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=v01xorbj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id d12-20020a170902cecc00b001b9ffda162csi8077023plg.441.2023.10.24.02.41.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Oct 2023 02:41:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=v01xorbj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 snail.vger.email (Postfix) with ESMTP id 8C25680B81E3; Tue, 24 Oct 2023 02:41:34 -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 S234193AbjJXJlb (ORCPT + 99 others); Tue, 24 Oct 2023 05:41:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35114 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234492AbjJXJlI (ORCPT ); Tue, 24 Oct 2023 05:41:08 -0400 Received: from mail-yw1-x1129.google.com (mail-yw1-x1129.google.com [IPv6:2607:f8b0:4864:20::1129]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8AD5D10DE for ; Tue, 24 Oct 2023 02:40:13 -0700 (PDT) Received: by mail-yw1-x1129.google.com with SMTP id 00721157ae682-5a7c7262d5eso44021127b3.1 for ; Tue, 24 Oct 2023 02:40:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698140412; x=1698745212; darn=vger.kernel.org; h=content-transfer-encoding:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=nrczhLGD57ThZZUAC+aPmJYkJuVGn0gGizSYS9IZ/6k=; b=v01xorbj2vmZyjz9Rj3CPHBIV7wt17LnkRj58c/9qqkOTe50XFHd8P4ADFnUKxerpe RFmDuMFq4jBB7hxX14M/Q+/55PUVGnuzOUX4ev9I8YauKRjT5ROYX3COc901GAOPV3/0 2M0/zlmH1AAIrPKja7YymH7a9Ldxfvc/k9P3Jy106hSgsBKwV0XBdVQI0nQTrzoHjyyq 2bl09BqWn1REMeIRamilUfr2RlfDVXNU4oG2Z1HXmJsSofgXOvepzNdfMVmykCwbA3Q1 eTR3h84GDKk9V4U4HlB46ufjMhodhzwMtex85Bpqc4YPM99wn+656+hPPl4gVpsQpbP1 EFmw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698140412; x=1698745212; h=content-transfer-encoding:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=nrczhLGD57ThZZUAC+aPmJYkJuVGn0gGizSYS9IZ/6k=; b=Aei+RUG1zuvAlY5COUOhdXOjxqg3mryh61intflr5Ug4cn2aZSKa2UgrfXo5jz9CUO 6nqGLTvqhDEAnkGyrw4iZ6zAETanTMzKbeQ5FoeXRkWJV7hT42EbO0FbxguAdiLMfdEn 6zy5bcmU/hUydcmtjFribeVLuz1HlM+chC9j564LMl8VKagZKV4BPN2Wp9/SrJN2s25S 4TyC32PUbDqLJB62xjeb4Jp31nOrdhtb2vKnjuRGDZyhHR6/lWnS79qVXAHMKfK7Yw0x VrSuY0WdNw81iWoLzbVbhBdSBBwMixdPis4tr+wpc6cCLhexHO0HOhJaNwfpHiN+HtBO X6Ig== X-Gm-Message-State: AOJu0YywQqEfklTOKQAp9uj9CaC8mA1DdN+tUwvuWWfa9cWc8fdKqpNS yGPpTT49GjiB1oO1SlrUPOZffnvDHWwbbefVIae/6A== X-Received: by 2002:a05:690c:f87:b0:59f:b0d9:5df2 with SMTP id df7-20020a05690c0f8700b0059fb0d95df2mr15122020ywb.0.1698140412349; Tue, 24 Oct 2023 02:40:12 -0700 (PDT) MIME-Version: 1.0 References: <20231005025843.508689-1-takahiro.akashi@linaro.org> <20231005025843.508689-6-takahiro.akashi@linaro.org> <20231006132346.GA3426353-robh@kernel.org> In-Reply-To: From: Linus Walleij Date: Tue, 24 Oct 2023 11:40:00 +0200 Message-ID: Subject: Re: [RFC v2 5/5] dt-bindings: gpio: Add bindings for pinctrl based generic gpio driver To: AKASHI Takahiro , Linus Walleij , Rob Herring , sudeep.holla@arm.com, cristian.marussi@arm.com, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org, Oleksii_Moisieiev@epam.com, linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-gpio@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,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, 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 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]); Tue, 24 Oct 2023 02:41:34 -0700 (PDT) Hi Takahiro, On Tue, Oct 24, 2023 at 9:12=E2=80=AFAM AKASHI Takahiro wrote: > > I think it is better of the pin controller just parse and add any > > subdevices (GPIO or other) using of_platform_default_populate() > > (just grep for this function and you will see how many device > > drivers use that). > > IICU, then, we will have to add a "compatible" to pinctrl node > to make of_platform_default_populate() work as expected. That is: > > scmi { > ... > protocol@19 { > compatible =3D "simple-bus"; // <- added Hm right, but you could also use of_platform_populate(np, NULL, NULL, dev); Then the compatible match is of no concern. Sorry for my lack of attention to details :/ If you want to restrict the population to a few select compatibles (maybe only "pin-control-gpio") then you can do that with const struct of_device_id of_scmi_protocol_19_match_table[] =3D { { .compatible =3D "pin-control-gpio", }, {} }; of_platform_populate(np, of_scmi_protocol_19_match_table, NULL, dev); > Is this what you meant? > In this case, however, "protocol@19" has a mixture of sub-nodes, > most are pinconf definitions which are the properties of the pin > controller, while "scmi_gpio" is a separate device. That looks good to me, it makes sense to have the GPIO as a subnode here and mandate it with a compatible to match. > The code will work, but is it sane from DT binding pov? Let's let the DT people jump in on that. > > Instead just call gpiochip_add_pin_range() directly in Linux > > after adding the pin controller and gpio_chip. > > C.f. drivers/pinctrl/pinctrl-sx150x.c for an example of a driver > > doing this. In this case the SX150X is hot-plugged (on a slow > > bus) so it needs to figure out all ranges at runtime anyway. > > Are you suggesting implementing a custom function for parsing "gpio-range= s" > and calling it in pin_control_gpio_probe() instead of a generic helper? The generic helper will always be attempted but if there are no ranges in the device tree, it will just continue without adding any ranges. I suggest putting *no* ranges into the device tree. > Or do you want to always map all the pin controller's pins to > gpio pins as sx150x does? I think since the SCMI firmware knows about the available line and pins etc, it makes sense that the driver comes up with the applicable ranges on its own (derived from the information from the SCMI firmware) and add them, instead of trying to put that information into the device tree at all. Just omit it, and make your own ranges, and add them in the Linux driver with gpiochip_add_pin_range() without involving DT at all when defining the ranges. I'm sorry if I'm unclear sometimes. Yours, Linus Walleij