linux-leds.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 0/3] Add PMI632 PMIC and RGB LED on sdm632-fairphone-fp3
@ 2023-05-23 20:41 Luca Weiss
  2023-05-23 20:41 ` [PATCH v3 1/3] arm64: dts: qcom: Add PMI632 PMIC Luca Weiss
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Luca Weiss @ 2023-05-23 20:41 UTC (permalink / raw)
  To: ~postmarketos/upstreaming, phone-devel, Andy Gross,
	Bjorn Andersson, Konrad Dybcio, Linus Walleij, Rob Herring,
	Krzysztof Kozlowski, Pavel Machek, Lee Jones, Jonathan Cameron,
	Lars-Peter Clausen, Stephen Boyd, Jonathan Corbet, Conor Dooley
  Cc: linux-arm-msm, linux-gpio, devicetree, linux-kernel, linux-leds,
	linux-iio, linux-doc, Luca Weiss

Add support for the PMI632 PMIC in the spmi-gpio & qcom-lpg driver, add
the dtsi for the PMIC and enable the notification LED on fairphone-fp3.

Signed-off-by: Luca Weiss <luca@z3ntu.xyz>
---
Changes in v3:
- Pick up tags
- Drop patches that have been applied
- Link to v2: https://lore.kernel.org/r/20230414-pmi632-v2-0-98bafa909c36@z3ntu.xyz

Changes in v2:
- Add qcom,pmi632-gpio to all the needed places in yaml
- Add patch documenting led path
- Pick up tags
- Drop vadc pre-scaling patch since it was applied
- Link to v1: https://lore.kernel.org/r/20230414-pmi632-v1-0-fe94dc414832@z3ntu.xyz

---
Luca Weiss (3):
      arm64: dts: qcom: Add PMI632 PMIC
      arm64: dts: qcom: sdm632-fairphone-fp3: Add notification LED
      Documentation: leds: Add "rgb:status" path

 Documentation/leds/well-known-leds.txt            |   1 +
 arch/arm64/boot/dts/qcom/pmi632.dtsi              | 165 ++++++++++++++++++++++
 arch/arm64/boot/dts/qcom/sdm632-fairphone-fp3.dts |  29 ++++
 3 files changed, 195 insertions(+)
---
base-commit: 5a3b858944b3a5a297df90353614abfb7c7ef592
change-id: 20230414-pmi632-4ae03225ae75

Best regards,
-- 
Luca Weiss <luca@z3ntu.xyz>


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

* [PATCH v3 1/3] arm64: dts: qcom: Add PMI632 PMIC
  2023-05-23 20:41 [PATCH v3 0/3] Add PMI632 PMIC and RGB LED on sdm632-fairphone-fp3 Luca Weiss
@ 2023-05-23 20:41 ` Luca Weiss
  2023-05-23 20:41 ` [PATCH v3 2/3] arm64: dts: qcom: sdm632-fairphone-fp3: Add notification LED Luca Weiss
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: Luca Weiss @ 2023-05-23 20:41 UTC (permalink / raw)
  To: ~postmarketos/upstreaming, phone-devel, Andy Gross,
	Bjorn Andersson, Konrad Dybcio, Linus Walleij, Rob Herring,
	Krzysztof Kozlowski, Pavel Machek, Lee Jones, Jonathan Cameron,
	Lars-Peter Clausen, Stephen Boyd, Jonathan Corbet, Conor Dooley
  Cc: linux-arm-msm, linux-gpio, devicetree, linux-kernel, linux-leds,
	linux-iio, linux-doc, Luca Weiss

The PMI632, commonly found on SoCs with SDM632 has various standard
functions like ADC, GPIOs, LPG and more.

Reviewed-by: Konrad Dybcio <konrad.dybcio@linaro.org>
Signed-off-by: Luca Weiss <luca@z3ntu.xyz>
---
 arch/arm64/boot/dts/qcom/pmi632.dtsi | 165 +++++++++++++++++++++++++++++++++++
 1 file changed, 165 insertions(+)

diff --git a/arch/arm64/boot/dts/qcom/pmi632.dtsi b/arch/arm64/boot/dts/qcom/pmi632.dtsi
new file mode 100644
index 000000000000..4eb79e0ce40a
--- /dev/null
+++ b/arch/arm64/boot/dts/qcom/pmi632.dtsi
@@ -0,0 +1,165 @@
+// SPDX-License-Identifier: BSD-3-Clause
+/*
+ * Copyright (C) 2023 Luca Weiss <luca@z3ntu.xyz>
+ */
+
+#include <dt-bindings/iio/qcom,spmi-vadc.h>
+#include <dt-bindings/interrupt-controller/irq.h>
+#include <dt-bindings/spmi/spmi.h>
+
+/ {
+	thermal-zones {
+		pmi632-thermal {
+			polling-delay-passive = <100>;
+			polling-delay = <0>;
+
+			thermal-sensors = <&pmi632_temp>;
+
+			trips {
+				trip0 {
+					temperature = <95000>;
+					hysteresis = <0>;
+					type = "passive";
+				};
+
+				trip1 {
+					temperature = <115000>;
+					hysteresis = <0>;
+					type = "hot";
+				};
+
+				trip2 {
+					temperature = <125000>;
+					hysteresis = <0>;
+					type = "critical";
+				};
+			};
+		};
+	};
+};
+
+&spmi_bus {
+	pmic@2 {
+		compatible = "qcom,pmi632", "qcom,spmi-pmic";
+		reg = <0x2 SPMI_USID>;
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		pmi632_temp: temp-alarm@2400 {
+			compatible = "qcom,spmi-temp-alarm";
+			reg = <0x2400>;
+			interrupts = <0x2 0x24 0x0 IRQ_TYPE_EDGE_BOTH>;
+			#thermal-sensor-cells = <0>;
+		};
+
+		pmi632_adc: adc@3100 {
+			compatible = "qcom,spmi-adc5";
+			reg = <0x3100>;
+			#address-cells = <1>;
+			#size-cells = <0>;
+			#io-channel-cells = <1>;
+			interrupts = <0x2 0x31 0x0 IRQ_TYPE_EDGE_RISING>;
+
+			channel@0 {
+				reg = <ADC5_REF_GND>;
+				qcom,pre-scaling = <1 1>;
+				label = "ref_gnd";
+			};
+
+			channel@1 {
+				reg = <ADC5_1P25VREF>;
+				qcom,pre-scaling = <1 1>;
+				label = "vref_1p25";
+			};
+
+			channel@6 {
+				reg = <ADC5_DIE_TEMP>;
+				qcom,pre-scaling = <1 1>;
+				label = "die_temp";
+			};
+
+			channel@7 {
+				reg = <ADC5_USB_IN_I>;
+				qcom,pre-scaling = <1 1>;
+				label = "usb_in_i_uv";
+			};
+
+			channel@8 {
+				reg = <ADC5_USB_IN_V_16>;
+				qcom,pre-scaling = <1 16>;
+				label = "usb_in_v_div_16";
+			};
+
+			channel@9 {
+				reg = <ADC5_CHG_TEMP>;
+				qcom,pre-scaling = <1 1>;
+				label = "chg_temp";
+			};
+
+			channel@4b {
+				reg = <ADC5_BAT_ID_100K_PU>;
+				qcom,hw-settle-time = <200>;
+				qcom,pre-scaling = <1 1>;
+				qcom,ratiometric;
+				label = "bat_id";
+			};
+
+			channel@83 {
+				reg = <ADC5_VPH_PWR>;
+				qcom,pre-scaling = <1 3>;
+				label = "vph_pwr";
+			};
+
+			channel@84 {
+				reg = <ADC5_VBAT_SNS>;
+				qcom,pre-scaling = <1 3>;
+				label = "vbat_sns";
+			};
+		};
+
+		pmi632_adc_tm: adc-tm@3500 {
+			compatible = "qcom,spmi-adc-tm5";
+			reg = <0x3500>;
+			interrupts = <0x2 0x35 0x0 IRQ_TYPE_EDGE_RISING>;
+			#thermal-sensor-cells = <1>;
+			#address-cells = <1>;
+			#size-cells = <0>;
+			status = "disabled";
+		};
+
+		pmi632_sdam_7: nvram@b600 {
+			compatible = "qcom,spmi-sdam";
+			reg = <0xb600>;
+			#address-cells = <1>;
+			#size-cells = <1>;
+			ranges = <0 0xb600 0x100>;
+		};
+
+		pmi632_gpios: gpio@c000 {
+			compatible = "qcom,pmi632-gpio", "qcom,spmi-gpio";
+			reg = <0xc000>;
+			gpio-controller;
+			gpio-ranges = <&pmi632_gpios 0 0 8>;
+			#gpio-cells = <2>;
+			interrupt-controller;
+			#interrupt-cells = <2>;
+		};
+	};
+
+	pmic@3 {
+		compatible = "qcom,pmi632", "qcom,spmi-pmic";
+		reg = <0x3 SPMI_USID>;
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		pmi632_lpg: pwm {
+			compatible = "qcom,pmi632-lpg";
+
+			#address-cells = <1>;
+			#size-cells = <0>;
+			#pwm-cells = <2>;
+
+			status = "disabled";
+		};
+	};
+};

-- 
2.40.1


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

* [PATCH v3 2/3] arm64: dts: qcom: sdm632-fairphone-fp3: Add notification LED
  2023-05-23 20:41 [PATCH v3 0/3] Add PMI632 PMIC and RGB LED on sdm632-fairphone-fp3 Luca Weiss
  2023-05-23 20:41 ` [PATCH v3 1/3] arm64: dts: qcom: Add PMI632 PMIC Luca Weiss
