12 Nov, 2020

1 commit

  • It has been observed that on OMAP4430 (ES2.0, ES2.1 and ES2.3) the enabled
    notifier causes errors on the DTEMP readout values:

    ti-soc-thermal 4a002260.bandgap: in range ADC val: 52
    ti-soc-thermal 4a002260.bandgap: in range ADC val: 64
    ti-soc-thermal 4a002260.bandgap: in range ADC val: 64
    ti-soc-thermal 4a002260.bandgap: out of range ADC val: 0
    thermal thermal_zone0: failed to read out thermal zone (-5)
    ti-soc-thermal 4a002260.bandgap: out of range ADC val: 0
    thermal thermal_zone0: failed to read out thermal zone (-5)
    ti-soc-thermal 4a002260.bandgap: out of range ADC val: 4
    thermal thermal_zone0: failed to read out thermal zone (-5)
    ti-soc-thermal 4a002260.bandgap: in range ADC val: 100

    raw 100 translates to 133 Celsius on omap4-sdp, triggering shutdown due to
    critical temperature.

    When the notifier is disable for OMAP4430 the DTEMP values are stable:
    ti-soc-thermal 4a002260.bandgap: in range ADC val: 56
    ti-soc-thermal 4a002260.bandgap: in range ADC val: 56
    ti-soc-thermal 4a002260.bandgap: in range ADC val: 57
    ti-soc-thermal 4a002260.bandgap: in range ADC val: 57
    ti-soc-thermal 4a002260.bandgap: in range ADC val: 56

    Fixes: 5093402e5b44 ("thermal: ti-soc-thermal: Enable addition power management")
    Signed-off-by: Peter Ujfalusi
    Tested-by: Tony Lindgren
    Acked-by: Keerthy
    Signed-off-by: Daniel Lezcano
    Link: https://lore.kernel.org/r/20201029100335.27665-1-peter.ujfalusi@ti.com

    Peter Ujfalusi
     

12 Oct, 2020

1 commit

  • The bandgap sensor can be idled when the processor is too, but it
    isn't currently being done, so the power consumption of OMAP3
    boards can elevated if the bangap sensor is enabled.

    This patch attempts to use some additional power management
    to idle the clock to the bandgap when not needed.

    Signed-off-by: Adam Ford
    Reported-by: kernel test robot
    Tested-by: Andreas Kemnade # GTA04
    Signed-off-by: Daniel Lezcano
    Link: https://lore.kernel.org/r/20200911123157.759379-1-aford173@gmail.com

    Adam Ford
     

04 Sep, 2020

1 commit

  • We can sometimes get bogus thermal shutdowns on omap4430 at least with
    droid4 running idle with a battery charger connected:

    thermal thermal_zone0: critical temperature reached (143 C), shutting down

    Dumping out the register values shows we can occasionally get a 0x7f value
    that is outside the TRM listed values in the ADC conversion table. And then
    we get a normal value when reading again after that. Reading the register
    multiple times does not seem help avoiding the bogus values as they stay
    until the next sample is ready.

    Looking at the TRM chapter "18.4.10.2.3 ADC Codes Versus Temperature", we
    should have values from 13 to 107 listed with a total of 95 values. But
    looking at the omap4430_adc_to_temp array, the values are off, and the
    end values are missing. And it seems that the 4430 ADC table is similar
    to omap3630 rather than omap4460.

    Let's fix the issue by using values based on the omap3630 table and just
    ignoring invalid values. Compared to the 4430 TRM, the omap3630 table has
    the missing values added while the TRM table only shows every second
    value.

    Note that sometimes the ADC register values within the valid table can
    also be way off for about 1 out of 10 values. But it seems that those
    just show about 25 C too low values rather than too high values. So those
    do not cause a bogus thermal shutdown.

    Fixes: 1a31270e54d7 ("staging: omap-thermal: add OMAP4 data structures")
    Cc: Merlijn Wajer
    Cc: Pavel Machek
    Cc: Sebastian Reichel
    Signed-off-by: Tony Lindgren
    Signed-off-by: Daniel Lezcano
    Link: https://lore.kernel.org/r/20200706183338.25622-1-tony@atomide.com

    Tony Lindgren
     

