2015-02-24 04:57:07

by Chanwoo Choi

[permalink] [raw]
Subject: [PATCH v2 0/2] thermal: exynos: Fix NULL pointer error and bug of PD_DET_EN of Exynos7

This patch-set fix the bug of PD_DET_EN bit field of Exynos7 TMU.
And the clean-up the exynos compatible table by making oneline entry.

Changes from v1:
- Rebased it on Linux 4.0-rc1
- Add acked message by Lukasz Majewski
- Drop first patch [1] because NULL poiner error don't happen.
[1] http://www.spinics.net/lists/linux-samsung-soc/msg42424.html

Chanwoo Choi (2):
thermal: exynos: Fix wrong control of power down detection mode for Exynos7
thermal: exynos: Clean-up code to use oneline entry for exynos compatible table

drivers/thermal/samsung/exynos_tmu.c | 41 +++++++++++-------------------------
1 file changed, 12 insertions(+), 29 deletions(-)

--
1.8.5.5


2015-02-24 04:57:10

by Chanwoo Choi

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

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 <[email protected]>
Cc: Eduardo Valentin <[email protected]>
Signed-off-by: Chanwoo Choi <[email protected]>
---
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

2015-02-24 04:57:11

by Chanwoo Choi

[permalink] [raw]
Subject: [PATCH 2/2] thermal: exynos: Clean-up code to use oneline entry for exynos compatible table

This patch cleanup the code to use oneline for entry of exynos compatible
table.

Cc: Zhang Rui <[email protected]>
Cc: Eduardo Valentin <[email protected]>
Signed-off-by: Chanwoo Choi <[email protected]>
Acked-by: Lukasz Majewski <[email protected]>
---
drivers/thermal/samsung/exynos_tmu.c | 38 ++++++++++--------------------------
1 file changed, 10 insertions(+), 28 deletions(-)

diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung/exynos_tmu.c
index a60f527..1d30b09 100644
--- a/drivers/thermal/samsung/exynos_tmu.c
+++ b/drivers/thermal/samsung/exynos_tmu.c
@@ -919,34 +919,16 @@ static irqreturn_t exynos_tmu_irq(int irq, void *id)
}

static const struct of_device_id exynos_tmu_match[] = {
- {
- .compatible = "samsung,exynos3250-tmu",
- },
- {
- .compatible = "samsung,exynos4210-tmu",
- },
- {
- .compatible = "samsung,exynos4412-tmu",
- },
- {
- .compatible = "samsung,exynos5250-tmu",
- },
- {
- .compatible = "samsung,exynos5260-tmu",
- },
- {
- .compatible = "samsung,exynos5420-tmu",
- },
- {
- .compatible = "samsung,exynos5420-tmu-ext-triminfo",
- },
- {
- .compatible = "samsung,exynos5440-tmu",
- },
- {
- .compatible = "samsung,exynos7-tmu",
- },
- {},
+ { .compatible = "samsung,exynos3250-tmu", },
+ { .compatible = "samsung,exynos4210-tmu", },
+ { .compatible = "samsung,exynos4412-tmu", },
+ { .compatible = "samsung,exynos5250-tmu", },
+ { .compatible = "samsung,exynos5260-tmu", },
+ { .compatible = "samsung,exynos5420-tmu", },
+ { .compatible = "samsung,exynos5420-tmu-ext-triminfo", },
+ { .compatible = "samsung,exynos5440-tmu", },
+ { .compatible = "samsung,exynos7-tmu", },
+ { /* sentinel */ },
};
MODULE_DEVICE_TABLE(of, exynos_tmu_match);

--
1.8.5.5

2015-02-24 18:53:42

by Eduardo Valentin

[permalink] [raw]
Subject: Re: [PATCH 1/2] thermal: exynos: Fix wrong control of power down detection mode for Exynos7

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 <[email protected]>
> Cc: Eduardo Valentin <[email protected]>
> Signed-off-by: Chanwoo Choi <[email protected]>

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
>


Attachments:
(No filename) (1.53 kB)
signature.asc (473.00 B)
Digital signature
Download all attachments

2015-02-25 09:03:45

by Lukasz Majewski

[permalink] [raw]
Subject: Re: [PATCH 1/2] thermal: exynos: Fix wrong control of power down detection mode for Exynos7

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 <[email protected]>
> Cc: Eduardo Valentin <[email protected]>
> Signed-off-by: Chanwoo Choi <[email protected]>
> ---
> 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?

--
Best regards,

Lukasz Majewski

Samsung R&D Institute Poland (SRPOL) | Linux Platform Group

2015-02-25 12:09:11

by Abhilash Kesavan

[permalink] [raw]
Subject: Re: [PATCH 1/2] thermal: exynos: Fix wrong control of power down detection mode for Exynos7

Hi Lukasz,

On Wed, Feb 25, 2015 at 2:33 PM, Lukasz Majewski <[email protected]> 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 <[email protected]>
>> Cc: Eduardo Valentin <[email protected]>
>> Signed-off-by: Chanwoo Choi <[email protected]>
>> ---
>> 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 <[email protected]>


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

2015-02-25 12:25:23

by Lukasz Majewski

[permalink] [raw]
Subject: Re: [PATCH 1/2] thermal: exynos: Fix wrong control of power down detection mode for Exynos7

Hi Eduardo,

> Hi Lukasz,
>
> On Wed, Feb 25, 2015 at 2:33 PM, Lukasz Majewski
> <[email protected]> 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 <[email protected]>
> >> Cc: Eduardo Valentin <[email protected]>
> >> Signed-off-by: Chanwoo Choi <[email protected]>
> >> ---
> >> 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 <[email protected]>
>

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


--
Best regards,

Lukasz Majewski

Samsung R&D Institute Poland (SRPOL) | Linux Platform Group

2015-02-25 19:01:45

by Eduardo Valentin

[permalink] [raw]
Subject: Re: [PATCH 1/2] thermal: exynos: Fix wrong control of power down detection mode for Exynos7

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
> > <[email protected]> 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 <[email protected]>
> > >> Cc: Eduardo Valentin <[email protected]>
> > >> Signed-off-by: Chanwoo Choi <[email protected]>
> > >> ---
> > >> 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 <[email protected]>
> >
>
> 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


Attachments:
(No filename) (2.60 kB)
signature.asc (473.00 B)
Digital signature
Download all attachments