2024-03-08 22:08:52

by Konrad Dybcio

[permalink] [raw]
Subject: [PATCH 0/3] QCM2290 LMH

Wire up LMH on QCM2290 and fix a bad bug while at it.

P1-2 for thermal, P3 for qcom

Signed-off-by: Konrad Dybcio <[email protected]>
---
Konrad Dybcio (2):
dt-bindings: thermal: lmh: Add QCM2290 compatible
thermal: qcom: lmh: Check for SCM avaiability at probe

Loic Poulain (1):
arm64: dts: qcom: qcm2290: Add LMH node

Documentation/devicetree/bindings/thermal/qcom-lmh.yaml | 13 +++++++++----
arch/arm64/boot/dts/qcom/qcm2290.dtsi | 14 +++++++++++++-
drivers/thermal/qcom/lmh.c | 3 +++
3 files changed, 25 insertions(+), 5 deletions(-)
---
base-commit: 8ffc8b1bbd505e27e2c8439d326b6059c906c9dd
change-id: 20240308-topic-rb1_lmh-1e0f440c392a

Best regards,
--
Konrad Dybcio <[email protected]>



2024-03-08 22:08:57

by Konrad Dybcio

[permalink] [raw]
Subject: [PATCH 1/3] dt-bindings: thermal: lmh: Add QCM2290 compatible

Document the QCM2290 LMH.

Signed-off-by: Konrad Dybcio <[email protected]>
---
Documentation/devicetree/bindings/thermal/qcom-lmh.yaml | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/Documentation/devicetree/bindings/thermal/qcom-lmh.yaml b/Documentation/devicetree/bindings/thermal/qcom-lmh.yaml
index 5ff72ce5c887..b815d8c5da51 100644
--- a/Documentation/devicetree/bindings/thermal/qcom-lmh.yaml
+++ b/Documentation/devicetree/bindings/thermal/qcom-lmh.yaml
@@ -17,10 +17,15 @@ description:

properties:
compatible:
- enum:
- - qcom,sc8180x-lmh
- - qcom,sdm845-lmh
- - qcom,sm8150-lmh
+ oneOf:
+ - enum:
+ - qcom,msm8998-lmh
+ - qcom,sc8180x-lmh
+ - qcom,sdm845-lmh
+ - qcom,sm8150-lmh
+ - items:
+ - const: qcom,qcm2290-lmh
+ - const: qcom,sm8150-lmh

reg:
items:

--
2.44.0


2024-03-08 22:09:17

by Konrad Dybcio

[permalink] [raw]
Subject: [PATCH 2/3] thermal: qcom: lmh: Check for SCM avaiability at probe

Up until now, the necessary scm availability check has not been
performed, leading to possible null pointer dereferences (which did
happen for me on RB1).

Fix that.

Fixes: 53bca371cdf7 ("thermal/drivers/qcom: Add support for LMh driver")
Cc: <[email protected]>
Signed-off-by: Konrad Dybcio <[email protected]>
---
drivers/thermal/qcom/lmh.c | 3 +++
1 file changed, 3 insertions(+)

diff --git a/drivers/thermal/qcom/lmh.c b/drivers/thermal/qcom/lmh.c
index f6edb12ec004..5225b3621a56 100644
--- a/drivers/thermal/qcom/lmh.c
+++ b/drivers/thermal/qcom/lmh.c
@@ -95,6 +95,9 @@ static int lmh_probe(struct platform_device *pdev)
unsigned int enable_alg;
u32 node_id;

+ if (!qcom_scm_is_available())
+ return -EPROBE_DEFER;
+
lmh_data = devm_kzalloc(dev, sizeof(*lmh_data), GFP_KERNEL);
if (!lmh_data)
return -ENOMEM;

--
2.44.0


2024-03-08 22:09:37

by Konrad Dybcio

[permalink] [raw]
Subject: [PATCH 3/3] arm64: dts: qcom: qcm2290: Add LMH node

From: Loic Poulain <[email protected]>

Add a node for the Limits Mangement Hardware to ensure it can be
configured by the operating system.

