linux-arm-msm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] arm64: dts: qcom: pm6150: Add thermal zone for PMIC on-die temperature
@ 2021-06-02 16:06 Matthias Kaehlcke
  2021-06-02 16:36 ` Doug Anderson
  0 siblings, 1 reply; 3+ messages in thread
From: Matthias Kaehlcke @ 2021-06-02 16:06 UTC (permalink / raw)
  To: Andy Gross, Bjorn Andersson, Rob Herring
  Cc: linux-kernel, Douglas Anderson, devicetree, Stephen Boyd,
	linux-arm-msm, Matthias Kaehlcke

Add a thermal zone for the pm6150 on-die temperature. The system should
try to shut down orderly when the temperature reaches 95degC, otherwise
the PMIC will power off at 115degC.

Signed-off-by: Matthias Kaehlcke <mka@chromium.org>
---

 arch/arm64/boot/dts/qcom/pm6150.dtsi | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/arch/arm64/boot/dts/qcom/pm6150.dtsi b/arch/arm64/boot/dts/qcom/pm6150.dtsi
index 8ab4f1f78bbf..de7fb129f739 100644
--- a/arch/arm64/boot/dts/qcom/pm6150.dtsi
+++ b/arch/arm64/boot/dts/qcom/pm6150.dtsi
@@ -7,6 +7,30 @@
 #include <dt-bindings/spmi/spmi.h>
 #include <dt-bindings/thermal/thermal.h>
 
+/ {
+	thermal-zones {
+		pm6150_thermal: pm6150-thermal {
+			polling-delay-passive = <100>;
+			polling-delay = <0>;
+			thermal-sensors = <&pm6150_temp>;
+
+			trips {
+				pm6150_trip0: trip0 {
+					temperature = <95000>;
+					hysteresis = <0>;
+					type = "passive";
+				};
+
+				pm6150_crit: pm6150-crit {
+					temperature = <115000>;
+					hysteresis = <0>;
+					type = "critical";
+				};
+			};
+		};
+	};
+};
+
 &spmi_bus {
 	pm6150_lsid0: pmic@0 {
 		compatible = "qcom,pm6150", "qcom,spmi-pmic";
-- 
2.32.0.rc0.204.g9fa02ecfa5-goog


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

* Re: [PATCH] arm64: dts: qcom: pm6150: Add thermal zone for PMIC on-die temperature
  2021-06-02 16:06 [PATCH] arm64: dts: qcom: pm6150: Add thermal zone for PMIC on-die temperature Matthias Kaehlcke
@ 2021-06-02 16:36 ` Doug Anderson
  2021-06-02 16:44   ` Matthias Kaehlcke
  0 siblings, 1 reply; 3+ messages in thread
From: Doug Anderson @ 2021-06-02 16:36 UTC (permalink / raw)
  To: Matthias Kaehlcke
  Cc: Andy Gross, Bjorn Andersson, Rob Herring, LKML,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	Stephen Boyd, linux-arm-msm

Hi,

On Wed, Jun 2, 2021 at 9:06 AM Matthias Kaehlcke <mka@chromium.org> wrote:
>
> Add a thermal zone for the pm6150 on-die temperature. The system should
> try to shut down orderly when the temperature reaches 95degC, otherwise
> the PMIC will power off at 115degC.
>
> Signed-off-by: Matthias Kaehlcke <mka@chromium.org>
> ---
>
>  arch/arm64/boot/dts/qcom/pm6150.dtsi | 24 ++++++++++++++++++++++++
>  1 file changed, 24 insertions(+)
>
> diff --git a/arch/arm64/boot/dts/qcom/pm6150.dtsi b/arch/arm64/boot/dts/qcom/pm6150.dtsi
> index 8ab4f1f78bbf..de7fb129f739 100644
> --- a/arch/arm64/boot/dts/qcom/pm6150.dtsi
> +++ b/arch/arm64/boot/dts/qcom/pm6150.dtsi
> @@ -7,6 +7,30 @@
>  #include <dt-bindings/spmi/spmi.h>
>  #include <dt-bindings/thermal/thermal.h>
>
> +/ {
> +       thermal-zones {
> +               pm6150_thermal: pm6150-thermal {
> +                       polling-delay-passive = <100>;
> +                       polling-delay = <0>;
> +                       thermal-sensors = <&pm6150_temp>;
> +
> +                       trips {
> +                               pm6150_trip0: trip0 {
> +                                       temperature = <95000>;
> +                                       hysteresis = <0>;
> +                                       type = "passive";
> +                               };
> +
> +                               pm6150_crit: pm6150-crit {

Nit that the node names are not symmetric. One is "trip0" and the
other is "pm6510-crit". Seems like you can remove the "pm6150-" prefix
from this one (but keep it in the label?)

> +                                       temperature = <115000>;
> +                                       hysteresis = <0>;
> +                                       type = "critical";
> +                               };
> +                       };
> +               };

Correct me if I'm misunderstanding, but I don't think that the
description of this patch matches the contents. You're saying that the
PMIC will power itself off at 115C and that we want to do an orderly
shutdown _before_ the PMIC powers off. Doesn't that mean that the
"critical" trip needs to be at some temperature _lower_ than 115C? As
I remember it the system performs an orderly shutdown starting when it
sees the critical temperature.

-Doug

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

* Re: [PATCH] arm64: dts: qcom: pm6150: Add thermal zone for PMIC on-die temperature
  2021-06-02 16:36 ` Doug Anderson
