* [PATCH 2/5 RESEND] thermal: exynos: Miscellaneous fixes to support falling threshold interrupt
[not found] <1353937640-9939-3-git-send-email-amit.kachhap@linaro.org>
@ 2013-01-06 23:50 ` Amit Daniel Kachhap
2013-01-06 23:55 ` Joe Perches
0 siblings, 1 reply; 5+ messages in thread
From: Amit Daniel Kachhap @ 2013-01-06 23:50 UTC (permalink / raw)
To: linux-pm, linux-pm, Zhang Rui; +Cc: linux-samsung-soc, linux-kernel
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>
---
drivers/thermal/exynos_thermal.c | 19 ++++++++++++-------
1 files changed, 12 insertions(+), 7 deletions(-)
diff --git a/drivers/thermal/exynos_thermal.c b/drivers/thermal/exynos_thermal.c
index dcd13f7..0d17d41 100644
--- a/drivers/thermal/exynos_thermal.c
+++ b/drivers/thermal/exynos_thermal.c
@@ -82,7 +82,7 @@
#define EXYNOS_TRIMINFO_RELOAD 0x1
#define EXYNOS_TMU_CLEAR_RISE_INT 0x111
-#define EXYNOS_TMU_CLEAR_FALL_INT (0x111 << 16)
+#define EXYNOS_TMU_CLEAR_FALL_INT (0x111 << 12)
#define EXYNOS_MUX_ADDR_VALUE 6
#define EXYNOS_MUX_ADDR_SHIFT 20
#define EXYNOS_TMU_TRIP_MODE_SHIFT 13
@@ -373,12 +373,19 @@ static int exynos_get_temp(struct thermal_zone_device *thermal,
static int exynos_get_trend(struct thermal_zone_device *thermal,
int trip, enum thermal_trend *trend)
{
- if (thermal->temperature >= trip)
+ int ret = 0;
+ unsigned long trip_temp;
+
+ ret = exynos_get_trip_temp(thermal, trip, &trip_temp);
+ if (ret < 0)
+ return ret;
+
+ if (thermal->temperature >= trip_temp)
*trend = THERMAL_TREND_RAISING;
else
*trend = THERMAL_TREND_DROPPING;
- return 0;
+ return ret;
}
/* Operation callback functions for thermal zone */
static struct thermal_zone_device_ops const exynos_dev_ops = {
@@ -712,10 +719,9 @@ static void exynos_tmu_work(struct work_struct *work)
struct exynos_tmu_data *data = container_of(work,
struct exynos_tmu_data, irq_work);
+ exynos_report_trigger();
mutex_lock(&data->lock);
clk_enable(data->clk);
-
-
if (data->soc == SOC_ARCH_EXYNOS)
writel(EXYNOS_TMU_CLEAR_RISE_INT |
EXYNOS_TMU_CLEAR_FALL_INT,
@@ -723,10 +729,9 @@ static void exynos_tmu_work(struct work_struct *work)
else
writel(EXYNOS4210_TMU_INTCLEAR_VAL,
data->base + EXYNOS_TMU_REG_INTCLEAR);
-
clk_disable(data->clk);
mutex_unlock(&data->lock);
- exynos_report_trigger();
+
enable_irq(data->irq);
}
--
1.7.5.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 2/5 RESEND] thermal: exynos: Miscellaneous fixes to support falling threshold interrupt
2013-01-06 23:50 ` [PATCH 2/5 RESEND] thermal: exynos: Miscellaneous fixes to support falling threshold interrupt Amit Daniel Kachhap
@ 2013-01-06 23:55 ` Joe Perches
2013-01-09 4:30 ` amit kachhap
0 siblings, 1 reply; 5+ messages in thread
From: Joe Perches @ 2013-01-06 23:55 UTC (permalink / raw)
To: Amit Daniel Kachhap
Cc: linux-pm, linux-pm, Zhang Rui, linux-samsung-soc, linux-kernel
On Sun, 2013-01-06 at 15:50 -0800, Amit Daniel Kachhap wrote:
> 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.
[]
> diff --git a/drivers/thermal/exynos_thermal.c b/drivers/thermal/exynos_thermal.c
[]
> @@ -373,12 +373,19 @@ static int exynos_get_temp(struct thermal_zone_device *thermal,
> static int exynos_get_trend(struct thermal_zone_device *thermal,
> int trip, enum thermal_trend *trend)
> {
> - if (thermal->temperature >= trip)
> + int ret = 0;
Unnecessary initialization
> + unsigned long trip_temp;
> +
> + ret = exynos_get_trip_temp(thermal, trip, &trip_temp);
> + if (ret < 0)
> + return ret;
> +
> + if (thermal->temperature >= trip_temp)
> *trend = THERMAL_TREND_RAISING;
> else
> *trend = THERMAL_TREND_DROPPING;
THERMAL_TREND_STABLE ?
>
> - return 0;
> + return ret;
return 0 is clearer.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 2/5 RESEND] thermal: exynos: Miscellaneous fixes to support falling threshold interrupt
2013-01-06 23:55 ` Joe Perches
@ 2013-01-09 4:30 ` amit kachhap
2013-01-17 1:42 ` [PATCH V3 2/3] " Amit Daniel Kachhap
0 siblings, 1 reply; 5+ messages in thread
From: amit kachhap @ 2013-01-09 4:30 UTC (permalink / raw)
To: Joe Perches
Cc: linux-pm, linux-pm, Zhang Rui, linux-samsung-soc, linux-kernel
Hi Joe,
Thanks for the review. Will re-post with your suggestion,
On Sun, Jan 6, 2013 at 3:55 PM, Joe Perches <joe@perches.com> wrote:
> On Sun, 2013-01-06 at 15:50 -0800, Amit Daniel Kachhap wrote:
>> 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.
> []
>> diff --git a/drivers/thermal/exynos_thermal.c b/drivers/thermal/exynos_thermal.c
> []
>> @@ -373,12 +373,19 @@ static int exynos_get_temp(struct thermal_zone_device *thermal,
>> static int exynos_get_trend(struct thermal_zone_device *thermal,
>> int trip, enum thermal_trend *trend)
>> {
>> - if (thermal->temperature >= trip)
>> + int ret = 0;
Yes agreed. Will modify it.
>
> Unnecessary initialization
>
>> + unsigned long trip_temp;
>> +
>> + ret = exynos_get_trip_temp(thermal, trip, &trip_temp);
>> + if (ret < 0)
>> + return ret;
>> +
>> + if (thermal->temperature >= trip_temp)
>> *trend = THERMAL_TREND_RAISING;
>> else
>> *trend = THERMAL_TREND_DROPPING;
>
> THERMAL_TREND_STABLE ?
Only 2 trend is sufficient. It is stable for some time as the falling
threshold interrupt is some units below the trip temp.
>
>>
>> - return 0;
>> + return ret;
Ok agreed
>
> return 0 is clearer.
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH V3 2/3] thermal: exynos: Miscellaneous fixes to support falling threshold interrupt
2013-01-09 4:30 ` amit kachhap
@ 2013-01-17 1:42 ` Amit Daniel Kachhap
2013-01-20 12:53 ` Shubhrajyoti Datta
0 siblings, 1 reply; 5+ messages in thread
From: Amit Daniel Kachhap @ 2013-01-17 1:42 UTC (permalink / raw)
To: linux-pm, Zhang Rui
Cc: jonghwa3.lee, linux-samsung-soc, linux-kernel, durgadoss.r, joe
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>
---
Changes since V2,
Incorporated Joe Perches <joe@perches.com> review comments about coding
guidelines.
This path is based on thermal maintainer next tree.
drivers/thermal/exynos_thermal.c | 17 +++++++++++------
1 files changed, 11 insertions(+), 6 deletions(-)
diff --git a/drivers/thermal/exynos_thermal.c b/drivers/thermal/exynos_thermal.c
index dcd13f7..f4dd68a 100644
--- a/drivers/thermal/exynos_thermal.c
+++ b/drivers/thermal/exynos_thermal.c
@@ -82,7 +82,7 @@
#define EXYNOS_TRIMINFO_RELOAD 0x1
#define EXYNOS_TMU_CLEAR_RISE_INT 0x111
-#define EXYNOS_TMU_CLEAR_FALL_INT (0x111 << 16)
+#define EXYNOS_TMU_CLEAR_FALL_INT (0x111 << 12)
#define EXYNOS_MUX_ADDR_VALUE 6
#define EXYNOS_MUX_ADDR_SHIFT 20
#define EXYNOS_TMU_TRIP_MODE_SHIFT 13
@@ -373,7 +373,14 @@ static int exynos_get_temp(struct thermal_zone_device *thermal,
static int exynos_get_trend(struct thermal_zone_device *thermal,
int trip, enum thermal_trend *trend)
{
- if (thermal->temperature >= trip)
+ int ret;
+ unsigned long trip_temp;
+
+ ret = exynos_get_trip_temp(thermal, trip, &trip_temp);
+ if (ret < 0)
+ return ret;
+
+ if (thermal->temperature >= trip_temp)
*trend = THERMAL_TREND_RAISING;
else
*trend = THERMAL_TREND_DROPPING;
@@ -712,10 +719,9 @@ static void exynos_tmu_work(struct work_struct *work)
struct exynos_tmu_data *data = container_of(work,
struct exynos_tmu_data, irq_work);
+ exynos_report_trigger();
mutex_lock(&data->lock);
clk_enable(data->clk);
-
-
if (data->soc == SOC_ARCH_EXYNOS)
writel(EXYNOS_TMU_CLEAR_RISE_INT |
EXYNOS_TMU_CLEAR_FALL_INT,
@@ -723,10 +729,9 @@ static void exynos_tmu_work(struct work_struct *work)
else
writel(EXYNOS4210_TMU_INTCLEAR_VAL,
data->base + EXYNOS_TMU_REG_INTCLEAR);
-
clk_disable(data->clk);
mutex_unlock(&data->lock);
- exynos_report_trigger();
+
enable_irq(data->irq);
}
--
1.7.5.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH V3 2/3] thermal: exynos: Miscellaneous fixes to support falling threshold interrupt
2013-01-17 1:42 ` [PATCH V3 2/3] " Amit Daniel Kachhap
@ 2013-01-20 12:53 ` Shubhrajyoti Datta
0 siblings, 0 replies; 5+ messages in thread
From: Shubhrajyoti Datta @ 2013-01-20 12:53 UTC (permalink / raw)
To: Amit Daniel Kachhap
Cc: linux-pm, Zhang Rui, jonghwa3.lee, linux-samsung-soc,
linux-kernel, durgadoss.r, joe
On 1/17/13, Amit Daniel Kachhap <amit.daniel@samsung.com> wrote:
> 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.
One fix per patch would have been better.
However not particular.
Also are they applicable to older kernels?
>
> Signed-off-by: Amit Daniel Kachhap <amit.daniel@samsung.com>
> ---
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2013-01-20 12:53 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <1353937640-9939-3-git-send-email-amit.kachhap@linaro.org>
2013-01-06 23:50 ` [PATCH 2/5 RESEND] thermal: exynos: Miscellaneous fixes to support falling threshold interrupt Amit Daniel Kachhap
2013-01-06 23:55 ` Joe Perches
2013-01-09 4:30 ` amit kachhap
2013-01-17 1:42 ` [PATCH V3 2/3] " Amit Daniel Kachhap
2013-01-20 12:53 ` Shubhrajyoti Datta
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).