All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] ARM: dts: add XOADC and IIO HWMON to MSM8660/APQ8060
@ 2017-01-31 10:21 ` Linus Walleij
  0 siblings, 0 replies; 14+ messages in thread
From: Linus Walleij @ 2017-01-31 10:21 UTC (permalink / raw)
  To: linux-arm-kernel, linux-arm-msm, Andy Gross, Bjorn Andersson
  Cc: David Brown, Linus Walleij, Stephen Boyd

This adds the PM8058 XOADC node to the PM8058 PMIC node,
defines the 16 channels and further also define an IIO HWMON
node for the channels that are used for housekeeping of
voltages and die temperature for the PMIC chip die.

Tested on the APQ8060 DragonBoard:
cd /sys/class/hwmon/hwmon0
cat in2_input
4773 (DC mains ~5V)
cat in4_input
625  (0.625V reference voltage)
cat in5_input
1250 (1.25V reference voltage)
cat temp1_input
35852 (die temperature)

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
Andy: these bindings have been merged to the IIO tree and ACKed
by DT maintainers.
---
 arch/arm/boot/dts/qcom-apq8060-dragonboard.dts | 27 ++++++++++++
 arch/arm/boot/dts/qcom-msm8660.dtsi            | 59 ++++++++++++++++++++++++++
 2 files changed, 86 insertions(+)

diff --git a/arch/arm/boot/dts/qcom-apq8060-dragonboard.dts b/arch/arm/boot/dts/qcom-apq8060-dragonboard.dts
index 39d9e6ddefed..c04960371c5e 100644
--- a/arch/arm/boot/dts/qcom-apq8060-dragonboard.dts
+++ b/arch/arm/boot/dts/qcom-apq8060-dragonboard.dts
@@ -327,6 +327,33 @@
 					};
 				};
 
+				xoadc@197 {
+					/* Reference voltage 2.2 V */
+					xoadc-ref-supply = <&pm8058_l18>;
+
+					/* Board-specific channels */
+					mpp5 {
+						/* Connected to AOUT of ALS sensor */
+						reg = <0x05>;
+					};
+					mpp6 {
+						/* Connected to test point TP43 */
+						reg = <0x06>;
+					};
+					mpp7 {
+						/* Connected to battery thermistor */
+						reg = <0x07>;
+					};
+					mpp8 {
+						/* Connected to battery ID detector */
+						reg = <0x08>;
+					};
+					mpp9 {
+						/* Connected to XO thermistor */
+						reg = <0x09>;
+					};
+				};
+
 				led@48 {
 					/*
 					 * The keypad LED @0x48 is routed to
diff --git a/arch/arm/boot/dts/qcom-msm8660.dtsi b/arch/arm/boot/dts/qcom-msm8660.dtsi
index 91c9a62ae725..5ca6df54f9b5 100644
--- a/arch/arm/boot/dts/qcom-msm8660.dtsi
+++ b/arch/arm/boot/dts/qcom-msm8660.dtsi
@@ -63,6 +63,22 @@
 		};
 	};
 
+	/*
+	 * These channels from the ADC are simply hardware monitors.
+	 * That is why the ADC is referred to as "HKADC" - HouseKeeping
+	 * ADC.
+	 */
+	iio-hwmon {
+		compatible = "iio-hwmon";
+		io-channels = <&xoadc 0x01>, /* Battery */
+			    <&xoadc 0x02>, /* DC in (charger) */
+			    <&xoadc 0x04>, /* VPH the main system voltage */
+			    <&xoadc 0x0b>, /* Die temperature */
+			    <&xoadc 0x0c>, /* Reference voltage 1.25V */
+			    <&xoadc 0x0d>, /* Reference voltage 0.625V */
+			    <&xoadc 0x0e>; /* Reference voltage 0.325V */
+	};
+
 	soc: soc {
 		#address-cells = <1>;
 		#size-cells = <1>;
@@ -267,6 +283,49 @@
 					row-hold = <91500>;
 				};
 
+				xoadc: xoadc@197 {
+					compatible = "qcom,pm8058-adc";
+					reg = <0x197>;
+					interrupts-extended = <&pm8058 76 IRQ_TYPE_EDGE_RISING>;
+					#address-cells = <1>;
+					#size-cells = <0>;
+					#io-channel-cells = <1>;
+
+					vcoin: adc-channel@0 {
+						reg = <0x00>;
+					};
+					vbat: adc-channel@1 {
+						reg = <0x01>;
+					};
+					dcin: adc-channel@2 {
+						reg = <0x02>;
+					};
+					ichg: adc-channel@3 {
+						reg = <0x03>;
+					};
+					vph_pwr: adc-channel@4 {
+						reg = <0x04>;
+					};
+					usb_vbus: adc-channel@a {
+						reg = <0x0a>;
+					};
+					die_temp: adc-channel@b {
+						reg = <0x0b>;
+					};
+					ref_625mv: adc-channel@c {
+						reg = <0x0c>;
+					};
+					ref_1250mv: adc-channel@d {
+						reg = <0x0d>;
+					};
+					ref_325mv: adc-channel@e {
+						reg = <0x0e>;
+					};
+					ref_muxoff: adc-channel@f {
+						reg = <0x0f>;
+					};
+				};
+
 				rtc@1e8 {
 					compatible = "qcom,pm8058-rtc";
 					reg = <0x1e8>;
-- 
2.9.3

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

* [PATCH 1/2] ARM: dts: add XOADC and IIO HWMON to MSM8660/APQ8060
@ 2017-01-31 10:21 ` Linus Walleij
  0 siblings, 0 replies; 14+ messages in thread
