diff mbox

ARM: dts: exynos5422-odroidxu3: add INA2xx sensors

Message ID 1421193801-24637-1-git-send-email-khilman@kernel.org (mailing list archive)
State New, archived
Headers show

Commit Message

Kevin Hilman Jan. 14, 2015, 12:03 a.m. UTC
From: Kevin Hilman <khilman@linaro.org>

The odroid-xu3 has 4 INA231 current sensors on board which can be
accessed from the Linux via the hwmon interface.

There is one sensor for each of these power rails:

- A15 cluster: VDD_ARM
- A7 cluster: VDD_KFC
- GPU: VDD_G3D
- memory: VDD_MEM

In addition to adding the sensors, LDO26 from the PMIC needs to be
enabled because it's powering these sensor.

Cc: Javier Martinez Canillas <javier.martinez@collabora.co.uk>
Cc: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
Signed-off-by: Kevin Hilman <khilman@linaro.org>
---
Applies on top of "ARM: dts: Add dts file for odroid XU3 board" from Sjoerd Simons.

 arch/arm/boot/dts/exynos5422-odroidxu3.dts | 39 ++++++++++++++++++++++++++++++
 1 file changed, 39 insertions(+)

Comments

kgene@kernel.org Jan. 14, 2015, 3:55 p.m. UTC | #1
On 01/14/15 09:03, Kevin Hilman wrote:
> From: Kevin Hilman <khilman@linaro.org>
> 
> The odroid-xu3 has 4 INA231 current sensors on board which can be
> accessed from the Linux via the hwmon interface.
> 
> There is one sensor for each of these power rails:
> 
> - A15 cluster: VDD_ARM
> - A7 cluster: VDD_KFC
> - GPU: VDD_G3D
> - memory: VDD_MEM
> 
> In addition to adding the sensors, LDO26 from the PMIC needs to be
> enabled because it's powering these sensor.
> 
> Cc: Javier Martinez Canillas <javier.martinez@collabora.co.uk>
> Cc: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
> Signed-off-by: Kevin Hilman <khilman@linaro.org>
> ---
> Applies on top of "ARM: dts: Add dts file for odroid XU3 board" from Sjoerd Simons.
> 
>  arch/arm/boot/dts/exynos5422-odroidxu3.dts | 39 ++++++++++++++++++++++++++++++
>  1 file changed, 39 insertions(+)
> 
> diff --git a/arch/arm/boot/dts/exynos5422-odroidxu3.dts b/arch/arm/boot/dts/exynos5422-odroidxu3.dts
> index c29123c0734d..7874da20939f 100644
> --- a/arch/arm/boot/dts/exynos5422-odroidxu3.dts
> +++ b/arch/arm/boot/dts/exynos5422-odroidxu3.dts
> @@ -174,6 +174,13 @@
>  					regulator-always-on;
>  				};
>  
> +				ldo26_reg: LDO26 {
> +					regulator-name = "vdd_ldo26";
> +					regulator-min-microvolt = <3000000>;
> +					regulator-max-microvolt = <3000000>;
> +					regulator-always-on;
> +				};
> +
>  				buck1_reg: BUCK1 {
>  					regulator-name = "vdd_mif";
>  					regulator-min-microvolt = <800000>;
> @@ -257,6 +264,38 @@
>  		};
>  	};
>  
> +	i2c_0: i2c@12C60000 {
> +		status = "okay";
> +
> +		/* A15 cluster: VDD_ARM */
> +		ina220@40 {
> +			compatible = "ti,ina230";
> +			reg = <0x40>;
> +			shunt-resistor = <10000>;
> +		};
> +
> +		/* memory: VDD_MEM */
> +		ina220@41 {
> +			compatible = "ti,ina230";
> +			reg = <0x41>;
> +			shunt-resistor = <10000>;
> +		};
> +
> +		/* GPU: VDD_G3D */
> +		ina220@44 {
> +			compatible = "ti,ina230";
> +			reg = <0x44>;
> +			shunt-resistor = <10000>;
> +		};
> +
> +		/* A7 cluster: VDD_KFC */
> +		ina220@45 {
> +			compatible = "ti,ina230";
> +			reg = <0x45>;
> +			shunt-resistor = <10000>;
> +		};
> +	};
> +
>  	i2c_2: i2c@12C80000 {
>  		samsung,i2c-sda-delay = <100>;
>  		samsung,i2c-max-bus-freq = <66000>;

Looks good to me and applied. To be honest, I'm not sure about the
values in the node of shunt-resistor though ;)

Thanks,
Kukjin
Sjoerd Simons Jan. 14, 2015, 9:25 p.m. UTC | #2
Hey kevin,