21 Jul, 2020

1 commit


29 Apr, 2020

1 commit

  • On error the function ti_bandgap_get_sensor_data() returns the error
    code in ERR_PTR() but we only checked if the return value is NULL or
    not. And, so we can dereference an error code inside ERR_PTR.
    While at it, convert a check to IS_ERR_OR_NULL.

    Signed-off-by: Sudip Mukherjee
    Reviewed-by: Amit Kucheria
    Signed-off-by: Daniel Lezcano
    Link: https://lore.kernel.org/r/20200424161944.6044-1-sudipm.mukherjee@gmail.com

    Sudip Mukherjee
     

14 Apr, 2020

1 commit

  • The function “platform_get_irq” can log an error already.
    Thus omit redundant messages for the exception handling in the
    calling functions.

    This issue was detected by using the Coccinelle software.

    Signed-off-by: Markus Elfring
    Reviewed-by: Amit Kucheria
    Reviewed-by: Keerthy
    Signed-off-by: Daniel Lezcano
    Link: https://lore.kernel.org/r/05f49ae7-5cc7-d6a0-fc3d-abaf2a0b373c@web.de

    Markus Elfring
     

12 Mar, 2020

1 commit

  • This switches the TI SoC thermal driver to use GPIO
    descriptors instead of retrieveing a GPIO number from the
    device tree and requesting the GPIO separately.

    Cc: Keerthy
    Signed-off-by: Linus Walleij
    Signed-off-by: Daniel Lezcano
    Link: https://lore.kernel.org/r/20200229210532.173430-1-linus.walleij@linaro.org

    Linus Walleij
     

05 Jun, 2019

2 commits

  • Based on 1 normalized pattern(s):

    this program is free software you can redistribute it and or modify
    it under the terms of the gnu general public license version 2 as
    published by the free software foundation this program is
    distributed in the hope that it will be useful but without any
    warranty without even the implied warranty of merchantability or
    fitness for a particular purpose see the gnu general public license
    for more details you should have received a copy of the gnu general
    public license along with this program if not write to the free
    software foundation inc 51 franklin st fifth floor boston ma 02110
    1301 usa

    extracted by the scancode license scanner the SPDX license identifier

    GPL-2.0-only

    has been chosen to replace the boilerplate/reference in 246 file(s).

    Signed-off-by: Thomas Gleixner
    Reviewed-by: Alexios Zavras
    Reviewed-by: Allison Randal
    Cc: linux-spdx@vger.kernel.org
    Link: https://lkml.kernel.org/r/20190530000436.674189849@linutronix.de
    Signed-off-by: Greg Kroah-Hartman

    Thomas Gleixner
     
  • Based on 1 normalized pattern(s):

    this software is licensed under the terms of the gnu general public
    license version 2 as published by the free software foundation and
    may be copied distributed and modified under those terms this
    program is distributed in the hope that it will be useful but
    without any warranty without even the implied warranty of
    merchantability or fitness for a particular purpose see the gnu
    general public license for more details

    extracted by the scancode license scanner the SPDX license identifier

    GPL-2.0-only

    has been chosen to replace the boilerplate/reference in 285 file(s).

    Signed-off-by: Thomas Gleixner
    Reviewed-by: Alexios Zavras
    Reviewed-by: Allison Randal
    Cc: linux-spdx@vger.kernel.org
    Link: https://lkml.kernel.org/r/20190529141900.642774971@linutronix.de
    Signed-off-by: Greg Kroah-Hartman

    Thomas Gleixner
     

21 May, 2019

1 commit


28 Jul, 2018

1 commit

  • Majority of this code (i.e. functions from ti-bandgap.c) has been
    introduced in May 2013 by commit eb982001dbd8 ("thermal: introduce TI
    SoC thermal driver"). Just remove it altogether (in case it is needed
    it can be easily resurrected from git repo).

    While at it fix incorrect "not used" comments.

    Tested-by: Keerthy
    Acked-by: Keerthy
    Signed-off-by: Bartlomiej Zolnierkiewicz
    Signed-off-by: Eduardo Valentin

    Bartlomiej Zolnierkiewicz
     

