linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 2/2] ARM: sun8i: h3: add SY8113B regulator on Banana Pi M2 Zero board
@ 2018-07-11 13:44 Icenowy Zheng
  2018-07-11 14:15 ` [linux-sunxi] " Chen-Yu Tsai
  2018-07-12  7:23 ` Maxime Ripard
  0 siblings, 2 replies; 4+ messages in thread
From: Icenowy Zheng @ 2018-07-11 13:44 UTC (permalink / raw)
  To: Maxime Ripard, Chen-Yu Tsai
  Cc: devicetree, linux-arm-kernel, linux-kernel, linux-sunxi, Icenowy Zheng

Banana Pi M2 Zero board has a SY8113B regulator, which is controlled via
GPIO and capable of outputing 1.1V when the PL1 GPIO is set to output 0
or 1.1V when the PL6 GPIO is set to input or output 1, and the output is
the power supply of the ARM cores in H3 SoC.

Add the device tree node of this regulator and set the cpu's cpu-supply
property to it.

Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
---
 .../dts/sun8i-h2-plus-bananapi-m2-zero.dts    | 21 +++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/arch/arm/boot/dts/sun8i-h2-plus-bananapi-m2-zero.dts b/arch/arm/boot/dts/sun8i-h2-plus-bananapi-m2-zero.dts
index eb61dcf32797..abc8dc750f4b 100644
--- a/arch/arm/boot/dts/sun8i-h2-plus-bananapi-m2-zero.dts
+++ b/arch/arm/boot/dts/sun8i-h2-plus-bananapi-m2-zero.dts
@@ -59,6 +59,23 @@
 		};
 	};
 
+	reg_vdd_cpux: vdd-cpux-regulator {
+		compatible = "regulator-gpio";
+		regulator-name = "vdd-cpux";
+		regulator-type = "voltage";
+		regulator-boot-on;
+		regulator-always-on;
+		regulator-min-microvolt = <1100000>;
+		regulator-max-microvolt = <1300000>;
+		regulator-ramp-delay = <50>; /* 4ms */
+
+		gpios = <&r_pio 0 1 GPIO_ACTIVE_HIGH>; /* PL1 */
+		enable-active-high;
+		gpios-states = <0x1>;
+		states = <1100000 0x0
+			  1300000 0x1>;
+	};
+
 	wifi_pwrseq: wifi_pwrseq {
 		compatible = "mmc-pwrseq-simple";
 		pinctrl-names = "default";
@@ -66,6 +83,10 @@
 	};
 };
 
+&cpu0 {
+	cpu-supply = <&reg_vdd_cpux>;
+};
+
 &de {
 	status = "okay";
 };
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [linux-sunxi] [PATCH 2/2] ARM: sun8i: h3: add SY8113B regulator on Banana Pi M2 Zero board
  2018-07-11 13:44 [PATCH 2/2] ARM: sun8i: h3: add SY8113B regulator on Banana Pi M2 Zero board Icenowy Zheng