@ 2021-06-02 16:44   ` Matthias Kaehlcke
  0 siblings, 0 replies; 3+ messages in thread
From: Matthias Kaehlcke @ 2021-06-02 16:44 UTC (permalink / raw)
  To: Doug Anderson
  Cc: Andy Gross, Bjorn Andersson, Rob Herring, LKML,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	Stephen Boyd, linux-arm-msm

Hi Doug,

On Wed, Jun 02, 2021 at 09:36:07AM -0700, Doug Anderson wrote:
> Hi,
> 
> On Wed, Jun 2, 2021 at 9:06 AM Matthias Kaehlcke <mka@chromium.org> wrote:
> >
> > Add a thermal zone for the pm6150 on-die temperature. The system should
> > try to shut down orderly when the temperature reaches 95degC, otherwise
> > the PMIC will power off at 115degC.
> >
> > Signed-off-by: Matthias Kaehlcke <mka@chromium.org>
> > ---
> >
> >  arch/arm64/boot/dts/qcom/pm6150.dtsi | 24 ++++++++++++++++++++++++
> >  1 file changed, 24 insertions(+)
> >
> > diff --git a/arch/arm64/boot/dts/qcom/pm6150.dtsi b/arch/arm64/boot/dts/qcom/pm6150.dtsi
> > index 8ab4f1f78bbf..de7fb129f739 100644
> > --- a/arch/arm64/boot/dts/qcom/pm6150.dtsi
> > +++ b/arch/arm64/boot/dts/qcom/pm6150.dtsi
> > @@ -7,6 +7,30 @@
> >  #include <dt-bindings/spmi/spmi.h>
> >  #include <dt-bindings/thermal/thermal.h>
> >
> > +/ {
> > +       thermal-zones {
> > +               pm6150_thermal: pm6150-thermal {
> > +                       polling-delay-passive = <100>;
> > +                       polling-delay = <0>;
> > +                       thermal-sensors = <&pm6150_temp>;
> > +
> > +                       trips {
> > +                               pm6150_trip0: trip0 {
> > +                                       temperature = <95000>;
> > +                                       hysteresis = <0>;
> > +                                       type = "passive";
> > +                               };
> > +
> > +                               pm6150_crit: pm6150-crit {
> 
> Nit that the node names are not symmetric. One is "trip0" and the
> other is "pm6510-crit". Seems like you can remove the "pm6150-" prefix
> from this one (but keep it in the label?)

Sounds good.

> > +                                       temperature = <115000>;
> > +                                       hysteresis = <0>;
> > +                                       type = "critical";
> > +                               };
> > +                       };
> > +               };
> 
> Correct me if I'm misunderstanding, but I don't think that the
> description of this patch matches the contents. You're saying that the
> PMIC will power itself off at 115C and that we want to do an orderly
> shutdown _before_ the PMIC powers off. Doesn't that mean that the
> "critical" trip needs to be at some temperature _lower_ than 115C? As
> I remember it the system performs an orderly shutdown starting when it
> sees the critical temperature.

Yeah, you are right. Polling starts at 95degC, the system should try to
shutdown at 115degC and based on that configuration the emergency
shutdown would happen at 145degC:

  static const long temp_map_gen2_v1[THRESH_COUNT][STAGE_COUNT] = {
        {  90000, 110000, 140000 },
  	{  95000, 115000, 145000 },
  	{ 100000, 120000, 150000 },
  	{ 105000, 125000, 155000 },
  };

I'll fix the commit message in the v2.

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

end of thread, other threads:[~2021-06-02 16:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-02 16:06 [PATCH] arm64: dts: qcom: pm6150: Add thermal zone for PMIC on-die temperature Matthias Kaehlcke
2021-06-02 16:36 ` Doug Anderson
2021-06-02 16:44   ` Matthias Kaehlcke

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