Commit graph

187 commits

Author SHA1 Message Date
Eduardo Valentin 7b73c99377 thermal: rename notify_thermal_framework to thermal_notify_framework
To follow the prefix names used by the thermal functions,
this patch renames notify_thermal_framework to thermal_notify_framework.

Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2013-04-25 00:56:16 +08:00
Eduardo Valentin 6d8d4974a2 thermal: update driver license
As per the comment at the top of this file, this is a GPLv2 driver.
This patch updates the driver license accordingly.

Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2013-04-25 00:56:12 +08:00
Eduardo Valentin c7a8b9d916 thermal: use strlcpy instead of strcpy
For memory boundaries safety, use strlcpy instead of strcpy.

Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2013-04-25 00:56:07 +08:00
Zhang Rui 335553ce40 Merge branch 'eduardo-1' of .git into next 2013-04-24 21:43:00 +08:00
Dan Carpenter 4f89038f17 Thermal: cpufreq cooling: endian bug in cpufreq_get_max_state()
This code doesn't work on big endian systems because we're storing low
values in the high bits of the unsigned long.  It makes it a very high
value instead.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2013-04-17 23:43:31 +08:00
Eduardo Valentin 837b26bb2e thermal: expose thermal_zone_get_temp API
This patch exports the thermal_zone_get_temp API so that driver
writers can fetch temperature of thermal zones managed by other
drivers.

Acked-by: Durgadoss R <durgadoss.r@intel.com>
Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2013-04-15 09:39:02 +08:00
Eduardo Valentin 63c4d919cf thermal: introduce thermal_zone_get_zone_by_name helper function
This patch adds a helper function to get a reference of
a thermal zone, based on the zone type name.

It will perform a zone name lookup and return a reference
to a thermal zone device that matches the name requested.
In case the zone is not found or when several zones match
same name or if the required parameters are invalid, it will return
the corresponding error code (ERR_PTR).

Cc: Durgadoss R <durgadoss.r@intel.com>
Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Acked-by: Durgadoss R <durgadoss.r@intel.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2013-04-15 09:34:28 +08:00
Zhang Rui d13cb03aef Merge branch 'thermal' of git://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux into next
Conflicts:
	drivers/thermal/cpu_cooling.c
2013-04-15 09:26:58 +08:00
Zhang Rui bbf7fc88c7 Thermal: build cpu_cooling code into thermal_sys module
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
Acked-by: Eduardo Valentin <eduardo.valentin@ti.com>
Acked-by: Durgadoss R <durgadoss.r@intel.com>
2013-04-14 23:28:49 +08:00
Zhang Rui 80a26a5c22 Thermal: build thermal governors into thermal_sys module
The thermal governors are part of the thermal framework,
rather than a seperate feature/module.
Because the generic thermal layer can not work without
thermal governors, and it must load the thermal governors
during its initialization.

Build them into one module in this patch.

This also fix a problem that the generic thermal layer does not
work when CONFIG_THERMAL=m and CONFIG_THERMAL_GOV_XXX=y.

Signed-off-by: Zhang Rui <rui.zhang@intel.com>
Acked-by: Eduardo Valentin <eduardo.valentin@ti.com>
Acked-by: Durgadoss R <durgadoss.r@intel.com>
2013-04-14 23:28:43 +08:00
Zhang Rui 5fc024ab47 Thermal: rename thermal_sys.c to thermal_core.c
this is the preparation work to build all the thermal core framework
source file, like governors, cpu cooling, etc, into one module.

No functional change in this patch.

Signed-off-by: Zhang Rui <rui.zhang@intel.com>
Acked-by: Eduardo Valentin <eduardo.valentin@ti.com>
Acked-by: Durgadoss R <durgadoss.r@intel.com>
2013-04-14 02:14:12 +08:00
Arnd Bergmann 841d481b3c Thermal: exynos: remove unnecessary header inclusions
In multiplatform configurations, we cannot include headers
provided by only the exynos platform. Fortunately a number
of drivers that include those headers do not actually need
them, so we can just remove the inclusions.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Cc: linux-pm@vger.kernel.org
Acked-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2013-04-12 07:24:19 +08:00
Andrew Bresticker e79fe642cc thermal: step_wise: set throttle target within thermal instance limits
When selecting a target cooling state in get_target_state(), make sure
that the state is at least as high as the minimum when the temperature
is rising and at least as low as the maximum when the temperature is
falling.  This is necessary because, in the THREAML_TREND_RAISING and
THERMAL_TREND_DROPPING cases, the current state may only be incremented
or decremented by one even if it is outside the bounds of the thermal
instance.  This might occur, for example, if the CPU is heating up
and hits a thermal trip point for the first time when it's frequency
is much higher than the range specified by the thermal instance
corresponding to the trip point.

