devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v5 0/3] arm: qcom: qcom-apq8064: add separate device node for tsens
@ 2022-04-27 12:54 Dmitry Baryshkov
  2022-04-27 12:54 ` [PATCH v5 1/3] clk: qcom: gcc-msm8960: create tsens device if there are no child nodes Dmitry Baryshkov
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Dmitry Baryshkov @ 2022-04-27 12:54 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, quic_tdas

Currently gcc-msm8960 driver manually creates tsens device. Instantiate
the device using DT node instead. This makes the APQ8064 follow the
IPQ8064 device tree schema (which is also closer to the way tsens
devices are described on newer Qualcomm platforms).

Compatibility with the previous devices trees is kept intact.

Changes since v4:
- Added thermal-sensor description to the qcom,gcc-apq8064 schema

Changes since v3:
- Fix a typo qcom,gcc-msm8060 -> qcom,gcc-msm8960 (noted by Krzyshtof)
- Fixed indentation in the example (also noted by Krzyshtof)

Changes since v2:
- Remove patches merged by Daniel
- Rephrase commit messages to emphasize that these changes make apq8064
  follow ipq8064

Changes since v1:
- populate child devices in gcc-msm8960
- add syscon to the gcc device tree node

Dmitry Baryshkov (3):
  clk: qcom: gcc-msm8960: create tsens device if there are no child
    nodes
  arm: dts: qcom-apq8064: create tsens device node
  dt-bindings: clock: qcom,gcc-apq8064: split tsens to the child node

 .../bindings/clock/qcom,gcc-apq8064.yaml      | 49 +++++++++----------
 arch/arm/boot/dts/qcom-apq8064.dtsi           | 25 +++++++---
 drivers/clk/qcom/gcc-msm8960.c                |  6 ++-
 3 files changed, 44 insertions(+), 36 deletions(-)


base-commit: 3123109284176b1532874591f7c81f3837bbdc17
prerequisite-patch-id: b5aad2b1e0db4e6d77d6a2faa2fe95acf274b3c8
prerequisite-patch-id: a0c7dcfc85a1eac4969530b73230f226006d6e1a
prerequisite-patch-id: 0fbf70957a52fa87d038d08f9c599e314c69e7d5
prerequisite-patch-id: d22652b1f0e097692b670a0ed4c3f803875d1c5e
-- 
2.35.1


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

* [PATCH v5 1/3] clk: qcom: gcc-msm8960: create tsens device if there are no child nodes
  2022-04-27 12:54 [PATCH v5 0/3] arm: qcom: qcom-apq8064: add separate device node for tsens Dmitry Baryshkov
@ 2022-04-27 12:54 ` Dmitry Baryshkov
  2022-04-27 12:54 ` [PATCH v5 2/3] arm: dts: qcom-apq8064: create tsens device node Dmitry Baryshkov
  2022-04-27 12:54 ` [PATCH v5 3/3] dt-bindings: clock: qcom,gcc-apq8064: split tsens to the child node Dmitry Baryshkov
  2 siblings, 0 replies; 5+ messages in thread
From: Dmitry Baryshkov @ 2022-04-27 12:54 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, quic_tdas

Currently gcc-msm8960 driver manually creates tsens platform device
manually. It would be better to follow IPQ8064 approach, where tsens
device is defined as gcc's child device in the device tree. If nothing
else, it removes gcc's dependency on QFPROM, thus allowing clock
controller to be probed earlier.

Don't create it in case there are available child nodes (tsens) inside
the gcc's device tree node.

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

diff --git a/drivers/clk/qcom/gcc-msm8960.c b/drivers/clk/qcom/gcc-msm8960.c
index 051745ef99c8..a6e13b91e4c8 100644
--- a/drivers/clk/qcom/gcc-msm8960.c
+++ b/drivers/clk/qcom/gcc-msm8960.c
@@ -3641,6 +3641,9 @@ static int gcc_msm8960_probe(struct platform_device *pdev)
 		hfpll_l2.d = &hfpll_l2_8064_data;
 	}
 
+	if (of_get_available_child_count(pdev->dev.of_node) != 0)
+		return devm_of_platform_populate(&pdev->dev);
+
 	tsens = platform_device_register_data(&pdev->dev, "qcom-tsens", -1,
 					      NULL, 0);
 	if (IS_ERR(tsens))