02 Jun, 2018

1 commit


18 Nov, 2017

1 commit

  • Pull thermal management updates from Zhang Rui:

    - introduce brcmstb AVS TMON thermal driver (Brian Norris)

    - add Rockchip RV1108 support in rockchip thermal driver (Rocky Hao)

    - major rework on HISI driver plus additional support of hisi3660
    (Daniel Lezcano)

    - add nvmem-cells binding on imx6sx (Leonard Crestez)

    - fix a NULL pointer dereference on ti thermal driver unloading (Tony
    Lindgren)

    - improve tmon tool to make it easier to cross-compile tmon (Markus
    Mayer)

    - add Coffee Lake and Cannon Lake support for intel processor and pch
    thermal drivers (Srinivas Pandruvada)

    - other small fixes and cleanups (Arvind Yadav, Colin Ian King, Allen
    Wild, Nicolin Chen, Baruch SiachNiklas Söderlund, Arnd Bergmann)

    * 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux: (44 commits)
    thermal: pch: Add Cannon Lake support
    thermal: int340x: processor_thermal: Add Coffee Lake support
    thermal: int340x: processor_thermal: Add Cannon Lake support
    thermal: bxt: remove redundant variable trip
    thermal: cpu_cooling: pr_err() strings should end with newlines
    thermal: add brcmstb AVS TMON driver
    Documentation: devicetree: add binding for Broadcom STB AVS TMON
    thermal/drivers/hisi: Add support for hi3660 SoC
    thermal/drivers/hisi: Prepare to add support for other hisi platforms
    thermal/drivers/hisi: Add platform prefix to function name
    thermal/drivers/hisi: Put platform code together
    thermal/drivers/qcom-spmi: Use devm_iio_channel_get
    thermal/drivers/generic-iio-adc: Switch tz request to devm version
    thermal/drivers/step_wise: Fix temperature regulation misbehavior
    thermal/drivers/hisi: Use round up step value
    thermal/drivers/hisi: Move the clk setup in the corresponding functions
    thermal/drivers/hisi: Remove mutex_lock in the code
    thermal/drivers/hisi: Remove thermal data back pointer
    thermal/drivers/hisi: Convert long to int
    thermal/drivers/hisi: Rename and remove unused field
    ...

    Linus Torvalds
     

02 Nov, 2017

