1. 04 Oct, 2022 1 commit
    • Daniel Lezcano's avatar
      thermal/drivers/imx_sc: Rely on the platform data to get the resource id · 31fd4b9d
      Daniel Lezcano authored
      Currently the imx_sc driver is reimplementing part of the thermal zone
      parsing from the thermal OF tree code to get the sensor id associated
      with a thermal zone sensor.
      
      The driver platform specific code should know what sensor is present
      and not rely on the thermal zone description to do a discovery. Well
      that is arguable but all the other drivers have a per platform data
      telling what sensor id to use.
      
      The imx_sc thermal driver is the only one using a different
      approach. Not invalid but forcing to keep a specific function
      'thermal_zone_of_get_sensor_id()' to get the sensor id for a specific
      thermal zone as the self-explanatory function tells and having device
      tree code inside the driver.
      
      The thermal OF code had a rework and remains now self-encapsulated
      with a register/unregister functions and their 'devm' variants, except
      for the function mentioned above.
      
      After investigating, it appears the imx_sc sensor is defined in
      arch/arm64/boot/dts/freescale/imx8qxp.dtsi:
      
      which defines the cpu-thermal zone with the id: IMX_SC_R_SYSTEM
      
      This dtsi is included by:
       - imx8qxp-ai_ml.dts
       - imx8qxp-colibri.dtsi
       - imx8qxp-mek.dts
      
      The two first ones do not define more thermal zones
      The third one adds the pmic-thermal0 zone with id: IMX_SC_R_PMIC_0
      
      The thermal OF code returns -ENODEV if the thermal zone registration
      with a specific id fails because the description is not available in
      the DT for such a sensor id. In this case we continue with the other
      ids without bailing out with an error.
      
      So we can build for the 'fsl,imx-sc-thermal' a compatible data, an
      array of sensor ids containing IMX_SC_R_SYSTEM and IMX_SC_R_PMIC_0.
      
      The latter won't be found but that will not result in an error but a
      normal case where we continue the initialization with other ids.
      
      Just to clarify, it is what the thermal framework does and what the
      other drivers are expecting: when a registration fails with -ENODEV
      this is not an error but a case where the description is not found in
      the device tree, that be can the entire thermal zones description or a
      specific thermal zone with an unknown id.
      
      There is one small functional change but without impact. When there is
      no 'thermal-zones' description the probe function was returning
      '-ENODEV', now it returns zero. When a thermal zone fails to register
      with an error different from '-ENODEV', the error is detected and
      returned.
      
      Change the code accordingly and remove the OF code from the driver.
      Signed-off-by: default avatarDaniel Lezcano <daniel.lezcano@linaro.org>
      Link: https://lore.kernel.org/r/20220818082316.2717095-1-daniel.lezcano@linaro.org
      31fd4b9d
  2. 03 Oct, 2022 2 commits
    • Rafael J. Wysocki's avatar
      Merge branches 'thermal-intel' and 'thermal-drivers' · 2e70ea7f
      Rafael J. Wysocki authored
      Merge thermal control driver changes for 6.1-rc1:
      
       - Use module_pci_driver() macro in the int340x processor_thermal
         driver (Shang XiaoJing).
      
       - Use get_cpu() instead of smp_processor_id() in the intel_powerclamp
         thermal driver to prevent it from crashing and remove unused
         accounting for IRQ wakes from it (Srinivas Pandruvada).
      
       - Consolidate priv->data_vault checks in int340x_thermal (Rafael
         Wysocki).
      
       - Check the policy first in cpufreq_cooling_register() (Xuewen Yan).
      
       - Drop redundant error message from da9062-thermal (zhaoxiao).
      
       - Drop of_match_ptr() from thermal_mmio (Jean Delvare).
      
      * thermal-intel:
        thermal: int340x: processor_thermal: Use module_pci_driver() macro
        thermal: intel_powerclamp: Remove accounting for IRQ wakes
        thermal: intel_powerclamp: Use get_cpu() instead of smp_processor_id() to avoid crash
        thermal: int340x_thermal: Consolidate priv->data_vault checks
      
      * thermal-drivers:
        thermal: cpufreq_cooling: Check the policy first in cpufreq_cooling_register()
        thermal: da9062-thermal: Drop redundant error message
        thermal/drivers/thermal_mmio: Drop of_match_ptr()
      2e70ea7f
    • Rafael J. Wysocki's avatar
      Merge branch 'thermal-core' · a7ae50fc
      Rafael J. Wysocki authored
      Merge core thermal control changes for 6.1-rc1:
      
       - Increase maximum number of trip points in the thermal core (Sumeet
         Pawnikar).
      
       - Replace strlcpy() with unused retval with strscpy() in the core
         thermal control code (Wolfram Sang).
      
       - Do not lock thermal zone mutex in the user space governor (Rafael
         Wysocki)
      
       - Rework the device tree initialization, convert the drivers to the
         new API and remove the old OF code (Daniel Lezcano)
      
       - Fix return value to -ENODEV when searching for a specific thermal
         zone which does not exist (Daniel Lezcano)
      
       - Fix the return value inspection in of_thermal_zone_find() (Dan
         Carpenter)
      
       - Fix kernel panic when KASAN is enabled as it detects use after
         free when unregistering a thermal zone (Daniel Lezcano)
      
       - Move the set_trip ops inside the therma sysfs code (Daniel Lezcano)
      
       - Remove unnecessary error message as it is already showed in the
         underlying function (Jiapeng Chong)
      
       - Rework the monitoring path and move the locks upper in the call
         stack to fix some potentials race windows (Daniel Lezcano)
      
       - Fix lockdep_assert() warning introduced by the lock rework (Daniel
         Lezcano)
      
       - Revert the Mellanox 'hotter thermal zone' feature because it is
         already handled in the thermal framework core code (Daniel Lezcano)
      
      * thermal-core: (47 commits)
        thermal: core: Increase maximum number of trip points
        thermal: move from strlcpy() with unused retval to strscpy()
        thermal: gov_user_space: Do not lock thermal zone mutex
        Revert "mlxsw: core: Add the hottest thermal zone detection"
        thermal/core: Fix lockdep_assert() warning
        thermal/core: Move the mutex inside the thermal_zone_device_update() function
        thermal/core: Move the thermal zone lock out of the governors
        thermal/governors: Group the thermal zone lock inside the throttle function
        thermal/core: Rework the monitoring a bit
        thermal/core: Rearm the monitoring only one time
        thermal/drivers/qcom/spmi-adc-tm5: Remove unnecessary print function dev_err()
        thermal/of: Remove old OF code
        thermal/core: Move set_trip_temp ops to the sysfs code
        thermal/drivers/samsung: Switch to new of thermal API
        regulator/drivers/max8976: Switch to new of thermal API
        Input: sun4i-ts - switch to new of thermal API
        iio/drivers/sun4i_gpadc: Switch to new of thermal API
        hwmon/drivers/core: Switch to new of thermal API
        hwmon: pm_bus: core: Switch to new of thermal API
        ata/drivers/ahci_imx: Switch to new of thermal API
        ...
      a7ae50fc
  3. 30 Sep, 2022 1 commit
    • Sumeet Pawnikar's avatar
      thermal: core: Increase maximum number of trip points · 82b1ec79
      Sumeet Pawnikar authored
      On one of the Chrome system, if we define more than 12 trip points,
      probe for thermal sensor fails with
      "int3403 thermal: probe of INTC1046:03 failed with error -22"
      and throws an error as
      "thermal_sys: Error: Incorrect number of thermal trips".
      
      The thermal_zone_device_register() interface needs maximum
      number of trip points supported in a zone as an argument.
      This number can't exceed THERMAL_MAX_TRIPS, which is currently
      set to 12. To address this issue, THERMAL_MAX_TRIPS value
      has to be increased.
      
      This interface also has an argument to specify a mask of trips
      which are writable. This mask is defined as an int.
      This mask sets the ceiling for increasing maximum number of
      supported trips. With the current implementation, maximum number
      of trips can be supported is 31.
      
      Also, THERMAL_MAX_TRIPS macro is used in one place only.
      So, remove THERMAL_MAX_TRIPS macro and compare num_trips
      directly with using a macro BITS_PER_TYPE(int)-1.
      Signed-off-by: default avatarSumeet Pawnikar <sumeet.r.pawnikar@intel.com>
      Reviewed-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      82b1ec79
  4. 24 Sep, 2022 1 commit
  5. 21 Sep, 2022 2 commits
  6. 03 Sep, 2022 3 commits
  7. 31 Aug, 2022 3 commits
  8. 30 Aug, 2022 2 commits
  9. 28 Aug, 2022 25 commits