All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/4] arm: qcom: qcom-apq8064: add separate device node for tsens
@ 2022-04-05 23:59 Dmitry Baryshkov
  2022-04-05 23:59 ` [PATCH 1/4] dt-bindings: thermal: qcom-tsens.yaml: add msm8960 compat string Dmitry Baryshkov
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Dmitry Baryshkov @ 2022-04-05 23:59 UTC (permalink / raw)
  To: Andy Gross, Bjorn Andersson, Amit Kucheria, Thara Gopinath,
	Rob Herring, Krzysztof Kozlowski, Michael Turquette,
	Stephen Boyd
  Cc: linux-arm-msm, linux-pm, devicetree, linux-clk

Currently gcc-msm8960 driver manually creates tsens device. Instantiate
the device using DT node instead. This follow the IPQ8064 device tree
schema.

Compatibility with the previous devices trees is kept intact.

Dmitry Baryshkov (4):
  dt-bindings: thermal: qcom-tsens.yaml: add msm8960 compat string
  thermal/drivers/tsens: add compat string for the qcom,msm8960
  clk: qcom: gcc-msm8960: create tsens device if there are no child
    nodes
  arm: dts: qcom-apq8064: create tsens device node

 .../bindings/thermal/qcom-tsens.yaml          |  4 +++-
 arch/arm/boot/dts/qcom-apq8064.dtsi           | 23 +++++++++++++------
 drivers/clk/qcom/gcc-msm8960.c                | 18 +++++++++------
 drivers/thermal/qcom/tsens.c                  |  3 +++
 4 files changed, 33 insertions(+), 15 deletions(-)

-- 
2.35.1


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

* [PATCH 1/4] dt-bindings: thermal: qcom-tsens.yaml: add msm8960 compat string
  2022-04-05 23:59 [PATCH 0/4] arm: qcom: qcom-apq8064: add separate device node for tsens Dmitry Baryshkov
@ 2022-04-05 23:59 ` Dmitry Baryshkov
  2022-04-05 23:59 ` [PATCH 2/4] thermal/drivers/tsens: add compat string for the qcom,msm8960 Dmitry Baryshkov
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Dmitry Baryshkov @ 2022-04-05 23:59 UTC (permalink / raw)
  To: Andy Gross, Bjorn Andersson, Amit Kucheria, Thara Gopinath,
	Rob Herring, Krzysztof Kozlowski, Michael Turquette,
	Stephen Boyd
  Cc: linux-arm-msm, linux-pm, devicetree, linux-clk

Add compatibility string for the thermal sensors on MSM8960/APQ8064
platforms.

Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
---
 Documentation/devicetree/bindings/thermal/qcom-tsens.yaml | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/thermal/qcom-tsens.yaml b/Documentation/devicetree/bindings/thermal/qcom-tsens.yaml
index b6406bcc683f..43510b8399ff 100644
--- a/Documentation/devicetree/bindings/thermal/qcom-tsens.yaml
+++ b/Documentation/devicetree/bindings/thermal/qcom-tsens.yaml
@@ -19,10 +19,11 @@ description: |
 properties:
   compatible:
     oneOf:
-      - description: msm9860 TSENS based
+      - description: msm8960 TSENS based
         items:
           - enum:
               - qcom,ipq8064-tsens
+              - qcom,msm8960-tsens
 
       - description: v0.1 of TSENS
         items:
@@ -116,6 +117,7 @@ allOf:
               - qcom,ipq8064-tsens
               - qcom,mdm9607-tsens
               - qcom,msm8916-tsens
+              - qcom,msm8960-tsens
               - qcom,msm8974-tsens
               - qcom,msm8976-tsens
               - qcom,qcs404-tsens
-- 
2.35.1


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

* [PATCH 2/4] thermal/drivers/tsens: add compat string for the qcom,msm8960
  2022-04-05 23:59 [PATCH 0/4] arm: qcom: qcom-apq8064: add separate device node for tsens Dmitry Baryshkov
  2022-04-05 23:59 ` [PATCH 1/4] dt-bindings: thermal: qcom-tsens.yaml: add msm8960 compat string Dmitry Baryshkov
