linux-arm-msm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/6] ARM: dts: qcom: apq8074-dragonboard: enable additional devices
@ 2023-05-08 16:04 Dmitry Baryshkov
  2023-05-08 16:04 ` [PATCH v2 1/6] dt-bindings: power: reset: qcom-pon: define pm8941-pon Dmitry Baryshkov
                   ` (5 more replies)
  0 siblings, 6 replies; 16+ messages in thread
From: Dmitry Baryshkov @ 2023-05-08 16:04 UTC (permalink / raw)
  To: Sebastian Reichel, Rob Herring, Krzysztof Kozlowski, Andy Gross,
	Bjorn Andersson, Konrad Dybcio, Vinod Koul
  Cc: linux-pm, devicetree, linux-arm-msm

Add support for buttons, LEDs and coincell charger found on the APQ8074
dragonboard device.

For PM8941 we don't have a defined field to store the reset reason.
Support wrapping pwrkey and resin, but without writing the reset
reason.

Changes since v1 (noted by Konrad):
 - Changed to use freshly defined qcom,pm8941-pon compat
 - Fixed indentiation for LEDs definition
 - Reverted the order of pinctrl fields
 - Moved status field to the last position
 - Removed unnecessary pinconf indirection

Dmitry Baryshkov (6):
  dt-bindings: power: reset: qcom-pon: define pm8941-pon
  power: reset: qcom-pon: add support for pm8941-pon
  ARM: dts: qcom-pm8941: add resin support
  ARM: dts: qcom: apq8074-dragonboard: add resin and gpio keys
  ARM: dts: qcom: apq8074-dragonboard: add onboard leds
  ARM: dts: qcom: apq8074-dragonboard: enable coincell charger

 .../bindings/power/reset/qcom,pon.yaml        |  2 +
 .../arm/boot/dts/qcom-apq8074-dragonboard.dts | 69 +++++++++++++++++++
 arch/arm/boot/dts/qcom-pm8941.dtsi            | 22 ++++--
 drivers/power/reset/qcom-pon.c                | 22 ++++--
 4 files changed, 103 insertions(+), 12 deletions(-)

-- 
2.39.2


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

* [PATCH v2 1/6] dt-bindings: power: reset: qcom-pon: define pm8941-pon
  2023-05-08 16:04 [PATCH v2 0/6] ARM: dts: qcom: apq8074-dragonboard: enable additional devices Dmitry Baryshkov
@ 2023-05-08 16:04 ` Dmitry Baryshkov
  2023-05-09  8:53   ` Konrad Dybcio
  2023-05-08 16:04 ` [PATCH v2 2/6] power: reset: qcom-pon: add support for pm8941-pon Dmitry Baryshkov
                   ` (4 subsequent siblings)
  5 siblings, 1 reply; 16+ messages in thread
From: Dmitry Baryshkov @ 2023-05-08 16:04 UTC (permalink / raw)
  To: Sebastian Reichel, Rob Herring, Krzysztof Kozlowski, Andy Gross,
	Bjorn Andersson, Konrad Dybcio, Vinod Koul
  Cc: linux-pm, devicetree, linux-arm-msm, Krzysztof Kozlowski

On PM8941 pon doesn't store the reset reason. However we still need the
wrapping node for pwrkey and resin nodes. Add bindings for pm8941-pon
device.

Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
---
 Documentation/devicetree/bindings/power/reset/qcom,pon.yaml | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/Documentation/devicetree/bindings/power/reset/qcom,pon.yaml b/Documentation/devicetree/bindings/power/reset/qcom,pon.yaml
index d96170eecbd2..0f4f55dd4eac 100644
--- a/Documentation/devicetree/bindings/power/reset/qcom,pon.yaml
+++ b/Documentation/devicetree/bindings/power/reset/qcom,pon.yaml
@@ -19,6 +19,7 @@ properties:
   compatible:
     enum:
       - qcom,pm8916-pon
+      - qcom,pm8941-pon
       - qcom,pms405-pon
       - qcom,pm8998-pon
       - qcom,pmk8350-pon
@@ -63,6 +64,7 @@ allOf:
           contains:
             enum:
               - qcom,pm8916-pon
+              - qcom,pm8941-pon
               - qcom,pms405-pon
               - qcom,pm8998-pon
     then:
-- 
2.39.2


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

