Merge tag 'thermal-v5.7-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/thermal...
authorLinus Torvalds <torvalds@linux-foundation.org>
Wed, 8 Apr 2020 03:00:16 +0000 (20:00 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 8 Apr 2020 03:00:16 +0000 (20:00 -0700)
Pull thermal updates from Daniel Lezcano:

 - Convert tsens configuration DT binding to yaml (Rajeshwari)

 - Add interrupt support on the rcar sensor (Niklas Söderlund)

 - Add a new Spreadtrum thermal driver (Baolin Wang)

 - Add thermal binding for the fsl scu board, a new API to retrieve the
   sensor id bound to the thermal zone and i.MX system controller sensor
   (Anson Huang))

 - Remove warning log when a deferred probe is requested on Exynos
   (Marek Szyprowski)

 - Add the thermal monitoring unit support for imx8mm with its DT
   bindings (Anson Huang)

 - Rephrase the Kconfig text for clarity (Linus Walleij)

 - Use the gpio descriptor for the ti-soc-thermal (Linus Walleij)

 - Align msg structure to 4 bytes for i.MX SC, fix the Kconfig
   dependency, add the __may_be unused annotation for PM functions and
   the COMPILE_TEST option for imx8mm (Anson Huang)

 - Fix a dependency on regmap in Kconfig for qoriq (Yuantian Tang)

 - Add DT binding and support for the rcar gen3 r8a77961 and improve the
   error path on the rcar init function (Niklas Söderlund)

 - Cleanup and improvements for the tsens Qcom sensor (Amit Kucheria)

 - Improve code by removing lock and caching values in the rcar thermal
   sensor (Niklas Söderlund)

 - Cleanup in the qoriq drivers and add a call to
   imx_thermal_unregister_legacy_cooling in the removal function (Anson
   Huang)

 - Remove redundant 'maxItems' in tsens and sprd DT bindings (Rob
   Herring)

 - Change the thermal DT bindings by making the cooling-maps optional
   (Yuantian Tang)

 - Add Tiger Lake support (Sumeet Pawnikar)

 - Use scnprintf() for avoiding potential buffer overflow (Takashi Iwai)

 - Make pkg_temp_lock a raw_spinlock_t(Clark Williams)

 - Fix incorrect data types by changing them to signed on i.MX SC (Anson
   Huang)

 - Replace zero-length array with flexible-array member (Gustavo A. R.
   Silva)

 - Add support for i.MX8MP in the driver and in the DT bindings (Anson
   Huang)

 - Fix return value of the cpufreq_set_cur_state() function (Willy
   Wolff)

 - Remove abusing and scary WARN_ON in the cpufreq cooling device
   (Daniel Lezcano)

 - Fix build warning of incorrect argument type reported by sparse on
   imx8mm (Anson Huang)

 - Fix stub for the devfreq cooling device (Martin Blumenstingl)

 - Fix cpu idle cooling documentation (Sergey Vidishev)

* tag 'thermal-v5.7-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/thermal/linux: (52 commits)
  Documentation: cpu-idle-cooling: Fix diagram for 33% duty cycle
  thermal: devfreq_cooling: inline all stubs for CONFIG_DEVFREQ_THERMAL=n
  thermal: imx8mm: Fix build warning of incorrect argument type
  thermal/drivers/cpufreq_cooling: Remove abusing WARN_ON
  thermal/drivers/cpufreq_cooling: Fix return of cpufreq_set_cur_state
  thermal: imx8mm: Add i.MX8MP support
  dt-bindings: thermal: imx8mm-thermal: Add support for i.MX8MP
  thermal: qcom: tsens.h: Replace zero-length array with flexible-array member
  thermal: imx_sc_thermal: Fix incorrect data type
  thermal: int340x_thermal: Use scnprintf() for avoiding potential buffer overflow
  thermal: int340x: processor_thermal: Add Tiger Lake support
  thermal/x86_pkg_temp: Make pkg_temp_lock a raw_spinlock_t
  dt-bindings: thermal: make cooling-maps property optional
  dt-bindings: thermal: qcom-tsens: Remove redundant 'maxItems'
  dt-bindings: thermal: sprd: Remove redundant 'maxItems'
  thermal: imx: Calling imx_thermal_unregister_legacy_cooling() in .remove
  thermal: qoriq: Sort includes alphabetically
  thermal: qoriq: Use devm_add_action_or_reset() to handle all cleanups
  thermal: rcar_thermal: Remove lock in rcar_thermal_get_current_temp()
  thermal: rcar_thermal: Do not store ctemp in rcar_thermal_priv
  ...

1  2 
Documentation/devicetree/bindings/arm/freescale/fsl,scu.txt
Documentation/devicetree/bindings/thermal/qcom-tsens.yaml
drivers/thermal/cpufreq_cooling.c
drivers/thermal/intel/int340x_thermal/int3400_thermal.c

@@@ -164,8 -164,19 +164,19 @@@ Required properties
  - compatible: should be:
                "fsl,imx8qxp-sc-key"
                followed by "fsl,imx-sc-key";
 -- linux,keycodes: See Documentation/devicetree/bindings/input/keys.txt
 +- linux,keycodes: See Documentation/devicetree/bindings/input/input.yaml
  
+ Thermal bindings based on SCU Message Protocol
+ ------------------------------------------------------------
+ Required properties:
+ - compatible:                 Should be :
+                                 "fsl,imx8qxp-sc-thermal"
+                               followed by "fsl,imx-sc-thermal";
+ - #thermal-sensor-cells:      See Documentation/devicetree/bindings/thermal/thermal.txt
+                               for a description.
  Example (imx8qxp):
  -------------
  aliases {
@@@ -238,6 -249,11 +249,11 @@@ firmware 
                        compatible = "fsl,imx8qxp-sc-wdt", "fsl,imx-sc-wdt";
                        timeout-sec = <60>;
                };
