Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp4292818ybl; Tue, 20 Aug 2019 09:42:14 -0700 (PDT) X-Google-Smtp-Source: APXvYqziwkggmE/pPRYWWaEtKbLajA0kESUhuYfLKv8m3j0iAXFuiaOF7tWcQ1tgAWbuwMxSBdvP X-Received: by 2002:a17:90a:2a48:: with SMTP id d8mr928458pjg.70.1566319334733; Tue, 20 Aug 2019 09:42:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566319334; cv=none; d=google.com; s=arc-20160816; b=NoRKC/IJUaYzdIwlLUBdJYXkMQj1ryoYHbW+CfnaQU8ZwkVU5+QF4WsxH2AsjDbBVJ 6c7aLjTq31vmbBlhkTIK5M7jPQPkEqF7FPFsw9e+qWGTUDARz8nbcaR9f8wFjOmvUwXm BHNKZKpJ2V0DfCNCLry84Awd/oVvr1Gq3ACWaORGtbT3JczJsP/FfY1J+RXNOVKw4cPP 8DEqxV8O2CzuGKOcnyqOi6xtaapMqlPSZk34w7RvqQ2Wq8KFbToxAK8vnn93Z7b2184l 8zCgKg6RG4eR0hkW7QniQzezMvv86UN2DfnYZgD72uX0PHme7/xanrsDi7JzLRExNaPa CTTA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=HbXsRSoZRABGfZkiNoOU5Ljrb68OZSqpRD5cEsDPJJ0=; b=s7Soj0K1bvCdN7AIybdnxA6ZpC9Uo0/RqyJDFtR+0PIluCQBYkUrwiqm+kZDe7vkxr EMNY+ZN5i1MJfB29XGf1lW13AdlAiUxEdcvjAdkduwF/8xl6carx4hAYDv3zGtR5xsTR Duy3MLYdVKojB6n3+bUKXtSjKyhtjXc4gxAChgpVi/yGwYq9WMSCZjg+B9JSrzjecxRa eIa4M1TLpXGAL5E8iMcX9yFhIX1xmQbYEhsYNIgMveyfUIYBSpxzFiOzrenF/rjI6j8v vYFYbc5UZUq9iVdJZMw+U6lULh4IjMF7aBPQ7U17y2nOf2OG6/NYHoiUxZMJ6Al0TtX6 klTA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=DElMqDuD; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b24si13563238pfi.180.2019.08.20.09.41.59; Tue, 20 Aug 2019 09:42:14 -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=@kernel.org header.s=default header.b=DElMqDuD; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730399AbfHTQjm (ORCPT + 99 others); Tue, 20 Aug 2019 12:39:42 -0400 Received: from mail.kernel.org ([198.145.29.99]:58640 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725983AbfHTQjm (ORCPT ); Tue, 20 Aug 2019 12:39:42 -0400 Received: from mail-qk1-f174.google.com (mail-qk1-f174.google.com [209.85.222.174]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id CB5F022DD3; Tue, 20 Aug 2019 16:39:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1566319180; bh=veCX3JRCfSZHvEnItISPv2HdfktZ61+FPhofkrQuQUA=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=DElMqDuDa0Ao7h8uyG4MMeOdMC48rGY0ZtAT8ieDY32nxAnK60GGzIiGEqEWxRG32 /w5xGLBTfniHaeOr13JNUb6kySAnslvYedWh4sws8favcIU9VbK0RrzrCbH1wVkVoJ 1lU2aaHBPaEwM/GHNeDMGV2/QXGdLezsapQC3yzM= Received: by mail-qk1-f174.google.com with SMTP id m2so5027896qkd.10; Tue, 20 Aug 2019 09:39:40 -0700 (PDT) X-Gm-Message-State: APjAAAUbA7HewrJNLVO7voIQup5vu91NVtYCBoc3CHwkh0vWxjfu42Rg wDQ25Hip95trQK0xa61sbVGriNceE7/Dq/1EWw== X-Received: by 2002:a37:a44a:: with SMTP id n71mr26455136qke.393.1566319180031; Tue, 20 Aug 2019 09:39:40 -0700 (PDT) MIME-Version: 1.0 References: <20190820152511.15307-1-u.kleine-koenig@pengutronix.de> In-Reply-To: <20190820152511.15307-1-u.kleine-koenig@pengutronix.de> From: Rob Herring Date: Tue, 20 Aug 2019 11:39:27 -0500 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH RFC] dt-bindings: regulator: define a mux regulator To: =?UTF-8?Q?Uwe_Kleine=2DK=C3=B6nig?= Cc: Liam Girdwood , Mark Brown , Mark Rutland , Sascha Hauer , devicetree@vger.kernel.org, "linux-kernel@vger.kernel.org" , "moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Aug 20, 2019 at 10:25 AM Uwe Kleine-K=C3=B6nig wrote: > > A mux regulator is used to provide current on one of several outputs. It > might look as follows: > > ,------------. > -- -- -- -- -- -- -- -- `------------' > > Depending on which address is encoded on the three address inputs A0, A1 > and A2 the current provided on IN is provided on one of the eight > outputs. > > What is new here is that the binding makes use of a #regulator-cells > property. This uses the approach known from other bindings (e.g. gpio) > to allow referencing all eight outputs with phandle arguments. This > requires an extention in of_get_regulator to use a new variant of > of_parse_phandle_with_args that has a cell_count_default parameter that > is used in absence of a $cell_name property. Even if we'd choose to > update all regulator-bindings to add #regulator-cells =3D <0>; we still > needed something to implement compatibility to the currently defined > bindings. > > Signed-off-by: Uwe Kleine-K=C3=B6nig > --- > Hello, > > the obvious alternative is to add (here) eight subnodes to represent the > eight outputs. This is IMHO less pretty, but wouldn't need to introduce > #regulator-cells. I'm okay with #regulator-cells approach. > > Apart from reg =3D <..> and a phandle there is (I think) nothing that > needs to be specified in the subnodes because all properties of an > output (apart from the address) apply to all outputs. > > What do you think? > > Best regards > Uwe > > .../bindings/regulator/mux-regulator.yaml | 52 +++++++++++++++++++ > 1 file changed, 52 insertions(+) > create mode 100644 Documentation/devicetree/bindings/regulator/mux-regul= ator.yaml > > diff --git a/Documentation/devicetree/bindings/regulator/mux-regulator.ya= ml b/Documentation/devicetree/bindings/regulator/mux-regulator.yaml > new file mode 100644 > index 000000000000..f06dbb969090 > --- /dev/null > +++ b/Documentation/devicetree/bindings/regulator/mux-regulator.yaml > @@ -0,0 +1,52 @@ > +# SPDX-License-Identifier: GPL-2.0 (GPL-2.0-only OR BSD-2-Clause) is preferred. > +%YAML 1.2 > +--- > +$id: http://devicetree.org/schemas/regulator/mux-regulator.yaml# > +$schema: http://devicetree.org/meta-schemas/core.yaml# > + > +title: MUX regulators > + > +properties: > + compatible: > + const: XXX,adb708 ? I assume you will split this into a common and specific schemas. I suppose there could be differing ways to control the mux just like all other muxes. > + > + enable-gpios: > + maxItems: 1 > + > + address-gpios: > + description: Array of typically three GPIO pins used to select the > + regulator's output. The least significant address GPIO must be lis= ted > + first. The others follow in order of significance. > + minItems: 1 > + > + "#regulator-cells": How is this not required? > + const: 1 > + > + regulator-name: > + description: A string used to construct the sub regulator's names > + $ref: "/schemas/types.yaml#/definitions/string" > + > + supply: > + description: input supply > + > +required: > + - compatible > + - regulator-name > + - supply > + > + > +examples: > + - | > + mux-regulator { > + compatible =3D "regulator-mux"; > + > + regulator-name =3D "blafasel"; > + > + supply =3D <&muxin_regulator>; > + > + enable-gpios =3D <&gpio2 5 GPIO_ACTIVE_HIGH>; > + address-gpios =3D <&gpio2 2 GPIO_ACTIVE_HIGH>, > + <&gpio2 3 GPIO_ACTIVE_HIGH>, > + <&gpio2 4 GPIO_ACTIVE_HIGH>, > + }; > +... > -- > 2.20.1 >