@ 2023-05-23 20:41 ` Luca Weiss
  2023-05-23 20:41 ` [PATCH v3 3/3] Documentation: leds: Add "rgb:status" path Luca Weiss
  2023-05-25  4:54 ` (subset) [PATCH v3 0/3] Add PMI632 PMIC and RGB LED on sdm632-fairphone-fp3 Bjorn Andersson
  3 siblings, 0 replies; 6+ messages in thread
From: Luca Weiss @ 2023-05-23 20:41 UTC (permalink / raw)
  To: ~postmarketos/upstreaming, phone-devel, Andy Gross,
	Bjorn Andersson, Konrad Dybcio, Linus Walleij, Rob Herring,
	Krzysztof Kozlowski, Pavel Machek, Lee Jones, Jonathan Cameron,
	Lars-Peter Clausen, Stephen Boyd, Jonathan Corbet, Conor Dooley
  Cc: linux-arm-msm, linux-gpio, devicetree, linux-kernel, linux-leds,
	linux-iio, linux-doc, Luca Weiss

The phone features a notification LED connected to the pmi632. Configure
the RGB led found on it.

Reviewed-by: Konrad Dybcio <konrad.dybcio@linaro.org>
Signed-off-by: Luca Weiss <luca@z3ntu.xyz>
---
 arch/arm64/boot/dts/qcom/sdm632-fairphone-fp3.dts | 29 +++++++++++++++++++++++
 1 file changed, 29 insertions(+)

diff --git a/arch/arm64/boot/dts/qcom/sdm632-fairphone-fp3.dts b/arch/arm64/boot/dts/qcom/sdm632-fairphone-fp3.dts
index 70e683b7e4fc..301eca9a4f31 100644
--- a/arch/arm64/boot/dts/qcom/sdm632-fairphone-fp3.dts
+++ b/arch/arm64/boot/dts/qcom/sdm632-fairphone-fp3.dts
@@ -4,8 +4,10 @@
  */
 /dts-v1/;
 
+#include <dt-bindings/leds/common.h>
 #include "sdm632.dtsi"
 #include "pm8953.dtsi"
+#include "pmi632.dtsi"
 
 / {
 	model = "Fairphone 3";
@@ -83,6 +85,33 @@ &pm8953_resin {
 	linux,code = <KEY_VOLUMEDOWN>;
 };
 
+&pmi632_lpg {
+	status = "okay";
+
+	multi-led {
+		color = <LED_COLOR_ID_RGB>;
+		function = LED_FUNCTION_STATUS;
+
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		led@1 {
+			reg = <1>;
+			color = <LED_COLOR_ID_RED>;
+		};
+
+		led@2 {
+			reg = <2>;
+			color = <LED_COLOR_ID_GREEN>;
+		};
+
+		led@3 {
+			reg = <3>;
+			color = <LED_COLOR_ID_BLUE>;
+		};
+	};
+};
+
 &sdhc_1 {
 	status = "okay";
 	vmmc-supply = <&pm8953_l8>;

-- 
2.40.1


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

* [PATCH v3 3/3] Documentation: leds: Add "rgb:status" path
  2023-05-23 20:41 [PATCH v3 0/3] Add PMI632 PMIC and RGB LED on sdm632-fairphone-fp3 Luca Weiss
  2023-05-23 20:41 ` [PATCH v3 1/3] arm64: dts: qcom: Add PMI632 PMIC Luca Weiss
  2023-05-23 20:41 ` [PATCH v3 2/3] arm64: dts: qcom: sdm632-fairphone-fp3: Add notification LED Luca Weiss
@ 2023-05-23 20:41 ` Luca Weiss
  2023-05-25 11:48   ` Lee Jones
  2023-05-25  4:54 ` (subset) [PATCH v3 0/3] Add PMI632 PMIC and RGB LED on sdm632-fairphone-fp3 Bjorn Andersson
  3 siblings, 1 reply; 6+ messages in thread
