13 May, 2017

1 commit

  • Pull thermal management updates from Zhang Rui:

    - Fix a problem where orderly_shutdown() is called for multiple times
    due to multiple critical overheating events raised in a short period
    by platform thermal driver. (Keerthy)

    - Introduce a backup thermal shutdown mechanism, which invokes
    kernel_power_off()/emergency_restart() directly, after
    orderly_shutdown() being issued for certain amount of time(specified
    via Kconfig). This is useful in certain conditions that userspace may
    be unable to power off the system in a clean manner and leaves the
    system in a critical state, like in the middle of driver probing
    phase. (Keerthy)

    - Introduce a new interface in thermal devfreq_cooling code so that the
    driver can provide more precise data regarding actual power to the
    thermal governor every time the power budget is calculated. (Lukasz
    Luba)

    - Introduce BCM 2835 soc thermal driver and northstar thermal driver,
    within a new sub-folder. (Rafał Miłecki)

    - Introduce DA9062/61 thermal driver. (Steve Twiss)

    - Remove non-DT booting on TI-SoC driver. Also add support to fetching
    coefficients from DT. (Keerthy)

    - Refactorf RCAR Gen3 thermal driver. (Niklas Söderlund)

    - Small fix on MTK and intel-soc-dts thermal driver. (Dawei Chien,
    Brian Bian)

    * 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux: (25 commits)
    thermal: core: Add a back up thermal shutdown mechanism
    thermal: core: Allow orderly_poweroff to be called only once
    Thermal: Intel SoC DTS: Change interrupt request behavior
    trace: thermal: add another parameter 'power' to the tracing function
    thermal: devfreq_cooling: add new interface for direct power read
    thermal: devfreq_cooling: refactor code and add get_voltage function
    thermal: mt8173: minor mtk_thermal.c cleanups
    thermal: bcm2835: move to the broadcom subdirectory
    thermal: broadcom: ns: specify myself as MODULE_AUTHOR
    thermal: da9062/61: Thermal junction temperature monitoring driver
    Documentation: devicetree: thermal: da9062/61 TJUNC temperature binding
    thermal: broadcom: add Northstar thermal driver
    dt-bindings: thermal: add support for Broadcom's Northstar thermal
    thermal: bcm2835: add thermal driver for bcm2835 SoC
    dt-bindings: Add thermal zone to bcm2835-thermal example
    thermal: rcar_gen3_thermal: add suspend and resume support
    thermal: rcar_gen3_thermal: store device match data in private structure
    thermal: rcar_gen3_thermal: enable hardware interrupts for trip points
    thermal: rcar_gen3_thermal: record and check number of TSCs found
    thermal: rcar_gen3_thermal: check that TSC exists before memory allocation
    ...

    Linus Torvalds
     

06 May, 2017

2 commits


05 May, 2017

