2023-04-13 23:20:11

by Luca Weiss

[permalink] [raw]
Subject: [PATCH 0/8] Add PMI632 PMIC and RGB LED on sdm632-fairphone-fp3

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 <[email protected]>
---
Luca Weiss (8):
dt-bindings: pinctrl: qcom,pmic-gpio: add PMI632
pinctrl: qcom: spmi-gpio: Add PMI632 support
dt-bindings: leds: qcom-lpg: Add compatible for PMI632 LPG block
leds: qcom-lpg: Add support for PMI632 LPG
dt-bindings: iio: adc: qcom,spmi-vadc: Allow 1/16 for pre-scaling
dt-bindings: mfd: qcom-spmi-pmic: Add PMI632 compatible
arm64: dts: qcom: Add PMI632 PMIC
arm64: dts: qcom: sdm632-fairphone-fp3: Add notification LED

.../bindings/iio/adc/qcom,spmi-vadc.yaml | 2 +-
.../devicetree/bindings/leds/leds-qcom-lpg.yaml | 1 +
.../devicetree/bindings/mfd/qcom,spmi-pmic.yaml | 1 +
.../bindings/pinctrl/qcom,pmic-gpio.yaml | 2 +
arch/arm64/boot/dts/qcom/pmi632.dtsi | 165 +++++++++++++++++++++
arch/arm64/boot/dts/qcom/sdm632-fairphone-fp3.dts | 29 ++++
drivers/leds/rgb/leds-qcom-lpg.c | 15 ++
drivers/pinctrl/qcom/pinctrl-spmi-gpio.c | 1 +
8 files changed, 215 insertions(+), 1 deletion(-)
---
base-commit: c83fb1e4acf528c29b0729525cf23544f8121b3d
change-id: 20230414-pmi632-4ae03225ae75

Best regards,
--
Luca Weiss <[email protected]>


2023-04-13 23:20:11

by Luca Weiss

[permalink] [raw]
Subject: [PATCH 7/8] arm64: dts: qcom: Add PMI632 PMIC

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

Signed-off-by: Luca Weiss <[email protected]>
---
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 <[email protected]>
+ */
+
+#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.0

2023-04-13 23:20:26

by Luca Weiss

[permalink] [raw]
Subject: [PATCH 2/8] pinctrl: qcom: spmi-gpio: Add PMI632 support

Add support for the 8 GPIOs found on PMI632.