Signed-off-by: Loic Poulain <[email protected]>
[Konrad: add commit msg, rebase]
Signed-off-by: Konrad Dybcio <[email protected]>
---
arch/arm64/boot/dts/qcom/qcm2290.dtsi | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/arch/arm64/boot/dts/qcom/qcm2290.dtsi b/arch/arm64/boot/dts/qcom/qcm2290.dtsi
index 89beac833d43..1aacad50e7fc 100644
--- a/arch/arm64/boot/dts/qcom/qcm2290.dtsi
+++ b/arch/arm64/boot/dts/qcom/qcm2290.dtsi
@@ -1858,7 +1858,7 @@ cpufreq_hw: cpufreq@f521000 {
compatible = "qcom,qcm2290-cpufreq-hw", "qcom,cpufreq-hw";
reg = <0x0 0x0f521000 0x0 0x1000>;
reg-names = "freq-domain0";
- interrupts = <GIC_SPI 37 IRQ_TYPE_LEVEL_HIGH>;
+ interrupts-extended = <&lmh_cluster 0>;
interrupt-names = "dcvsh-irq-0";
clocks = <&rpmcc RPM_SMD_XO_CLK_SRC>, <&gcc GPLL0>;
clock-names = "xo", "alternate";
@@ -1866,6 +1866,18 @@ cpufreq_hw: cpufreq@f521000 {
#freq-domain-cells = <1>;
#clock-cells = <1>;
};
+
+ lmh_cluster: lmh@f550800 {
+ compatible = "qcom,qcm2290-lmh", "qcom,sm8150-lmh";
+ reg = <0x0 0x0f550800 0x0 0x400>;
+ interrupts = <GIC_SPI 37 IRQ_TYPE_LEVEL_HIGH>;
+ cpus = <&CPU0>;
+ qcom,lmh-temp-arm-millicelsius = <65000>;
+ qcom,lmh-temp-low-millicelsius = <94500>;
+ qcom,lmh-temp-high-millicelsius = <95000>;
+ interrupt-controller;
+ #interrupt-cells = <1>;
+ };
};

thermal-zones {

--
2.44.0


2024-03-09 10:41:12

by Dmitry Baryshkov

[permalink] [raw]
Subject: Re: [PATCH 2/3] thermal: qcom: lmh: Check for SCM avaiability at probe

On Sat, 9 Mar 2024 at 00:08, Konrad Dybcio <[email protected]> wrote:
>
> Up until now, the necessary scm availability check has not been
> performed, leading to possible null pointer dereferences (which did
> happen for me on RB1).
>
> Fix that.
>
> Fixes: 53bca371cdf7 ("thermal/drivers/qcom: Add support for LMh driver")
> Cc: <[email protected]>
> Signed-off-by: Konrad Dybcio <[email protected]>
> ---
> drivers/thermal/qcom/lmh.c | 3 +++
> 1 file changed, 3 insertions(+)

Reviewed-by: Dmitry Baryshkov <[email protected]>



--
With best wishes
Dmitry

2024-03-09 11:06:27

by Krzysztof Kozlowski

[permalink] [raw]
Subject: Re: [PATCH 1/3] dt-bindings: thermal: lmh: Add QCM2290 compatible

On 08/03/2024 23:08, Konrad Dybcio wrote:
> Document the QCM2290 LMH.
>

MSM8998 appeared as well. Please either explain in the commit msg or
drop it from the binding (if it is not correct).

> Signed-off-by: Konrad Dybcio <[email protected]>
> ---
> Documentation/devicetree/bindings/thermal/qcom-lmh.yaml | 13 +++++++++----
> 1 file changed, 9 insertions(+), 4 deletions(-)
>
> diff --git a/Documentation/devicetree/bindings/thermal/qcom-lmh.yaml b/Documentation/devicetree/bindings/thermal/qcom-lmh.yaml
> index 5ff72ce5c887..b815d8c5da51 100644
> --- a/Documentation/devicetree/bindings/thermal/qcom-lmh.yaml
> +++ b/Documentation/devicetree/bindings/thermal/qcom-lmh.yaml
> @@ -17,10 +17,15 @@ description:
>
> properties:
> compatible:
> - enum:
> - - qcom,sc8180x-lmh
> - - qcom,sdm845-lmh
> - - qcom,sm8150-lmh
> + oneOf:
> + - enum:
> + - qcom,msm8998-lmh

^^ Here

Best regards,
Krzysztof


2024-03-09 13:05:51

by Konrad Dybcio

[permalink] [raw]
Subject: Re: [PATCH 1/3] dt-bindings: thermal: lmh: Add QCM2290 compatible

On 9.03.2024 12:06, Krzysztof Kozlowski wrote:
> On 08/03/2024 23:08, Konrad Dybcio wrote:
>> Document the QCM2290 LMH.
>>
>
> MSM8998 appeared as well. Please either explain in the commit msg or
> drop it from the binding (if it is not correct).

Hm, git messed with my branches.. I'll send the correct patch in v2.

Konrad