platform/kernel/linux-3.10.git
9 years agopinctrl: exynos: ack level-triggered interrupts before unmasking
Doug Anderson [Mon, 17 Jun 2013 16:50:43 +0000 (09:50 -0700)]
pinctrl: exynos: ack level-triggered interrupts before unmasking

A level-triggered interrupt should be acked after the interrupt line
becomes inactive and before it is unmasked, or else another interrupt
will be immediately triggered.  Acking before or after calling the
handler is not enough.

Change-Id: I553444ce552df5722e606d71bea8bf7b862cce25
Signed-off-by: Luigi Semenzato <semenzato@chromium.org>
Signed-off-by: Doug Anderson <dianders@chromium.org>
Acked-by: Tomasz Figa <t.figa@samsung.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
9 years agopinctrl: exynos: reorder xyz_irq_unmask() so future patch can ack
Doug Anderson [Wed, 12 Jun 2013 17:33:18 +0000 (10:33 -0700)]
pinctrl: exynos: reorder xyz_irq_unmask() so future patch can ack

This patch does nothing but reorder the functions to improve the
readability of a future patch.

Change-Id: Ia70d2969d88f6b4579617209be1cedbbf6bbc26c
Signed-off-by: Doug Anderson <dianders@chromium.org>
Acked-by: Tomasz Figa <t.figa@samsung.com>
Acked-by: Kukjin Kim <kgene.kim@samsung.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
9 years agopinctrl: exynos: Add spinlocks to irq_mask and irq_unmask
Doug Anderson [Wed, 12 Jun 2013 17:33:17 +0000 (10:33 -0700)]
pinctrl: exynos: Add spinlocks to irq_mask and irq_unmask

The patch:
  1984695 pinctrl: samsung: Protect bank registers with a spinlock

...added spinlocks to protect many accesses.  However, the irq_mask
and irq_unmask functions still do an unprotected read/modify/write.
Add the spinlock there.

Change-Id: I892cfcd82368466184b99eab75d2bc7882674211
Signed-off-by: Doug Anderson <dianders@chromium.org>
Acked-by: Tomasz Figa <t.figa@samsung.com>
Acked-by: Kukjin Kim <kgene.kim@samsung.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
9 years agodts: exynos4x12: fix clock properties.
Beomho Seo [Mon, 9 Dec 2013 10:43:06 +0000 (19:43 +0900)]
dts: exynos4x12: fix clock properties.

This patch fix incorrect clock properties.
And then, move fixed clock properties to
exynos4x12.dtsi to avoid further duplication of broken properties.

Change-Id: Ib980422ad67af8dc2493f1886f6e26f23b451d12
Signed-off-by: Beomho Seo <beomho.seo@samsung.com>
9 years agommc: sdhci-s3c: sdhci-s3c driver use sdhci-pltfm
Beomho Seo [Wed, 4 Dec 2013 10:46:44 +0000 (19:46 +0900)]
mmc: sdhci-s3c: sdhci-s3c driver use sdhci-pltfm

This patch revised to use sdhci-pltfm.

Change-Id: Ib11e5a4005aa7c78261c12e7c8df027acd71575e
Signed-off-by: Beomho Seo <beomho.seo@samsung.com>
9 years agomfd: max77693: Fix mapping IRQ during mask/unmask
Krzysztof Kozlowski [Tue, 3 Dec 2013 14:49:13 +0000 (15:49 +0100)]
mfd: max77693: Fix mapping IRQ during mask/unmask

Use hwirq in max77693_irq_mask() and max77693_irq_unmask() for accessing
irq array. Previously the virtual irq was used which resulted in
out-of-bounds access.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Change-Id: I6e2e6751d07427072e90d9f4dfef921108485f29

9 years agommc: sdhci-pltfm: Use devm_ioremap_resource()
Beomho Seo [Tue, 3 Dec 2013 08:25:13 +0000 (17:25 +0900)]
mmc: sdhci-pltfm: Use devm_ioremap_resource()

This patch devm_ioremap_resource for replace request region and ioremap.

