Received: by 2002:a17:90a:88:0:0:0:0 with SMTP id a8csp115019pja; Fri, 22 Nov 2019 04:14:57 -0800 (PST) X-Google-Smtp-Source: APXvYqwR61lNqbgu9ff3Vfyrh6pvb+Y5H266A/aW3/pwjkmQDoiSdUJHsVXZYllmKnyNsNpJdc48 X-Received: by 2002:a17:906:404d:: with SMTP id y13mr22366445ejj.276.1574424897496; Fri, 22 Nov 2019 04:14:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574424897; cv=none; d=google.com; s=arc-20160816; b=Jd430rh96oL7ojNLRighV3eCD1UmMHaaQaLdPwDRqXBaMhvs3/iwvLAbi7T4tIUoQF 1Qwd3LQ9Iaf9trCAoKoSTFCR0XshY8dO+ElXJPyItIGhOD7l1cZ3lOVQzojUFj4+joS2 d5oh5pLuVttFhmI9X+FHHp1bL/YnD3Zy3GZrIcj23KXY80V9zCaQvbQZ5fXoOqp8hWRo UIvQos8lD2BdQAzv3GyRxejTFkebpKe7f1rHJmDEsvClSo5+aoOnnJljNlNk7IQ64zBB FAHAE4+4PQUOBlWoDCL+fU12KXC4HINy452lB/NcuKIxocL0Ut5ONb9lhmHgz8uXjmFg 8taw== 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=wlDWTRSDtzcsrS/LzPR3YwO7p6W49eS5hMAX/W8yQE0=; b=SNAQESDN5D6+nwkrKobmcpaR+BYnv3LkEJgWAuzc7JB8mGYPcLBhFRQa8al/RRkAp1 ytRkO71xG9es12kN04Wf7i8K9/0wch7GhQtxSro7aY2cgJbdBQeJRo07AZXMNJ0HHO7N tt1N35IQ4/jMDknsDa6DLMA/RpjhVnBeEIxCDG+f0QfiOKfwp2PgAmjN6Y9/7YyHB8S5 MwZFRrOzus4dKw9vIooyXzQvLGhT08PISHvZYWjHGT+KJOSLxRHQIsufkihLG0jaP+e7 FSjlUqhDgTgOUWo8j13gaWjHcgsjG2kWc8qunQBL3fLo+E/DJh9FjBPZ8RIcIr/2/pai b+Rg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=pRhLjYM0; 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 h11si5248683ede.45.2019.11.22.04.14.31; Fri, 22 Nov 2019 04:14:57 -0800 (PST) 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=pRhLjYM0; 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 S1727738AbfKVMKn (ORCPT + 99 others); Fri, 22 Nov 2019 07:10:43 -0500 Received: from mail-lj1-f193.google.com ([209.85.208.193]:46018 "EHLO mail-lj1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727312AbfKVMKn (ORCPT ); Fri, 22 Nov 2019 07:10:43 -0500 Received: by mail-lj1-f193.google.com with SMTP id n21so7050870ljg.12 for ; Fri, 22 Nov 2019 04:10:42 -0800 (PST) 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=wlDWTRSDtzcsrS/LzPR3YwO7p6W49eS5hMAX/W8yQE0=; b=pRhLjYM0wx/YizczTitjIGOaQJ3d7C3HKug/L0+xWBQiV0c0Nk9AKah2Tcvn321RB3 64UTqFpyIj5U2Ub+uUJK230TnnmsIC0mrbFcrSmcxEIUxGLmWyVS7j5EsqUE8B+GChJo lgeNS4EfhmVVmA559xgRF4VUIAPfwtS7U2APxgfRXw89iaTSfvKyb9t5ejHGo6AaRITK fCbEqJTC/0ae3U9y3iHN54/jQrdvW0XfE8xUf22m+gmlCdaMwCJ6ROoOu4ROGxijXKuZ vtmU2XXCvOaF4G3M1IsTO7THcDosvQdEjs+XpakwnqGfgryu+C3GHNuU6zcYnFW8J813 B9gw== 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=wlDWTRSDtzcsrS/LzPR3YwO7p6W49eS5hMAX/W8yQE0=; b=ZxpBA7an5Fp4gFkxL8ruEVop9It2UwvkyQzkNwdNeCgy9yXJt26+ws6FFSOaubB/eD /6eJP60b2rIei2T+eQjacPl4+hkPOuEUFDMrXv1hwa5qenfvvNDeS+pvJjVGgVBMZvRW p5AFVVrytEO2B0JpM9+TWsM8vWQbJS6NcogD66APCnWeIe2kM4y26jwUTTKcf9R41f0h sh8bRh6c+xGEMa+pUEkOj1kOwBz8N5w0HatuE4w8vKzLK/gyE4yQ8FK77VoNEV+4mC4t ZVhjXKjO2e1lLu9annpTjXMSMiza/2up402hVQORNHwAn5S35JCSo7jwWi7QGudktPV9 A19g== X-Gm-Message-State: APjAAAXqAyIPDVcfstGSgcvAWSxA08HN6FaV3cv9LCJMsw9SMPCVvh8F EeCkdty1ilmo6zt+Sh0NrjHRSCFZUVqwcvSXNgwKEQ== X-Received: by 2002:a2e:161b:: with SMTP id w27mr12053927ljd.183.1574424641250; Fri, 22 Nov 2019 04:10:41 -0800 (PST) MIME-Version: 1.0 References: <20191120133409.9217-1-peter.ujfalusi@ti.com> <20191120133409.9217-2-peter.ujfalusi@ti.com> In-Reply-To: <20191120133409.9217-2-peter.ujfalusi@ti.com> From: Linus Walleij Date: Fri, 22 Nov 2019 13:10:29 +0100 Message-ID: Subject: Re: [RFC 1/2] dt-bindings: gpio: Document shared GPIO line usage To: Peter Ujfalusi Cc: Bartosz Golaszewski , Rob Herring , "open list:GPIO SUBSYSTEM" , "linux-kernel@vger.kernel.org" , Marek Szyprowski , Mark Brown , 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 On Wed, Nov 20, 2019 at 2:34 PM Peter Ujfalusi wrote: > Boards might use the same GPIO line to control several external devices. > Add section to document on how a shared GPIO pin can be described. > > Signed-off-by: Peter Ujfalusi As I've stated earlier I think this information is surplus. If two devices have a phandle to the same GPIO line then it is by definition shared. > + line_a { > + gpio-shared; So this is unnecessary: if the same line is referenced by phandle from two places it is shared, simple as that. It is up to code in the operating system (like Linux) to detect if they are shared in practice (both consumer nodes are enabled) and then deal with the outcome. > + gpios = <5 0>; > + output-low; This is overlapping with the use case to define initial state values for GPIOs, something that has been brought up repeatedly and I've collected links for previous discussions several times. I guess if need be I have to look them up again. The DT maintainers don't like the hog syntax so something else is desired for this. > + refcounted-high; (snip) > +The shared GPIO line management strategy can be selected with either of the > +following properties: > +- refcounted-low: The line must be kept low as long as there is at least one > + request asking it to be low. > +- refcounted-high: The line must be kept high as long as there is at least one > + request asking it to be high. Is this really needed? Isn't it more appropriate to just define the semantics such that as soon as some consumer requests the line high it will be refcounted high, and as soon as it is requested low by any consumer it will be refcounted low. > +If neither of the refcounting strategy was selected then the shared GPIO is > +handled as pass through. In this mode all user requests will be forwarded to the > +shared GPIO pin without refcounting. Why should this even be allowed? If we are defining a special semantic for refcounted GPIOs (even defining a separate API in the Linux OS, though it is beside the point) why do we have to have a fallback to the old behaviour at all? I think you can do this by just detecting multiple phandles to the same GPIO and implicit refcounting for > 1 consumers. I.e. no new bindings at all, maybe some patches explaining the semantic effect of using the same GPIO from two consumer nodes. Yours, Linus Walleij