aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/thermal/exynos_thermal.c
diff options
context:
space:
mode:
authorAmit Daniel Kachhap <amit.daniel@samsung.com>2013-01-16 20:42:18 -0500
committerZhang Rui <rui.zhang@intel.com>2013-02-06 00:45:19 -0500
commit3ad9524a15126c24fc37922f56a0fb5dd03c218f (patch)
tree6498afc97dddff0db4cbb8c78b84fbacd5cf20f4 /drivers/thermal/exynos_thermal.c
parentd6d71ee4a14ae602db343ec48c491851d7ec5267 (diff)
thermal: exynos: Miscellaneous fixes to support falling threshold interrupt
Below fixes are done to support falling threshold interrupt, * Falling interrupt status macro corrected according to exynos5 data sheet. * The get trend function modified to calculate trip temperature correctly. * The clearing of interrupt status in the isr is now done after handling the event that caused the interrupt. Signed-off-by: Amit Daniel Kachhap <amit.daniel@samsung.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
Diffstat (limited to 'drivers/thermal/exynos_thermal.c')
-rw-r--r--drivers/thermal/exynos_thermal.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/drivers/thermal/exynos_thermal.c b/drivers/thermal/exynos_thermal.c
index 327102a4596a..cd71e24194b1 100644
--- a/drivers/thermal/exynos_thermal.c
+++ b/drivers/thermal/exynos_thermal.c
@@ -82,7 +82,7 @@
82 82
83#define EXYNOS_TRIMINFO_RELOAD 0x1 83#define EXYNOS_TRIMINFO_RELOAD 0x1
84#define EXYNOS_TMU_CLEAR_RISE_INT 0x111 84#define EXYNOS_TMU_CLEAR_RISE_INT 0x111
85#define EXYNOS_TMU_CLEAR_FALL_INT (0x111 << 16) 85#define EXYNOS_TMU_CLEAR_FALL_INT (0x111 << 12)
86#define EXYNOS_MUX_ADDR_VALUE 6 86#define EXYNOS_MUX_ADDR_VALUE 6
87#define EXYNOS_MUX_ADDR_SHIFT 20 87#define EXYNOS_MUX_ADDR_SHIFT 20
88#define EXYNOS_TMU_TRIP_MODE_SHIFT 13 88#define EXYNOS_TMU_TRIP_MODE_SHIFT 13
@@ -370,7 +370,14 @@ static int exynos_get_temp(struct thermal_zone_device *thermal,
370static int exynos_get_trend(struct thermal_zone_device *thermal, 370static int exynos_get_trend(struct thermal_zone_device *thermal,
371 int trip, enum thermal_trend *trend) 371 int trip, enum thermal_trend *trend)
372{ 372{
373 if (thermal->temperature >= trip) 373 int ret;
374 unsigned long trip_temp;
375
376 ret = exynos_get_trip_temp(thermal, trip, &trip_temp);
377 if (ret < 0)
378 return ret;
379
380 if (thermal->temperature >= trip_temp)
374 *trend = THERMAL_TREND_RAISING; 381 *trend = THERMAL_TREND_RAISING;
375 else 382 else
376 *trend = THERMAL_TREND_DROPPING; 383 *trend = THERMAL_TREND_DROPPING;
@@ -705,20 +712,18 @@ static void exynos_tmu_work(struct work_struct *work)
705 struct exynos_tmu_data *data = container_of(work, 712 struct exynos_tmu_data *data = container_of(work,
706 struct exynos_tmu_data, irq_work); 713 struct exynos_tmu_data, irq_work);
707 714
715 exynos_report_trigger();
708 mutex_lock(&data->lock); 716 mutex_lock(&data->lock);
709 clk_enable(data->clk); 717 clk_enable(data->clk);
710
711
712 if (data->soc == SOC_ARCH_EXYNOS) 718 if (data->soc == SOC_ARCH_EXYNOS)
713 writel(EXYNOS_TMU_CLEAR_RISE_INT, 719 writel(EXYNOS_TMU_CLEAR_RISE_INT,
714 data->base + EXYNOS_TMU_REG_INTCLEAR); 720 data->base + EXYNOS_TMU_REG_INTCLEAR);
715 else 721 else
716 writel(EXYNOS4210_TMU_INTCLEAR_VAL, 722 writel(EXYNOS4210_TMU_INTCLEAR_VAL,
717 data->base + EXYNOS_TMU_REG_INTCLEAR); 723 data->base + EXYNOS_TMU_REG_INTCLEAR);
718
719 clk_disable(data->clk); 724 clk_disable(data->clk);
720 mutex_unlock(&data->lock); 725 mutex_unlock(&data->lock);
721 exynos_report_trigger(); 726
722 enable_irq(data->irq); 727 enable_irq(data->irq);
723} 728}
724 729