diff mbox

[1/2] thermal: exynos: Fix wrong control of power down detection mode for Exynos7

Message ID 1424753815-15113-2-git-send-email-cw00.choi@samsung.com (mailing list archive)
State Accepted
Delegated to: Eduardo Valentin
Headers show

Commit Message

Chanwoo Choi Feb. 24, 2015, 4:56 a.m. UTC
This patch fixes the wrong control of PD_DET_EN (power down detection mode)
for Exynos7 because exynos7_tmu_control() always enables the power down detection
mode regardless 'on' parameter.

Cc: Zhang Rui <rui.zhang@intel.com>
Cc: Eduardo Valentin <edubezval@gmail.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
---
 drivers/thermal/samsung/exynos_tmu.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Eduardo Valentin Feb. 24, 2015, 6:53 p.m. UTC | #1
On Tue, Feb 24, 2015 at 01:56:54PM +0900, Chanwoo Choi wrote:
> This patch fixes the wrong control of PD_DET_EN (power down detection mode)
> for Exynos7 because exynos7_tmu_control() always enables the power down detection
> mode regardless 'on' parameter.
> 
> Cc: Zhang Rui <rui.zhang@intel.com>
> Cc: Eduardo Valentin <edubezval@gmail.com>
> Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>

Lukasz,

Any objections to this code?

BR,

Eduardo Valentin

> ---
>  drivers/thermal/samsung/exynos_tmu.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung/exynos_tmu.c
> index 933cd80..a60f527 100644
> --- a/drivers/thermal/samsung/exynos_tmu.c
> +++ b/drivers/thermal/samsung/exynos_tmu.c
> @@ -682,6 +682,7 @@ static void exynos7_tmu_control(struct platform_device *pdev, bool on)
>  
>  	if (on) {
>  		con |= (1 << EXYNOS_TMU_CORE_EN_SHIFT);
> +		con |= (1 << EXYNOS7_PD_DET_EN_SHIFT);
>  		interrupt_en =
>  			(of_thermal_is_trip_valid(tz, 7)
>  			<< EXYNOS7_TMU_INTEN_RISE7_SHIFT) |
> @@ -704,9 +705,9 @@ static void exynos7_tmu_control(struct platform_device *pdev, bool on)
>  			interrupt_en << EXYNOS_TMU_INTEN_FALL0_SHIFT;
>  	} else {
>  		con &= ~(1 << EXYNOS_TMU_CORE_EN_SHIFT);
> +		con &= ~(1 << EXYNOS7_PD_DET_EN_SHIFT);
>  		interrupt_en = 0; /* Disable all interrupts */
>  	}
> -	con |= 1 << EXYNOS7_PD_DET_EN_SHIFT;
>  
>  	writel(interrupt_en, data->base + EXYNOS7_TMU_REG_INTEN);
>  	writel(con, data->base + EXYNOS_TMU_REG_CONTROL);
> -- 
> 1.8.5.5
>
Lukasz Majewski Feb. 25, 2015, 9:03 a.m. UTC | #2
Hi Abhilash,

