mbox series

[v3,0/4] thermal: tsens: Add support for QCS404 platform

Message ID cover.1543335819.git.amit.kucheria@linaro.org
Headers show
Series thermal: tsens: Add support for QCS404 platform | expand

Message

Amit Kucheria Nov. 27, 2018, 4:29 p.m. UTC
Add support for the Qualcomm QCS404 platform that contains v1 of the TSENS
IP. Introduce a fallback binding to handle "v1" functionality.

These patches have been tested on top of 4.20-rc3 + various qcs404-related
DT patches now in Andy's ci-next branch[1].

Changes since v2:
- Fix a conversion error in the get_temp routine the caused negative
  temperature readings (Reported by Khasim)

Changes since v1:
- Change p1 and p2 to be fixed-size arrays
- Refactor DT entries to be sorted by address, Thanks Vinod
- Added Acks

Amit Kucheria (4):
  dt: thermal: tsens: Add bindings for qcs404
  drivers: thermal: tsens: Add generic support for TSENS v1 IP
  arm64: dts: qcom: qcs404: Add tsens controller
  arm64: dts: qcom: qcs404: Add thermal zones for each sensor

 .../bindings/thermal/qcom-tsens.txt           |   3 +
 arch/arm64/boot/dts/qcom/qcs404.dtsi          | 226 ++++++++++++++++++
 drivers/thermal/qcom/Makefile                 |   2 +-
 drivers/thermal/qcom/tsens-common.c           |   2 +-
 drivers/thermal/qcom/tsens-v1.c               | 196 +++++++++++++++
 drivers/thermal/qcom/tsens.c                  |   3 +
 drivers/thermal/qcom/tsens.h                  |   3 +-
 7 files changed, 432 insertions(+), 3 deletions(-)
 create mode 100644 drivers/thermal/qcom/tsens-v1.c

-- 
2.17.1

Comments

Amit Kucheria Dec. 4, 2018, 11:26 a.m. UTC | #1
On Thu, Nov 29, 2018 at 10:27 PM Eduardo Valentin <edubezval@gmail.com> wrote:
>

> On Tue, Nov 27, 2018 at 09:59:07PM +0530, Amit Kucheria wrote:

> > qcs404 has 10 sensors connected to the single TSENS IP. Define a thermal

> > zone for each of those sensors to expose the temperature of each zone.

> >

> > Signed-off-by: Amit Kucheria <amit.kucheria@linaro.org>

> > Reviewed-by: Vinod Koul <vkoul@kernel.org>

> > Tested-by: Vinod Koul <vkoul@kernel.org>

> > ---

> >  arch/arm64/boot/dts/qcom/qcs404.dtsi | 206 +++++++++++++++++++++++++++

> >  1 file changed, 206 insertions(+)

> >

> > diff --git a/arch/arm64/boot/dts/qcom/qcs404.dtsi b/arch/arm64/boot/dts/qcom/qcs404.dtsi

> > index 57d14d8f0c90..cbc3fd378893 100644

> > --- a/arch/arm64/boot/dts/qcom/qcs404.dtsi

> > +++ b/arch/arm64/boot/dts/qcom/qcs404.dtsi

> > @@ -30,6 +30,7 @@

> >                       reg = <0x100>;

> >                       enable-method = "psci";

> >                       next-level-cache = <&L2_0>;

> > +                     #cooling-cells= <2>;

> >               };

> >

> >               CPU1: cpu@101 {

> > @@ -38,6 +39,7 @@

> >                       reg = <0x101>;

> >                       enable-method = "psci";

> >                       next-level-cache = <&L2_0>;

> > +                     #cooling-cells= <2>;

> >               };

> >

> >               CPU2: cpu@102 {

> > @@ -46,6 +48,7 @@

> >                       reg = <0x102>;

> >                       enable-method = "psci";

> >                       next-level-cache = <&L2_0>;

> > +                     #cooling-cells= <2>;

> >               };

> >

> >               CPU3: cpu@103 {

> > @@ -54,6 +57,7 @@

> >                       reg = <0x103>;

> >                       enable-method = "psci";

> >                       next-level-cache = <&L2_0>;

> > +                     #cooling-cells= <2>;

> >               };

> >

> >               L2_0: l2-cache {

> > @@ -507,4 +511,206 @@

> >                       #interrupt-cells = <2>;

> >               };

> >       };

> > +