From: Linus Walleij @ 2017-01-31 10:21 UTC (permalink / raw)
  To: linux-arm-kernel

This adds the PM8058 XOADC node to the PM8058 PMIC node,
defines the 16 channels and further also define an IIO HWMON
node for the channels that are used for housekeeping of
voltages and die temperature for the PMIC chip die.

Tested on the APQ8060 DragonBoard:
cd /sys/class/hwmon/hwmon0
cat in2_input
4773 (DC mains ~5V)
cat in4_input
625  (0.625V reference voltage)
cat in5_input
1250 (1.25V reference voltage)
cat temp1_input
35852 (die temperature)

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
Andy: these bindings have been merged to the IIO tree and ACKed
by DT maintainers.
---
 arch/arm/boot/dts/qcom-apq8060-dragonboard.dts | 27 ++++++++++++
 arch/arm/boot/dts/qcom-msm8660.dtsi            | 59 ++++++++++++++++++++++++++
 2 files changed, 86 insertions(+)

diff --git a/arch/arm/boot/dts/qcom-apq8060-dragonboard.dts b/arch/arm/boot/dts/qcom-apq8060-dragonboard.dts
index 39d9e6ddefed..c04960371c5e 100644
--- a/arch/arm/boot/dts/qcom-apq8060-dragonboard.dts
+++ b/arch/arm/boot/dts/qcom-apq8060-dragonboard.dts
@@ -327,6 +327,33 @@
 					};
 				};
 