Signed-off-by: Andrew Bresticker <abrestic@chromium.org>
Acked-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2013-04-12 07:23:50 +08:00
Eduardo Valentin 8837295a73 thermal: add a warning for temperature emulation feature
Because this feature is for debuging purposes, it is highly
recommended to do not enable this on production systems.
This patch adds warnings for system integrators, so that
people are aware of this potential security issue.

Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2013-04-02 21:34:42 +08:00
Amit Daniel Kachhap bffd1f8ac8 thermal: exynos: Adapt to temperature emulation core thermal framework
This removes the driver specific sysfs support of the temperature
emulation and uses the newly added core thermal framework for thermal
emulation. An exynos platform specific handler is added to support this.

In this patch, the exynos senor(tmu) related code and exynos framework
related (thermal zone, cooling devices) code are intentionally kept separate.
So an emulated function pointer is passed from sensor to framework. This is
beneficial in adding more sensor support using the same framework code
which is an ongoing work. The goal is to finally split them totally. Even
the existing read_temperature also follows the same execution method.

Acked-by: Kukjin Kim <kgene.kim@samsung.com>
Signed-off-by: Amit Daniel Kachhap <amit.daniel@samsung.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2013-04-02 21:29:54 +08:00
Kuninori Morimoto 51d45d2594 thermal: rcar: add pm_runtime_xxx() support
Current rcar_thermal() didn't care about own power.
Without this patch, rcar_thermal doesn't work on APE6 board

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2013-04-02 21:18:39 +08:00
Kuninori Morimoto 1dc20828e6 thermal: rcar: tidyup registration failure case
Current rcar_thermal driver didn't care about rcar_theraml_irq_disable()
when registration failure case on _probe(), and _remove().
And, it returns without unregistering thermal zone when
registration failure case on _probe().
This patch fixes these issue.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2013-04-02 21:15:04 +08:00
Ezequiel Garcia fa0d654c84 thermal: Add driver for Armada 370/XP SoC thermal management
This driver supports both Armada 370 and Armada XP SoC
thermal management controllers.

Armada 370 has a register to check a valid temperature, whereas
Armada XP does not. Each has a different initialization (i.e. calibration)
function. The temperature conversion formula is the same for both.

The controller present in each SoC have a very similar feature set,
so it corresponds to have one driver to support both of them.

Although this driver may present similarities to Dove and Kirkwood
thermal driver, the exact differences and coincidences are not fully
known. For this reason, support is given through a separate driver.

Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2013-04-02 21:04:09 +08:00
Ezequiel Garcia 2fd1db8819 thermal: dove: Fix thermal sensor formula
The currently formula has been taken from the 88AP510 SoC datasheet,
which is not exactly correct. The correct value for the temperature
in Celcius of the sensor present in this SoC is:

  Celsius = (322-reg)/1.3625

Signed-off-by: Lior Amsalem <alior@marvell.com>
Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
Acked-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2013-03-26 22:13:10 +08:00
Ezequiel Garcia 696b6075af thermal: kirkwood: Fix thermal sensor formula
The currently formula has been taken from the 88AP510 SoC datasheet,
which is not exactly correct. The correct value for the temperature
in Celcius of the sensor present in this SoC is:

  Celsius = (322-reg)/1.3625

