Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1555685 > unrolled thread

[PATCH] regulator: anatop: Add support for "anatop-enable-bit"

Started byAndrey Smirnov <andrew.smirnov@gmail.com>
First post2017-01-10 17:40 +0100
Last post2017-01-13 18:20 +0100
Articles 3 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH] regulator: anatop: Add support for "anatop-enable-bit" Andrey Smirnov <andrew.smirnov@gmail.com> - 2017-01-10 17:40 +0100
    Re: [PATCH] regulator: anatop: Add support for "anatop-enable-bit" Rob Herring <robh@kernel.org> - 2017-01-13 18:10 +0100
      Re: [PATCH] regulator: anatop: Add support for "anatop-enable-bit" Rob Herring <robh@kernel.org> - 2017-01-13 18:20 +0100

#1555685 — [PATCH] regulator: anatop: Add support for "anatop-enable-bit"

FromAndrey Smirnov <andrew.smirnov@gmail.com>
Date2017-01-10 17:40 +0100
Subject[PATCH] regulator: anatop: Add support for "anatop-enable-bit"
Message-ID<sY7CO-3Fl-25@gated-at.bofh.it>
Add code to support support for "anatop-enable-bit" device-tree
property. This property translates to LINREG_ENABLE bit in real hardware
and is present on 1p1, 2p5 and 3p0 regulators on i.MX6 and 1p0d regulator
on i.MX7.

Cc: yurovsky@gmail.com
Cc: Liam Girdwood <lgirdwood@gmail.com>
Cc: Mark Brown <broonie@kernel.org>
Cc: Rob Herring <robh+dt@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Shawn Guo <shawnguo@kernel.org>
Cc: devicetree@vger.kernel.org
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
---

Note: "anatop-enable-bit" has already found its way into upstream tree
before this patch (probably not on purpose). See imx6ul.dtsi and
imx7s.dtsi for concrete examples

 .../devicetree/bindings/regulator/anatop-regulator.txt       |  1 +
 drivers/regulator/anatop-regulator.c                         | 12 ++++++++++++
 2 files changed, 13 insertions(+)

diff --git a/Documentation/devicetree/bindings/regulator/anatop-regulator.txt b/Documentation/devicetree/bindings/regulator/anatop-regulator.txt
index 37c4ea0..1d58c8c 100644
--- a/Documentation/devicetree/bindings/regulator/anatop-regulator.txt
+++ b/Documentation/devicetree/bindings/regulator/anatop-regulator.txt
@@ -14,6 +14,7 @@ Optional properties:
 - anatop-delay-bit-shift: Bit shift for the step time register
 - anatop-delay-bit-width: Number of bits used in the step time register
 - vin-supply: The supply for this regulator
+- anatop-enable-bit: Regulator enable bit offset
 
 Any property defined as part of the core regulator
 binding, defined in regulator.txt, can also be used.
diff --git a/drivers/regulator/anatop-regulator.c b/drivers/regulator/anatop-regulator.c
index 3a6d029..b041f27 100644
--- a/drivers/regulator/anatop-regulator.c
+++ b/drivers/regulator/anatop-regulator.c
@@ -301,7 +301,19 @@ static int anatop_regulator_probe(struct platform_device *pdev)
 			return -EINVAL;
 		}
 	} else {
+		u32 enable_bit;
+
 		rdesc->ops = &anatop_rops;
+
+		if (!of_property_read_u32(np, "anatop-enable-bit",
+					  &enable_bit)) {
+			anatop_rops.enable  = regulator_enable_regmap;
+			anatop_rops.disable = regulator_disable_regmap;
+			anatop_rops.is_enabled = regulator_is_enabled_regmap;
+
+			rdesc->enable_reg = sreg->control_reg;
+			rdesc->enable_mask = BIT(enable_bit);
+		}
 	}
 
 	/* register regulator */
-- 
2.9.3

[toc] | [next] | [standalone]


#1558598