> This patch fixes the wrong control of PD_DET_EN (power down detection
> mode) for Exynos7 because exynos7_tmu_control() always enables the
> power down detection mode regardless 'on' parameter.
> 
> Cc: Zhang Rui <rui.zhang@intel.com>
> Cc: Eduardo Valentin <edubezval@gmail.com>
> Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
> ---
>  drivers/thermal/samsung/exynos_tmu.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/thermal/samsung/exynos_tmu.c
> b/drivers/thermal/samsung/exynos_tmu.c index 933cd80..a60f527 100644
> --- a/drivers/thermal/samsung/exynos_tmu.c
> +++ b/drivers/thermal/samsung/exynos_tmu.c
> @@ -682,6 +682,7 @@ static void exynos7_tmu_control(struct
> platform_device *pdev, bool on) 
>  	if (on) {
>  		con |= (1 << EXYNOS_TMU_CORE_EN_SHIFT);
> +		con |= (1 << EXYNOS7_PD_DET_EN_SHIFT);
>  		interrupt_en =
>  			(of_thermal_is_trip_valid(tz, 7)
>  			<< EXYNOS7_TMU_INTEN_RISE7_SHIFT) |
> @@ -704,9 +705,9 @@ static void exynos7_tmu_control(struct
> platform_device *pdev, bool on) interrupt_en <<
> EXYNOS_TMU_INTEN_FALL0_SHIFT; } else {
>  		con &= ~(1 << EXYNOS_TMU_CORE_EN_SHIFT);
> +		con &= ~(1 << EXYNOS7_PD_DET_EN_SHIFT);
>  		interrupt_en = 0; /* Disable all interrupts */
>  	}
> -	con |= 1 << EXYNOS7_PD_DET_EN_SHIFT;
>  
>  	writel(interrupt_en, data->base + EXYNOS7_TMU_REG_INTEN);
>  	writel(con, data->base + EXYNOS_TMU_REG_CONTROL);

Could you test this patch if it isn't introducing any regression on your
HW?
Abhilash Kesavan Feb. 25, 2015, 12:09 p.m. UTC | #3
Hi Lukasz,

On Wed, Feb 25, 2015 at 2:33 PM, Lukasz Majewski <l.majewski@samsung.com> wrote:
> Hi Abhilash,
>
>> This patch fixes the wrong control of PD_DET_EN (power down detection
>> mode) for Exynos7 because exynos7_tmu_control() always enables the
>> power down detection mode regardless 'on' parameter.
>>
>> Cc: Zhang Rui <rui.zhang@intel.com>
>> Cc: Eduardo Valentin <edubezval@gmail.com>
>> Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
>> ---
>>  drivers/thermal/samsung/exynos_tmu.c | 3 ++-
>>  1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/thermal/samsung/exynos_tmu.c
>> b/drivers/thermal/samsung/exynos_tmu.c index 933cd80..a60f527 100644
>> --- a/drivers/thermal/samsung/exynos_tmu.c
>> +++ b/drivers/thermal/samsung/exynos_tmu.c
>> @@ -682,6 +682,7 @@ static void exynos7_tmu_control(struct
>> platform_device *pdev, bool on)
>>       if (on) {
>>               con |= (1 << EXYNOS_TMU_CORE_EN_SHIFT);
>> +             con |= (1 << EXYNOS7_PD_DET_EN_SHIFT);
>>               interrupt_en =
>>                       (of_thermal_is_trip_valid(tz, 7)
>>                       << EXYNOS7_TMU_INTEN_RISE7_SHIFT) |
>> @@ -704,9 +705,9 @@ static void exynos7_tmu_control(struct
>> platform_device *pdev, bool on) interrupt_en <<
>> EXYNOS_TMU_INTEN_FALL0_SHIFT; } else {
>>               con &= ~(1 << EXYNOS_TMU_CORE_EN_SHIFT);
>> +             con &= ~(1 << EXYNOS7_PD_DET_EN_SHIFT);
>>               interrupt_en = 0; /* Disable all interrupts */
>>       }
>> -     con |= 1 << EXYNOS7_PD_DET_EN_SHIFT;
>>
>>       writel(interrupt_en, data->base + EXYNOS7_TMU_REG_INTEN);
>>       writel(con, data->base + EXYNOS_TMU_REG_CONTROL);
>
> Could you test this patch if it isn't introducing any regression on your
> HW?

The patch does not cause any regression on exynos7 and seems logically correct.

Tested-by: Abhilash Kesavan <a.kesavan@samsung.com>


Regards,
Abhilash
>
> --
> Best regards,
>
> Lukasz Majewski
>
> Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
--
To unsubscribe from this list: send the line "unsubscribe linux-pm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Lukasz Majewski Feb. 25, 2015, 12:25 p.m. UTC | #4
Hi Eduardo,