@ 2022-04-05 23:59 ` Dmitry Baryshkov
  2022-04-05 23:59 ` [PATCH 3/4] clk: qcom: gcc-msm8960: create tsens device if there are no child nodes Dmitry Baryshkov
  2022-04-05 23:59 ` [PATCH 4/4] arm: dts: qcom-apq8064: create tsens device node Dmitry Baryshkov
  3 siblings, 0 replies; 5+ messages in thread
From: Dmitry Baryshkov @ 2022-04-05 23:59 UTC (permalink / raw)
  To: Andy Gross, Bjorn Andersson, Amit Kucheria, Thara Gopinath,
	Rob Herring, Krzysztof Kozlowski, Michael Turquette,
	Stephen Boyd
  Cc: linux-arm-msm, linux-pm, devicetree, linux-clk

On apq8064 (msm8960) platforms the tsens device is created manually by
the gcc driver. Prepare the tsens driver for the qcom,msm8960-tsens
device instantiated from the device tree.

Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
---
 drivers/thermal/qcom/tsens.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/thermal/qcom/tsens.c b/drivers/thermal/qcom/tsens.c
index 154d3cb19c88..7963ee33bf75 100644
--- a/drivers/thermal/qcom/tsens.c
+++ b/drivers/thermal/qcom/tsens.c
@@ -979,6 +979,9 @@ static const struct of_device_id tsens_table[] = {
 	}, {
 		.compatible = "qcom,msm8939-tsens",
 		.data = &data_8939,
+	}, {
+		.compatible = "qcom,msm8960-tsens",
+		.data = &data_8960,
 	}, {
 		.compatible = "qcom,msm8974-tsens",
 		.data = &data_8974,
-- 
2.35.1


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

* [PATCH 3/4] clk: qcom: gcc-msm8960: create tsens device if there are no child nodes
  2022-04-05 23:59 [PATCH 0/4] arm: qcom: qcom-apq8064: add separate device node for tsens Dmitry Baryshkov
  2022-04-05 23:59 ` [PATCH 1/4] dt-bindings: thermal: qcom-tsens.yaml: add msm8960 compat string Dmitry Baryshkov
  2022-04-05 23:59 ` [PATCH 2/4] thermal/drivers/tsens: add compat string for the qcom,msm8960 Dmitry Baryshkov
@ 2022-04-05 23:59 ` Dmitry Baryshkov
  2022-04-05 23:59 ` [PATCH 4/4] arm: dts: qcom-apq8064: create tsens device node Dmitry Baryshkov
  3 siblings, 0 replies; 5+ messages in thread
From: Dmitry Baryshkov @ 2022-04-05 23:59 UTC (permalink / raw)
  To: Andy Gross, Bjorn Andersson, Amit Kucheria, Thara Gopinath,
	Rob Herring, Krzysztof Kozlowski, Michael Turquette,
	Stephen Boyd
  Cc: linux-arm-msm, linux-pm, devicetree, linux-clk

Currently gcc-msm8960 driver manually creates tsens device. Don't create
it in case there are child nodes inside the gcc device (which would
include the tsens).

Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
---
 drivers/clk/qcom/gcc-msm8960.c | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/drivers/clk/qcom/gcc-msm8960.c b/drivers/clk/qcom/gcc-msm8960.c
index 051745ef99c8..0f2d1a69781b 100644
--- a/drivers/clk/qcom/gcc-msm8960.c
+++ b/drivers/clk/qcom/gcc-msm8960.c
@@ -3617,7 +3617,6 @@ static int gcc_msm8960_probe(struct platform_device *pdev)
 {
 	struct device *dev = &pdev->dev;
 	const struct of_device_id *match;
-	struct platform_device *tsens;
 	int ret;
 
 	match = of_match_device(gcc_msm8960_match_table, &pdev->dev);
@@ -3641,12 +3640,16 @@ static int gcc_msm8960_probe(struct platform_device *pdev)
 		hfpll_l2.d = &hfpll_l2_8064_data;
 	}
 
-	tsens = platform_device_register_data(&pdev->dev, "qcom-tsens", -1,
-					      NULL, 0);
-	if (IS_ERR(tsens))
-		return PTR_ERR(tsens);
+	if (of_get_available_child_count(pdev->dev.of_node) == 0) {
+		struct platform_device *tsens;
 
-	platform_set_drvdata(pdev, tsens);
+		tsens = platform_device_register_data(&pdev->dev, "qcom-tsens", -1,
+						      NULL, 0);
+		if (IS_ERR(tsens))
+			return PTR_ERR(tsens);
+
+		platform_set_drvdata(pdev, tsens);
+	}
 
 	return 0;
 }
@@ -3655,7 +3658,8 @@ static int gcc_msm8960_remove(struct platform_device *pdev)
 {
 	struct platform_device *tsens = platform_get_drvdata(pdev);
 
-	platform_device_unregister(tsens);
+	if (tsens)
+		platform_device_unregister(tsens);
 
 	return 0;
 }
-- 
2.35.1


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

* [PATCH 4/4] arm: dts: qcom-apq8064: create tsens device node
  2022-04-05 23:59 [PATCH 0/4] arm: qcom: qcom-apq8064: add separate device node for tsens Dmitry Baryshkov
                   ` (2 preceding siblings ...)
  2022-04-05 23:59 ` [PATCH 3/4] clk: qcom: gcc-msm8960: create tsens device if there are no child nodes Dmitry Baryshkov
@ 2022-04-05 23:59 ` Dmitry Baryshkov
  3 siblings, 0 replies; 5+ messages in thread