@ 2018-07-11 14:15 ` Chen-Yu Tsai
  2018-07-11 14:18   ` Icenowy Zheng
  2018-07-12  7:23 ` Maxime Ripard
  1 sibling, 1 reply; 4+ messages in thread
From: Chen-Yu Tsai @ 2018-07-11 14:15 UTC (permalink / raw)
  To: Icenowy Zheng
  Cc: Maxime Ripard, devicetree, linux-arm-kernel, linux-kernel, linux-sunxi

Hi,

On Wed, Jul 11, 2018 at 9:44 PM, Icenowy Zheng <icenowy@aosc.io> wrote:
> Banana Pi M2 Zero board has a SY8113B regulator, which is controlled via
> GPIO and capable of outputing 1.1V when the PL1 GPIO is set to output 0
> or 1.1V when the PL6 GPIO is set to input or output 1, and the output is
> the power supply of the ARM cores in H3 SoC.
>
> Add the device tree node of this regulator and set the cpu's cpu-supply
> property to it.
>
> Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
> ---
>  .../dts/sun8i-h2-plus-bananapi-m2-zero.dts    | 21 +++++++++++++++++++
>  1 file changed, 21 insertions(+)
>
> diff --git a/arch/arm/boot/dts/sun8i-h2-plus-bananapi-m2-zero.dts b/arch/arm/boot/dts/sun8i-h2-plus-bananapi-m2-zero.dts
> index eb61dcf32797..abc8dc750f4b 100644
> --- a/arch/arm/boot/dts/sun8i-h2-plus-bananapi-m2-zero.dts
> +++ b/arch/arm/boot/dts/sun8i-h2-plus-bananapi-m2-zero.dts
> @@ -59,6 +59,23 @@
>                 };
>         };
>
> +       reg_vdd_cpux: vdd-cpux-regulator {
> +               compatible = "regulator-gpio";
> +               regulator-name = "vdd-cpux";
> +               regulator-type = "voltage";
> +               regulator-boot-on;
> +               regulator-always-on;
> +               regulator-min-microvolt = <1100000>;
> +               regulator-max-microvolt = <1300000>;
> +               regulator-ramp-delay = <50>; /* 4ms */
> +
> +               gpios = <&r_pio 0 1 GPIO_ACTIVE_HIGH>; /* PL1 */
> +               enable-active-high;
> +               gpios-states = <0x1>;
> +               states = <1100000 0x0

So looking at the schematics with the resistor values, this calculates
to roughly 1.108475 (0.6 * (1 + 10 / 11.8)) ...

> +                         1300000 0x1>;

and this to 1.308475.

ChenYu

> +       };
> +
>         wifi_pwrseq: wifi_pwrseq {
>                 compatible = "mmc-pwrseq-simple";
>                 pinctrl-names = "default";
> @@ -66,6 +83,10 @@
>         };
>  };
>
> +&cpu0 {
> +       cpu-supply = <&reg_vdd_cpux>;
> +};
> +
>  &de {
>         status = "okay";
>  };
> --
> 2.17.1
>
> --
> You received this message because you are subscribed to the Google Groups "linux-sunxi" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi+unsubscribe@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [linux-sunxi] [PATCH 2/2] ARM: sun8i: h3: add SY8113B regulator on Banana Pi M2 Zero board
  2018-07-11 14:15 ` [linux-sunxi] " Chen-Yu Tsai