@@ -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 v5 2/3] arm: dts: qcom-apq8064: create tsens device node
  2022-04-27 12:54 [PATCH v5 0/3] arm: qcom: qcom-apq8064: add separate device node for tsens Dmitry Baryshkov
  2022-04-27 12:54 ` [PATCH v5 1/3] clk: qcom: gcc-msm8960: create tsens device if there are no child nodes Dmitry Baryshkov
@ 2022-04-27 12:54 ` Dmitry Baryshkov
  2022-04-27 12:54 ` [PATCH v5 3/3] dt-bindings: clock: qcom,gcc-apq8064: split tsens to the child node Dmitry Baryshkov
  2 siblings, 0 replies; 5+ messages in thread
From: Dmitry Baryshkov @ 2022-04-27 12:54 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, quic_tdas

Create separate device node for thermal sensors on apq8064 platform.
Move related properties to the newly created device tree node.
This harmonizes apq8064 and ipq8064 device trees and allows gcc device
to be probed earlier by removing dependency on QFPROM nodes.

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

diff --git a/arch/arm/boot/dts/qcom-apq8064.dtsi b/arch/arm/boot/dts/qcom-apq8064.dtsi
index a1c8ae516d21..389191ca5a69 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 {
@@ -810,14 +810,23 @@ tsens_backup: backup_calib {
 		};
 
 		gcc: clock-controller@900000 {
-			compatible = "qcom,gcc-apq8064";
+			compatible = "qcom,gcc-apq8064", "syscon";
 			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 {
+				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

* [PATCH v5 3/3] dt-bindings: clock: qcom,gcc-apq8064: split tsens to the child node
  2022-04-27 12:54 [PATCH v5 0/3] arm: qcom: qcom-apq8064: add separate device node for tsens Dmitry Baryshkov
  2022-04-27 12:54 ` [PATCH v5 1/3] clk: qcom: gcc-msm8960: create tsens device if there are no child nodes Dmitry Baryshkov
  2022-04-27 12:54 ` [PATCH v5 2/3] arm: dts: qcom-apq8064: create tsens device node Dmitry Baryshkov
@ 2022-04-27 12:54 ` Dmitry Baryshkov
  2022-04-28  8:00   ` Krzysztof Kozlowski
  2 siblings, 1 reply; 5+ messages in thread
From: Dmitry Baryshkov @ 2022-04-27 12:54 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, quic_tdas

Split tsens properties to the child node of the gcc. This follows the
lead of ipq8064 (which also uses a separate node for tsens) and makes
device tree closer to other platforms, where tsens is a completely
separate device.

Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
---
 .../bindings/clock/qcom,gcc-apq8064.yaml      | 49 +++++++++----------
 1 file changed, 22 insertions(+), 27 deletions(-)

diff --git a/Documentation/devicetree/bindings/clock/qcom,gcc-apq8064.yaml b/Documentation/devicetree/bindings/clock/qcom,gcc-apq8064.yaml
index bd7b04c75e50..3a8bb5a5b37f 100644
--- a/Documentation/devicetree/bindings/clock/qcom,gcc-apq8064.yaml
+++ b/Documentation/devicetree/bindings/clock/qcom,gcc-apq8064.yaml
@@ -23,47 +23,42 @@ description: |
 
 properties:
   compatible:
-    enum:
-      - qcom,gcc-apq8064
-      - qcom,gcc-msm8960
-
-  nvmem-cells:
-    minItems: 1
-    maxItems: 2
-    description:
-      Qualcomm TSENS (thermal sensor device) on some devices can
-      be part of GCC and hence the TSENS properties can also be part
-      of the GCC/clock-controller node.
-      For more details on the TSENS properties please refer
-      Documentation/devicetree/bindings/thermal/qcom-tsens.yaml
-
-  nvmem-cell-names:
-    minItems: 1
     items:
-      - const: calib
-      - const: calib_backup
+      - enum:
+          - qcom,gcc-apq8064
+          - qcom,gcc-msm8960
+      - const: syscon
+
+  thermal-sensor:
+    type: object
 
-  '#thermal-sensor-cells':
-    const: 1
+    allOf:
+      - $ref: /schemas/thermal/qcom-tsens.yaml#
 
 required:
   - compatible
-  - nvmem-cells
-  - nvmem-cell-names
-  - '#thermal-sensor-cells'
 
 unevaluatedProperties: false
 
 examples:
   - |
     clock-controller@900000 {
-      compatible = "qcom,gcc-apq8064";
+      compatible = "qcom,gcc-apq8064", "syscon";
       reg = <0x00900000 0x4000>;
-      nvmem-cells = <&tsens_calib>, <&tsens_backup>;
-      nvmem-cell-names = "calib", "calib_backup";
       #clock-cells = <1>;
       #reset-cells = <1>;
       #power-domain-cells = <1>;
-      #thermal-sensor-cells = <1>;
+
+      thermal-sensor {
+        compatible = "qcom,msm8960-tsens";
+
+        nvmem-cells = <&tsens_calib>, <&tsens_backup>;
+        nvmem-cell-names = "calib", "calib_backup";
+        interrupts = <0 178 4>;
+        interrupt-names = "uplow";
+
+        #qcom,sensors = <11>;
+        #thermal-sensor-cells = <1>;
+      };
     };
 ...
-- 
2.35.1


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

* Re: [PATCH v5 3/3] dt-bindings: clock: qcom,gcc-apq8064: split tsens to the child node
  2022-04-27 12:54 ` [PATCH v5 3/3] dt-bindings: clock: qcom,gcc-apq8064: split tsens to the child node Dmitry Baryshkov
