27 May, 2016

1 commit

  • Pull thermal management updates from Zhang Rui:

    - Introduce generic ADC thermal driver, based on OF thermal (Laxman
    Dewangan)

    - Introduce new thermal driver for Tango chips (Marc Gonzalez)

    - Rockchip driver support for RK3399, RK3366, and some fixes (Caesar
    Wang, Elaine Zhang and Shawn Lin)

    - Add CPU power cooling model to Mediatek thermal driver (Dawei Chien)

    - Wider usage of dev_thermal_zone_of_sensor_register (Eduardo Valentin)

    - TI thermal driver gained a new maintainer (Keerthy).

    - Enabled powerclamp driver by checking CPU feature and package cstate
    counter instead of CPU whitelist (Jacob Pan)

    - Various fixes on thermal governor, OF thermal, Tegra, and RCAR

    * 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux: (50 commits)
    thermal: tango: initialize TEMPSI_CFG
    thermal: rockchip: use the usleep_range instead of udelay
    thermal: rockchip: add the notes for better reading
    thermal: rockchip: Support RK3366 SoCs in the thermal driver
    thermal: rockchip: handle the power sequence for tsadc controller
    thermal: rockchip: update the tsadc table for rk3399
    thermal: rockchip: fixes the code_to_temp for tsadc driver
    thermal: rockchip: disable thermal->clk in err case
    thermal: tegra: add Tegra132 specific SOC_THERM driver
    thermal: fix ptr_ret.cocci warnings
    thermal: mediatek: Add cpu dynamic power cooling model.
    thermal: generic-adc: Add ADC based thermal sensor driver
    thermal: generic-adc: Add DT binding for ADC based thermal sensor
    thermal: tegra: fix static checker warning
    thermal: tegra: mark PM functions __maybe_unused
    thermal: add temperature sensor support for tango SoC
    thermal: hisilicon: fix IRQ imbalance enabling
    thermal: hisilicon: support to use any sensor
    thermal: rcar: Remove binding docs for r8a7794
    thermal: tegra: add PM support
    ...

    Linus Torvalds
     

18 May, 2016

1 commit


17 May, 2016