> Hi Lukasz,
> 
> On Wed, Feb 25, 2015 at 2:33 PM, Lukasz Majewski
> <l.majewski@samsung.com> wrote:
> > Hi Abhilash,
> >
> >> This patch fixes the wrong control of PD_DET_EN (power down
> >> detection mode) for Exynos7 because exynos7_tmu_control() always
> >> enables the power down detection mode regardless 'on' parameter.
> >>
> >> Cc: Zhang Rui <rui.zhang@intel.com>
> >> Cc: Eduardo Valentin <edubezval@gmail.com>
> >> Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
> >> ---
> >>  drivers/thermal/samsung/exynos_tmu.c | 3 ++-
> >>  1 file changed, 2 insertions(+), 1 deletion(-)
> >>
> >> diff --git a/drivers/thermal/samsung/exynos_tmu.c
> >> b/drivers/thermal/samsung/exynos_tmu.c index 933cd80..a60f527
> >> 100644 --- a/drivers/thermal/samsung/exynos_tmu.c
> >> +++ b/drivers/thermal/samsung/exynos_tmu.c
> >> @@ -682,6 +682,7 @@ static void exynos7_tmu_control(struct
> >> platform_device *pdev, bool on)
> >>       if (on) {
> >>               con |= (1 << EXYNOS_TMU_CORE_EN_SHIFT);
> >> +             con |= (1 << EXYNOS7_PD_DET_EN_SHIFT);
> >>               interrupt_en =
> >>                       (of_thermal_is_trip_valid(tz, 7)
> >>                       << EXYNOS7_TMU_INTEN_RISE7_SHIFT) |
> >> @@ -704,9 +705,9 @@ static void exynos7_tmu_control(struct
> >> platform_device *pdev, bool on) interrupt_en <<
> >> EXYNOS_TMU_INTEN_FALL0_SHIFT; } else {
> >>               con &= ~(1 << EXYNOS_TMU_CORE_EN_SHIFT);
> >> +             con &= ~(1 << EXYNOS7_PD_DET_EN_SHIFT);
> >>               interrupt_en = 0; /* Disable all interrupts */
> >>       }
> >> -     con |= 1 << EXYNOS7_PD_DET_EN_SHIFT;
> >>
> >>       writel(interrupt_en, data->base + EXYNOS7_TMU_REG_INTEN);
> >>       writel(con, data->base + EXYNOS_TMU_REG_CONTROL);
> >
> > Could you test this patch if it isn't introducing any regression on
> > your HW?
> 
> The patch does not cause any regression on exynos7 and seems
> logically correct.
> 
> Tested-by: Abhilash Kesavan <a.kesavan@samsung.com>
> 

Eduardo, it is up to you if you prefer to take this fix directly or via
the new thermal-samsung tree ?

From when shall I regard myself as a maintainer? :-)