Change-Id: I6b63e1db0d0c9d6d8cf89a93d57db0b253418e3a
Signed-off-by: Beomho Seo <beomho.seo@samsung.com>
9 years agovideo: display: panel-s6e8aa0: Use devm_kzalloc to allocate driver data
Tomasz Figa [Mon, 4 Nov 2013 15:38:47 +0000 (16:38 +0100)]
video: display: panel-s6e8aa0: Use devm_kzalloc to allocate driver data

This fixes memory leak on probe error path.

Change-Id: Ibea51282dee8139a85764f39e7c894a94036f0cf
Signed-off-by: Tomasz Figa <t.figa@samsung.com>
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
9 years agovideo: display: panel-s6d6aa1: Use devm_kzalloc to allocate driver data
Tomasz Figa [Mon, 4 Nov 2013 15:38:47 +0000 (16:38 +0100)]
video: display: panel-s6d6aa1: Use devm_kzalloc to allocate driver data

This fixes memory leak on probe error path.

Change-Id: Iafc7a9920869e59d792c480770dcb07507a998da
Signed-off-by: Tomasz Figa <t.figa@samsung.com>
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
9 years agoEnable RTC chips on M0 devices
Łukasz Stelmach [Wed, 27 Nov 2013 15:25:27 +0000 (16:25 +0100)]
Enable RTC chips on M0 devices

Change-Id: Ide6d17af6d026230c48bededf32e8f15ca41b8e4
Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
9 years agoInclude kernel configuration in kernel image
Łukasz Stelmach [Wed, 27 Nov 2013 14:59:56 +0000 (15:59 +0100)]
Include kernel configuration in kernel image

Enable IKCONFIG and IKCONFIG_PROC to include the configuration of the
kernel in the image and export it via /proc/config.gz.

Change-Id: I868ba4cabd4a1517b625e81037d7758651dfa4b4
Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
9 years agoUSB: gadget: s3c-hsotg: fix disconnect handling
Robert Baldyga [Thu, 14 Nov 2013 11:10:20 +0000 (12:10 +0100)]
USB: gadget: s3c-hsotg: fix disconnect handling

This patch moves s3c_hsotg_disconnect function call from USBSusp interrupt
handler to SET_ADDRESS request handler.

It's because disconnected state can't be detected directly, because this
hardware doesn't support Disconnected interrupt for device mode. For both
Suspend and Disconnect events there is one interrupt USBSusp, but calling
s3c_hsotg_disconnect from this interrupt handler causes config reset in
composite layer, which is not undesirable for Suspended state.

For this reason s3c_hsotg_disconnect is called from SET_ADDRESS request
handler, which occurs always after disconnection, so we do disconnect
immediately before we are connected again. It's probably only way we
can do handle disconnection correctly.

Change-Id: I8e69b532077c6ad76489e70fcc3f8d525fe75cf3
Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
9 years agoUSB: gadget: s3c-hsotg: fix spinlock locking
Robert Baldyga [Thu, 14 Nov 2013 11:07:29 +0000 (12:07 +0100)]
USB: gadget: s3c-hsotg: fix spinlock locking

This patch adds missing spinlock locking in s3c_hsotg_complete_setup function,
and unlocking for gadget setup call.

Change-Id: I73dc683a9df16872d9d6ba2b6b7c98a48418c500
Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
9 years agoarch: ARM: dts: add support for exynos4210-usbphy driver to trats
Andrzej Hajda [Tue, 15 Oct 2013 08:45:34 +0000 (10:45 +0200)]
arch: ARM: dts: add support for exynos4210-usbphy driver to trats

Change-Id: I9758e15225e86050b62068b1156709a71799e4f1
Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
9 years agogpu: arm: mali400: support gpu frequency profiling
Chanho Park [Mon, 25 Nov 2013 02:52:04 +0000 (11:52 +0900)]
gpu: arm: mali400: support gpu frequency profiling

This patch supports gpu frequency profiling by using ARM streamline.
You must turn on below configuration if you want to get a profiling data.

CONFIG_MALI400_PROFILING
CONFIG_MALI400_INTERNAL_PROFILING

Change-Id: Id8cc59b80dcf4483cc5944283fc95daaca6f0839
Signed-off-by: Chanho Park <chanho61.park@samsung.com>
9 years agotizen: update default config to use slp gadget
Chanho Park [Fri, 22 Nov 2013 10:11:44 +0000 (19:11 +0900)]
tizen: update default config to use slp gadget