From: Dmitry Baryshkov @ 2022-04-05 23:59 UTC (permalink / raw)
  To: Andy Gross, Bjorn Andersson, Amit Kucheria, Thara Gopinath,
	Rob Herring, Krzysztof Kozlowski, Michael Turquette,
	Stephen Boyd
  Cc: linux-arm-msm, linux-pm, devicetree, linux-clk

Create separate device node for thermal sensors on apq8064 platform.
Move related properties to the newly created device tree node.

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

diff --git a/arch/arm/boot/dts/qcom-apq8064.dtsi b/arch/arm/boot/dts/qcom-apq8064.dtsi
index b9e9a9f9d3e2..87e8861d647c 100644
--- a/arch/arm/boot/dts/qcom-apq8064.dtsi
+++ b/arch/arm/boot/dts/qcom-apq8064.dtsi
@@ -105,7 +105,7 @@ cpu0-thermal {
 			polling-delay-passive = <250>;
 			polling-delay = <1000>;
 
-			thermal-sensors = <&gcc 7>;
+			thermal-sensors = <&tsens 7>;
 			coefficients = <1199 0>;
 
 			trips {
@@ -126,7 +126,7 @@ cpu1-thermal {
 			polling-delay-passive = <250>;
 			polling-delay = <1000>;
 
-			thermal-sensors = <&gcc 8>;
+			thermal-sensors = <&tsens 8>;
 			coefficients = <1132 0>;
 
 			trips {
@@ -147,7 +147,7 @@ cpu2-thermal {
 			polling-delay-passive = <250>;
 			polling-delay = <1000>;
 
-			thermal-sensors = <&gcc 9>;
+			thermal-sensors = <&tsens 9>;
 			coefficients = <1199 0>;
 
 			trips {
@@ -168,7 +168,7 @@ cpu3-thermal {
 			polling-delay-passive = <250>;
 			polling-delay = <1000>;
 
-			thermal-sensors = <&gcc 10>;
+			thermal-sensors = <&tsens 10>;
 			coefficients = <1132 0>;
 
 			trips {
@@ -812,12 +812,21 @@ tsens_backup: backup_calib {
 		gcc: clock-controller@900000 {
 			compatible = "qcom,gcc-apq8064";
 			reg = <0x00900000 0x4000>;
-			nvmem-cells = <&tsens_calib>, <&tsens_backup>;
-			nvmem-cell-names = "calib", "calib_backup";
 			#clock-cells = <1>;
 			#power-domain-cells = <1>;
 			#reset-cells = <1>;
-			#thermal-sensor-cells = <1>;
+
+			tsens: thermal-sensor@900000 {
+				compatible = "qcom,msm8960-tsens";
+
+				nvmem-cells = <&tsens_calib>, <&tsens_backup>;
+				nvmem-cell-names = "calib", "calib_backup";
+				interrupts = <GIC_SPI 178 IRQ_TYPE_LEVEL_HIGH>;
+				interrupt-names = "uplow";
+
+				#qcom,sensors = <11>;
+				#thermal-sensor-cells = <1>;
+			};
 		};
 
 		lcc: clock-controller@28000000 {
-- 
2.35.1


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

end of thread, other threads:[~2022-04-06  5:41 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-05 23:59 [PATCH 0/4] arm: qcom: qcom-apq8064: add separate device node for tsens Dmitry Baryshkov
2022-04-05 23:59 ` [PATCH 1/4] dt-bindings: thermal: qcom-tsens.yaml: add msm8960 compat string Dmitry Baryshkov
2022-04-05 23:59 ` [PATCH 2/4] thermal/drivers/tsens: add compat string for the qcom,msm8960 Dmitry Baryshkov
2022-04-05 23:59 ` [PATCH 3/4] clk: qcom: gcc-msm8960: create tsens device if there are no child nodes Dmitry Baryshkov
2022-04-05 23:59 ` [PATCH 4/4] arm: dts: qcom-apq8064: create tsens device node Dmitry Baryshkov

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