On Tue, 2015-01-13 at 16:03 -0800, Kevin Hilman wrote:
> From: Kevin Hilman <khilman@linaro.org>
> 
> The odroid-xu3 has 4 INA231 current sensors on board which can be
> accessed from the Linux via the hwmon interface.
> 
> There is one sensor for each of these power rails:
> 
> - A15 cluster: VDD_ARM
> - A7 cluster: VDD_KFC
> - GPU: VDD_G3D
> - memory: VDD_MEM
> 
> In addition to adding the sensors, LDO26 from the PMIC needs to be
> enabled because it's powering these sensor.
> 
> Cc: Javier Martinez Canillas <javier.martinez@collabora.co.uk>
> Cc: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
> Signed-off-by: Kevin Hilman <khilman@linaro.org>
> ---
> Applies on top of "ARM: dts: Add dts file for odroid XU3 board" from Sjoerd Simons.
> 
>  arch/arm/boot/dts/exynos5422-odroidxu3.dts | 39 ++++++++++++++++++++++++++++++
>  1 file changed, 39 insertions(+)
> 
> diff --git a/arch/arm/boot/dts/exynos5422-odroidxu3.dts b/arch/arm/boot/dts/exynos5422-odroidxu3.dts
> index c29123c0734d..7874da20939f 100644
> --- a/arch/arm/boot/dts/exynos5422-odroidxu3.dts
> +++ b/arch/arm/boot/dts/exynos5422-odroidxu3.dts
> @@ -257,6 +264,38 @@
>  		};
>  	};
>  
> +	i2c_0: i2c@12C60000 {
> +		status = "okay";
> +
> +		/* A15 cluster: VDD_ARM */
> +		ina220@40 {
                   ^ ina231@40 ?
> +			compatible = "ti,ina230";

This feels incredibly nitpicky, but would it not better to use ti,ina231
as it's an INA231 chip not a INA230? (And add the compatibility string
to the driver)
Kevin Hilman Jan. 14, 2015, 11:42 p.m. UTC | #3
Kukjin Kim <kgene@kernel.org> writes:

> On 01/14/15 09:03, Kevin Hilman wrote:
>> From: Kevin Hilman <khilman@linaro.org>
>> 
>> The odroid-xu3 has 4 INA231 current sensors on board which can be
>> accessed from the Linux via the hwmon interface.
>> 
>> There is one sensor for each of these power rails:
>> 
>> - A15 cluster: VDD_ARM
>> - A7 cluster: VDD_KFC
>> - GPU: VDD_G3D
>> - memory: VDD_MEM
>> 
>> In addition to adding the sensors, LDO26 from the PMIC needs to be
>> enabled because it's powering these sensor.
>> 
>> Cc: Javier Martinez Canillas <javier.martinez@collabora.co.uk>
>> Cc: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
>> Signed-off-by: Kevin Hilman <khilman@linaro.org>
>> ---
>> Applies on top of "ARM: dts: Add dts file for odroid XU3 board" from Sjoerd Simons.
>> 
>>  arch/arm/boot/dts/exynos5422-odroidxu3.dts | 39 ++++++++++++++++++++++++++++++
>>  1 file changed, 39 insertions(+)
>> 
>> diff --git a/arch/arm/boot/dts/exynos5422-odroidxu3.dts b/arch/arm/boot/dts/exynos5422-odroidxu3.dts
>> index c29123c0734d..7874da20939f 100644
>> --- a/arch/arm/boot/dts/exynos5422-odroidxu3.dts
>> +++ b/arch/arm/boot/dts/exynos5422-odroidxu3.dts
>> @@ -174,6 +174,13 @@
>>  					regulator-always-on;
>>  				};
>>  
>> +				ldo26_reg: LDO26 {
>> +					regulator-name = "vdd_ldo26";
>> +					regulator-min-microvolt = <3000000>;
>> +					regulator-max-microvolt = <3000000>;
>> +					regulator-always-on;
>> +				};
>> +
>>  				buck1_reg: BUCK1 {
>>  					regulator-name = "vdd_mif";
>>  					regulator-min-microvolt = <800000>;
>> @@ -257,6 +264,38 @@
>>  		};
>>  	};
>>  
>> +	i2c_0: i2c@12C60000 {
>> +		status = "okay";
>> +
>> +		/* A15 cluster: VDD_ARM */
>> +		ina220@40 {
>> +			compatible = "ti,ina230";
>> +			reg = <0x40>;
>> +			shunt-resistor = <10000>;
>> +		};
>> +
>> +		/* memory: VDD_MEM */
>> +		ina220@41 {
>> +			compatible = "ti,ina230";
>> +			reg = <0x41>;
>> +			shunt-resistor = <10000>;
>> +		};
>> +
>> +		/* GPU: VDD_G3D */
>> +		ina220@44 {
>> +			compatible = "ti,ina230";
>> +			reg = <0x44>;
>> +			shunt-resistor = <10000>;
>> +		};
>> +
>> +		/* A7 cluster: VDD_KFC */
>> +		ina220@45 {
>> +			compatible = "ti,ina230";
>> +			reg = <0x45>;
>> +			shunt-resistor = <10000>;
>> +		};
>> +	};
>> +
>>  	i2c_2: i2c@12C80000 {
>>  		samsung,i2c-sda-delay = <100>;
>>  		samsung,i2c-max-bus-freq = <66000>;
>
> Looks good to me and applied. To be honest, I'm not sure about the
> values in the node of shunt-resistor though ;)

