Received: by 2002:a05:7412:251c:b0:e2:908c:2ebd with SMTP id w28csp1896077rda; Tue, 24 Oct 2023 06:43:19 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEZvqfMf9E/qD+KONUY4Y8DfL/LkmeBz78wdlDJaie0GufGq6BoEPppdnlG2a0yI2zkD8iq X-Received: by 2002:a05:6a20:160e:b0:16b:e2e5:fe55 with SMTP id l14-20020a056a20160e00b0016be2e5fe55mr3016588pzj.51.1698154999250; Tue, 24 Oct 2023 06:43:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698154999; cv=none; d=google.com; s=arc-20160816; b=uy35/y1Om894E/3M6V7au1zp3LvRzXN0fSUwCmSrQXKvOdQP040JZ/igQrLFr/VO3a rjfk/DMfSrKcda8ei9o1QMjqvGOecoVcddTe6jgKPu2AgUvX5NnnYmCimdKgHVmWh6E9 oGRZ2mqdJn5vLp+MaWn6yAunl9mOhII6IhGZeDlLJdSDHuwIUzu+UrWHn/Ci/I8Moklz c70t1fMfbjZaAnBI4tDaJ3awGrkoVE2pmgMR4LOb+T3F9GPWWuYloFLROepFOKQZa9QT xaowV7WxdUvtK9CiKUQhKrANymNBeLf3CoanpfHQazJfxMONiny+wdGg1arpyWnt35sQ /s8A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:mail-followup-to:message-id:subject:cc:to:from:date :dkim-signature; bh=llE/A+xwdvnmuUTq+C1r2sdJnt3pwBP1QiuNoEB548A=; fh=VYHYLZF2XbPvGme9Y3zkdWTYuAo7LCRg6JosWpUQi08=; b=bRLlBHKiA7/qsLYqYW6AlRn0jg6Qv2NxRZKEt6zLQx/9CA4Ff7ZSzZvtnNkj0gA8oQ Z/MjqHTfbW9ML7i79jkdSAVNU1abr2ucn8yMnKAHkdd5oMKczkKMGGV7NM7DMoq6hw4p 6YYz6tYEtL2IcwI8wPgWS51BOYVc0w9RFM3KeueeazWiJATTNVfh4dRYKDcHSpfRRQ1G J+UIHaa4eySuoia3Reyaom9woXxXXwrUx7jhwold5wZh7eXM00qeYNzxBLEcrs72czUJ FPZ7hBDXe+A4PO3PphF1duRTZV5p1QUL4pYL+80ApoDiIpvkI8mmUPi89YiN9dcWgDEJ 6plA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=bD3PbT0h; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 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 fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id s29-20020a63925d000000b005b8555564e2si8095317pgn.565.2023.10.24.06.43.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Oct 2023 06:43:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=bD3PbT0h; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 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 fry.vger.email (Postfix) with ESMTP id 80745805F42D; Tue, 24 Oct 2023 06:43:16 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234255AbjJXNnH (ORCPT + 99 others); Tue, 24 Oct 2023 09:43:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49340 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234404AbjJXNnF (ORCPT ); Tue, 24 Oct 2023 09:43:05 -0400 Received: from mail-pl1-x635.google.com (mail-pl1-x635.google.com [IPv6:2607:f8b0:4864:20::635]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 71AB7DD for ; Tue, 24 Oct 2023 06:43:03 -0700 (PDT) Received: by mail-pl1-x635.google.com with SMTP id d9443c01a7336-1c9d132d92cso8561025ad.0 for ; Tue, 24 Oct 2023 06:43:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698154983; x=1698759783; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references :mail-followup-to:message-id:subject:cc:to:from:date:from:to:cc :subject:date:message-id:reply-to; bh=llE/A+xwdvnmuUTq+C1r2sdJnt3pwBP1QiuNoEB548A=; b=bD3PbT0hQ1dVD+iDsHeJ2mlcykXCE8UIGyAqM43nFIuBix2pW20Lm5G2HtF1ERhOXM ZMNyfx442D+cwbUGB4pHUFgN3m9uju1GeE7zYajeIFQ+UTvSivAe0B8f9eHFu35AcsK1 sUXnLfK2oivsbqMkYvogMnddmBFdF/jUGyVldQPf/YYe/5ye6sjxjmFZEEI6+6IsZL1+ eWOSov7frJ2Yt2EBqiuXFjQyvqrfAiO8uS6HcrSzUeU1lPeK+XtOApBcH6ayhKa8xnRE 7NKI9yr1SDXibE66M8J+JutmS0VMRbVD0VmefjO0kFwy427AHlNAz7Z6SH3o715TgzI8 prow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698154983; x=1698759783; h=in-reply-to:content-disposition:mime-version:references :mail-followup-to:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=llE/A+xwdvnmuUTq+C1r2sdJnt3pwBP1QiuNoEB548A=; b=GzbdvclzC0N7ZjWGk5DdkaTNfL+ECukOsSmR6nPWASPWDi4UiXnWj9lTyEt9FhmEb7 C38rdL8mqptrOVJbxBpyRy+iGK8L7AozYShZb2d+8CvksKxOgm4yp3/1VX2CE0/F/EYP Uh+t/U4PPsR4iWlycQg+yaKyQo0Rp0fsSGUmGltXgYWaIpNnDKlkm1tDrMQBEsrbcBYd HGh6IclMMNs0XAhSr+rZ9PKV1DpmRvew0WjcPyLa/D8Bv15N/vF4KfGaSXgAaoL/nv59 sVgRzDsC96yNTez2JNrSBrQ9jKdSzrPJAiwmYqtNxfAW/92gQKbrxR6w/SJYI4kQEOb7 p4+Q== X-Gm-Message-State: AOJu0YzocTjxjjlQCxuqyGRzFdjziS+UaVwhIvLNIwwuWIImeUq/05cF 2oqaREXKmHvH3Pny+7iYnjuawi3ZbY1un0GdFUuusw== X-Received: by 2002:a17:903:6c7:b0:1ca:85b4:b962 with SMTP id kj7-20020a17090306c700b001ca85b4b962mr11793079plb.4.1698154982724; Tue, 24 Oct 2023 06:43:02 -0700 (PDT) Received: from octopus ([2400:4050:c3e1:100:7c15:610f:1205:f10c]) by smtp.gmail.com with ESMTPSA id q12-20020a170902dacc00b001c71ec1866fsm7416507plx.258.2023.10.24.06.42.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Oct 2023 06:43:02 -0700 (PDT) Date: Tue, 24 Oct 2023 22:42:57 +0900 From: AKASHI Takahiro To: Linus Walleij Cc: 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 Subject: Re: [RFC v2 5/5] dt-bindings: gpio: Add bindings for pinctrl based generic gpio driver Message-ID: Mail-Followup-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 References: <20231006132346.GA3426353-robh@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-0.8 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 fry.vger.email 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 (fry.vger.email [0.0.0.0]); Tue, 24 Oct 2023 06:43:16 -0700 (PDT) On Tue, Oct 24, 2023 at 03:12:51PM +0200, Linus Walleij wrote: > On Tue, Oct 24, 2023 at 1:10???PM AKASHI Takahiro > wrote: > > > As far as I understand, there is only one way for SCMI gpio driver > > to know which pins are actually GPIO pins; Calling PINCNTRL_CONFIG_GET > > command with "Input-mode" or "Output-mode" configuration type > > against *every* pin-controller's pins. > > (Here I assume that the command would fail with INVALID_PARAMETERS or > > NOT_SUPPORTED if configuring the given pin as a GPIO input or output > > is not possible. But the specification seems to be a bit ambiguous.) > > As I also wrote in the reply to Christian, I expect the SCMI firmware > to consider GPIO a function on the pins, and either individual pins > (groups with just one pin in it) or entire groups of pins can be switched > to perform the "gpio function". ("gpio function" is akin to "i2c function" > or "HDMI function" etc.) First of all, there is no pre-defined naming convention either for pins, groups or functions. SCMI firmware can give them any names. Secondly, What you said in the above is already implemented in my RFC patch. Please remember the example that I gave: > gpio-ranges = <&scmi_pinctrl 6 0 0>; > gpio-ranges-group-names = "pinmux_gpio"; > > means that SCMI *group*, "pinmux_gpio", are mapped to this driver's > gpio range which starts with 5. If "pinmux_gpio" indicates SCMI *pin* > range [20..24], > > baa-gpios = <&gpio0 7>; > will refer to gpio pin#7 that is actually SCMI's 22 (=20 + (7-5)). Given the fact there is no naming convention, we need to explicitly specify an associated group name in "gpio-ranges-group-names" in any way. What my driver doesn't care for now is the case where a group of GPIO pins are multiplexed with other functions (UART, I2C or whatever else). In this case, we need to configure "pinconf" setup prior to using those pins as GPIO anyway. Simply, it is out of scope of my driver. (We can still use existing generic GPIO interfaces to operate them once set up, though.) After all, I still believe we need "gpio-ranges" property in most of all use cases (The only exception is, as I mentioned, to unconditionally map all pinctrl's pins to GPIO (if possible) when SCMI firmware provides only GPIO function for all pins. I think it is a simple and yet likely use case. Thanks, -Takahiro Akashi > > If the SCMI protocol considers GPIO usage to be something else > than a function of a pin, that is going to be a problem. Then the SCMI > protocol need some other way of determining that the pin is in > GPIO mode, and perhaps something would need to be added to > the protocol for that. > > The reason is that in practice a lot of hardware has to decouple > the pin from any internal function in order to use it as GPIO, and > connect it to the GPIO block that can drive the line high and low. > And we don't select that as a function, how is the firmware going > to know that it needs to do this? Implicitly from the call requesting > the line to be output perhaps. But if the firmware can be altered > to do that, the firmware can just as well be altered to present > GPIO as a proper function. > > Using a function makes most sense, because the board firmware > knows which pins are GPIO lines and what they are used for > (such as a LED or camera flash) and at boot certainly put them > into GPIO function and drive them high/low or set them as > input (high impedance). > > > It means that, if SCMI firmware has 100 pinctrl pins, the driver needs > > to call the command 200 times in order to get the answer. > > I think we should only need to check which function each pin > has and those that are in the GPIO function we put into the ranges. > > Yours, > Linus Walleij