Signed-off-by: Lior Amsalem <alior@marvell.com>
Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
Acked-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2013-03-26 22:12:20 +08:00
Ezequiel Garcia 02519d3397 thermal: kirkwood: Fix valid check for thermal register
The correct value is obtain by first shifting the register by the offset,
later applying the valid mask and finally invert the result.
This check was lacking an extra parenthesis to be strictly correct.

Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2013-03-26 22:09:14 +08:00
Axel Lin 4c7fa83aa5 thermal: db8500: Fix missing mutex_unlock() in probe error paths
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2013-03-26 22:08:08 +08:00
Axel Lin f534e9bf80 thermal: db8500: Fix checking return value of thermal_zone_device_register
thermal_zone_device_register() returns ERR_PTR on error, thus use
IS_ERR rather than IS_ERR_OR_NULL to check return value.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2013-03-26 22:07:52 +08:00
Laurent Navet [Mali] bde0066309 drivers: thermal: cpu_cooling: fix checkpatch warning
- WARNING: Avoid CamelCase: <maskPtr>

Signed-off-by: Laurent Navet <laurent.navet@gmail.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2013-03-26 17:26:19 +08:00
Zhang Rui 57df810693 Thermal: exynos: fix cooling state translation
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
Tested-by: Amit Daniel kachhap <amit.daniel@samsung.com>
2013-03-26 14:33:50 +08:00
Zhang Rui fc35b35cbe Thermal: cpufreq cooling: fix parsing per_cpu cpufreq_frequency_table
cpufreq cooling uses different frequencies as different cooling states.

But the per_cpu cpufreq_frequency_table may contain duplicate,
invalid entries, and it may be in either ascending or descending order.
And currently, code for parsing the per_cpu cpufreq_frequency_table
is used in several places and inconsistent.

Now introduce new code to
1. get the maximum cooling states
2. translate cooling state to cpu frequency
3. translate cpu frequency to cooling state
in one place,
with the correct logic of handling per_cpu cpufreq_frequency_table.

Signed-off-by: Zhang Rui <rui.zhang@intel.com>
Tested-by: Amit Daniel kachhap <amit.daniel@samsung.com>
2013-03-26 14:33:43 +08:00
Devendra Naga 043e4652bf thermal: exynos_thermal: return a proper error code while thermal_zone_device_register fail.
we are returning EINVAL while the thermal_zone_device_register function fail.
instead we can use the return value from the thermal_zone_device_register by
using PTR_ERR.

Signed-off-by: Devendra Naga <devendra.aaru@gmail.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2013-03-11 23:09:29 +08:00
Devendra Naga fb84d9907f thermal: rcar_thermal: propagate return value of thermal_zone_device_register
thermal_zone_device_register returns a value contained in the pointer itself
use PTR_ERR to obtain the address and return it at the end.

Signed-off-by: Devendra Naga <devendra.aaru@gmail.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2013-03-11 23:09:24 +08:00
Sachin Kamat aa3b5d222d Thermal: kirkwood: Convert to devm_ioremap_resource()
Use the newly introduced devm_ioremap_resource() instead of
devm_request_and_ioremap() which provides more consistent error handling.

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

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
Reviewed-by: Thierry Reding <thierry.reding@avionic-design.de>
Acked-by: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2013-03-11 23:09:18 +08:00
Sachin Kamat 5095526faf Thermal: rcar: Convert to devm_ioremap_resource()
Use the newly introduced devm_ioremap_resource() instead of
devm_request_and_ioremap() which provides more consistent error handling.

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

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Cc: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Thierry Reding <thierry.reding@avionic-design.de>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2013-03-11 23:09:12 +08:00
Sachin Kamat 6bc51b6622 Thermal: dove: Convert to devm_ioremap_resource()
Use the newly introduced devm_ioremap_resource() instead of
devm_request_and_ioremap() which provides more consistent error handling.

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

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Cc: Andrew Lunn <andrew@lunn.ch>
Reviewed-by: Thierry Reding <thierry.reding@avionic-design.de>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2013-03-11 23:09:02 +08:00
Wei Yongjun f0e68fc3ca thermal: rcar: fix missing unlock on error in rcar_thermal_update_temp()
Add the missing unlock before return from function rcar_thermal_update_temp()
in the error handling case.

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2013-03-11 23:08:33 +08:00
Linus Torvalds 19cc90f58d Fix mis-merge of intel_powerclamp.c resulting in compile error
The new intel_powerclamp thermal cooling device driver was merged in
commit 2af78448ff (Pull thermal management updates from Zhang Rui)
without any data conflicts.  But there was a more subtle conflict I
missed: the driver uses MAX_USER_RT_PRIO, but commit 8bd75c77b7
("sched/rt: Move rt specific bits into new header file") had moved that
define from <linux/sched.h> to <linux/sched/rt.h>.