* [PATCH v2 2/6] power: reset: qcom-pon: add support for pm8941-pon
  2023-05-08 16:04 [PATCH v2 0/6] ARM: dts: qcom: apq8074-dragonboard: enable additional devices Dmitry Baryshkov
  2023-05-08 16:04 ` [PATCH v2 1/6] dt-bindings: power: reset: qcom-pon: define pm8941-pon Dmitry Baryshkov
@ 2023-05-08 16:04 ` Dmitry Baryshkov
  2023-05-09  8:51   ` Konrad Dybcio
  2023-05-08 16:04 ` [PATCH v2 3/6] ARM: dts: qcom-pm8941: add resin support Dmitry Baryshkov
                   ` (3 subsequent siblings)
  5 siblings, 1 reply; 16+ messages in thread
From: Dmitry Baryshkov @ 2023-05-08 16:04 UTC (permalink / raw)
  To: Sebastian Reichel, Rob Herring, Krzysztof Kozlowski, Andy Gross,
	Bjorn Andersson, Konrad Dybcio, Vinod Koul
  Cc: linux-pm, devicetree, linux-arm-msm

For PM8941 we don't have a defined field to store the reset reason.
Support wrapping pwrkey and resin, but without writing the reset
reason.

Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
---
 drivers/power/reset/qcom-pon.c | 22 +++++++++++++++-------
 1 file changed, 15 insertions(+), 7 deletions(-)

diff --git a/drivers/power/reset/qcom-pon.c b/drivers/power/reset/qcom-pon.c
index 16bc01738be9..d42475bc0ee6 100644
--- a/drivers/power/reset/qcom-pon.c
+++ b/drivers/power/reset/qcom-pon.c
@@ -17,6 +17,8 @@
 #define GEN1_REASON_SHIFT		2
 #define GEN2_REASON_SHIFT		1
 
+#define NO_REASON_SHIFT			0
+
 struct pm8916_pon {
 	struct device *dev;
 	struct regmap *regmap;
@@ -45,6 +47,7 @@ static int pm8916_reboot_mode_write(struct reboot_mode_driver *reboot,
 static int pm8916_pon_probe(struct platform_device *pdev)
 {
 	struct pm8916_pon *pon;
+	long reason_shift;
 	int error;
 
 	pon = devm_kzalloc(&pdev->dev, sizeof(*pon), GFP_KERNEL);
@@ -64,13 +67,17 @@ static int pm8916_pon_probe(struct platform_device *pdev)
 	if (error)
 		return error;
 
-	pon->reboot_mode.dev = &pdev->dev;
-	pon->reason_shift = (long)of_device_get_match_data(&pdev->dev);
-	pon->reboot_mode.write = pm8916_reboot_mode_write;
-	error = devm_reboot_mode_register(&pdev->dev, &pon->reboot_mode);
-	if (error) {
-		dev_err(&pdev->dev, "can't register reboot mode\n");
-		return error;
+	reason_shift = (long)of_device_get_match_data(&pdev->dev);
+
+	if (reason_shift != NO_REASON_SHIFT) {
+		pon->reboot_mode.dev = &pdev->dev;
+		pon->reason_shift = reason_shift;
+		pon->reboot_mode.write = pm8916_reboot_mode_write;
+		error = devm_reboot_mode_register(&pdev->dev, &pon->reboot_mode);
+		if (error) {
+			dev_err(&pdev->dev, "can't register reboot mode\n");
+			return error;
+		}
 	}
 
 	platform_set_drvdata(pdev, pon);
@@ -80,6 +87,7 @@ static int pm8916_pon_probe(struct platform_device *pdev)
 
 static const struct of_device_id pm8916_pon_id_table[] = {
 	{ .compatible = "qcom,pm8916-pon", .data = (void *)GEN1_REASON_SHIFT },
+	{ .compatible = "qcom,pm8941-pon", .data = (void *)NO_REASON_SHIFT },
 	{ .compatible = "qcom,pms405-pon", .data = (void *)GEN1_REASON_SHIFT },
 	{ .compatible = "qcom,pm8998-pon", .data = (void *)GEN2_REASON_SHIFT },
 	{ .compatible = "qcom,pmk8350-pon", .data = (void *)GEN2_REASON_SHIFT },
-- 
2.39.2


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

* [PATCH v2 3/6] ARM: dts: qcom-pm8941: add resin support
  2023-05-08 16:04 [PATCH v2 0/6] ARM: dts: qcom: apq8074-dragonboard: enable additional devices Dmitry Baryshkov
  2023-05-08 16:04 ` [PATCH v2 1/6] dt-bindings: power: reset: qcom-pon: define pm8941-pon Dmitry Baryshkov
  2023-05-08 16:04 ` [PATCH v2 2/6] power: reset: qcom-pon: add support for pm8941-pon Dmitry Baryshkov
@ 2023-05-08 16:04 ` Dmitry Baryshkov
  2023-05-09  8:52   ` Konrad Dybcio
  2023-05-08 16:04 ` [PATCH v2 4/6] ARM: dts: qcom: apq8074-dragonboard: add resin and gpio keys Dmitry Baryshkov
                   ` (2 subsequent siblings)
  5 siblings, 1 reply; 16+ messages in thread
From: Dmitry Baryshkov @ 2023-05-08 16:04 UTC (permalink / raw)
  To: Sebastian Reichel, Rob Herring, Krzysztof Kozlowski, Andy Gross,
	Bjorn Andersson, Konrad Dybcio, Vinod Koul
  Cc: linux-pm, devicetree, linux-arm-msm

Wrap existing pwrkey and new resin nodes into the new pon node to enable
volume-down key support on platforms using pm8941 PMIC.

Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
---
 arch/arm/boot/dts/qcom-pm8941.dtsi | 22 +++++++++++++++++-----
 1 file changed, 17 insertions(+), 5 deletions(-)

diff --git a/arch/arm/boot/dts/qcom-pm8941.dtsi b/arch/arm/boot/dts/qcom-pm8941.dtsi
index a821f0368a28..cf1fcf97fa88 100644
--- a/arch/arm/boot/dts/qcom-pm8941.dtsi
+++ b/arch/arm/boot/dts/qcom-pm8941.dtsi
@@ -19,12 +19,24 @@ rtc@6000 {
 			interrupts = <0x0 0x61 0x1 IRQ_TYPE_EDGE_RISING>;
 		};
 
-		pwrkey@800 {
-			compatible = "qcom,pm8941-pwrkey";
+		pon@800 {
+			compatible = "qcom,pm8941-pon";
 			reg = <0x800>;
-			interrupts = <0x0 0x8 0 IRQ_TYPE_EDGE_BOTH>;
-			debounce = <15625>;
-			bias-pull-up;
+
+			pwrkey {
+				compatible = "qcom,pm8941-pwrkey";
+				interrupts = <0x0 0x8 0 IRQ_TYPE_EDGE_BOTH>;
+				debounce = <15625>;
+				bias-pull-up;
+			};
+
+			pm8941_resin: resin {
+				compatible = "qcom,pm8941-resin";
+				interrupts = <0x0 0x8 1 IRQ_TYPE_EDGE_BOTH>;
+				debounce = <15625>;
+				bias-pull-up;
+				status = "disabled";
+			};
 		};
 
 		usb_id: usb-detect@900 {
-- 
2.39.2


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

* [PATCH v2 4/6] ARM: dts: qcom: apq8074-dragonboard: add resin and gpio keys
  2023-05-08 16:04 [PATCH v2 0/6] ARM: dts: qcom: apq8074-dragonboard: enable additional devices Dmitry Baryshkov
                   ` (2 preceding siblings ...)
  2023-05-08 16:04 ` [PATCH v2 3/6] ARM: dts: qcom-pm8941: add resin support Dmitry Baryshkov
@ 2023-05-08 16:04 ` Dmitry Baryshkov
  2023-05-09  8:52   ` Konrad Dybcio
  2023-05-08 16:04 ` [PATCH v2 5/6] ARM: dts: qcom: apq8074-dragonboard: add onboard leds Dmitry Baryshkov
  2023-05-08 16:04 ` [PATCH v2 6/6] ARM: dts: qcom: apq8074-dragonboard: enable coincell charger Dmitry Baryshkov
  5 siblings, 1 reply; 16+ messages in thread
From: Dmitry Baryshkov @ 2023-05-08 16:04 UTC (permalink / raw)
  To: Sebastian Reichel, Rob Herring, Krzysztof Kozlowski, Andy Gross,
	Bjorn Andersson, Konrad Dybcio, Vinod Koul
  Cc: linux-pm, devicetree, linux-arm-msm

Add device nodes for resin (reset, volume-down) and gpio-keys
(volume-up, general key) device nodes.

Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
---
 .../arm/boot/dts/qcom-apq8074-dragonboard.dts | 39 +++++++++++++++++++
 1 file changed, 39 insertions(+)

diff --git a/arch/arm/boot/dts/qcom-apq8074-dragonboard.dts b/arch/arm/boot/dts/qcom-apq8074-dragonboard.dts
index 1345df7cbd00..630180edecfd 100644
--- a/arch/arm/boot/dts/qcom-apq8074-dragonboard.dts
+++ b/arch/arm/boot/dts/qcom-apq8074-dragonboard.dts
@@ -1,5 +1,7 @@
 // SPDX-License-Identifier: GPL-2.0
 #include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/input.h>
+#include <dt-bindings/pinctrl/qcom,pmic-gpio.h>
 #include "qcom-msm8974.dtsi"
 #include "qcom-pm8841.dtsi"
 #include "qcom-pm8941.dtsi"
@@ -17,6 +19,26 @@ aliases {
 	chosen {
 		stdout-path = "serial0:115200n8";
 	};
+
+	gpio-keys {
+		compatible = "gpio-keys";
+		autorepeat;
+
+		pinctrl-0 = <&msm_keys_default>;
+		pinctrl-names = "default";
+
+		button-volup {
+			label = "Volume Up";
+			linux,code = <KEY_VOLUMEUP>;
+			gpios = <&pm8941_gpios 5 GPIO_ACTIVE_LOW>;
+		};
+
+		button-general {
+			label = "General";
+			linux,code = <KEY_PROG1>;
+			gpios = <&pm8941_gpios 23 GPIO_ACTIVE_LOW>;
+		};
+	};
 };
 
 &blsp1_uart2 {
@@ -35,6 +57,23 @@ eeprom: eeprom@52 {
 	};
 };
 
+&pm8941_gpios {
+        msm_keys_default: pm8941-gpio-keys-state {
+		pins = "gpio5", "gpio23";
+		function = "normal";
+		input-enable;
+		drive-push-pull;
+		bias-pull-up;
+		qcom,drive-strength = <PMIC_GPIO_STRENGTH_NO>;
+		power-source = <PM8941_GPIO_S3>; /* 1.8V */
+        };
+};
+
+&pm8941_resin {
+	linux,code = <KEY_VOLUMEDOWN>;
+	status = "okay";
+};
+
 &rpm_requests {
 	regulators-0 {
 		compatible = "qcom,rpm-pm8841-regulators";
-- 
2.39.2


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

* [PATCH v2 5/6] ARM: dts: qcom: apq8074-dragonboard: add onboard leds
  2023-05-08 16:04 [PATCH v2 0/6] ARM: dts: qcom: apq8074-dragonboard: enable additional devices Dmitry Baryshkov
                   ` (3 preceding siblings ...)
  2023-05-08 16:04 ` [PATCH v2 4/6] ARM: dts: qcom: apq8074-dragonboard: add resin and gpio keys Dmitry Baryshkov
@ 2023-05-08 16:04 ` Dmitry Baryshkov
  2023-05-08 16:35   ` Krzysztof Kozlowski
  2023-05-09  8:52   ` Konrad Dybcio
  2023-05-08 16:04 ` [PATCH v2 6/6] ARM: dts: qcom: apq8074-dragonboard: enable coincell charger Dmitry Baryshkov
  5 siblings, 2 replies; 16+ messages in thread
From: Dmitry Baryshkov @ 2023-05-08 16:04 UTC (permalink / raw)
  To: Sebastian Reichel, Rob Herring, Krzysztof Kozlowski, Andy Gross,
	Bjorn Andersson, Konrad Dybcio, Vinod Koul
  Cc: linux-pm, devicetree, linux-arm-msm

The dragonboard as three LEDs: red, green and blue. Add corresponding
description.

Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
---
 .../arm/boot/dts/qcom-apq8074-dragonboard.dts | 24 +++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/arch/arm/boot/dts/qcom-apq8074-dragonboard.dts b/arch/arm/boot/dts/qcom-apq8074-dragonboard.dts
index 630180edecfd..07db6451f273 100644
--- a/arch/arm/boot/dts/qcom-apq8074-dragonboard.dts
+++ b/arch/arm/boot/dts/qcom-apq8074-dragonboard.dts
@@ -1,6 +1,7 @@
 // SPDX-License-Identifier: GPL-2.0
 #include <dt-bindings/gpio/gpio.h>
 #include <dt-bindings/input/input.h>
+#include <dt-bindings/leds/common.h>
 #include <dt-bindings/pinctrl/qcom,pmic-gpio.h>
 #include "qcom-msm8974.dtsi"
 #include "qcom-pm8841.dtsi"
@@ -69,6 +70,29 @@ msm_keys_default: pm8941-gpio-keys-state {
         };
 };
 
+&pm8941_lpg {
+        qcom,power-source = <1>;
+	status = "okay";
+
+	led@5 {
+		reg = <5>;
+		color = <LED_COLOR_ID_BLUE>;
+		function = LED_FUNCTION_INDICATOR;
+	};
+
+	led@6 {
+		reg = <6>;
+		color = <LED_COLOR_ID_GREEN>;
+		function = LED_FUNCTION_INDICATOR;
+	};
+
+	led@7 {
+		reg = <7>;
+		color = <LED_COLOR_ID_RED>;
+		function = LED_FUNCTION_INDICATOR;
+	};
+};
+
 &pm8941_resin {
 	linux,code = <KEY_VOLUMEDOWN>;
 	status = "okay";
-- 
2.39.2


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

* [PATCH v2 6/6] ARM: dts: qcom: apq8074-dragonboard: enable coincell charger
  2023-05-08 16:04 [PATCH v2 0/6] ARM: dts: qcom: apq8074-dragonboard: enable additional devices Dmitry Baryshkov
                   ` (4 preceding siblings ...)
  2023-05-08 16:04 ` [PATCH v2 5/6] ARM: dts: qcom: apq8074-dragonboard: add onboard leds Dmitry Baryshkov
@ 2023-05-08 16:04 ` Dmitry Baryshkov
  2023-05-23 23:34   ` Dmitry Baryshkov
  5 siblings, 1 reply; 16+ messages in thread
From: Dmitry Baryshkov @ 2023-05-08 16:04 UTC (permalink / raw)
  To: Sebastian Reichel, Rob Herring, Krzysztof Kozlowski, Andy Gross,
	Bjorn Andersson, Konrad Dybcio, Vinod Koul
  Cc: linux-pm, devicetree, linux-arm-msm

Enable coincell charger for the coin battery which can be installed on
the APQ8074 dragonboard.

Reviewed-by: Konrad Dybcio <konrad.dybcio@linaro.org>
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
---
 arch/arm/boot/dts/qcom-apq8074-dragonboard.dts | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/arch/arm/boot/dts/qcom-apq8074-dragonboard.dts b/arch/arm/boot/dts/qcom-apq8074-dragonboard.dts
index 07db6451f273..93a059641957 100644
--- a/arch/arm/boot/dts/qcom-apq8074-dragonboard.dts
+++ b/arch/arm/boot/dts/qcom-apq8074-dragonboard.dts
@@ -58,6 +58,12 @@ eeprom: eeprom@52 {
 	};
 };
 
+&pm8941_coincell {
+	qcom,rset-ohms = <2100>;
+	qcom,vset-millivolts = <3000>;
+	status = "okay";
+};
+
 &pm8941_gpios {
         msm_keys_default: pm8941-gpio-keys-state {
 		pins = "gpio5", "gpio23";
-- 
2.39.2


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

* Re: [PATCH v2 5/6] ARM: dts: qcom: apq8074-dragonboard: add onboard leds
  2023-05-08 16:04 ` [PATCH v2 5/6] ARM: dts: qcom: apq8074-dragonboard: add onboard leds Dmitry Baryshkov
