Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux
authorLinus Torvalds <torvalds@linux-foundation.org>
Wed, 12 Oct 2016 18:05:23 +0000 (11:05 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 12 Oct 2016 18:05:23 +0000 (11:05 -0700)
Pull thermal managament updates from Zhang Rui:

 - Enhance thermal "userspace" governor to export the reason when a
   thermal event is triggered and delivered to user space. From Srinivas
   Pandruvada

 - Introduce a single TSENS thermal driver for the different versions of
   the TSENS IP that exist, on different qcom msm/apq SoCs'. Support for
   msm8916, msm8960, msm8974 and msm8996 families is also added. From
   Rajendra Nayak

 - Introduce hardware-tracked trip points support to the device tree
   thermal sensor framework. The framework supports an arbitrary number
   of trip points. Whenever the current temperature is changed, the trip
   points immediately below and above the current temperature are found,
   driver callback is invoked to program the hardware to get notified
   when either of the two trip points are triggered. Hardware-tracked
   trip points support for rockchip thermal driver is also added at the
   same time. From Sascha Hauer, Caesar Wang

 - Introduce a new thermal driver, which enables TMU (Thermal Monitor
   Unit) on QorIQ platform. From Jia Hongtao

 - Introduce a new thermal driver for Maxim MAX77620. From Laxman
   Dewangan

 - Introduce a new thermal driver for Intel platforms using WhiskeyCove
   PMIC. From Bin Gao

 - Add mt2701 chip support to MTK thermal driver. From Dawei Chien

 - Enhance Tegra thermal driver to enable soctherm node and set
   "critical", "hot" trips, for Tegra124, Tegra132, Tegra210. From Wei
   Ni

 - Add resume support for tango thermal driver. From Marc Gonzalez

 - several small fixes and improvements for rockchip, qcom, imx, rcar,
   mtk thermal drivers and thermal core code. From Caesar Wang, Keerthy,
   Rocky Hao, Wei Yongjun, Peter Robinson, Bui Duc Phuc, Axel Lin, Hugh
   Kang

* 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux: (48 commits)
  thermal: int3403: Process trip change notification
  thermal: int340x: New Interface to read trip and notify
  thermal: user_space gov: Add additional information in uevent
  thermal: Enhance thermal_zone_device_update for events
  arm64: tegra: set hot trips for Tegra210
  arm64: tegra: set critical trips for Tegra210
  arm64: tegra: add soctherm node for Tegra210
  arm64: tegra: set hot trips for Tegra132
  arm64: tegra: set critical trips for Tegra132
  arm64: tegra: use tegra132-soctherm for Tegra132
  arm: tegra: set hot trips for Tegra124
  arm: tegra: set critical trips for Tegra124
  thermal: tegra: add hw-throttle for Tegra132
  thermal: tegra: add hw-throttle function
  of: Add bindings of hw throttle for Tegra soctherm
  thermal: mtk_thermal: Check return value of devm_thermal_zone_of_sensor_register
  thermal: Add Mediatek thermal driver for mt2701.
  dt-bindings: thermal: Add binding document for Mediatek thermal controller
  thermal: max77620: Add thermal driver for reporting junction temp
  thermal: max77620: Add DT binding doc for thermal driver
  ...

1  2 
arch/arm/boot/dts/tegra124-jetson-tk1.dts
arch/arm64/boot/dts/nvidia/tegra210.dtsi
drivers/thermal/rcar_thermal.c

         *   Pin 41: BR_UART1_TXD
         *   Pin 44: BR_UART1_RXD
         */
 -      serial@0,70006000 {
 +      serial@70006000 {
                compatible = "nvidia,tegra124-hsuart", "nvidia,tegra30-hsuart";
                status = "okay";
        };
         *   Pin 71: UART2_CTS_L
         *   Pin 74: UART2_RTS_L
         */
 -      serial@0,70006040 {
 +      serial@70006040 {
                compatible = "nvidia,tegra124-hsuart", "nvidia,tegra30-hsuart";
                status = "okay";
        };
        thermal-zones {
                cpu {
                        trips {
-                               trip {
+                               cpu-shutdown-trip {
                                        temperature = <101000>;
                                        hysteresis = <0>;
                                        type = "critical";
                                };
                        };
-                       cooling-maps {
-                               /* There are currently no cooling maps because there are no cooling devices */
-                       };
                };
  
                mem {
                        trips {
-                               trip {
+                               mem-shutdown-trip {
                                        temperature = <101000>;
                                        hysteresis = <0>;
                                        type = "critical";
                                };
                        };
-                       cooling-maps {
-                               /* There are currently no cooling maps because there are no cooling devices */
-                       };
                };
  
                gpu {
                        trips {
-                               trip {
+                               gpu-shutdown-trip {
                                        temperature = <101000>;
                                        hysteresis = <0>;
                                        type = "critical";
                                };
                        };
-                       cooling-maps {
-                               /* There are currently no cooling maps because there are no cooling devices */
-                       };
                };
        };
  };
@@@ -3,6 -3,7 +3,7 @@@
  #include <dt-bindings/memory/tegra210-mc.h>
  #include <dt-bindings/pinctrl/pinctrl-tegra.h>
  #include <dt-bindings/interrupt-controller/arm-gic.h>
+ #include <dt-bindings/thermal/tegra124-soctherm.h>
  
  / {
        compatible = "nvidia,tegra210";
@@@ -34,7 -35,6 +35,7 @@@
                        clock-names = "dpaux", "parent";
                        resets = <&tegra_car 207>;
                        reset-names = "dpaux";
 +                      power-domains = <&pd_sor>;
                        status = "disabled";
  
                        state_dpaux1_aux: pinmux-aux {
                        clock-names = "dsi", "lp", "parent";
                        resets = <&tegra_car 48>;
                        reset-names = "dsi";
 +                      power-domains = <&pd_sor>;
                        nvidia,mipi-calibrate = <&mipi 0x0c0>; /* DSIA & DSIB pads */
  
                        status = "disabled";
                        clock-names = "dsi", "lp", "parent";
                        resets = <&tegra_car 82>;
                        reset-names = "dsi";
 +                      power-domains = <&pd_sor>;
                        nvidia,mipi-calibrate = <&mipi 0x300>; /* DSIC & DSID pads */
  
                        status = "disabled";
                        pinctrl-1 = <&state_dpaux_i2c>;
                        pinctrl-2 = <&state_dpaux_off>;
                        pinctrl-names = "aux", "i2c", "off";
 +                      power-domains = <&pd_sor>;
                        status = "disabled";
                };
  
                        pinctrl-1 = <&state_dpaux1_i2c>;
                        pinctrl-2 = <&state_dpaux1_off>;
                        pinctrl-names = "aux", "i2c", "off";
 +                      power-domains = <&pd_sor>;
                        status = "disabled";
                };
  
                        clock-names = "dpaux", "parent";
                        resets = <&tegra_car 181>;
                        reset-names = "dpaux";
 +                      power-domains = <&pd_sor>;
                        status = "disabled";
  
                        state_dpaux_aux: pinmux-aux {
        };
  
        gpio: gpio@6000d000 {
 -              compatible = "nvidia,tegra210-gpio", "nvidia,tegra124-gpio", "nvidia,tegra30-gpio";
 +              compatible = "nvidia,tegra210-gpio", "nvidia,tegra30-gpio";
                reg = <0x0 0x6000d000 0x0 0x1000>;
                interrupts = <GIC_SPI 32 IRQ_TYPE_LEVEL_HIGH>,
                             <GIC_SPI 33 IRQ_TYPE_LEVEL_HIGH>,
                                #power-domain-cells = <0>;
                        };
  
 +                      pd_sor: sor {
 +                              clocks = <&tegra_car TEGRA210_CLK_SOR0>,
 +                                       <&tegra_car TEGRA210_CLK_SOR1>,
 +                                       <&tegra_car TEGRA210_CLK_CSI>,
 +                                       <&tegra_car TEGRA210_CLK_DSIA>,
 +                                       <&tegra_car TEGRA210_CLK_DSIB>,
 +                                       <&tegra_car TEGRA210_CLK_DPAUX>,
 +                                       <&tegra_car TEGRA210_CLK_DPAUX1>,
 +                                       <&tegra_car TEGRA210_CLK_MIPI_CAL>;
 +                              resets = <&tegra_car TEGRA210_CLK_SOR0>,
 +                                       <&tegra_car TEGRA210_CLK_SOR1>,
 +                                       <&tegra_car TEGRA210_CLK_CSI>,
 +                                       <&tegra_car TEGRA210_CLK_DSIA>,
 +                                       <&tegra_car TEGRA210_CLK_DSIB>,
 +                                       <&tegra_car TEGRA210_CLK_DPAUX>,
 +                                       <&tegra_car TEGRA210_CLK_DPAUX1>,
 +                                       <&tegra_car TEGRA210_CLK_MIPI_CAL>;
 +                              #power-domain-cells = <0>;
 +                      };
 +
                        pd_xusbss: xusba {
                                clocks = <&tegra_car TEGRA210_CLK_XUSB_SS>;
 -                              clock-names = "xusb-ss";
                                resets = <&tegra_car TEGRA210_CLK_XUSB_SS>;
 -                              reset-names = "xusb-ss";
                                #power-domain-cells = <0>;
                        };
  
                        pd_xusbdev: xusbb {
                                clocks = <&tegra_car TEGRA210_CLK_XUSB_DEV>;
 -                              clock-names = "xusb-dev";
                                resets = <&tegra_car 95>;
 -                              reset-names = "xusb-dev";
                                #power-domain-cells = <0>;
                        };
  
                        pd_xusbhost: xusbc {
                                clocks = <&tegra_car TEGRA210_CLK_XUSB_HOST>;
 -                              clock-names = "xusb-host";
                                resets = <&tegra_car TEGRA210_CLK_XUSB_HOST>;
 -                              reset-names = "xusb-host";
                                #power-domain-cells = <0>;
                        };
                };
                reg = <0x0 0x700e3000 0x0 0x100>;
                clocks = <&tegra_car TEGRA210_CLK_MIPI_CAL>;
                clock-names = "mipi-cal";
 +              power-domains = <&pd_sor>;
                #nvidia,mipi-calibrate-cells = <1>;
        };
  
                #size-cells = <1>;
                ranges = <0x702c0000 0x0 0x702c0000 0x00040000>;
                status = "disabled";
 +
 +              adma: dma@702e2000 {
 +                      compatible = "nvidia,tegra210-adma";
 +                      reg = <0x702e2000 0x2000>;
 +                      interrupt-parent = <&agic>;
 +                      interrupts = <GIC_SPI 24 IRQ_TYPE_LEVEL_HIGH>,
 +                                   <GIC_SPI 25 IRQ_TYPE_LEVEL_HIGH>,
 +                                   <GIC_SPI 26 IRQ_TYPE_LEVEL_HIGH>,
 +                                   <GIC_SPI 27 IRQ_TYPE_LEVEL_HIGH>,
 +                                   <GIC_SPI 28 IRQ_TYPE_LEVEL_HIGH>,
 +                                   <GIC_SPI 29 IRQ_TYPE_LEVEL_HIGH>,
 +                                   <GIC_SPI 30 IRQ_TYPE_LEVEL_HIGH>,
 +                                   <GIC_SPI 31 IRQ_TYPE_LEVEL_HIGH>,
 +                                   <GIC_SPI 32 IRQ_TYPE_LEVEL_HIGH>,
 +                                   <GIC_SPI 33 IRQ_TYPE_LEVEL_HIGH>,
 +                                   <GIC_SPI 34 IRQ_TYPE_LEVEL_HIGH>,
 +                                   <GIC_SPI 35 IRQ_TYPE_LEVEL_HIGH>,
 +                                   <GIC_SPI 36 IRQ_TYPE_LEVEL_HIGH>,
 +                                   <GIC_SPI 37 IRQ_TYPE_LEVEL_HIGH>,
 +                                   <GIC_SPI 38 IRQ_TYPE_LEVEL_HIGH>,
 +                                   <GIC_SPI 39 IRQ_TYPE_LEVEL_HIGH>,
 +                                   <GIC_SPI 40 IRQ_TYPE_LEVEL_HIGH>,
 +                                   <GIC_SPI 41 IRQ_TYPE_LEVEL_HIGH>,
 +                                   <GIC_SPI 42 IRQ_TYPE_LEVEL_HIGH>,
 +                                   <GIC_SPI 43 IRQ_TYPE_LEVEL_HIGH>,
 +                                   <GIC_SPI 44 IRQ_TYPE_LEVEL_HIGH>,
 +                                   <GIC_SPI 45 IRQ_TYPE_LEVEL_HIGH>;
 +                      #dma-cells = <1>;
 +                      clocks = <&tegra_car TEGRA210_CLK_D_AUDIO>;
 +                      clock-names = "d_audio";
 +                      status = "disabled";
 +              };
 +
 +              agic: agic@702f9000 {
 +                      compatible = "nvidia,tegra210-agic";
 +                      #interrupt-cells = <3>;
 +                      interrupt-controller;
 +                      reg = <0x702f9000 0x2000>,
 +                            <0x702fa000 0x2000>;
 +                      interrupts = <GIC_SPI 102 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_HIGH)>;
 +                      clocks = <&tegra_car TEGRA210_CLK_APE>;
 +                      clock-names = "clk";
 +                      status = "disabled";
 +              };
        };
  
        spi@70410000 {
                                (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>;
                interrupt-parent = <&gic>;
        };
+       soctherm: thermal-sensor@700e2000 {
+               compatible = "nvidia,tegra210-soctherm";
+               reg = <0x0 0x700e2000 0x0 0x600 /* SOC_THERM reg_base */
+                       0x0 0x60006000 0x0 0x400>; /* CAR reg_base */
+               reg-names = "soctherm-reg", "car-reg";
+               interrupts = <GIC_SPI 48 IRQ_TYPE_LEVEL_HIGH>;
+               clocks = <&tegra_car TEGRA210_CLK_TSENSOR>,
+                       <&tegra_car TEGRA210_CLK_SOC_THERM>;
+               clock-names = "tsensor", "soctherm";
+               resets = <&tegra_car 78>;
+               reset-names = "soctherm";
+               #thermal-sensor-cells = <1>;
+               throttle-cfgs {
+                       throttle_heavy: heavy {
+                               nvidia,priority = <100>;
+                               nvidia,cpu-throt-percent = <85>;
+                               #cooling-cells = <2>;
+                       };
+               };
+       };
+       thermal-zones {
+               cpu {
+                       polling-delay-passive = <1000>;
+                       polling-delay = <0>;
+                       thermal-sensors =
+                               <&soctherm TEGRA124_SOCTHERM_SENSOR_CPU>;
+                       trips {
+                               cpu-shutdown-trip {
+                                       temperature = <102500>;
+                                       hysteresis = <0>;
+                                       type = "critical";
+                               };
+                               cpu_throttle_trip: throttle-trip {
+                                       temperature = <98500>;
+                                       hysteresis = <1000>;
+                                       type = "hot";
+                               };
+                       };
+                       cooling-maps {
+                               map0 {
+                                       trip = <&cpu_throttle_trip>;
+                                       cooling-device = <&throttle_heavy 1 1>;
+                               };
+                       };
+               };
+               mem {
+                       polling-delay-passive = <0>;
+                       polling-delay = <0>;
+                       thermal-sensors =
+                               <&soctherm TEGRA124_SOCTHERM_SENSOR_MEM>;
+                       trips {
+                               mem-shutdown-trip {
+                                       temperature = <103000>;
+                                       hysteresis = <0>;
+                                       type = "critical";
+                               };
+                       };
+                       cooling-maps {
+                               /*
+                                * There are currently no cooling maps,
+                                * because there are no cooling devices.
+                                */
+                       };
+               };
+               gpu {
+                       polling-delay-passive = <1000>;
+                       polling-delay = <0>;
+                       thermal-sensors =
+                               <&soctherm TEGRA124_SOCTHERM_SENSOR_GPU>;
+                       trips {
+                               gpu-shutdown-trip {
+                                       temperature = <103000>;
+                                       hysteresis = <0>;
+                                       type = "critical";
+                               };
+                               gpu_throttle_trip: throttle-trip {
+                                       temperature = <100000>;
+                                       hysteresis = <1000>;
+                                       type = "hot";
+                               };
+                       };
+                       cooling-maps {
+                               map0 {
+                                       trip = <&gpu_throttle_trip>;
+                                       cooling-device = <&throttle_heavy 1 1>;
+                               };
+                       };
+               };
+               pllx {
+                       polling-delay-passive = <0>;
+                       polling-delay = <0>;
+                       thermal-sensors =
+                               <&soctherm TEGRA124_SOCTHERM_SENSOR_PLLX>;
+                       trips {
+                               pllx-shutdown-trip {
+                                       temperature = <103000>;
+                                       hysteresis = <0>;
+                                       type = "critical";
+                               };
+                       };
+                       cooling-maps {
+                               /*
+                                * There are currently no cooling maps,
+                                * because there are no cooling devices.
+                                */
+                       };
+               };
+       };
  };
@@@ -31,6 -31,8 +31,8 @@@
  #include <linux/spinlock.h>
  #include <linux/thermal.h>
  
+ #include "thermal_hwmon.h"
  #define IDLE_INTERVAL 5000
  
  #define COMMON_STR    0x00
@@@ -75,6 -77,8 +77,8 @@@ struct rcar_thermal_priv 
  #define rcar_priv_to_dev(priv)                ((priv)->common->dev)
  #define rcar_has_irq_support(priv)    ((priv)->common->base)
  #define rcar_id_to_shift(priv)                ((priv)->id * 8)
+ #define rcar_of_data(dev)             ((unsigned long)of_device_get_match_data(dev))
+ #define rcar_use_of_thermal(dev)      (rcar_of_data(dev) == USE_OF_THERMAL)
  
  #define USE_OF_THERMAL        1
  static const struct of_device_id rcar_thermal_dt_ids[] = {
@@@ -354,7 -358,8 +358,8 @@@ static void rcar_thermal_work(struct wo
                return;
  
        if (nctemp != cctemp)
-               thermal_zone_device_update(priv->zone);
+               thermal_zone_device_update(priv->zone,
+                                          THERMAL_EVENT_UNSPECIFIED);
  }
  
  static u32 rcar_thermal_had_changed(struct rcar_thermal_priv *priv, u32 status)
@@@ -415,7 -420,10 +420,10 @@@ static int rcar_thermal_remove(struct p
  
        rcar_thermal_for_each_priv(priv, common) {
                rcar_thermal_irq_disable(priv);
-               thermal_zone_device_unregister(priv->zone);
+               if (rcar_use_of_thermal(dev))
+                       thermal_remove_hwmon_sysfs(priv->zone);
+               else
+                       thermal_zone_device_unregister(priv->zone);
        }
  
        pm_runtime_put(dev);
@@@ -430,7 -438,6 +438,6 @@@ static int rcar_thermal_probe(struct pl
        struct rcar_thermal_priv *priv;
        struct device *dev = &pdev->dev;
        struct resource *res, *irq;
-       unsigned long of_data = (unsigned long)of_device_get_match_data(dev);
        int mres = 0;
        int i;
        int ret = -ENODEV;
                if (ret < 0)
                        goto error_unregister;
  
-               if (of_data == USE_OF_THERMAL)
+               if (rcar_use_of_thermal(dev))
                        priv->zone = devm_thermal_zone_of_sensor_register(
                                                dev, i, priv,
                                                &rcar_thermal_zone_of_ops);
                if (IS_ERR(priv->zone)) {
                        dev_err(dev, "can't register thermal zone\n");
                        ret = PTR_ERR(priv->zone);
 +                      priv->zone = NULL;
                        goto error_unregister;
                }
  
+               if (rcar_use_of_thermal(dev)) {
+                       /*
+                        * thermal_zone doesn't enable hwmon as default,
+                        * but, enable it here to keep compatible
+                        */
+                       priv->zone->tzp->no_hwmon = false;
+                       ret = thermal_add_hwmon_sysfs(priv->zone);
+                       if (ret)
+                               goto error_unregister;
+               }
                rcar_thermal_irq_enable(priv);
  
                list_move_tail(&priv->list, &common->head);