From: Luca Weiss @ 2023-05-23 20:41 UTC (permalink / raw)
  To: ~postmarketos/upstreaming, phone-devel, Andy Gross,
	Bjorn Andersson, Konrad Dybcio, Linus Walleij, Rob Herring,
	Krzysztof Kozlowski, Pavel Machek, Lee Jones, Jonathan Cameron,
	Lars-Peter Clausen, Stephen Boyd, Jonathan Corbet, Conor Dooley
  Cc: linux-arm-msm, linux-gpio, devicetree, linux-kernel, linux-leds,
	linux-iio, linux-doc, Luca Weiss

The path /sys/class/leds/rgb:status is already widely used with the
qcom-lpg driver and others. Document it.

Signed-off-by: Luca Weiss <luca@z3ntu.xyz>
---
 Documentation/leds/well-known-leds.txt | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/leds/well-known-leds.txt b/Documentation/leds/well-known-leds.txt
index e9c30dc75884..bfbb5892154d 100644
--- a/Documentation/leds/well-known-leds.txt
+++ b/Documentation/leds/well-known-leds.txt
@@ -58,6 +58,7 @@ LEDs on notebook body, indicating that sound input / output is muted.
 
 * System notification
 
+Good: "rgb:status"
 Legacy: "status-led:{red,green,blue}" (Motorola Droid 4)
 Legacy: "lp5523:{r,g,b}" (Nokia N900)
 