+				xoadc at 197 {
+					/* Reference voltage 2.2 V */
+					xoadc-ref-supply = <&pm8058_l18>;
+
+					/* Board-specific channels */
+					mpp5 {
+						/* Connected to AOUT of ALS sensor */
+						reg = <0x05>;
+					};
+					mpp6 {
+						/* Connected to test point TP43 */
+						reg = <0x06>;
+					};
+					mpp7 {
+						/* Connected to battery thermistor */
+						reg = <0x07>;
+					};
+					mpp8 {
+						/* Connected to battery ID detector */
+						reg = <0x08>;
+					};
+					mpp9 {
+						/* Connected to XO thermistor */
+						reg = <0x09>;
+					};
+				};
+
 				led at 48 {
 					/*
 					 * The keypad LED @0x48 is routed to
diff --git a/arch/arm/boot/dts/qcom-msm8660.dtsi b/arch/arm/boot/dts/qcom-msm8660.dtsi
index 91c9a62ae725..5ca6df54f9b5 100644
--- a/arch/arm/boot/dts/qcom-msm8660.dtsi
+++ b/arch/arm/boot/dts/qcom-msm8660.dtsi
@@ -63,6 +63,22 @@
 		};
 	};
 
+	/*
+	 * These channels from the ADC are simply hardware monitors.
+	 * That is why the ADC is referred to as "HKADC" - HouseKeeping
+	 * ADC.
+	 */
+	iio-hwmon {
+		compatible = "iio-hwmon";
+		io-channels = <&xoadc 0x01>, /* Battery */
+			    <&xoadc 0x02>, /* DC in (charger) */
+			    <&xoadc 0x04>, /* VPH the main system voltage */
+			    <&xoadc 0x0b>, /* Die temperature */
+			    <&xoadc 0x0c>, /* Reference voltage 1.25V */
+			    <&xoadc 0x0d>, /* Reference voltage 0.625V */
+			    <&xoadc 0x0e>; /* Reference voltage 0.325V */
+	};
+
 	soc: soc {
 		#address-cells = <1>;
 		#size-cells = <1>;
@@ -267,6 +283,49 @@
 					row-hold = <91500>;
 				};
 
+				xoadc: xoadc at 197 {
+					compatible = "qcom,pm8058-adc";
+					reg = <0x197>;
+					interrupts-extended = <&pm8058 76 IRQ_TYPE_EDGE_RISING>;
+					#address-cells = <1>;
+					#size-cells = <0>;
+					#io-channel-cells = <1>;
+
+					vcoin: adc-channel at 0 {
+						reg = <0x00>;
+					};
+					vbat: adc-channel at 1 {
+						reg = <0x01>;
+					};
+					dcin: adc-channel at 2 {
+						reg = <0x02>;
+					};
+					ichg: adc-channel at 3 {
+						reg = <0x03>;
+					};
+					vph_pwr: adc-channel at 4 {
+						reg = <0x04>;
+					};
+					usb_vbus: adc-channel at a {
+						reg = <0x0a>;
+					};
+					die_temp: adc-channel at b {
+						reg = <0x0b>;
+					};
+					ref_625mv: adc-channel at c {
+						reg = <0x0c>;
+					};
+					ref_1250mv: adc-channel at d {
+						reg = <0x0d>;
+					};
+					ref_325mv: adc-channel at e {
+						reg = <0x0e>;
+					};
+					ref_muxoff: adc-channel at f {
+						reg = <0x0f>;
+					};
+				};
+
 				rtc at 1e8 {
 					compatible = "qcom,pm8058-rtc";
 					reg = <0x1e8>;
-- 
2.9.3

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

* [PATCH 2/2] ARM: dts: Qualcomm APQ8060 DragonBoard ALS sensor
  2017-01-31 10:21 ` Linus Walleij
@ 2017-01-31 10:21   ` Linus Walleij
  -1 siblings, 0 replies; 14+ messages in thread
From: Linus Walleij @ 2017-01-31 10:21 UTC (permalink / raw)
  To: linux-arm-kernel, linux-arm-msm, Andy Gross, Bjorn Andersson
  Cc: David Brown, Linus Walleij, Stephen Boyd

This adds the Capella CM3605 ambient light and proximity sensor
to the APQ8060 DragonBoard device tree. Notice that we also set
up pin config for the AOUT line and GPIO lines, and that we set
the default trigger on the infrared LED to associate with the
"cm3605" trigger so the IR LED is controlled by this the CM3605
driver.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
Andy: these bindings have been merged to the IIO tree and ACKed
by DT maintainers.
---
 arch/arm/boot/dts/qcom-apq8060-dragonboard.dts | 53 ++++++++++++++++++++++++++
 1 file changed, 53 insertions(+)

diff --git a/arch/arm/boot/dts/qcom-apq8060-dragonboard.dts b/arch/arm/boot/dts/qcom-apq8060-dragonboard.dts
index c04960371c5e..f3bd65e284ee 100644
--- a/arch/arm/boot/dts/qcom-apq8060-dragonboard.dts
+++ b/arch/arm/boot/dts/qcom-apq8060-dragonboard.dts
@@ -23,6 +23,7 @@
 #include <dt-bindings/input/input.h>
 #include <dt-bindings/gpio/gpio.h>
 #include <dt-bindings/pinctrl/qcom,pmic-gpio.h>
+#include <dt-bindings/pinctrl/qcom,pmic-mpp.h>
 #include "qcom-msm8660.dtsi"
 
 / {
@@ -83,6 +84,25 @@
 		};
 	};
 
+	/*
+	 * Capella CM3605 light and proximity sensor mounted directly
+	 * on the sensor board.
+	 */
+	cm3605 {
+		compatible = "capella,cm3605";
+		vdd-supply = <&pm8058_l14>; // 2.85V
+		aset-gpios = <&pm8058_gpio 35 GPIO_ACTIVE_LOW>;
+		capella,aset-resistance-ohms = <100000>;
+		/* GPIO34 has interrupt 225 on the PM8058 */
+		/* Trig on both edges - getting close or far away */
+		interrupts-extended = <&pm8058 225 IRQ_TYPE_EDGE_BOTH>;
+		/* MPP05 analog input to the XOADC */
+		io-channels = <&xoadc 0x05>;
+		io-channel-names = "aout";
+		pinctrl-names = "default";
+		pinctrl-0 = <&dragon_cm3605_gpios>, <&dragon_cm3605_mpps>;
+	};
+
 	soc {
 		pinctrl@800000 {
 			/* eMMMC pins, all 8 data lines connected */
@@ -317,6 +337,24 @@
 							power-source = <PM8058_GPIO_S3>;
 						};
 					};
+					dragon_cm3605_gpios: cm3605-gpios {
+						/* Pin 34 connected to the proxy IRQ */
+						pinconf_gpio34 {
+							pins = "gpio34";
+							function = "normal";
+							input-enable;
+							bias-disable;
+							power-source = <PM8058_GPIO_S3>;
+						};
+						/* Pin 35 connected to ASET */
+						pinconf_gpio35 {
+							pins = "gpio35";
+							function = "normal";
+							output-high;
+							bias-disable;
+							power-source = <PM8058_GPIO_S3>;
+						};
+					};
 					dragon_veth_gpios: veth-gpios {
 						pinconf {
 							pins = "gpio40";
@@ -327,6 +365,20 @@
 					};
 				};
 
+				mpps@50 {
+					dragon_cm3605_mpps: cm3605-mpps {
+						pinconf {
+							pins = "mpp5";
+							function = "analog";
+							input-enable;
+							bias-high-impedance;
+							/* Let's use channel 5 */
+							qcom,amux-route = <PMIC_MPP_AMUX_ROUTE_CH5>;
+							power-source = <PM8058_GPIO_S3>;
+						};
+					};
+				};
+
 				xoadc@197 {
 					/* Reference voltage 2.2 V */
 					xoadc-ref-supply = <&pm8058_l18>;
@@ -367,6 +419,7 @@
 					reg = <0x48>;
 					label = "pm8058:infrared:proximitysensor";
 					default-state = "off";
+					linux,default-trigger = "cm3605";
 				};
 				led@131 {
 					compatible = "qcom,pm8058-led";
-- 
2.9.3

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

* [PATCH 2/2] ARM: dts: Qualcomm APQ8060 DragonBoard ALS sensor
@ 2017-01-31 10:21   ` Linus Walleij
  0 siblings, 0 replies; 14+ messages in thread
From: Linus Walleij @ 2017-01-31 10:21 UTC (permalink / raw)
  To: linux-arm-kernel

This adds the Capella CM3605 ambient light and proximity sensor
to the APQ8060 DragonBoard device tree. Notice that we also set
up pin config for the AOUT line and GPIO lines, and that we set
the default trigger on the infrared LED to associate with the
"cm3605" trigger so the IR LED is controlled by this the CM3605
driver.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
Andy: these bindings have been merged to the IIO tree and ACKed
by DT maintainers.
---
 arch/arm/boot/dts/qcom-apq8060-dragonboard.dts | 53 ++++++++++++++++++++++++++
 1 file changed, 53 insertions(+)

diff --git a/arch/arm/boot/dts/qcom-apq8060-dragonboard.dts b/arch/arm/boot/dts/qcom-apq8060-dragonboard.dts
index c04960371c5e..f3bd65e284ee 100644
--- a/arch/arm/boot/dts/qcom-apq8060-dragonboard.dts
+++ b/arch/arm/boot/dts/qcom-apq8060-dragonboard.dts
@@ -23,6 +23,7 @@
 #include <dt-bindings/input/input.h>
 #include <dt-bindings/gpio/gpio.h>
 #include <dt-bindings/pinctrl/qcom,pmic-gpio.h>
+#include <dt-bindings/pinctrl/qcom,pmic-mpp.h>
 #include "qcom-msm8660.dtsi"
 
 / {
@@ -83,6 +84,25 @@
 		};
 	};
 
+	/*
+	 * Capella CM3605 light and proximity sensor mounted directly
+	 * on the sensor board.
+	 */
+	cm3605 {
+		compatible = "capella,cm3605";
+		vdd-supply = <&pm8058_l14>; // 2.85V
+		aset-gpios = <&pm8058_gpio 35 GPIO_ACTIVE_LOW>;
+		capella,aset-resistance-ohms = <100000>;
+		/* GPIO34 has interrupt 225 on the PM8058 */
+		/* Trig on both edges - getting close or far away */
+		interrupts-extended = <&pm8058 225 IRQ_TYPE_EDGE_BOTH>;
+		/* MPP05 analog input to the XOADC */
+		io-channels = <&xoadc 0x05>;
+		io-channel-names = "aout";
+		pinctrl-names = "default";
+		pinctrl-0 = <&dragon_cm3605_gpios>, <&dragon_cm3605_mpps>;
+	};
+
 	soc {
 		pinctrl at 800000 {
 			/* eMMMC pins, all 8 data lines connected */
@@ -317,6 +337,24 @@
 							power-source = <PM8058_GPIO_S3>;
 						};
 					};
+					dragon_cm3605_gpios: cm3605-gpios {
+						/* Pin 34 connected to the proxy IRQ */
+						pinconf_gpio34 {
+							pins = "gpio34";
+							function = "normal";
+							input-enable;
+							bias-disable;
+							power-source = <PM8058_GPIO_S3>;
+						};
+						/* Pin 35 connected to ASET */
+						pinconf_gpio35 {
+							pins = "gpio35";
+							function = "normal";
+							output-high;
+							bias-disable;
+							power-source = <PM8058_GPIO_S3>;
+						};
+					};
 					dragon_veth_gpios: veth-gpios {
 						pinconf {
 							pins = "gpio40";
@@ -327,6 +365,20 @@
 					};
 				};
 
+				mpps at 50 {
+					dragon_cm3605_mpps: cm3605-mpps {
+						pinconf {
+							pins = "mpp5";
+							function = "analog";
+							input-enable;
+							bias-high-impedance;
+							/* Let's use channel 5 */
+							qcom,amux-route = <PMIC_MPP_AMUX_ROUTE_CH5>;
+							power-source = <PM8058_GPIO_S3>;
+						};
+					};
+				};
+
 				xoadc at 197 {
 					/* Reference voltage 2.2 V */
 					xoadc-ref-supply = <&pm8058_l18>;
@@ -367,6 +419,7 @@
 					reg = <0x48>;
 					label = "pm8058:infrared:proximitysensor";
 					default-state = "off";
+					linux,default-trigger = "cm3605";
 				};
 				led at 131 {
 					compatible = "qcom,pm8058-led";
-- 
2.9.3

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

* Re: [PATCH 1/2] ARM: dts: add XOADC and IIO HWMON to MSM8660/APQ8060
  2017-01-31 10:21 ` Linus Walleij
@ 2017-02-01 18:31   ` Bjorn Andersson
  -1 siblings, 0 replies; 14+ messages in thread
From: Bjorn Andersson @ 2017-02-01 18:31 UTC (permalink / raw)
  To: Linus Walleij
  Cc: linux-arm-kernel, linux-arm-msm, Andy Gross, Stephen Boyd, David Brown

On Tue 31 Jan 02:21 PST 2017, Linus Walleij wrote:

> This adds the PM8058 XOADC node to the PM8058 PMIC node,
> defines the 16 channels and further also define an IIO HWMON
> node for the channels that are used for housekeeping of
> voltages and die temperature for the PMIC chip die.
> 
> Tested on the APQ8060 DragonBoard:
> cd /sys/class/hwmon/hwmon0
> cat in2_input
> 4773 (DC mains ~5V)
> cat in4_input
> 625  (0.625V reference voltage)
> cat in5_input
> 1250 (1.25V reference voltage)
> cat temp1_input
> 35852 (die temperature)
> 
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

Acked-by: Bjorn Andersson <bjorn.andersson@linaro.org>

Regards,
Bjorn

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

* [PATCH 1/2] ARM: dts: add XOADC and IIO HWMON to MSM8660/APQ8060
@ 2017-02-01 18:31   ` Bjorn Andersson
  0 siblings, 0 replies; 14+ messages in thread
From: Bjorn Andersson @ 2017-02-01 18:31 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue 31 Jan 02:21 PST 2017, Linus Walleij wrote:

> This adds the PM8058 XOADC node to the PM8058 PMIC node,
> defines the 16 channels and further also define an IIO HWMON
> node for the channels that are used for housekeeping of
> voltages and die temperature for the PMIC chip die.
> 
> Tested on the APQ8060 DragonBoard:
> cd /sys/class/hwmon/hwmon0
> cat in2_input
> 4773 (DC mains ~5V)
> cat in4_input
> 625  (0.625V reference voltage)
> cat in5_input
> 1250 (1.25V reference voltage)
> cat temp1_input
> 35852 (die temperature)
> 
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

Acked-by: Bjorn Andersson <bjorn.andersson@linaro.org>

Regards,
Bjorn

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

* Re: [PATCH 2/2] ARM: dts: Qualcomm APQ8060 DragonBoard ALS sensor
  2017-01-31 10:21   ` Linus Walleij
@ 2017-02-01 18:36     ` Bjorn Andersson
  -1 siblings, 0 replies; 14+ messages in thread
From: Bjorn Andersson @ 2017-02-01 18:36 UTC (permalink / raw)
  To: Linus Walleij
  Cc: linux-arm-kernel, linux-arm-msm, Andy Gross, Stephen Boyd, David Brown

On Tue 31 Jan 02:21 PST 2017, Linus Walleij wrote:

> This adds the Capella CM3605 ambient light and proximity sensor
> to the APQ8060 DragonBoard device tree. Notice that we also set
> up pin config for the AOUT line and GPIO lines, and that we set
> the default trigger on the infrared LED to associate with the
> "cm3605" trigger so the IR LED is controlled by this the CM3605
> driver.

Acked-by: Bjorn Andersson <bjorn.andersson@linaro.org>

> 
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
[..]
> +				mpps@50 {
> +					dragon_cm3605_mpps: cm3605-mpps {
> +						pinconf {
> +							pins = "mpp5";
> +							function = "analog";
> +							input-enable;
> +							bias-high-impedance;
> +							/* Let's use channel 5 */
> +							qcom,amux-route = <PMIC_MPP_AMUX_ROUTE_CH5>;

Unrelated to this patch, I did look at how this works on later devices.
It seems like we want to be able to switch the amux-route depending on
which ADC "channel" we're querying - e.g. on DB820c we have thermistors
on 3 different AMUX inputs but we don't have 3 mpps available.

Any thoughts on how to deal with this?

> +							power-source = <PM8058_GPIO_S3>;
> +						};
> +					};
> +				};

Regards,
Bjorn

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

* [PATCH 2/2] ARM: dts: Qualcomm APQ8060 DragonBoard ALS sensor
@ 2017-02-01 18:36     ` Bjorn Andersson
  0 siblings, 0 replies; 14+ messages in thread
From: Bjorn Andersson @ 2017-02-01 18:36 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue 31 Jan 02:21 PST 2017, Linus Walleij wrote:

> This adds the Capella CM3605 ambient light and proximity sensor
> to the APQ8060 DragonBoard device tree. Notice that we also set
> up pin config for the AOUT line and GPIO lines, and that we set
> the default trigger on the infrared LED to associate with the
> "cm3605" trigger so the IR LED is controlled by this the CM3605
> driver.

Acked-by: Bjorn Andersson <bjorn.andersson@linaro.org>

> 
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
[..]
> +				mpps at 50 {
> +					dragon_cm3605_mpps: cm3605-mpps {
> +						pinconf {
> +							pins = "mpp5";
> +							function = "analog";
> +							input-enable;
> +							bias-high-impedance;
> +							/* Let's use channel 5 */
> +							qcom,amux-route = <PMIC_MPP_AMUX_ROUTE_CH5>;

Unrelated to this patch, I did look at how this works on later devices.
It seems like we want to be able to switch the amux-route depending on
which ADC "channel" we're querying - e.g. on DB820c we have thermistors
on 3 different AMUX inputs but we don't have 3 mpps available.

Any thoughts on how to deal with this?

> +							power-source = <PM8058_GPIO_S3>;
> +						};
> +					};
> +				};

Regards,
Bjorn

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

* Re: [PATCH 2/2] ARM: dts: Qualcomm APQ8060 DragonBoard ALS sensor
  2017-02-01 18:36     ` Bjorn Andersson
@ 2017-02-03 13:05       ` Linus Walleij
  -1 siblings, 0 replies; 14+ messages in thread
From: Linus Walleij @ 2017-02-03 13:05 UTC (permalink / raw)
  To: Bjorn Andersson, Rama Krishna Phani A
  Cc: linux-arm-kernel, linux-arm-msm, Andy Gross, Stephen Boyd, David Brown

On Wed, Feb 1, 2017 at 7:36 PM, Bjorn Andersson
<bjorn.andersson@linaro.org> wrote:
> On Tue 31 Jan 02:21 PST 2017, Linus Walleij wrote:

>> +                                                     /* Let's use channel 5 */
>> +                                                     qcom,amux-route = <PMIC_MPP_AMUX_ROUTE_CH5>;
>
> Unrelated to this patch, I did look at how this works on later devices.
> It seems like we want to be able to switch the amux-route depending on
> which ADC "channel" we're querying - e.g. on DB820c we have thermistors
> on 3 different AMUX inputs but we don't have 3 mpps available.
>
> Any thoughts on how to deal with this?

The AMUX is just one big mystery to me, it's one of those areas where I
think a real datasheet would be extremely helpful.

In absence of datasheet, maybe a piece of ASCII art illustrating the muxes
in the device tree binding docs or so, written by someone who understand
it.

In absence of any written sources, maybe hearsay, rumors, palimpsest...
hehe.

I'd seriously like to know how this is engineered.

Yours,
Linus Walleij

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

* [PATCH 2/2] ARM: dts: Qualcomm APQ8060 DragonBoard ALS sensor
@ 2017-02-03 13:05       ` Linus Walleij
  0 siblings, 0 replies; 14+ messages in thread
From: Linus Walleij @ 2017-02-03 13:05 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Feb 1, 2017 at 7:36 PM, Bjorn Andersson
<bjorn.andersson@linaro.org> wrote:
> On Tue 31 Jan 02:21 PST 2017, Linus Walleij wrote:

>> +                                                     /* Let's use channel 5 */
>> +                                                     qcom,amux-route = <PMIC_MPP_AMUX_ROUTE_CH5>;
>
> Unrelated to this patch, I did look at how this works on later devices.
> It seems like we want to be able to switch the amux-route depending on
> which ADC "channel" we're querying - e.g. on DB820c we have thermistors
> on 3 different AMUX inputs but we don't have 3 mpps available.
>
> Any thoughts on how to deal with this?

The AMUX is just one big mystery to me, it's one of those areas where I
think a real datasheet would be extremely helpful.

In absence of datasheet, maybe a piece of ASCII art illustrating the muxes
in the device tree binding docs or so, written by someone who understand
it.

In absence of any written sources, maybe hearsay, rumors, palimpsest...
hehe.

I'd seriously like to know how this is engineered.

Yours,
Linus Walleij

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

* Re: [PATCH 2/2] ARM: dts: Qualcomm APQ8060 DragonBoard ALS sensor
  2017-02-03 13:05       ` Linus Walleij
@ 2017-02-09  1:42         ` Bjorn Andersson
  -1 siblings, 0 replies; 14+ messages in thread
From: Bjorn Andersson @ 2017-02-09  1:42 UTC (permalink / raw)
  To: Linus Walleij
  Cc: linux-arm-msm, Stephen Boyd, Rama Krishna Phani A, David Brown,
	Andy Gross, linux-arm-kernel

On Fri 03 Feb 05:05 PST 2017, Linus Walleij wrote:

> On Wed, Feb 1, 2017 at 7:36 PM, Bjorn Andersson
> <bjorn.andersson@linaro.org> wrote:
> > On Tue 31 Jan 02:21 PST 2017, Linus Walleij wrote:
> 
> >> +                                                     /* Let's use channel 5 */
> >> +                                                     qcom,amux-route = <PMIC_MPP_AMUX_ROUTE_CH5>;
> >
> > Unrelated to this patch, I did look at how this works on later devices.
> > It seems like we want to be able to switch the amux-route depending on
> > which ADC "channel" we're querying - e.g. on DB820c we have thermistors
> > on 3 different AMUX inputs but we don't have 3 mpps available.
> >
> > Any thoughts on how to deal with this?
> 
> The AMUX is just one big mystery to me, it's one of those areas where I
> think a real datasheet would be extremely helpful.
> 

After additional research and a long chat with Stephen this is what I
have come up with.

On PM8058 you have 16 AMUX channels that can be either read as raw,
scaled or dived by 3, this is selected by the 2 "premux" bits in the
AMUX selector register.

AMUX channel 5-9 are called MPP5-9,
connected to a switching matrix so each MPP is configured to output its
signal on one of the 5 mpp-amux-channels. I.e. it's probably better to
rename these just "AMUX5" through "AMXU9".



On PM8921 this changes somewhat and an additional mux is introduced.
The first premux looks similar to pm8058, but with no direct MPP AMUXes
to be selected. Premux 1 or 2 is used to select the second level mux.

This mux has channels:
 1: usb_sns
 2: dcin_sns
 3: amux3 (reserved and called pa_therm)
 4: amux4 (reserved and called amux_in)
 5-8: amuxX (as configured output of MPPs)

Premux 2 has the same set of channels, but with a divisor of 3.

The MPP1/MPP2 AMUX channels in premux 0 found downstream are now
reserved - likely they the hardware used to select unity and div/3 input
from the second level mux.

Regards,
Bjorn

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

* [PATCH 2/2] ARM: dts: Qualcomm APQ8060 DragonBoard ALS sensor
@ 2017-02-09  1:42         ` Bjorn Andersson
  0 siblings, 0 replies; 14+ messages in thread
From: Bjorn Andersson @ 2017-02-09  1:42 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri 03 Feb 05:05 PST 2017, Linus Walleij wrote:

> On Wed, Feb 1, 2017 at 7:36 PM, Bjorn Andersson
> <bjorn.andersson@linaro.org> wrote:
> > On Tue 31 Jan 02:21 PST 2017, Linus Walleij wrote:
> 
> >> +                                                     /* Let's use channel 5 */
> >> +                                                     qcom,amux-route = <PMIC_MPP_AMUX_ROUTE_CH5>;
> >
> > Unrelated to this patch, I did look at how this works on later devices.
> > It seems like we want to be able to switch the amux-route depending on
> > which ADC "channel" we're querying - e.g. on DB820c we have thermistors
> > on 3 different AMUX inputs but we don't have 3 mpps available.
> >
> > Any thoughts on how to deal with this?
> 
> The AMUX is just one big mystery to me, it's one of those areas where I
> think a real datasheet would be extremely helpful.
> 

After additional research and a long chat with Stephen this is what I
have come up with.

On PM8058 you have 16 AMUX channels that can be either read as raw,
scaled or dived by 3, this is selected by the 2 "premux" bits in the
AMUX selector register.

AMUX channel 5-9 are called MPP5-9,
connected to a switching matrix so each MPP is configured to output its
signal on one of the 5 mpp-amux-channels. I.e. it's probably better to
rename these just "AMUX5" through "AMXU9".



On PM8921 this changes somewhat and an additional mux is introduced.
The first premux looks similar to pm8058, but with no direct MPP AMUXes
to be selected. Premux 1 or 2 is used to select the second level mux.

This mux has channels:
 1: usb_sns
 2: dcin_sns
 3: amux3 (reserved and called pa_therm)
 4: amux4 (reserved and called amux_in)
 5-8: amuxX (as configured output of MPPs)

Premux 2 has the same set of channels, but with a divisor of 3.

The MPP1/MPP2 AMUX channels in premux 0 found downstream are now
reserved - likely they the hardware used to select unity and div/3 input
from the second level mux.

Regards,
Bjorn

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

* Re: [PATCH 2/2] ARM: dts: Qualcomm APQ8060 DragonBoard ALS sensor
  2017-02-09  1:42         ` Bjorn Andersson
@ 2017-02-21 15:44           ` Linus Walleij
  -1 siblings, 0 replies; 14+ messages in thread
From: Linus Walleij @ 2017-02-21 15:44 UTC (permalink / raw)
  To: Bjorn Andersson
  Cc: Rama Krishna Phani A, linux-arm-kernel, linux-arm-msm,
	Andy Gross, Stephen Boyd, David Brown

On Thu, Feb 9, 2017 at 2:42 AM, Bjorn Andersson
<bjorn.andersson@linaro.org> wrote:

>> The AMUX is just one big mystery to me, it's one of those areas where I
>> think a real datasheet would be extremely helpful.
>>
>
> After additional research and a long chat with Stephen this is what I
> have come up with.
>
> On PM8058 you have 16 AMUX channels that can be either read as raw,
> scaled or dived by 3, this is selected by the 2 "premux" bits in the
> AMUX selector register.
>
> AMUX channel 5-9 are called MPP5-9,
> connected to a switching matrix so each MPP is configured to output its
> signal on one of the 5 mpp-amux-channels. I.e. it's probably better to
> rename these just "AMUX5" through "AMXU9".

Awesome, that part is encoded into the next iteration of the driver.

> On PM8921 this changes somewhat and an additional mux is introduced.
> The first premux looks similar to pm8058, but with no direct MPP AMUXes
> to be selected. Premux 1 or 2 is used to select the second level mux.
>
> This mux has channels:
>  1: usb_sns
>  2: dcin_sns
>  3: amux3 (reserved and called pa_therm)
>  4: amux4 (reserved and called amux_in)
>  5-8: amuxX (as configured output of MPPs)
>
> Premux 2 has the same set of channels, but with a divisor of 3.
>
> The MPP1/MPP2 AMUX channels in premux 0 found downstream are now
> reserved - likely they the hardware used to select unity and div/3 input
> from the second level mux.

That is some serious silicon duct tape work going on here...

OK I am trying to accomodate it, but I will likely need verification on
real hardware making use of the premuxed thingies.

Yours,
Linus Walleij

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

* [PATCH 2/2] ARM: dts: Qualcomm APQ8060 DragonBoard ALS sensor
@ 2017-02-21 15:44           ` Linus Walleij
  0 siblings, 0 replies; 14+ messages in thread
From: Linus Walleij @ 2017-02-21 15:44 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, Feb 9, 2017 at 2:42 AM, Bjorn Andersson
<bjorn.andersson@linaro.org> wrote:

>> The AMUX is just one big mystery to me, it's one of those areas where I
>> think a real datasheet would be extremely helpful.
>>
>
> After additional research and a long chat with Stephen this is what I
> have come up with.
>
> On PM8058 you have 16 AMUX channels that can be either read as raw,
> scaled or dived by 3, this is selected by the 2 "premux" bits in the
> AMUX selector register.
>
> AMUX channel 5-9 are called MPP5-9,
> connected to a switching matrix so each MPP is configured to output its
> signal on one of the 5 mpp-amux-channels. I.e. it's probably better to
> rename these just "AMUX5" through "AMXU9".

Awesome, that part is encoded into the next iteration of the driver.

> On PM8921 this changes somewhat and an additional mux is introduced.
> The first premux looks similar to pm8058, but with no direct MPP AMUXes
> to be selected. Premux 1 or 2 is used to select the second level mux.
>
> This mux has channels:
>  1: usb_sns
>  2: dcin_sns
>  3: amux3 (reserved and called pa_therm)
>  4: amux4 (reserved and called amux_in)
>  5-8: amuxX (as configured output of MPPs)
>
> Premux 2 has the same set of channels, but with a divisor of 3.
>
> The MPP1/MPP2 AMUX channels in premux 0 found downstream are now
> reserved - likely they the hardware used to select unity and div/3 input
> from the second level mux.

That is some serious silicon duct tape work going on here...

OK I am trying to accomodate it, but I will likely need verification on
real hardware making use of the premuxed thingies.

Yours,
Linus Walleij

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

end of thread, other threads:[~2017-02-21 15:44 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-31 10:21 [PATCH 1/2] ARM: dts: add XOADC and IIO HWMON to MSM8660/APQ8060 Linus Walleij
2017-01-31 10:21 ` Linus Walleij
2017-01-31 10:21 ` [PATCH 2/2] ARM: dts: Qualcomm APQ8060 DragonBoard ALS sensor Linus Walleij
2017-01-31 10:21   ` Linus Walleij
2017-02-01 18:36   ` Bjorn Andersson
2017-02-01 18:36     ` Bjorn Andersson
2017-02-03 13:05     ` Linus Walleij
2017-02-03 13:05       ` Linus Walleij
2017-02-09  1:42       ` Bjorn Andersson
2017-02-09  1:42         ` Bjorn Andersson
2017-02-21 15:44         ` Linus Walleij
2017-02-21 15:44           ` Linus Walleij
2017-02-01 18:31 ` [PATCH 1/2] ARM: dts: add XOADC and IIO HWMON to MSM8660/APQ8060 Bjorn Andersson
2017-02-01 18:31   ` Bjorn Andersson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.