linux-arm-msm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/5] Add Qcom PM6125 PMIC, and use in Sony Xperia Seine PDX201
@ 2022-08-05 13:57 Marijn Suijten
  2022-08-05 13:57 ` [PATCH v2 1/5] arm64: dts: qcom: pm660: Use unique ADC5_VCOIN address in node name Marijn Suijten
                   ` (4 more replies)
  0 siblings, 5 replies; 10+ messages in thread
From: Marijn Suijten @ 2022-08-05 13:57 UTC (permalink / raw)
  To: phone-devel
  Cc: ~postmarketos/upstreaming, AngeloGioacchino Del Regno,
	Konrad Dybcio, Martin Botka, Jami Kettunen, Marijn Suijten,
	Andy Gross, Bjorn Andersson, Rob Herring, Krzysztof Kozlowski,
	Jonathan Cameron, Lars-Peter Clausen, linux-arm-msm, devicetree,
	linux-kernel, linux-iio

This series adds initial support for the PM6125 PMIC, and its power key
handling and thermal monitoring capabilities are configured for Sony's
PDX201 (Xperia 10II).

One patch for pm660 is included to fix a node address mismatch with its
reg field.

Note that this series has been based on top of:

  https://lore.kernel.org/linux-arm-msm/20220508100336.127176-1-marijn.suijten@somainline.org/T/#u

To prevent conflicts with the moving around of sdc2 nodes, presuming
that series is applied first.

All dts patches are expected to go through the QCOM DTS tree, whereas
the sole iio patch goes through the IIO tree.

Changes since v1:
- Dropped both pinctrl patches that have already been applied;
- Add -us suffix to qcom,hw-settle-time properties on ADC TM5 nodes
  (this suffix is not present on regular ADC5/VADC nodes);
- Add -state suffix to pm6125_gpio pinctrl nodes;
- Use PMIC_GPIO_FUNC_NORMAL instead of the string-literal "normal";
- Removed #address-cells and #size-cells from empty pmic@1 node;
- Removed ADC5_AMUX_THM3 / ADC5_GPIO2_100K_PU channels from the ADC5
  patch, these are unused on my board and hence untested.

v1: https://lore.kernel.org/phone-devel/20220511220613.1015472-1-marijn.suijten@somainline.org/T/#u

Marijn Suijten (5):
  arm64: dts: qcom: pm660: Use unique ADC5_VCOIN address in node name
  iio: adc: qcom-spmi-adc5: Add missing VCOIN/GPIO[134] channels
  arm64: dts: qcom: Add PM6125 PMIC
  arm64: dts: qcom: sm6125-seine: Include PM6125 and configure PON
  arm64: dts: qcom: sm6125-seine: Configure additional trinket
    thermistors

 arch/arm64/boot/dts/qcom/pm6125.dtsi          | 154 +++++++++++++++++
 arch/arm64/boot/dts/qcom/pm660.dtsi           |   2 +-
 .../qcom/sm6125-sony-xperia-seine-pdx201.dts  | 162 +++++++++++++++++-
 drivers/iio/adc/qcom-spmi-adc5.c              |   8 +
 4 files changed, 324 insertions(+), 2 deletions(-)
 create mode 100644 arch/arm64/boot/dts/qcom/pm6125.dtsi

-- 
2.37.1


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

* [PATCH v2 1/5] arm64: dts: qcom: pm660: Use unique ADC5_VCOIN address in node name
  2022-08-05 13:57 [PATCH v2 0/5] Add Qcom PM6125 PMIC, and use in Sony Xperia Seine PDX201 Marijn Suijten
@ 2022-08-05 13:57 ` Marijn Suijten
  2022-08-05 13:57 ` [PATCH v2 2/5] iio: adc: qcom-spmi-adc5: Add missing VCOIN/GPIO[134] channels Marijn Suijten
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 10+ messages in thread
From: Marijn Suijten @ 2022-08-05 13:57 UTC (permalink / raw)
  To: phone-devel
  Cc: ~postmarketos/upstreaming, AngeloGioacchino Del Regno,
	Konrad Dybcio, Martin Botka, Jami Kettunen, Marijn Suijten,
	Andy Gross, Bjorn Andersson, Rob Herring, Krzysztof Kozlowski,
	Jonathan Cameron, Lars-Peter Clausen, linux-arm-msm, devicetree,
	linux-kernel, linux-iio

The register address in the node name is shadowing vph_pwr@83, whereas
the ADC5_VCOIN register resolves to 0x85.  Fix this copy-paste
discrepancy.

Fixes: 4bf097540506 ("arm64: dts: qcom: pm660: Add VADC and temp alarm nodes")
Signed-off-by: Marijn Suijten <marijn.suijten@somainline.org>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@somainline.org>
---
 arch/arm64/boot/dts/qcom/pm660.dtsi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm64/boot/dts/qcom/pm660.dtsi b/arch/arm64/boot/dts/qcom/pm660.dtsi
index c482663aad56..42f9c51b9c1e 100644
--- a/arch/arm64/boot/dts/qcom/pm660.dtsi
+++ b/arch/arm64/boot/dts/qcom/pm660.dtsi
@@ -163,7 +163,7 @@ vadc_vph_pwr: vph_pwr@83 {
 				qcom,pre-scaling = <1 3>;
 			};
 