> > +     thermal-zones {

> > +             aoss-thermal {

> > +                     polling-delay-passive = <250>;

> > +                     polling-delay = <1000>;

> > +

> > +                     thermal-sensors = <&tsens 0>;

> > +

> > +                     trips {

> > +                             aoss_alert: trip0 {

> > +                                     temperature = <75000>;

> > +                                     hysteresis = <2000>;

> > +                                     type = "passive";

>

>

> A passive trip and yet no cooling map associate to it..


Oops, was waiting for cpufreq to be enabled on the platform. I'll get
rid of the trips for now.

>

> > +                             };

> > +                             aoss_crit: trip1 {

> > +                                     temperature = <95000>;

> > +                                     hysteresis = <2000>;

> > +                                     type = "critical";

> > +                             };

> > +                     };

> > +             };

> > +

> > +             dsp-thermal {

> > +                     polling-delay-passive = <250>;

> > +                     polling-delay = <1000>;

> > +

> > +                     thermal-sensors = <&tsens 1>;

> > +

> > +                     trips {

> > +                             dsp_alert: trip0 {

> > +                                     temperature = <75000>;

> > +                                     hysteresis = <2000>;

> > +                                     type = "passive";

> > +                             };

> > +                             dsp_crit: trip1 {

> > +                                     temperature = <95000>;

> > +                                     hysteresis = <2000>;

> > +                                     type = "critical";

> > +                             };

> > +                     };

> > +             };

> > +

> > +             lpass-thermal {

> > +                     polling-delay-passive = <250>;

> > +                     polling-delay = <1000>;

> > +

> > +                     thermal-sensors = <&tsens 2>;

> > +

> > +                     trips {

> > +                             lpass_alert: trip0 {

> > +                                     temperature = <75000>;

> > +                                     hysteresis = <2000>;

> > +                                     type = "passive";

> > +                             };

> > +                             lpass_crit: trip1 {

> > +                                     temperature = <95000>;

> > +                                     hysteresis = <2000>;

> > +                                     type = "critical";

> > +                             };

> > +                     };

> > +             };

> > +

> > +             wlan-thermal {

> > +                     polling-delay-passive = <250>;

> > +                     polling-delay = <1000>;

> > +

> > +                     thermal-sensors = <&tsens 3>;

> > +

> > +                     trips {

> > +                             wlan_alert: trip0 {

> > +                                     temperature = <75000>;

> > +                                     hysteresis = <2000>;

> > +                                     type = "passive";

> > +                             };

> > +                             wlan_crit: trip1 {

> > +                                     temperature = <95000>;

> > +                                     hysteresis = <2000>;

> > +                                     type = "critical";

> > +                             };

> > +                     };

> > +             };

> > +

> > +             cluster-thermal {

> > +                     polling-delay-passive = <250>;

> > +                     polling-delay = <1000>;

> > +

> > +                     thermal-sensors = <&tsens 4>;

> > +

> > +                     trips {

> > +                             cluster_alert: cluster_alert {

> > +                                     temperature = <75000>;

> > +                                     hysteresis = <2000>;

> > +                                     type = "passive";

> > +                             };

> > +                             cluster_crit: cluster_crit {

> > +                                     temperature = <110000>;

> > +                                     hysteresis = <2000>;

> > +                                     type = "critical";

> > +                             };

> > +                     };

> > +             };

> > +

> > +             cpu-thermal0 {

> > +                     polling-delay-passive = <250>;

> > +                     polling-delay = <1000>;

> > +

> > +                     thermal-sensors = <&tsens 5>;

> > +

> > +                     trips {

> > +                             cpu_alert0: cpu_alert0 {

> > +                                     temperature = <75000>;

> > +                                     hysteresis = <2000>;

> > +                                     type = "passive";

> > +                             };

> > +                             cpu_crit0: cpu_crit0 {

> > +                                     temperature = <110000>;

> > +                                     hysteresis = <2000>;

> > +                                     type = "critical";

> > +                             };

> > +                     };

> > +             };

> > +

> > +             cpu-thermal1 {

> > +                     polling-delay-passive = <250>;

> > +                     polling-delay = <1000>;

> > +

> > +                     thermal-sensors = <&tsens 6>;

> > +

> > +                     trips {

> > +                             cpu_alert1: trip0 {

> > +                                     temperature = <75000>;

> > +                                     hysteresis = <2000>;

> > +                                     type = "passive";

> > +                             };

> > +                             cpu_crit1: trip1 {

> > +                                     temperature = <110000>;

> > +                                     hysteresis = <2000>;

> > +                                     type = "critical";

> > +                             };

> > +                     };

> > +             };

> > +

> > +             cpu-thermal2 {

> > +                     polling-delay-passive = <250>;

> > +                     polling-delay = <1000>;

> > +

> > +                     thermal-sensors = <&tsens 7>;

> > +

> > +                     trips {

> > +                             cpu_alert2: trip0 {

> > +                                     temperature = <75000>;

> > +                                     hysteresis = <2000>;

> > +                                     type = "passive";

> > +                             };

> > +                             cpu_crit2: trip1 {

> > +                                     temperature = <110000>;

> > +                                     hysteresis = <2000>;

> > +                                     type = "critical";

> > +                             };

> > +                     };

> > +             };

> > +

> > +             cpu-thermal3 {

> > +                     polling-delay-passive = <250>;

> > +                     polling-delay = <1000>;

> > +

> > +                     thermal-sensors = <&tsens 8>;

> > +

> > +                     trips {

> > +                             cpu_alert3: trip0 {

> > +                                     temperature = <75000>;

> > +                                     hysteresis = <2000>;

> > +                                     type = "passive";

> > +                             };

> > +                             cpu_crit3: trip1 {

> > +                                     temperature = <110000>;

> > +                                     hysteresis = <2000>;

> > +                                     type = "critical";

> > +                             };

> > +                     };

> > +             };

> > +

> > +             gpu-thermal {

> > +                     polling-delay-passive = <250>;

> > +                     polling-delay = <1000>;

> > +

> > +                     thermal-sensors = <&tsens 9>;

> > +

> > +                     trips {

> > +                             gpu_alert: trip0 {

> > +                                     temperature = <75000>;

> > +                                     hysteresis = <2000>;

> > +                                     type = "passive";

> > +                             };

> > +                             gpu_crit: trip1 {

> > +                                     temperature = <95000>;

> > +                                     hysteresis = <2000>;

> > +                                     type = "critical";

> > +                             };

> > +                     };

> > +             };

> > +     };

> >  };

> > --

> > 2.17.1

> >