+               tsens: thermal-sensor {
+                       compatible = "fsl,imx8qxp-sc-thermal", "fsl,imx-sc-thermal";
+                       #thermal-sensor-cells = <1>;
+               };
        };
  };
  
@@@ -38,39 -38,28 +38,39 @@@ properties
            - enum:
                - qcom,msm8996-tsens
                - qcom,msm8998-tsens
+               - qcom,sc7180-tsens
                - qcom,sdm845-tsens
            - const: qcom,tsens-v2
  
    reg:
-     maxItems: 2
      items:
        - description: TM registers
        - description: SROT registers
  
 +  interrupts:
 +    minItems: 1
 +    items:
 +      - description: Combined interrupt if upper or lower threshold crossed
 +      - description: Interrupt if critical threshold crossed
 +
 +  interrupt-names:
 +    minItems: 1
 +    items:
 +      - const: uplow
 +      - const: critical
 +
    nvmem-cells:
      minItems: 1
      maxItems: 2
      description:
        Reference to an nvmem node for the calibration data
  
 -  nvmem-cells-names:
 +  nvmem-cell-names:
      minItems: 1
      maxItems: 2
      items:
 -      - enum:
 -        - caldata
 -        - calsel
 +      - const: calib
 +      - const: calib_sel
  
    "#qcom,sensors":
      allOf:
@@@ -101,16 -90,22 +101,16 @@@ allOf
      then:
        properties:
          interrupts:
 -          items:
 -            - description: Combined interrupt if upper or lower threshold crossed
 +          maxItems: 1
          interrupt-names:
 -          items:
 -            - const: uplow
 +          maxItems: 1
  
      else:
        properties:
          interrupts:
 -          items:
 -            - description: Combined interrupt if upper or lower threshold crossed
 -            - description: Interrupt if critical threshold crossed
 +          minItems: 2
          interrupt-names:
 -          items:
 -            - const: uplow
 -            - const: critical
 +          minItems: 2
  
  required:
    - compatible
    - interrupt-names
    - "#thermal-sensor-cells"
  
 +additionalProperties: false
 +
  examples:
    - |
      #include <dt-bindings/interrupt-controller/arm-gic.h>
                   <0x4a8000 0x1000>; /* SROT */
  
             nvmem-cells = <&tsens_caldata>, <&tsens_calsel>;
 -           nvmem-cell-names = "caldata", "calsel";
 +           nvmem-cell-names = "calib", "calib_sel";
  
             interrupts = <GIC_SPI 184 IRQ_TYPE_LEVEL_HIGH>;
             interrupt-names = "uplow";
@@@ -273,7 -273,7 +273,7 @@@ static int cpufreq_state2power(struct t
        struct cpufreq_cooling_device *cpufreq_cdev = cdev->devdata;
  
        /* Request state should be less than max_level */
-       if (WARN_ON(state > cpufreq_cdev->max_level))
+       if (state > cpufreq_cdev->max_level)
                return -EINVAL;
  
        num_cpus = cpumask_weight(cpufreq_cdev->policy->cpus);
@@@ -431,13 -431,10 +431,13 @@@ static int cpufreq_set_cur_state(struc
                                 unsigned long state)
  {
        struct cpufreq_cooling_device *cpufreq_cdev = cdev->devdata;
 +      struct cpumask *cpus;
 +      unsigned int frequency;
 +      unsigned long max_capacity, capacity;
        int ret;
  
        /* Request state should be less than max_level */
-       if (WARN_ON(state > cpufreq_cdev->max_level))
+       if (state > cpufreq_cdev->max_level)
                return -EINVAL;
  
        /* Check if the old cooling action is same as new cooling action */
  
        cpufreq_cdev->cpufreq_state = state;
  
 -      ret = freq_qos_update_request(&cpufreq_cdev->qos_req,
 -                                    get_state_freq(cpufreq_cdev, state));
 -      return ret < 0 ? ret : 0;
 +      frequency = get_state_freq(cpufreq_cdev, state);
 +
 +      ret = freq_qos_update_request(&cpufreq_cdev->qos_req, frequency);
 +
 +      if (ret > 0) {
 +              cpus = cpufreq_cdev->policy->cpus;
 +              max_capacity = arch_scale_cpu_capacity(cpumask_first(cpus));
 +              capacity = frequency * max_capacity;
 +              capacity /= cpufreq_cdev->policy->cpuinfo.max_freq;
 +              arch_set_thermal_pressure(cpus, max_capacity - capacity);
++              ret = 0;
 +      }
 +
 +      return ret;
  }
  
  /* Bind cpufreq callbacks to thermal cooling device ops */
@@@ -65,7 -65,7 +65,7 @@@ static ssize_t available_uuids_show(str
        for (i = 0; i < INT3400_THERMAL_MAXIMUM_UUID; i++) {
                if (priv->uuid_bitmap & (1 << i))
                        if (PAGE_SIZE - length > 0)
-                               length += snprintf(&buf[length],
+                               length += scnprintf(&buf[length],
                                                   PAGE_SIZE - length,
                                                   "%s\n",
                                                   int3400_thermal_uuids[i]);
@@@ -369,8 -369,8 +369,8 @@@ static int int3400_thermal_remove(struc
  }
  
  static const struct acpi_device_id int3400_thermal_match[] = {
 -      {"INT1040", 0},
        {"INT3400", 0},
 +      {"INTC1040", 0},
        {}
  };