-			vcoin: vcoin@83 {
+			vcoin: vcoin@85 {
 				reg = <ADC5_VCOIN>;
 				qcom,decimation = <1024>;
 				qcom,pre-scaling = <1 3>;
-- 
2.37.1


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

* [PATCH v2 2/5] iio: adc: qcom-spmi-adc5: Add missing VCOIN/GPIO[134] channels
  2022-08-05 13:57 [PATCH v2 0/5] Add Qcom PM6125 PMIC, and use in Sony Xperia Seine PDX201 Marijn Suijten
  2022-08-05 13:57 ` [PATCH v2 1/5] arm64: dts: qcom: pm660: Use unique ADC5_VCOIN address in node name Marijn Suijten
@ 2022-08-05 13:57 ` Marijn Suijten
  2022-08-06 14:24   ` Jonathan Cameron
  2022-08-05 13:57 ` [PATCH v2 3/5] arm64: dts: qcom: Add PM6125 PMIC Marijn Suijten
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 10+ messages in thread
From: Marijn Suijten @ 2022-08-05 13:57 UTC (permalink / raw)
  To: phone-devel
  Cc: ~postmarketos/upstreaming, AngeloGioacchino Del Regno,
	Konrad Dybcio, Martin Botka, Jami Kettunen, Marijn Suijten,
	Andy Gross, Bjorn Andersson, Rob Herring, Krzysztof Kozlowski,
	Jonathan Cameron, Lars-Peter Clausen, linux-arm-msm, devicetree,
	linux-kernel, linux-iio

These channels are specified in downstream kernels [1] and actively used
by e.g. the Sony Seine platform on the SM6125 SoC.  Note that GPIO2
isn't used on this platform and, while the definition downstream is
identical to the other GPIOx_100K_PU definitions, has been omitted for
lack of proper testing.

[1]: https://source.codeaurora.org/quic/la/kernel/msm-4.14/tree/drivers/iio/adc/qcom-spmi-adc5.c?h=LA.UM.7.11.r1-05200-NICOBAR.0#n688

Signed-off-by: Marijn Suijten <marijn.suijten@somainline.org>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@somainline.org>
---
 drivers/iio/adc/qcom-spmi-adc5.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/iio/adc/qcom-spmi-adc5.c b/drivers/iio/adc/qcom-spmi-adc5.c
index 87438d1e5c0b..0dc4fe612433 100644
--- a/drivers/iio/adc/qcom-spmi-adc5.c
+++ b/drivers/iio/adc/qcom-spmi-adc5.c
@@ -526,6 +526,8 @@ static const struct adc5_channels adc5_chans_pmic[ADC5_MAX_CHANNEL] = {
 					SCALE_HW_CALIB_DEFAULT)
 	[ADC5_VBAT_SNS]		= ADC5_CHAN_VOLT("vbat_sns", 1,
 					SCALE_HW_CALIB_DEFAULT)
+	[ADC5_VCOIN]		= ADC5_CHAN_VOLT("vcoin", 1,
+					SCALE_HW_CALIB_DEFAULT)
 	[ADC5_DIE_TEMP]		= ADC5_CHAN_TEMP("die_temp", 0,
 					SCALE_HW_CALIB_PMIC_THERM)
 	[ADC5_USB_IN_I]		= ADC5_CHAN_VOLT("usb_in_i_uv", 0,
@@ -549,6 +551,12 @@ static const struct adc5_channels adc5_chans_pmic[ADC5_MAX_CHANNEL] = {
 					SCALE_HW_CALIB_THERM_100K_PULLUP)
 	[ADC5_AMUX_THM2]	= ADC5_CHAN_TEMP("amux_thm2", 0,
 					SCALE_HW_CALIB_PM5_SMB_TEMP)
+	[ADC5_GPIO1_100K_PU]	= ADC5_CHAN_TEMP("gpio1_100k_pu", 0,
+					SCALE_HW_CALIB_THERM_100K_PULLUP)
+	[ADC5_GPIO3_100K_PU]	= ADC5_CHAN_TEMP("gpio3_100k_pu", 0,
+					SCALE_HW_CALIB_THERM_100K_PULLUP)
+	[ADC5_GPIO4_100K_PU]	= ADC5_CHAN_TEMP("gpio4_100k_pu", 0,
+					SCALE_HW_CALIB_THERM_100K_PULLUP)
 };
 
 static const struct adc5_channels adc7_chans_pmic[ADC5_MAX_CHANNEL] = {
-- 
2.37.1


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

* [PATCH v2 3/5] arm64: dts: qcom: Add PM6125 PMIC
  2022-08-05 13:57 [PATCH v2 0/5] Add Qcom PM6125 PMIC, and use in Sony Xperia Seine PDX201 Marijn Suijten
  2022-08-05 13:57 ` [PATCH v2 1/5] arm64: dts: qcom: pm660: Use unique ADC5_VCOIN address in node name Marijn Suijten
  2022-08-05 13:57 ` [PATCH v2 2/5] iio: adc: qcom-spmi-adc5: Add missing VCOIN/GPIO[134] channels Marijn Suijten
@ 2022-08-05 13:57 ` Marijn Suijten
  2022-08-08  9:17   ` Krzysztof Kozlowski
  2022-08-05 13:57 ` [PATCH v2 4/5] arm64: dts: qcom: sm6125-seine: Include PM6125 and configure PON Marijn Suijten
  2022-08-05 13:57 ` [PATCH v2 5/5] arm64: dts: qcom: sm6125-seine: Configure additional trinket thermistors Marijn Suijten
  4 siblings, 1 reply; 10+ messages in thread
From: Marijn Suijten @ 2022-08-05 13:57 UTC (permalink / raw)
  To: phone-devel
  Cc: ~postmarketos/upstreaming, AngeloGioacchino Del Regno,
	Konrad Dybcio, Martin Botka, Jami Kettunen, Marijn Suijten,
	Andy Gross, Bjorn Andersson, Rob Herring, Krzysztof Kozlowski,
	Jonathan Cameron, Lars-Peter Clausen, linux-arm-msm, devicetree,
	linux-kernel, linux-iio

This PMIC is commonly used on boards with an SM6125 SoC and looks very
similar in layout to the PM6150.

Downstream declares more nodes to be available, but these have been
omitted from this patch: the pwm/lpg block is unused on my reference
device making it impossible to test/validate, and the spmi-clkdiv does
not have a single device-tree binding using this driver yet, hence
inclusion is better postponed until ie. audio which uses these clocks is
brought up.

Signed-off-by: Marijn Suijten <marijn.suijten@somainline.org>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@somainline.org>
Reviewed-by: Konrad Dybcio <konrad.dybcio@somainline.org>
---
 arch/arm64/boot/dts/qcom/pm6125.dtsi | 154 +++++++++++++++++++++++++++
 1 file changed, 154 insertions(+)
 create mode 100644 arch/arm64/boot/dts/qcom/pm6125.dtsi

diff --git a/arch/arm64/boot/dts/qcom/pm6125.dtsi b/arch/arm64/boot/dts/qcom/pm6125.dtsi
new file mode 100644
index 000000000000..25ef15fbfda7
--- /dev/null
+++ b/arch/arm64/boot/dts/qcom/pm6125.dtsi
@@ -0,0 +1,154 @@
+// SPDX-License-Identifier: BSD-3-Clause
+
+#include <dt-bindings/iio/qcom,spmi-vadc.h>
+#include <dt-bindings/input/input.h>
+#include <dt-bindings/input/linux-event-codes.h>
+#include <dt-bindings/interrupt-controller/irq.h>
+#include <dt-bindings/spmi/spmi.h>
+
+/ {
+	thermal-zones {
+		pm6125-thermal {
+			polling-delay-passive = <100>;
+			polling-delay = <0>;
+
+			thermal-sensors = <&pm6125_temp>;
+
+			trips {
+				trip0 {
+					temperature = <95000>;
+					hysteresis = <0>;
+					type = "passive";
+				};
+
+				trip1 {
+					temperature = <115000>;
+					hysteresis = <0>;
+					type = "hot";
+				};
+
+				trip2 {
+					temperature = <145000>;
+					hysteresis = <0>;
+					type = "critical";
+				};
+			};
+		};
+	};
+};
+
+&spmi_bus {
+	pmic@0 {
+		compatible = "qcom,pm6125", "qcom,spmi-pmic";
+		reg = <0x0 SPMI_USID>;
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		pm6125_pon: pon@800 {
+			compatible = "qcom,pm8998-pon";
+			reg = <0x800>;
+			mode-bootloader = <0x2>;
+			mode-recovery = <0x1>;
+
+			pon_pwrkey: pwrkey {
+				compatible = "qcom,pm8941-pwrkey";
+				interrupts = <0x0 0x8 0x0 IRQ_TYPE_EDGE_BOTH>;
+				debounce = <15625>;
+				linux,code = <KEY_POWER>;
+				bias-pull-up;
+				status = "disabled";
+			};
+
+			pon_resin: resin {
+				compatible = "qcom,pm8941-resin";
+				interrupts = <0x0 0x8 0x1 IRQ_TYPE_EDGE_BOTH>;
+				debounce = <15625>;
+				bias-pull-up;
+				status = "disabled";
+			};
+		};
+
+		pm6125_temp: temp-alarm@2400 {
+			compatible = "qcom,spmi-temp-alarm";
+			reg = <0x2400>;
+			interrupts = <0x0 0x24 0x0 IRQ_TYPE_EDGE_RISING>;
+			io-channels = <&pm6125_adc ADC5_DIE_TEMP>;
+			io-channel-names = "thermal";
+			#thermal-sensor-cells = <0>;
+		};
+
+		pm6125_adc: adc@3100 {
+			compatible = "qcom,spmi-adc5";
+			reg = <0x3100>;
+			#address-cells = <1>;
+			#size-cells = <0>;
+			interrupts = <0x0 0x31 0x0 IRQ_TYPE_EDGE_RISING>;
+			#io-channel-cells = <1>;
+
+			ref-gnd@0 {
+				reg = <ADC5_REF_GND>;
+				qcom,pre-scaling = <1 1>;
+			};
+
+			vref-1p25@1 {
+				reg = <ADC5_1P25VREF>;
+				qcom,pre-scaling = <1 1>;
+			};
+
+			die-temp@6 {
+				reg = <ADC5_DIE_TEMP>;
+				qcom,pre-scaling = <1 1>;
+			};
+
+			vph-pwr@83 {
+				reg = <ADC5_VPH_PWR>;
+				qcom,pre-scaling = <1 3>;
+			};
+
+			vcoin@85 {
+				reg = <ADC5_VCOIN>;
+				qcom,pre-scaling = <1 3>;
+			};
+
+			xo-therm@4c {
+				reg = <ADC5_XO_THERM_100K_PU>;
+				qcom,pre-scaling = <1 1>;
+				qcom,hw-settle-time = <200>;
+				qcom,ratiometric;
+			};
+		};
+
+		pm6125_adc_tm: adc-tm@3500 {
+			compatible = "qcom,spmi-adc-tm5";
+			reg = <0x3500>;
+			interrupts = <0x0 0x35 0x0 IRQ_TYPE_EDGE_RISING>;
+			#address-cells = <1>;
+			#size-cells = <0>;
+			#thermal-sensor-cells = <1>;
+			status = "disabled";
+		};
+
+		pm6125_rtc: rtc@6000 {
+			compatible = "qcom,pm8941-rtc";
+			reg = <0x6000>, <0x6100>;
+			reg-names = "rtc", "alarm";
+			interrupts = <0x0 0x61 0x1 IRQ_TYPE_EDGE_RISING>;
+			status = "disabled";
+		};
+
+		pm6125_gpio: gpios@c000 {
+			compatible = "qcom,pm6125-gpio", "qcom,spmi-gpio";
+			reg = <0xc000>;
+			gpio-controller;
+			gpio-ranges = <&pm6125_gpio 0 0 9>;
+			#gpio-cells = <2>;
+			interrupt-controller;
+			#interrupt-cells = <2>;
+		};
+	};
+
+	pmic@1 {
+		compatible = "qcom,pm6125", "qcom,spmi-pmic";
+		reg = <0x1 SPMI_USID>;
+	};
+};
-- 
2.37.1


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

* [PATCH v2 4/5] arm64: dts: qcom: sm6125-seine: Include PM6125 and configure PON
  2022-08-05 13:57 [PATCH v2 0/5] Add Qcom PM6125 PMIC, and use in Sony Xperia Seine PDX201 Marijn Suijten
                   ` (2 preceding siblings ...)
  2022-08-05 13:57 ` [PATCH v2 3/5] arm64: dts: qcom: Add PM6125 PMIC Marijn Suijten
@ 2022-08-05 13:57 ` Marijn Suijten
  2022-08-05 13:57 ` [PATCH v2 5/5] arm64: dts: qcom: sm6125-seine: Configure additional trinket thermistors Marijn Suijten
  4 siblings, 0 replies; 10+ messages in thread
From: Marijn Suijten @ 2022-08-05 13:57 UTC (permalink / raw)
  To: phone-devel
  Cc: ~postmarketos/upstreaming, AngeloGioacchino Del Regno,
	Konrad Dybcio, Martin Botka, Jami Kettunen, Marijn Suijten,
	Andy Gross, Bjorn Andersson, Rob Herring, Krzysztof Kozlowski,
	Jonathan Cameron, Lars-Peter Clausen, linux-arm-msm, devicetree,
	linux-kernel, linux-iio

The Sony Xperia Seine board uses the PM6125; include it and configure
the PON buttons that provide the power and volume-up key.

Signed-off-by: Marijn Suijten <marijn.suijten@somainline.org>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@somainline.org>
---
 .../boot/dts/qcom/sm6125-sony-xperia-seine-pdx201.dts | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/arch/arm64/boot/dts/qcom/sm6125-sony-xperia-seine-pdx201.dts b/arch/arm64/boot/dts/qcom/sm6125-sony-xperia-seine-pdx201.dts
index 038970c0b68e..c5967140d028 100644
--- a/arch/arm64/boot/dts/qcom/sm6125-sony-xperia-seine-pdx201.dts
+++ b/arch/arm64/boot/dts/qcom/sm6125-sony-xperia-seine-pdx201.dts
@@ -6,8 +6,8 @@
 /dts-v1/;
 
 #include "sm6125.dtsi"
+#include "pm6125.dtsi"
 #include <dt-bindings/gpio/gpio.h>
-#include <dt-bindings/input/input.h>
 #include <dt-bindings/input/gpio-keys.h>
 
 / {
@@ -88,6 +88,15 @@ &hsusb_phy1 {
 	status = "okay";
 };
 
+&pon_pwrkey {
+	status = "okay";
+};
+
+&pon_resin {
+	status = "okay";
+	linux,code = <KEY_VOLUMEUP>;
+};
+
 &sdc2_off_state {
 	sd-cd {
 		pins = "gpio98";
-- 
2.37.1


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

* [PATCH v2 5/5] arm64: dts: qcom: sm6125-seine: Configure additional trinket thermistors
  2022-08-05 13:57 [PATCH v2 0/5] Add Qcom PM6125 PMIC, and use in Sony Xperia Seine PDX201 Marijn Suijten
                   ` (3 preceding siblings ...)
  2022-08-05 13:57 ` [PATCH v2 4/5] arm64: dts: qcom: sm6125-seine: Include PM6125 and configure PON Marijn Suijten
@ 2022-08-05 13:57 ` Marijn Suijten
  4 siblings, 0 replies; 10+ messages in thread
From: Marijn Suijten @ 2022-08-05 13:57 UTC (permalink / raw)
  To: phone-devel
  Cc: ~postmarketos/upstreaming, AngeloGioacchino Del Regno,
	Konrad Dybcio, Martin Botka, Jami Kettunen, Marijn Suijten,
	Andy Gross, Bjorn Andersson, Rob Herring, Krzysztof Kozlowski,
	Jonathan Cameron, Lars-Peter Clausen, linux-arm-msm, devicetree,
	linux-kernel, linux-iio

In addition to PMIC-specific (pm6125) thermistors downstream extends
this set with the rf-pa0/rf-pa1, quiet, camera-flash and UFS/eMMC
thermistors in sm6125 (trinket) board and seine-specific DT files.  All
thermistors report sensible temperature readings in userspace.

The sensors are also added to their respective Thermal Monitor node,
with thermal zones to match where applicable: emmc-ufs and camera-flash
are not available on the TM5 block, hence cannot be configured with a
tripping point and will not have a thermal zone.

Signed-off-by: Marijn Suijten <marijn.suijten@somainline.org>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@somainline.org>
---
 .../qcom/sm6125-sony-xperia-seine-pdx201.dts  | 151 ++++++++++++++++++
 1 file changed, 151 insertions(+)

diff --git a/arch/arm64/boot/dts/qcom/sm6125-sony-xperia-seine-pdx201.dts b/arch/arm64/boot/dts/qcom/sm6125-sony-xperia-seine-pdx201.dts
index c5967140d028..bfeea20fdd4f 100644
--- a/arch/arm64/boot/dts/qcom/sm6125-sony-xperia-seine-pdx201.dts
+++ b/arch/arm64/boot/dts/qcom/sm6125-sony-xperia-seine-pdx201.dts
@@ -9,6 +9,7 @@
 #include "pm6125.dtsi"
 #include <dt-bindings/gpio/gpio.h>
 #include <dt-bindings/input/gpio-keys.h>
+#include <dt-bindings/pinctrl/qcom,pmic-gpio.h>
 
 / {
 	/* required for bootloader to select correct board */
@@ -82,12 +83,162 @@ cmdline_mem: memory@ffd00000 {
 			no-map;
 		};
 	};
+
+	thermal-zones {
+		rf-pa0-thermal {
+			polling-delay-passive = <0>;
+			polling-delay = <0>;
+			thermal-sensors = <&pm6125_adc_tm 0>;
+
+			trips {
+				active-config0 {
+					temperature = <125000>;
+					hysteresis = <1000>;
+					type = "critical";
+				};
+			};
+		};
+
+		quiet-thermal {
+			polling-delay-passive = <0>;
+			polling-delay = <5000>;
+			thermal-sensors = <&pm6125_adc_tm 1>;
+
+			trips {
+				active-config0 {
+					temperature = <125000>;
+					hysteresis = <1000>;
+					type = "critical";
+				};
+			};
+		};
+
+		xo-thermal {
+			polling-delay-passive = <0>;
+			polling-delay = <0>;
+			thermal-sensors = <&pm6125_adc_tm 2>;
+
+			trips {
+				active-config0 {
+					temperature = <125000>;
+					hysteresis = <1000>;
+					type = "critical";
+				};
+			};
+		};
+
+		rf-pa1-thermal {
+			polling-delay-passive = <0>;
+			polling-delay = <0>;
+			thermal-sensors = <&pm6125_adc_tm 3>;
+
+			trips {
+				active-config0 {
+					temperature = <125000>;
+					hysteresis = <1000>;
+					type = "critical";
+				};
+			};
+		};
+	};
 };
 
 &hsusb_phy1 {
 	status = "okay";
 };
 
+&pm6125_adc {
+	pinctrl-names = "default";
+	pinctrl-0 = <&camera_flash_therm &emmc_ufs_therm &rf_pa1_therm>;
+
+	rf-pa0-therm@4d {
+		reg = <ADC5_AMUX_THM1_100K_PU>;
+		qcom,ratiometric;
+		qcom,hw-settle-time = <200>;
+		qcom,pre-scaling = <1 1>;
+	};
+
+	quiet-therm@4e {
+		reg = <ADC5_AMUX_THM2_100K_PU>;
+		qcom,ratiometric;
+		qcom,hw-settle-time = <200>;
+		qcom,pre-scaling = <1 1>;
+	};
+
+	camera-flash-therm@52 {
+		reg = <ADC5_GPIO1_100K_PU>;
+		qcom,ratiometric;
+		qcom,hw-settle-time = <200>;
+		qcom,pre-scaling = <1 1>;
+	};
+
+	emmc-ufs-therm@54 {
+		reg = <ADC5_GPIO3_100K_PU>;
+		qcom,ratiometric;
+		qcom,hw-settle-time = <200>;
+		qcom,pre-scaling = <1 1>;
+	};
+
+	rf-pa1-therm@55 {
+		reg = <ADC5_GPIO4_100K_PU>;
+		qcom,ratiometric;
+		qcom,hw-settle-time = <200>;
+		qcom,pre-scaling = <1 1>;
+	};
+};
+
+&pm6125_adc_tm {
+	status = "okay";
+
+	rf-pa0-therm@0 {
+		reg = <0>;
+		io-channels = <&pm6125_adc ADC5_AMUX_THM1_100K_PU>;
+		qcom,ratiometric;
+		qcom,hw-settle-time-us = <200>;
+	};
+
+	quiet-therm@1 {
+		reg = <1>;
+		io-channels = <&pm6125_adc ADC5_AMUX_THM2_100K_PU>;
+		qcom,ratiometric;
+		qcom,hw-settle-time-us = <200>;
+	};
+
+	xo-therm@2 {
+		reg = <2>;
+		io-channels = <&pm6125_adc ADC5_XO_THERM_100K_PU>;
+		qcom,ratiometric;
+		qcom,hw-settle-time-us = <200>;
+	};
+
+	rf-pa1-therm@3 {
+		reg = <3>;
+		io-channels = <&pm6125_adc ADC5_GPIO4_100K_PU>;
+		qcom,ratiometric;
+		qcom,hw-settle-time-us = <200>;
+	};
+};
+
+&pm6125_gpio {
+	camera_flash_therm: camera-flash-therm-state {
+		pins = "gpio3";
+		function = PMIC_GPIO_FUNC_NORMAL;
+		bias-high-impedance;
+	};
+
+	emmc_ufs_therm: emmc-ufs-therm-state {
+		pins = "gpio6";
+		function = PMIC_GPIO_FUNC_NORMAL;
+		bias-high-impedance;
+	};
+
+	rf_pa1_therm: rf-pa1-therm-state {
+		pins = "gpio7";
+		function = PMIC_GPIO_FUNC_NORMAL;
+		bias-high-impedance;
+	};
+};
+
 &pon_pwrkey {
 	status = "okay";
 };
-- 
2.37.1


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

* Re: [PATCH v2 2/5] iio: adc: qcom-spmi-adc5: Add missing VCOIN/GPIO[134] channels
  2022-08-05 13:57 ` [PATCH v2 2/5] iio: adc: qcom-spmi-adc5: Add missing VCOIN/GPIO[134] channels Marijn Suijten
@ 2022-08-06 14:24   ` Jonathan Cameron
  0 siblings, 0 replies; 10+ messages in thread
From: Jonathan Cameron @ 2022-08-06 14:24 UTC (permalink / raw)
  To: Marijn Suijten
  Cc: phone-devel, ~postmarketos/upstreaming,
	AngeloGioacchino Del Regno, Konrad Dybcio, Martin Botka,
	Jami Kettunen, Andy Gross, Bjorn Andersson, Rob Herring,
	Krzysztof Kozlowski, Lars-Peter Clausen, linux-arm-msm,
	devicetree, linux-kernel, linux-iio

On Fri,  5 Aug 2022 15:57:26 +0200
Marijn Suijten <marijn.suijten@somainline.org> wrote:

> These channels are specified in downstream kernels [1] and actively used
> by e.g. the Sony Seine platform on the SM6125 SoC.  Note that GPIO2
> isn't used on this platform and, while the definition downstream is
> identical to the other GPIOx_100K_PU definitions, has been omitted for
> lack of proper testing.
> 
> [1]: https://source.codeaurora.org/quic/la/kernel/msm-4.14/tree/drivers/iio/adc/qcom-spmi-adc5.c?h=LA.UM.7.11.r1-05200-NICOBAR.0#n688
> 
> Signed-off-by: Marijn Suijten <marijn.suijten@somainline.org>
> Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@somainline.org>
Applied to the togreg branch of iio.git.  Note that I'll only push it out as testing
for now as I plan to rebase after rc1 is available.

Thanks,

Jonathan

> ---
>  drivers/iio/adc/qcom-spmi-adc5.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/drivers/iio/adc/qcom-spmi-adc5.c b/drivers/iio/adc/qcom-spmi-adc5.c
> index 87438d1e5c0b..0dc4fe612433 100644
> --- a/drivers/iio/adc/qcom-spmi-adc5.c
> +++ b/drivers/iio/adc/qcom-spmi-adc5.c
> @@ -526,6 +526,8 @@ static const struct adc5_channels adc5_chans_pmic[ADC5_MAX_CHANNEL] = {
>  					SCALE_HW_CALIB_DEFAULT)
>  	[ADC5_VBAT_SNS]		= ADC5_CHAN_VOLT("vbat_sns", 1,
>  					SCALE_HW_CALIB_DEFAULT)
> +	[ADC5_VCOIN]		= ADC5_CHAN_VOLT("vcoin", 1,
> +					SCALE_HW_CALIB_DEFAULT)
>  	[ADC5_DIE_TEMP]		= ADC5_CHAN_TEMP("die_temp", 0,
>  					SCALE_HW_CALIB_PMIC_THERM)
>  	[ADC5_USB_IN_I]		= ADC5_CHAN_VOLT("usb_in_i_uv", 0,
> @@ -549,6 +551,12 @@ static const struct adc5_channels adc5_chans_pmic[ADC5_MAX_CHANNEL] = {
>  					SCALE_HW_CALIB_THERM_100K_PULLUP)
>  	[ADC5_AMUX_THM2]	= ADC5_CHAN_TEMP("amux_thm2", 0,
>  					SCALE_HW_CALIB_PM5_SMB_TEMP)
> +	[ADC5_GPIO1_100K_PU]	= ADC5_CHAN_TEMP("gpio1_100k_pu", 0,
> +					SCALE_HW_CALIB_THERM_100K_PULLUP)
> +	[ADC5_GPIO3_100K_PU]	= ADC5_CHAN_TEMP("gpio3_100k_pu", 0,
> +					SCALE_HW_CALIB_THERM_100K_PULLUP)
> +	[ADC5_GPIO4_100K_PU]	= ADC5_CHAN_TEMP("gpio4_100k_pu", 0,
> +					SCALE_HW_CALIB_THERM_100K_PULLUP)
>  };
>  
>  static const struct adc5_channels adc7_chans_pmic[ADC5_MAX_CHANNEL] = {


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

* Re: [PATCH v2 3/5] arm64: dts: qcom: Add PM6125 PMIC
  2022-08-05 13:57 ` [PATCH v2 3/5] arm64: dts: qcom: Add PM6125 PMIC Marijn Suijten
@ 2022-08-08  9:17   ` Krzysztof Kozlowski
  2022-09-07 21:27     ` Marijn Suijten
  0 siblings, 1 reply; 10+ messages in thread
From: Krzysztof Kozlowski @ 2022-08-08  9:17 UTC (permalink / raw)
  To: Marijn Suijten, phone-devel
  Cc: ~postmarketos/upstreaming, AngeloGioacchino Del Regno,
	Konrad Dybcio, Martin Botka, Jami Kettunen, Andy Gross,
	Bjorn Andersson, Rob Herring, Krzysztof Kozlowski,
	Jonathan Cameron, Lars-Peter Clausen, linux-arm-msm, devicetree,
	linux-kernel, linux-iio

On 05/08/2022 16:57, Marijn Suijten wrote:
> This PMIC is commonly used on boards with an SM6125 SoC and looks very
> similar in layout to the PM6150.
> 
> Downstream declares more nodes to be available, but these have been
> omitted from this patch: the pwm/lpg block is unused on my reference
> device making it impossible to test/validate, and the spmi-clkdiv does
> not have a single device-tree binding using this driver yet, hence
> inclusion is better postponed until ie. audio which uses these clocks is
> brought up.
> 

Thank you for your patch. There is something to discuss/improve.

> +
> +			xo-therm@4c {
> +				reg = <ADC5_XO_THERM_100K_PU>;
> +				qcom,pre-scaling = <1 1>;
> +				qcom,hw-settle-time = <200>;
> +				qcom,ratiometric;
> +			};
> +		};
> +
> +		pm6125_adc_tm: adc-tm@3500 {

Generic node names, so either this is adc or thermal-sensor. Looks like
thermal-sensor.

> +			compatible = "qcom,spmi-adc-tm5";
> +			reg = <0x3500>;
> +			interrupts = <0x0 0x35 0x0 IRQ_TYPE_EDGE_RISING>;
> +			#address-cells = <1>;
> +			#size-cells = <0>;
> +			#thermal-sensor-cells = <1>;
> +			status = "disabled";
> +		};
> +
> +		pm6125_rtc: rtc@6000 {
> +			compatible = "qcom,pm8941-rtc";
> +			reg = <0x6000>, <0x6100>;
> +			reg-names = "rtc", "alarm";
> +			interrupts = <0x0 0x61 0x1 IRQ_TYPE_EDGE_RISING>;
> +			status = "disabled";
> +		};
> +
> +		pm6125_gpio: gpios@c000 {

s/gpios/gpio/

> +			compatible = "qcom,pm6125-gpio", "qcom,spmi-gpio";
> +			reg = <0xc000>;
> +			gpio-controller;
> +			gpio-ranges = <&pm6125_gpio 0 0 9>;
> +			#gpio-cells = <2>;
> +			interrupt-controller;
> +			#interrupt-cells = <2>;
> +		};
> +	};
> +
> +	pmic@1 {
> +		compatible = "qcom,pm6125", "qcom,spmi-pmic";
> +		reg = <0x1 SPMI_USID>;
> +	};
> +};


Best regards,
Krzysztof

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

* Re: [PATCH v2 3/5] arm64: dts: qcom: Add PM6125 PMIC
  2022-08-08  9:17   ` Krzysztof Kozlowski
@ 2022-09-07 21:27     ` Marijn Suijten
  2022-09-08  7:26       ` Krzysztof Kozlowski
  0 siblings, 1 reply; 10+ messages in thread
From: Marijn Suijten @ 2022-09-07 21:27 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: phone-devel, ~postmarketos/upstreaming,
	AngeloGioacchino Del Regno, Konrad Dybcio, Martin Botka,
	Jami Kettunen, Andy Gross, Bjorn Andersson, Rob Herring,
	Krzysztof Kozlowski, Jonathan Cameron, Lars-Peter Clausen,
	linux-arm-msm, devicetree, linux-kernel, linux-iio

On 2022-08-08 12:17:06, Krzysztof Kozlowski wrote:
> On 05/08/2022 16:57, Marijn Suijten wrote:
> > This PMIC is commonly used on boards with an SM6125 SoC and looks very
> > similar in layout to the PM6150.
> > 
> > Downstream declares more nodes to be available, but these have been
> > omitted from this patch: the pwm/lpg block is unused on my reference
> > device making it impossible to test/validate, and the spmi-clkdiv does
> > not have a single device-tree binding using this driver yet, hence
> > inclusion is better postponed until ie. audio which uses these clocks is
> > brought up.
> > 
> 
> Thank you for your patch. There is something to discuss/improve.

I can respin the series with the suggested changes (and the iio patch
removed as that has now been applied), but note that all other PMIC dtsi
files as of -next today still carry the "wrong" adc-tm or gpios node
names.  Are there plans to patch those up too (if not already in a
series that I missed)?

- Marijn

> > +
> > +			xo-therm@4c {
> > +				reg = <ADC5_XO_THERM_100K_PU>;
> > +				qcom,pre-scaling = <1 1>;
> > +				qcom,hw-settle-time = <200>;
> > +				qcom,ratiometric;
> > +			};
> > +		};
> > +
> > +		pm6125_adc_tm: adc-tm@3500 {
> 
> Generic node names, so either this is adc or thermal-sensor. Looks like
> thermal-sensor.
> 
> > +			compatible = "qcom,spmi-adc-tm5";
> > +			reg = <0x3500>;
> > +			interrupts = <0x0 0x35 0x0 IRQ_TYPE_EDGE_RISING>;
> > +			#address-cells = <1>;
> > +			#size-cells = <0>;
> > +			#thermal-sensor-cells = <1>;
> > +			status = "disabled";
> > +		};
> > +
> > +		pm6125_rtc: rtc@6000 {
> > +			compatible = "qcom,pm8941-rtc";
> > +			reg = <0x6000>, <0x6100>;
> > +			reg-names = "rtc", "alarm";
> > +			interrupts = <0x0 0x61 0x1 IRQ_TYPE_EDGE_RISING>;
> > +			status = "disabled";
> > +		};
> > +
> > +		pm6125_gpio: gpios@c000 {
> 
> s/gpios/gpio/
> 
> > +			compatible = "qcom,pm6125-gpio", "qcom,spmi-gpio";
> > +			reg = <0xc000>;
> > +			gpio-controller;
> > +			gpio-ranges = <&pm6125_gpio 0 0 9>;
> > +			#gpio-cells = <2>;
> > +			interrupt-controller;
> > +			#interrupt-cells = <2>;
> > +		};
> > +	};
> > +
> > +	pmic@1 {
> > +		compatible = "qcom,pm6125", "qcom,spmi-pmic";
> > +		reg = <0x1 SPMI_USID>;
> > +	};
> > +};
> 
> 
> Best regards,
> Krzysztof

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

* Re: [PATCH v2 3/5] arm64: dts: qcom: Add PM6125 PMIC
  2022-09-07 21:27     ` Marijn Suijten
@ 2022-09-08  7:26       ` Krzysztof Kozlowski
  0 siblings, 0 replies; 10+ messages in thread
From: Krzysztof Kozlowski @ 2022-09-08  7:26 UTC (permalink / raw)
  To: Marijn Suijten, phone-devel, ~postmarketos/upstreaming,
	AngeloGioacchino Del Regno, Konrad Dybcio, Martin Botka,
	Jami Kettunen, Andy Gross, Bjorn Andersson, Rob Herring,
	Krzysztof Kozlowski, Jonathan Cameron, Lars-Peter Clausen,
	linux-arm-msm, devicetree, linux-kernel, linux-iio

On 07/09/2022 23:27, Marijn Suijten wrote:
> On 2022-08-08 12:17:06, Krzysztof Kozlowski wrote:
>> On 05/08/2022 16:57, Marijn Suijten wrote:
>>> This PMIC is commonly used on boards with an SM6125 SoC and looks very
>>> similar in layout to the PM6150.
>>>
>>> Downstream declares more nodes to be available, but these have been
>>> omitted from this patch: the pwm/lpg block is unused on my reference
>>> device making it impossible to test/validate, and the spmi-clkdiv does
>>> not have a single device-tree binding using this driver yet, hence
>>> inclusion is better postponed until ie. audio which uses these clocks is
>>> brought up.
>>>
>>
>> Thank you for your patch. There is something to discuss/improve.
> 
> I can respin the series with the suggested changes (and the iio patch
> removed as that has now been applied), but note that all other PMIC dtsi
> files as of -next today still carry the "wrong" adc-tm or gpios node
> names.  Are there plans to patch those up too (if not already in a
> series that I missed)?

See below

> 
> - Marijn
> 
>>> +
>>> +			xo-therm@4c {
>>> +				reg = <ADC5_XO_THERM_100K_PU>;
>>> +				qcom,pre-scaling = <1 1>;
>>> +				qcom,hw-settle-time = <200>;
>>> +				qcom,ratiometric;
>>> +			};
>>> +		};
>>> +
>>> +		pm6125_adc_tm: adc-tm@3500 {
>>
>> Generic node names, so either this is adc or thermal-sensor. Looks like
>> thermal-sensor.

My comment was here not correct. The schema indeed expects this to be
adc-tm. I did not plan to change it, so let's keep adc-tm also here.

>>
>>> +			compatible = "qcom,spmi-adc-tm5";
>>> +			reg = <0x3500>;
>>> +			interrupts = <0x0 0x35 0x0 IRQ_TYPE_EDGE_RISING>;
>>> +			#address-cells = <1>;
>>> +			#size-cells = <0>;
>>> +			#thermal-sensor-cells = <1>;
>>> +			status = "disabled";
>>> +		};
>>> +
>>> +		pm6125_rtc: rtc@6000 {
>>> +			compatible = "qcom,pm8941-rtc";
>>> +			reg = <0x6000>, <0x6100>;
>>> +			reg-names = "rtc", "alarm";
>>> +			interrupts = <0x0 0x61 0x1 IRQ_TYPE_EDGE_RISING>;
>>> +			status = "disabled";
>>> +		};
>>> +
>>> +		pm6125_gpio: gpios@c000 {
>>
>> s/gpios/gpio/

Both are allowed by schema, but convention in all other cases is "gpio",
so let's change it. I'll send a patch for other files.

Best regards,
Krzysztof

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

end of thread, other threads:[~2022-09-08  7:26 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-05 13:57 [PATCH v2 0/5] Add Qcom PM6125 PMIC, and use in Sony Xperia Seine PDX201 Marijn Suijten
2022-08-05 13:57 ` [PATCH v2 1/5] arm64: dts: qcom: pm660: Use unique ADC5_VCOIN address in node name Marijn Suijten
2022-08-05 13:57 ` [PATCH v2 2/5] iio: adc: qcom-spmi-adc5: Add missing VCOIN/GPIO[134] channels Marijn Suijten
2022-08-06 14:24   ` Jonathan Cameron
2022-08-05 13:57 ` [PATCH v2 3/5] arm64: dts: qcom: Add PM6125 PMIC Marijn Suijten
2022-08-08  9:17   ` Krzysztof Kozlowski
2022-09-07 21:27     ` Marijn Suijten
2022-09-08  7:26       ` Krzysztof Kozlowski
2022-08-05 13:57 ` [PATCH v2 4/5] arm64: dts: qcom: sm6125-seine: Include PM6125 and configure PON Marijn Suijten
2022-08-05 13:57 ` [PATCH v2 5/5] arm64: dts: qcom: sm6125-seine: Configure additional trinket thermistors Marijn Suijten

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).