Which caused this build failure:

  drivers/thermal/intel_powerclamp.c: In function ‘clamp_thread’:
  drivers/thermal/intel_powerclamp.c:360:21: error: ‘MAX_USER_RT_PRIO’ undeclared (first use in this function)
  drivers/thermal/intel_powerclamp.c:360:21: note: each undeclared identifier is reported only once for each function it appears in

And because I don't do a full "make allmodconfig" build after each pull,
I didn't notice until too late.  So now the fix is here, separately from
the merge commit.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2013-02-28 20:23:09 -08:00
Linus Torvalds 2af78448ff Merge branch 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux
Pull thermal management updates from Zhang Rui:
 "Highlights:

   - introduction of Dove thermal sensor driver.

   - introduction of Kirkwood thermal sensor driver.

   - introduction of intel_powerclamp thermal cooling device driver.

   - add interrupt and DT support for rcar thermal driver.

   - add thermal emulation support which allows platform thermal driver
     to do software/hardware emulation for thermal issues."

* 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux: (36 commits)
  thermal: rcar: remove __devinitconst
  thermal: return an error on failure to register thermal class
  Thermal: rename thermal governor Kconfig option to avoid generic naming
  thermal: exynos: Use the new thermal trend type for quick cooling action.
  Thermal: exynos: Add support for temperature falling interrupt.
  Thermal: Dove: Add Themal sensor support for Dove.
  thermal: Add support for the thermal sensor on Kirkwood SoCs
  thermal: rcar: add Device Tree support
  thermal: rcar: remove machine_power_off() from rcar_thermal_notify()
  thermal: rcar: add interrupt support
  thermal: rcar: add read/write functions for common/priv data
  thermal: rcar: multi channel support
  thermal: rcar: use mutex lock instead of spin lock
  thermal: rcar: enable CPCTL to use hardware TSC deciding
  thermal: rcar: use parenthesis on macro
  Thermal: fix a build warning when CONFIG_THERMAL_EMULATION cleared
  Thermal: fix a wrong comment
  thermal: sysfs: Add a new sysfs node emul_temp for thermal emulation
  PM: intel_powerclamp: off by one in start_power_clamp()
  thermal: exynos: Miscellaneous fixes to support falling threshold interrupt
  ...
2013-02-28 19:48:26 -08:00
Tejun Heo 6deb69face thermal: convert to idr_alloc()
Convert to the much saner new idr interface.

Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Zhang Rui <rui.zhang@intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2013-02-27 19:10:19 -08:00
Arnd Bergmann f5b6d45f8c thermal: rcar: remove __devinitconst
commit 76cc18874 "thermal: rcar: add Device Tree support"
added device tree support for this driver, but also added
an instance of __devinitconst, which is no longer defined

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Cc: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Cc: Zhang Rui <rui.zhang@intel.com>
2013-02-22 17:38:40 +08:00
Richard Guy Briggs da28d966f6 thermal: return an error on failure to register thermal class
The return code from the registration of the thermal class is used to
unallocate resources, but this failure isn't passed back to the caller of
thermal_init.  Return this failure back to the caller.

This bug was introduced in changeset 4cb18728 which overwrote the return code
when the variable was re-used to catch the return code of the registration of
the genetlink thermal socket family.

Signed-off-by: Richard Guy Briggs <rbriggs@redhat.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2013-02-22 17:38:40 +08:00
Zhang Rui 9d185d0417 Thermal: rename thermal governor Kconfig option to avoid generic naming
Currently, we have three Kconfig options for thermal governors, aka,
CONFIG_FAIR_SHARE, CONFIG_USER_SPACE and CONFIG_STEP_WISE.
But these names are too generic that may bring confusion to users.

Rename them to CONFIG_THERMAL_GOV_FAIR_SHARE,
CONFIG_THERMAL_GOV_USER_SPACE, CONFIG_THERMAL_GOV_STEP_WISE
to avoid the generic naming.

Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2013-02-08 20:33:42 +08:00
Amit Daniel Kachhap ce760ed3f4 thermal: exynos: Use the new thermal trend type for quick cooling action.
This patch uses the quick thermal cooling trend type macros. This is needed
as exynos5 and other thermal sensors now supports only interrupt method for
thresold temperature check.