FromRob Herring <robh@kernel.org>
Date2017-01-13 18:10 +0100
Message-ID<sZdwu-3x7-31@gated-at.bofh.it>
In reply to#1555685
On Tue, Jan 10, 2017 at 08:30:14AM -0800, Andrey Smirnov wrote:
> Add code to support support for "anatop-enable-bit" device-tree
> property. This property translates to LINREG_ENABLE bit in real hardware
> and is present on 1p1, 2p5 and 3p0 regulators on i.MX6 and 1p0d regulator
> on i.MX7.
> 
> Cc: yurovsky@gmail.com
> Cc: Liam Girdwood <lgirdwood@gmail.com>
> Cc: Mark Brown <broonie@kernel.org>
> Cc: Rob Herring <robh+dt@kernel.org>
> Cc: Mark Rutland <mark.rutland@arm.com>
> Cc: Shawn Guo <shawnguo@kernel.org>
> Cc: devicetree@vger.kernel.org
> Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
> ---
> 
> Note: "anatop-enable-bit" has already found its way into upstream tree
> before this patch (probably not on purpose). See imx6ul.dtsi and
> imx7s.dtsi for concrete examples

But since the kernel is not using it, it doesn't really mean we have to 
keep it. Yes, other OSs could be, but that's unlikely.

>  .../devicetree/bindings/regulator/anatop-regulator.txt       |  1 +
>  drivers/regulator/anatop-regulator.c                         | 12 ++++++++++++
>  2 files changed, 13 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/regulator/anatop-regulator.txt b/Documentation/devicetree/bindings/regulator/anatop-regulator.txt
> index 37c4ea0..1d58c8c 100644
> --- a/Documentation/devicetree/bindings/regulator/anatop-regulator.txt
> +++ b/Documentation/devicetree/bindings/regulator/anatop-regulator.txt
> @@ -14,6 +14,7 @@ Optional properties:
>  - anatop-delay-bit-shift: Bit shift for the step time register
>  - anatop-delay-bit-width: Number of bits used in the step time register
>  - vin-supply: The supply for this regulator
> +- anatop-enable-bit: Regulator enable bit offset

Looks like we have several properties describing the register layout. 
IMO, we should drop all of them and use the compatible strings to 
determine those instead.

Rob

[toc] | [prev] | [next] | [standalone]


#1558611

FromRob Herring <robh@kernel.org>
Date2017-01-13 18:20 +0100
Message-ID<sZdGa-3Aq-27@gated-at.bofh.it>
In reply to#1558598
On Fri, Jan 13, 2017 at 11:07:42AM -0600, Rob Herring wrote:
> On Tue, Jan 10, 2017 at 08:30:14AM -0800, Andrey Smirnov wrote:
> > Add code to support support for "anatop-enable-bit" device-tree
> > property. This property translates to LINREG_ENABLE bit in real hardware
> > and is present on 1p1, 2p5 and 3p0 regulators on i.MX6 and 1p0d regulator
> > on i.MX7.
> > 
> > Cc: yurovsky@gmail.com
> > Cc: Liam Girdwood <lgirdwood@gmail.com>
> > Cc: Mark Brown <broonie@kernel.org>
> > Cc: Rob Herring <robh+dt@kernel.org>
> > Cc: Mark Rutland <mark.rutland@arm.com>
> > Cc: Shawn Guo <shawnguo@kernel.org>
> > Cc: devicetree@vger.kernel.org
> > Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
> > ---
> > 
> > Note: "anatop-enable-bit" has already found its way into upstream tree
> > before this patch (probably not on purpose). See imx6ul.dtsi and
> > imx7s.dtsi for concrete examples
> 
> But since the kernel is not using it, it doesn't really mean we have to 
> keep it. Yes, other OSs could be, but that's unlikely.
> 
> >  .../devicetree/bindings/regulator/anatop-regulator.txt       |  1 +
> >  drivers/regulator/anatop-regulator.c                         | 12 ++++++++++++
> >  2 files changed, 13 insertions(+)
> > 
> > diff --git a/Documentation/devicetree/bindings/regulator/anatop-regulator.txt b/Documentation/devicetree/bindings/regulator/anatop-regulator.txt
> > index 37c4ea0..1d58c8c 100644
> > --- a/Documentation/devicetree/bindings/regulator/anatop-regulator.txt
> > +++ b/Documentation/devicetree/bindings/regulator/anatop-regulator.txt
> > @@ -14,6 +14,7 @@ Optional properties:
> >  - anatop-delay-bit-shift: Bit shift for the step time register
> >  - anatop-delay-bit-width: Number of bits used in the step time register
> >  - vin-supply: The supply for this regulator
> > +- anatop-enable-bit: Regulator enable bit offset
> 
> Looks like we have several properties describing the register layout. 
> IMO, we should drop all of them and use the compatible strings to 
> determine those instead.

NM, I see this on each regulator...

Acked-by: Rob Herring <robh@kernel.org>

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web