-- 
2.40.1


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

* Re: (subset) [PATCH v3 0/3] Add PMI632 PMIC and RGB LED on sdm632-fairphone-fp3
  2023-05-23 20:41 [PATCH v3 0/3] Add PMI632 PMIC and RGB LED on sdm632-fairphone-fp3 Luca Weiss
                   ` (2 preceding siblings ...)
  2023-05-23 20:41 ` [PATCH v3 3/3] Documentation: leds: Add "rgb:status" path Luca Weiss
@ 2023-05-25  4:54 ` Bjorn Andersson
  3 siblings, 0 replies; 6+ messages in thread
From: Bjorn Andersson @ 2023-05-25  4:54 UTC (permalink / raw)
  To: Krzysztof Kozlowski, Lee Jones, Jonathan Cameron, Konrad Dybcio,
	Stephen Boyd, Pavel Machek, Rob Herring, Andy Gross,
	Jonathan Corbet, Lars-Peter Clausen, Luca Weiss,
	~postmarketos/upstreaming, phone-devel, Linus Walleij,
	Conor Dooley
  Cc: linux-kernel, linux-arm-msm, devicetree, linux-leds, linux-iio,
	linux-doc, linux-gpio

On Tue, 23 May 2023 22:41:27 +0200, Luca Weiss wrote:
> Add support for the PMI632 PMIC in the spmi-gpio & qcom-lpg driver, add
> the dtsi for the PMIC and enable the notification LED on fairphone-fp3.
> 
> 

Applied, thanks!

[1/3] arm64: dts: qcom: Add PMI632 PMIC
      commit: a1f0f2ebb044c7248c3f30b98de0f151505bd4bd
[2/3] arm64: dts: qcom: sdm632-fairphone-fp3: Add notification LED
      commit: 0c4f10917d22e6f36080617bfe71de1ae854ee58

Best regards,
-- 
Bjorn Andersson <andersson@kernel.org>

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

* Re: [PATCH v3 3/3] Documentation: leds: Add "rgb:status" path
  2023-05-23 20:41 ` [PATCH v3 3/3] Documentation: leds: Add "rgb:status" path Luca Weiss
@ 2023-05-25 11:48   ` Lee Jones
  0 siblings, 0 replies; 6+ messages in thread
From: Lee Jones @ 2023-05-25 11:48 UTC (permalink / raw)
  To: Luca Weiss
  Cc: ~postmarketos/upstreaming, phone-devel, Andy Gross,
	Bjorn Andersson, Konrad Dybcio, Linus Walleij, Rob Herring,
	Krzysztof Kozlowski, Pavel Machek, Jonathan Cameron,
	Lars-Peter Clausen, Stephen Boyd, Jonathan Corbet, Conor Dooley,
	linux-arm-msm, linux-gpio, devicetree, linux-kernel, linux-leds,
	linux-iio, linux-doc

On Tue, 23 May 2023, Luca Weiss wrote:

> The path /sys/class/leds/rgb:status is already widely used with the
> qcom-lpg driver and others. Document it.
> 
> Signed-off-by: Luca Weiss <luca@z3ntu.xyz>
> ---
>  Documentation/leds/well-known-leds.txt | 1 +
>  1 file changed, 1 insertion(+)

Applied, thanks

-- 
Lee Jones [李琼斯]

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

end of thread, other threads:[~2023-05-25 11:48 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-23 20:41 [PATCH v3 0/3] Add PMI632 PMIC and RGB LED on sdm632-fairphone-fp3 Luca Weiss
2023-05-23 20:41 ` [PATCH v3 1/3] arm64: dts: qcom: Add PMI632 PMIC Luca Weiss
2023-05-23 20:41 ` [PATCH v3 2/3] arm64: dts: qcom: sdm632-fairphone-fp3: Add notification LED Luca Weiss
2023-05-23 20:41 ` [PATCH v3 3/3] Documentation: leds: Add "rgb:status" path Luca Weiss
2023-05-25 11:48   ` Lee Jones
2023-05-25  4:54 ` (subset) [PATCH v3 0/3] Add PMI632 PMIC and RGB LED on sdm632-fairphone-fp3 Bjorn Andersson

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