@ 2023-05-08 16:35   ` Krzysztof Kozlowski
  2023-05-09  8:52   ` Konrad Dybcio
  1 sibling, 0 replies; 16+ messages in thread
From: Krzysztof Kozlowski @ 2023-05-08 16:35 UTC (permalink / raw)
  To: Dmitry Baryshkov, Sebastian Reichel, Rob Herring,
	Krzysztof Kozlowski, Andy Gross, Bjorn Andersson, Konrad Dybcio,
	Vinod Koul
  Cc: linux-pm, devicetree, linux-arm-msm

On 08/05/2023 18:04, Dmitry Baryshkov wrote:
> The dragonboard as three LEDs: red, green and blue. Add corresponding
> description.
> 
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> ---
>  .../arm/boot/dts/qcom-apq8074-dragonboard.dts | 24 +++++++++++++++++++
>  1 file changed, 24 insertions(+)
> 
> diff --git a/arch/arm/boot/dts/qcom-apq8074-dragonboard.dts b/arch/arm/boot/dts/qcom-apq8074-dragonboard.dts
> index 630180edecfd..07db6451f273 100644
> --- a/arch/arm/boot/dts/qcom-apq8074-dragonboard.dts
> +++ b/arch/arm/boot/dts/qcom-apq8074-dragonboard.dts
> @@ -1,6 +1,7 @@
>  // SPDX-License-Identifier: GPL-2.0
>  #include <dt-bindings/gpio/gpio.h>
>  #include <dt-bindings/input/input.h>
> +#include <dt-bindings/leds/common.h>
>  #include <dt-bindings/pinctrl/qcom,pmic-gpio.h>
>  #include "qcom-msm8974.dtsi"
>  #include "qcom-pm8841.dtsi"
> @@ -69,6 +70,29 @@ msm_keys_default: pm8941-gpio-keys-state {
>          };
>  };
>  
> +&pm8941_lpg {
> +        qcom,power-source = <1>;
> +	status = "okay";

Broken indentation.



Best regards,
Krzysztof


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

* Re: [PATCH v2 2/6] power: reset: qcom-pon: add support for pm8941-pon
  2023-05-08 16:04 ` [PATCH v2 2/6] power: reset: qcom-pon: add support for pm8941-pon Dmitry Baryshkov
@ 2023-05-09  8:51   ` Konrad Dybcio
  0 siblings, 0 replies; 16+ messages in thread
From: Konrad Dybcio @ 2023-05-09  8:51 UTC (permalink / raw)
  To: Dmitry Baryshkov, Sebastian Reichel, Rob Herring,
	Krzysztof Kozlowski, Andy Gross, Bjorn Andersson, Vinod Koul
  Cc: linux-pm, devicetree, linux-arm-msm



On 8.05.2023 18:04, Dmitry Baryshkov wrote:
> For PM8941 we don't have a defined field to store the reset reason.
> Support wrapping pwrkey and resin, but without writing the reset
> reason.
> 
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> ---
Reviewed-by: Konrad Dybcio <konrad.dybcio@linaro.org>

Konrad
>  drivers/power/reset/qcom-pon.c | 22 +++++++++++++++-------
>  1 file changed, 15 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/power/reset/qcom-pon.c b/drivers/power/reset/qcom-pon.c
> index 16bc01738be9..d42475bc0ee6 100644
> --- a/drivers/power/reset/qcom-pon.c
> +++ b/drivers/power/reset/qcom-pon.c
> @@ -17,6 +17,8 @@
>  #define GEN1_REASON_SHIFT		2
>  #define GEN2_REASON_SHIFT		1
>  
> +#define NO_REASON_SHIFT			0
> +
>  struct pm8916_pon {
>  	struct device *dev;
>  	struct regmap *regmap;
> @@ -45,6 +47,7 @@ static int pm8916_reboot_mode_write(struct reboot_mode_driver *reboot,
>  static int pm8916_pon_probe(struct platform_device *pdev)
>  {
>  	struct pm8916_pon *pon;
> +	long reason_shift;
>  	int error;
>  
>  	pon = devm_kzalloc(&pdev->dev, sizeof(*pon), GFP_KERNEL);
> @@ -64,13 +67,17 @@ static int pm8916_pon_probe(struct platform_device *pdev)
>  	if (error)
>  		return error;
>  
> -	pon->reboot_mode.dev = &pdev->dev;
> -	pon->reason_shift = (long)of_device_get_match_data(&pdev->dev);
> -	pon->reboot_mode.write = pm8916_reboot_mode_write;
> -	error = devm_reboot_mode_register(&pdev->dev, &pon->reboot_mode);
> -	if (error) {
> -		dev_err(&pdev->dev, "can't register reboot mode\n");
> -		return error;
> +	reason_shift = (long)of_device_get_match_data(&pdev->dev);
> +
> +	if (reason_shift != NO_REASON_SHIFT) {
> +		pon->reboot_mode.dev = &pdev->dev;
> +		pon->reason_shift = reason_shift;
> +		pon->reboot_mode.write = pm8916_reboot_mode_write;
> +		error = devm_reboot_mode_register(&pdev->dev, &pon->reboot_mode);
> +		if (error) {
> +			dev_err(&pdev->dev, "can't register reboot mode\n");
> +			return error;
> +		}
>  	}
>  
>  	platform_set_drvdata(pdev, pon);
> @@ -80,6 +87,7 @@ static int pm8916_pon_probe(struct platform_device *pdev)
>  
>  static const struct of_device_id pm8916_pon_id_table[] = {
>  	{ .compatible = "qcom,pm8916-pon", .data = (void *)GEN1_REASON_SHIFT },
> +	{ .compatible = "qcom,pm8941-pon", .data = (void *)NO_REASON_SHIFT },
>  	{ .compatible = "qcom,pms405-pon", .data = (void *)GEN1_REASON_SHIFT },
>  	{ .compatible = "qcom,pm8998-pon", .data = (void *)GEN2_REASON_SHIFT },
>  	{ .compatible = "qcom,pmk8350-pon", .data = (void *)GEN2_REASON_SHIFT },

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

* Re: [PATCH v2 3/6] ARM: dts: qcom-pm8941: add resin support
  2023-05-08 16:04 ` [PATCH v2 3/6] ARM: dts: qcom-pm8941: add resin support Dmitry Baryshkov
@ 2023-05-09  8:52   ` Konrad Dybcio
  0 siblings, 0 replies; 16+ messages in thread
From: Konrad Dybcio @ 2023-05-09  8:52 UTC (permalink / raw)
  To: Dmitry Baryshkov, Sebastian Reichel, Rob Herring,
	Krzysztof Kozlowski, Andy Gross, Bjorn Andersson, Vinod Koul
  Cc: linux-pm, devicetree, linux-arm-msm



On 8.05.2023 18:04, Dmitry Baryshkov wrote:
> Wrap existing pwrkey and new resin nodes into the new pon node to enable
> volume-down key support on platforms using pm8941 PMIC.
> 
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> ---
Reviewed-by: Konrad Dybcio <konrad.dybcio@linaro.org>

Konrad
>  arch/arm/boot/dts/qcom-pm8941.dtsi | 22 +++++++++++++++++-----
>  1 file changed, 17 insertions(+), 5 deletions(-)
> 
> diff --git a/arch/arm/boot/dts/qcom-pm8941.dtsi b/arch/arm/boot/dts/qcom-pm8941.dtsi
> index a821f0368a28..cf1fcf97fa88 100644
> --- a/arch/arm/boot/dts/qcom-pm8941.dtsi
> +++ b/arch/arm/boot/dts/qcom-pm8941.dtsi
> @@ -19,12 +19,24 @@ rtc@6000 {
>  			interrupts = <0x0 0x61 0x1 IRQ_TYPE_EDGE_RISING>;
>  		};
>  
> -		pwrkey@800 {
> -			compatible = "qcom,pm8941-pwrkey";
> +		pon@800 {
> +			compatible = "qcom,pm8941-pon";
>  			reg = <0x800>;
> -			interrupts = <0x0 0x8 0 IRQ_TYPE_EDGE_BOTH>;
> -			debounce = <15625>;
> -			bias-pull-up;
> +
> +			pwrkey {
> +				compatible = "qcom,pm8941-pwrkey";
> +				interrupts = <0x0 0x8 0 IRQ_TYPE_EDGE_BOTH>;
> +				debounce = <15625>;
> +				bias-pull-up;
> +			};
> +
> +			pm8941_resin: resin {
> +				compatible = "qcom,pm8941-resin";
> +				interrupts = <0x0 0x8 1 IRQ_TYPE_EDGE_BOTH>;
> +				debounce = <15625>;
> +				bias-pull-up;
> +				status = "disabled";
> +			};
>  		};
>  
>  		usb_id: usb-detect@900 {

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

* Re: [PATCH v2 4/6] ARM: dts: qcom: apq8074-dragonboard: add resin and gpio keys
  2023-05-08 16:04 ` [PATCH v2 4/6] ARM: dts: qcom: apq8074-dragonboard: add resin and gpio keys Dmitry Baryshkov
@ 2023-05-09  8:52   ` Konrad Dybcio
  0 siblings, 0 replies; 16+ messages in thread
From: Konrad Dybcio @ 2023-05-09  8:52 UTC (permalink / raw)
  To: Dmitry Baryshkov, Sebastian Reichel, Rob Herring,
	Krzysztof Kozlowski, Andy Gross, Bjorn Andersson, Vinod Koul
  Cc: linux-pm, devicetree, linux-arm-msm



On 8.05.2023 18:04, Dmitry Baryshkov wrote:
> Add device nodes for resin (reset, volume-down) and gpio-keys
> (volume-up, general key) device nodes.
> 
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> ---
Reviewed-by: Konrad Dybcio <konrad.dybcio@linaro.org>

Konrad
>  .../arm/boot/dts/qcom-apq8074-dragonboard.dts | 39 +++++++++++++++++++
>  1 file changed, 39 insertions(+)
> 
> diff --git a/arch/arm/boot/dts/qcom-apq8074-dragonboard.dts b/arch/arm/boot/dts/qcom-apq8074-dragonboard.dts
> index 1345df7cbd00..630180edecfd 100644
> --- a/arch/arm/boot/dts/qcom-apq8074-dragonboard.dts
> +++ b/arch/arm/boot/dts/qcom-apq8074-dragonboard.dts
> @@ -1,5 +1,7 @@
>  // SPDX-License-Identifier: GPL-2.0
>  #include <dt-bindings/gpio/gpio.h>
> +#include <dt-bindings/input/input.h>
> +#include <dt-bindings/pinctrl/qcom,pmic-gpio.h>
>  #include "qcom-msm8974.dtsi"
>  #include "qcom-pm8841.dtsi"
>  #include "qcom-pm8941.dtsi"
> @@ -17,6 +19,26 @@ aliases {
>  	chosen {
>  		stdout-path = "serial0:115200n8";
>  	};
> +
> +	gpio-keys {
> +		compatible = "gpio-keys";
> +		autorepeat;
> +
> +		pinctrl-0 = <&msm_keys_default>;
> +		pinctrl-names = "default";
> +
> +		button-volup {
> +			label = "Volume Up";
> +			linux,code = <KEY_VOLUMEUP>;
> +			gpios = <&pm8941_gpios 5 GPIO_ACTIVE_LOW>;
> +		};
> +
> +		button-general {
> +			label = "General";
> +			linux,code = <KEY_PROG1>;
> +			gpios = <&pm8941_gpios 23 GPIO_ACTIVE_LOW>;
> +		};
> +	};
>  };
>  
>  &blsp1_uart2 {
> @@ -35,6 +57,23 @@ eeprom: eeprom@52 {
>  	};
>  };
>  
> +&pm8941_gpios {
> +        msm_keys_default: pm8941-gpio-keys-state {
> +		pins = "gpio5", "gpio23";
> +		function = "normal";
> +		input-enable;
> +		drive-push-pull;
> +		bias-pull-up;
> +		qcom,drive-strength = <PMIC_GPIO_STRENGTH_NO>;
> +		power-source = <PM8941_GPIO_S3>; /* 1.8V */
> +        };
> +};
> +
> +&pm8941_resin {
> +	linux,code = <KEY_VOLUMEDOWN>;
> +	status = "okay";
> +};
> +
>  &rpm_requests {
>  	regulators-0 {
>  		compatible = "qcom,rpm-pm8841-regulators";

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

* Re: [PATCH v2 5/6] ARM: dts: qcom: apq8074-dragonboard: add onboard leds
  2023-05-08 16:04 ` [PATCH v2 5/6] ARM: dts: qcom: apq8074-dragonboard: add onboard leds Dmitry Baryshkov
  2023-05-08 16:35   ` Krzysztof Kozlowski
@ 2023-05-09  8:52   ` Konrad Dybcio
  1 sibling, 0 replies; 16+ messages in thread
From: Konrad Dybcio @ 2023-05-09  8:52 UTC (permalink / raw)
  To: Dmitry Baryshkov, Sebastian Reichel, Rob Herring,
	Krzysztof Kozlowski, Andy Gross, Bjorn Andersson, Vinod Koul
  Cc: linux-pm, devicetree, linux-arm-msm



On 8.05.2023 18:04, Dmitry Baryshkov wrote:
> The dragonboard as three LEDs: red, green and blue. Add corresponding
> description.
> 
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> ---
>  .../arm/boot/dts/qcom-apq8074-dragonboard.dts | 24 +++++++++++++++++++
>  1 file changed, 24 insertions(+)
> 
> diff --git a/arch/arm/boot/dts/qcom-apq8074-dragonboard.dts b/arch/arm/boot/dts/qcom-apq8074-dragonboard.dts
> index 630180edecfd..07db6451f273 100644
> --- a/arch/arm/boot/dts/qcom-apq8074-dragonboard.dts
> +++ b/arch/arm/boot/dts/qcom-apq8074-dragonboard.dts
> @@ -1,6 +1,7 @@
>  // SPDX-License-Identifier: GPL-2.0
>  #include <dt-bindings/gpio/gpio.h>
>  #include <dt-bindings/input/input.h>
> +#include <dt-bindings/leds/common.h>
>  #include <dt-bindings/pinctrl/qcom,pmic-gpio.h>
>  #include "qcom-msm8974.dtsi"
>  #include "qcom-pm8841.dtsi"
> @@ -69,6 +70,29 @@ msm_keys_default: pm8941-gpio-keys-state {
>          };
>  };
>  
> +&pm8941_lpg {
> +        qcom,power-source = <1>;
> +	status = "okay";
Indentation?

Konrad
> +
> +	led@5 {
> +		reg = <5>;
> +		color = <LED_COLOR_ID_BLUE>;
> +		function = LED_FUNCTION_INDICATOR;
> +	};
> +
> +	led@6 {
> +		reg = <6>;
> +		color = <LED_COLOR_ID_GREEN>;
> +		function = LED_FUNCTION_INDICATOR;
> +	};
> +
> +	led@7 {
> +		reg = <7>;
> +		color = <LED_COLOR_ID_RED>;
> +		function = LED_FUNCTION_INDICATOR;
> +	};
> +};
> +
>  &pm8941_resin {
>  	linux,code = <KEY_VOLUMEDOWN>;
>  	status = "okay";

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

* Re: [PATCH v2 1/6] dt-bindings: power: reset: qcom-pon: define pm8941-pon
  2023-05-08 16:04 ` [PATCH v2 1/6] dt-bindings: power: reset: qcom-pon: define pm8941-pon Dmitry Baryshkov
@ 2023-05-09  8:53   ` Konrad Dybcio
  2023-05-09 11:21     ` Dmitry Baryshkov
  0 siblings, 1 reply; 16+ messages in thread
From: Konrad Dybcio @ 2023-05-09  8:53 UTC (permalink / raw)
  To: Dmitry Baryshkov, Sebastian Reichel, Rob Herring,
	Krzysztof Kozlowski, Andy Gross, Bjorn Andersson, Vinod Koul
  Cc: linux-pm, devicetree, linux-arm-msm, Krzysztof Kozlowski



On 8.05.2023 18:04, Dmitry Baryshkov wrote:
> On PM8941 pon doesn't store the reset reason. However we still need the
> wrapping node for pwrkey and resin nodes. Add bindings for pm8941-pon
> device.
> 
> Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> ---
Should probably also disallow setting reboot modes!

Konrad
>  Documentation/devicetree/bindings/power/reset/qcom,pon.yaml | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/power/reset/qcom,pon.yaml b/Documentation/devicetree/bindings/power/reset/qcom,pon.yaml
> index d96170eecbd2..0f4f55dd4eac 100644
> --- a/Documentation/devicetree/bindings/power/reset/qcom,pon.yaml
> +++ b/Documentation/devicetree/bindings/power/reset/qcom,pon.yaml
> @@ -19,6 +19,7 @@ properties:
>    compatible:
>      enum:
>        - qcom,pm8916-pon
> +      - qcom,pm8941-pon
>        - qcom,pms405-pon
>        - qcom,pm8998-pon
>        - qcom,pmk8350-pon
> @@ -63,6 +64,7 @@ allOf:
>            contains:
>              enum:
>                - qcom,pm8916-pon
> +              - qcom,pm8941-pon
>                - qcom,pms405-pon
>                - qcom,pm8998-pon
>      then:

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

* Re: [PATCH v2 1/6] dt-bindings: power: reset: qcom-pon: define pm8941-pon
  2023-05-09  8:53   ` Konrad Dybcio
@ 2023-05-09 11:21     ` Dmitry Baryshkov
  2023-05-09 11:54       ` Konrad Dybcio
  0 siblings, 1 reply; 16+ messages in thread
From: Dmitry Baryshkov @ 2023-05-09 11:21 UTC (permalink / raw)
  To: Konrad Dybcio
  Cc: Sebastian Reichel, Rob Herring, Krzysztof Kozlowski, Andy Gross,
	Bjorn Andersson, Vinod Koul, linux-pm, devicetree, linux-arm-msm,
	Krzysztof Kozlowski

On Tue, 9 May 2023 at 11:53, Konrad Dybcio <konrad.dybcio@linaro.org> wrote:
>
>
>
> On 8.05.2023 18:04, Dmitry Baryshkov wrote:
> > On PM8941 pon doesn't store the reset reason. However we still need the
> > wrapping node for pwrkey and resin nodes. Add bindings for pm8941-pon
> > device.
> >
> > Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
> > Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> > ---
> Should probably also disallow setting reboot modes!

But we don't set reboot modes in DT!

>
> Konrad
> >  Documentation/devicetree/bindings/power/reset/qcom,pon.yaml | 2 ++
> >  1 file changed, 2 insertions(+)
> >
> > diff --git a/Documentation/devicetree/bindings/power/reset/qcom,pon.yaml b/Documentation/devicetree/bindings/power/reset/qcom,pon.yaml
> > index d96170eecbd2..0f4f55dd4eac 100644
> > --- a/Documentation/devicetree/bindings/power/reset/qcom,pon.yaml
> > +++ b/Documentation/devicetree/bindings/power/reset/qcom,pon.yaml
> > @@ -19,6 +19,7 @@ properties:
> >    compatible:
> >      enum:
> >        - qcom,pm8916-pon
> > +      - qcom,pm8941-pon
> >        - qcom,pms405-pon
> >        - qcom,pm8998-pon
> >        - qcom,pmk8350-pon
> > @@ -63,6 +64,7 @@ allOf:
> >            contains:
> >              enum:
> >                - qcom,pm8916-pon
> > +              - qcom,pm8941-pon
> >                - qcom,pms405-pon
> >                - qcom,pm8998-pon
> >      then:



-- 
With best wishes
Dmitry

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

* Re: [PATCH v2 1/6] dt-bindings: power: reset: qcom-pon: define pm8941-pon
  2023-05-09 11:21     ` Dmitry Baryshkov
@ 2023-05-09 11:54       ` Konrad Dybcio
  0 siblings, 0 replies; 16+ messages in thread
From: Konrad Dybcio @ 2023-05-09 11:54 UTC (permalink / raw)
  To: Dmitry Baryshkov
  Cc: Sebastian Reichel, Rob Herring, Krzysztof Kozlowski, Andy Gross,
	Bjorn Andersson, Vinod Koul, linux-pm, devicetree, linux-arm-msm,
	Krzysztof Kozlowski



On 9.05.2023 13:21, Dmitry Baryshkov wrote:
> On Tue, 9 May 2023 at 11:53, Konrad Dybcio <konrad.dybcio@linaro.org> wrote:
>>
>>
>>
>> On 8.05.2023 18:04, Dmitry Baryshkov wrote:
>>> On PM8941 pon doesn't store the reset reason. However we still need the
>>> wrapping node for pwrkey and resin nodes. Add bindings for pm8941-pon
>>> device.
>>>
>>> Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
>>> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
>>> ---
>> Should probably also disallow setting reboot modes!
> 
> But we don't set reboot modes in DT!
That's what I'm saying :P

> 
>>
>> Konrad
>>>  Documentation/devicetree/bindings/power/reset/qcom,pon.yaml | 2 ++
>>>  1 file changed, 2 insertions(+)
>>>
>>> diff --git a/Documentation/devicetree/bindings/power/reset/qcom,pon.yaml b/Documentation/devicetree/bindings/power/reset/qcom,pon.yaml
>>> index d96170eecbd2..0f4f55dd4eac 100644
>>> --- a/Documentation/devicetree/bindings/power/reset/qcom,pon.yaml
>>> +++ b/Documentation/devicetree/bindings/power/reset/qcom,pon.yaml
>>> @@ -19,6 +19,7 @@ properties:
>>>    compatible:
>>>      enum:
>>>        - qcom,pm8916-pon
>>> +      - qcom,pm8941-pon
>>>        - qcom,pms405-pon
>>>        - qcom,pm8998-pon
>>>        - qcom,pmk8350-pon
>>> @@ -63,6 +64,7 @@ allOf:
>>>            contains:
>>>              enum:
>>>                - qcom,pm8916-pon
>>> +              - qcom,pm8941-pon
>>>                - qcom,pms405-pon
>>>                - qcom,pm8998-pon
>>>      then:
[...]
	  allOf:
	        - $ref: reboot-mode.yaml#

Konrad
> 
> 
> 

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

* Re: [PATCH v2 6/6] ARM: dts: qcom: apq8074-dragonboard: enable coincell charger
  2023-05-08 16:04 ` [PATCH v2 6/6] ARM: dts: qcom: apq8074-dragonboard: enable coincell charger Dmitry Baryshkov
@ 2023-05-23 23:34   ` Dmitry Baryshkov
  0 siblings, 0 replies; 16+ messages in thread
From: Dmitry Baryshkov @ 2023-05-23 23:34 UTC (permalink / raw)
  To: Sebastian Reichel, Rob Herring, Krzysztof Kozlowski, Andy Gross,
	Bjorn Andersson, Konrad Dybcio, Vinod Koul
  Cc: linux-pm, devicetree, linux-arm-msm

On 08/05/2023 19:04, Dmitry Baryshkov wrote:
> Enable coincell charger for the coin battery which can be installed on
> the APQ8074 dragonboard.
> 
> Reviewed-by: Konrad Dybcio <konrad.dybcio@linaro.org>
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> ---
>   arch/arm/boot/dts/qcom-apq8074-dragonboard.dts | 6 ++++++
>   1 file changed, 6 insertions(+)
> 
> diff --git a/arch/arm/boot/dts/qcom-apq8074-dragonboard.dts b/arch/arm/boot/dts/qcom-apq8074-dragonboard.dts
> index 07db6451f273..93a059641957 100644
> --- a/arch/arm/boot/dts/qcom-apq8074-dragonboard.dts
> +++ b/arch/arm/boot/dts/qcom-apq8074-dragonboard.dts
> @@ -58,6 +58,12 @@ eeprom: eeprom@52 {
>   	};
>   };
>   
> +&pm8941_coincell {
> +	qcom,rset-ohms = <2100>;
> +	qcom,vset-millivolts = <3000>;
> +	status = "okay";
> +};

Ok, this one might need reconsideration. I still didn't find the lithium 
accumulator of this size and granted that it might be the battery 
instead of the accumulator, it is safer not to enable the charger, at 
least by default.

> +
>   &pm8941_gpios {
>           msm_keys_default: pm8941-gpio-keys-state {
>   		pins = "gpio5", "gpio23";

-- 
With best wishes
Dmitry


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

end of thread, other threads:[~2023-05-23 23:35 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-08 16:04 [PATCH v2 0/6] ARM: dts: qcom: apq8074-dragonboard: enable additional devices Dmitry Baryshkov
2023-05-08 16:04 ` [PATCH v2 1/6] dt-bindings: power: reset: qcom-pon: define pm8941-pon Dmitry Baryshkov
2023-05-09  8:53   ` Konrad Dybcio
2023-05-09 11:21     ` Dmitry Baryshkov
2023-05-09 11:54       ` Konrad Dybcio
2023-05-08 16:04 ` [PATCH v2 2/6] power: reset: qcom-pon: add support for pm8941-pon Dmitry Baryshkov
2023-05-09  8:51   ` Konrad Dybcio
2023-05-08 16:04 ` [PATCH v2 3/6] ARM: dts: qcom-pm8941: add resin support Dmitry Baryshkov
2023-05-09  8:52   ` Konrad Dybcio
2023-05-08 16:04 ` [PATCH v2 4/6] ARM: dts: qcom: apq8074-dragonboard: add resin and gpio keys Dmitry Baryshkov
2023-05-09  8:52   ` Konrad Dybcio
2023-05-08 16:04 ` [PATCH v2 5/6] ARM: dts: qcom: apq8074-dragonboard: add onboard leds Dmitry Baryshkov
2023-05-08 16:35   ` Krzysztof Kozlowski
2023-05-09  8:52   ` Konrad Dybcio
2023-05-08 16:04 ` [PATCH v2 6/6] ARM: dts: qcom: apq8074-dragonboard: enable coincell charger Dmitry Baryshkov
2023-05-23 23:34   ` Dmitry Baryshkov

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