[linux,dev-4.17] ARM: dts: aspeed: romulus: Enable iio-hwmon-battery

Message ID 1532669385-45493-1-git-send-email-mine260309@gmail.com
State Rejected, archived
Headers show
Series
  • [linux,dev-4.17] ARM: dts: aspeed: romulus: Enable iio-hwmon-battery
Related show

Commit Message

Lei YU July 27, 2018, 5:29 a.m.
Add iio-hwmon-battery using adc channel 12;
Pull GPIOR3 high to enable RTC_ADC;
Enable adc to make adc running.

Signed-off-by: Lei YU <mine260309@gmail.com>
---
 arch/arm/boot/dts/aspeed-bmc-opp-romulus.dts | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

Comments

Lei YU July 30, 2018, 2:29 a.m. | #1
Please do NOT merge this patch, as toggling GPIOR3 drains the battery.
On Fri, Jul 27, 2018 at 1:29 PM Lei YU <mine260309@gmail.com> wrote:
>
> Add iio-hwmon-battery using adc channel 12;
> Pull GPIOR3 high to enable RTC_ADC;
> Enable adc to make adc running.
>
> Signed-off-by: Lei YU <mine260309@gmail.com>
> ---
>  arch/arm/boot/dts/aspeed-bmc-opp-romulus.dts | 15 +++++++++++++++
>  1 file changed, 15 insertions(+)
>
> diff --git a/arch/arm/boot/dts/aspeed-bmc-opp-romulus.dts b/arch/arm/boot/dts/aspeed-bmc-opp-romulus.dts
> index 852b552..461564c 100644
> --- a/arch/arm/boot/dts/aspeed-bmc-opp-romulus.dts
> +++ b/arch/arm/boot/dts/aspeed-bmc-opp-romulus.dts
> @@ -83,6 +83,11 @@
>                         linux,code = <ASPEED_GPIO(Q, 7)>;
>                 };
>         };
> +
> +       iio-hwmon-battery {
> +               compatible = "iio-hwmon";
> +               io-channels = <&adc 12>;
> +       };
>  };
>
>  #include "ibm-power9-cfam.dtsi"
> @@ -236,6 +241,12 @@
>                 output-low;
>                 line-name = "seq_cont";
>         };
> +       rtc_adc_en {
> +               gpio-hog;
> +               gpios = <ASPEED_GPIO(R, 3) GPIO_ACTIVE_HIGH>;
> +               output-high;
> +               line-name = "rtc_adc_en";
> +       };
>  };
>
>  &vuart {
> @@ -304,3 +315,7 @@
>         status = "okay";
>  };
>
> +&adc {
> +       status = "okay";
> +};
> +
> --
> 2.7.4
>

Patch

diff --git a/arch/arm/boot/dts/aspeed-bmc-opp-romulus.dts b/arch/arm/boot/dts/aspeed-bmc-opp-romulus.dts
index 852b552..461564c 100644
--- a/arch/arm/boot/dts/aspeed-bmc-opp-romulus.dts
+++ b/arch/arm/boot/dts/aspeed-bmc-opp-romulus.dts
@@ -83,6 +83,11 @@ 
 			linux,code = <ASPEED_GPIO(Q, 7)>;
 		};
 	};
+
+	iio-hwmon-battery {
+		compatible = "iio-hwmon";
+		io-channels = <&adc 12>;
+	};
 };
 
 #include "ibm-power9-cfam.dtsi"
@@ -236,6 +241,12 @@ 
 		output-low;
 		line-name = "seq_cont";
 	};
+	rtc_adc_en {
+		gpio-hog;
+		gpios = <ASPEED_GPIO(R, 3) GPIO_ACTIVE_HIGH>;
+		output-high;
+		line-name = "rtc_adc_en";
+	};
 };
 
 &vuart {
@@ -304,3 +315,7 @@ 
 	status = "okay";
 };
 
+&adc {
+	status = "okay";
+};
+