Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp669929ybx; Fri, 1 Nov 2019 09:21:50 -0700 (PDT) X-Google-Smtp-Source: APXvYqzbEldIEqp2kJhRZABdl8yvaHgzmO7cGd039AkpaQwP8Bo2mObyIinTcA8IlCemCQViD5hP X-Received: by 2002:a17:906:24d3:: with SMTP id f19mr10711153ejb.267.1572625310402; Fri, 01 Nov 2019 09:21:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572625310; cv=none; d=google.com; s=arc-20160816; b=HXEAW2gpT8BX3papq3Ym+ErfYZt+qj+FYlBUfzCD0ON13NecJhqs3F9tea03TqeE1s qDModEru+Q5couEAt7Rjpx6aZVdJxwLK5DHg7vvNn5C6n8GAcMIIul8QtzxNUw+IdAXc YZ2saZRqJ4GxIuYC2BMomS3DkOKFbXDHM834/zXyytTPW85+SdPYFdVh/6TMtvYcVKMD nT6F5vk7by2bEd3WbQgaBJU0NdGNWVKy/sXz/qOKqGeG2KQPSvgq2XYzGMOJ8KvKIyBw u055zRwsSm+7Dv7sS/Pe/ZQ6UWme3ZLZyL59B0B6h3nN/poKUU94F2DnMzQ7TvIUm6B4 Qnuw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=fFCvFToGeaHVIGU5sFBVgfSRoD2BKpJyYjD9mLtHujQ=; b=ytVP3Ayoo0/GagYK9V2YmkwRA+tYzgdgozR1lH2r639YuAiVtOZRfV5uFlDBopKNxk YxyXt0H7n4orxUaf951caLhpxolVPK4Rqpri+XOTbfRelSdFe4S3UOWCdEeeoyLB60dV fvLI8Wvf34MdxANm3Kan0MGFcN3hY/Hu9+9g+yI/LTv7mRZGiRY+iv4GNZ2B+7kKSas8 cvpVcbKOoHNom9Ve8PFWBUiS7dcnw0p+8sqJs4wlOIECBblUL10l2eAU6qyWhZc8OcPT kkPpxAgPWOCpBjmZtFxMZzxnbwvkKu17i0ElegXwIqTjrLZwRzHmGgv7hXnkRC5Yu5HL KisA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=F9Ndl5Ph; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 18si6117342ejz.321.2019.11.01.09.21.26; Fri, 01 Nov 2019 09:21:50 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=F9Ndl5Ph; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729308AbfKAP4e (ORCPT + 99 others); Fri, 1 Nov 2019 11:56:34 -0400 Received: from mail-lf1-f68.google.com ([209.85.167.68]:41578 "EHLO mail-lf1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726757AbfKAP4e (ORCPT ); Fri, 1 Nov 2019 11:56:34 -0400 Received: by mail-lf1-f68.google.com with SMTP id j14so7572598lfb.8 for ; Fri, 01 Nov 2019 08:56:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=fFCvFToGeaHVIGU5sFBVgfSRoD2BKpJyYjD9mLtHujQ=; b=F9Ndl5PhHtMPfUuMcm8khWvn73/BEOIl++HBIcr20Ca4EaRLGm0X6RFvsiVYxyTX1g ScVc4k5lnnHBMJ/H/gnJWwg7s7cajawJ2YKfsHiEtNaOhBIrW6P82v9lWIsp4xPGOmsA 9q8ZHL/h7W1JGbUDLXrlJb3earEteWQrnKzeYI4pTOy0d8MaY+lfEZgmfgMGyFxVDWOZ lusyDw5qW5fg9ImIFhykFIXEit3Pty0/IEovLGP9ElvcQ0+kyi6ngXU+wqtlfiMAIXmA 3oC4MDlTxQoJKR2Ml8zNsEQhHYR4x9mVMEqIxS+PkIWxgT1z+NItPSoSl+FuRRrny1sQ xumw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=fFCvFToGeaHVIGU5sFBVgfSRoD2BKpJyYjD9mLtHujQ=; b=eF2DwrbhxluusrKYj8K2Gu9H4nmvANQZ5vsihq6tIoqG2wWNF/dRQ5YTYtG9cBb1Yk aeuHb7YvF2MNtJg+wKFYWiFzclZQi5ArmS3esfSlbFYBIQRGhCbr8K9x9i6o5x1FFImq rKYoXWZAsSdVChQym4TQ3jiETt41P8676N9TIti+SQmaBg4RyAVbYv69v62IJ4j54Upj CuJpgr1FHBoaV0lkfFc6BtEL8fvkRMr/anxTAM4Dijrn9BfAamt02DJ7ykfayCYmsPTA Y6dN5MDxm4VeYuR8KgY+6AFm7xKDr5VVE5J8zPsZOvAGMORw0lqVeBP4ZY9ypGxI3ROp l7jw== X-Gm-Message-State: APjAAAXEe05UrhHi+AKQoDEX2VXvRe5ARyxKTVHEFUBTqm059uREasmL aKzPipuMoQrmb7+0wChyFFXnFm9u0hbJUk7gegKR5Q+3L0U9Qw== X-Received: by 2002:ac2:4a8f:: with SMTP id l15mr7717304lfp.5.1572623791617; Fri, 01 Nov 2019 08:56:31 -0700 (PDT) MIME-Version: 1.0 References: <20191030114530.872-1-peter.ujfalusi@ti.com> In-Reply-To: <20191030114530.872-1-peter.ujfalusi@ti.com> From: Linus Walleij Date: Fri, 1 Nov 2019 16:56:19 +0100 Message-ID: Subject: Re: [RFC 0/2] gpio: Support for shared GPIO lines on boards To: Peter Ujfalusi , Rajendra Nayak , Grant Likely Cc: Bartosz Golaszewski , "open list:GPIO SUBSYSTEM" , "linux-kernel@vger.kernel.org" , Marek Szyprowski , Mark Brown , Tero Kristo , Maxime Ripard , Philipp Zabel , "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi folks, cutting all the discussions in this thread we need to see the bigger pattern: On GPIO rails People want "something like rails" for GPIO. In power supplies and thus the regulator subsystem, rails are connected to many logical endpoints. - The suggested inverter bindings would be effectively an inverter on a GPIO rail. - This suggestion would be equal to many power consumers on a rail, such as the usecase of shared gpio-enable lines in the regulator subsystem already provides. The former seems to have been identified as solveable for the userspace that needed it and absorbed into the drafts for a virtualized GPIO controller. (Aggregating and creating a new virtual GPIO chip for some select physical GPIO lines.) I haven't seen an exact rationale from the DT community as to why these things should not be modeled, but as can be clearly seen in Documentation/devicetree/bindings/regulator/regulator.yaml the "rail abstraction" from the regulator subsystem which is in effect struct regulation_constraints and it sibling struct regulator_init_data is not in the DT bindings, instead this is encoded as properties in the regulator itself, so this is pretty consistent: the phandle from regulator to consumer *is* the rail. This goes back to Rajendras initial DT regulator support code see: git log -p 69511a452e6d So it would be logical then to just have: - More than one phandle taking the same GPIO line - Figure this situation out in the gpiolib OF core - Resolve the manageability of the situation (same consumer flags etc) - Instantiate a kernel component as suggested, mediating requests. - Handle it from there. So: gpio: gpio-controller@0 { compatible = "foo,gpio"; gpio-controller; #gpio-cells = <2>; }; consumer-a { compatible = "foo,consumer-a"; rst-gpios = <&gpio 0 GPIO_ACTIVE_HIGH>; }; consumer-b { compatible = "foo,consumer-b"; rst-gpios = <&gpio 0 GPIO_ACTIVE_HIGH>; }; Hi kernel: figure it out. From this point the kernel driver(s) have to figure it out. I don't think this requires any changes to the DT bindings other than perhaps spelling out that if you link more than one phandle to a GPIO line, magic will happen. (We should probably make very verbose dmesg prints about this magic.) This is enough to start with. After that we can discuss adding flags and constraint properties to a certain GPIO line if need be. (That will be a big discussion as well, as we haven't even figured out how to assign default values to individual GPIO lines yet.) Yours, Linus Walleij