platform/kernel/linux-3.10.git
9 years agoARM: dts: add clocks and enable pwm for exynos4
Sangjung Woo [Tue, 5 Nov 2013 01:48:07 +0000 (10:48 +0900)]
ARM: dts: add clocks and enable pwm for exynos4

This patch adds clocks for PWM(Pulse width modulation) timer and enable
it.

Signed-off-by: Sangjung Woo <sangjung.woo@samsung.com>
9 years agopwm: Add PWM polarity flag macro for DT
Laurent Pinchart [Wed, 17 Jul 2013 22:54:21 +0000 (00:54 +0200)]
pwm: Add PWM polarity flag macro for DT

Define a PWM_POLARITY_INVERTED macro in include/dt-bindings/pwm/pwm.h to
be used by device tree sources.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Reviewed-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
9 years agopwm: Remove superseded pwm-samsung-legacy driver
Tomasz Figa [Sat, 6 Apr 2013 00:54:30 +0000 (02:54 +0200)]
pwm: Remove superseded pwm-samsung-legacy driver

This patch removes the now unused pwm-samsung-legacy driver, which was
replaced by new pwm-samsung driver.

Signed-off-by: Tomasz Figa <tomasz.figa@gmail.com>
Reviewed-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Tested-by: Heiko Stuebner <heiko@sntech.de>
Tested-by: Mark Brown <broonie@linaro.org>
Tested-by: Sylwester Nawrocki <sylvester.nawrocki@gmail.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Thierry Reding <thierry.reding@gmail.com>
9 years agopwm: Add new pwm-samsung driver
Tomasz Figa [Sat, 6 Apr 2013 00:40:36 +0000 (02:40 +0200)]
pwm: Add new pwm-samsung driver

This patch introduces new Samsung PWM driver, which is completely
rewritten to be multiplatform- and DeviceTree-aware.

In addition, remaining problems of old driver are fixed, such as:
 - proper handling of hardware variants,
 - synchronization on SMP systems,
 - handling of boundary parameter values,
 - hardware sharing with PWM clocksource driver,
 - undefined state of PWM output after stopping PWM channel.

Signed-off-by: Tomasz Figa <tomasz.figa@gmail.com>
Reviewed-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Tested-by: Heiko Stuebner <heiko@sntech.de>
Tested-by: Mark Brown <broonie@linaro.org>
Tested-by: Sylwester Nawrocki <sylvester.nawrocki@gmail.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Thierry Reding <thierry.reding@gmail.com>
9 years agopwm: samsung: Rename to pwm-samsung-legacy
Tomasz Figa [Fri, 5 Apr 2013 23:08:03 +0000 (01:08 +0200)]
pwm: samsung: Rename to pwm-samsung-legacy

This patch renames the old pwm-samsung driver to pwm-samsung-legacy to
create place for the new, rewritten, DT-aware pwm-samsung driver.

Signed-off-by: Tomasz Figa <tomasz.figa@gmail.com>
Reviewed-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Tested-by: Heiko Stuebner <heiko@sntech.de>
Tested-by: Mark Brown <broonie@linaro.org>
Tested-by: Sylwester Nawrocki <sylvester.nawrocki@gmail.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Thierry Reding <thierry.reding@gmail.com>
9 years agopwm: Use the DT macro directly when parsing PWM DT flags
Laurent Pinchart [Wed, 17 Jul 2013 22:54:22 +0000 (00:54 +0200)]
pwm: Use the DT macro directly when parsing PWM DT flags

Don't redefine a PWM_SPEC_POLARITY macro with a value identical to
PWM_POLARITY_INVERTED, use the PWM DT macro directly.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Reviewed-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
9 years agopwm: Add sysfs interface
H Hartley Sweeten [Tue, 11 Jun 2013 17:38:59 +0000 (10:38 -0700)]
pwm: Add sysfs interface