1 commit

  • Many source files in the tree are missing licensing information, which
    makes it harder for compliance tools to determine the correct license.

    By default all files without license information are under the default
    license of the kernel, which is GPL version 2.

    Update the files which contain no license information with the 'GPL-2.0'
    SPDX license identifier. The SPDX identifier is a legally binding
    shorthand, which can be used instead of the full boiler plate text.

    This patch is based on work done by Thomas Gleixner and Kate Stewart and
    Philippe Ombredanne.

    How this work was done:

    Patches were generated and checked against linux-4.14-rc6 for a subset of
    the use cases:
    - file had no licensing information it it.
    - file was a */uapi/* one with no licensing information in it,
    - file was a */uapi/* one with existing licensing information,

    Further patches will be generated in subsequent months to fix up cases
    where non-standard license headers were used, and references to license
    had to be inferred by heuristics based on keywords.

    The analysis to determine which SPDX License Identifier to be applied to
    a file was done in a spreadsheet of side by side results from of the
    output of two independent scanners (ScanCode & Windriver) producing SPDX
    tag:value files created by Philippe Ombredanne. Philippe prepared the
    base worksheet, and did an initial spot review of a few 1000 files.

    The 4.13 kernel was the starting point of the analysis with 60,537 files
    assessed. Kate Stewart did a file by file comparison of the scanner
    results in the spreadsheet to determine which SPDX license identifier(s)
    to be applied to the file. She confirmed any determination that was not
    immediately clear with lawyers working with the Linux Foundation.

    Criteria used to select files for SPDX license identifier tagging was:
    - Files considered eligible had to be source code files.
    - Make and config files were included as candidates if they contained >5
    lines of source
    - File already had some variant of a license header in it (even if
    Reviewed-by: Philippe Ombredanne
    Reviewed-by: Thomas Gleixner
    Signed-off-by: Greg Kroah-Hartman

    Greg Kroah-Hartman
     

01 Nov, 2017

1 commit

  • While debugging some PM issues and trying to remove all the loaded modules, I ran
    across the following when unloading ti-soc-thermal:

    Unable to handle kernel NULL pointer dereference at virtual address 000000b4
    ...
    [] (kobject_put) from [] (ti_thermal_unregister_cpu_cooling+0x20/0x28 [ti_soc_thermal])
    [] (ti_thermal_unregister_cpu_cooling [ti_soc_thermal]) from [] (ti_bandgap_remove+0x3c/0x104 [ti_soc_thermal])
    [] (ti_bandgap_remove [ti_soc_thermal]) from [] (platform_drv_remove+0x24/0x3c)
    [] (platform_drv_remove) from [] (device_release_driver_internal+0x160/0x208)
    [] (device_release_driver_internal) from [] (driver_detach+0x38/0x6c)
    [] (driver_detach) from [] (bus_remove_driver+0x4c/0xa0)
    [] (bus_remove_driver) from [] (SyS_delete_module+0x168/0x238)
    [] (SyS_delete_module) from [] (ret_fast_syscall+0x0/0x28)

    Cc: Keerthy
    Signed-off-by: Tony Lindgren
    Signed-off-by: Eduardo Valentin

    Tony Lindgren
     

05 Jul, 2017

1 commit


28 May, 2017

1 commit

  • The CPU cooling driver uses the cpufreq policy, to get clip_cpus, the
    frequency table, etc. Most of the callers of CPU cooling driver's
    registration routines have the cpufreq policy with them, but they only
    pass the policy->related_cpus cpumask. The __cpufreq_cooling_register()
    routine then gets the policy by itself and uses it.

    It would be much better if the callers can pass the policy instead
    directly. This also fixes a basic design flaw, where the policy can be
    freed while the CPU cooling driver is still active.

    Signed-off-by: Viresh Kumar
    Reviewed-by: Lukasz Luba
    Tested-by: Lukasz Luba
    Signed-off-by: Eduardo Valentin

    Viresh Kumar
     

24 May, 2017

3 commits


30 Mar, 2017

3 commits


19 Feb, 2017

3 commits

  • No configuration needs to be done for TSHUT from software.
    Hence remove all the unnecessary definitions.

    Signed-off-by: Keerthy
    Signed-off-by: Eduardo Valentin

    Keerthy
     
  • Technical Reference Manual [1] mandates that software should
    not be configuring the thermal shutdown thresholds. Hence
    removing TSHUT_CONFIG.

    [1] http://www.ti.com/lit/ug/sprui30b/sprui30b.pdf

    Signed-off-by: Keerthy
    Reported-by: Ravikumar Kattekola
    Signed-off-by: Eduardo Valentin

    Keerthy
     
  • Currently when CPU_THERMAL is not defined the thermal sensors
    are not even exposed consequently no cooling is possible. CPU_THERMAL
    eventually depends on CPUFREQ. CPPUFREQ is not the only cooling
    for CPU.

    The thermal shutdown for critical temperatures is another
    cooling solution which will currently not get enabled if CPU_THERMAL
    is not defined. Remove this dependency so as to have the last level
    of thermal protection working even without CPUFREQ defined.

    Signed-off-by: Keerthy
    Signed-off-by: Eduardo Valentin

    Keerthy
     

23 Nov, 2016

1 commit


27 Sep, 2016

2 commits

  • Added one additional parameter to thermal_zone_device_update() to provide
    caller with an optional capability to specify reason.
    Currently this event is used by user space governor to trigger different
    processing based on event code. Also it saves an additional call to read
    temperature when the event is received.
    The following events are cuurently defined:
    - Unspecified event
    - New temperature sample
    - Trip point violated
    - Trip point changed
    - thermal device up and down
    - thermal device power capability changed

    Signed-off-by: Srinivas Pandruvada
    Signed-off-by: Zhang Rui

    Srinivas Pandruvada
     
  • The .get_trend callback in struct thermal_zone_device_ops has
    the prototype:
    int (*get_trend) (struct thermal_zone_device *, int,
    enum thermal_trend *);
    whereas the .get_trend callback in struct thermal_zone_of_device_ops
    has:
    int (*get_trend)(void *, long *);

    Streamline both prototypes and add the trip argument to the OF callback
    aswell and use enum thermal_trend * instead of an integer pointer.

    While the OF prototype may be the better one, this should be decided at
    framework level and not on OF level.

    Signed-off-by: Sascha Hauer
    Signed-off-by: Caesar Wang
    Cc: Zhang Rui
    Cc: Eduardo Valentin
    Cc: linux-pm@vger.kernel.org
    Reviewed-by: Keerthy
    Signed-off-by: Eduardo Valentin
    Signed-off-by: Zhang Rui

    Sascha Hauer
     

17 May, 2016

1 commit


09 Mar, 2016

1 commit


30 Sep, 2015

2 commits


14 Sep, 2015

2 commits


03 Aug, 2015

1 commit

  • The thermal code uses int, long and unsigned long for temperatures
    in different places.

    Using an unsigned type limits the thermal framework to positive
    temperatures without need. Also several drivers currently will report
    temperatures near UINT_MAX for temperatures below 0°C. This will probably
    immediately shut the machine down due to overtemperature if started below
    0°C.

    'long' is 64bit on several architectures. This is not needed since INT_MAX °mC
    is above the melting point of all known materials.

    Consistently use a plain 'int' for temperatures throughout the thermal code and
    the drivers. This only changes the places in the drivers where the temperature
    is passed around as pointer, when drivers internally use another type this is
    not changed.

    Signed-off-by: Sascha Hauer
    Acked-by: Geert Uytterhoeven
    Reviewed-by: Jean Delvare
    Reviewed-by: Lukasz Majewski
    Reviewed-by: Darren Hart
    Reviewed-by: Heiko Stuebner
    Reviewed-by: Peter Feuerer
    Cc: Punit Agrawal
    Cc: Zhang Rui
    Cc: Eduardo Valentin
    Cc: linux-pm@vger.kernel.org
    Cc: linux-kernel@vger.kernel.org
    Cc: Jean Delvare
    Cc: Peter Feuerer
    Cc: Heiko Stuebner
    Cc: Lukasz Majewski
    Cc: Stephen Warren
    Cc: Thierry Reding
    Cc: linux-acpi@vger.kernel.org
    Cc: platform-driver-x86@vger.kernel.org
    Cc: linux-arm-kernel@lists.infradead.org
    Cc: linux-omap@vger.kernel.org
    Cc: linux-samsung-soc@vger.kernel.org
    Cc: Guenter Roeck
    Cc: Rafael J. Wysocki
    Cc: Maxime Ripard
    Cc: Darren Hart
    Cc: lm-sensors@lm-sensors.org
    Signed-off-by: Zhang Rui

    Sascha Hauer
     

26 Jun, 2015

1 commit

  • Pull thermal management updates from Zhang Rui:
    "Specifics:

    - enhance Thermal Framework with several new capabilities:

    * use power estimates
    * compute weights with relative integers instead of percentages
    * allow governors to have private data in thermal zones
    * export thermal zone parameters through sysfs

    Thanks to the ARM thermal team (Javi, Punit, KP).

    - introduce a new thermal governor: power allocator. First in kernel
    closed loop PI(D) controller for thermal control. Thanks to ARM
    thermal team.

    - enhance OF thermal to allow thermal zones to have sustainable power
    HW specification. Thanks to Punit.

    - introduce thermal driver for Intel Quark SoC x1000platform. Thanks
    to Ong, Boon Leong.

    - introduce QPNP PMIC temperature alarm driver. Thanks to Ivan T. I.

    - introduce thermal driver for Hisilicon hi6220. Thanks to
    kongxinwei.

    - enhance Exynos thermal driver to handle Exynos5433 TMU. Thanks to
    Chanwoo C.

    - TI thermal driver now has a better implementation for EOCZ bit.
    From Pavel M.

    - add id for Skylake processors in int340x processor thermal driver.

    - a couple of small fixes and cleanups."

    * 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux: (36 commits)
    thermal: hisilicon: add new hisilicon thermal sensor driver
    dt-bindings: Document the hi6220 thermal sensor bindings
    thermal: of-thermal: add support for reading coefficients property
    thermal: support slope and offset coefficients
    thermal: power_allocator: round the division when divvying up power
    thermal: exynos: Add the support for Exynos5433 TMU
    thermal: cpu_cooling: Fix power calculation when CPUs are offline
    thermal: cpu_cooling: Remove cpu_dev update on policy CPU update
    thermal: export thermal_zone_parameters to sysfs
    thermal: cpu_cooling: Check memory allocation of power_table
    ti-soc-thermal: request temperature periodically if hw can't do that itself
    ti-soc-thermal: implement eocz bit to make driver useful on omap3
    cleanup ti-soc-thermal
    thermal: remove stale THERMAL_POWER_ACTOR select
    thermal: Default OF created trip points to writable
    thermal: core: Add Kconfig option to enable writable trips
    thermal: x86_pkg_temp: drop const for thermal_zone_parameters
    of: thermal: Introduce sustainable power for a thermal zone
    thermal: add trace events to the power allocator governor
    thermal: introduce the Power Allocator governor
    ...

    Linus Torvalds
     

09 May, 2015

2 commits

  • DESCRIPTION

    Spurious Thermal Alert: Talert can happen randomly while the device remains
    under the temperature limit defined for this event to trig. This spurious
    event is caused by a incorrect re-synchronization between clock domains.
    The comparison between configured threshold and current temperature value
    can happen while the value is transitioning (metastable), thus causing
    inappropriate event generation. No spurious event occurs as long as the
    threshold value stays unchanged. Spurious event can be generated while a
    thermal alert threshold is modified in
    CONTROL_BANDGAP_THRESHOLD_MPU/GPU/CORE/DSPEVE/IVA_n.

    WORKAROUND

    Spurious event generation can be avoided by performing following sequence
    when the threshold is modified:
    1. Mask the hot/cold events at the thermal IP level.
    2. Modify Threshold.
    3. Unmask the hot/cold events at the thermal IP level.

    Signed-off-by: Keerthy
    Signed-off-by: Eduardo Valentin

    Keerthy
     
  • Bandgap Temperature read Dtemp can be corrupted

    DESCRIPTION
    Read accesses to registers listed below can be corrupted due to
    incorrect resynchronization between clock domains.

    Read access to registers below can be corrupted :
    • CTRL_CORE_DTEMP_MPU/GPU/CORE/DSPEVE/IVA_n (n = 0 to 4)
    • CTRL_CORE_TEMP_SENSOR_MPU/GPU/CORE/DSPEVE/IVA_n

    WORKAROUND
    Multiple reads to CTRL_CORE_TEMP_SENSOR_MPU/GPU/CORE/DSPEVE/IVA[9:0]:
    BGAP_DTEMPMPU/GPU/CORE/DSPEVE/IVA is needed to discard false value and
    read right value:
    1. Perform two successive reads to BGAP_DTEMP bit field.
    (a) If read1 returns Val1 and read2 returns Val1, then
    right value is Val1.
    (b) If read1 returns Val1, read 2 returns Val2, a third
    read is needed.
    2. Perform third read
    (a) If read3 returns Val2 then right value is Val2.
    (b) If read3 returns Val3, then right value is Val3.

    The above in gist means if val1 and val2 are the same then we can go
    ahead with that value else we need a third read which will be right
    since synchronization will be complete by then.

    Signed-off-by: Keerthy
    Signed-off-by: Eduardo Valentin

    Keerthy
     

05 May, 2015

1 commit