Acked-by: Kukjin Kim <kgene.kim@samsung.com>
Signed-off-by: Amit Daniel Kachhap <amit.daniel@samsung.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2013-02-08 20:26:14 +08:00
Jonghwa Lee 4f0a684781 Thermal: exynos: Add support for temperature falling interrupt.
This patch introduces using temperature falling interrupt in exynos
thermal driver. Former patch, it only use polling way to check
whether if system themperature is fallen. However, exynos SOC also
provides temperature falling interrupt way to do same things by hw.
This feature is not supported in exynos4210.

Acked-by: Kukjin Kim <kgene.kim@samsung.com>
Signed-off-by: Jonghwa Lee <jonghwa3.lee@samsung.com>
Signed-off-by: Amit Daniel Kachhap <amit.daniel@samsung.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2013-02-08 20:26:07 +08:00
Andrew Lunn 74ffa64c23 Thermal: Dove: Add Themal sensor support for Dove.
The Marvell Dove SoC has a thermal sensor. Add a driver using the
thermal framework.

Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2013-02-08 20:26:02 +08:00
Nobuhiro Iwamatsu 7060aa3664 thermal: Add support for the thermal sensor on Kirkwood SoCs
This patch adds support for Kirkwood 88F6282 and 88F6283 thermal sensor.

Signed-off-by: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2013-02-08 20:25:56 +08:00
Kuninori Morimoto 76cc188749 thermal: rcar: add Device Tree support
Support for loading the Renesas R-Car thermal module via devicetree.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2013-02-08 20:25:36 +08:00
Kuninori Morimoto e6e053f4e4 thermal: rcar: remove machine_power_off() from rcar_thermal_notify()
Machine/System power-off is run in thermal frame work if
it become critical temperature.
This patch removed pointless machine_power_off()
from thermal_zone_device_ops :: .notify

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2013-02-06 14:13:59 +08:00
Kuninori Morimoto e0a5172e9e thermal: rcar: add interrupt support
This patch adds interrupt support for R-Car thermal driver.

New generation R-Car thermal sensor interrupt controller was
different from old generation.
This patch supports new generation sensor only,
since the old generation interrupt controller had never been used before,
and will never be used in the future.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2013-02-06 14:13:59 +08:00
Kuninori Morimoto e9137a582f thermal: rcar: add read/write functions for common/priv data
R-Car thermal driver will use struct common in next
feature (interrupt support).
But the register address is different between struct priv and common.
This patch adds read/write functions for struct common,
and use macro technique to avoid wrong register access.

This is preparation patch for next feature (interrupt support),
therefore, there is no user to use this common read/write
function at this point.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2013-02-06 14:13:58 +08:00
Kuninori Morimoto 3676d1dd3d thermal: rcar: multi channel support
R-Car thermal sensor will be multi channel sensor in next generation.
But "IRQ controlling method" and "register mapping" are
different between old/new chip.

This patch adds multi sensor support.
Then, this driver assumes there is common register
if platform has IRQ resource.

The IRQ will be supported soon.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2013-02-06 14:13:58 +08:00
Kuninori Morimoto b2bbc6a2ac thermal: rcar: use mutex lock instead of spin lock
Current R-Car thermal driver is using spin lock for each
registers read/write, but it is pointless lock.
This lock is required while reading temperature,
but it needs long wait (= 300ms).
So, this patch used mutex lock while reading temperature,
instead of spin lock for each registers.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2013-02-06 14:13:57 +08:00
Kuninori Morimoto f8f53e1874 thermal: rcar: enable CPCTL to use hardware TSC deciding
If CPCTL was 1 on R-Car thermal, the thermal comparator offset
is automatically decided by hardware.
And this CPCTL is the conditions which validate interrupt.
This patch enabled CPCTL.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2013-02-06 14:13:57 +08:00
Kuninori Morimoto 9dde8f8608 thermal: rcar: use parenthesis on macro
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2013-02-06 14:13:57 +08:00