8 commits

  • Zhang Rui
     
  • Zhang Rui
     
  • orderly_poweroff is triggered when a graceful shutdown
    of system is desired. This may be used in many critical states of the
    kernel such as when subsystems detects conditions such as critical
    temperature conditions. However, in certain conditions in system
    boot up sequences like those in the middle of driver probes being
    initiated, userspace will be unable to power off the system in a clean
    manner and leaves the system in a critical state. In cases like these,
    the /sbin/poweroff will return success (having forked off to attempt
    powering off the system. However, the system overall will fail to
    completely poweroff (since other modules will be probed) and the system
    is still functional with no userspace (since that would have shut itself
    off).

    However, there is no clean way of detecting such failure of userspace
    powering off the system. In such scenarios, it is necessary for a backup
    workqueue to be able to force a shutdown of the system when orderly
    shutdown is not successful after a configurable time period.

    Reported-by: Nishanth Menon
    Signed-off-by: Keerthy
    Acked-by: Eduardo Valentin
    Signed-off-by: Zhang Rui

    Keerthy
     
  • thermal_zone_device_check --> thermal_zone_device_update -->
    handle_thermal_trip --> handle_critical_trips --> orderly_poweroff

    The above sequence happens every 250/500 mS based on the configuration.
    The orderly_poweroff function is getting called every 250/500 mS.
    With a full fledged file system it takes at least 5-10 Seconds to
    power off gracefully.

    In that period due to the thermal_zone_device_check triggering
    periodically the thermal work queues bombard with
    orderly_poweroff calls multiple times eventually leading to
    failures in gracefully powering off the system.

    Make sure that orderly_poweroff is called only once.

    Signed-off-by: Keerthy
    Acked-by: Eduardo Valentin
    Signed-off-by: Zhang Rui

    Keerthy
     
  • The interrupt request call in Intel SoC DTS driver may fail if
    there is no underlying BIOS support. However, the user space
    thermal daemon can still use the thermal zones created by the
    SoC DTS driver in polling mode, therefore, instead of bailing
    out on interrupt request failures, it is better just to log
    a warning message and continue the init process.

    Signed-off-by: Brian Bian
    Signed-off-by: Zhang Rui

    Brian Bian
     
  • This patch adds another parameter to the trace function:
    trace_thermal_power_devfreq_get_power().

    In case when we call directly driver's code for the real power,
    we do not have static/dynamic_power values. Instead we get total
    power in the '*power' value. The 'static_power' and
    'dynamic_power' are set to 0.

    Therefore, we have to trace that '*power' value in this scenario.

    CC: Steven Rostedt
    CC: Ingo Molnar
    CC: Zhang Rui
    CC: Eduardo Valentin
    Acked-by: Javi Merino
    Signed-off-by: Lukasz Luba

    Lukasz Luba
     
  • This patch introduces a new interface for device drivers connected to
    devfreq_cooling in the thermal framework: get_real_power().

    Some devices have more sophisticated methods (like power counters)
    to approximate the actual power that they use.
    In the previous implementation we had a pre-calculated power
    table which was then scaled by 'utilization'
    ('busy_time' and 'total_time' taken from devfreq 'last_status').

    With this new interface the driver can provide more precise data
    regarding actual power to the thermal governor every time the power
    budget is calculated. We then use this value and calculate the real
    resource utilization scaling factor.

    Reviewed-by: Chris Diamand
    Acked-by: Javi Merino
    Signed-off-by: Lukasz Luba

    Lukasz Luba
     
  • Move the code which gets the voltage for a given frequency.
    This code will be resused in few places.

    Acked-by: Javi Merino
    Signed-off-by: Lukasz Luba

    Lukasz Luba
     

04 May, 2017

1 commit

  • Pull MFD updates from Lee Jones:
    "New Drivers:
    - Freescale MXS Low Resolution ADC
    - Freescale i.MX23/i.MX28 LRADC touchscreen
    - Motorola CPCAP Power Button
    - TI LMU (Lighting Management Unit)
    - Atmel SMC (Static Memory Controller)

    New Device Support:
    - Add support for X-Powers AXP803 to axp20x
    - Add support for Dialog Semi DA9061 to da9062-core
    - Add support for Intel Cougar Mountain to lpc_ich
    - Add support for Intel Gemini Lake to lpc_ich

    New Functionality:
    - Add Device Tree support; wm831x-*, axp20x, ti-lmu, da9062, sun4i-gpadc
    - Add IRQ sense support; motorola-cpcap
    - Add ACPI support; cros_ec
    - Add Reset support; altera-a10sr
    - Add ADC support; axp20x
    - Add AC Power support; axp20x
    - Add Runtime PM support; atmel-ebi, exynos-lpass
    - Add Battery Power Supply support; axp20x
    - Add Clock support; exynos-lpass, hi655x-pmic

    Fix-ups:
    - Implicitly specify required headers; motorola-cpcap, intel_soc_pmic_bxtwc
    - Add .remove() method; stm32-timers, exynos-lpass
    - Remove unused code; intel_soc_pmic_core, intel-lpss-acpi, ipaq-micro, atmel-smc, menelaus
    - Rename variables for clarity; axp20x
    - Convert pr_warning() to pr_warn(); db8500-prcmu, sta2x11-mfd, twl4030-power
    - Improve formatting; arizona-core, axp20x
    - Use raw_spinlock_*() variants; asic3, t7l66xb, tc6393xb
    - Simplify/refactor code; arizona-core, atmel-ebi
    - Improve error checking; intel_soc_pmic_core

    Bug Fixes:
    - Ensure OMAP3630/3730 boards can successfully reboot; twl4030-power
    - Correct max-register value; stm32-timers
    - Extend timeout to account for clock stretching; cros_ec_spi
    - Use correct IRQ trigger type; motorola-cpcap
    - Fix bad use of IRQ sense register; motorola-cpcap
    - Logic error "||" should be "&&"; mxs-lradc-ts"

    * tag 'mfd-next-4.12' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd: (79 commits)
    input: touchscreen: mxs-lradc: || vs && typos
    dt-bindings: Add AXP803's regulator info
    mfd: axp20x: Support AXP803 variant
    dt-bindings: Add device tree binding for X-Powers AXP803 PMIC
    dt-bindings: Make AXP20X compatible strings one per line
    mfd: intel_soc_pmic_core: Fix unchecked return value
    mfd: menelaus: Remove obsolete local_irq_disable() and local_irq_enable()
    mfd: omap-usb-tll: Configure ULPIAUTOIDLE
    mfd: omap-usb-tll: Fix inverted bit use for USB TLL mode
    mfd: palmas: Fixed spelling mistake in error message
    mfd: lpc_ich: Add support for Intel Gemini Lake SoC
    mfd: hi655x: Add the clock cell to provide WiFi and Bluetooth
    mfd: intel_soc_pmic: Fix a mess with compilation units
    mfd: exynos-lpass: Add runtime PM support
    mfd: exynos-lpass: Add missing remove() function
    mfd: exynos-lpass: Add support for clocks
    mfd: exynos-lpass: Remove pad retention control
    iio: adc: add support for X-Powers AXP20X and AXP22X PMICs ADCs
    mfd: cpcap: Fix bad use of IRQ sense register
    mfd: cpcap: Use ack_invert interrupts
    ...

    Linus Torvalds
     

27 Apr, 2017

1 commit

  • Crystal Cove and Whiskey Cove are two different PMICs which are
    installed on Intel Atom SoC based platforms.

    Moreover there are two independent drivers that by some reason were
    supposed (*) to get into one kernel module.

    Fix the mess by clarifying Kconfig option for Crystal Cove and split
    Whiskey Cove out of it.

    (*) It looks like the configuration was never tested with
    INTEL_SOC_PMIC=n. The line in Makefile is actually wrong.

    Cc: "Rafael J. Wysocki" (supporter:ACPI)
    Acked-by: Linus Walleij
    Acked-by: Zhang Rui
    Signed-off-by: Andy Shevchenko
    Signed-off-by: Lee Jones

    Andy Shevchenko
     

24 Apr, 2017

1 commit

  • If thermal bank with 4 sensors, thermal driver should read TEMP_MSR3.

    However, currently thermal driver would not read TEMP_MSR3 since mt8173
    thermal driver only use 3 sensors on each thermal bank at the same time,
    so this patch would not effect temperature.
    Only if mt mt8173 thermal driver use 4 sensors on any thermal bank, would
    read third sensor two times, and lose fourth sensor of vale.

    cc: stable@vger.kernel.org
    Fixes: b7cf0053738c ("thermal: Add Mediatek thermal driver for mt2701.")
    Reviewed-by: Matthias Brugger
    Signed-off-by: Dawei Chien
    Signed-off-by: Eduardo Valentin

    Dawei Chien
     

23 Apr, 2017

2 commits


15 Apr, 2017

1 commit


07 Apr, 2017

2 commits

  • Add junction temperature monitoring supervisor device driver, compatible
    with the DA9062 and DA9061 PMICs. A MODULE_DEVICE_TABLE() macro is added.

    If the PMIC's internal junction temperature rises above T_WARN (125 degC)
    an interrupt is issued. This T_WARN level is defined as the
    THERMAL_TRIP_HOT trip-wire inside the device driver.

    The thermal triggering mechanism is interrupt based and happens when the
    temperature rises above a given threshold level. The component cannot
    return an exact temperature, it only has knowledge if the temperature is
    above or below a given threshold value. A status bit must be polled to
    detect when the temperature falls below that threshold level again. A
    kernel work queue is configured to repeatedly poll and detect when the
    temperature falls below this trip-wire, between 1 and 10 second intervals
    (defaulting at 3 seconds).

    This scheme is provided as an example. It would be expected that any
    final implementation will also include a notify() function and any of these
    settings could be altered to match the application where appropriate.

    When over-temperature is reached, the interrupt from the DA9061/2 will be
    repeatedly triggered. The IRQ is therefore disabled when the first
    over-temperature event happens and the status bit is polled using a
    work-queue until it becomes false.

    This strategy is designed to allow the periodic transmission of uevents
    (HOT trip point) as the first level of temperature supervision method. It
    is intended for non-invasive temperature control, where the necessary
    measures for cooling the system down are left to the host software. Once
    the temperature falls again, the IRQ is re-enabled so a new critical
    over-temperature event can be detected.

    Reviewed-by: Lukasz Luba
    Signed-off-by: Steve Twiss
    Signed-off-by: Eduardo Valentin

    Steve Twiss
     
  • Northstar is a SoC family commonly used in home routers. This commit
    adds a driver for checking CPU temperature. As Northstar Plus seems to
    also have this IP block this new symbol gets ARCH_BCM_IPROC dependency.

    Signed-off-by: Rafał Miłecki
    Signed-off-by: Jon Mason
    Signed-off-by: Eduardo Valentin

    Rafał Miłecki
     

02 Apr, 2017

1 commit


31 Mar, 2017

7 commits

  • To restore operation it's easiest to reinitialise all TSCs. In order to
    do this the current trip window needs to be stored in the TSC structure
    so that it can be restored upon resume.

    Signed-off-by: Niklas Söderlund
    Reviewed-by: Wolfram Sang
    Signed-off-by: Eduardo Valentin

    Niklas Söderlund
     
  • The device match data needs to be accessible outside the probe function,
    store it in the private data structure.

    Signed-off-by: Niklas Söderlund
    Reviewed-by: Geert Uytterhoeven
    Reviewed-by: Wolfram Sang
    Signed-off-by: Eduardo Valentin

    Niklas Söderlund
     
  • Enable hardware trip points by implementing the set_trips callback. The
    thermal core will take care of setting the initial trip point window and
    to update it once the driver reports a TSC has moved outside it.

    The interrupt structure for this device is a bit odd. There is not a
    dedicated IRQ for each TSC, instead the interrupts are shared between
    all TSCs. IRQn is fired if the temp monitored in IRQTEMPn is reached in
    any of the TSCs, example IRQ3 is fired if temperature in IRQTEMP3 is
    reached in either TSC0, TSC1 or TSC2.

    For this reason the usage of interrupts in this driver is an all-on or
    all-off design. When an interrupt happens all TSCs are checked and all
    thermal zones are updated. This could be refined to be more fine grained
    but the thermal core takes care of only updating the thermal zones that
    have left their trip point window.

    Signed-off-by: Niklas Söderlund
    Reviewed-by: Wolfram Sang
    Signed-off-by: Eduardo Valentin

    Niklas Söderlund
     
  • Record how many TSCs are found in struct rcar_gen3_thermal_priv, this is
    needed to be able to add hardware interrupts for trip points later. Also
    add a check to make sure at least one TSC is found.

    Signed-off-by: Niklas Söderlund
    Reviewed-by: Geert Uytterhoeven
    Reviewed-by: Wolfram Sang
    Signed-off-by: Eduardo Valentin

    Niklas Söderlund
     
  • Move the check for a TSC resource before allocating memory for a new
    TSC. If no TSC is found there is little point in allocating memory for
    it.

    Signed-off-by: Niklas Söderlund
    Reviewed-by: Geert Uytterhoeven
    Reviewed-by: Wolfram Sang
    Signed-off-by: Eduardo Valentin

    Niklas Söderlund
     
  • There is no point in protecting a register read with a lock. This is
    most likely a leftover from when the driver was reworked before being
    submitted for upstream.

    Signed-off-by: Niklas Söderlund
    Reviewed-by: Geert Uytterhoeven
    Reviewed-by: Wolfram Sang
    Signed-off-by: Eduardo Valentin

    Niklas Söderlund
     
  • The .thermal_init needs to be delayed a short amount of time to allow
    for the TEMP register to contain something useful. If it's not delayed
    these warnings are common during boot:

    thermal thermal_zone0: failed to read out thermal zone (-5)
    thermal thermal_zone1: failed to read out thermal zone (-5)
    thermal thermal_zone2: failed to read out thermal zone (-5)

    The warnings are triggered by the first call to .get_temp() while the
    TEMP register contains 0 and rcar_gen3_thermal_get_temp() returns -EIO
    since a TEMP value of 0 will result in a temperature reading which is
    out of specifications.

    This should have been done in the initial commit which adds the driver
    as the same issue was found and corrected for r8a7795.

    Fixes: 564e73d283af9d4c ("thermal: rcar_gen3_thermal: Add R-Car Gen3 thermal driver")
    Signed-off-by: Niklas Söderlund
    Reviewed-by: Geert Uytterhoeven
    Reviewed-by: Wolfram Sang
    Signed-off-by: Eduardo Valentin

    Niklas Söderlund
     

30 Mar, 2017

3 commits


16 Mar, 2017

1 commit

  • The best place to register the CPU cooling device is from the cpufreq
    driver as we would know if all the resources are already available or
    not. That's what is done for the cpufreq-dt.c driver as well.

    The cpu-cooling driver for dbx500 platform was just (un)registering
    with the thermal framework and that can be handled easily by the cpufreq
    driver as well and in proper sequence as well.

    Get rid of the cooling driver and its its users and manage everything
    from the cpufreq driver instead.

    Signed-off-by: Viresh Kumar
    Tested-by: Linus Walleij
    Signed-off-by: Rafael J. Wysocki

    Viresh Kumar
     

13 Mar, 2017

6 commits

  • It is possible for dev_pm_opp_find_freq_exact() to return errors. It was
    all fine earlier as dev_pm_opp_get_voltage() had a check within it to
    check for invalid OPPs, but dev_pm_opp_put() doesn't have any similar
    checks and the callers need to make sure OPP is valid before calling
    them.

    Also update the later dev_warn_ratelimited() to not print the error
    message as the OPP is guaranteed to be valid now.

    Reported-by: Dan Carpenter
    Signed-off-by: Viresh Kumar
    Signed-off-by: Zhang Rui

    Viresh Kumar
     
  • There isn't much the user can do on seeing these warnings, as the
    hardware is actually okay. dev_err suits much better here.

    Signed-off-by: Viresh Kumar
    Signed-off-by: Zhang Rui

    Viresh Kumar
     
  • It is possible for dev_pm_opp_find_freq_exact() to return errors. It was
    all fine earlier as dev_pm_opp_get_voltage() had a check within it to
    check for invalid OPPs, but dev_pm_opp_put() doesn't have any similar
    checks and the callers need to make sure OPP is valid before calling
    them.

    Also update the later dev_warn_ratelimited() to not print the error
    message as the OPP is guaranteed to be valid now.

    Reported-by: Dan Carpenter
    Signed-off-by: Viresh Kumar
    Signed-off-by: Zhang Rui

    Viresh Kumar
     
  • There isn't much the user can do on seeing this warning, as the hardware
    is actually okay. dev_err suits much better here.

    Signed-off-by: Viresh Kumar
    Signed-off-by: Zhang Rui

    Viresh Kumar
     
  • There is no need to check for IS_ERR() as we are looking for a very
    particular error value here. Drop the first check.

    Reported-by: Dan Carpenter
    Signed-off-by: Viresh Kumar
    Signed-off-by: Zhang Rui

    Viresh Kumar
     
  • cooling_list_lock is covering not just cpufreq_dev_count, but also the
    calls to cpufreq_register_notifier() and cpufreq_unregister_notifier().

    Since cooling_list_lock is also used within cpufreq_thermal_notifier(),
    lockdep reports a potential deadlock. Fix it by testing the condition
    under cooling_list_lock and dropping the lock before calling
    cpufreq_register_notifier(). And variable cpufreq_dev_count is removed
    at the same time, because it's no longer needed after the fix.

    Fixes: ae606089621e ("thermal: convert cpu_cooling to use an IDA")
    Reported-and-Tested-by: Russell King
    Signed-off-by: Matthew Wilcox
    Acked-by: Rafael J. Wysocki

    Matthew Wilcox
     

02 Mar, 2017

2 commits

  • We are going to move scheduler ABI details to ,
    which will be used from a number of .c files.

    Create empty placeholder header that maps to .

    Include the new header in the files that are going to need it.

    Acked-by: Linus Torvalds
    Cc: Mike Galbraith
    Cc: Peter Zijlstra
    Cc: Thomas Gleixner
    Cc: linux-kernel@vger.kernel.org
    Signed-off-by: Ingo Molnar

    Ingo Molnar
     
  • Pull thermal management updates from Zhang Rui:

    - add thermal driver for R-Car Gen3 thermal sensors.

    - add thermal driver for ZTE' zx2967 family thermal sensors.

    - convert thermal ID allocation from IDR to IDA.

    - fix a possible NULL dereference in imx thermal driver.

    - fix a ti-soc-thermal driver dependency issue so that critical thermal
    control is still available when CPU_THERMAL is not defined.

    - update binding information for QorIQ thermal driver.

    - a couple of cleanups in thermal core, intel_powerclamp, exynos,
    dra752-thermal, mtk-thermal driver.

    * 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux:
    powerpc/mpc85xx: Update TMU device tree node for T1023/T1024
    powerpc/mpc85xx: Update TMU device tree node for T1040/T1042
    dt-bindings: Update QorIQ TMU thermal bindings
    thermal: mtk_thermal: Staticise a number of data variables
    thermal: arm: dra752: Remove all TSHUT related definitions
    thermal: arm: dra752: Remove TSHUT configuration
    thermal: ti-soc-thermal: Remove CPU_THERMAL Dependency from TI_THERMAL
    thermal: imx: Fix possible NULL dereference.
    thermal: exynos: Remove parsing unused samsung,tmu_cal_mode property
    thermal: zx2967: add thermal driver for ZTE's zx2967 family
    thermal: use cpumask_var_t for on-stack cpu masks
    dt: bindings: add documentation for zx2967 family thermal sensor
    thermal/intel_powerclamp: Remove set-but-not-used variables
    thermal: rcar_gen3_thermal: Add R-Car Gen3 thermal driver
    thermal: rcar_gen3_thermal: Document the R-Car Gen3
    thermal: convert devfreq_cooling to use an IDA
    thermal: convert cpu_cooling to use an IDA
    thermal: convert clock cooling to use an IDA
    thermal core: convert ID allocation to IDA

    Linus Torvalds
     

22 Feb, 2017

1 commit