1. 03 8月, 2015 1 次提交
  2. 12 5月, 2015 1 次提交
    • E
      thermal: support slope and offset coefficients · 9d0be7f4
      Eduardo Valentin 提交于
      It is common to have a linear extrapolation from
      the current sensor readings and the actual temperature
      value. This is specially the case when the sensor
      is in use to extrapolate hotspots.
      
      This patch adds slope and offset constants for
      single sensor linear extrapolation equation. Because
      the same sensor can be use in different locations,
      from board to board, these constants are added
      as part of thermal_zone_params.
      
      The constants are available through sysfs.
      
      It is up to the device driver to determine
      the usage of these values.
      Signed-off-by: NEduardo Valentin <edubezval@gmail.com>
      9d0be7f4
  3. 05 5月, 2015 7 次提交
    • J
      thermal: export thermal_zone_parameters to sysfs · 9f38271c
      Javi Merino 提交于
      It's useful for tuning to be able to edit thermal_zone_parameters from
      userspace.  Export them to the thermal_zone sysfs so that they can be
      easily changed.
      
      Cc: Zhang Rui <rui.zhang@intel.com>
      Cc: Eduardo Valentin <edubezval@gmail.com>
      Signed-off-by: NJavi Merino <javi.merino@arm.com>
      Signed-off-by: NEduardo Valentin <edubezval@gmail.com>
      9f38271c
    • P
      thermal: core: Add Kconfig option to enable writable trips · 35e94644
      Punit Agrawal 提交于
      Add a Kconfig option to allow system integrators to control whether
      userspace tools can change trip temperatures. This option overrides
      the thermal zone setup in the driver code and must be enabled for
      platform specified writable trips to come into effect.
      
      The original behaviour of requiring root privileges to change trip
      temperatures remains unchanged.
      
      Cc: Eduardo Valentin <edubezval@gmail.com>
      Cc: Zhang Rui <rui.zhang@intel.com>
      Signed-off-by: NPunit Agrawal <punit.agrawal@arm.com>
      Signed-off-by: NEduardo Valentin <edubezval@gmail.com>
      35e94644
    • J
      thermal: introduce the Power Allocator governor · 6b775e87
      Javi Merino 提交于
      The power allocator governor is a thermal governor that controls system
      and device power allocation to control temperature.  Conceptually, the
      implementation divides the sustainable power of a thermal zone among
      all the heat sources in that zone.
      
      This governor relies on "power actors", entities that represent heat
      sources.  They can report current and maximum power consumption and
      can set a given maximum power consumption, usually via a cooling
      device.
      
      The governor uses a Proportional Integral Derivative (PID) controller
      driven by the temperature of the thermal zone.  The output of the
      controller is a power budget that is then allocated to each power
      actor that can have bearing on the temperature we are trying to
      control.  It decides how much power to give each cooling device based
      on the performance they are requesting.  The PID controller ensures
      that the total power budget does not exceed the control temperature.
      
      Cc: Zhang Rui <rui.zhang@intel.com>
      Cc: Eduardo Valentin <edubezval@gmail.com>
      Signed-off-by: NPunit Agrawal <punit.agrawal@arm.com>
      Signed-off-by: NJavi Merino <javi.merino@arm.com>
      Signed-off-by: NEduardo Valentin <edubezval@gmail.com>
      6b775e87
    • J
      thermal: extend the cooling device API to include power information · 35b11d2e
      Javi Merino 提交于
      Add three optional callbacks to the cooling device interface to allow
      them to express power.  In addition to the callbacks, add helpers to
      identify cooling devices that implement the power cooling device API.
      
      Cc: Zhang Rui <rui.zhang@intel.com>
      Cc: Eduardo Valentin <edubezval@gmail.com>
      Signed-off-by: NJavi Merino <javi.merino@arm.com>
      Signed-off-by: NEduardo Valentin <edubezval@gmail.com>
      35b11d2e
    • J
      thermal: let governors have private data for each thermal zone · e33df1d2
      Javi Merino 提交于
      A governor may need to store its current state between calls to
      throttle().  That state depends on the thermal zone, so store it as
      private data in struct thermal_zone_device.
      
      The governors may have two new ops: bind_to_tz() and unbind_from_tz().
      When provided, these functions let governors do some initialization
      and teardown when they are bound/unbound to a tz and possibly store that
      information in the governor_data field of the struct
      thermal_zone_device.
      
      Cc: Zhang Rui <rui.zhang@intel.com>
      Cc: Eduardo Valentin <edubezval@gmail.com>
      Signed-off-by: NJavi Merino <javi.merino@arm.com>
      Signed-off-by: NEduardo Valentin <edubezval@gmail.com>
      e33df1d2
    • J
      thermal: export weight to sysfs · db916513
      Javi Merino 提交于
      It's useful to have access to the weights for the cooling devices for
      thermal zones and change them if needed.  Export them to sysfs.
      
      Cc: Zhang Rui <rui.zhang@intel.com>
      Cc: Eduardo Valentin <edubezval@gmail.com>
      Signed-off-by: NJavi Merino <javi.merino@arm.com>
      Signed-off-by: NEduardo Valentin <edubezval@gmail.com>
      db916513
    • K
      thermal: of: fix cooling device weights in device tree · 6cd9e9f6
      Kapileshwar Singh 提交于
      Currently you can specify the weight of the cooling device in the device
      tree but that information is not populated to the
      thermal_bind_params where the fair share governor expects it to
      be.  The of thermal zone device doesn't have a thermal_bind_params
      structure and arguably it's better to pass the weight inside the
      thermal_instance as it is specific to the bind of a cooling device to a
      thermal zone parameter.
      
      Core thermal code is fixed to populate the weight in the instance from
      the thermal_bind_params, so platform code that was passing the weight
      inside the thermal_bind_params continue to work seamlessly.
      
      While we are at it, create a default value for the weight parameter for
      those thermal zones that currently don't define it and remove the
      hardcoded default in of-thermal.
      
      Cc: Zhang Rui <rui.zhang@intel.com>
      Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
      Cc: Len Brown <lenb@kernel.org>
      Cc: Peter Feuerer <peter@piie.net>
      Cc: Darren Hart <dvhart@infradead.org>
      Cc: Eduardo Valentin <edubezval@gmail.com>
      Cc: Kukjin Kim <kgene@kernel.org>
      Cc: Durgadoss R <durgadoss.r@intel.com>
      Signed-off-by: NKapileshwar Singh <kapileshwar.singh@arm.com>
      Signed-off-by: NEduardo Valentin <edubezval@gmail.com>
      6cd9e9f6
  4. 08 4月, 2015 1 次提交
  5. 05 3月, 2015 1 次提交
  6. 18 1月, 2015 1 次提交
    • J
      netlink: make nlmsg_end() and genlmsg_end() void · 053c095a
      Johannes Berg 提交于
      Contrary to common expectations for an "int" return, these functions
      return only a positive value -- if used correctly they cannot even
      return 0 because the message header will necessarily be in the skb.
      
      This makes the very common pattern of
      
        if (genlmsg_end(...) < 0) { ... }
      
      be a whole bunch of dead code. Many places also simply do
      
        return nlmsg_end(...);
      
      and the caller is expected to deal with it.
      
      This also commonly (at least for me) causes errors, because it is very
      common to write
      
        if (my_function(...))
          /* error condition */
      
      and if my_function() does "return nlmsg_end()" this is of course wrong.
      
      Additionally, there's not a single place in the kernel that actually
      needs the message length returned, and if anyone needs it later then
      it'll be very easy to just use skb->len there.
      
      Remove this, and make the functions void. This removes a bunch of dead
      code as described above. The patch adds lines because I did
      
      -	return nlmsg_end(...);
      +	nlmsg_end(...);
      +	return 0;
      
      I could have preserved all the function's return values by returning
      skb->len, but instead I've audited all the places calling the affected
      functions and found that none cared. A few places actually compared
      the return value with <= 0 in dump functionality, but that could just
      be changed to < 0 with no change in behaviour, so I opted for the more
      efficient version.
      
      One instance of the error I've made numerous times now is also present
      in net/phonet/pn_netlink.c in the route_dumpit() function - it didn't
      check for <0 or <=0 and thus broke out of the loop every single time.
      I've preserved this since it will (I think) have caused the messages to
      userspace to be formatted differently with just a single message for
      every SKB returned to userspace. It's possible that this isn't needed
      for the tools that actually use this, but I don't even know what they
      are so couldn't test that changing this behaviour would be acceptable.
      Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      053c095a
  7. 09 12月, 2014 1 次提交
  8. 08 12月, 2014 3 次提交
  9. 04 11月, 2014 1 次提交
  10. 14 10月, 2014 1 次提交
  11. 27 8月, 2014 1 次提交
    • P
      thermal: Added Bang-bang thermal governor · e4dbf98f
      Peter Feuerer 提交于
      The bang-bang thermal governor uses a hysteresis to switch abruptly on
      or off a cooling device.  It is intended to control fans, which can
      not be throttled but just switched on or off.
      Bang-bang cannot be set as default governor as it is intended for
      special devices only.  For those special devices the driver needs to
      explicitely request it.
      
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Zhang Rui <rui.zhang@intel.com>
      Cc: Andreas Mohr <andi@lisas.de>
      Cc: Borislav Petkov <bp@suse.de>
      Cc: Javi Merino <javi.merino@arm.com>
      Cc: linux-pm@vger.kernel.org
      Signed-off-by: NPeter Feuerer <peter@piie.net>
      Signed-off-by: NZhang Rui <rui.zhang@intel.com>
      e4dbf98f
  12. 29 7月, 2014 3 次提交
  13. 03 3月, 2014 2 次提交
    • Z
      Thermal: thermal zone governor fix · f2234bcd
      Zhang Rui 提交于
      This patch does a cleanup about the thermal zone govenor,
      setting and make the following rule.
      1. For thermal zone devices that are registered w/o tz->tzp,
         they can use the default thermal governor only.
      2. For thermal zone devices w/ governor name specified in
         tz->tzp->governor_name, we will use the default govenor
         if the governor specified is not available at the moment,
         and update tz->governor when the matched governor is registered.
      
      This also fixes a problem that OF registered thermal zones
      are running with no governor.
      Signed-off-by: NZhang Rui <rui.zhang@intel.com>
      Acked-by: NJavi Merino <javi.merino@arm.com>
      f2234bcd
    • N
      Thermal: Allow first update of cooling device state · 5ca0cce5
      Ni Wade 提交于
      In initialization, if the cooling device is initialized at
      max cooling state, and the thermal zone temperature is below
      the first trip point, then the cooling state can't be updated
      to the right state, untill the first trip point be triggered.
      
      To fix this issue, allow first update of cooling device state
      during registration, initialized "updated" device field as
      "false" (instead of "true").
      Signed-off-by: NWei Ni <wni@nvidia.com>
      Signed-off-by: NZhang Rui <rui.zhang@intel.com>
      5ca0cce5
  14. 03 1月, 2014 1 次提交
  15. 02 1月, 2014 1 次提交
    • A
      thermal: debug: add debug statement for core and step_wise · 06475b55
      Aaron Lu 提交于
      To ease debugging thermal problem, add these dynamic debug statements
      so that user do not need rebuild kernel to see these info.
      
      Based on a patch from Zhang Rui for debugging on bugzilla:
      https://bugzilla.kernel.org/attachment.cgi?id=98671
      
      A sample output after we turn on dynamic debug with the following cmd:
      # echo 'module thermal_sys +fp' > /sys/kernel/debug/dynamic_debug/control
      is like:
      
      [  355.147627] update_temperature: thermal thermal_zone0: last_temperature=52000, current_temperature=55000
      [  355.147636] thermal_zone_trip_update: thermal thermal_zone0: Trip1[type=1,temp=79000]:trend=2,throttle=0
      [  355.147644] get_target_state: thermal cooling_device8: cur_state=0
      [  355.147647] thermal_zone_trip_update: thermal cooling_device8: old_target=-1, target=-1
      [  355.147652] get_target_state: thermal cooling_device7: cur_state=0
      [  355.147655] thermal_zone_trip_update: thermal cooling_device7: old_target=-1, target=-1
      [  355.147660] get_target_state: thermal cooling_device6: cur_state=0
      [  355.147663] thermal_zone_trip_update: thermal cooling_device6: old_target=-1, target=-1
      [  355.147668] get_target_state: thermal cooling_device5: cur_state=0
      [  355.147671] thermal_zone_trip_update: thermal cooling_device5: old_target=-1, target=-1
      [  355.147678] thermal_zone_trip_update: thermal thermal_zone0: Trip2[type=0,temp=90000]:trend=1,throttle=0
      [  355.147776] get_target_state: thermal cooling_device0: cur_state=0
      [  355.147783] thermal_zone_trip_update: thermal cooling_device0: old_target=-1, target=-1
      [  355.147792] thermal_zone_trip_update: thermal thermal_zone0: Trip3[type=0,temp=80000]:trend=1,throttle=0
      [  355.147845] get_target_state: thermal cooling_device1: cur_state=0
      [  355.147849] thermal_zone_trip_update: thermal cooling_device1: old_target=-1, target=-1
      [  355.147856] thermal_zone_trip_update: thermal thermal_zone0: Trip4[type=0,temp=70000]:trend=1,throttle=0
      [  355.147904] get_target_state: thermal cooling_device2: cur_state=0
      [  355.147908] thermal_zone_trip_update: thermal cooling_device2: old_target=-1, target=-1
      [  355.147915] thermal_zone_trip_update: thermal thermal_zone0: Trip5[type=0,temp=60000]:trend=1,throttle=0
      [  355.147963] get_target_state: thermal cooling_device3: cur_state=0
      [  355.147967] thermal_zone_trip_update: thermal cooling_device3: old_target=-1, target=-1
      [  355.147973] thermal_zone_trip_update: thermal thermal_zone0: Trip6[type=0,temp=55000]:trend=1,throttle=1
      [  355.148022] get_target_state: thermal cooling_device4: cur_state=0
      [  355.148025] thermal_zone_trip_update: thermal cooling_device4: old_target=-1, target=1
      [  355.148036] thermal_cdev_update: thermal cooling_device4: zone0->target=1
      [  355.169279] thermal_cdev_update: thermal cooling_device4: set to state 1
      Signed-off-by: NAaron Lu <aaron.lu@intel.com>
      Acked-by: NEduardo Valentin <eduardo.valentin@ti.com>
      Signed-off-by: NZhang Rui <rui.zhang@intel.com>
      06475b55
  16. 04 12月, 2013 3 次提交
    • E
      thermal: core: introduce thermal_of_cooling_device_register · a116b5d4
      Eduardo Valentin 提交于
      This patch adds a new API to allow registering cooling devices
      in the thermal framework derived from device tree nodes.
      
      This API links the cooling device with the device tree node
      so that binding with thermal zones is possible, given
      that thermal zones are pointing to cooling device
      device tree nodes.
      
      Cc: Zhang Rui <rui.zhang@intel.com>
      Cc: linux-pm@vger.kernel.org
      Cc: linux-kernel@vger.kernel.org
      Signed-off-by: NEduardo Valentin <eduardo.valentin@ti.com>
      a116b5d4
    • E
      thermal: introduce device tree parser · 4e5e4705
      Eduardo Valentin 提交于
      This patch introduces a device tree bindings for
      describing the hardware thermal behavior and limits.
      Also a parser to read and interpret the data and feed
      it in the thermal framework is presented.
      
      This patch introduces a thermal data parser for device
      tree. The parsed data is used to build thermal zones
      and thermal binding parameters. The output data
      can then be used to deploy thermal policies.
      
      This patch adds also documentation regarding this
      API and how to define tree nodes to use
      this infrastructure.
      
      Note that, in order to be able to have control
      on the sensor registration on the DT thermal zone,
      it was required to allow changing the thermal zone
      .get_temp callback. For this reason, this patch
      also removes the 'const' modifier from the .ops
      field of thermal zone devices.
      
      Cc: Zhang Rui <rui.zhang@intel.com>
      Cc: linux-pm@vger.kernel.org
      Cc: linux-kernel@vger.kernel.org
      Acked-by: NMark Rutland <mark.rutland@arm.com>
      Signed-off-by: NEduardo Valentin <eduardo.valentin@ti.com>
      4e5e4705
    • E
      thermal: allow registering without .get_temp · 81bd4e1c
      Eduardo Valentin 提交于
      This patch changes the thermal core driver to allow
      registration of thermal zones without the .get_temp callback.
      
      The idea behind this change is to allow lazy registration
      of sensor callbacks.
      
      The thermal zone will be disabled whenever the ops
      does not contain a .get_temp callback. The sysfs interface
      will be returning -EINVAL on any temperature read operation.
      
      Cc: Zhang Rui <rui.zhang@intel.com>
      Cc: linux-pm@vger.kernel.org
      Cc: linux-kernel@vger.kernel.org
      Signed-off-by: NEduardo Valentin <eduardo.valentin@ti.com>
      81bd4e1c
  17. 20 11月, 2013 2 次提交
  18. 06 11月, 2013 1 次提交
  19. 14 10月, 2013 1 次提交
    • D
      Thermal: Check for validity before doing kfree · 732e4c8d
      durgadoss.r@intel.com 提交于
      The thermal_release function is called whenever
      any device belonging to 'thermal' class unregisters.
      This function performs kfree(cdev) without any check.
      In cases where there are more device registrations
      other than just 'thermal_zone' and 'cooling_device'
      this might accidently free memory allocated them
      silently; and cause memory errors.
      
      This patch changes this behavior by doing
      kfree(cdev) only when the device pointer belongs
      to a real cdev i.e. cooling_device.
      Signed-off-by: NDurgadoss R <durgadoss.r@intel.com>
      Signed-off-by: NZhang Rui <rui.zhang@intel.com>
      732e4c8d
  20. 03 9月, 2013 3 次提交
    • E
      thermal: thermal_core: allow binding with limits on bind_params · a8892d83
      Eduardo Valentin 提交于
      When registering a thermal zone device using platform information
      via bind_params, the thermal framework will always perform the
      cdev binding using the lowest and highest limits (THERMAL_NO_LIMIT).
      
      This patch changes the data structures so that it is possible
      to inform what are the desired limits for each trip point
      inside a bind_param. The way the binding is performed is also
      changed so that it uses the new data structure.
      
      Cc: Zhang Rui <rui.zhang@intel.com>
      Cc: linux-pm@vger.kernel.org
      Cc: linux-kernel@vger.kernel.org
      Signed-off-by: NEduardo Valentin <eduardo.valentin@ti.com>
      a8892d83
    • E
      drivers: thermal: make usage of CONFIG_THERMAL_HWMON optional · ccba4ffd
      Eduardo Valentin 提交于
      When registering a new thermal_device, the thermal framework
      will always add a hwmon sysfs interface.
      
      This patch adds a flag to make this behavior optional. Now
      when registering a new thermal device, the caller can
      optionally inform if hwmon interface is desirable. This can
      be done by means of passing a thermal_zone_params.no_hwmon == true.
      
      In order to keep same behavior as of today, all current
      calls will by default create the hwmon interface.
      
      Cc: David Woodhouse <dwmw2@infradead.org>
      Cc: linux-acpi@vger.kernel.org
      Cc: linux-arm-kernel@lists.infradead.org
      Cc: linux-kernel@vger.kernel.org
      Cc: linux-pm@vger.kernel.org
      Cc: Zhang Rui <rui.zhang@intel.com>
      Suggested-by: NWei Ni <wni@nvidia.com>
      Signed-off-by: NEduardo Valentin <eduardo.valentin@ti.com>
      ccba4ffd
    • E
      thermal: hwmon: move hwmon support to single file · 0dd88793
      Eduardo Valentin 提交于
      In order to improve code organization, this patch
      moves the hwmon sysfs support to a file named
      thermal_hwmon. This helps to add extra support
      for hwmon without scrambling the code.
      
      In order to do this move, the hwmon list head is now
      using its own locking. Before, the list used
      the global thermal locking. Also, some minor changes
      in the code were required, as recommended by checkpatch.pl.
      
      Cc: Zhang Rui <rui.zhang@intel.com>
      Cc: linux-pm@vger.kernel.org
      Cc: linux-kernel@vger.kernel.org
      Acked-by: NDurgadoss R <durgadoss.r@intel.com>
      Signed-off-by: NEduardo Valentin <eduardo.valentin@ti.com>
      0dd88793
  21. 13 6月, 2013 1 次提交
    • E
      thermal: consider emul_temperature while computing trend · 0c872507
      Eduardo Valentin 提交于
      In case emulated temperature is in use, using the trend
      provided by driver layer can lead to bogus situation.
      In this case, debugger user would set a temperature value,
      but the trend would be from driver computation.
      
      To avoid this situation, this patch changes the get_tz_trend()
      to consider the emulated temperature whenever that is in use.
      
      Cc: Zhang Rui <rui.zhang@intel.com>
      Cc: Amit Daniel Kachhap <amit.daniel@samsung.com>
      Cc: Durgadoss R <durgadoss.r@intel.com>
      Cc: linux-pm@vger.kernel.org
      Cc: linux-kernel@vger.kernel.org
      Signed-off-by: NEduardo Valentin <eduardo.valentin@ti.com>
      Signed-off-by: NZhang Rui <rui.zhang@intel.com>
      0c872507
  22. 28 5月, 2013 2 次提交
  23. 27 4月, 2013 1 次提交
    • E
      thermal: thermal_core: remove usage of IS_ERR_OR_NULL · 9b19ec39
      Eduardo Valentin 提交于
      This patch changes the driver to avoid the usage of IS_ERR_OR_NULL()
      macro. This macro can lead to dangerous results, like returning
      success (0) during a failure scenario (NULL pointer handling).
      
      The case present in this patch has simply be translated to
      normal check for NULL and if the pointer has an error code.
      The later case is needed because functions like
      thermal_zone_get_zone_by_name() could return an ERR_PTR().
      
      Cc: Zhang Rui <rui.zhang@intel.com>
      Cc: Russell King <rmk@arm.linux.org.uk>
      Cc: linux-pm@vger.kernel.org
      Cc: linux-kernel@vger.kernel.org
      Signed-off-by: NEduardo Valentin <eduardo.valentin@ti.com>
      Signed-off-by: NZhang Rui <rui.zhang@intel.com>
      9b19ec39