All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v4 0/3] arm: qcom: qcom-apq8064: add separate device node for tsens
@ 2022-04-26  9:41 Dmitry Baryshkov
  2022-04-26  9:41 ` [PATCH v4 1/3] clk: qcom: gcc-msm8960: create tsens device if there are no child nodes Dmitry Baryshkov
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Dmitry Baryshkov @ 2022-04-26  9:41 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 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

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      | 45 +++++++------------
 arch/arm/boot/dts/qcom-apq8064.dtsi           | 25 +++++++----
 drivers/clk/qcom/gcc-msm8960.c                |  6 ++-
 3 files changed, 39 insertions(+), 37 deletions(-)


base-commit: 3123109284176b1532874591f7c81f3837bbdc17
prerequisite-patch-id: b5aad2b1e0db4e6d77d6a2faa2fe95acf274b3c8
prerequisite-patch-id: a0c7dcfc85a1eac4969530b73230f226006d6e1a
prerequisite-patch-id: 775709cdc871c90669902f9b431ac7b4f51408b5
-- 
2.35.1


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

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

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

* [PATCH v4 3/3] dt-bindings: clock: qcom,gcc-apq8064: split tsens to the child node
  2022-04-26  9:41 [PATCH v4 0/3] arm: qcom: qcom-apq8064: add separate device node for tsens Dmitry Baryshkov
  2022-04-26  9:41 ` [PATCH v4 1/3] clk: qcom: gcc-msm8960: create tsens device if there are no child nodes Dmitry Baryshkov
  2022-04-26  9:41 ` [PATCH v4 2/3] arm: dts: qcom-apq8064: create tsens device node Dmitry Baryshkov
@ 2022-04-26  9:41 ` Dmitry Baryshkov
  2022-04-26 18:24   ` Rob Herring
  2 siblings, 1 reply; 6+ messages in thread
From: Dmitry Baryshkov @ 2022-04-26  9:41 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      | 45 +++++++------------
 1 file changed, 17 insertions(+), 28 deletions(-)

diff --git a/Documentation/devicetree/bindings/clock/qcom,gcc-apq8064.yaml b/Documentation/devicetree/bindings/clock/qcom,gcc-apq8064.yaml
index b867da12761e..f2762599f679 100644
--- a/Documentation/devicetree/bindings/clock/qcom,gcc-apq8064.yaml
+++ b/Documentation/devicetree/bindings/clock/qcom,gcc-apq8064.yaml
@@ -23,47 +23,36 @@ description: |
 
 properties:
   compatible:
-    enum:
-      - qcom,gcc-apq8064
-      - qcom,gcc-msm8060
-
-  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
-
-  '#thermal-sensor-cells':
-    const: 1
+      - enum:
+          - qcom,gcc-apq8064
+          - qcom,gcc-msm8060
+      - const: syscon
 
 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] 6+ messages in thread

* Re: [PATCH v4 3/3] dt-bindings: clock: qcom,gcc-apq8064: split tsens to the child node
  2022-04-26  9:41 ` [PATCH v4 3/3] dt-bindings: clock: qcom,gcc-apq8064: split tsens to the child node Dmitry Baryshkov
@ 2022-04-26 18:24   ` Rob Herring
  2022-04-26 20:20     ` Dmitry Baryshkov
  0 siblings, 1 reply; 6+ messages in thread
From: Rob Herring @ 2022-04-26 18:24 UTC (permalink / raw)
  To: Dmitry Baryshkov
  Cc: Andy Gross, Bjorn Andersson, Amit Kucheria, Thara Gopinath,
	Krzysztof Kozlowski, Michael Turquette, Stephen Boyd,
	linux-arm-msm, linux-pm, devicetree, linux-clk, quic_tdas