Add a simple sysfs interface to the generic PWM framework.

  /sys/class/pwm/
  `-- pwmchipN/           for each PWM chip
      |-- export          (w/o) ask the kernel to export a PWM channel
      |-- npwm            (r/o) number of PWM channels in this PWM chip
      |-- pwmX/           for each exported PWM channel
      |   |-- duty_cycle  (r/w) duty cycle (in nanoseconds)
      |   |-- enable      (r/w) enable/disable PWM
      |   |-- period      (r/w) period (in nanoseconds)
      |   `-- polarity    (r/w) polarity of PWM (normal/inversed)
      `-- unexport        (w/o) return a PWM channel to the kernel

Based on work by Lars Poeschel.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Thierry Reding <thierry.reding@gmail.com>
Cc: Lars Poeschel <poeschel@lemonage.de>
Cc: Ryan Mallon <rmallon@gmail.com>
Cc: Rob Landley <rob@landley.net>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
9 years agopwm: devm: alloc correct pointer size
Wolfram Sang [Mon, 3 Jun 2013 20:27:17 +0000 (22:27 +0200)]
pwm: devm: alloc correct pointer size

The allocated object should be the size of what the pointer is pointing
to and not the size of the pointer itself.

Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
9 years agothermal: exynos: Provide initial setting for TMU's test MUX address at Exynos4412
Lukasz Majewski [Wed, 9 Oct 2013 06:29:52 +0000 (08:29 +0200)]
thermal: exynos: Provide initial setting for TMU's test MUX address at Exynos4412

The commit d0a0ce3e77c795258d47f9163e92d5031d0c5221 ("thermal: exynos: Add
missing definations and code cleanup") has removed setting of test MUX address
value at TMU configuration setting.

This field is not present on Exynos4210 and Exynos5 SoCs. However on Exynos4412
SoC it is required to set this field after reset because without it TMU shows
maximal available temperature, which causes immediate platform shutdown.

Signed-off-by: Lukasz Majewski <l.majewski@samsung.com>
Reviewed-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Reviewed-by: Tomasz Figa <t.figa@samsung.com>
Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
9 years agothermal: exynos: Provide separate TMU data for Exynos4412
Lukasz Majewski [Wed, 9 Oct 2013 06:29:51 +0000 (08:29 +0200)]
thermal: exynos: Provide separate TMU data for Exynos4412

Up till now Exynos5250 and Exynos4412 had the same definitions for TMU
data. Following commit changes that, by introducing separate
exynos4412_default_tmu_data structure.

Since Exynos4412 was chronologically first, the corresponding name for
TMU registers and default data was renamed.

Additionally, new SOC_ARCH_EXYNOS4412 type has been defined.

Moreover, the SOC_ARCH_EXYNOS name has been changed to SOC_ARCH_EXYNOS5250.

Signed-off-by: Lukasz Majewski <l.majewski@samsung.com>
Reviewed-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Reviewed-by: Tomasz Figa <t.figa@samsung.com>
Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
9 years agothermal: exynos: Remove check for thermal device pointer at exynos_report_trigger()
Lukasz Majewski [Wed, 9 Oct 2013 06:29:50 +0000 (08:29 +0200)]
thermal: exynos: Remove check for thermal device pointer at exynos_report_trigger()

The commit 4de0bdaa9677d11406c9becb70c60887c957e1f0
("thermal: exynos: Add support for instance based register/unregister")
broke check for presence of therm_dev at global thermal zone in
exynos_report_trigger().

The resulting wrong test prevents thermal_zone_device_update() call, which
calls handlers for situation when trip points are passed.
Such behavior prevents thermal driver from proper reaction (when TMU interrupt
is raised) in a situation when overheating is detected at TMU hardware.

It turns out, that after exynos thermal subsystem redesign (at v3.12) this
check is not needed, since it is not possible to register thermal zone
without valid thermal device.

Signed-off-by: Lukasz Majewski <l.majewski@samsung.com>
Reviewed-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Reviewed-by: Tomasz Figa <t.figa@samsung.com>
Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
9 years agoRevert "thermal: exynos: Set MUX bits in tmu's control register to work correctly."
Jonghwa Lee [Mon, 4 Nov 2013 07:12:26 +0000 (16:12 +0900)]
Revert "thermal: exynos: Set MUX bits in tmu's control register to work correctly."

This reverts commit e612d47f36eb9eb90ee88fd11addfe5aac8cdae4.
This will be suppported later with Lukasz's pathches.

Signed-off-by : Jonghwa Lee <jonghwa3.lee@samsung.com>

9 years agothermal: exynos: Set MUX bits in tmu's control register to work correctly.
Jonghwa Lee [Mon, 4 Nov 2013 05:23:22 +0000 (14:23 +0900)]
thermal: exynos: Set MUX bits in tmu's control register to work correctly.

Exynos 4x12 and 5250 need that MUX bits in control register is set to be
certain value at reset. Otherwise it'll reflect improper data when we
read current sensor's value. For other Exynos series, it doesn't need.

Signed-off-by: Jonghwa Lee <jonghwa3.lee@samsung.com>
9 years agothermal: EXYNOS: always register TMU driver with core thermal framework
Bartlomiej Zolnierkiewicz [Mon, 4 Nov 2013 06:48:45 +0000 (15:48 +0900)]
thermal: EXYNOS: always register TMU driver with core thermal framework

There is little sense in having separate config option for
registering EXYNOS TMU driver with the core thermal framework.
Fix it by integrating EXYNOS_THERMAL_CORE config option with
EXYNOS_THERMAL one.

Signed-off-by: Jonghwa Lee <jonghwa3.lee@samsung.com>
9 years agoIntroduce CONFIG_ARCH_HAS_BANDGAP and ARCH_EXYNOS4/5 selects it.
Jonghwa Lee [Fri, 1 Nov 2013 09:53:09 +0000 (18:53 +0900)]
Introduce CONFIG_ARCH_HAS_BANDGAP and ARCH_EXYNOS4/5 selects it.

CONFIG_ARCH_HAS_BANDGAP is used for tmu driver in thermal fw.

Signed-off-by: Jonghwa Lee <jonghwa3.lee@samsung.com>
9 years agothermal: Add ommitted codes from merging.
Jonghwa Lee [Fri, 1 Nov 2013 09:44:14 +0000 (18:44 +0900)]
thermal: Add ommitted codes from merging.

Add omitted codes from commits,

<commit-id d9e6913d1> "drivers: thermal: add check when ~ ", and
<commit-id efbf8d7a3> "thermal: thermal_core: allow binding with ~"

Signed-off-by: Jonghwa Lee <jonghwa3.lee@samsung.com>
9 years agoDocumentation: thermal: Explain the exynos thermal driver model
Amit Daniel Kachhap [Mon, 24 Jun 2013 10:50:49 +0000 (16:20 +0530)]
Documentation: thermal: Explain the exynos thermal driver model

This patch updates the documentation to explain the driver model
and file layout.

Acked-by: Jonghwa Lee <jonghwa3.lee@samsung.com>
Acked-by: Kukjin Kim <kgene.kim@samsung.com>
Acked-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Amit Daniel Kachhap <amit.daniel@samsung.com>
Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
9 years agodts: Fix exynos4x12 dts file to get thermal sensor regualtor properly.
Jonghwa Lee [Fri, 1 Nov 2013 08:32:40 +0000 (17:32 +0900)]
dts: Fix exynos4x12 dts file to get thermal sensor regualtor properly.

Fixes regulator consumer name from DT from 'vdd_ts' to 'vtmu' which
is used in Exynos tmu driver. And also enable tmu in all exynos4412 boards.

Signed-off-by: Jonghwa Lee <jonghwa3.lee@samsung.com>
9 years agodrivers: thermal: add check when unregistering cpu cooling
Eduardo Valentin [Thu, 15 Aug 2013 14:54:46 +0000 (10:54 -0400)]
drivers: thermal: add check when unregistering cpu cooling

This patch avoids NULL pointer accesses while unregistering
cpu cooling devices, in case a NULL pointer is received.

Cc: Zhang Rui <rui.zhang@intel.com>
Cc: linux-pm@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
9 years agothermal: thermal_core: allow binding with limits on bind_params
Eduardo Valentin [Tue, 16 Jul 2013 19:26:28 +0000 (15:26 -0400)]
thermal: thermal_core: allow binding with limits on bind_params

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: Eduardo Valentin <eduardo.valentin@ti.com>
9 years agodrivers: thermal: make usage of CONFIG_THERMAL_HWMON optional
Eduardo Valentin [Thu, 15 Aug 2013 15:34:17 +0000 (11:34 -0400)]
drivers: thermal: make usage of CONFIG_THERMAL_HWMON optional

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: Wei Ni <wni@nvidia.com>
Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
9 years agodrivers: thermal: parent virtual hwmon with thermal zone
Eduardo Valentin [Fri, 23 Aug 2013 21:07:58 +0000 (17:07 -0400)]
drivers: thermal: parent virtual hwmon with thermal zone

When  creating virtual hwmon devices based out of thermal
zone devices, the virtual devices won't have parents.

This patch changes the code so that the parent of virtual
hwmon devices is the thermal zone device that they are
based of.

Cc: Zhang Rui <rui.zhang@intel.com>
Cc: linux-pm@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
9 years agothermal: hwmon: move hwmon support to single file
Eduardo Valentin [Wed, 3 Jul 2013 19:14:28 +0000 (15:14 -0400)]
thermal: hwmon: move hwmon support to single file

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: Durgadoss R <durgadoss.r@intel.com>
Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
9 years agothermal: exynos: Clean up non-DT remnants
Sachin Kamat [Mon, 19 Aug 2013 06:28:43 +0000 (11:58 +0530)]
thermal: exynos: Clean up non-DT remnants

Commit 1cd1ecb6 ("thermal: exynos: Remove non DT based support")
cleaned up some non-DT code. However, there were few more things
needed for complete cleanup to make this driver DT only.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
9 years agothermal: exynos: Fix potential NULL pointer dereference
Sachin Kamat [Mon, 19 Aug 2013 06:28:42 +0000 (11:58 +0530)]
thermal: exynos: Fix potential NULL pointer dereference

NULL pointer was being dereferenced in its own error message.
Changed it to the correct device pointer.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
9 years agothermal: exynos: Fix typos in Kconfig
Sachin Kamat [Mon, 19 Aug 2013 06:28:41 +0000 (11:58 +0530)]
thermal: exynos: Fix typos in Kconfig

Fixes some trivial typos.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
9 years agothermal: ti-soc-thermal: Ensure to compute thermal trend
Ranganath Krishnan [Fri, 23 Aug 2013 16:08:23 +0000 (11:08 -0500)]
thermal: ti-soc-thermal: Ensure to compute thermal trend

Workaround to compute thermal trend even when update interval
is not set. This patch will ensure to compute the thermal trend
when bandgap counter delay is not set.

Signed-off-by: Ranganath Krishnan <ranganath@ti.com>
Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
9 years agothermal: ti-soc-thermal: Set the bandgap mask counter delay value
Ranganath Krishnan [Fri, 23 Aug 2013 16:08:22 +0000 (11:08 -0500)]
thermal: ti-soc-thermal: Set the bandgap mask counter delay value

Set the bandgap mask counter_delay with the polling_delay value on
registering the thermal zone. This patch will ensure to get the
correct update interval for computing the thermal trend.

Signed-off-by: Ranganath Krishnan <ranganath@ti.com>
Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
9 years agothermal: ti-soc-thermal: Initialize counter_delay field for TI DRA752 sensors
Ranganath Krishnan [Fri, 23 Aug 2013 16:08:21 +0000 (11:08 -0500)]
thermal: ti-soc-thermal: Initialize counter_delay field for TI DRA752 sensors

Initialize MPU, GPU, CORE, DSPEVE and IVA thermal sensors of DRA752 bandgap
with the counter delay mask.

Signed-off-by: Ranganath Krishnan <ranganath@ti.com>
Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
9 years agothermal: step_wise: return instance->target by default
Eduardo Valentin [Mon, 17 Jun 2013 13:24:24 +0000 (21:24 +0800)]
thermal: step_wise: return instance->target by default

In case the trend is not changing or when there is no
request for throttling, it is expected that the instance
would not change its requested target. This patch improves
the code implementation to cover for this expected behavior.

With current implementation, the instance will always
reset to cdev.cur_state, even in not expected cases,
like those mentioned above.

This patch changes the step_wise governor implementation
of get_target so that we accomplish:
(a) - default value will be current instance->target, so
we do not change the thermal instance target unnecessarily.
(b) - the code now it is clear about what is the intention.
There is a clear statement of what are the expected outcomes
(c) - removal of hardcoded constants, now it is put in use
the THERMAL_NO_TARGET macro.
(d) - variable names are also improved so that reader can
clearly understand the difference between instance cur target,
next target and cdev cur_state.

Cc: Zhang Rui <rui.zhang@intel.com>
Cc: Durgadoss R <durgadoss.r@intel.com>
Cc: linux-pm@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Reported-by: Ruslan Ruslichenko <ruslan.ruslichenko@ti.com>
Signed-of-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
9 years agothermal: step_wise: cdev only needs update on a new target state
Shawn Guo [Mon, 17 Jun 2013 13:24:23 +0000 (21:24 +0800)]
thermal: step_wise: cdev only needs update on a new target state

The cooling device only needs update on a new target state.  Since we
already check old target in thermal_zone_trip_update(), we can do one
more check to see if it's a new target state.  If not, we can reasonably
save some uncecesary code execution.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
Acked-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
9 years agoThermal/cpu_cooling: Return directly for the cpu out of allowed_cpus in the cpufreq_t...
Lan Tianyu [Tue, 13 Aug 2013 02:07:28 +0000 (10:07 +0800)]
Thermal/cpu_cooling: Return directly for the cpu out of allowed_cpus in the cpufreq_thermal_notifier()

cpufreq_thermal_notifier() is to change the cpu's cpufreq in the allowed_cpus mask
when associated thermal-cpufreq cdev's cooling state is changed. It's a cpufreq policy
notifier handler and it will be triggered even if those cpus out of allowed_cpus has
changed freq policy.

cpufreq_thermal_notifier() checks the policy->cpu. If it belongs to allowed_cpus,
change max_freq(default to 0) to the desire cpufreq value and pass 0 and max_freq
to cpufreq_verify_within_limits() as cpufreq scope. But if not, do nothing and
max_freq will remain 0. This will cause the cpufreq scope to become 0~0. This
is not right. This patch is to return directly after finding cpu not belonging
to allowed_cpus.

Signed-off-by: Lan Tianyu <tianyu.lan@intel.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
9 years agothermal: exynos_tmu: fix wrong error check for mapped memory
Naveen Krishna Chatradhi [Wed, 7 Aug 2013 08:31:09 +0000 (14:01 +0530)]
thermal: exynos_tmu: fix wrong error check for mapped memory

The error check is checking for a "base" mapped memory base
instead of "base_common". Fixing the same.

Signed-off-by: Naveen Krishna Chatradhi <ch.naveen@samsung.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
9 years agothermal: imx: implement thermal alarm interrupt handling
Philipp Zabel [Thu, 1 Aug 2013 16:33:12 +0000 (18:33 +0200)]
thermal: imx: implement thermal alarm interrupt handling

Enable automatic measurements at 10 Hz and use the alarm interrupt to react
more quickly to sudden temperature changes above the passive or critical
temperature trip points.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Acked-by: Shawn Guo <shawn.guo@linaro.org>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
9 years agothermal: imx: dynamic passive and SoC specific critical trip points
Philipp Zabel [Thu, 1 Aug 2013 16:33:11 +0000 (18:33 +0200)]
thermal: imx: dynamic passive and SoC specific critical trip points

Set passive and critical trip point values depending on the maximum die
temperature stored in the OCOTP fuses. This allows higher trip points
for industrial and automotive rated i.MX6 SoCs.
Also allow to configure the passive trip point from userspace.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Acked-by: Shawn Guo <shawn.guo@linaro.org>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
9 years agothermal: exynos: Support for TMU regulator defined at device tree
Amit Daniel Kachhap [Mon, 24 Jun 2013 10:50:47 +0000 (16:20 +0530)]
thermal: exynos: Support for TMU regulator defined at device tree

TMU probe function now checks for a device tree defined regulator.
For compatibility reasons it is allowed to probe driver even without
this regulator defined.

Acked-by: Jonghwa Lee <jonghwa3.lee@samsung.com>
Acked-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Lukasz Majewski <l.majewski@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Amit Daniel Kachhap <amit.daniel@samsung.com>
Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
9 years agothermal: exynos: Add hardware mode thermal calibration support
Amit Daniel Kachhap [Mon, 24 Jun 2013 10:50:46 +0000 (16:20 +0530)]
thermal: exynos: Add hardware mode thermal calibration support

This patch adds support for h/w mode calibration in the TMU controller.
Soc's like 5440 support this features. The h/w bits needed for calibration
setting are same as that of enum calibration_type.

Acked-by: Jonghwa Lee <jonghwa3.lee@samsung.com>
Acked-by: Kukjin Kim <kgene.kim@samsung.com>
Signed-off-by: Amit Daniel Kachhap <amit.daniel@samsung.com>
Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
9 years agothermal: exynos: Fix to set the second point correction value
Amit Daniel Kachhap [Mon, 24 Jun 2013 10:50:45 +0000 (16:20 +0530)]
thermal: exynos: Fix to set the second point correction value

This patch sets the second point trimming value according to the platform
data if the register value is 0.

Acked-by: Jonghwa Lee <jonghwa3.lee@samsung.com>
Acked-by: Kukjin Kim <kgene.kim@samsung.com>
Acked-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Amit Daniel Kachhap <amit.daniel@samsung.com>
Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
9 years agothermal: exynos: Add thermal configuration data for exynos5440 TMU sensor
Amit Daniel Kachhap [Mon, 24 Jun 2013 10:50:44 +0000 (16:20 +0530)]
thermal: exynos: Add thermal configuration data for exynos5440 TMU sensor

This patch adds configuration data for exynos5440 soc. Also register
definations for the controller are added.

Acked-by: Jonghwa Lee <jonghwa3.lee@samsung.com>
Acked-by: Kukjin Kim <kgene.kim@samsung.com>
Signed-off-by: Amit Daniel Kachhap <amit.daniel@samsung.com>
Acked-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
9 years agothermal: exynos: Add driver support for exynos5440 TMU sensor
Amit Daniel Kachhap [Mon, 24 Jun 2013 10:50:43 +0000 (16:20 +0530)]
thermal: exynos: Add driver support for exynos5440 TMU sensor

This patch modifies TMU controller to add changes needed to work with
exynos5440 platform. This sensor registers 3 instance of the tmu controller
with the thermal zone and hence reports 3 temperature output. This controller
supports upto five trip points. For critical threshold the driver uses the
core driver thermal framework for shutdown.

Acked-by: Jonghwa Lee <jonghwa3.lee@samsung.com>
Acked-by: Kukjin Kim <kgene.kim@samsung.com>
Signed-off-by: Jungseok Lee <jays.lee@samsung.com>
Signed-off-by: Amit Daniel Kachhap <amit.daniel@samsung.com>
Acked-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
9 years agothermal: exynos: Add support to access common register for multistance
Amit Daniel Kachhap [Mon, 24 Jun 2013 10:50:42 +0000 (16:20 +0530)]
thermal: exynos: Add support to access common register for multistance

This patch adds support to parse one more common set of TMU register. First
set of register belongs to each instance of TMU and second set belongs to
common TMU registers.

Acked-by: Jonghwa Lee <jonghwa3.lee@samsung.com>
Acked-by: Kukjin Kim <kgene.kim@samsung.com>
Acked-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Amit Daniel Kachhap <amit.daniel@samsung.com>
Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
9 years agothermal: exynos: use device resource management infrastructure
Amit Daniel Kachhap [Tue, 25 Jun 2013 11:41:42 +0000 (17:11 +0530)]
thermal: exynos: use device resource management infrastructure

This patch uses the device pointer stored in the configuration structure
and converts to dev_* prints and devm API's.

Acked-by: Kukjin Kim <kgene.kim@samsung.com>
Acked-by: Jonghwa Lee <jonghwa3.lee@samsung.com>
Acked-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Amit Daniel Kachhap <amit.daniel@samsung.com>
Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
9 years agothermal: exynos: Add TMU features to check instead of using SOC type
Amit Daniel Kachhap [Mon, 24 Jun 2013 10:50:40 +0000 (16:20 +0530)]
thermal: exynos: Add TMU features to check instead of using SOC type

This patch adds several features supported by TMU as bitfields.
This features varies across different SOC type and comparing
the features present in the TMU is more logical than comparing
the soc itself.

Acked-by: Kukjin Kim <kgene.kim@samsung.com>
Acked-by: Jonghwa Lee <jonghwa3.lee@samsung.com>
Acked-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Amit Daniel Kachhap <amit.daniel@samsung.com>
Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
9 years agothermal: exynos: Add support to handle many instances of TMU
Amit Daniel Kachhap [Mon, 24 Jun 2013 10:50:39 +0000 (16:20 +0530)]
thermal: exynos: Add support to handle many instances of TMU

This patch adds support to handle multiple instances of the TMU controllers.
This is done by removing the static structure to register with the core thermal
and creating it dynamically for each instance of the TMU controller. The
interrupt is made shared type to handle shared interrupts. Now since the ISR needs
the core thermal framework to be registered so request_irq is moved after the core
registration is done.
Also the identifier of the TMU controller is extracted from device tree alias. This
will be used for TMU specific initialisation.

Acked-by: Kukjin Kim <kgene.kim@samsung.com>
Acked-by: Jonghwa Lee <jonghwa3.lee@samsung.com>
Signed-off-by: Amit Daniel Kachhap <amit.daniel@samsung.com>
Acked-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
9 years agothermal: exynos: Remove non DT based support
Amit Daniel Kachhap [Mon, 24 Jun 2013 10:50:38 +0000 (16:20 +0530)]
thermal: exynos: Remove non DT based support

Recently non DT support from Exynos platform is removed and hence
removing non DT support from the driver also. This will help in easy
maintainence.

Acked-by: Jonghwa Lee <jonghwa3.lee@samsung.com>
Acked-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Amit Daniel Kachhap <amit.daniel@samsung.com>
Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
9 years agothermal: exynos: Make the zone handling use trip information
Amit Daniel Kachhap [Mon, 24 Jun 2013 10:50:37 +0000 (16:20 +0530)]
thermal: exynos: Make the zone handling use trip information

This code simplifies the zone handling to use the trip information passed
by the TMU driver and not the hardcoded macros. This also helps in adding
more zone support.

Acked-by: Kukjin Kim <kgene.kim@samsung.com>
Acked-by: Jonghwa Lee <jonghwa3.lee@samsung.com>
Signed-off-by: Amit Daniel Kachhap <amit.daniel@samsung.com>
Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
9 years agothermal: exynos: Return success even if no cooling data supplied
Amit Daniel Kachhap [Mon, 24 Jun 2013 10:50:36 +0000 (16:20 +0530)]
thermal: exynos: Return success even if no cooling data supplied

This patch removes the error return in the bind/unbind routine
as the platform may not register any cpufreq cooling data.

Acked-by: Kukjin Kim <kgene.kim@samsung.com>
Acked-by: Jonghwa Lee <jonghwa3.lee@samsung.com>
Acked-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Amit Daniel Kachhap <amit.daniel@samsung.com>
Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
9 years agothermal: exynos: Modify private_data to appropriate name driver_data
Amit Daniel Kachhap [Mon, 24 Jun 2013 10:50:35 +0000 (16:20 +0530)]
thermal: exynos: Modify private_data to appropriate name driver_data

This patch renames member private_data to driver_data of the thermal
zone registration structure as this item stores the driver related
data and uses it to call the driver related callbacks.

Acked-by: Kukjin Kim <kgene.kim@samsung.com>
Acked-by: Jonghwa Lee <jonghwa3.lee@samsung.com>
Acked-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Amit Daniel Kachhap <amit.daniel@samsung.com>
Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
9 years agothermal: exynos: Add support for instance based register/unregister
Amit Daniel Kachhap [Mon, 24 Jun 2013 10:50:34 +0000 (16:20 +0530)]
thermal: exynos: Add support for instance based register/unregister

This code modifies the thermal driver to have multiple thermal zone
support by replacing the global thermal zone variable with device data
member of thermal_zone_device.

Acked-by: Kukjin Kim <kgene.kim@samsung.com>
Acked-by: Jonghwa Lee <jonghwa3.lee@samsung.com>
Acked-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Amit Daniel Kachhap <amit.daniel@samsung.com>
Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
9 years agothermal: exynos: Fix to clear only the generated interrupts
Amit Daniel Kachhap [Mon, 24 Jun 2013 10:50:33 +0000 (16:20 +0530)]
thermal: exynos: Fix to clear only the generated interrupts

This patch uses the TMU status register to know the generated interrupts
and only clear them in the interrupt handler.

Acked-by: Kukjin Kim <kgene.kim@samsung.com>
Acked-by: Jonghwa Lee <jonghwa3.lee@samsung.com>
Acked-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Amit Daniel Kachhap <amit.daniel@samsung.com>
Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
9 years agothermal: exynos: Support thermal tripping
Amit Daniel Kachhap [Mon, 24 Jun 2013 10:50:32 +0000 (16:20 +0530)]
thermal: exynos: Support thermal tripping

TMU urgently sends active-high signal (thermal trip) to PMU, and thermal
tripping by hardware logic. Thermal tripping means that PMU cuts off the
whole power of SoC by controlling external voltage regulator.

Acked-by: Kukjin Kim <kgene.kim@samsung.com>
Acked-by: Jonghwa Lee <jonghwa3.lee@samsung.com>
Acked-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Jonghwan Choi <jhbird.choi@samsung.com>
Signed-off-by: Amit Daniel Kachhap <amit.daniel@samsung.com>
Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
9 years agothermal: exynos: Move register definitions from driver to data file
Amit Daniel Kachhap [Mon, 24 Jun 2013 10:50:31 +0000 (16:20 +0530)]
thermal: exynos: Move register definitions from driver to data file

This patch migrates the TMU register definition/bitfields to data file. This
is needed to support SoC's which use the same TMU controller but register
validity, offsets or bitfield may slightly vary across SOC's.

Acked-by: Kukjin Kim <kgene.kim@samsung.com>
Acked-by: Jonghwa Lee <jonghwa3.lee@samsung.com>
Acked-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Amit Daniel Kachhap <amit.daniel@samsung.com>
Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
9 years agothermal: exynos: Add extra entries in the tmu platform data
Amit Daniel Kachhap [Mon, 24 Jun 2013 10:50:30 +0000 (16:20 +0530)]
thermal: exynos: Add extra entries in the tmu platform data

This patch adds entries min_efuse_value, max_efuse_value, default_temp_offset,
trigger_type, cal_type, trim_first_point, trim_second_point, max_trigger_level
trigger_enable in the TMU platform data structure. Also the driver is modified
to use the data passed by these new platform memebers instead of the constant
macros. All these changes helps in separating the SOC specific data part from
the TMU driver.

Acked-by: Kukjin Kim <kgene.kim@samsung.com>
Acked-by: Jonghwa Lee <jonghwa3.lee@samsung.com>
Signed-off-by: Amit Daniel Kachhap <amit.daniel@samsung.com>
Acked-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
9 years agothermal: exynos: Add missing definations and code cleanup
Amit Daniel Kachhap [Mon, 24 Jun 2013 10:50:29 +0000 (16:20 +0530)]
thermal: exynos: Add missing definations and code cleanup

This patch adds some extra register bitfield definations and cleans
up the code to prepare for moving register macros and definations inside
the TMU data section. In this code cleanup the TMU enable bit is correctly used
as bit0 and bit1 is taken care which is reserve bit.

Acked-by: Kukjin Kim <kgene.kim@samsung.com>
Acked-by: Jonghwa Lee <jonghwa3.lee@samsung.com>
Signed-off-by: Amit Daniel Kachhap <amit.daniel@samsung.com>
Acked-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
9 years agothermal: exynos: Bifurcate exynos tmu driver and configuration data
Amit Daniel Kachhap [Mon, 24 Jun 2013 10:50:28 +0000 (16:20 +0530)]
thermal: exynos: Bifurcate exynos tmu driver and configuration data

This code splits the exynos tmu driver code into SOC specific data parts.
This will simplify adding new SOC specific data to the same TMU controller.

Acked-by: Kukjin Kim <kgene.kim@samsung.com>
Acked-by: Jonghwa Lee <jonghwa3.lee@samsung.com>
Acked-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Amit Daniel Kachhap <amit.daniel@samsung.com>
Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
9 years agothermal: exynos: Move exynos_thermal.h from include/* to driver/* folder
Amit Daniel Kachhap [Mon, 24 Jun 2013 10:50:27 +0000 (16:20 +0530)]
thermal: exynos: Move exynos_thermal.h from include/* to driver/* folder

This patch renames and moves include/linux/platform_data/exynos_thermal.h to
drivers/thermal/samsung/exynos_tmu.h. This file movement is needed as exynos
SOC's are not supporting non-DT based platforms and this file now just contains
exynos tmu driver related definations.
Also struct freq_clip_table is now moved to exynos_thermal_common.c as it fixes
the compilation issue occuring because now this new tmu header file is included
in tmu driver c file and not in the common thermal header file.

Acked-by: Kukjin Kim <kgene.kim@samsung.com>
Acked-by: Jonghwa Lee <jonghwa3.lee@samsung.com>
Acked-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Amit Daniel Kachhap <amit.daniel@samsung.com>
Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
9 years agothermal: exynos: Rename exynos_thermal.c to exynos_tmu.c
Amit Daniel Kachhap [Mon, 24 Jun 2013 10:50:26 +0000 (16:20 +0530)]
thermal: exynos: Rename exynos_thermal.c to exynos_tmu.c

This patch renames exynos_thermal.c to exynos_tmu.c. This change is needed as
this file now just contains exynos tmu driver related codes and thermal zone
or cpufreq cooling registration related changes are not there anymore.

Acked-by: Kukjin Kim <kgene.kim@samsung.com>
Acked-by: Jonghwa Lee <jonghwa3.lee@samsung.com>
Acked-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Amit Daniel Kachhap <amit.daniel@samsung.com>
Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
9 years agothermal: exynos: Bifurcate exynos thermal common and tmu controller code
Amit Daniel Kachhap [Mon, 24 Jun 2013 10:50:25 +0000 (16:20 +0530)]
thermal: exynos: Bifurcate exynos thermal common and tmu controller code

This code bifurcates exynos thermal implementation into common and sensor
specific parts. The common thermal code interacts with core thermal layer and
core cpufreq cooling parts and is independent of SOC specific driver. This
change is needed to cleanly add support for new TMU sensors.

Acked-by: Kukjin Kim <kgene.kim@samsung.com>
Acked-by: Jonghwa Lee <jonghwa3.lee@samsung.com>
Acked-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Amit Daniel Kachhap <amit.daniel@samsung.com>
Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
9 years agothermal: exynos: Remove un-necessary CPU_THERMAL dependency
Amit Daniel Kachhap [Mon, 24 Jun 2013 10:50:24 +0000 (16:20 +0530)]
thermal: exynos: Remove un-necessary CPU_THERMAL dependency

This patch removes the dependency on CPU_THERMAL for compiling TMU driver.
This is useful for cases when only TMU controller needs to be initialised
without cpu cooling action.

Acked-by: Kukjin Kim <kgene.kim@samsung.com>
Acked-by: Jonghwa Lee <jonghwa3.lee@samsung.com>
Acked-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Amit Daniel Kachhap <amit.daniel@samsung.com>
Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
9 years agothermal: exynos: Use ARCH_HAS_BANDGAP config to know the supported soc's
Amit Daniel Kachhap [Mon, 24 Jun 2013 10:50:23 +0000 (16:20 +0530)]
thermal: exynos: Use ARCH_HAS_BANDGAP config to know the supported soc's

This patch uses the recently added config sybmol ARCH_HAS_BANDGAP to enable
the TMU driver. This will allow adding support for new soc easily as now it
is the platform responsibility to enable this config symbol for a particular
soc.

Acked-by: Kukjin Kim <kgene.kim@samsung.com>
Acked-by: Jonghwa Lee <jonghwa3.lee@samsung.com>
Acked-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Amit Daniel Kachhap <amit.daniel@samsung.com>
Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
9 years agothermal: exynos: Moving exynos thermal files into samsung directory
Amit Daniel Kachhap [Fri, 1 Nov 2013 06:45:25 +0000 (15:45 +0900)]
thermal: exynos: Moving exynos thermal files into samsung directory

This movement of files is done for easy maintenance and adding more
new sensor's support for exynos platform easily . This will also help in
bifurcating exynos common, sensor driver and sensor data related parts.

Acked-by: Kukjin Kim <kgene.kim@samsung.com>
Acked-by: Jonghwa Lee <jonghwa3.lee@samsung.com>
Acked-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Amit Daniel Kachhap <amit.daniel@samsung.com>
Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
9 years agothermal: add imx thermal driver support
Shawn Guo [Mon, 24 Jun 2013 06:30:44 +0000 (14:30 +0800)]
thermal: add imx thermal driver support

This is based on the initial imx thermal work done by
Rob Lee <rob.lee@linaro.org> (Not sure if the email address is still
valid).  Since he is no longer interested in the work and I have
rewritten a significant amount of the code, I just took the authorship
over from him.

It adds the imx thermal support using Temperature Monitor (TEMPMON)
block found on some Freescale i.MX SoCs.  The driver uses syscon regmap
interface to access TEMPMON control registers and calibration data, and
supports cpufreq as the cooling device.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
9 years agoThermal: Fix lockup of cpu_down()
Steven Rostedt [Tue, 16 Jul 2013 18:02:28 +0000 (14:02 -0400)]
Thermal: Fix lockup of cpu_down()

Commit f1a18a105 "Thermal: CPU Package temperature thermal" had code
that did a get_online_cpus(), run a loop and then do a
put_online_cpus(). The problem is that the loop had an error exit that
would skip the put_online_cpus() part.

In the error exit part of the function, it also did a get_online_cpus(),
run a loop and then put_online_cpus(). The only way to get to the error
exit part is with get_online_cpus() already performed. If this error
condition is hit, the system will be prevented from taking CPUs offline.
The process taking the CPU offline will lock up hard.

Removing the get_online_cpus() removes the lockup as the hotplug CPU
refcount is back to zero.

This was bisected with ktest.

Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
9 years agoThermal: x86_pkg_temp: Limit number of pkg temp zones
Srinivas Pandruvada [Mon, 15 Jul 2013 22:38:52 +0000 (15:38 -0700)]
Thermal: x86_pkg_temp: Limit number of pkg temp zones

Although it is unlikley that physical package id is set to some
arbitary number, it is better to prevent in anycase. Since package
temp zones use this in thermal zone type and for allocation, added
a limit.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
9 years agoThermal: x86_pkg_temp: fix krealloc() misuse in in pkg_temp_thermal_device_add()
Wei Yongjun [Tue, 18 Jun 2013 13:09:12 +0000 (21:09 +0800)]
Thermal: x86_pkg_temp: fix krealloc() misuse in in pkg_temp_thermal_device_add()

If krealloc() returns NULL, it doesn't free the original. So any code
of the form 'foo = krealloc(foo, ...);' is almost certainly a bug.

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
9 years agoThermal: x86 package temp thermal crash
Srinivas Pandruvada [Thu, 11 Jul 2013 16:50:30 +0000 (09:50 -0700)]
Thermal: x86 package temp thermal crash

On systems with no package MSR support this caused crash as there
is a bug in the logic to check presence of DTHERM and PTS feature
together. Added a change so that when there is no PTS support, module
doesn't get loaded. Even if some CPU comes online with the PTS
feature disabled, and other CPUs has this support, this patch
will still prevent such MSR accesses.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Reported-by: Daniel Walker <dwalker@fifo99.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
9 years agothermal: ti-soc-thermal: use standard GPIO DT bindings
Eduardo Valentin [Fri, 7 Jun 2013 15:11:53 +0000 (11:11 -0400)]
thermal: ti-soc-thermal: use standard GPIO DT bindings

This change updates the ti-soc-thermal driver to use
standard GPIO DT bindings to read the GPIO number associated
to thermal shutdown IRQ, in case the device features it.

Previously, the code was using a specific DT bindings.
As now OMAP supports the standard way to model GPIOs,
there is no point in having a ti specific binding.

Cc: Zhang Rui <rui.zhang@intel.com>
Cc: Grant Likely <grant.likely@linaro.org>
Cc: Rob Herring <rob.herring@calxeda.com>
Cc: linux-pm@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Cc: devicetree-discuss@lists.ozlabs.org
Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
9 years agothermal: exynos: Support both EXYNOS4X12 SoCs
Tomasz Figa [Tue, 18 Jun 2013 16:31:50 +0000 (01:31 +0900)]
thermal: exynos: Support both EXYNOS4X12 SoCs

EXYNOS4212 and EXYNOS4412 have the same thermal block, so there is no
reason to include support only for EXYNOS4412 in this driver.

Cc: linux-pm@vger.kernel.org
Cc: Zhang Rui <rui.zhang@intel.com>
Cc: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Tomasz Figa <t.figa@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
9 years agothermal: fix x86_pkg_temp_thermal.c build and Kconfig
Randy Dunlap [Mon, 17 Jun 2013 19:27:17 +0000 (12:27 -0700)]
thermal: fix x86_pkg_temp_thermal.c build and Kconfig

Fix build error in x86_pkg_temp_thermal.c.  It requires that
X86_MCE & X86_THERMAL_VECTOR be enabled, so depend on the latter symbol,
since it depends on X86_MCE (indirectly).

Also, X86_PKG_TEMP_THERMAL is already inside an "if THERMAL" block,
so remove that duplicated dependency.

ERROR: "platform_thermal_package_rate_control" [drivers/thermal/x86_pkg_temp_thermal.ko] undefined!
ERROR: "platform_thermal_package_notify" [drivers/thermal/x86_pkg_temp_thermal.ko] undefined!

Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Acked-by: Borislav Petkov <bp@suse.de>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
9 years agoThermal: CPU Package temperature thermal
Srinivas Pandruvada [Fri, 17 May 2013 23:42:02 +0000 (23:42 +0000)]
Thermal: CPU Package temperature thermal

This driver register CPU digital temperature sensor as a thermal
zone at package level.
Each package will show up as one zone with at max two trip points.
These trip points can be both read and updated. Once a non zero
value is set in the trip point, if the package package temperature
goes above or below this setting, a thermal notification is
generated.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
9 years agothermal: consider emul_temperature while computing trend
Eduardo Valentin [Wed, 29 May 2013 21:37:00 +0000 (21:37 +0000)]
thermal: consider emul_temperature while computing trend

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: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
9 years agothermal: ti-soc-thermal: add dra752 chip to device table
Eduardo Valentin [Wed, 29 May 2013 15:07:45 +0000 (15:07 +0000)]
thermal: ti-soc-thermal: add dra752 chip to device table

Add support to TI dra752 chips by adapting the driver
device table.

Cc: Zhang Rui <rui.zhang@intel.com>
Cc: linux-pm@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
9 years agothermal: ti-soc-thermal: add thermal data for DRA752 chips
Eduardo Valentin [Mon, 3 Jun 2013 20:31:55 +0000 (20:31 +0000)]
thermal: ti-soc-thermal: add thermal data for DRA752 chips

This patch adds the thermal data for TI DRA752 chips.
In this change it includes (autogen):
. Register offset definitions
. Bitfields and masks for all registers
. Conversion table

Also, the thermal limits, thresholds and extrapolation
rules are included. The extrapolation rule is simply
add +2C as margin.

All 5 sensors, MPU, GPU, CORE, DSPEVE and IVA, are defined
and exposed. Only MPU has cooling device.

Cc: Zhang Rui <rui.zhang@intel.com>
Cc: linux-pm@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
9 years agothermal: ti-soc-thermal: remove usage of IS_ERR_OR_NULL
Eduardo Valentin [Wed, 29 May 2013 15:07:43 +0000 (15:07 +0000)]
thermal: ti-soc-thermal: remove usage of IS_ERR_OR_NULL

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).

For this reason this patch is changing the driver after
revisiting the code. These are the cases:
i. For cases in which IS_ERR_OR_NULL() is used for checking
return values of functions that returns either PTR_ERR()
or a valid pointer, it has been translated to IS_ERR() check only.
ii. For cases that a NULL check is still needed, it has been
translated to if (!ptr || IS_ERR(ptr)).

Cc: Zhang Rui <rui.zhang@intel.com>
Cc: linux-pm@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
9 years agothermal: ti-soc-thermal: freeze FSM while computing trend
Eduardo Valentin [Fri, 7 Jun 2013 19:13:13 +0000 (19:13 +0000)]
thermal: ti-soc-thermal: freeze FSM while computing trend

In order to read the history buffer, it is required to
freeze BG FSM. This patch adds the missing piece of code
to freeze the FSM and also a contention area to avoid
other parts of the code to access the DTEMPs.

Cc: Zhang Rui <rui.zhang@intel.com>
Cc: linux-pm@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
9 years agothermal: ti-soc-thermal: remove external heat while extrapolating hotspot
Eduardo Valentin [Wed, 29 May 2013 15:07:41 +0000 (15:07 +0000)]
thermal: ti-soc-thermal: remove external heat while extrapolating hotspot

For boards that provide a PCB sensor close to SoC junction
temperature, it is possible to remove the cumulative heat
reported by the SoC temperature sensor.

This patch changes the extrapolation computation to consider
an external sensor in the extrapolation equations.

Cc: Zhang Rui <rui.zhang@intel.com>
Cc: linux-pm@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
9 years agothermal: cpu_cooling: fix 'descend' check in get_property()
Shawn Guo [Tue, 28 May 2013 06:22:32 +0000 (06:22 +0000)]
thermal: cpu_cooling: fix 'descend' check in get_property()

The variable 'descend' is initialized as -1 in function get_property(),
and will never get any chance to be updated by the following code.

if (freq != CPUFREQ_ENTRY_INVALID && descend != -1)
descend = !!(freq > table[i].frequency);

This makes function get_property() return the wrong frequency for given
cooling level if the frequency table is sorted in ascending.  Fix it
by correcting the 'descend' check in if-condition to 'descend == -1'.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
9 years agoThermal: spear: Remove redundant use of of_match_ptr
Sachin Kamat [Thu, 16 May 2013 10:28:11 +0000 (10:28 +0000)]
Thermal: spear: Remove redundant use of of_match_ptr

'spear_thermal_id_table' is always compiled in and the driver
is dependent on OF. Hence use of of_match_ptr is unnecessary.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Cc: Vincenzo Frascino <vincenzo.frascino@st.com>
Cc: Viresh Kumar <viresh.kumar@linaro.org>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Acked-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
9 years agoThermal: kirkwood: Remove redundant use of of_match_ptr
Sachin Kamat [Thu, 16 May 2013 10:28:10 +0000 (10:28 +0000)]
Thermal: kirkwood: Remove redundant use of of_match_ptr

'kirkwood_thermal_id_table' is always compiled in and the driver
is dependent on OF. Hence use of of_match_ptr is unnecessary.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
Acked-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
9 years agoThermal: dove: Remove redundant use of of_match_ptr
Sachin Kamat [Thu, 16 May 2013 10:28:09 +0000 (10:28 +0000)]
Thermal: dove: Remove redundant use of of_match_ptr

'dove_thermal_id_table' is always compiled in and the driver
is dependent on OF. Hence use of of_match_ptr is unnecessary.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Cc: Andrew Lunn <andrew@lunn.ch>
Acked-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
9 years agoThermal: armada: Remove redundant use of of_match_ptr
Sachin Kamat [Thu, 16 May 2013 10:28:08 +0000 (10:28 +0000)]
Thermal: armada: Remove redundant use of of_match_ptr

'armada_thermal_id_table' is always compiled in and the driver
is dependent on OF. Hence use of of_match_ptr is unnecessary.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Cc: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
Acked-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
9 years agothermal: introduce TI SoC thermal driver
Eduardo Valentin [Wed, 15 May 2013 15:46:00 +0000 (15:46 +0000)]
thermal: introduce TI SoC thermal driver

This patch moves the ti-soc-thermal driver out of
the staging tree to the thermal tree.

Cc: Grant Likely <grant.likely@linaro.org>
Cc: Rob Herring <rob.herring@calxeda.com>
Cc: Rob Landley <rob@landley.net>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Zhang Rui <rui.zhang@intel.com>
Cc: Eduardo Valentin <eduardo.valentin@ti.com>
Cc: J Keerthy <j-keerthy@ti.com>
Cc: Radhesh Fadnis <radhesh.fadnis@ti.com>
Cc: Cyril Roelandt <tipecaml@gmail.com>
Cc: devicetree-discuss@lists.ozlabs.org
Cc: linux-doc@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Cc: devel@driverdev.osuosl.org
Cc: linux-pm@vger.kernel.org
Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
9 years agoThermal: don't check resource with devm_ioremap_resource
Zhang Rui [Thu, 16 May 2013 02:16:21 +0000 (02:16 +0000)]
Thermal: don't check resource with devm_ioremap_resource

devm_ioremap_resource does sanity checks on the given resource.
No need to duplicate this in the driver.

CC: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
CC: Vincenzo Frascino <vincenzo.frascino@st.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
Acked-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
9 years agoThermal: core: Ask .get_trip_temp() to register thermal zone device.
Jonghwa Lee [Sat, 18 May 2013 09:50:26 +0000 (09:50 +0000)]
Thermal: core: Ask .get_trip_temp() to register thermal zone device.

This patch adds a requirement needing .get_trip_temp() callback
function for registering thermal zone device. This function is
used when thermal zone is updated and essential where thermal core
handles thermal trip based only polling way not hw interrupt.

Signed-off-by: Jonghwa Lee <jonghwa3.lee@samsung.com>
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
Acked-by: Durgadoss R <durgadoss.r@intel.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
9 years agothermal: cut the spaces when user sets policy
Andy Shevchenko [Fri, 17 May 2013 11:52:02 +0000 (11:52 +0000)]
thermal: cut the spaces when user sets policy

Setting policy results in invalid value error.
% echo "step_wise" > policy
% echo: write error: Invalid argument

Need clean up of the buffer which "echo" may add based on the arguments, before
comparing aganist list of governor names.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reported-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Acked-by: Eduardo Valentin <eduardo.valentin@ti.com>
Tested-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
9 years agothermal: rcar: Fix typo in probe information message
Laurent Pinchart [Tue, 14 May 2013 23:00:32 +0000 (23:00 +0000)]
thermal: rcar: Fix typo in probe information message

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Acked-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
9 years agoThermal: spear_thermal: convert to devm_ioremap_resource
Zhang Rui [Thu, 16 May 2013 02:16:20 +0000 (02:16 +0000)]
Thermal: spear_thermal: convert to devm_ioremap_resource

Use the newly introduced devm_ioremap_resource().

devm_ioremap_resource() provides its own error messages; so all explicit
error messages can be removed from the failure code paths.

CC: Vincenzo Frascino <vincenzo.frascino@st.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
9 years agodrivers/thermal: don't check resource with devm_ioremap_resource
Wolfram Sang [Fri, 10 May 2013 08:17:11 +0000 (08:17 +0000)]
drivers/thermal: don't check resource with devm_ioremap_resource

devm_ioremap_resource does sanity checks on the given resource. No need to
duplicate this in the driver.

Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Acked-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
9 years agoThermal: spear: Remove redundant platform_set_drvdata()
Sachin Kamat [Fri, 3 May 2013 09:57:13 +0000 (09:57 +0000)]
Thermal: spear: Remove redundant platform_set_drvdata()

Commit 0998d06310 (device-core: Ensure drvdata = NULL when no
driver is bound) removes the need to set driver data field to
NULL.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Cc: Vincenzo Frascino <vincenzo.frascino@st.com>
Acked-by: Eduardo Valentin <eduardo.valentin@ti.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
9 years agoThermal: rcar: Remove redundant platform_set_drvdata()
Sachin Kamat [Fri, 3 May 2013 09:57:12 +0000 (09:57 +0000)]
Thermal: rcar: Remove redundant platform_set_drvdata()

Commit 0998d06310 (device-core: Ensure drvdata = NULL when no
driver is bound) removes the need to set driver data field to
NULL.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Cc: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Acked-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
9 years agoThermal: kirkwood: Remove redundant platform_set_drvdata()
Sachin Kamat [Fri, 3 May 2013 09:57:11 +0000 (09:57 +0000)]
Thermal: kirkwood: Remove redundant platform_set_drvdata()

Commit 0998d06310 (device-core: Ensure drvdata = NULL when no
driver is bound) removes the need to set driver data field to
NULL.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
Acked-by: Eduardo Valentin <eduardo.valentin@ti.com>
Acked-by: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
9 years agoThermal: exynos: Remove redundant platform_set_drvdata()
Sachin Kamat [Fri, 3 May 2013 09:57:10 +0000 (09:57 +0000)]
Thermal: exynos: Remove redundant platform_set_drvdata()

Commit 0998d06310 (device-core: Ensure drvdata = NULL when no
driver is bound) removes the need to set driver data field to
NULL.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Acked-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
9 years agoThermal: dove_thermal: Remove redundant platform_set_drvdata()
Sachin Kamat [Fri, 3 May 2013 09:57:09 +0000 (09:57 +0000)]
Thermal: dove_thermal: Remove redundant platform_set_drvdata()

Commit 0998d06310 (device-core: Ensure drvdata = NULL when no
driver is bound) removes the need to set driver data field to
NULL.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Cc: Andrew Lunn <andrew@lunn.ch>
Acked-by: Andrew Lunn <andrew@lunn.ch>
Acked-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
9 years agoThermal: armada_thermal: Remove redundant platform_set_drvdata()
Sachin Kamat [Fri, 3 May 2013 09:57:08 +0000 (09:57 +0000)]
Thermal: armada_thermal: Remove redundant platform_set_drvdata()

Commit 0998d06310 (device-core: Ensure drvdata = NULL when no
driver is bound) removes the need to set driver data field to
NULL.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Cc: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
Acked-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
Acked-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
9 years agoRevert "Thermal: exynos: Support for TMU regulator defined at device tree"
Jonghwa Lee [Fri, 1 Nov 2013 05:54:23 +0000 (14:54 +0900)]
Revert "Thermal: exynos: Support for TMU regulator defined at device tree"

This reverts commit ed58c6a559cf9a870e55587872f9b0eb322e3e6b.

9 years agommc:sdhci-s3c: Use mmc_gpio_request_cd function
Beomho Seo [Fri, 1 Nov 2013 06:17:02 +0000 (15:17 +0900)]
mmc:sdhci-s3c: Use mmc_gpio_request_cd function

This patch used mmc_gpio_request function for detect card from cd gpio pin.

Include slot-gpio header file.
Use mmc_gpio_request_cd function.
Remove sdhci_s3c_setup_card_detect_gpio/card_detect_thread functions.

Signed-off-by: Beomho Seo <beomho.seo@samsung.com>
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
9 years agotizen:config: Enable THERMAL and BOOST
Lukasz Majewski [Thu, 31 Oct 2013 17:01:29 +0000 (18:01 +0100)]
tizen:config: Enable THERMAL and BOOST

Signed-off-by: Lukasz Majewski <l.majewski@samsung.com>
9 years agoBOOST: Core code compliant with v9 of the patch
Lukasz Majewski [Thu, 31 Oct 2013 15:54:09 +0000 (16:54 +0100)]
BOOST: Core code compliant with v9 of the patch

Update the BOOST framework core to be compliant with v9 version of the patch

Signed-off-by: Lukasz Majewski <l.majewski@samsung.com>
9 years agoARM:exynos: Enable boost mode for exynos4412 redwood target
Lukasz Majewski [Mon, 10 Jun 2013 11:57:04 +0000 (13:57 +0200)]
ARM:exynos: Enable boost mode for exynos4412 redwood target

Signed-off-by: Lukasz Majewski <l.majewski@samsung.com>
9 years agocpufreq:exynos4x12: Change L0 driver data to CPUFREQ_BOOST_FREQ
Lukasz Majewski [Tue, 9 Jul 2013 07:08:43 +0000 (09:08 +0200)]
cpufreq:exynos4x12: Change L0 driver data to CPUFREQ_BOOST_FREQ

Special driver data flag (CPUFREQ_BOOST_FREQ) has been added to indicate
frequency, which can be only enabled for BOOST mode.
This frequency shall be used only for limited time, since it might cause
target device to overheat.

Signed-off-by: Lukasz Majewski <l.majewski@samsung.com>
Signed-off-by: Myungjoo Ham <myungjoo.ham@samsung.com>
Changes for v6:
- New patch