The Tizen uses slp composite gadget which is based on android gadget.
Until we migrate to configfs based gadget configuration, we should use the slp
gadget. It only support sdb and rndis gadget.

Change-Id: I9e7afd3ef9865d43d43d2221b30b7b10ef039399
Signed-off-by: Chanho Park <chanho61.park@samsung.com>
9 years agoupdate linux-kernel.spec file to fix build problems.
Karol Lewandowski [Tue, 29 Oct 2013 13:00:53 +0000 (14:00 +0100)]
update linux-kernel.spec file to fix build problems.

The following changes have been implemented:
1. kernel-source package
2. kernel-build package
3. linux-kernel package
4. add kernel configuration name and abi version to output names.

Change-Id: I95479b660dda8a18f3e8f32c20fcbfbab8ab6000
Signed-off-by: Jacek Pielaszkiewicz <j.pielaszkie@samsung.com>
9 years agomali: Support build to different objdir (O=...).
Karol Lewandowski [Thu, 31 Oct 2013 18:56:58 +0000 (19:56 +0100)]
mali: Support build to different objdir (O=...).

Change-Id: I3b76381af1ec083c41e321e55c10eb1e75e42155
Signed-off-by: Karol Lewandowski <k.lewandowsk@samsung.com>
Signed-off-by: Jacek Pielaszkiewicz <j.pielaszkie@samsung.com>
9 years agopackaging: Bump version
Karol Lewandowski [Tue, 29 Oct 2013 13:00:53 +0000 (14:00 +0100)]
packaging: Bump version

Modified version number, again.

Change-Id: Idf67ccbf9c36030644be6c6f76f5fe0e2b857246
Signed-off-by: Karol Lewandowski <k.lewandowsk@samsung.com>
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
9 years agogpu: arm: mali400: ump: Fix svn revision check
Nikita Kalyazin [Thu, 14 Nov 2013 05:05:32 +0000 (09:05 +0400)]
gpu: arm: mali400: ump: Fix svn revision check

Change-Id: Ic5a3d69518be56a800d4233a48ba8bb719e67c52
Signed-off-by: Nikita Kalyazin <n.kalyazin@samsung.com>
9 years agommc: sdhci-s3c: Add irq_set_wake function
Beomho Seo [Tue, 12 Nov 2013 07:36:22 +0000 (16:36 +0900)]
mmc: sdhci-s3c: Add irq_set_wake function

- Add irq_set_irq_wake function for control irq
- Remove unused variables

Signed-off-by: Beomho Seo <beomho.seo@samsung.com>
9 years agocpufreq: lab: Fix codes for correct working of lab governor.
Jonghwa Lee [Mon, 11 Nov 2013 08:29:24 +0000 (17:29 +0900)]
cpufreq: lab: Fix codes for correct working of lab governor.

- Modify typo in lab govnernor.
- Remove deadlock in lab governor which is occured when it enables
  overclocking
- Add initialization of LAB's data to cpufreq_governor driver

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

drivers/cpufreq/cpufreq_governor.c

Resolved-by: MyungJoo Ham <myungjoo.ham@samsung.com>
9 years agocpufreq: exysnos: Fix the way of enabling boost in exynos cpufreq driver.
Jonghwa Lee [Fri, 8 Nov 2013 08:53:46 +0000 (17:53 +0900)]
cpufreq: exysnos: Fix the way of enabling boost in exynos cpufreq driver.

Follow the codes from ML.

Signed-off-by: Jonghwa Lee <jonghwa3.lee@samsung.com>
9 years agocpufreq: lab: Enable overclocking in LAB
Jonghwa Lee [Fri, 8 Nov 2013 08:40:25 +0000 (17:40 +0900)]
cpufreq: lab: Enable overclocking in LAB

Overclocking is always on for LAB governor's working.

Signed-off-by: Jonghwa Lee <jonghwa3.lee@samsung.com>
9 years agocpufreq:LAB: Introduce new cpufreq LAB(Legaccy Application Boost) governor
Jonghwa Lee [Fri, 8 Nov 2013 07:20:45 +0000 (16:20 +0900)]
cpufreq:LAB: Introduce new cpufreq LAB(Legaccy  Application Boost) governor