@ 2022-04-28  8:00   ` Krzysztof Kozlowski
  0 siblings, 0 replies; 5+ messages in thread
From: Krzysztof Kozlowski @ 2022-04-28  8:00 UTC (permalink / raw)
  To: Dmitry Baryshkov, 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, quic_tdas

On 27/04/2022 14:54, Dmitry Baryshkov wrote:
> Split tsens properties to the child node of the gcc. This follows the
> lead of ipq8064 (which also uses a separate node for tsens) and makes
> device tree closer to other platforms, where tsens is a completely
> separate device.
> 
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> ---
>  .../bindings/clock/qcom,gcc-apq8064.yaml      | 49 +++++++++----------
>  1 file changed, 22 insertions(+), 27 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/clock/qcom,gcc-apq8064.yaml b/Documentation/devicetree/bindings/clock/qcom,gcc-apq8064.yaml
> index bd7b04c75e50..3a8bb5a5b37f 100644
> --- a/Documentation/devicetree/bindings/clock/qcom,gcc-apq8064.yaml
> +++ b/Documentation/devicetree/bindings/clock/qcom,gcc-apq8064.yaml
> @@ -23,47 +23,42 @@ description: |
>  
>  properties:
>    compatible:
> -    enum:
> -      - qcom,gcc-apq8064
> -      - qcom,gcc-msm8960
> -
> -  nvmem-cells:
> -    minItems: 1
> -    maxItems: 2
> -    description:
> -      Qualcomm TSENS (thermal sensor device) on some devices can
> -      be part of GCC and hence the TSENS properties can also be part
> -      of the GCC/clock-controller node.
> -      For more details on the TSENS properties please refer
> -      Documentation/devicetree/bindings/thermal/qcom-tsens.yaml
> -
> -  nvmem-cell-names:

All these properties (and old compatible list) should be rather instead
made deprecated:true. These bindings exists since some time, so it's not
like refactoring during development.

> -    minItems: 1
>      items:
> -      - const: calib
> -      - const: calib_backup
> +      - enum:
> +          - qcom,gcc-apq8064
> +          - qcom,gcc-msm8960
> +      - const: syscon
> +
> +  thermal-sensor:
> +    type: object
>  
> -  '#thermal-sensor-cells':
> -    const: 1
> +    allOf:
> +      - $ref: /schemas/thermal/qcom-tsens.yaml#

No need for allOf and type, just $ref and description.

>  
>  required:
>    - compatible
> -  - nvmem-cells
> -  - nvmem-cell-names
> -  - '#thermal-sensor-cells'
>  
>  unevaluatedProperties: false


Best regards,
Krzysztof

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

end of thread, other threads:[~2022-04-28  8:00 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-27 12:54 [PATCH v5 0/3] arm: qcom: qcom-apq8064: add separate device node for tsens Dmitry Baryshkov
2022-04-27 12:54 ` [PATCH v5 1/3] clk: qcom: gcc-msm8960: create tsens device if there are no child nodes Dmitry Baryshkov
2022-04-27 12:54 ` [PATCH v5 2/3] arm: dts: qcom-apq8064: create tsens device node Dmitry Baryshkov
2022-04-27 12:54 ` [PATCH v5 3/3] dt-bindings: clock: qcom,gcc-apq8064: split tsens to the child node Dmitry Baryshkov
2022-04-28  8:00   ` Krzysztof Kozlowski

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