36 commits

  • TEMPSI_CFG is not equal to 0 at reset. It must be initialized.

    Signed-off-by: Marc Gonzalez
    Signed-off-by: Eduardo Valentin

    Marc Gonzalez
     
  • Documentation/timers/timers-howto.txt recommends to use
    usleep_range on delays > 10usec.
    The usleep_range indeed reduces CPU load, since the udelay will busy wait
    for enough loop cycles to achieve the desired delay.

    Fixes commit b06c52db39fd ("thermal: rockchip:
    handle the power sequence for tsadc controller").

    Cc: Zhang Rui
    Cc: Eduardo Valentin
    Cc: Heiko Stuebner
    Suggested-by: Eduardo Valentin
    Signed-off-by: Caesar Wang
    Signed-off-by: Eduardo Valentin

    Caesar Wang
     
  • To update the notes for keeping in mind that quickly in case
    someone re-read this driver in the future.

    Signed-off-by: Caesar Wang
    Cc: Zhang Rui
    Cc: Eduardo Valentin
    Cc: Heiko Stuebner
    Signed-off-by: Eduardo Valentin

    Caesar Wang
     
  • The RK3366 SoCs have two Temperature Sensors, channel 0 is for CPU
    channel 1 is for GPU.

    Signed-off-by: Elaine Zhang
    Signed-off-by: Caesar Wang
    Signed-off-by: Eduardo Valentin

    Elaine Zhang
     
  • This adds the grf property to handle the tsadc power sequence on
    rockchip some SoCs.

    Verified on rk3399 can work with this patch on now.

    while true; do grep "" /sys/class/thermal/thermal_zone[0-1]/temp
    sleep .5; done
    /sys/class/thermal/thermal_zone0/temp:40555
    /sys/class/thermal/thermal_zone1/temp:41111
    /sys/class/thermal/thermal_zone0/temp:40555
    /sys/class/thermal/thermal_zone1/temp:41111
    /sys/class/thermal/thermal_zone0/temp:40555
    /sys/class/thermal/thermal_zone1/temp:41666
    /sys/class/thermal/thermal_zone0/temp:40555
    /sys/class/thermal/thermal_zone1/temp:41111
    /sys/class/thermal/thermal_zone0/temp:40555
    /sys/class/thermal/thermal_zone1/temp:41111
    /sys/class/thermal/thermal_zone0/temp:40555

    Signed-off-by: Caesar Wang
    Cc: Zhang Rui
    Cc: Eduardo Valentin
    Cc: Heiko Stuebner
    Signed-off-by: Eduardo Valentin

    Caesar Wang
     
  • This patch fixes the incorrect conversion table.
    The Code to Temperature mapping is updated based on sillcon results.

    Fixes commit b0d70338bca22cb14
    ("thermal: rockchip: Support the RK3399 SoCs in thermal driver").

    Signed-off-by: Caesar Wang
    Cc: Zhang Rui
    Cc: Eduardo Valentin
    Cc: Heiko Stuebner
    Signed-off-by: Eduardo Valentin

    Caesar Wang
     
  • We should judge the table.id[mid].code insearch algorithm on matter the
    adc value increment or decrement.

    Or otherwise, the temperature return the incorrect value in some cases.
    [ 1.438589] adc_val=402,temp=-40000
    [ 1.438903] adc_val=403,temp=-39375
    [ 1.439217] adc_val=404,temp=-38750
    ...
    [ 1.441102] adc_val=410,temp=-40000
    [ 1.441416] adc_val=411,temp=-34445
    [ 1.441737] adc_val=412,temp=-33889
    ...

    Let's fix it right now.

    Fixes commit 020ba95dbbbe ("thermal: rockchip:
    Add the sort mode for adc value increment or decrement").

    Reported-by: Rocky Hao
    Signed-off-by: Caesar Wang
    Cc: Zhang Rui
    Cc: Eduardo Valentin
    Cc: Heiko Stuebner
    Signed-off-by: Eduardo Valentin

    Caesar Wang
     
  • Disable thermal->clk when enabling pclk fails in
    resume routine.

    Signed-off-by: Shawn Lin
    Reviewed-by: Heiko Stuebner
    Reviewed-by: Caesar Wang
    Signed-off-by: Caesar Wang
    Signed-off-by: Eduardo Valentin

    Shawn Lin
     
  • add Tegra132 specific SOC_THERM driver.

    Signed-off-by: Wei Ni
    Signed-off-by: Eduardo Valentin

    Wei Ni
     
  • drivers/thermal/tango_thermal.c:86:1-3: WARNING: PTR_ERR_OR_ZERO can be used

    Use PTR_ERR_OR_ZERO rather than if(IS_ERR(...)) + PTR_ERR

    Generated by: scripts/coccinelle/api/ptr_ret.cocci

    CC: Marc Gonzalez
    Signed-off-by: Fengguang Wu
    Signed-off-by: Eduardo Valentin

    kbuild test robot
     
  • In some of platform, thermal sensors like NCT thermistors are
    connected to the one of ADC channel. The temperature is read by
    reading the voltage across the sensor resistance via ADC. Lookup
    table for ADC read value to temperature is referred to get
    temperature. ADC is read via IIO framework.

    Add support for thermal sensor driver which read the voltage across
    sensor resistance from ADC through IIO framework.

    Acked-by: Jonathan Cameron
    Signed-off-by: Laxman Dewangan
    Signed-off-by: Eduardo Valentin

    Laxman Dewangan
     
  • There has a static checker warning:
    warn: variable dereferenced before check 'dev' (see line 222)

    Since check 'dev' is unnecessary, so remove this check.

    Fixes: ee6d79f202a4 ("thermal: tegra: add thermtrip function")
    Signed-off-by: Wei Ni
    Reported-by: Dan Carpenter
    Signed-off-by: Eduardo Valentin

    Wei Ni
     
  • After the PM support has been added to this driver, we get
    a harmless warning when that support is disabled at compile
    time:

    drivers/thermal/tegra/soctherm.c:641:12: error: 'soctherm_resume' defined but not used [-Werror=unused-function]
    static int soctherm_resume(struct device *dev)

    This marks the two PM functions as __maybe_unused to shut up
    the warning. This is preferred over adding an #ifdef around
    them, as it is harder to get wrong, and provides better
    compile-time coverage.

    Signed-off-by: Arnd Bergmann
    Fixes: a134b4143b65 ("thermal: tegra: add PM support")
    Signed-off-by: Eduardo Valentin

    Arnd Bergmann
     
  • The Tango thermal driver provides support for the primitive temperature
    sensor embedded in Tango chips since the SMP8758.

    This sensor only generates a 1-bit signal to indicate whether the die
    temperature exceeds a programmable threshold.

    Signed-off-by: Marc Gonzalez
    Signed-off-by: Eduardo Valentin

    Marc Gonzalez
     
  • When register sensors into thermal zone during initialization phase, it
    reports error for IRQ imbalance enabling:

    [ 2.040713] WARNING: at kernel/irq/manage.c:513
    [ 2.040719] Modules linked in:
    [ 2.040721]
    [ 2.040729] CPU: 1 PID: 804 Comm: irq/33-hisi_the Not tainted 4.5.0-rc4+ #505
    [ 2.040732] Hardware name: HiKey Development Board (DT)
    [ 2.040736] task: ffffffc03ae82580 ti: ffffffc0379c8000 task.ti: ffffffc0379c8000
    [ 2.040745] PC is at __enable_irq+0x74/0x84
    [ 2.040749] LR is at __enable_irq+0x74/0x84

    This warning is for IRQ imbalance enabling, which is caused by
    enable_irq() twice. During sensor's initialization it tries to enable
    IRQ, the driver will call thermal_zone_of_sensor_register() to bind
    sensors and read sensor's temperature. But at this moment the flag
    "data->irq_enabled" has been not initialized as correct state, so it
    finally introduces the function enabled_irq() to be called twice. In
    essentially this is caused by the flag "data->irq_enabled" is
    inconsistent with real hardware IRQ enabling state.

    So this patch is to fix this issue, firstly init "irq_enabled" flag
    before binding sensors to thermal zone. Also change to use the function
    irq_get_irqchip_state() to read back real interrupt line state.

    Signed-off-by: Leo Yan
    Signed-off-by: Eduardo Valentin

    Leo Yan
     
  • In current code sensor driver registers all 4 sensors together and if
    any of them has not bound to thermal zone successfully then driver will
    return failure for driver's initialization. As a result, if DT binds
    thermal zone with only one sensor, then the thermal driver will not work
    well anymore.

    So this patch is to fix this issue. It allows the thermal sensor driver
    can register any number sensors at initialization phase, and fix up code
    for other related code to skip related sensor's accessing if the sensor
    has not been enabled in initialization phase.

    Signed-off-by: Leo Yan
    Signed-off-by: Eduardo Valentin

    Leo Yan
     
  • Add suspend/resume function in soctherm driver.

    Signed-off-by: Wei Ni
    Signed-off-by: Eduardo Valentin

    Wei Ni
     
  • Handle HW initialization in one function soctherm_init(),
    so that the codes are more clear.

    Signed-off-by: Wei Ni
    Signed-off-by: Eduardo Valentin

    Wei Ni
     
  • Handle clock enable/disable codes in one function
    soctherm_clk_enable(), so that the codes are more clear.

    Signed-off-by: Wei Ni
    Signed-off-by: Eduardo Valentin

    Wei Ni
     
  • Add support for hardware critical thermal limits to the
    SOC_THERM driver. It use the Linux thermal framework to
    create critical trip temp, and set it to SOC_THERM hardware.
    If these limits are breached, the chip will reset, and if
    appropriately configured, will turn off the PMIC.

    This support is critical for safe usage of the chip.

    Signed-off-by: Wei Ni
    Signed-off-by: Eduardo Valentin

    Wei Ni
     
  • In current of-thermal, the .set_trip_temp only support to
    set trip_temp for SW. But some sensors support to set
    trip_temp on hardware, so that can trigger interrupt,
    shutdown or any other events.
    This patch adds .set_trip_temp() callback in
    thermal_zone_of_device_ops{}, so that the sensor device can
    use it to set trip_temp on hardware.

    Signed-off-by: Wei Ni
    Signed-off-by: Eduardo Valentin

    Wei Ni
     
  • Add a debugfs interface to show register contents for debug.

    Signed-off-by: Wei Ni
    Signed-off-by: Eduardo Valentin

    Wei Ni
     
  • Add Tegra210 specific SOC_THERM driver.

    Signed-off-by: Wei Ni
    Signed-off-by: Eduardo Valentin

    Wei Ni
     
  • Split most of the Tegra124 data and code into a Tegra124-specific
    file.
    Split most of the fuse-related code into a fuse-related source file.
    This is in preparation for adding a Tegra210-specific driver in a
    future patch.

    Beyond the maintainability improvements, this is intended to separate
    chip-specific ATE and characterization-related hacks into chip-specific
    files, in the hopes that they won't pollute code for other chips.

    Signed-off-by: Wei Ni
    Signed-off-by: Eduardo Valentin

    Wei Ni
     
  • Get rid of T124-specific PDIV/HOTSPOT hack.
    tegra-soctherm.c contained a hack to set the SENSOR_PDIV and
    SENSOR_HOTSPOT_OFFSET registers - it just did two writes of
    T124-specific opaque values. Convert these into a form that can be
    substituted on a per-chip basis, and into structure fields that have
    at least some independent meaning.

    Signed-off-by: Wei Ni
    Signed-off-by: Eduardo Valentin

    Wei Ni
     
  • Combine sensor group-related data structures into struct
    tegra_tsensor_group. This provides a single location for
    sensor group data storage.
    More sensor group data will be added in subsequent patches.

    Signed-off-by: Wei Ni
    Signed-off-by: Eduardo Valentin

    Wei Ni
     
  • Move Tegra soctherm driver to tegra directory, it's easy to maintain
    and add more new function support for Tegra platforms.
    This will also help to split soctherm driver into common parts and
    chip specific data related parts.

    Signed-off-by: Wei Ni
    Signed-off-by: Eduardo Valentin

    Wei Ni
     
  • This changes the driver to use the devm_ version
    of thermal_zone_of_sensor_register and cleans
    up the local points and unregister calls.

    Cc: Zhang Rui
    Cc: linux-pm@vger.kernel.org
    Cc: linux-omap@vger.kernel.org
    Cc: linux-kernel@vger.kernel.org
    Tested-by: Keerthy
    Signed-off-by: Eduardo Valentin

    Eduardo Valentin
     
  • This changes the driver to use the devm_ version
    of thermal_zone_of_sensor_register and cleans
    up the local points and unregister calls.

    Cc: Zhang Rui
    Cc: Stephen Warren
    Cc: Thierry Reding
    Cc: Alexandre Courbot
    Cc: linux-pm@vger.kernel.org
    Cc: linux-tegra@vger.kernel.org
    Cc: linux-kernel@vger.kernel.org
    Signed-off-by: Eduardo Valentin

    Eduardo Valentin
     
  • This changes the driver to use the devm_ version
    of thermal_zone_of_sensor_register and cleans
    up the local points and unregister calls.

    Cc: Zhang Rui
    Cc: Heiko Stuebner
    Cc: linux-pm@vger.kernel.org
    Cc: linux-arm-kernel@lists.infradead.org
    Cc: linux-rockchip@lists.infradead.org
    Cc: linux-kernel@vger.kernel.org
    Tested-by: Caesar Wang
    Reviewed-by: Caesar Wang
    Reviewed-by: Heiko Stuebner
    Signed-off-by: Eduardo Valentin

    Eduardo Valentin
     
  • This changes the driver to use the devm_ version
    of thermal_zone_of_sensor_register and cleans
    up the local points and unregister calls.

    Cc: Zhang Rui
    Cc: linux-pm@vger.kernel.org
    Cc: linux-kernel@vger.kernel.org
    Signed-off-by: Eduardo Valentin

    Eduardo Valentin
     
  • This changes the driver to use the devm_ version
    of thermal_zone_of_sensor_register and cleans
    up the local points and unregister calls.

    Cc: Zhang Rui
    Cc: linux-pm@vger.kernel.org
    Cc: linux-kernel@vger.kernel.org
    Signed-off-by: Eduardo Valentin

    Eduardo Valentin
     
  • This changes the driver to use the devm_ version
    of thermal_zone_of_sensor_register and cleans
    up the local points and unregister calls.

    Cc: Zhang Rui
    Cc: Matthias Brugger
    Cc: linux-pm@vger.kernel.org
    Cc: linux-arm-kernel@lists.infradead.org
    Cc: linux-mediatek@lists.infradead.org
    Cc: linux-kernel@vger.kernel.org
    Signed-off-by: Eduardo Valentin

    Eduardo Valentin
     
  • This changes the driver to use the devm_ version
    of thermal_zone_of_sensor_register and cleans
    up the local points and unregister calls.

    Cc: Zhang Rui
    Cc: linux-pm@vger.kernel.org
    Cc: linux-kernel@vger.kernel.org
    Signed-off-by: Eduardo Valentin

    Eduardo Valentin
     
  • of_node_put is iterating through all terms in the tbps array even though
    the bind has failed. We need to only iterate through the terms that have
    already passed the binding step.

    Cc: Zhang Rui
    Cc: Eduardo Valentin
    Cc: linux-pm@vger.kernel.org
    Cc: linux-kernel@vger.kernel.org
    Signed-off-by: Ulises Brindis
    Signed-off-by: Eduardo Valentin

    Ulises Brindis
     
  • When performing a suspend operation, the kernel brings all of the
    non-boot CPUs offline, calling the hot plug notifiers with the flag,
    CPU_TASKS_FROZEN, set in the action code. Similarly, during resume,
    the CPUs are brought back online, but again the notifiers have the
    FROZEN flag set.

    While some very few drivers really need to treat suspend/resume
    specially, this driver unintentionally ignores the notifications.

    This patch changes the driver to cancel its work item when the CPU
    goes down, even during a suspend operation. As a result, the
    suspended state is no longer a special case.

    Cc: Zhang Rui
    Cc: Eduardo Valentin
    Cc: linux-pm@vger.kernel.org
    Signed-off-by: Richard Cochran
    Signed-off-by: Zhang Rui

    Richard Cochran
     

16 May, 2016

1 commit

  • Bang-bang thermal governor uses trip point hysteresis to make decisions.
    Hysteresis is a required property in the device tree for trip points, but it is
    an optional thermal zone device operation. Hence, we need to check whether the
    function pointer is valid or not.

    If it is not available, we assume the hysteresis to be zero. Consequently, a
    highly varying temperature will make the governor continuosly switch a cooling
    device ON and OFF.

    CC: Zhang Rui
    CC: Eduardo Valentin
    CC: Peter Feuerer
    Signed-off-by: Michele Di Giorgio
    Signed-off-by: Zhang Rui

    Michele Di Giorgio
     

11 May, 2016

1 commit

  • INT3406 ACPI device object resembles an ACPI video output device, but its
    _BCM is said to be deprecated and should not be used. So we will make
    use of the raw interface to do the actual cooling.

    Signed-off-by: Aaron Lu
    Acked-by: Zhang Rui
    Signed-off-by: Rafael J. Wysocki

    Aaron Lu