This patch introduces new cpufreq governor named 'LAB'.
LAB governor will use scheduler, per-CPU information to determine how many
CPUs are in busy now. As a result the number of idle CPUs is calculated
for current load (digital low pass filtering is used to provide more stable
results). It will determine next frequency.

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

drivers/cpufreq/cpufreq_governor.c
Resolved-by: MyungJoo Ham <myungjoo.ham@samsung.com>
9 years agocpufreq : M0: Allow sailable frequency up to 1.4Ghz @ M0
Jonghwa Lee [Fri, 8 Nov 2013 01:51:00 +0000 (10:51 +0900)]
cpufreq : M0: Allow sailable frequency up to 1.4Ghz @ M0

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

9 years agoconfig: tizen: Enable CONFIG_BRCMFMAC for supporting WIFI on M0
Jonghwa Lee [Thu, 7 Nov 2013 07:51:07 +0000 (16:51 +0900)]
config: tizen: Enable CONFIG_BRCMFMAC for supporting WIFI on M0

Signed-off-by: Jonghwa Lee <jonghwa3.lee@samsung.com>
9 years agommc: sdhci-s3c: Revised sdhci_s3c_remove function.
Beomho Seo [Tue, 5 Nov 2013 11:51:00 +0000 (20:51 +0900)]
mmc: sdhci-s3c: Revised sdhci_s3c_remove function.

Remove "return ret;" from "err_req_cd:".
Revised sdhci_s3c_remove function.

Signed-off-by: Beomho Seo <beomho.seo@samsung.com>
9 years agoarm: Thumb=>ARM signal handling setup skips the a few instructions on Snapdragon...
T.J. Purtell [Tue, 5 Nov 2013 07:52:10 +0000 (16:52 +0900)]
arm: Thumb=>ARM signal handling setup skips the a few instructions on Snapdragon S4/Krait

The Thumb instruction set include an If-Then instruction.  If an ARM
function is registered as a signal handler, and that signal is
delivered inside the block of instructions follow the IT instruction,
some of the instructions at the beginning of the signal handler are
skipped.  This occurs because the IT state bits of the Program Status
Register are not cleared by the kernel.

The ARM architecture reference specifies that the IT state bits in the
PSR must be all zeros in ARM mode or behavior is unspecified.  On the
Qualcomm Snapdragon S4/Krait architecture CPUs the processor continues
to consider the IT state bits while in ARM mode.  This makes it so
that some instructions are skipped by the CPU.

The relevant clipping of the ARM architecture  document is available
here: https://www.dropbox.com/s/6hpwey3kklw20c1/ITState-ARM-Architecture.pdf

This manifests itself in code that uses a lot of signal handling
concurrently with complicated logic code compiled for thumb when the
signal handler compiled as ARM code.  One example is the mono runtime.
 It uses a signal based mechanism to perform stop the world operation
needed by its garbage collector.  It is compiled for ARM and generates
ARM code, however, bionic (libc for android) is compiled for thumb.
During a test case involving native allocation in parallel with
garbage collection (signal handling), we found that the test case
would crash only when running on a Krait architecture CPU.  We found
the preceding instructions before the signal to always point to
something inside an IT sequence, in this case the logic in the dlfree
merging of free heap blocks.  After adding a sequence of NOPs to the
beginning of the signal handlers, the problem disappeared.  We applied
the attached patch to the kernel on one of the Krait devices and found
that it also alleviated the crashes.

The patch simply clears the IT State bits regardless of if the signal
handler is an ARM/Thumb function.  It also includes the same fix
applied to the arm64 compat handler.

Signed-off-by: T.J. Purtell <tj@mobisocial.us>
9 years agopwm: samsung: memory leak bugfix in pwm_samsung_free
Sangjung Woo [Tue, 5 Nov 2013 02:08:34 +0000 (11:08 +0900)]
pwm: samsung: memory leak bugfix in pwm_samsung_free

There is certainly a kind of memory leak since allocated data (i.e.
chip_data) is set NULL before freeing it by calling devm_kfree().This
patch fixes the memory leak bug by modifying its call order.

Signed-off-by: Sangjung Woo <sangjung.woo@samsung.com>
Reviewed-by: Jonghwa Lee <jonghwa3.lee@samsung.com>
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>