I didn't measure the values, but used the values from the DTS that's
part of the hardkernel tree.

Kevin
Kevin Hilman Jan. 14, 2015, 11:44 p.m. UTC | #4
Sjoerd Simons <sjoerd.simons@collabora.co.uk> writes:

> Hey kevin,
>
> On Tue, 2015-01-13 at 16:03 -0800, Kevin Hilman wrote:
>> From: Kevin Hilman <khilman@linaro.org>
>> 
>> The odroid-xu3 has 4 INA231 current sensors on board which can be
>> accessed from the Linux via the hwmon interface.
>> 
>> There is one sensor for each of these power rails:
>> 
>> - A15 cluster: VDD_ARM
>> - A7 cluster: VDD_KFC
>> - GPU: VDD_G3D
>> - memory: VDD_MEM
>> 
>> In addition to adding the sensors, LDO26 from the PMIC needs to be
>> enabled because it's powering these sensor.
>> 
>> Cc: Javier Martinez Canillas <javier.martinez@collabora.co.uk>
>> Cc: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
>> Signed-off-by: Kevin Hilman <khilman@linaro.org>
>> ---
>> Applies on top of "ARM: dts: Add dts file for odroid XU3 board" from Sjoerd Simons.
>> 
>>  arch/arm/boot/dts/exynos5422-odroidxu3.dts | 39 ++++++++++++++++++++++++++++++
>>  1 file changed, 39 insertions(+)
>> 
>> diff --git a/arch/arm/boot/dts/exynos5422-odroidxu3.dts b/arch/arm/boot/dts/exynos5422-odroidxu3.dts
>> index c29123c0734d..7874da20939f 100644
>> --- a/arch/arm/boot/dts/exynos5422-odroidxu3.dts
>> +++ b/arch/arm/boot/dts/exynos5422-odroidxu3.dts
>> @@ -257,6 +264,38 @@
>>  		};
>>  	};
>>  
>> +	i2c_0: i2c@12C60000 {
>> +		status = "okay";
>> +
>> +		/* A15 cluster: VDD_ARM */
>> +		ina220@40 {
>                    ^ ina231@40 ?
>> +			compatible = "ti,ina230";
>
> This feels incredibly nitpicky, but would it not better to use ti,ina231
> as it's an INA231 chip not a INA230? (And add the compatibility string
> to the driver)

Hmm, you're right.  Until recently, I thought these were INA230s, but
squinted enough at the schematic yesterday to notice they were marked as
INA231, so updated the changelog, but not the DTS.

Will re-spin with a compatible string update to the driver.

Kevin
diff mbox

Patch

diff --git a/arch/arm/boot/dts/exynos5422-odroidxu3.dts b/arch/arm/boot/dts/exynos5422-odroidxu3.dts
index c29123c0734d..7874da20939f 100644
--- a/arch/arm/boot/dts/exynos5422-odroidxu3.dts
+++ b/arch/arm/boot/dts/exynos5422-odroidxu3.dts
@@ -174,6 +174,13 @@ 
 					regulator-always-on;
 				};
 
+				ldo26_reg: LDO26 {
+					regulator-name = "vdd_ldo26";
+					regulator-min-microvolt = <3000000>;
+					regulator-max-microvolt = <3000000>;
+					regulator-always-on;
+				};
+
 				buck1_reg: BUCK1 {
 					regulator-name = "vdd_mif";
 					regulator-min-microvolt = <800000>;
@@ -257,6 +264,38 @@ 
 		};
 	};
 
+	i2c_0: i2c@12C60000 {
+		status = "okay";
+
+		/* A15 cluster: VDD_ARM */
+		ina220@40 {
+			compatible = "ti,ina230";
+			reg = <0x40>;
+			shunt-resistor = <10000>;
+		};
+
+		/* memory: VDD_MEM */
+		ina220@41 {
+			compatible = "ti,ina230";
+			reg = <0x41>;
+			shunt-resistor = <10000>;
+		};
+
+		/* GPU: VDD_G3D */
+		ina220@44 {
+			compatible = "ti,ina230";
+			reg = <0x44>;
+			shunt-resistor = <10000>;
+		};
+
+		/* A7 cluster: VDD_KFC */
+		ina220@45 {
+			compatible = "ti,ina230";
+			reg = <0x45>;
+			shunt-resistor = <10000>;
+		};
+	};
+
 	i2c_2: i2c@12C80000 {
 		samsung,i2c-sda-delay = <100>;
 		samsung,i2c-max-bus-freq = <66000>;