> 
> Regards,
> Abhilash
> >
> > --
> > Best regards,
> >
> > Lukasz Majewski
> >
> > Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
Eduardo Valentin Feb. 25, 2015, 7:01 p.m. UTC | #5
On Wed, Feb 25, 2015 at 01:25:08PM +0100, Lukasz Majewski wrote:
> Hi Eduardo,
> 
> > Hi Lukasz,
> > 
> > On Wed, Feb 25, 2015 at 2:33 PM, Lukasz Majewski
> > <l.majewski@samsung.com> wrote:
> > > Hi Abhilash,
> > >
> > >> This patch fixes the wrong control of PD_DET_EN (power down
> > >> detection mode) for Exynos7 because exynos7_tmu_control() always
> > >> enables the power down detection mode regardless 'on' parameter.
> > >>
> > >> Cc: Zhang Rui <rui.zhang@intel.com>
> > >> Cc: Eduardo Valentin <edubezval@gmail.com>
> > >> Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
> > >> ---
> > >>  drivers/thermal/samsung/exynos_tmu.c | 3 ++-
> > >>  1 file changed, 2 insertions(+), 1 deletion(-)
> > >>
> > >> diff --git a/drivers/thermal/samsung/exynos_tmu.c
> > >> b/drivers/thermal/samsung/exynos_tmu.c index 933cd80..a60f527
> > >> 100644 --- a/drivers/thermal/samsung/exynos_tmu.c
> > >> +++ b/drivers/thermal/samsung/exynos_tmu.c
> > >> @@ -682,6 +682,7 @@ static void exynos7_tmu_control(struct
> > >> platform_device *pdev, bool on)
> > >>       if (on) {
> > >>               con |= (1 << EXYNOS_TMU_CORE_EN_SHIFT);
> > >> +             con |= (1 << EXYNOS7_PD_DET_EN_SHIFT);
> > >>               interrupt_en =
> > >>                       (of_thermal_is_trip_valid(tz, 7)
> > >>                       << EXYNOS7_TMU_INTEN_RISE7_SHIFT) |
> > >> @@ -704,9 +705,9 @@ static void exynos7_tmu_control(struct
> > >> platform_device *pdev, bool on) interrupt_en <<
> > >> EXYNOS_TMU_INTEN_FALL0_SHIFT; } else {
> > >>               con &= ~(1 << EXYNOS_TMU_CORE_EN_SHIFT);
> > >> +             con &= ~(1 << EXYNOS7_PD_DET_EN_SHIFT);
> > >>               interrupt_en = 0; /* Disable all interrupts */
> > >>       }
> > >> -     con |= 1 << EXYNOS7_PD_DET_EN_SHIFT;
> > >>
> > >>       writel(interrupt_en, data->base + EXYNOS7_TMU_REG_INTEN);
> > >>       writel(con, data->base + EXYNOS_TMU_REG_CONTROL);
> > >
> > > Could you test this patch if it isn't introducing any regression on
> > > your HW?
> > 
> > The patch does not cause any regression on exynos7 and seems
> > logically correct.
> > 
> > Tested-by: Abhilash Kesavan <a.kesavan@samsung.com>
> > 
> 
> Eduardo, it is up to you if you prefer to take this fix directly or via
> the new thermal-samsung tree ?
> 
> From when shall I regard myself as a maintainer? :-)
> 

Yeah. Go ahead and collect it.

> 
> > 
> > Regards,
> > Abhilash
> > >
> > > --
> > > Best regards,
> > >
> > > Lukasz Majewski
> > >
> > > Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
> 
> 
> -- 
> Best regards,
> 
> Lukasz Majewski
> 
> Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
diff mbox

Patch

diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung/exynos_tmu.c
index 933cd80..a60f527 100644
--- a/drivers/thermal/samsung/exynos_tmu.c
+++ b/drivers/thermal/samsung/exynos_tmu.c
@@ -682,6 +682,7 @@  static void exynos7_tmu_control(struct platform_device *pdev, bool on)
 
 	if (on) {
 		con |= (1 << EXYNOS_TMU_CORE_EN_SHIFT);
+		con |= (1 << EXYNOS7_PD_DET_EN_SHIFT);
 		interrupt_en =
 			(of_thermal_is_trip_valid(tz, 7)
 			<< EXYNOS7_TMU_INTEN_RISE7_SHIFT) |
@@ -704,9 +705,9 @@  static void exynos7_tmu_control(struct platform_device *pdev, bool on)
 			interrupt_en << EXYNOS_TMU_INTEN_FALL0_SHIFT;
 	} else {
 		con &= ~(1 << EXYNOS_TMU_CORE_EN_SHIFT);
+		con &= ~(1 << EXYNOS7_PD_DET_EN_SHIFT);
 		interrupt_en = 0; /* Disable all interrupts */
 	}
-	con |= 1 << EXYNOS7_PD_DET_EN_SHIFT;
 
 	writel(interrupt_en, data->base + EXYNOS7_TMU_REG_INTEN);
 	writel(con, data->base + EXYNOS_TMU_REG_CONTROL);