On Tue, Apr 26, 2022 at 12:41:44PM +0300, 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      | 45 +++++++------------
>  1 file changed, 17 insertions(+), 28 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/clock/qcom,gcc-apq8064.yaml b/Documentation/devicetree/bindings/clock/qcom,gcc-apq8064.yaml
> index b867da12761e..f2762599f679 100644
> --- a/Documentation/devicetree/bindings/clock/qcom,gcc-apq8064.yaml
> +++ b/Documentation/devicetree/bindings/clock/qcom,gcc-apq8064.yaml
> @@ -23,47 +23,36 @@ description: |
>  
>  properties:
>    compatible:
> -    enum:
> -      - qcom,gcc-apq8064
> -      - qcom,gcc-msm8060
> -
> -  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
> -
> -  '#thermal-sensor-cells':
> -    const: 1
> +      - enum:
> +          - qcom,gcc-apq8064
> +          - qcom,gcc-msm8060
> +      - const: syscon
>  
>  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 {

This should throw a warning I think as 'thermal-sensor' needs to be 
defined. The patch didn't apply for me though.

> +        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	[flat|nested] 6+ messages in thread

* Re: [PATCH v4 3/3] dt-bindings: clock: qcom,gcc-apq8064: split tsens to the child node
  2022-04-26 18:24   ` Rob Herring
@ 2022-04-26 20:20     ` Dmitry Baryshkov
  0 siblings, 0 replies; 6+ messages in thread
From: Dmitry Baryshkov @ 2022-04-26 20:20 UTC (permalink / raw)
  To: Rob Herring
  Cc: Andy Gross, Bjorn Andersson, Amit Kucheria, Thara Gopinath,
	Krzysztof Kozlowski, Michael Turquette, Stephen Boyd,
	linux-arm-msm, linux-pm, devicetree, linux-clk, quic_tdas

On 26/04/2022 21:24, Rob Herring wrote:
> On Tue, Apr 26, 2022 at 12:41:44PM +0300, 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      | 45 +++++++------------
>>   1 file changed, 17 insertions(+), 28 deletions(-)
>>
>> diff --git a/Documentation/devicetree/bindings/clock/qcom,gcc-apq8064.yaml b/Documentation/devicetree/bindings/clock/qcom,gcc-apq8064.yaml
>> index b867da12761e..f2762599f679 100644
>> --- a/Documentation/devicetree/bindings/clock/qcom,gcc-apq8064.yaml
>> +++ b/Documentation/devicetree/bindings/clock/qcom,gcc-apq8064.yaml
>> @@ -23,47 +23,36 @@ description: |
>>   
>>   properties:
>>     compatible:
>> -    enum:
>> -      - qcom,gcc-apq8064
>> -      - qcom,gcc-msm8060
>> -
>> -  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
>> -
>> -  '#thermal-sensor-cells':
>> -    const: 1
>> +      - enum:
>> +          - qcom,gcc-apq8064
>> +          - qcom,gcc-msm8060
>> +      - const: syscon
>>   
>>   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 {
> 
> This should throw a warning I think as 'thermal-sensor' needs to be
> defined. The patch didn't apply for me though.

This series depends on 
https://lore.kernel.org/linux-arm-msm/20220426093608.2957210-1-dmitry.baryshkov@linaro.org/T/#u

Regarding the warnings, I think this is related to the issue Krzyshtof 
has reported few days ago. I was not able to trigger warnings for 
unknown properties if unevaluatedProperties:false is used.

> 
>> +        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
>>
>>


-- 
With best wishes
Dmitry

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

end of thread, other threads:[~2022-04-26 20:21 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-26  9:41 [PATCH v4 0/3] arm: qcom: qcom-apq8064: add separate device node for tsens Dmitry Baryshkov
2022-04-26  9:41 ` [PATCH v4 1/3] clk: qcom: gcc-msm8960: create tsens device if there are no child nodes Dmitry Baryshkov
2022-04-26  9:41 ` [PATCH v4 2/3] arm: dts: qcom-apq8064: create tsens device node Dmitry Baryshkov
2022-04-26  9:41 ` [PATCH v4 3/3] dt-bindings: clock: qcom,gcc-apq8064: split tsens to the child node Dmitry Baryshkov
2022-04-26 18:24   ` Rob Herring
2022-04-26 20:20     ` 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.