Signed-off-by: Luca Weiss <[email protected]>
---
drivers/pinctrl/qcom/pinctrl-spmi-gpio.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/pinctrl/qcom/pinctrl-spmi-gpio.c b/drivers/pinctrl/qcom/pinctrl-spmi-gpio.c
index ea3485344f06..40cab13e5a83 100644
--- a/drivers/pinctrl/qcom/pinctrl-spmi-gpio.c
+++ b/drivers/pinctrl/qcom/pinctrl-spmi-gpio.c
@@ -1232,6 +1232,7 @@ static const struct of_device_id pmic_gpio_of_match[] = {
{ .compatible = "qcom,pm8994-gpio", .data = (void *) 22 },
{ .compatible = "qcom,pm8998-gpio", .data = (void *) 26 },
{ .compatible = "qcom,pma8084-gpio", .data = (void *) 22 },
+ { .compatible = "qcom,pmi632-gpio", .data = (void *) 8 },
{ .compatible = "qcom,pmi8950-gpio", .data = (void *) 2 },
{ .compatible = "qcom,pmi8994-gpio", .data = (void *) 10 },
{ .compatible = "qcom,pmi8998-gpio", .data = (void *) 14 },

--
2.40.0

2023-04-13 23:20:41

by Luca Weiss

[permalink] [raw]
Subject: [PATCH 6/8] dt-bindings: mfd: qcom-spmi-pmic: Add PMI632 compatible

Document support for the pmi632, often found with the sdm632 SoC.

Signed-off-by: Luca Weiss <[email protected]>
---
Documentation/devicetree/bindings/mfd/qcom,spmi-pmic.yaml | 1 +
1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/mfd/qcom,spmi-pmic.yaml b/Documentation/devicetree/bindings/mfd/qcom,spmi-pmic.yaml
index 84620ebc1efe..09e7195c622b 100644
--- a/Documentation/devicetree/bindings/mfd/qcom,spmi-pmic.yaml
+++ b/Documentation/devicetree/bindings/mfd/qcom,spmi-pmic.yaml
@@ -71,6 +71,7 @@ properties:
- qcom,pm8998
- qcom,pma8084
- qcom,pmd9635
+ - qcom,pmi632
- qcom,pmi8950
- qcom,pmi8962
- qcom,pmi8994

--
2.40.0

2023-04-13 23:20:58

by Luca Weiss

[permalink] [raw]
Subject: [PATCH 3/8] dt-bindings: leds: qcom-lpg: Add compatible for PMI632 LPG block

Document the availability of an LPG configuration for the PMI632 PMIC in
the Qualcomm Light Pulse Generator driver.

Signed-off-by: Luca Weiss <[email protected]>
---
Documentation/devicetree/bindings/leds/leds-qcom-lpg.yaml | 1 +
1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/leds/leds-qcom-lpg.yaml b/Documentation/devicetree/bindings/leds/leds-qcom-lpg.yaml
index 1df837798249..2e4426894bed 100644
--- a/Documentation/devicetree/bindings/leds/leds-qcom-lpg.yaml
+++ b/Documentation/devicetree/bindings/leds/leds-qcom-lpg.yaml
@@ -25,6 +25,7 @@ properties:
- qcom,pm8941-lpg
- qcom,pm8994-lpg
- qcom,pmc8180c-lpg
+ - qcom,pmi632-lpg
- qcom,pmi8994-lpg
- qcom,pmi8998-lpg


--
2.40.0

2023-04-13 23:34:32

by Konrad Dybcio

[permalink] [raw]
Subject: Re: [PATCH 2/8] pinctrl: qcom: spmi-gpio: Add PMI632 support



On 14.04.2023 01:17, Luca Weiss wrote:
> Add support for the 8 GPIOs found on PMI632.
>
> Signed-off-by: Luca Weiss <[email protected]>
> ---
As I've started doing more and more lately, I'll hijack this
patch to discuss the general approach..

I have a feeling that you'll get some comments about
this match list growing, especially since the driver data
is already filled in dt (gpio-ranges).. perhaps we can improve
this..

Especially considering the "qcom,spmi-gpio" fallback is there
(unless we care about 2015 DTs like 0804308fdd3c) that are
unlikely to still work nowadays. Old DTs also used interrupts=<>
to list out all the GPIOs (among the other SPMI fluff) individually
(see e.g. 5f540fb4821a).

Krzysztof, WDYT? Would it be worth taking all of that old junk into
account, or should we keep it as-is?

Konrad
> drivers/pinctrl/qcom/pinctrl-spmi-gpio.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/pinctrl/qcom/pinctrl-spmi-gpio.c b/drivers/pinctrl/qcom/pinctrl-spmi-gpio.c
> index ea3485344f06..40cab13e5a83 100644
> --- a/drivers/pinctrl/qcom/pinctrl-spmi-gpio.c
> +++ b/drivers/pinctrl/qcom/pinctrl-spmi-gpio.c
> @@ -1232,6 +1232,7 @@ static const struct of_device_id pmic_gpio_of_match[] = {
> { .compatible = "qcom,pm8994-gpio", .data = (void *) 22 },
> { .compatible = "qcom,pm8998-gpio", .data = (void *) 26 },
> { .compatible = "qcom,pma8084-gpio", .data = (void *) 22 },
> + { .compatible = "qcom,pmi632-gpio", .data = (void *) 8 },
> { .compatible = "qcom,pmi8950-gpio", .data = (void *) 2 },
> { .compatible = "qcom,pmi8994-gpio", .data = (void *) 10 },
> { .compatible = "qcom,pmi8998-gpio", .data = (void *) 14 },
>

2023-04-14 07:57:12

by Krzysztof Kozlowski

[permalink] [raw]
Subject: Re: [PATCH 3/8] dt-bindings: leds: qcom-lpg: Add compatible for PMI632 LPG block

On 14/04/2023 01:17, Luca Weiss wrote:
> Document the availability of an LPG configuration for the PMI632 PMIC in
> the Qualcomm Light Pulse Generator driver.
>
> Signed-off-by: Luca Weiss <[email protected]>
> ---

Acked-by: Krzysztof Kozlowski <[email protected]>

Best regards,
Krzysztof

2023-04-14 07:57:48

by Krzysztof Kozlowski

[permalink] [raw]
Subject: Re: [PATCH 6/8] dt-bindings: mfd: qcom-spmi-pmic: Add PMI632 compatible

On 14/04/2023 01:17, Luca Weiss wrote:
> Document support for the pmi632, often found with the sdm632 SoC.
>
> Signed-off-by: Luca Weiss <[email protected]>
> ---
> Documentation/devicetree/bindings/mfd/qcom,spmi-pmic.yaml | 1 +

Acked-by: Krzysztof Kozlowski <[email protected]>

Best regards,
Krzysztof

2023-04-14 12:26:55

by Pavel Machek

[permalink] [raw]
Subject: Re: [PATCH 6/8] dt-bindings: mfd: qcom-spmi-pmic: Add PMI632 compatible

On Fri 2023-04-14 01:17:50, Luca Weiss wrote:
> Document support for the pmi632, often found with the sdm632 SoC.
>
> Signed-off-by: Luca Weiss <[email protected]>

5,6: Acked-by: Pavel Machek <[email protected]>

--
People of Russia, stop Putin before his war on Ukraine escalates.


Attachments:
(No filename) (286.00 B)
signature.asc (201.00 B)
Download all attachments

2023-04-21 08:41:17

by Linus Walleij

[permalink] [raw]
Subject: Re: [PATCH 2/8] pinctrl: qcom: spmi-gpio: Add PMI632 support

On Fri, Apr 14, 2023 at 1:18 AM Luca Weiss <[email protected]> wrote:

> Add support for the 8 GPIOs found on PMI632.
>
> Signed-off-by: Luca Weiss <[email protected]>

This patch (2/8) applied as uncontroversial.

Yours,
Linus Walleij