@ 2018-07-11 14:18   ` Icenowy Zheng
  0 siblings, 0 replies; 4+ messages in thread
From: Icenowy Zheng @ 2018-07-11 14:18 UTC (permalink / raw)
  To: wens, Chen-Yu Tsai
  Cc: Maxime Ripard, devicetree, linux-arm-kernel, linux-kernel, linux-sunxi



于 2018年7月11日 GMT+08:00 下午10:15:41, Chen-Yu Tsai <wens@csie.org> 写到:
>Hi,
>
>On Wed, Jul 11, 2018 at 9:44 PM, Icenowy Zheng <icenowy@aosc.io> wrote:
>> Banana Pi M2 Zero board has a SY8113B regulator, which is controlled
>via
>> GPIO and capable of outputing 1.1V when the PL1 GPIO is set to output
>0
>> or 1.1V when the PL6 GPIO is set to input or output 1, and the output
>is
>> the power supply of the ARM cores in H3 SoC.
>>
>> Add the device tree node of this regulator and set the cpu's
>cpu-supply
>> property to it.
>>
>> Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
>> ---
>>  .../dts/sun8i-h2-plus-bananapi-m2-zero.dts    | 21
>+++++++++++++++++++
>>  1 file changed, 21 insertions(+)
>>
>> diff --git a/arch/arm/boot/dts/sun8i-h2-plus-bananapi-m2-zero.dts
>b/arch/arm/boot/dts/sun8i-h2-plus-bananapi-m2-zero.dts
>> index eb61dcf32797..abc8dc750f4b 100644
>> --- a/arch/arm/boot/dts/sun8i-h2-plus-bananapi-m2-zero.dts
>> +++ b/arch/arm/boot/dts/sun8i-h2-plus-bananapi-m2-zero.dts
>> @@ -59,6 +59,23 @@
>>                 };
>>         };
>>
>> +       reg_vdd_cpux: vdd-cpux-regulator {
>> +               compatible = "regulator-gpio";
>> +               regulator-name = "vdd-cpux";
>> +               regulator-type = "voltage";
>> +               regulator-boot-on;
>> +               regulator-always-on;
>> +               regulator-min-microvolt = <1100000>;
>> +               regulator-max-microvolt = <1300000>;
>> +               regulator-ramp-delay = <50>; /* 4ms */
>> +
>> +               gpios = <&r_pio 0 1 GPIO_ACTIVE_HIGH>; /* PL1 */
>> +               enable-active-high;
>> +               gpios-states = <0x1>;
>> +               states = <1100000 0x0
>
>So looking at the schematics with the resistor values, this calculates
>to roughly 1.108475 (0.6 * (1 + 10 / 11.8)) ...
>
>> +                         1300000 0x1>;
>
>and this to 1.308475.

But I think it cannot reach such accuracy, because of the
error of component values and the error of the power voltage.

In addition, set it to a too accurate value may break the
common opp table.

>
>ChenYu
>
>> +       };
>> +
>>         wifi_pwrseq: wifi_pwrseq {
>>                 compatible = "mmc-pwrseq-simple";
>>                 pinctrl-names = "default";
>> @@ -66,6 +83,10 @@
>>         };
>>  };
>>
>> +&cpu0 {
>> +       cpu-supply = <&reg_vdd_cpux>;
>> +};
>> +
>>  &de {
>>         status = "okay";
>>  };
>> --
>> 2.17.1
>>
>> --
>> You received this message because you are subscribed to the Google
>Groups "linux-sunxi" group.
>> To unsubscribe from this group and stop receiving emails from it,
>send an email to linux-sunxi+unsubscribe@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 2/2] ARM: sun8i: h3: add SY8113B regulator on Banana Pi M2 Zero board
  2018-07-11 13:44 [PATCH 2/2] ARM: sun8i: h3: add SY8113B regulator on Banana Pi M2 Zero board Icenowy Zheng
  2018-07-11 14:15 ` [linux-sunxi] " Chen-Yu Tsai
@ 2018-07-12  7:23 ` Maxime Ripard
  1 sibling, 0 replies; 4+ messages in thread
From: Maxime Ripard @ 2018-07-12  7:23 UTC (permalink / raw)
  To: Icenowy Zheng
  Cc: Chen-Yu Tsai, devicetree, linux-arm-kernel, linux-kernel, linux-sunxi

[-- Attachment #1: Type: text/plain, Size: 636 bytes --]

On Wed, Jul 11, 2018 at 09:44:50PM +0800, Icenowy Zheng wrote:
> Banana Pi M2 Zero board has a SY8113B regulator, which is controlled via
> GPIO and capable of outputing 1.1V when the PL1 GPIO is set to output 0
> or 1.1V when the PL6 GPIO is set to input or output 1, and the output is
> the power supply of the ARM cores in H3 SoC.
> 
> Add the device tree node of this regulator and set the cpu's cpu-supply
> property to it.
> 
> Signed-off-by: Icenowy Zheng <icenowy@aosc.io>

Applied, thanks!
Maxime

-- 
Maxime Ripard, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-07-12  7:23 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-11 13:44 [PATCH 2/2] ARM: sun8i: h3: add SY8113B regulator on Banana Pi M2 Zero board Icenowy Zheng
2018-07-11 14:15 ` [linux-sunxi] " Chen-Yu Tsai
2018-07-11 14:18   ` Icenowy Zheng
2018-07-12  7:23 ` Maxime Ripard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).