2013-09-24 08:08:47

by Lukasz Majewski

[permalink] [raw]
Subject: [PATCH 0/6] thermal: exynos: Fixes for v3.12

This patch series is divided into two parts:
1. Device tree node definition and enabelement for TMU at Exynos4412 (Trats2)
2. Exynos thermal subsystem regressions for v3.12-rc1. Several commits were
necessary to properly fix regression for TMU test MUX address setting after
reset.

Test HW:
- Exynos4412 - TRATS2 board (Linux v3.12-rc1)

Lukasz Majewski (6):
thermal: exynos: fix: Return from exynos_report_trigger() when
therm_dev is NULL
thermal: exynos: Provide separate TMU data for Exynos4412
thermal: exynos: Provide initial setting for TMU's test MUX address
at Exynos4412
thermal: exynos: Replace SOC_ARCH_EXYNOS with SOC_ARCH_EXYNOS5250
ARM: dts: exynos4x12: Device tree node definition for TMU on
Exynos4x12
ARM: dts: exynos4412-trats2: Enable TMU support at Trats2

arch/arm/boot/dts/exynos4412-trats2.dts | 5 +++++
arch/arm/boot/dts/exynos4x12.dtsi | 10 +++++++++
drivers/thermal/samsung/exynos_thermal_common.c | 2 +-
drivers/thermal/samsung/exynos_tmu.c | 12 +++++++----
drivers/thermal/samsung/exynos_tmu.h | 3 ++-
drivers/thermal/samsung/exynos_tmu_data.c | 26 +++++++++++++++++------
drivers/thermal/samsung/exynos_tmu_data.h | 13 +++++++++++-
7 files changed, 58 insertions(+), 13 deletions(-)

--
1.7.10.4


2013-09-24 08:08:50

by Lukasz Majewski

[permalink] [raw]
Subject: [PATCH 1/6] thermal: exynos: fix: Return from exynos_report_trigger() when therm_dev is NULL

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.
This patch fixes it.

Signed-off-by: Lukasz Majewski <[email protected]>
Reviewed-by: Bartlomiej Zolnierkiewicz <[email protected]>
Reviewed-by: Tomasz Figa <[email protected]>
---
drivers/thermal/samsung/exynos_thermal_common.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/thermal/samsung/exynos_thermal_common.c b/drivers/thermal/samsung/exynos_thermal_common.c
index f10a6ad..55a912a 100644
--- a/drivers/thermal/samsung/exynos_thermal_common.c
+++ b/drivers/thermal/samsung/exynos_thermal_common.c
@@ -310,7 +310,7 @@ void exynos_report_trigger(struct thermal_sensor_conf *conf)
}

th_zone = conf->pzone_data;
- if (th_zone->therm_dev)
+ if (!th_zone->therm_dev)
return;

if (th_zone->bind == false) {
--
1.7.10.4

2013-09-24 08:08:54

by Lukasz Majewski

[permalink] [raw]
Subject: [PATCH 3/6] 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 <[email protected]>
Reviewed-by: Bartlomiej Zolnierkiewicz <[email protected]>
Reviewed-by: Tomasz Figa <[email protected]>
---
drivers/thermal/samsung/exynos_tmu.c | 3 +++
drivers/thermal/samsung/exynos_tmu_data.h | 4 ++++
2 files changed, 7 insertions(+)

diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung/exynos_tmu.c
index a858cc4..21b89e4 100644
--- a/drivers/thermal/samsung/exynos_tmu.c
+++ b/drivers/thermal/samsung/exynos_tmu.c
@@ -317,6 +317,9 @@ static void exynos_tmu_control(struct platform_device *pdev, bool on)

con = readl(data->base + reg->tmu_ctrl);

+ if (pdata->type == SOC_ARCH_EXYNOS4412)
+ con |= (EXYNOS4412_MUX_ADDR_VALUE << EXYNOS4412_MUX_ADDR_SHIFT);
+
if (pdata->reference_voltage) {
con &= ~(reg->buf_vref_sel_mask << reg->buf_vref_sel_shift);
con |= pdata->reference_voltage << reg->buf_vref_sel_shift;
diff --git a/drivers/thermal/samsung/exynos_tmu_data.h b/drivers/thermal/samsung/exynos_tmu_data.h
index b130b1e..a1ea19d 100644
--- a/drivers/thermal/samsung/exynos_tmu_data.h
+++ b/drivers/thermal/samsung/exynos_tmu_data.h
@@ -95,6 +95,10 @@

#define EXYNOS_MAX_TRIGGER_PER_REG 4

+/* Exynos4412 specific */
+#define EXYNOS4412_MUX_ADDR_VALUE 6
+#define EXYNOS4412_MUX_ADDR_SHIFT 20
+
/*exynos5440 specific registers*/
#define EXYNOS5440_TMU_S0_7_TRIM 0x000
#define EXYNOS5440_TMU_S0_7_CTRL 0x020
--
1.7.10.4

2013-09-24 08:09:00

by Lukasz Majewski

[permalink] [raw]
Subject: [PATCH 4/6] thermal: exynos: Replace SOC_ARCH_EXYNOS with SOC_ARCH_EXYNOS5250

The TMU data definition is now separated to Exynos4412 and Exynos5250.

Now SOC_ARCH_EXYNOS only refers to Exynos5250. Hence the name
SOC_ARCH_EXYNOS has been changed to SOC_ARCH_EXYNOS5250.

Signed-off-by: Lukasz Majewski <[email protected]>
---
drivers/thermal/samsung/exynos_tmu.c | 4 ++--
drivers/thermal/samsung/exynos_tmu.h | 2 +-
drivers/thermal/samsung/exynos_tmu_data.c | 2 +-
3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung/exynos_tmu.c
index 21b89e4..037cd46 100644
--- a/drivers/thermal/samsung/exynos_tmu.c
+++ b/drivers/thermal/samsung/exynos_tmu.c
@@ -632,9 +632,9 @@ static int exynos_tmu_probe(struct platform_device *pdev)
if (ret)
return ret;

- if (pdata->type == SOC_ARCH_EXYNOS ||
- pdata->type == SOC_ARCH_EXYNOS4210 ||
+ if (pdata->type == SOC_ARCH_EXYNOS4210 ||
pdata->type == SOC_ARCH_EXYNOS4412 ||
+ pdata->type == SOC_ARCH_EXYNOS5250 ||
pdata->type == SOC_ARCH_EXYNOS5440)
data->soc = pdata->type;
else {
diff --git a/drivers/thermal/samsung/exynos_tmu.h b/drivers/thermal/samsung/exynos_tmu.h
index db37df0..b42ece4 100644
--- a/drivers/thermal/samsung/exynos_tmu.h
+++ b/drivers/thermal/samsung/exynos_tmu.h
@@ -42,7 +42,7 @@ enum calibration_mode {
enum soc_type {
SOC_ARCH_EXYNOS4210 = 1,
SOC_ARCH_EXYNOS4412,
- SOC_ARCH_EXYNOS,
+ SOC_ARCH_EXYNOS5250,
SOC_ARCH_EXYNOS5440,
};

diff --git a/drivers/thermal/samsung/exynos_tmu_data.c b/drivers/thermal/samsung/exynos_tmu_data.c
index bd08093..188223f 100644
--- a/drivers/thermal/samsung/exynos_tmu_data.c
+++ b/drivers/thermal/samsung/exynos_tmu_data.c
@@ -183,7 +183,7 @@ struct exynos_tmu_init_data const exynos4412_default_tmu_data = {
struct exynos_tmu_init_data const exynos5250_default_tmu_data = {
.tmu_data = {
{ EXYNOS4412_TMU_DATA,
- .type = SOC_ARCH_EXYNOS,
+ .type = SOC_ARCH_EXYNOS5250,
},
},
.tmu_count = 1,
--
1.7.10.4

2013-09-24 08:09:08

by Lukasz Majewski

[permalink] [raw]
Subject: [PATCH 5/6] ARM: dts: exynos4x12: Device tree node definition for TMU on Exynos4x12

The TMU device tree node definition for Exynos4x12 family of SoCs.

Signed-off-by: Lukasz Majewski <[email protected]>
Reviewed-by: Bartlomiej Zolnierkiewicz <[email protected]>
Reviewed-by: Tomasz Figa <[email protected]>
---
arch/arm/boot/dts/exynos4x12.dtsi | 10 ++++++++++
1 file changed, 10 insertions(+)

diff --git a/arch/arm/boot/dts/exynos4x12.dtsi b/arch/arm/boot/dts/exynos4x12.dtsi
index ad531fe..64c0ece 100644
--- a/arch/arm/boot/dts/exynos4x12.dtsi
+++ b/arch/arm/boot/dts/exynos4x12.dtsi
@@ -176,4 +176,14 @@
};
};
};
+
+ tmu@100C0000 {
+ compatible = "samsung,exynos4412-tmu";
+ interrupt-parent = <&combiner>;
+ interrupts = <2 4>;
+ reg = <0x100C0000 0x100>;
+ clocks = <&clock 383>;
+ clock-names = "tmu_apbif";
+ status = "disabled";
+ };
};
--
1.7.10.4

2013-09-24 08:09:53

by Lukasz Majewski

[permalink] [raw]
Subject: [PATCH 6/6] ARM: dts: exynos4412-trats2: Enable TMU support at Trats2

This patch enables support for TMU at Exynos4412 based Trats2 board.

Signed-off-by: Lukasz Majewski <[email protected]>
Reviewed-by: Bartlomiej Zolnierkiewicz <[email protected]>
Reviewed-by: Tomasz Figa <[email protected]>
---
arch/arm/boot/dts/exynos4412-trats2.dts | 5 +++++
1 file changed, 5 insertions(+)

diff --git a/arch/arm/boot/dts/exynos4412-trats2.dts b/arch/arm/boot/dts/exynos4412-trats2.dts
index fb7b9ae..57136f8 100644
--- a/arch/arm/boot/dts/exynos4412-trats2.dts
+++ b/arch/arm/boot/dts/exynos4412-trats2.dts
@@ -467,6 +467,11 @@
status = "okay";
};

+ tmu@100C0000 {
+ vtmu-supply = <&ldo10_reg>;
+ status = "okay";
+ };
+
i2c_ak8975: i2c-gpio-0 {
compatible = "i2c-gpio";
gpios = <&gpy2 4 0>, <&gpy2 5 0>;
--
1.7.10.4

2013-09-24 08:11:05

by Lukasz Majewski

[permalink] [raw]
Subject: [PATCH 2/6] 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.

Signed-off-by: Lukasz Majewski <[email protected]>
Reviewed-by: Bartlomiej Zolnierkiewicz <[email protected]>
Reviewed-by: Tomasz Figa <[email protected]>
---
drivers/thermal/samsung/exynos_tmu.c | 7 ++++---
drivers/thermal/samsung/exynos_tmu.h | 1 +
drivers/thermal/samsung/exynos_tmu_data.c | 26 ++++++++++++++++++++------
drivers/thermal/samsung/exynos_tmu_data.h | 9 ++++++++-
4 files changed, 33 insertions(+), 10 deletions(-)

diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung/exynos_tmu.c
index b43afda..a858cc4 100644
--- a/drivers/thermal/samsung/exynos_tmu.c
+++ b/drivers/thermal/samsung/exynos_tmu.c
@@ -488,7 +488,7 @@ static const struct of_device_id exynos_tmu_match[] = {
},
{
.compatible = "samsung,exynos4412-tmu",
- .data = (void *)EXYNOS5250_TMU_DRV_DATA,
+ .data = (void *)EXYNOS4412_TMU_DRV_DATA,
},
{
.compatible = "samsung,exynos5250-tmu",
@@ -630,8 +630,9 @@ static int exynos_tmu_probe(struct platform_device *pdev)
return ret;

if (pdata->type == SOC_ARCH_EXYNOS ||
- pdata->type == SOC_ARCH_EXYNOS4210 ||
- pdata->type == SOC_ARCH_EXYNOS5440)
+ pdata->type == SOC_ARCH_EXYNOS4210 ||
+ pdata->type == SOC_ARCH_EXYNOS4412 ||
+ pdata->type == SOC_ARCH_EXYNOS5440)
data->soc = pdata->type;
else {
ret = -EINVAL;
diff --git a/drivers/thermal/samsung/exynos_tmu.h b/drivers/thermal/samsung/exynos_tmu.h
index b364c9e..db37df0 100644
--- a/drivers/thermal/samsung/exynos_tmu.h
+++ b/drivers/thermal/samsung/exynos_tmu.h
@@ -41,6 +41,7 @@ enum calibration_mode {

enum soc_type {
SOC_ARCH_EXYNOS4210 = 1,
+ SOC_ARCH_EXYNOS4412,
SOC_ARCH_EXYNOS,
SOC_ARCH_EXYNOS5440,
};
diff --git a/drivers/thermal/samsung/exynos_tmu_data.c b/drivers/thermal/samsung/exynos_tmu_data.c
index 9002499..bd08093 100644
--- a/drivers/thermal/samsung/exynos_tmu_data.c
+++ b/drivers/thermal/samsung/exynos_tmu_data.c
@@ -90,8 +90,8 @@ struct exynos_tmu_init_data const exynos4210_default_tmu_data = {
};
#endif

-#if defined(CONFIG_SOC_EXYNOS5250) || defined(CONFIG_SOC_EXYNOS4412)
-static const struct exynos_tmu_registers exynos5250_tmu_registers = {
+#if defined(CONFIG_SOC_EXYNOS4412) || defined(CONFIG_SOC_EXYNOS5250)
+static const struct exynos_tmu_registers exynos4412_tmu_registers = {
.triminfo_data = EXYNOS_TMU_REG_TRIMINFO,
.triminfo_25_shift = EXYNOS_TRIMINFO_25_SHIFT,
.triminfo_85_shift = EXYNOS_TRIMINFO_85_SHIFT,
@@ -128,7 +128,7 @@ static const struct exynos_tmu_registers exynos5250_tmu_registers = {
.emul_time_mask = EXYNOS_EMUL_TIME_MASK,
};

-#define EXYNOS5250_TMU_DATA \
+#define EXYNOS4412_TMU_DATA \
.threshold_falling = 10, \
.trigger_levels[0] = 85, \
.trigger_levels[1] = 103, \
@@ -162,15 +162,29 @@ static const struct exynos_tmu_registers exynos5250_tmu_registers = {
.temp_level = 103, \
}, \
.freq_tab_count = 2, \
- .type = SOC_ARCH_EXYNOS, \
- .registers = &exynos5250_tmu_registers, \
+ .registers = &exynos4412_tmu_registers, \
.features = (TMU_SUPPORT_EMULATION | TMU_SUPPORT_TRIM_RELOAD | \
TMU_SUPPORT_FALLING_TRIP | TMU_SUPPORT_READY_STATUS | \
TMU_SUPPORT_EMUL_TIME)
+#endif

+#if defined(CONFIG_SOC_EXYNOS4412)
+struct exynos_tmu_init_data const exynos4412_default_tmu_data = {
+ .tmu_data = {
+ { EXYNOS4412_TMU_DATA,
+ .type = SOC_ARCH_EXYNOS4412,
+ },
+ },
+ .tmu_count = 1,
+};
+#endif
+
+#if defined(CONFIG_SOC_EXYNOS5250)
struct exynos_tmu_init_data const exynos5250_default_tmu_data = {
.tmu_data = {
- { EXYNOS5250_TMU_DATA },
+ { EXYNOS4412_TMU_DATA,
+ .type = SOC_ARCH_EXYNOS,
+ },
},
.tmu_count = 1,
};
diff --git a/drivers/thermal/samsung/exynos_tmu_data.h b/drivers/thermal/samsung/exynos_tmu_data.h
index dc7feb5..b130b1e 100644
--- a/drivers/thermal/samsung/exynos_tmu_data.h
+++ b/drivers/thermal/samsung/exynos_tmu_data.h
@@ -138,7 +138,14 @@ extern struct exynos_tmu_init_data const exynos4210_default_tmu_data;
#define EXYNOS4210_TMU_DRV_DATA (NULL)
#endif

-#if (defined(CONFIG_SOC_EXYNOS5250) || defined(CONFIG_SOC_EXYNOS4412))
+#if defined(CONFIG_SOC_EXYNOS4412)
+extern struct exynos_tmu_init_data const exynos4412_default_tmu_data;
+#define EXYNOS4412_TMU_DRV_DATA (&exynos4412_default_tmu_data)
+#else
+#define EXYNOS4412_TMU_DRV_DATA (NULL)
+#endif
+
+#if defined(CONFIG_SOC_EXYNOS5250)
extern struct exynos_tmu_init_data const exynos5250_default_tmu_data;
#define EXYNOS5250_TMU_DRV_DATA (&exynos5250_default_tmu_data)
#else
--
1.7.10.4

2013-09-24 09:30:18

by Tomasz Figa

[permalink] [raw]
Subject: Re: [PATCH 0/6] thermal: exynos: Fixes for v3.12

Hi Lukasz,

On Tuesday 24 of September 2013 10:08:16 Lukasz Majewski wrote:
> This patch series is divided into two parts:
> 1. Device tree node definition and enabelement for TMU at Exynos4412 (Trats2)
> 2. Exynos thermal subsystem regressions for v3.12-rc1. Several commits were
> necessary to properly fix regression for TMU test MUX address setting after
> reset.
>
> Test HW:
> - Exynos4412 - TRATS2 board (Linux v3.12-rc1)
>
> Lukasz Majewski (6):
> thermal: exynos: fix: Return from exynos_report_trigger() when
> therm_dev is NULL
> thermal: exynos: Provide separate TMU data for Exynos4412
> thermal: exynos: Provide initial setting for TMU's test MUX address
> at Exynos4412
> thermal: exynos: Replace SOC_ARCH_EXYNOS with SOC_ARCH_EXYNOS5250
> ARM: dts: exynos4x12: Device tree node definition for TMU on
> Exynos4x12
> ARM: dts: exynos4412-trats2: Enable TMU support at Trats2
>
> arch/arm/boot/dts/exynos4412-trats2.dts | 5 +++++
> arch/arm/boot/dts/exynos4x12.dtsi | 10 +++++++++
> drivers/thermal/samsung/exynos_thermal_common.c | 2 +-
> drivers/thermal/samsung/exynos_tmu.c | 12 +++++++----
> drivers/thermal/samsung/exynos_tmu.h | 3 ++-
> drivers/thermal/samsung/exynos_tmu_data.c | 26 +++++++++++++++++------
> drivers/thermal/samsung/exynos_tmu_data.h | 13 +++++++++++-
> 7 files changed, 58 insertions(+), 13 deletions(-)
>

For the whole series:

Reviewed-by: Tomasz Figa <[email protected]>

Best regards,
Tomasz

2013-09-30 10:52:43

by amit daniel kachhap

[permalink] [raw]
Subject: Re: [PATCH 1/6] thermal: exynos: fix: Return from exynos_report_trigger() when therm_dev is NULL

On Tue, Sep 24, 2013 at 1:38 PM, Lukasz Majewski <[email protected]> wrote:
> 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.
> This patch fixes it.
>
> Signed-off-by: Lukasz Majewski <[email protected]>
> Reviewed-by: Bartlomiej Zolnierkiewicz <[email protected]>
> Reviewed-by: Tomasz Figa <[email protected]>
> ---
> drivers/thermal/samsung/exynos_thermal_common.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/thermal/samsung/exynos_thermal_common.c b/drivers/thermal/samsung/exynos_thermal_common.c
> index f10a6ad..55a912a 100644
> --- a/drivers/thermal/samsung/exynos_thermal_common.c
> +++ b/drivers/thermal/samsung/exynos_thermal_common.c
> @@ -310,7 +310,7 @@ void exynos_report_trigger(struct thermal_sensor_conf *conf)
> }
>
> th_zone = conf->pzone_data;
> - if (th_zone->therm_dev)
> + if (!th_zone->therm_dev)
> return;
Changes looks fine.
Reviewed-by: Amit Daniel Kachhap<[email protected]>

Thanks,
Amit Daniel
>
> if (th_zone->bind == false) {
> --
> 1.7.10.4
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html

On Tue, Sep 24, 2013 at 1:38 PM, Lukasz Majewski <[email protected]> wrote:
> 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.
> This patch fixes it.
>
> Signed-off-by: Lukasz Majewski <[email protected]>
> Reviewed-by: Bartlomiej Zolnierkiewicz <[email protected]>
> Reviewed-by: Tomasz Figa <[email protected]>
> ---
> drivers/thermal/samsung/exynos_thermal_common.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/thermal/samsung/exynos_thermal_common.c b/drivers/thermal/samsung/exynos_thermal_common.c
> index f10a6ad..55a912a 100644
> --- a/drivers/thermal/samsung/exynos_thermal_common.c
> +++ b/drivers/thermal/samsung/exynos_thermal_common.c
> @@ -310,7 +310,7 @@ void exynos_report_trigger(struct thermal_sensor_conf *conf)
> }
>
> th_zone = conf->pzone_data;
> - if (th_zone->therm_dev)
> + if (!th_zone->therm_dev)
> return;
>
> if (th_zone->bind == false) {
> --
> 1.7.10.4
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html

2013-09-30 11:43:58

by amit daniel kachhap

[permalink] [raw]
Subject: Re: [PATCH 2/6] thermal: exynos: Provide separate TMU data for Exynos4412

On Tue, Sep 24, 2013 at 1:38 PM, Lukasz Majewski <[email protected]> wrote:
> 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.
>
> Signed-off-by: Lukasz Majewski <[email protected]>
> Reviewed-by: Bartlomiej Zolnierkiewicz <[email protected]>
> Reviewed-by: Tomasz Figa <[email protected]>
Reviewed-by: Amit Daniel Kachhap<[email protected]>

Thanks,
Amit Daniel
> ---
> drivers/thermal/samsung/exynos_tmu.c | 7 ++++---
> drivers/thermal/samsung/exynos_tmu.h | 1 +
> drivers/thermal/samsung/exynos_tmu_data.c | 26 ++++++++++++++++++++------
> drivers/thermal/samsung/exynos_tmu_data.h | 9 ++++++++-
> 4 files changed, 33 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung/exynos_tmu.c
> index b43afda..a858cc4 100644
> --- a/drivers/thermal/samsung/exynos_tmu.c
> +++ b/drivers/thermal/samsung/exynos_tmu.c
> @@ -488,7 +488,7 @@ static const struct of_device_id exynos_tmu_match[] = {
> },
> {
> .compatible = "samsung,exynos4412-tmu",
> - .data = (void *)EXYNOS5250_TMU_DRV_DATA,
> + .data = (void *)EXYNOS4412_TMU_DRV_DATA,
> },
> {
> .compatible = "samsung,exynos5250-tmu",
> @@ -630,8 +630,9 @@ static int exynos_tmu_probe(struct platform_device *pdev)
> return ret;
>
> if (pdata->type == SOC_ARCH_EXYNOS ||
> - pdata->type == SOC_ARCH_EXYNOS4210 ||
> - pdata->type == SOC_ARCH_EXYNOS5440)
> + pdata->type == SOC_ARCH_EXYNOS4210 ||
> + pdata->type == SOC_ARCH_EXYNOS4412 ||
> + pdata->type == SOC_ARCH_EXYNOS5440)
> data->soc = pdata->type;
> else {
> ret = -EINVAL;
> diff --git a/drivers/thermal/samsung/exynos_tmu.h b/drivers/thermal/samsung/exynos_tmu.h
> index b364c9e..db37df0 100644
> --- a/drivers/thermal/samsung/exynos_tmu.h
> +++ b/drivers/thermal/samsung/exynos_tmu.h
> @@ -41,6 +41,7 @@ enum calibration_mode {
>
> enum soc_type {
> SOC_ARCH_EXYNOS4210 = 1,
> + SOC_ARCH_EXYNOS4412,
> SOC_ARCH_EXYNOS,
> SOC_ARCH_EXYNOS5440,
> };
> diff --git a/drivers/thermal/samsung/exynos_tmu_data.c b/drivers/thermal/samsung/exynos_tmu_data.c
> index 9002499..bd08093 100644
> --- a/drivers/thermal/samsung/exynos_tmu_data.c
> +++ b/drivers/thermal/samsung/exynos_tmu_data.c
> @@ -90,8 +90,8 @@ struct exynos_tmu_init_data const exynos4210_default_tmu_data = {
> };
> #endif
>
> -#if defined(CONFIG_SOC_EXYNOS5250) || defined(CONFIG_SOC_EXYNOS4412)
> -static const struct exynos_tmu_registers exynos5250_tmu_registers = {
> +#if defined(CONFIG_SOC_EXYNOS4412) || defined(CONFIG_SOC_EXYNOS5250)
> +static const struct exynos_tmu_registers exynos4412_tmu_registers = {
> .triminfo_data = EXYNOS_TMU_REG_TRIMINFO,
> .triminfo_25_shift = EXYNOS_TRIMINFO_25_SHIFT,
> .triminfo_85_shift = EXYNOS_TRIMINFO_85_SHIFT,
> @@ -128,7 +128,7 @@ static const struct exynos_tmu_registers exynos5250_tmu_registers = {
> .emul_time_mask = EXYNOS_EMUL_TIME_MASK,
> };
>
> -#define EXYNOS5250_TMU_DATA \
> +#define EXYNOS4412_TMU_DATA \
> .threshold_falling = 10, \
> .trigger_levels[0] = 85, \
> .trigger_levels[1] = 103, \
> @@ -162,15 +162,29 @@ static const struct exynos_tmu_registers exynos5250_tmu_registers = {
> .temp_level = 103, \
> }, \
> .freq_tab_count = 2, \
> - .type = SOC_ARCH_EXYNOS, \
> - .registers = &exynos5250_tmu_registers, \
> + .registers = &exynos4412_tmu_registers, \
> .features = (TMU_SUPPORT_EMULATION | TMU_SUPPORT_TRIM_RELOAD | \
> TMU_SUPPORT_FALLING_TRIP | TMU_SUPPORT_READY_STATUS | \
> TMU_SUPPORT_EMUL_TIME)
> +#endif
>
> +#if defined(CONFIG_SOC_EXYNOS4412)
> +struct exynos_tmu_init_data const exynos4412_default_tmu_data = {
> + .tmu_data = {
> + { EXYNOS4412_TMU_DATA,
> + .type = SOC_ARCH_EXYNOS4412,
> + },
> + },
> + .tmu_count = 1,
> +};
> +#endif
> +
> +#if defined(CONFIG_SOC_EXYNOS5250)
> struct exynos_tmu_init_data const exynos5250_default_tmu_data = {
> .tmu_data = {
> - { EXYNOS5250_TMU_DATA },
> + { EXYNOS4412_TMU_DATA,
> + .type = SOC_ARCH_EXYNOS,
> + },
> },
> .tmu_count = 1,
> };
> diff --git a/drivers/thermal/samsung/exynos_tmu_data.h b/drivers/thermal/samsung/exynos_tmu_data.h
> index dc7feb5..b130b1e 100644
> --- a/drivers/thermal/samsung/exynos_tmu_data.h
> +++ b/drivers/thermal/samsung/exynos_tmu_data.h
> @@ -138,7 +138,14 @@ extern struct exynos_tmu_init_data const exynos4210_default_tmu_data;
> #define EXYNOS4210_TMU_DRV_DATA (NULL)
> #endif
>
> -#if (defined(CONFIG_SOC_EXYNOS5250) || defined(CONFIG_SOC_EXYNOS4412))
> +#if defined(CONFIG_SOC_EXYNOS4412)
> +extern struct exynos_tmu_init_data const exynos4412_default_tmu_data;
> +#define EXYNOS4412_TMU_DRV_DATA (&exynos4412_default_tmu_data)
> +#else
> +#define EXYNOS4412_TMU_DRV_DATA (NULL)
> +#endif
> +
> +#if defined(CONFIG_SOC_EXYNOS5250)
> extern struct exynos_tmu_init_data const exynos5250_default_tmu_data;
> #define EXYNOS5250_TMU_DRV_DATA (&exynos5250_default_tmu_data)
> #else
> --
> 1.7.10.4
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html

On Tue, Sep 24, 2013 at 1:38 PM, Lukasz Majewski <[email protected]> wrote:
> 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.
>
> Signed-off-by: Lukasz Majewski <[email protected]>
> Reviewed-by: Bartlomiej Zolnierkiewicz <[email protected]>
> Reviewed-by: Tomasz Figa <[email protected]>
> ---
> drivers/thermal/samsung/exynos_tmu.c | 7 ++++---
> drivers/thermal/samsung/exynos_tmu.h | 1 +
> drivers/thermal/samsung/exynos_tmu_data.c | 26 ++++++++++++++++++++------
> drivers/thermal/samsung/exynos_tmu_data.h | 9 ++++++++-
> 4 files changed, 33 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung/exynos_tmu.c
> index b43afda..a858cc4 100644
> --- a/drivers/thermal/samsung/exynos_tmu.c
> +++ b/drivers/thermal/samsung/exynos_tmu.c
> @@ -488,7 +488,7 @@ static const struct of_device_id exynos_tmu_match[] = {
> },
> {
> .compatible = "samsung,exynos4412-tmu",
> - .data = (void *)EXYNOS5250_TMU_DRV_DATA,
> + .data = (void *)EXYNOS4412_TMU_DRV_DATA,
> },
> {
> .compatible = "samsung,exynos5250-tmu",
> @@ -630,8 +630,9 @@ static int exynos_tmu_probe(struct platform_device *pdev)
> return ret;
>
> if (pdata->type == SOC_ARCH_EXYNOS ||
> - pdata->type == SOC_ARCH_EXYNOS4210 ||
> - pdata->type == SOC_ARCH_EXYNOS5440)
> + pdata->type == SOC_ARCH_EXYNOS4210 ||
> + pdata->type == SOC_ARCH_EXYNOS4412 ||
> + pdata->type == SOC_ARCH_EXYNOS5440)
> data->soc = pdata->type;
> else {
> ret = -EINVAL;
> diff --git a/drivers/thermal/samsung/exynos_tmu.h b/drivers/thermal/samsung/exynos_tmu.h
> index b364c9e..db37df0 100644
> --- a/drivers/thermal/samsung/exynos_tmu.h
> +++ b/drivers/thermal/samsung/exynos_tmu.h
> @@ -41,6 +41,7 @@ enum calibration_mode {
>
> enum soc_type {
> SOC_ARCH_EXYNOS4210 = 1,
> + SOC_ARCH_EXYNOS4412,
> SOC_ARCH_EXYNOS,
> SOC_ARCH_EXYNOS5440,
> };
> diff --git a/drivers/thermal/samsung/exynos_tmu_data.c b/drivers/thermal/samsung/exynos_tmu_data.c
> index 9002499..bd08093 100644
> --- a/drivers/thermal/samsung/exynos_tmu_data.c
> +++ b/drivers/thermal/samsung/exynos_tmu_data.c
> @@ -90,8 +90,8 @@ struct exynos_tmu_init_data const exynos4210_default_tmu_data = {
> };
> #endif
>
> -#if defined(CONFIG_SOC_EXYNOS5250) || defined(CONFIG_SOC_EXYNOS4412)
> -static const struct exynos_tmu_registers exynos5250_tmu_registers = {
> +#if defined(CONFIG_SOC_EXYNOS4412) || defined(CONFIG_SOC_EXYNOS5250)
> +static const struct exynos_tmu_registers exynos4412_tmu_registers = {
> .triminfo_data = EXYNOS_TMU_REG_TRIMINFO,
> .triminfo_25_shift = EXYNOS_TRIMINFO_25_SHIFT,
> .triminfo_85_shift = EXYNOS_TRIMINFO_85_SHIFT,
> @@ -128,7 +128,7 @@ static const struct exynos_tmu_registers exynos5250_tmu_registers = {
> .emul_time_mask = EXYNOS_EMUL_TIME_MASK,
> };
>
> -#define EXYNOS5250_TMU_DATA \
> +#define EXYNOS4412_TMU_DATA \
> .threshold_falling = 10, \
> .trigger_levels[0] = 85, \
> .trigger_levels[1] = 103, \
> @@ -162,15 +162,29 @@ static const struct exynos_tmu_registers exynos5250_tmu_registers = {
> .temp_level = 103, \
> }, \
> .freq_tab_count = 2, \
> - .type = SOC_ARCH_EXYNOS, \
> - .registers = &exynos5250_tmu_registers, \
> + .registers = &exynos4412_tmu_registers, \
> .features = (TMU_SUPPORT_EMULATION | TMU_SUPPORT_TRIM_RELOAD | \
> TMU_SUPPORT_FALLING_TRIP | TMU_SUPPORT_READY_STATUS | \
> TMU_SUPPORT_EMUL_TIME)
> +#endif
>
> +#if defined(CONFIG_SOC_EXYNOS4412)
> +struct exynos_tmu_init_data const exynos4412_default_tmu_data = {
> + .tmu_data = {
> + { EXYNOS4412_TMU_DATA,
> + .type = SOC_ARCH_EXYNOS4412,
> + },
> + },
> + .tmu_count = 1,
> +};
> +#endif
> +
> +#if defined(CONFIG_SOC_EXYNOS5250)
> struct exynos_tmu_init_data const exynos5250_default_tmu_data = {
> .tmu_data = {
> - { EXYNOS5250_TMU_DATA },
> + { EXYNOS4412_TMU_DATA,
> + .type = SOC_ARCH_EXYNOS,
> + },
> },
> .tmu_count = 1,
> };
> diff --git a/drivers/thermal/samsung/exynos_tmu_data.h b/drivers/thermal/samsung/exynos_tmu_data.h
> index dc7feb5..b130b1e 100644
> --- a/drivers/thermal/samsung/exynos_tmu_data.h
> +++ b/drivers/thermal/samsung/exynos_tmu_data.h
> @@ -138,7 +138,14 @@ extern struct exynos_tmu_init_data const exynos4210_default_tmu_data;
> #define EXYNOS4210_TMU_DRV_DATA (NULL)
> #endif
>
> -#if (defined(CONFIG_SOC_EXYNOS5250) || defined(CONFIG_SOC_EXYNOS4412))
> +#if defined(CONFIG_SOC_EXYNOS4412)
> +extern struct exynos_tmu_init_data const exynos4412_default_tmu_data;
> +#define EXYNOS4412_TMU_DRV_DATA (&exynos4412_default_tmu_data)
> +#else
> +#define EXYNOS4412_TMU_DRV_DATA (NULL)
> +#endif
> +
> +#if defined(CONFIG_SOC_EXYNOS5250)
> extern struct exynos_tmu_init_data const exynos5250_default_tmu_data;
> #define EXYNOS5250_TMU_DRV_DATA (&exynos5250_default_tmu_data)
> #else
> --
> 1.7.10.4
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html

2013-09-30 11:59:27

by amit daniel kachhap

[permalink] [raw]
Subject: Re: [PATCH 3/6] thermal: exynos: Provide initial setting for TMU's test MUX address at Exynos4412

Hi,

On Tue, Sep 24, 2013 at 1:38 PM, Lukasz Majewski <[email protected]> wrote:
> 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.
Right In 5250 this field is not defined so didn't catch this. The
changes looks fine but I have a minor comment that if this field is
defined in 4412 in detail then you can add a field entry in
exynos_tmu_registers with proper name and populate this field. The
good thing is that in 5250 also this field is reserved and the default
value is 0x6 so same TMU_DATA can be used for 5250 and 4412. The main
idea of this suggestion is to reduce the soc checks in the driver.

Thanks,
Amit Daniel
>
> Signed-off-by: Lukasz Majewski <[email protected]>
> Reviewed-by: Bartlomiej Zolnierkiewicz <[email protected]>
> Reviewed-by: Tomasz Figa <[email protected]>
> ---
> drivers/thermal/samsung/exynos_tmu.c | 3 +++
> drivers/thermal/samsung/exynos_tmu_data.h | 4 ++++
> 2 files changed, 7 insertions(+)
>
> diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung/exynos_tmu.c
> index a858cc4..21b89e4 100644
> --- a/drivers/thermal/samsung/exynos_tmu.c
> +++ b/drivers/thermal/samsung/exynos_tmu.c
> @@ -317,6 +317,9 @@ static void exynos_tmu_control(struct platform_device *pdev, bool on)
>
> con = readl(data->base + reg->tmu_ctrl);
>
> + if (pdata->type == SOC_ARCH_EXYNOS4412)
> + con |= (EXYNOS4412_MUX_ADDR_VALUE << EXYNOS4412_MUX_ADDR_SHIFT);
> +
> if (pdata->reference_voltage) {
> con &= ~(reg->buf_vref_sel_mask << reg->buf_vref_sel_shift);
> con |= pdata->reference_voltage << reg->buf_vref_sel_shift;
> diff --git a/drivers/thermal/samsung/exynos_tmu_data.h b/drivers/thermal/samsung/exynos_tmu_data.h
> index b130b1e..a1ea19d 100644
> --- a/drivers/thermal/samsung/exynos_tmu_data.h
> +++ b/drivers/thermal/samsung/exynos_tmu_data.h
> @@ -95,6 +95,10 @@
>
> #define EXYNOS_MAX_TRIGGER_PER_REG 4
>
> +/* Exynos4412 specific */
> +#define EXYNOS4412_MUX_ADDR_VALUE 6
> +#define EXYNOS4412_MUX_ADDR_SHIFT 20
> +
> /*exynos5440 specific registers*/
> #define EXYNOS5440_TMU_S0_7_TRIM 0x000
> #define EXYNOS5440_TMU_S0_7_CTRL 0x020
> --
> 1.7.10.4
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-pm" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html

On Tue, Sep 24, 2013 at 1:38 PM, Lukasz Majewski <[email protected]> wrote:
> 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 <[email protected]>
> Reviewed-by: Bartlomiej Zolnierkiewicz <[email protected]>
> Reviewed-by: Tomasz Figa <[email protected]>
> ---
> drivers/thermal/samsung/exynos_tmu.c | 3 +++
> drivers/thermal/samsung/exynos_tmu_data.h | 4 ++++
> 2 files changed, 7 insertions(+)
>
> diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung/exynos_tmu.c
> index a858cc4..21b89e4 100644
> --- a/drivers/thermal/samsung/exynos_tmu.c
> +++ b/drivers/thermal/samsung/exynos_tmu.c
> @@ -317,6 +317,9 @@ static void exynos_tmu_control(struct platform_device *pdev, bool on)
>
> con = readl(data->base + reg->tmu_ctrl);
>
> + if (pdata->type == SOC_ARCH_EXYNOS4412)
> + con |= (EXYNOS4412_MUX_ADDR_VALUE << EXYNOS4412_MUX_ADDR_SHIFT);
> +
> if (pdata->reference_voltage) {
> con &= ~(reg->buf_vref_sel_mask << reg->buf_vref_sel_shift);
> con |= pdata->reference_voltage << reg->buf_vref_sel_shift;
> diff --git a/drivers/thermal/samsung/exynos_tmu_data.h b/drivers/thermal/samsung/exynos_tmu_data.h
> index b130b1e..a1ea19d 100644
> --- a/drivers/thermal/samsung/exynos_tmu_data.h
> +++ b/drivers/thermal/samsung/exynos_tmu_data.h
> @@ -95,6 +95,10 @@
>
> #define EXYNOS_MAX_TRIGGER_PER_REG 4
>
> +/* Exynos4412 specific */
> +#define EXYNOS4412_MUX_ADDR_VALUE 6
> +#define EXYNOS4412_MUX_ADDR_SHIFT 20
> +
> /*exynos5440 specific registers*/
> #define EXYNOS5440_TMU_S0_7_TRIM 0x000
> #define EXYNOS5440_TMU_S0_7_CTRL 0x020
> --
> 1.7.10.4
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-pm" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html

2013-09-30 12:02:54

by amit daniel kachhap

[permalink] [raw]
Subject: Re: [PATCH 4/6] thermal: exynos: Replace SOC_ARCH_EXYNOS with SOC_ARCH_EXYNOS5250

On Tue, Sep 24, 2013 at 1:38 PM, Lukasz Majewski <[email protected]> wrote:
> The TMU data definition is now separated to Exynos4412 and Exynos5250.
>
> Now SOC_ARCH_EXYNOS only refers to Exynos5250. Hence the name
> SOC_ARCH_EXYNOS has been changed to SOC_ARCH_EXYNOS5250.
>
> Signed-off-by: Lukasz Majewski <[email protected]>
Changes looks fine.
Reviewed-by: Amit Daniel Kachhap<[email protected]>

Thanks,
Amit
> ---
> drivers/thermal/samsung/exynos_tmu.c | 4 ++--
> drivers/thermal/samsung/exynos_tmu.h | 2 +-
> drivers/thermal/samsung/exynos_tmu_data.c | 2 +-
> 3 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung/exynos_tmu.c
> index 21b89e4..037cd46 100644
> --- a/drivers/thermal/samsung/exynos_tmu.c
> +++ b/drivers/thermal/samsung/exynos_tmu.c
> @@ -632,9 +632,9 @@ static int exynos_tmu_probe(struct platform_device *pdev)
> if (ret)
> return ret;
>
> - if (pdata->type == SOC_ARCH_EXYNOS ||
> - pdata->type == SOC_ARCH_EXYNOS4210 ||
> + if (pdata->type == SOC_ARCH_EXYNOS4210 ||
> pdata->type == SOC_ARCH_EXYNOS4412 ||
> + pdata->type == SOC_ARCH_EXYNOS5250 ||
> pdata->type == SOC_ARCH_EXYNOS5440)
> data->soc = pdata->type;
> else {
> diff --git a/drivers/thermal/samsung/exynos_tmu.h b/drivers/thermal/samsung/exynos_tmu.h
> index db37df0..b42ece4 100644
> --- a/drivers/thermal/samsung/exynos_tmu.h
> +++ b/drivers/thermal/samsung/exynos_tmu.h
> @@ -42,7 +42,7 @@ enum calibration_mode {
> enum soc_type {
> SOC_ARCH_EXYNOS4210 = 1,
> SOC_ARCH_EXYNOS4412,
> - SOC_ARCH_EXYNOS,
> + SOC_ARCH_EXYNOS5250,
> SOC_ARCH_EXYNOS5440,
> };
>
> diff --git a/drivers/thermal/samsung/exynos_tmu_data.c b/drivers/thermal/samsung/exynos_tmu_data.c
> index bd08093..188223f 100644
> --- a/drivers/thermal/samsung/exynos_tmu_data.c
> +++ b/drivers/thermal/samsung/exynos_tmu_data.c
> @@ -183,7 +183,7 @@ struct exynos_tmu_init_data const exynos4412_default_tmu_data = {
> struct exynos_tmu_init_data const exynos5250_default_tmu_data = {
> .tmu_data = {
> { EXYNOS4412_TMU_DATA,
> - .type = SOC_ARCH_EXYNOS,
> + .type = SOC_ARCH_EXYNOS5250,
> },
> },
> .tmu_count = 1,
> --
> 1.7.10.4
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html

2013-10-01 06:55:15

by Lukasz Majewski

[permalink] [raw]
Subject: Re: [PATCH 3/6] thermal: exynos: Provide initial setting for TMU's test MUX address at Exynos4412

Hi Amit,

> Hi,
>
> On Tue, Sep 24, 2013 at 1:38 PM, Lukasz Majewski
> <[email protected]> wrote:
> > 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.
> Right In 5250 this field is not defined so didn't catch this. The
> changes looks fine but I have a minor comment that if this field is
> defined in 4412 in detail then you can add a field entry in
> exynos_tmu_registers with proper name and populate this field.

It seems, that only at Exynos4412 (and Exynos4212) this field is valid.
When I extent exynos_tmu_registers structure, then all other Samsung
SoCs will be aware of it.
Define with explicit EXYNOS4412 seems more readable.


Also at exynos_tmu_control() function we use constructs like:
data->base + EXYNOS_TMU_REG_CONTROL, not data->base + regs->tmu_ctrl.

> The
> good thing is that in 5250 also this field is reserved and the default
> value is 0x6 so same TMU_DATA can be used for 5250 and 4412.

I'm not keen to this kind of hacks. This field is only valid on
Exynos4x12. And for Exynos5250 is reserved, which means that we shall
not touch it.

> The main
> idea of this suggestion is to reduce the soc checks in the driver.

Correct me if I'm wrong, but this MUX_ADDR initialization is performed
at exynos_tmu_control() which is called at probe and thermal power
management functions. Therefore, it seems that checking if SoC ==
Exynos4412 there is not an overkill.

If you don't mind I would leave those patches as they are and kindly
ask thermal maintainers for pulling them to v3.12.

>
> Thanks,
> Amit Daniel
> >
> > Signed-off-by: Lukasz Majewski <[email protected]>
> > Reviewed-by: Bartlomiej Zolnierkiewicz <[email protected]>
> > Reviewed-by: Tomasz Figa <[email protected]>
> > ---
> > drivers/thermal/samsung/exynos_tmu.c | 3 +++
> > drivers/thermal/samsung/exynos_tmu_data.h | 4 ++++
> > 2 files changed, 7 insertions(+)
> >
> > diff --git a/drivers/thermal/samsung/exynos_tmu.c
> > b/drivers/thermal/samsung/exynos_tmu.c index a858cc4..21b89e4 100644
> > --- a/drivers/thermal/samsung/exynos_tmu.c
> > +++ b/drivers/thermal/samsung/exynos_tmu.c
> > @@ -317,6 +317,9 @@ static void exynos_tmu_control(struct
> > platform_device *pdev, bool on)
> >
> > con = readl(data->base + reg->tmu_ctrl);
> >
> > + if (pdata->type == SOC_ARCH_EXYNOS4412)
> > + con |= (EXYNOS4412_MUX_ADDR_VALUE <<
> > EXYNOS4412_MUX_ADDR_SHIFT); +
> > if (pdata->reference_voltage) {
> > con &= ~(reg->buf_vref_sel_mask <<
> > reg->buf_vref_sel_shift); con |= pdata->reference_voltage <<
> > reg->buf_vref_sel_shift; diff --git
> > a/drivers/thermal/samsung/exynos_tmu_data.h
> > b/drivers/thermal/samsung/exynos_tmu_data.h index b130b1e..a1ea19d
> > 100644 --- a/drivers/thermal/samsung/exynos_tmu_data.h +++
> > b/drivers/thermal/samsung/exynos_tmu_data.h @@ -95,6 +95,10 @@
> >
> > #define EXYNOS_MAX_TRIGGER_PER_REG 4
> >
> > +/* Exynos4412 specific */
> > +#define EXYNOS4412_MUX_ADDR_VALUE 6
> > +#define EXYNOS4412_MUX_ADDR_SHIFT 20
> > +
> > /*exynos5440 specific registers*/
> > #define EXYNOS5440_TMU_S0_7_TRIM 0x000
> > #define EXYNOS5440_TMU_S0_7_CTRL 0x020
> > --
> > 1.7.10.4
> >
> > --
> > To unsubscribe from this list: send the line "unsubscribe linux-pm"
> > in the body of a message to [email protected]
> > More majordomo info at http://vger.kernel.org/majordomo-info.html
>
> On Tue, Sep 24, 2013 at 1:38 PM, Lukasz Majewski
> <[email protected]> wrote:
> > 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 <[email protected]>
> > Reviewed-by: Bartlomiej Zolnierkiewicz <[email protected]>
> > Reviewed-by: Tomasz Figa <[email protected]>
> > ---
> > drivers/thermal/samsung/exynos_tmu.c | 3 +++
> > drivers/thermal/samsung/exynos_tmu_data.h | 4 ++++
> > 2 files changed, 7 insertions(+)
> >
> > diff --git a/drivers/thermal/samsung/exynos_tmu.c
> > b/drivers/thermal/samsung/exynos_tmu.c index a858cc4..21b89e4 100644
> > --- a/drivers/thermal/samsung/exynos_tmu.c
> > +++ b/drivers/thermal/samsung/exynos_tmu.c
> > @@ -317,6 +317,9 @@ static void exynos_tmu_control(struct
> > platform_device *pdev, bool on)
> >
> > con = readl(data->base + reg->tmu_ctrl);
> >
> > + if (pdata->type == SOC_ARCH_EXYNOS4412)
> > + con |= (EXYNOS4412_MUX_ADDR_VALUE <<
> > EXYNOS4412_MUX_ADDR_SHIFT); +
> > if (pdata->reference_voltage) {
> > con &= ~(reg->buf_vref_sel_mask <<
> > reg->buf_vref_sel_shift); con |= pdata->reference_voltage <<
> > reg->buf_vref_sel_shift; diff --git
> > a/drivers/thermal/samsung/exynos_tmu_data.h
> > b/drivers/thermal/samsung/exynos_tmu_data.h index b130b1e..a1ea19d
> > 100644 --- a/drivers/thermal/samsung/exynos_tmu_data.h +++
> > b/drivers/thermal/samsung/exynos_tmu_data.h @@ -95,6 +95,10 @@
> >
> > #define EXYNOS_MAX_TRIGGER_PER_REG 4
> >
> > +/* Exynos4412 specific */
> > +#define EXYNOS4412_MUX_ADDR_VALUE 6
> > +#define EXYNOS4412_MUX_ADDR_SHIFT 20
> > +
> > /*exynos5440 specific registers*/
> > #define EXYNOS5440_TMU_S0_7_TRIM 0x000
> > #define EXYNOS5440_TMU_S0_7_CTRL 0x020
> > --
> > 1.7.10.4
> >
> > --
> > To unsubscribe from this list: send the line "unsubscribe linux-pm"
> > in the body of a message to [email protected]
> > More majordomo info at http://vger.kernel.org/majordomo-info.html



--
Best regards,

Lukasz Majewski

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

2013-10-03 13:29:58

by Lukasz Majewski

[permalink] [raw]
Subject: Re: [PATCH 0/6] thermal: exynos: Fixes for v3.12

Dear All,

> This patch series is divided into two parts:
> 1. Device tree node definition and enabelement for TMU at Exynos4412
> (Trats2) 2. Exynos thermal subsystem regressions for v3.12-rc1.
> Several commits were necessary to properly fix regression for TMU
> test MUX address setting after reset.

Zhang or Eduardo - will you find time to review those changes?
They have already been reviewed by Amit.

Now we have -rc3 and there is no feedback for regression/critical
patches (posted for -rc1).

>
> Test HW:
> - Exynos4412 - TRATS2 board (Linux v3.12-rc1)
>
> Lukasz Majewski (6):
> thermal: exynos: fix: Return from exynos_report_trigger() when
> therm_dev is NULL
> thermal: exynos: Provide separate TMU data for Exynos4412
> thermal: exynos: Provide initial setting for TMU's test MUX address
> at Exynos4412
> thermal: exynos: Replace SOC_ARCH_EXYNOS with SOC_ARCH_EXYNOS5250
> ARM: dts: exynos4x12: Device tree node definition for TMU on
> Exynos4x12
> ARM: dts: exynos4412-trats2: Enable TMU support at Trats2
>
> arch/arm/boot/dts/exynos4412-trats2.dts | 5 +++++
> arch/arm/boot/dts/exynos4x12.dtsi | 10 +++++++++
> drivers/thermal/samsung/exynos_thermal_common.c | 2 +-
> drivers/thermal/samsung/exynos_tmu.c | 12 +++++++----
> drivers/thermal/samsung/exynos_tmu.h | 3 ++-
> drivers/thermal/samsung/exynos_tmu_data.c | 26
> +++++++++++++++++------
> drivers/thermal/samsung/exynos_tmu_data.h | 13 +++++++++++- 7
> files changed, 58 insertions(+), 13 deletions(-)
>



--
Best regards,

Lukasz Majewski

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

2013-10-03 21:41:11

by Eduardo Valentin

[permalink] [raw]
Subject: Re: [PATCH 1/6] thermal: exynos: fix: Return from exynos_report_trigger() when therm_dev is NULL

On 24-09-2013 04:08, Lukasz Majewski wrote:
> 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.
> This patch fixes it.
>
> Signed-off-by: Lukasz Majewski <[email protected]>
> Reviewed-by: Bartlomiej Zolnierkiewicz <[email protected]>
> Reviewed-by: Tomasz Figa <[email protected]>
> ---
> drivers/thermal/samsung/exynos_thermal_common.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/thermal/samsung/exynos_thermal_common.c b/drivers/thermal/samsung/exynos_thermal_common.c
> index f10a6ad..55a912a 100644
> --- a/drivers/thermal/samsung/exynos_thermal_common.c
> +++ b/drivers/thermal/samsung/exynos_thermal_common.c
> @@ -310,7 +310,7 @@ void exynos_report_trigger(struct thermal_sensor_conf *conf)
> }
>
> th_zone = conf->pzone_data;
> - if (th_zone->therm_dev)
> + if (!th_zone->therm_dev)

Fine with this fix, as it really looks obvious. But after reading the
code a bit, I am considering if we can remove the above check at all.

Reading the driver code piece at drivers/thermal/samsung/exynos_tmu.c,
by checking how exynos_register_thermal gets called, and how error is
handled, I assume we do not need to check for th_zone->therm_dev.

To me looks like the driver only allows th_zone's exist only with valid
therm_dev, isn't it? Except for the probe sequence, maybe, at run time
there is a time window that we have valid th_zone with invalid
therm_dev. However, reading the probe, still, the irq gets initialized
only in very end, so the work queue don't get queue till then at least.

So, my question before acking is, shall we remove this check altogether?


> return;
>
> if (th_zone->bind == false) {
>


--
You have got to be excited about what you are doing. (L. Lamport)

Eduardo Valentin


Attachments:
signature.asc (295.00 B)
OpenPGP digital signature

2013-10-03 22:02:08

by Eduardo Valentin

[permalink] [raw]
Subject: Re: [PATCH 2/6] thermal: exynos: Provide separate TMU data for Exynos4412

Lukasz,

Just minor comments.

On 24-09-2013 04:08, Lukasz Majewski wrote:
> 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.

It is not clear the objective of the patch itself. Was it just to make
the code more readable or are you fixing something?

>
> Signed-off-by: Lukasz Majewski <[email protected]>
> Reviewed-by: Bartlomiej Zolnierkiewicz <[email protected]>
> Reviewed-by: Tomasz Figa <[email protected]>
> ---
> drivers/thermal/samsung/exynos_tmu.c | 7 ++++---
> drivers/thermal/samsung/exynos_tmu.h | 1 +
> drivers/thermal/samsung/exynos_tmu_data.c | 26 ++++++++++++++++++++------
> drivers/thermal/samsung/exynos_tmu_data.h | 9 ++++++++-
> 4 files changed, 33 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung/exynos_tmu.c
> index b43afda..a858cc4 100644
> --- a/drivers/thermal/samsung/exynos_tmu.c
> +++ b/drivers/thermal/samsung/exynos_tmu.c
> @@ -488,7 +488,7 @@ static const struct of_device_id exynos_tmu_match[] = {
> },
> {
> .compatible = "samsung,exynos4412-tmu",
> - .data = (void *)EXYNOS5250_TMU_DRV_DATA,
> + .data = (void *)EXYNOS4412_TMU_DRV_DATA,
> },
> {
> .compatible = "samsung,exynos5250-tmu",
> @@ -630,8 +630,9 @@ static int exynos_tmu_probe(struct platform_device *pdev)
> return ret;
>
> if (pdata->type == SOC_ARCH_EXYNOS ||
> - pdata->type == SOC_ARCH_EXYNOS4210 ||
> - pdata->type == SOC_ARCH_EXYNOS5440)
> + pdata->type == SOC_ARCH_EXYNOS4210 ||
> + pdata->type == SOC_ARCH_EXYNOS4412 ||
> + pdata->type == SOC_ARCH_EXYNOS5440)
> data->soc = pdata->type;
> else {
> ret = -EINVAL;
> diff --git a/drivers/thermal/samsung/exynos_tmu.h b/drivers/thermal/samsung/exynos_tmu.h
> index b364c9e..db37df0 100644
> --- a/drivers/thermal/samsung/exynos_tmu.h
> +++ b/drivers/thermal/samsung/exynos_tmu.h
> @@ -41,6 +41,7 @@ enum calibration_mode {
>
> enum soc_type {
> SOC_ARCH_EXYNOS4210 = 1,
> + SOC_ARCH_EXYNOS4412,
> SOC_ARCH_EXYNOS,
> SOC_ARCH_EXYNOS5440,
> };

I believe the above enum needs some documentation. SOC_ARCH_EXYNOS seams
to be a bit confusing.

> diff --git a/drivers/thermal/samsung/exynos_tmu_data.c b/drivers/thermal/samsung/exynos_tmu_data.c
> index 9002499..bd08093 100644
> --- a/drivers/thermal/samsung/exynos_tmu_data.c
> +++ b/drivers/thermal/samsung/exynos_tmu_data.c
> @@ -90,8 +90,8 @@ struct exynos_tmu_init_data const exynos4210_default_tmu_data = {
> };
> #endif
>
> -#if defined(CONFIG_SOC_EXYNOS5250) || defined(CONFIG_SOC_EXYNOS4412)
> -static const struct exynos_tmu_registers exynos5250_tmu_registers = {
> +#if defined(CONFIG_SOC_EXYNOS4412) || defined(CONFIG_SOC_EXYNOS5250)
> +static const struct exynos_tmu_registers exynos4412_tmu_registers = {
> .triminfo_data = EXYNOS_TMU_REG_TRIMINFO,
> .triminfo_25_shift = EXYNOS_TRIMINFO_25_SHIFT,
> .triminfo_85_shift = EXYNOS_TRIMINFO_85_SHIFT,
> @@ -128,7 +128,7 @@ static const struct exynos_tmu_registers exynos5250_tmu_registers = {
> .emul_time_mask = EXYNOS_EMUL_TIME_MASK,
> };
>
> -#define EXYNOS5250_TMU_DATA \
> +#define EXYNOS4412_TMU_DATA \
> .threshold_falling = 10, \
> .trigger_levels[0] = 85, \
> .trigger_levels[1] = 103, \
> @@ -162,15 +162,29 @@ static const struct exynos_tmu_registers exynos5250_tmu_registers = {
> .temp_level = 103, \
> }, \
> .freq_tab_count = 2, \
> - .type = SOC_ARCH_EXYNOS, \
> - .registers = &exynos5250_tmu_registers, \
> + .registers = &exynos4412_tmu_registers, \
> .features = (TMU_SUPPORT_EMULATION | TMU_SUPPORT_TRIM_RELOAD | \
> TMU_SUPPORT_FALLING_TRIP | TMU_SUPPORT_READY_STATUS | \
> TMU_SUPPORT_EMUL_TIME)
> +#endif
>
> +#if defined(CONFIG_SOC_EXYNOS4412)
> +struct exynos_tmu_init_data const exynos4412_default_tmu_data = {
> + .tmu_data = {
> + { EXYNOS4412_TMU_DATA,
> + .type = SOC_ARCH_EXYNOS4412,
> + },
> + },
> + .tmu_count = 1,
> +};
> +#endif
> +
> +#if defined(CONFIG_SOC_EXYNOS5250)
> struct exynos_tmu_init_data const exynos5250_default_tmu_data = {
> .tmu_data = {
> - { EXYNOS5250_TMU_DATA },
> + { EXYNOS4412_TMU_DATA,
> + .type = SOC_ARCH_EXYNOS,
> + },

Please add a comment on this initialization, specially because we start
to mix macros with inline initialization. Starts to be hard to follow.

Besides, I believe
+ {
+ EXYNOS4412_TMU_DATA,
+ .type = SOC_ARCH_EXYNOS,
+ },

is a much more common style.


> },
> .tmu_count = 1,
> };
> diff --git a/drivers/thermal/samsung/exynos_tmu_data.h b/drivers/thermal/samsung/exynos_tmu_data.h
> index dc7feb5..b130b1e 100644
> --- a/drivers/thermal/samsung/exynos_tmu_data.h
> +++ b/drivers/thermal/samsung/exynos_tmu_data.h
> @@ -138,7 +138,14 @@ extern struct exynos_tmu_init_data const exynos4210_default_tmu_data;
> #define EXYNOS4210_TMU_DRV_DATA (NULL)
> #endif
>
> -#if (defined(CONFIG_SOC_EXYNOS5250) || defined(CONFIG_SOC_EXYNOS4412))
> +#if defined(CONFIG_SOC_EXYNOS4412)
> +extern struct exynos_tmu_init_data const exynos4412_default_tmu_data;
> +#define EXYNOS4412_TMU_DRV_DATA (&exynos4412_default_tmu_data)
> +#else
> +#define EXYNOS4412_TMU_DRV_DATA (NULL)
> +#endif
> +
> +#if defined(CONFIG_SOC_EXYNOS5250)
> extern struct exynos_tmu_init_data const exynos5250_default_tmu_data;
> #define EXYNOS5250_TMU_DRV_DATA (&exynos5250_default_tmu_data)
> #else
>


--
You have got to be excited about what you are doing. (L. Lamport)

Eduardo Valentin


Attachments:
signature.asc (295.00 B)
OpenPGP digital signature

2013-10-03 22:05:37

by Eduardo Valentin

[permalink] [raw]
Subject: Re: [PATCH 3/6] thermal: exynos: Provide initial setting for TMU's test MUX address at Exynos4412

On 24-09-2013 04:08, Lukasz Majewski wrote:
> 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 <[email protected]>
> Reviewed-by: Bartlomiej Zolnierkiewicz <[email protected]>
> Reviewed-by: Tomasz Figa <[email protected]>
> ---
> drivers/thermal/samsung/exynos_tmu.c | 3 +++
> drivers/thermal/samsung/exynos_tmu_data.h | 4 ++++
> 2 files changed, 7 insertions(+)
>
> diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung/exynos_tmu.c
> index a858cc4..21b89e4 100644
> --- a/drivers/thermal/samsung/exynos_tmu.c
> +++ b/drivers/thermal/samsung/exynos_tmu.c
> @@ -317,6 +317,9 @@ static void exynos_tmu_control(struct platform_device *pdev, bool on)
>
> con = readl(data->base + reg->tmu_ctrl);
>
> + if (pdata->type == SOC_ARCH_EXYNOS4412)
> + con |= (EXYNOS4412_MUX_ADDR_VALUE << EXYNOS4412_MUX_ADDR_SHIFT);

Amit has introduced a way to describe features instead of checking
features per type. It would be interesting to have a reasoning why not
to use it. Think what if new Exynos TMU versions come, are you guys
going to steadily increase the above check for type?

> +
> if (pdata->reference_voltage) {
> con &= ~(reg->buf_vref_sel_mask << reg->buf_vref_sel_shift);
> con |= pdata->reference_voltage << reg->buf_vref_sel_shift;
> diff --git a/drivers/thermal/samsung/exynos_tmu_data.h b/drivers/thermal/samsung/exynos_tmu_data.h
> index b130b1e..a1ea19d 100644
> --- a/drivers/thermal/samsung/exynos_tmu_data.h
> +++ b/drivers/thermal/samsung/exynos_tmu_data.h
> @@ -95,6 +95,10 @@
>
> #define EXYNOS_MAX_TRIGGER_PER_REG 4
>
> +/* Exynos4412 specific */
> +#define EXYNOS4412_MUX_ADDR_VALUE 6
> +#define EXYNOS4412_MUX_ADDR_SHIFT 20
> +
> /*exynos5440 specific registers*/
> #define EXYNOS5440_TMU_S0_7_TRIM 0x000
> #define EXYNOS5440_TMU_S0_7_CTRL 0x020
>


--
You have got to be excited about what you are doing. (L. Lamport)

Eduardo Valentin


Attachments:
signature.asc (295.00 B)
OpenPGP digital signature

2013-10-03 22:09:09

by Eduardo Valentin

[permalink] [raw]
Subject: Re: [PATCH 4/6] thermal: exynos: Replace SOC_ARCH_EXYNOS with SOC_ARCH_EXYNOS5250

On 24-09-2013 04:08, Lukasz Majewski wrote:
> The TMU data definition is now separated to Exynos4412 and Exynos5250.
>
> Now SOC_ARCH_EXYNOS only refers to Exynos5250. Hence the name
> SOC_ARCH_EXYNOS has been changed to SOC_ARCH_EXYNOS5250.
>

How about merging this one with patch 02?

> Signed-off-by: Lukasz Majewski <[email protected]>
> ---
> drivers/thermal/samsung/exynos_tmu.c | 4 ++--
> drivers/thermal/samsung/exynos_tmu.h | 2 +-
> drivers/thermal/samsung/exynos_tmu_data.c | 2 +-
> 3 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung/exynos_tmu.c
> index 21b89e4..037cd46 100644
> --- a/drivers/thermal/samsung/exynos_tmu.c
> +++ b/drivers/thermal/samsung/exynos_tmu.c
> @@ -632,9 +632,9 @@ static int exynos_tmu_probe(struct platform_device *pdev)
> if (ret)
> return ret;
>
> - if (pdata->type == SOC_ARCH_EXYNOS ||
> - pdata->type == SOC_ARCH_EXYNOS4210 ||
> + if (pdata->type == SOC_ARCH_EXYNOS4210 ||
> pdata->type == SOC_ARCH_EXYNOS4412 ||
> + pdata->type == SOC_ARCH_EXYNOS5250 ||
> pdata->type == SOC_ARCH_EXYNOS5440)
> data->soc = pdata->type;
> else {
> diff --git a/drivers/thermal/samsung/exynos_tmu.h b/drivers/thermal/samsung/exynos_tmu.h
> index db37df0..b42ece4 100644
> --- a/drivers/thermal/samsung/exynos_tmu.h
> +++ b/drivers/thermal/samsung/exynos_tmu.h
> @@ -42,7 +42,7 @@ enum calibration_mode {
> enum soc_type {
> SOC_ARCH_EXYNOS4210 = 1,
> SOC_ARCH_EXYNOS4412,
> - SOC_ARCH_EXYNOS,
> + SOC_ARCH_EXYNOS5250,
> SOC_ARCH_EXYNOS5440,
> };
>
> diff --git a/drivers/thermal/samsung/exynos_tmu_data.c b/drivers/thermal/samsung/exynos_tmu_data.c
> index bd08093..188223f 100644
> --- a/drivers/thermal/samsung/exynos_tmu_data.c
> +++ b/drivers/thermal/samsung/exynos_tmu_data.c
> @@ -183,7 +183,7 @@ struct exynos_tmu_init_data const exynos4412_default_tmu_data = {
> struct exynos_tmu_init_data const exynos5250_default_tmu_data = {
> .tmu_data = {
> { EXYNOS4412_TMU_DATA,
> - .type = SOC_ARCH_EXYNOS,
> + .type = SOC_ARCH_EXYNOS5250,
> },
> },
> .tmu_count = 1,
>


--
You have got to be excited about what you are doing. (L. Lamport)

Eduardo Valentin


Attachments:
signature.asc (295.00 B)
OpenPGP digital signature

2013-10-04 09:56:24

by Lukasz Majewski

[permalink] [raw]
Subject: Re: [PATCH 1/6] thermal: exynos: fix: Return from exynos_report_trigger() when therm_dev is NULL

Hi Eduardo,

Thanks for reply.

> On 24-09-2013 04:08, Lukasz Majewski wrote:
> > 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. This patch fixes it.
> >
> > Signed-off-by: Lukasz Majewski <[email protected]>
> > Reviewed-by: Bartlomiej Zolnierkiewicz <[email protected]>
> > Reviewed-by: Tomasz Figa <[email protected]>
> > ---
> > drivers/thermal/samsung/exynos_thermal_common.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/thermal/samsung/exynos_thermal_common.c
> > b/drivers/thermal/samsung/exynos_thermal_common.c index
> > f10a6ad..55a912a 100644 ---
> > a/drivers/thermal/samsung/exynos_thermal_common.c +++
> > b/drivers/thermal/samsung/exynos_thermal_common.c @@ -310,7 +310,7
> > @@ void exynos_report_trigger(struct thermal_sensor_conf *conf) }
> >
> > th_zone = conf->pzone_data;
> > - if (th_zone->therm_dev)
> > + if (!th_zone->therm_dev)
>
> Fine with this fix, as it really looks obvious. But after reading the
> code a bit, I am considering if we can remove the above check at all.

I have just preserved the old behaviour for -rcX fix.

>
> Reading the driver code piece at drivers/thermal/samsung/exynos_tmu.c,
> by checking how exynos_register_thermal gets called, and how error is
> handled, I assume we do not need to check for th_zone->therm_dev.

It looks like we don't need this check (we will not register the
thermal zone if therm dev is not correct).

>
> To me looks like the driver only allows th_zone's exist only with
> valid therm_dev, isn't it? Except for the probe sequence, maybe, at
> run time there is a time window that we have valid th_zone with
> invalid therm_dev. However, reading the probe, still, the irq gets
> initialized only in very end, so the work queue don't get queue till
> then at least.
>
> So, my question before acking is, shall we remove this check
> altogether?

I think that it is up to you to decide how we proceed.

Shall this patch go into v3.12-rcX since it is "obvious" (and documents
what and when was broken) or would you require to prepare "new" patch
with removal of this check?

>
>
> > return;
> >
> > if (th_zone->bind == false) {
> >
>
>



--
Best regards,

Lukasz Majewski

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

2013-10-04 10:04:34

by Lukasz Majewski

[permalink] [raw]
Subject: Re: [PATCH 2/6] thermal: exynos: Provide separate TMU data for Exynos4412

Hi Eduardo,

> Lukasz,
>
> Just minor comments.
>
> On 24-09-2013 04:08, Lukasz Majewski wrote:
> > 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.
>
> It is not clear the objective of the patch itself. Was it just to make
> the code more readable or are you fixing something?

I'm fixing thermal on EXYNOS4412 device (trats2). The problem here is
to do it properly, since on the current code EXYNOS4412 and EXYNOS5250
uses the same configuration data.

To fix this problem, I had to split them. Also chronologically the
THERMAL IP first appeared on EXYNOS4412, not EXYNOS5250.

>
> >
> > Signed-off-by: Lukasz Majewski <[email protected]>
> > Reviewed-by: Bartlomiej Zolnierkiewicz <[email protected]>
> > Reviewed-by: Tomasz Figa <[email protected]>
> > ---
> > drivers/thermal/samsung/exynos_tmu.c | 7 ++++---
> > drivers/thermal/samsung/exynos_tmu.h | 1 +
> > drivers/thermal/samsung/exynos_tmu_data.c | 26
> > ++++++++++++++++++++------
> > drivers/thermal/samsung/exynos_tmu_data.h | 9 ++++++++- 4 files
> > changed, 33 insertions(+), 10 deletions(-)
> >
> > diff --git a/drivers/thermal/samsung/exynos_tmu.c
> > b/drivers/thermal/samsung/exynos_tmu.c index b43afda..a858cc4 100644
> > --- a/drivers/thermal/samsung/exynos_tmu.c
> > +++ b/drivers/thermal/samsung/exynos_tmu.c
> > @@ -488,7 +488,7 @@ static const struct of_device_id
> > exynos_tmu_match[] = { },
> > {
> > .compatible = "samsung,exynos4412-tmu",
> > - .data = (void *)EXYNOS5250_TMU_DRV_DATA,
> > + .data = (void *)EXYNOS4412_TMU_DRV_DATA,
> > },
> > {
> > .compatible = "samsung,exynos5250-tmu",
> > @@ -630,8 +630,9 @@ static int exynos_tmu_probe(struct
> > platform_device *pdev) return ret;
> >
> > if (pdata->type == SOC_ARCH_EXYNOS ||
> > - pdata->type == SOC_ARCH_EXYNOS4210 ||
> > - pdata->type == SOC_ARCH_EXYNOS5440)
> > + pdata->type == SOC_ARCH_EXYNOS4210 ||
> > + pdata->type == SOC_ARCH_EXYNOS4412 ||
> > + pdata->type == SOC_ARCH_EXYNOS5440)
> > data->soc = pdata->type;
> > else {
> > ret = -EINVAL;
> > diff --git a/drivers/thermal/samsung/exynos_tmu.h
> > b/drivers/thermal/samsung/exynos_tmu.h index b364c9e..db37df0 100644
> > --- a/drivers/thermal/samsung/exynos_tmu.h
> > +++ b/drivers/thermal/samsung/exynos_tmu.h
> > @@ -41,6 +41,7 @@ enum calibration_mode {
> >
> > enum soc_type {
> > SOC_ARCH_EXYNOS4210 = 1,
> > + SOC_ARCH_EXYNOS4412,
> > SOC_ARCH_EXYNOS,
> > SOC_ARCH_EXYNOS5440,
> > };
>
> I believe the above enum needs some documentation. SOC_ARCH_EXYNOS
> seams to be a bit confusing.

This is fixed at patch 4/6 of the series.

>
> > diff --git a/drivers/thermal/samsung/exynos_tmu_data.c
> > b/drivers/thermal/samsung/exynos_tmu_data.c index 9002499..bd08093
> > 100644 --- a/drivers/thermal/samsung/exynos_tmu_data.c
> > +++ b/drivers/thermal/samsung/exynos_tmu_data.c
> > @@ -90,8 +90,8 @@ struct exynos_tmu_init_data const
> > exynos4210_default_tmu_data = { };
> > #endif
> >
> > -#if defined(CONFIG_SOC_EXYNOS5250) ||
> > defined(CONFIG_SOC_EXYNOS4412) -static const struct
> > exynos_tmu_registers exynos5250_tmu_registers = { +#if
> > defined(CONFIG_SOC_EXYNOS4412) || defined(CONFIG_SOC_EXYNOS5250)
> > +static const struct exynos_tmu_registers exynos4412_tmu_registers
> > = { .triminfo_data = EXYNOS_TMU_REG_TRIMINFO, .triminfo_25_shift =
> > EXYNOS_TRIMINFO_25_SHIFT, .triminfo_85_shift =
> > EXYNOS_TRIMINFO_85_SHIFT, @@ -128,7 +128,7 @@ static const struct
> > exynos_tmu_registers exynos5250_tmu_registers = { .emul_time_mask =
> > EXYNOS_EMUL_TIME_MASK, };
> >
> > -#define EXYNOS5250_TMU_DATA \
> > +#define EXYNOS4412_TMU_DATA \
> > .threshold_falling = 10, \
> > .trigger_levels[0] = 85, \
> > .trigger_levels[1] = 103, \
> > @@ -162,15 +162,29 @@ static const struct exynos_tmu_registers
> > exynos5250_tmu_registers = { .temp_level = 103, \
> > }, \
> > .freq_tab_count = 2, \
> > - .type = SOC_ARCH_EXYNOS, \
> > - .registers = &exynos5250_tmu_registers, \
> > + .registers = &exynos4412_tmu_registers, \
> > .features = (TMU_SUPPORT_EMULATION |
> > TMU_SUPPORT_TRIM_RELOAD | \ TMU_SUPPORT_FALLING_TRIP |
> > TMU_SUPPORT_READY_STATUS | \ TMU_SUPPORT_EMUL_TIME)
> > +#endif
> >
> > +#if defined(CONFIG_SOC_EXYNOS4412)
> > +struct exynos_tmu_init_data const exynos4412_default_tmu_data = {
> > + .tmu_data = {
> > + { EXYNOS4412_TMU_DATA,
> > + .type = SOC_ARCH_EXYNOS4412,
> > + },
> > + },
> > + .tmu_count = 1,
> > +};
> > +#endif
> > +
> > +#if defined(CONFIG_SOC_EXYNOS5250)
> > struct exynos_tmu_init_data const exynos5250_default_tmu_data = {
> > .tmu_data = {
> > - { EXYNOS5250_TMU_DATA },
> > + { EXYNOS4412_TMU_DATA,
> > + .type = SOC_ARCH_EXYNOS,
> > + },
>
> Please add a comment on this initialization, specially because we
> start to mix macros with inline initialization. Starts to be hard to
> follow.
>
> Besides, I believe
> + {
> + EXYNOS4412_TMU_DATA,
> + .type = SOC_ARCH_EXYNOS,
> + },
>
> is a much more common style.

Ok.

>
>
> > },
> > .tmu_count = 1,
> > };
> > diff --git a/drivers/thermal/samsung/exynos_tmu_data.h
> > b/drivers/thermal/samsung/exynos_tmu_data.h index dc7feb5..b130b1e
> > 100644 --- a/drivers/thermal/samsung/exynos_tmu_data.h
> > +++ b/drivers/thermal/samsung/exynos_tmu_data.h
> > @@ -138,7 +138,14 @@ extern struct exynos_tmu_init_data const
> > exynos4210_default_tmu_data; #define EXYNOS4210_TMU_DRV_DATA (NULL)
> > #endif
> >
> > -#if (defined(CONFIG_SOC_EXYNOS5250) ||
> > defined(CONFIG_SOC_EXYNOS4412)) +#if defined(CONFIG_SOC_EXYNOS4412)
> > +extern struct exynos_tmu_init_data const
> > exynos4412_default_tmu_data; +#define EXYNOS4412_TMU_DRV_DATA
> > (&exynos4412_default_tmu_data) +#else
> > +#define EXYNOS4412_TMU_DRV_DATA (NULL)
> > +#endif
> > +
> > +#if defined(CONFIG_SOC_EXYNOS5250)
> > extern struct exynos_tmu_init_data const
> > exynos5250_default_tmu_data; #define EXYNOS5250_TMU_DRV_DATA
> > (&exynos5250_default_tmu_data) #else
> >
>
>



--
Best regards,

Lukasz Majewski

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

Subject: Re: [PATCH 4/6] thermal: exynos: Replace SOC_ARCH_EXYNOS with SOC_ARCH_EXYNOS5250


Hi,

On Thursday, October 03, 2013 06:08:45 PM Eduardo Valentin wrote:
> On 24-09-2013 04:08, Lukasz Majewski wrote:
> > The TMU data definition is now separated to Exynos4412 and Exynos5250.
> >
> > Now SOC_ARCH_EXYNOS only refers to Exynos5250. Hence the name
> > SOC_ARCH_EXYNOS has been changed to SOC_ARCH_EXYNOS5250.
> >
>
> How about merging this one with patch 02?

I would prefer that this is not done since patch #2 is a separate logical
change and it should be kept as a minimal preparatory patch for patch #3
(which is an important bugfix) to make potential backporting of fixes into
-stable etc. easier.

Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics

> > Signed-off-by: Lukasz Majewski <[email protected]>
> > ---
> > drivers/thermal/samsung/exynos_tmu.c | 4 ++--
> > drivers/thermal/samsung/exynos_tmu.h | 2 +-
> > drivers/thermal/samsung/exynos_tmu_data.c | 2 +-
> > 3 files changed, 4 insertions(+), 4 deletions(-)
> >
> > diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung/exynos_tmu.c
> > index 21b89e4..037cd46 100644
> > --- a/drivers/thermal/samsung/exynos_tmu.c
> > +++ b/drivers/thermal/samsung/exynos_tmu.c
> > @@ -632,9 +632,9 @@ static int exynos_tmu_probe(struct platform_device *pdev)
> > if (ret)
> > return ret;
> >
> > - if (pdata->type == SOC_ARCH_EXYNOS ||
> > - pdata->type == SOC_ARCH_EXYNOS4210 ||
> > + if (pdata->type == SOC_ARCH_EXYNOS4210 ||
> > pdata->type == SOC_ARCH_EXYNOS4412 ||
> > + pdata->type == SOC_ARCH_EXYNOS5250 ||
> > pdata->type == SOC_ARCH_EXYNOS5440)
> > data->soc = pdata->type;
> > else {
> > diff --git a/drivers/thermal/samsung/exynos_tmu.h b/drivers/thermal/samsung/exynos_tmu.h
> > index db37df0..b42ece4 100644
> > --- a/drivers/thermal/samsung/exynos_tmu.h
> > +++ b/drivers/thermal/samsung/exynos_tmu.h
> > @@ -42,7 +42,7 @@ enum calibration_mode {
> > enum soc_type {
> > SOC_ARCH_EXYNOS4210 = 1,
> > SOC_ARCH_EXYNOS4412,
> > - SOC_ARCH_EXYNOS,
> > + SOC_ARCH_EXYNOS5250,
> > SOC_ARCH_EXYNOS5440,
> > };
> >
> > diff --git a/drivers/thermal/samsung/exynos_tmu_data.c b/drivers/thermal/samsung/exynos_tmu_data.c
> > index bd08093..188223f 100644
> > --- a/drivers/thermal/samsung/exynos_tmu_data.c
> > +++ b/drivers/thermal/samsung/exynos_tmu_data.c
> > @@ -183,7 +183,7 @@ struct exynos_tmu_init_data const exynos4412_default_tmu_data = {
> > struct exynos_tmu_init_data const exynos5250_default_tmu_data = {
> > .tmu_data = {
> > { EXYNOS4412_TMU_DATA,
> > - .type = SOC_ARCH_EXYNOS,
> > + .type = SOC_ARCH_EXYNOS5250,
> > },
> > },
> > .tmu_count = 1,

2013-10-04 10:20:42

by Lukasz Majewski

[permalink] [raw]
Subject: Re: [PATCH 3/6] thermal: exynos: Provide initial setting for TMU's test MUX address at Exynos4412

Hi Eduardo,

> On 24-09-2013 04:08, Lukasz Majewski wrote:
> > 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 <[email protected]>
> > Reviewed-by: Bartlomiej Zolnierkiewicz <[email protected]>
> > Reviewed-by: Tomasz Figa <[email protected]>
> > ---
> > drivers/thermal/samsung/exynos_tmu.c | 3 +++
> > drivers/thermal/samsung/exynos_tmu_data.h | 4 ++++
> > 2 files changed, 7 insertions(+)
> >
> > diff --git a/drivers/thermal/samsung/exynos_tmu.c
> > b/drivers/thermal/samsung/exynos_tmu.c index a858cc4..21b89e4 100644
> > --- a/drivers/thermal/samsung/exynos_tmu.c
> > +++ b/drivers/thermal/samsung/exynos_tmu.c
> > @@ -317,6 +317,9 @@ static void exynos_tmu_control(struct
> > platform_device *pdev, bool on)
> > con = readl(data->base + reg->tmu_ctrl);
> >
> > + if (pdata->type == SOC_ARCH_EXYNOS4412)
> > + con |= (EXYNOS4412_MUX_ADDR_VALUE <<
> > EXYNOS4412_MUX_ADDR_SHIFT);
>
> Amit has introduced a way to describe features instead of checking
> features per type. It would be interesting to have a reasoning why not
> to use it.

Problem with Exynos4412 and Exynos4212 is that _only_ those SoCs export
this MUX_ADDR field at TMU_CONTROL register. Also I _must_ setup it
correctly after reset (reset value causes board emergency shutdown).

The Exynos5250 defines it as a "reserved".

> Think what if new Exynos TMU versions come, are you guys
> going to steadily increase the above check for type?

As the alternative I can define the TMU_SUPPORT_MUX_ADDR at .features
field for EXYNOS4412_TMU_DATA.

Then I can test for this feature at exynos_tmu_control function.
Proper shift and mask can be defined at struct exynos_tmu_registers.

Eduardo, Amit, will we manage to review/pull those patches with new
approach before -rcX ends?

>
> > +
> > if (pdata->reference_voltage) {
> > con &= ~(reg->buf_vref_sel_mask <<
> > reg->buf_vref_sel_shift); con |= pdata->reference_voltage <<
> > reg->buf_vref_sel_shift; diff --git
> > a/drivers/thermal/samsung/exynos_tmu_data.h
> > b/drivers/thermal/samsung/exynos_tmu_data.h index b130b1e..a1ea19d
> > 100644 --- a/drivers/thermal/samsung/exynos_tmu_data.h +++
> > b/drivers/thermal/samsung/exynos_tmu_data.h @@ -95,6 +95,10 @@
> >
> > #define EXYNOS_MAX_TRIGGER_PER_REG 4
> >
> > +/* Exynos4412 specific */
> > +#define EXYNOS4412_MUX_ADDR_VALUE 6
> > +#define EXYNOS4412_MUX_ADDR_SHIFT 20
> > +
> > /*exynos5440 specific registers*/
> > #define EXYNOS5440_TMU_S0_7_TRIM 0x000
> > #define EXYNOS5440_TMU_S0_7_CTRL 0x020
> >
>
>



--
Best regards,

Lukasz Majewski

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

2013-10-04 10:24:17

by Lukasz Majewski

[permalink] [raw]
Subject: Re: [PATCH 4/6] thermal: exynos: Replace SOC_ARCH_EXYNOS with SOC_ARCH_EXYNOS5250

Hi Eduardo,

> On 24-09-2013 04:08, Lukasz Majewski wrote:
> > The TMU data definition is now separated to Exynos4412 and
> > Exynos5250.
> >
> > Now SOC_ARCH_EXYNOS only refers to Exynos5250. Hence the name
> > SOC_ARCH_EXYNOS has been changed to SOC_ARCH_EXYNOS5250.
> >
>
> How about merging this one with patch 02?

I wanted to show how the work was logically split - patch 02
extracts Exynos4412 from Exynos5250. Then this patch changes the name.

I will merge those two patches. No problem.

>
> > Signed-off-by: Lukasz Majewski <[email protected]>
> > ---
> > drivers/thermal/samsung/exynos_tmu.c | 4 ++--
> > drivers/thermal/samsung/exynos_tmu.h | 2 +-
> > drivers/thermal/samsung/exynos_tmu_data.c | 2 +-
> > 3 files changed, 4 insertions(+), 4 deletions(-)
> >
> > diff --git a/drivers/thermal/samsung/exynos_tmu.c
> > b/drivers/thermal/samsung/exynos_tmu.c index 21b89e4..037cd46 100644
> > --- a/drivers/thermal/samsung/exynos_tmu.c
> > +++ b/drivers/thermal/samsung/exynos_tmu.c
> > @@ -632,9 +632,9 @@ static int exynos_tmu_probe(struct
> > platform_device *pdev) if (ret)
> > return ret;
> >
> > - if (pdata->type == SOC_ARCH_EXYNOS ||
> > - pdata->type == SOC_ARCH_EXYNOS4210 ||
> > + if (pdata->type == SOC_ARCH_EXYNOS4210 ||
> > pdata->type == SOC_ARCH_EXYNOS4412 ||
> > + pdata->type == SOC_ARCH_EXYNOS5250 ||
> > pdata->type == SOC_ARCH_EXYNOS5440)
> > data->soc = pdata->type;
> > else {
> > diff --git a/drivers/thermal/samsung/exynos_tmu.h
> > b/drivers/thermal/samsung/exynos_tmu.h index db37df0..b42ece4 100644
> > --- a/drivers/thermal/samsung/exynos_tmu.h
> > +++ b/drivers/thermal/samsung/exynos_tmu.h
> > @@ -42,7 +42,7 @@ enum calibration_mode {
> > enum soc_type {
> > SOC_ARCH_EXYNOS4210 = 1,
> > SOC_ARCH_EXYNOS4412,
> > - SOC_ARCH_EXYNOS,
> > + SOC_ARCH_EXYNOS5250,
> > SOC_ARCH_EXYNOS5440,
> > };
> >
> > diff --git a/drivers/thermal/samsung/exynos_tmu_data.c
> > b/drivers/thermal/samsung/exynos_tmu_data.c index bd08093..188223f
> > 100644 --- a/drivers/thermal/samsung/exynos_tmu_data.c
> > +++ b/drivers/thermal/samsung/exynos_tmu_data.c
> > @@ -183,7 +183,7 @@ struct exynos_tmu_init_data const
> > exynos4412_default_tmu_data = { struct exynos_tmu_init_data const
> > exynos5250_default_tmu_data = { .tmu_data = {
> > { EXYNOS4412_TMU_DATA,
> > - .type = SOC_ARCH_EXYNOS,
> > + .type = SOC_ARCH_EXYNOS5250,
> > },
> > },
> > .tmu_count = 1,
> >
>
>



--
Best regards,

Lukasz Majewski

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

Subject: Re: [PATCH 4/6] thermal: exynos: Replace SOC_ARCH_EXYNOS with SOC_ARCH_EXYNOS5250

On Friday, October 04, 2013 12:23:30 PM Lukasz Majewski wrote:
> Hi Eduardo,
>
> > On 24-09-2013 04:08, Lukasz Majewski wrote:
> > > The TMU data definition is now separated to Exynos4412 and
> > > Exynos5250.
> > >
> > > Now SOC_ARCH_EXYNOS only refers to Exynos5250. Hence the name
> > > SOC_ARCH_EXYNOS has been changed to SOC_ARCH_EXYNOS5250.
> > >
> >
> > How about merging this one with patch 02?
>
> I wanted to show how the work was logically split - patch 02
> extracts Exynos4412 from Exynos5250. Then this patch changes the name.
>
> I will merge those two patches. No problem.

Oh, well. Looking at the patch #2 again the merge can be done without
sacrificing backportability.

Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics

> >
> > > Signed-off-by: Lukasz Majewski <[email protected]>
> > > ---
> > > drivers/thermal/samsung/exynos_tmu.c | 4 ++--
> > > drivers/thermal/samsung/exynos_tmu.h | 2 +-
> > > drivers/thermal/samsung/exynos_tmu_data.c | 2 +-
> > > 3 files changed, 4 insertions(+), 4 deletions(-)
> > >
> > > diff --git a/drivers/thermal/samsung/exynos_tmu.c
> > > b/drivers/thermal/samsung/exynos_tmu.c index 21b89e4..037cd46 100644
> > > --- a/drivers/thermal/samsung/exynos_tmu.c
> > > +++ b/drivers/thermal/samsung/exynos_tmu.c
> > > @@ -632,9 +632,9 @@ static int exynos_tmu_probe(struct
> > > platform_device *pdev) if (ret)
> > > return ret;
> > >
> > > - if (pdata->type == SOC_ARCH_EXYNOS ||
> > > - pdata->type == SOC_ARCH_EXYNOS4210 ||
> > > + if (pdata->type == SOC_ARCH_EXYNOS4210 ||
> > > pdata->type == SOC_ARCH_EXYNOS4412 ||
> > > + pdata->type == SOC_ARCH_EXYNOS5250 ||
> > > pdata->type == SOC_ARCH_EXYNOS5440)
> > > data->soc = pdata->type;
> > > else {
> > > diff --git a/drivers/thermal/samsung/exynos_tmu.h
> > > b/drivers/thermal/samsung/exynos_tmu.h index db37df0..b42ece4 100644
> > > --- a/drivers/thermal/samsung/exynos_tmu.h
> > > +++ b/drivers/thermal/samsung/exynos_tmu.h
> > > @@ -42,7 +42,7 @@ enum calibration_mode {
> > > enum soc_type {
> > > SOC_ARCH_EXYNOS4210 = 1,
> > > SOC_ARCH_EXYNOS4412,
> > > - SOC_ARCH_EXYNOS,
> > > + SOC_ARCH_EXYNOS5250,
> > > SOC_ARCH_EXYNOS5440,
> > > };
> > >
> > > diff --git a/drivers/thermal/samsung/exynos_tmu_data.c
> > > b/drivers/thermal/samsung/exynos_tmu_data.c index bd08093..188223f
> > > 100644 --- a/drivers/thermal/samsung/exynos_tmu_data.c
> > > +++ b/drivers/thermal/samsung/exynos_tmu_data.c
> > > @@ -183,7 +183,7 @@ struct exynos_tmu_init_data const
> > > exynos4412_default_tmu_data = { struct exynos_tmu_init_data const
> > > exynos5250_default_tmu_data = { .tmu_data = {
> > > { EXYNOS4412_TMU_DATA,
> > > - .type = SOC_ARCH_EXYNOS,
> > > + .type = SOC_ARCH_EXYNOS5250,
> > > },
> > > },
> > > .tmu_count = 1,

2013-10-04 15:07:28

by Eduardo Valentin

[permalink] [raw]
Subject: Re: [PATCH 4/6] thermal: exynos: Replace SOC_ARCH_EXYNOS with SOC_ARCH_EXYNOS5250

On 04-10-2013 06:47, Bartlomiej Zolnierkiewicz wrote:
> On Friday, October 04, 2013 12:23:30 PM Lukasz Majewski wrote:
>> Hi Eduardo,
>>
>>> On 24-09-2013 04:08, Lukasz Majewski wrote:
>>>> The TMU data definition is now separated to Exynos4412 and
>>>> Exynos5250.
>>>>
>>>> Now SOC_ARCH_EXYNOS only refers to Exynos5250. Hence the name
>>>> SOC_ARCH_EXYNOS has been changed to SOC_ARCH_EXYNOS5250.
>>>>
>>>
>>> How about merging this one with patch 02?
>>
>> I wanted to show how the work was logically split - patch 02
>> extracts Exynos4412 from Exynos5250. Then this patch changes the name.
>>
>> I will merge those two patches. No problem.
>
> Oh, well. Looking at the patch #2 again the merge can be done without
> sacrificing backportability.

Please, merge them and describe that you are reworking the type and the
enum definition. Also add your reasonings, specially if you found bugs.
The way the descriptions are being presented, the bugs you found do not
get properly explained.

>
> Best regards,
> --
> Bartlomiej Zolnierkiewicz
> Samsung R&D Institute Poland
> Samsung Electronics
>
>>>
>>>> Signed-off-by: Lukasz Majewski <[email protected]>
>>>> ---
>>>> drivers/thermal/samsung/exynos_tmu.c | 4 ++--
>>>> drivers/thermal/samsung/exynos_tmu.h | 2 +-
>>>> drivers/thermal/samsung/exynos_tmu_data.c | 2 +-
>>>> 3 files changed, 4 insertions(+), 4 deletions(-)
>>>>
>>>> diff --git a/drivers/thermal/samsung/exynos_tmu.c
>>>> b/drivers/thermal/samsung/exynos_tmu.c index 21b89e4..037cd46 100644
>>>> --- a/drivers/thermal/samsung/exynos_tmu.c
>>>> +++ b/drivers/thermal/samsung/exynos_tmu.c
>>>> @@ -632,9 +632,9 @@ static int exynos_tmu_probe(struct
>>>> platform_device *pdev) if (ret)
>>>> return ret;
>>>>
>>>> - if (pdata->type == SOC_ARCH_EXYNOS ||
>>>> - pdata->type == SOC_ARCH_EXYNOS4210 ||
>>>> + if (pdata->type == SOC_ARCH_EXYNOS4210 ||
>>>> pdata->type == SOC_ARCH_EXYNOS4412 ||
>>>> + pdata->type == SOC_ARCH_EXYNOS5250 ||
>>>> pdata->type == SOC_ARCH_EXYNOS5440)
>>>> data->soc = pdata->type;
>>>> else {
>>>> diff --git a/drivers/thermal/samsung/exynos_tmu.h
>>>> b/drivers/thermal/samsung/exynos_tmu.h index db37df0..b42ece4 100644
>>>> --- a/drivers/thermal/samsung/exynos_tmu.h
>>>> +++ b/drivers/thermal/samsung/exynos_tmu.h
>>>> @@ -42,7 +42,7 @@ enum calibration_mode {
>>>> enum soc_type {
>>>> SOC_ARCH_EXYNOS4210 = 1,
>>>> SOC_ARCH_EXYNOS4412,
>>>> - SOC_ARCH_EXYNOS,
>>>> + SOC_ARCH_EXYNOS5250,
>>>> SOC_ARCH_EXYNOS5440,
>>>> };
>>>>
>>>> diff --git a/drivers/thermal/samsung/exynos_tmu_data.c
>>>> b/drivers/thermal/samsung/exynos_tmu_data.c index bd08093..188223f
>>>> 100644 --- a/drivers/thermal/samsung/exynos_tmu_data.c
>>>> +++ b/drivers/thermal/samsung/exynos_tmu_data.c
>>>> @@ -183,7 +183,7 @@ struct exynos_tmu_init_data const
>>>> exynos4412_default_tmu_data = { struct exynos_tmu_init_data const
>>>> exynos5250_default_tmu_data = { .tmu_data = {
>>>> { EXYNOS4412_TMU_DATA,
>>>> - .type = SOC_ARCH_EXYNOS,
>>>> + .type = SOC_ARCH_EXYNOS5250,
>>>> },
>>>> },
>>>> .tmu_count = 1,
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-pm" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
>


--
You have got to be excited about what you are doing. (L. Lamport)

Eduardo Valentin


Attachments:
signature.asc (295.00 B)
OpenPGP digital signature

2013-10-09 06:30:49

by Lukasz Majewski

[permalink] [raw]
Subject: [PATCH v2 0/5] thermal: exynos: Fixes for v3.12

This patch series is divided into two parts:
1. Device tree node definition and enabelement for TMU at Exynos4412 (Trats2)
2. Exynos thermal subsystem regressions for v3.12-rc4. Several commits were
necessary to properly fix regression for TMU test MUX address setting after
reset.

Test HW:
- Exynos4412 - TRATS2 board (Linux v3.12-rc4)
SHA1: 8b5ede69d24db939f52b47effff2f6fe1e83e08b


Lukasz Majewski (5):
thermal: exynos: Remove check for thermal device pointer at
exynos_report_trigger()
thermal: exynos: Provide separate TMU data for Exynos4412
thermal: exynos: Provide initial setting for TMU's test MUX address
at Exynos4412
ARM: dts: exynos4x12: Device tree node definition for TMU on
Exynos4x12
ARM: dts: exynos4412-trats2: Enable TMU support at Trats2

arch/arm/boot/dts/exynos4412-trats2.dts | 5 ++++
arch/arm/boot/dts/exynos4x12.dtsi | 10 ++++++++
drivers/thermal/samsung/exynos_thermal_common.c | 2 --
drivers/thermal/samsung/exynos_tmu.c | 12 ++++++---
drivers/thermal/samsung/exynos_tmu.h | 7 +++++-
drivers/thermal/samsung/exynos_tmu_data.c | 30 ++++++++++++++++++-----
drivers/thermal/samsung/exynos_tmu_data.h | 13 +++++++++-
7 files changed, 65 insertions(+), 14 deletions(-)

--
1.7.10.4

2013-10-09 06:30:59

by Lukasz Majewski

[permalink] [raw]
Subject: [PATCH v2 4/5] ARM: dts: exynos4x12: Device tree node definition for TMU on Exynos4x12

The TMU device tree node definition for Exynos4x12 family of SoCs.

Signed-off-by: Lukasz Majewski <[email protected]>
Reviewed-by: Bartlomiej Zolnierkiewicz <[email protected]>
Reviewed-by: Tomasz Figa <[email protected]>

---
Changes for v2:
- None

arch/arm/boot/dts/exynos4x12.dtsi | 10 ++++++++++
1 file changed, 10 insertions(+)

diff --git a/arch/arm/boot/dts/exynos4x12.dtsi b/arch/arm/boot/dts/exynos4x12.dtsi
index ad531fe..64c0ece 100644
--- a/arch/arm/boot/dts/exynos4x12.dtsi
+++ b/arch/arm/boot/dts/exynos4x12.dtsi
@@ -176,4 +176,14 @@
};
};
};
+
+ tmu@100C0000 {
+ compatible = "samsung,exynos4412-tmu";
+ interrupt-parent = <&combiner>;
+ interrupts = <2 4>;
+ reg = <0x100C0000 0x100>;
+ clocks = <&clock 383>;
+ clock-names = "tmu_apbif";
+ status = "disabled";
+ };
};
--
1.7.10.4

2013-10-09 06:30:55

by Lukasz Majewski

[permalink] [raw]
Subject: [PATCH v2 1/5] 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 <[email protected]>
Reviewed-by: Bartlomiej Zolnierkiewicz <[email protected]>
Reviewed-by: Tomasz Figa <[email protected]>

---
Changes for v2:
- Remove check for th_zone->therm_dev at exynos_report_trigger()

drivers/thermal/samsung/exynos_thermal_common.c | 2 --
1 file changed, 2 deletions(-)

diff --git a/drivers/thermal/samsung/exynos_thermal_common.c b/drivers/thermal/samsung/exynos_thermal_common.c
index f10a6ad..c2301da 100644
--- a/drivers/thermal/samsung/exynos_thermal_common.c
+++ b/drivers/thermal/samsung/exynos_thermal_common.c
@@ -310,8 +310,6 @@ void exynos_report_trigger(struct thermal_sensor_conf *conf)
}

th_zone = conf->pzone_data;
- if (th_zone->therm_dev)
- return;

if (th_zone->bind == false) {
for (i = 0; i < th_zone->cool_dev_size; i++) {
--
1.7.10.4

2013-10-09 06:31:27

by Lukasz Majewski

[permalink] [raw]
Subject: [PATCH v2 5/5] ARM: dts: exynos4412-trats2: Enable TMU support at Trats2

This patch enables support for TMU at Exynos4412 based Trats2 board.

Signed-off-by: Lukasz Majewski <[email protected]>
Reviewed-by: Bartlomiej Zolnierkiewicz <[email protected]>
Reviewed-by: Tomasz Figa <[email protected]>

---
Changes for v2:
- None

arch/arm/boot/dts/exynos4412-trats2.dts | 5 +++++
1 file changed, 5 insertions(+)

diff --git a/arch/arm/boot/dts/exynos4412-trats2.dts b/arch/arm/boot/dts/exynos4412-trats2.dts
index fb7b9ae..57136f8 100644
--- a/arch/arm/boot/dts/exynos4412-trats2.dts
+++ b/arch/arm/boot/dts/exynos4412-trats2.dts
@@ -467,6 +467,11 @@
status = "okay";
};

+ tmu@100C0000 {
+ vtmu-supply = <&ldo10_reg>;
+ status = "okay";
+ };
+
i2c_ak8975: i2c-gpio-0 {
compatible = "i2c-gpio";
gpios = <&gpy2 4 0>, <&gpy2 5 0>;
--
1.7.10.4

2013-10-09 06:31:49

by Lukasz Majewski

[permalink] [raw]
Subject: [PATCH v2 3/5] 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 <[email protected]>
Reviewed-by: Bartlomiej Zolnierkiewicz <[email protected]>
Reviewed-by: Tomasz Figa <[email protected]>

---
Changes for v2:
- Define test_mux and test_mux_addr_shift to not use direct register access
- Remove pdata->type == SOC_ARCH_EXYNOS4412 check at exynos_tmu_control() and
use only generic code

drivers/thermal/samsung/exynos_tmu.c | 3 +++
drivers/thermal/samsung/exynos_tmu.h | 4 ++++
drivers/thermal/samsung/exynos_tmu_data.c | 2 ++
drivers/thermal/samsung/exynos_tmu_data.h | 4 ++++
4 files changed, 13 insertions(+)

diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung/exynos_tmu.c
index 1312b34..32f38b9 100644
--- a/drivers/thermal/samsung/exynos_tmu.c
+++ b/drivers/thermal/samsung/exynos_tmu.c
@@ -317,6 +317,9 @@ static void exynos_tmu_control(struct platform_device *pdev, bool on)

con = readl(data->base + reg->tmu_ctrl);

+ if (pdata->test_mux)
+ con |= (pdata->test_mux << reg->test_mux_addr_shift);
+
if (pdata->reference_voltage) {
con &= ~(reg->buf_vref_sel_mask << reg->buf_vref_sel_shift);
con |= pdata->reference_voltage << reg->buf_vref_sel_shift;
diff --git a/drivers/thermal/samsung/exynos_tmu.h b/drivers/thermal/samsung/exynos_tmu.h
index b42ece4..3fb6554 100644
--- a/drivers/thermal/samsung/exynos_tmu.h
+++ b/drivers/thermal/samsung/exynos_tmu.h
@@ -85,6 +85,7 @@ enum soc_type {
* @triminfo_reload_shift: shift of triminfo reload enable bit in triminfo_ctrl
reg.
* @tmu_ctrl: TMU main controller register.
+ * @test_mux_addr_shift: shift bits of test mux address.
* @buf_vref_sel_shift: shift bits of reference voltage in tmu_ctrl register.
* @buf_vref_sel_mask: mask bits of reference voltage in tmu_ctrl register.
* @therm_trip_mode_shift: shift bits of tripping mode in tmu_ctrl register.
@@ -151,6 +152,7 @@ struct exynos_tmu_registers {
u32 triminfo_reload_shift;

u32 tmu_ctrl;
+ u32 test_mux_addr_shift;
u32 buf_vref_sel_shift;
u32 buf_vref_sel_mask;
u32 therm_trip_mode_shift;
@@ -258,6 +260,7 @@ struct exynos_tmu_registers {
* @first_point_trim: temp value of the first point trimming
* @second_point_trim: temp value of the second point trimming
* @default_temp_offset: default temperature offset in case of no trimming
+ * @test_mux; information if SoC supports test MUX
* @cal_type: calibration type for temperature
* @cal_mode: calibration mode for temperature
* @freq_clip_table: Table representing frequency reduction percentage.
@@ -287,6 +290,7 @@ struct exynos_tmu_platform_data {
u8 first_point_trim;
u8 second_point_trim;
u8 default_temp_offset;
+ u8 test_mux;

enum calibration_type cal_type;
enum calibration_mode cal_mode;
diff --git a/drivers/thermal/samsung/exynos_tmu_data.c b/drivers/thermal/samsung/exynos_tmu_data.c
index d8de5c1..073c292 100644
--- a/drivers/thermal/samsung/exynos_tmu_data.c
+++ b/drivers/thermal/samsung/exynos_tmu_data.c
@@ -98,6 +98,7 @@ static const struct exynos_tmu_registers exynos4412_tmu_registers = {
.triminfo_ctrl = EXYNOS_TMU_TRIMINFO_CON,
.triminfo_reload_shift = EXYNOS_TRIMINFO_RELOAD_SHIFT,
.tmu_ctrl = EXYNOS_TMU_REG_CONTROL,
+ .test_mux_addr_shift = EXYNOS4412_MUX_ADDR_SHIFT,
.buf_vref_sel_shift = EXYNOS_TMU_REF_VOLTAGE_SHIFT,
.buf_vref_sel_mask = EXYNOS_TMU_REF_VOLTAGE_MASK,
.therm_trip_mode_shift = EXYNOS_TMU_TRIP_MODE_SHIFT,
@@ -174,6 +175,7 @@ struct exynos_tmu_init_data const exynos4412_default_tmu_data = {
{
EXYNOS4412_TMU_DATA,
.type = SOC_ARCH_EXYNOS4412,
+ .test_mux = EXYNOS4412_MUX_ADDR_VALUE,
},
},
.tmu_count = 1,
diff --git a/drivers/thermal/samsung/exynos_tmu_data.h b/drivers/thermal/samsung/exynos_tmu_data.h
index b130b1e..a1ea19d 100644
--- a/drivers/thermal/samsung/exynos_tmu_data.h
+++ b/drivers/thermal/samsung/exynos_tmu_data.h
@@ -95,6 +95,10 @@

#define EXYNOS_MAX_TRIGGER_PER_REG 4

+/* Exynos4412 specific */
+#define EXYNOS4412_MUX_ADDR_VALUE 6
+#define EXYNOS4412_MUX_ADDR_SHIFT 20
+
/*exynos5440 specific registers*/
#define EXYNOS5440_TMU_S0_7_TRIM 0x000
#define EXYNOS5440_TMU_S0_7_CTRL 0x020
--
1.7.10.4

2013-10-09 06:32:22

by Lukasz Majewski

[permalink] [raw]
Subject: [PATCH v2 2/5] 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 <[email protected]>
Reviewed-by: Bartlomiej Zolnierkiewicz <[email protected]>
Reviewed-by: Tomasz Figa <[email protected]>

---
Changes for v2:
- Replace SOC_ARCH_EXYNOS with SOC_ARCH_EXYNOS5250
- Fix coding style for tmu_data elements definition

drivers/thermal/samsung/exynos_tmu.c | 9 +++++----
drivers/thermal/samsung/exynos_tmu.h | 3 ++-
drivers/thermal/samsung/exynos_tmu_data.c | 28 ++++++++++++++++++++++------
drivers/thermal/samsung/exynos_tmu_data.h | 9 ++++++++-
4 files changed, 37 insertions(+), 12 deletions(-)

diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung/exynos_tmu.c
index b43afda..1312b34 100644
--- a/drivers/thermal/samsung/exynos_tmu.c
+++ b/drivers/thermal/samsung/exynos_tmu.c
@@ -488,7 +488,7 @@ static const struct of_device_id exynos_tmu_match[] = {
},
{
.compatible = "samsung,exynos4412-tmu",
- .data = (void *)EXYNOS5250_TMU_DRV_DATA,
+ .data = (void *)EXYNOS4412_TMU_DRV_DATA,
},
{
.compatible = "samsung,exynos5250-tmu",
@@ -629,9 +629,10 @@ static int exynos_tmu_probe(struct platform_device *pdev)
if (ret)
return ret;

- if (pdata->type == SOC_ARCH_EXYNOS ||
- pdata->type == SOC_ARCH_EXYNOS4210 ||
- pdata->type == SOC_ARCH_EXYNOS5440)
+ if (pdata->type == SOC_ARCH_EXYNOS4210 ||
+ pdata->type == SOC_ARCH_EXYNOS4412 ||
+ pdata->type == SOC_ARCH_EXYNOS5250 ||
+ pdata->type == SOC_ARCH_EXYNOS5440)
data->soc = pdata->type;
else {
ret = -EINVAL;
diff --git a/drivers/thermal/samsung/exynos_tmu.h b/drivers/thermal/samsung/exynos_tmu.h
index b364c9e..b42ece4 100644
--- a/drivers/thermal/samsung/exynos_tmu.h
+++ b/drivers/thermal/samsung/exynos_tmu.h
@@ -41,7 +41,8 @@ enum calibration_mode {

enum soc_type {
SOC_ARCH_EXYNOS4210 = 1,
- SOC_ARCH_EXYNOS,
+ SOC_ARCH_EXYNOS4412,
+ SOC_ARCH_EXYNOS5250,
SOC_ARCH_EXYNOS5440,
};

diff --git a/drivers/thermal/samsung/exynos_tmu_data.c b/drivers/thermal/samsung/exynos_tmu_data.c
index 9002499..d8de5c1 100644
--- a/drivers/thermal/samsung/exynos_tmu_data.c
+++ b/drivers/thermal/samsung/exynos_tmu_data.c
@@ -90,8 +90,8 @@ struct exynos_tmu_init_data const exynos4210_default_tmu_data = {
};
#endif

-#if defined(CONFIG_SOC_EXYNOS5250) || defined(CONFIG_SOC_EXYNOS4412)
-static const struct exynos_tmu_registers exynos5250_tmu_registers = {
+#if defined(CONFIG_SOC_EXYNOS4412) || defined(CONFIG_SOC_EXYNOS5250)
+static const struct exynos_tmu_registers exynos4412_tmu_registers = {
.triminfo_data = EXYNOS_TMU_REG_TRIMINFO,
.triminfo_25_shift = EXYNOS_TRIMINFO_25_SHIFT,
.triminfo_85_shift = EXYNOS_TRIMINFO_85_SHIFT,
@@ -128,7 +128,7 @@ static const struct exynos_tmu_registers exynos5250_tmu_registers = {
.emul_time_mask = EXYNOS_EMUL_TIME_MASK,
};

-#define EXYNOS5250_TMU_DATA \
+#define EXYNOS4412_TMU_DATA \
.threshold_falling = 10, \
.trigger_levels[0] = 85, \
.trigger_levels[1] = 103, \
@@ -162,15 +162,31 @@ static const struct exynos_tmu_registers exynos5250_tmu_registers = {
.temp_level = 103, \
}, \
.freq_tab_count = 2, \
- .type = SOC_ARCH_EXYNOS, \
- .registers = &exynos5250_tmu_registers, \
+ .registers = &exynos4412_tmu_registers, \
.features = (TMU_SUPPORT_EMULATION | TMU_SUPPORT_TRIM_RELOAD | \
TMU_SUPPORT_FALLING_TRIP | TMU_SUPPORT_READY_STATUS | \
TMU_SUPPORT_EMUL_TIME)
+#endif

+#if defined(CONFIG_SOC_EXYNOS4412)
+struct exynos_tmu_init_data const exynos4412_default_tmu_data = {
+ .tmu_data = {
+ {
+ EXYNOS4412_TMU_DATA,
+ .type = SOC_ARCH_EXYNOS4412,
+ },
+ },
+ .tmu_count = 1,
+};
+#endif
+
+#if defined(CONFIG_SOC_EXYNOS5250)
struct exynos_tmu_init_data const exynos5250_default_tmu_data = {
.tmu_data = {
- { EXYNOS5250_TMU_DATA },
+ {
+ EXYNOS4412_TMU_DATA,
+ .type = SOC_ARCH_EXYNOS5250,
+ },
},
.tmu_count = 1,
};
diff --git a/drivers/thermal/samsung/exynos_tmu_data.h b/drivers/thermal/samsung/exynos_tmu_data.h
index dc7feb5..b130b1e 100644
--- a/drivers/thermal/samsung/exynos_tmu_data.h
+++ b/drivers/thermal/samsung/exynos_tmu_data.h
@@ -138,7 +138,14 @@ extern struct exynos_tmu_init_data const exynos4210_default_tmu_data;
#define EXYNOS4210_TMU_DRV_DATA (NULL)
#endif

-#if (defined(CONFIG_SOC_EXYNOS5250) || defined(CONFIG_SOC_EXYNOS4412))
+#if defined(CONFIG_SOC_EXYNOS4412)
+extern struct exynos_tmu_init_data const exynos4412_default_tmu_data;
+#define EXYNOS4412_TMU_DRV_DATA (&exynos4412_default_tmu_data)
+#else
+#define EXYNOS4412_TMU_DRV_DATA (NULL)
+#endif
+
+#if defined(CONFIG_SOC_EXYNOS5250)
extern struct exynos_tmu_init_data const exynos5250_default_tmu_data;
#define EXYNOS5250_TMU_DRV_DATA (&exynos5250_default_tmu_data)
#else
--
1.7.10.4

2013-10-14 05:46:46

by Lukasz Majewski

[permalink] [raw]
Subject: Re: [PATCH v2 0/5] thermal: exynos: Fixes for v3.12

Hi Zhang, Eduardo,

> This patch series is divided into two parts:
> 1. Device tree node definition and enabelement for TMU at Exynos4412
> (Trats2) 2. Exynos thermal subsystem regressions for v3.12-rc4.
> Several commits were necessary to properly fix regression for TMU
> test MUX address setting after reset.
>
> Test HW:
> - Exynos4412 - TRATS2 board (Linux v3.12-rc4)
> SHA1: 8b5ede69d24db939f52b47effff2f6fe1e83e08b
>
>
> Lukasz Majewski (5):
> thermal: exynos: Remove check for thermal device pointer at
> exynos_report_trigger()
> thermal: exynos: Provide separate TMU data for Exynos4412
> thermal: exynos: Provide initial setting for TMU's test MUX address
> at Exynos4412
> ARM: dts: exynos4x12: Device tree node definition for TMU on
> Exynos4x12
> ARM: dts: exynos4412-trats2: Enable TMU support at Trats2
>

Zhang, Eduardo - any comments?

Would it be possible to add them to v3.12 since they do fix critical
error and regression on Exynos4412.


> arch/arm/boot/dts/exynos4412-trats2.dts | 5 ++++
> arch/arm/boot/dts/exynos4x12.dtsi | 10 ++++++++
> drivers/thermal/samsung/exynos_thermal_common.c | 2 --
> drivers/thermal/samsung/exynos_tmu.c | 12 ++++++---
> drivers/thermal/samsung/exynos_tmu.h | 7 +++++-
> drivers/thermal/samsung/exynos_tmu_data.c | 30
> ++++++++++++++++++-----
> drivers/thermal/samsung/exynos_tmu_data.h | 13 +++++++++- 7
> files changed, 65 insertions(+), 14 deletions(-)
>



--
Best regards,

Lukasz Majewski

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

2013-10-14 05:52:26

by Zhang Rui

[permalink] [raw]
Subject: RE: [PATCH v2 0/5] thermal: exynos: Fixes for v3.12

Eduardo,

What's your opinion on this patch set?
BTW, please send me all the urgent fixes for thermal soc drivers that you think should go to 3.12.

Thanks,
rui
> -----Original Message-----
> From: Lukasz Majewski [mailto:[email protected]]
> Sent: Monday, October 14, 2013 1:47 PM
> To: Zhang, Rui; Eduardo Valentin; [email protected]
> Cc: Lukasz Majewski; Linux PM list; Lukasz Majewski; linux-kernel;
> Bartlomiej Zolnierkiewicz; [email protected]; Amit Daniel
> Kachhap; [email protected]
> Subject: Re: [PATCH v2 0/5] thermal: exynos: Fixes for v3.12
> Importance: High
>
> Hi Zhang, Eduardo,
>
> > This patch series is divided into two parts:
> > 1. Device tree node definition and enabelement for TMU at Exynos4412
> > (Trats2) 2. Exynos thermal subsystem regressions for v3.12-rc4.
> > Several commits were necessary to properly fix regression for TMU
> test
> > MUX address setting after reset.
> >
> > Test HW:
> > - Exynos4412 - TRATS2 board (Linux v3.12-rc4)
> > SHA1: 8b5ede69d24db939f52b47effff2f6fe1e83e08b
> >
> >
> > Lukasz Majewski (5):
> > thermal: exynos: Remove check for thermal device pointer at
> > exynos_report_trigger()
> > thermal: exynos: Provide separate TMU data for Exynos4412
> > thermal: exynos: Provide initial setting for TMU's test MUX address
> > at Exynos4412
> > ARM: dts: exynos4x12: Device tree node definition for TMU on
> > Exynos4x12
> > ARM: dts: exynos4412-trats2: Enable TMU support at Trats2
> >
>
> Zhang, Eduardo - any comments?
>
> Would it be possible to add them to v3.12 since they do fix critical
> error and regression on Exynos4412.
>
>
> > arch/arm/boot/dts/exynos4412-trats2.dts | 5 ++++
> > arch/arm/boot/dts/exynos4x12.dtsi | 10 ++++++++
> > drivers/thermal/samsung/exynos_thermal_common.c | 2 --
> > drivers/thermal/samsung/exynos_tmu.c | 12 ++++++---
> > drivers/thermal/samsung/exynos_tmu.h | 7 +++++-
> > drivers/thermal/samsung/exynos_tmu_data.c | 30
> > ++++++++++++++++++-----
> > drivers/thermal/samsung/exynos_tmu_data.h | 13 +++++++++- 7
> > files changed, 65 insertions(+), 14 deletions(-)
> >
>
>
>
> --
> Best regards,
>
> Lukasz Majewski
>
> Samsung R&D Institute Poland (SRPOL) | Linux Platform Group

2013-10-14 14:21:21

by Eduardo Valentin

[permalink] [raw]
Subject: Re: [PATCH v2 2/5] thermal: exynos: Provide separate TMU data for Exynos4412

On 09-10-2013 02:29, Lukasz Majewski wrote:
> 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 <[email protected]>
> Reviewed-by: Bartlomiej Zolnierkiewicz <[email protected]>
> Reviewed-by: Tomasz Figa <[email protected]>
>
> ---
> Changes for v2:
> - Replace SOC_ARCH_EXYNOS with SOC_ARCH_EXYNOS5250
> - Fix coding style for tmu_data elements definition
>
> drivers/thermal/samsung/exynos_tmu.c | 9 +++++----
> drivers/thermal/samsung/exynos_tmu.h | 3 ++-
> drivers/thermal/samsung/exynos_tmu_data.c | 28 ++++++++++++++++++++++------
> drivers/thermal/samsung/exynos_tmu_data.h | 9 ++++++++-
> 4 files changed, 37 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung/exynos_tmu.c
> index b43afda..1312b34 100644
> --- a/drivers/thermal/samsung/exynos_tmu.c
> +++ b/drivers/thermal/samsung/exynos_tmu.c
> @@ -488,7 +488,7 @@ static const struct of_device_id exynos_tmu_match[] = {
> },
> {
> .compatible = "samsung,exynos4412-tmu",
> - .data = (void *)EXYNOS5250_TMU_DRV_DATA,
> + .data = (void *)EXYNOS4412_TMU_DRV_DATA,
> },
> {
> .compatible = "samsung,exynos5250-tmu",
> @@ -629,9 +629,10 @@ static int exynos_tmu_probe(struct platform_device *pdev)
> if (ret)
> return ret;
>
> - if (pdata->type == SOC_ARCH_EXYNOS ||
> - pdata->type == SOC_ARCH_EXYNOS4210 ||
> - pdata->type == SOC_ARCH_EXYNOS5440)
> + if (pdata->type == SOC_ARCH_EXYNOS4210 ||
> + pdata->type == SOC_ARCH_EXYNOS4412 ||
> + pdata->type == SOC_ARCH_EXYNOS5250 ||
> + pdata->type == SOC_ARCH_EXYNOS5440)
> data->soc = pdata->type;
> else {
> ret = -EINVAL;
> diff --git a/drivers/thermal/samsung/exynos_tmu.h b/drivers/thermal/samsung/exynos_tmu.h
> index b364c9e..b42ece4 100644
> --- a/drivers/thermal/samsung/exynos_tmu.h
> +++ b/drivers/thermal/samsung/exynos_tmu.h
> @@ -41,7 +41,8 @@ enum calibration_mode {
>
> enum soc_type {
> SOC_ARCH_EXYNOS4210 = 1,
> - SOC_ARCH_EXYNOS,
> + SOC_ARCH_EXYNOS4412,
> + SOC_ARCH_EXYNOS5250,
> SOC_ARCH_EXYNOS5440,
> };
>
> diff --git a/drivers/thermal/samsung/exynos_tmu_data.c b/drivers/thermal/samsung/exynos_tmu_data.c
> index 9002499..d8de5c1 100644
> --- a/drivers/thermal/samsung/exynos_tmu_data.c
> +++ b/drivers/thermal/samsung/exynos_tmu_data.c
> @@ -90,8 +90,8 @@ struct exynos_tmu_init_data const exynos4210_default_tmu_data = {
> };
> #endif
>
> -#if defined(CONFIG_SOC_EXYNOS5250) || defined(CONFIG_SOC_EXYNOS4412)
> -static const struct exynos_tmu_registers exynos5250_tmu_registers = {
> +#if defined(CONFIG_SOC_EXYNOS4412) || defined(CONFIG_SOC_EXYNOS5250)

Below will be only 4412 definitions,right? Why should we test for 5250?

> +static const struct exynos_tmu_registers exynos4412_tmu_registers = {
> .triminfo_data = EXYNOS_TMU_REG_TRIMINFO,
> .triminfo_25_shift = EXYNOS_TRIMINFO_25_SHIFT,
> .triminfo_85_shift = EXYNOS_TRIMINFO_85_SHIFT,
> @@ -128,7 +128,7 @@ static const struct exynos_tmu_registers exynos5250_tmu_registers = {
> .emul_time_mask = EXYNOS_EMUL_TIME_MASK,
> };
>
> -#define EXYNOS5250_TMU_DATA \
> +#define EXYNOS4412_TMU_DATA \
> .threshold_falling = 10, \
> .trigger_levels[0] = 85, \
> .trigger_levels[1] = 103, \
> @@ -162,15 +162,31 @@ static const struct exynos_tmu_registers exynos5250_tmu_registers = {
> .temp_level = 103, \
> }, \
> .freq_tab_count = 2, \
> - .type = SOC_ARCH_EXYNOS, \
> - .registers = &exynos5250_tmu_registers, \
> + .registers = &exynos4412_tmu_registers, \
> .features = (TMU_SUPPORT_EMULATION | TMU_SUPPORT_TRIM_RELOAD | \
> TMU_SUPPORT_FALLING_TRIP | TMU_SUPPORT_READY_STATUS | \
> TMU_SUPPORT_EMUL_TIME)
> +#endif
>
> +#if defined(CONFIG_SOC_EXYNOS4412)
> +struct exynos_tmu_init_data const exynos4412_default_tmu_data = {
> + .tmu_data = {
> + {
> + EXYNOS4412_TMU_DATA,
> + .type = SOC_ARCH_EXYNOS4412,
> + },
> + },
> + .tmu_count = 1,
> +};
> +#endif
> +
> +#if defined(CONFIG_SOC_EXYNOS5250)
> struct exynos_tmu_init_data const exynos5250_default_tmu_data = {
> .tmu_data = {
> - { EXYNOS5250_TMU_DATA },
> + {
> + EXYNOS4412_TMU_DATA,
> + .type = SOC_ARCH_EXYNOS5250,
> + },
> },
> .tmu_count = 1,
> };
> diff --git a/drivers/thermal/samsung/exynos_tmu_data.h b/drivers/thermal/samsung/exynos_tmu_data.h
> index dc7feb5..b130b1e 100644
> --- a/drivers/thermal/samsung/exynos_tmu_data.h
> +++ b/drivers/thermal/samsung/exynos_tmu_data.h
> @@ -138,7 +138,14 @@ extern struct exynos_tmu_init_data const exynos4210_default_tmu_data;
> #define EXYNOS4210_TMU_DRV_DATA (NULL)
> #endif
>
> -#if (defined(CONFIG_SOC_EXYNOS5250) || defined(CONFIG_SOC_EXYNOS4412))
> +#if defined(CONFIG_SOC_EXYNOS4412)
> +extern struct exynos_tmu_init_data const exynos4412_default_tmu_data;
> +#define EXYNOS4412_TMU_DRV_DATA (&exynos4412_default_tmu_data)
> +#else
> +#define EXYNOS4412_TMU_DRV_DATA (NULL)
> +#endif
> +
> +#if defined(CONFIG_SOC_EXYNOS5250)
> extern struct exynos_tmu_init_data const exynos5250_default_tmu_data;
> #define EXYNOS5250_TMU_DRV_DATA (&exynos5250_default_tmu_data)
> #else
>


--
You have got to be excited about what you are doing. (L. Lamport)

Eduardo Valentin


Attachments:
signature.asc (295.00 B)
OpenPGP digital signature

2013-10-14 14:25:09

by Eduardo Valentin

[permalink] [raw]
Subject: Re: [PATCH v2 3/5] thermal: exynos: Provide initial setting for TMU's test MUX address at Exynos4412

On 09-10-2013 02:29, Lukasz Majewski wrote:
> 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 <[email protected]>
> Reviewed-by: Bartlomiej Zolnierkiewicz <[email protected]>
> Reviewed-by: Tomasz Figa <[email protected]>
>
> ---
> Changes for v2:
> - Define test_mux and test_mux_addr_shift to not use direct register access
> - Remove pdata->type == SOC_ARCH_EXYNOS4412 check at exynos_tmu_control() and
> use only generic code
>
> drivers/thermal/samsung/exynos_tmu.c | 3 +++
> drivers/thermal/samsung/exynos_tmu.h | 4 ++++
> drivers/thermal/samsung/exynos_tmu_data.c | 2 ++
> drivers/thermal/samsung/exynos_tmu_data.h | 4 ++++
> 4 files changed, 13 insertions(+)
>
> diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung/exynos_tmu.c
> index 1312b34..32f38b9 100644
> --- a/drivers/thermal/samsung/exynos_tmu.c
> +++ b/drivers/thermal/samsung/exynos_tmu.c
> @@ -317,6 +317,9 @@ static void exynos_tmu_control(struct platform_device *pdev, bool on)
>
> con = readl(data->base + reg->tmu_ctrl);
>
> + if (pdata->test_mux)


test_mux field is in fact an address, correct? Can 0 be a valid address?

Why not using the feature flags to test for capabilities, features and
required configurations instead of assuming obscure domain and address
ranges?


> + con |= (pdata->test_mux << reg->test_mux_addr_shift);
> +
> if (pdata->reference_voltage) {
> con &= ~(reg->buf_vref_sel_mask << reg->buf_vref_sel_shift);
> con |= pdata->reference_voltage << reg->buf_vref_sel_shift;
> diff --git a/drivers/thermal/samsung/exynos_tmu.h b/drivers/thermal/samsung/exynos_tmu.h
> index b42ece4..3fb6554 100644
> --- a/drivers/thermal/samsung/exynos_tmu.h
> +++ b/drivers/thermal/samsung/exynos_tmu.h
> @@ -85,6 +85,7 @@ enum soc_type {
> * @triminfo_reload_shift: shift of triminfo reload enable bit in triminfo_ctrl
> reg.
> * @tmu_ctrl: TMU main controller register.
> + * @test_mux_addr_shift: shift bits of test mux address.
> * @buf_vref_sel_shift: shift bits of reference voltage in tmu_ctrl register.
> * @buf_vref_sel_mask: mask bits of reference voltage in tmu_ctrl register.
> * @therm_trip_mode_shift: shift bits of tripping mode in tmu_ctrl register.
> @@ -151,6 +152,7 @@ struct exynos_tmu_registers {
> u32 triminfo_reload_shift;
>
> u32 tmu_ctrl;
> + u32 test_mux_addr_shift;
> u32 buf_vref_sel_shift;
> u32 buf_vref_sel_mask;
> u32 therm_trip_mode_shift;
> @@ -258,6 +260,7 @@ struct exynos_tmu_registers {
> * @first_point_trim: temp value of the first point trimming
> * @second_point_trim: temp value of the second point trimming
> * @default_temp_offset: default temperature offset in case of no trimming
> + * @test_mux; information if SoC supports test MUX
> * @cal_type: calibration type for temperature
> * @cal_mode: calibration mode for temperature
> * @freq_clip_table: Table representing frequency reduction percentage.
> @@ -287,6 +290,7 @@ struct exynos_tmu_platform_data {
> u8 first_point_trim;
> u8 second_point_trim;
> u8 default_temp_offset;
> + u8 test_mux;
>
> enum calibration_type cal_type;
> enum calibration_mode cal_mode;
> diff --git a/drivers/thermal/samsung/exynos_tmu_data.c b/drivers/thermal/samsung/exynos_tmu_data.c
> index d8de5c1..073c292 100644
> --- a/drivers/thermal/samsung/exynos_tmu_data.c
> +++ b/drivers/thermal/samsung/exynos_tmu_data.c
> @@ -98,6 +98,7 @@ static const struct exynos_tmu_registers exynos4412_tmu_registers = {
> .triminfo_ctrl = EXYNOS_TMU_TRIMINFO_CON,
> .triminfo_reload_shift = EXYNOS_TRIMINFO_RELOAD_SHIFT,
> .tmu_ctrl = EXYNOS_TMU_REG_CONTROL,
> + .test_mux_addr_shift = EXYNOS4412_MUX_ADDR_SHIFT,
> .buf_vref_sel_shift = EXYNOS_TMU_REF_VOLTAGE_SHIFT,
> .buf_vref_sel_mask = EXYNOS_TMU_REF_VOLTAGE_MASK,
> .therm_trip_mode_shift = EXYNOS_TMU_TRIP_MODE_SHIFT,
> @@ -174,6 +175,7 @@ struct exynos_tmu_init_data const exynos4412_default_tmu_data = {
> {
> EXYNOS4412_TMU_DATA,
> .type = SOC_ARCH_EXYNOS4412,
> + .test_mux = EXYNOS4412_MUX_ADDR_VALUE,
> },
> },
> .tmu_count = 1,
> diff --git a/drivers/thermal/samsung/exynos_tmu_data.h b/drivers/thermal/samsung/exynos_tmu_data.h
> index b130b1e..a1ea19d 100644
> --- a/drivers/thermal/samsung/exynos_tmu_data.h
> +++ b/drivers/thermal/samsung/exynos_tmu_data.h
> @@ -95,6 +95,10 @@
>
> #define EXYNOS_MAX_TRIGGER_PER_REG 4
>
> +/* Exynos4412 specific */
> +#define EXYNOS4412_MUX_ADDR_VALUE 6

> +#define EXYNOS4412_MUX_ADDR_SHIFT 20
> +
> /*exynos5440 specific registers*/
> #define EXYNOS5440_TMU_S0_7_TRIM 0x000
> #define EXYNOS5440_TMU_S0_7_CTRL 0x020
>


--
You have got to be excited about what you are doing. (L. Lamport)

Eduardo Valentin


Attachments:
signature.asc (295.00 B)
OpenPGP digital signature

2013-10-14 14:53:08

by Lukasz Majewski

[permalink] [raw]
Subject: Re: [PATCH v2 2/5] thermal: exynos: Provide separate TMU data for Exynos4412

Hi Eduardo,

> On 09-10-2013 02:29, Lukasz Majewski wrote:
> > 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 <[email protected]>
> > Reviewed-by: Bartlomiej Zolnierkiewicz <[email protected]>
> > Reviewed-by: Tomasz Figa <[email protected]>
> >
> > ---
> > Changes for v2:
> > - Replace SOC_ARCH_EXYNOS with SOC_ARCH_EXYNOS5250
> > - Fix coding style for tmu_data elements definition
> >
> > drivers/thermal/samsung/exynos_tmu.c | 9 +++++----
> > drivers/thermal/samsung/exynos_tmu.h | 3 ++-
> > drivers/thermal/samsung/exynos_tmu_data.c | 28
> > ++++++++++++++++++++++------
> > drivers/thermal/samsung/exynos_tmu_data.h | 9 ++++++++- 4 files
> > changed, 37 insertions(+), 12 deletions(-)
> >
> > diff --git a/drivers/thermal/samsung/exynos_tmu.c
> > b/drivers/thermal/samsung/exynos_tmu.c index b43afda..1312b34 100644
> > --- a/drivers/thermal/samsung/exynos_tmu.c
> > +++ b/drivers/thermal/samsung/exynos_tmu.c
> > @@ -488,7 +488,7 @@ static const struct of_device_id
> > exynos_tmu_match[] = { },
> > {
> > .compatible = "samsung,exynos4412-tmu",
> > - .data = (void *)EXYNOS5250_TMU_DRV_DATA,
> > + .data = (void *)EXYNOS4412_TMU_DRV_DATA,
> > },
> > {
> > .compatible = "samsung,exynos5250-tmu",
> > @@ -629,9 +629,10 @@ static int exynos_tmu_probe(struct
> > platform_device *pdev) if (ret)
> > return ret;
> >
> > - if (pdata->type == SOC_ARCH_EXYNOS ||
> > - pdata->type == SOC_ARCH_EXYNOS4210 ||
> > - pdata->type == SOC_ARCH_EXYNOS5440)
> > + if (pdata->type == SOC_ARCH_EXYNOS4210 ||
> > + pdata->type == SOC_ARCH_EXYNOS4412 ||
> > + pdata->type == SOC_ARCH_EXYNOS5250 ||
> > + pdata->type == SOC_ARCH_EXYNOS5440)
> > data->soc = pdata->type;
> > else {
> > ret = -EINVAL;
> > diff --git a/drivers/thermal/samsung/exynos_tmu.h
> > b/drivers/thermal/samsung/exynos_tmu.h index b364c9e..b42ece4 100644
> > --- a/drivers/thermal/samsung/exynos_tmu.h
> > +++ b/drivers/thermal/samsung/exynos_tmu.h
> > @@ -41,7 +41,8 @@ enum calibration_mode {
> >
> > enum soc_type {
> > SOC_ARCH_EXYNOS4210 = 1,
> > - SOC_ARCH_EXYNOS,
> > + SOC_ARCH_EXYNOS4412,
> > + SOC_ARCH_EXYNOS5250,
> > SOC_ARCH_EXYNOS5440,
> > };
> >
> > diff --git a/drivers/thermal/samsung/exynos_tmu_data.c
> > b/drivers/thermal/samsung/exynos_tmu_data.c index 9002499..d8de5c1
> > 100644 --- a/drivers/thermal/samsung/exynos_tmu_data.c
> > +++ b/drivers/thermal/samsung/exynos_tmu_data.c
> > @@ -90,8 +90,8 @@ struct exynos_tmu_init_data const
> > exynos4210_default_tmu_data = { };
> > #endif
> >
> > -#if defined(CONFIG_SOC_EXYNOS5250) ||
> > defined(CONFIG_SOC_EXYNOS4412) -static const struct
> > exynos_tmu_registers exynos5250_tmu_registers = { +#if
> > defined(CONFIG_SOC_EXYNOS4412) || defined(CONFIG_SOC_EXYNOS5250)
>
> Below will be only 4412 definitions,right? Why should we test for
> 5250?
^^^^^^^^ [1]

Below are registers definitions for Exynos4412, which appeared first.

However, the Exynos5250 is reusing those registers.

The exact separation between Exynos4412 and Exynos5250 is done when we
assign value to .tmu_data at exynos4412_default_tmu_data and
exynos5250_default_tmu_data.

The test [1] is correct here.

>
> > +static const struct exynos_tmu_registers exynos4412_tmu_registers
> > = { .triminfo_data = EXYNOS_TMU_REG_TRIMINFO,
> > .triminfo_25_shift = EXYNOS_TRIMINFO_25_SHIFT,
> > .triminfo_85_shift = EXYNOS_TRIMINFO_85_SHIFT,
> > @@ -128,7 +128,7 @@ static const struct exynos_tmu_registers
> > exynos5250_tmu_registers = { .emul_time_mask =
> > EXYNOS_EMUL_TIME_MASK, };
> >
> > -#define EXYNOS5250_TMU_DATA \
> > +#define EXYNOS4412_TMU_DATA \
> > .threshold_falling = 10, \
> > .trigger_levels[0] = 85, \
> > .trigger_levels[1] = 103, \
> > @@ -162,15 +162,31 @@ static const struct exynos_tmu_registers
> > exynos5250_tmu_registers = { .temp_level = 103, \
> > }, \
> > .freq_tab_count = 2, \
> > - .type = SOC_ARCH_EXYNOS, \
> > - .registers = &exynos5250_tmu_registers, \
> > + .registers = &exynos4412_tmu_registers, \
> > .features = (TMU_SUPPORT_EMULATION |
> > TMU_SUPPORT_TRIM_RELOAD | \ TMU_SUPPORT_FALLING_TRIP |
> > TMU_SUPPORT_READY_STATUS | \ TMU_SUPPORT_EMUL_TIME)
> > +#endif
> >
> > +#if defined(CONFIG_SOC_EXYNOS4412)
> > +struct exynos_tmu_init_data const exynos4412_default_tmu_data = {
> > + .tmu_data = {
> > + {
> > + EXYNOS4412_TMU_DATA,
> > + .type = SOC_ARCH_EXYNOS4412,
> > + },
> > + },
> > + .tmu_count = 1,
> > +};
> > +#endif
> > +
> > +#if defined(CONFIG_SOC_EXYNOS5250)
> > struct exynos_tmu_init_data const exynos5250_default_tmu_data = {
> > .tmu_data = {
> > - { EXYNOS5250_TMU_DATA },
> > + {
> > + EXYNOS4412_TMU_DATA,
> > + .type = SOC_ARCH_EXYNOS5250,
> > + },
> > },
> > .tmu_count = 1,
> > };
> > diff --git a/drivers/thermal/samsung/exynos_tmu_data.h
> > b/drivers/thermal/samsung/exynos_tmu_data.h index dc7feb5..b130b1e
> > 100644 --- a/drivers/thermal/samsung/exynos_tmu_data.h
> > +++ b/drivers/thermal/samsung/exynos_tmu_data.h
> > @@ -138,7 +138,14 @@ extern struct exynos_tmu_init_data const
> > exynos4210_default_tmu_data; #define EXYNOS4210_TMU_DRV_DATA (NULL)
> > #endif
> >
> > -#if (defined(CONFIG_SOC_EXYNOS5250) ||
> > defined(CONFIG_SOC_EXYNOS4412)) +#if defined(CONFIG_SOC_EXYNOS4412)
> > +extern struct exynos_tmu_init_data const
> > exynos4412_default_tmu_data; +#define EXYNOS4412_TMU_DRV_DATA
> > (&exynos4412_default_tmu_data) +#else
> > +#define EXYNOS4412_TMU_DRV_DATA (NULL)
> > +#endif
> > +
> > +#if defined(CONFIG_SOC_EXYNOS5250)
> > extern struct exynos_tmu_init_data const
> > exynos5250_default_tmu_data; #define EXYNOS5250_TMU_DRV_DATA
> > (&exynos5250_default_tmu_data) #else
> >
>
>



--
Best regards,

Lukasz Majewski

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

2013-10-14 15:00:43

by Lukasz Majewski

[permalink] [raw]
Subject: Re: [PATCH v2 3/5] thermal: exynos: Provide initial setting for TMU's test MUX address at Exynos4412

Hi Eduardo,

> On 09-10-2013 02:29, Lukasz Majewski wrote:
> > 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 <[email protected]>
> > Reviewed-by: Bartlomiej Zolnierkiewicz <[email protected]>
> > Reviewed-by: Tomasz Figa <[email protected]>
> >
> > ---
> > Changes for v2:
> > - Define test_mux and test_mux_addr_shift to not use direct
> > register access
> > - Remove pdata->type == SOC_ARCH_EXYNOS4412 check at
> > exynos_tmu_control() and use only generic code
> >
> > drivers/thermal/samsung/exynos_tmu.c | 3 +++
> > drivers/thermal/samsung/exynos_tmu.h | 4 ++++
> > drivers/thermal/samsung/exynos_tmu_data.c | 2 ++
> > drivers/thermal/samsung/exynos_tmu_data.h | 4 ++++
> > 4 files changed, 13 insertions(+)
> >
> > diff --git a/drivers/thermal/samsung/exynos_tmu.c
> > b/drivers/thermal/samsung/exynos_tmu.c index 1312b34..32f38b9 100644
> > --- a/drivers/thermal/samsung/exynos_tmu.c
> > +++ b/drivers/thermal/samsung/exynos_tmu.c
> > @@ -317,6 +317,9 @@ static void exynos_tmu_control(struct
> > platform_device *pdev, bool on)
> > con = readl(data->base + reg->tmu_ctrl);
> >
> > + if (pdata->test_mux)
>
>
> test_mux field is in fact an address, correct? Can 0 be a valid
> address?

No it isn't an address. It is the value which shall be written to
test_mux field of TMU_CONTROL register.

>
> Why not using the feature flags to test for capabilities,

It is easier to assign value to test_mux tmu_data struct, than write
separate set of features for Exynos4412 and Exynos5250, which share the
code.

Also .features seems to define SoC independent features of TMU IP (like
TMU_SUPPORT_EMULATION).

The TEST_MUX setting is platform dependent (only Exynos4412 uses it),
so this is the rationale to define it at tmu platform data.

> features and
> required configurations instead of assuming obscure domain and address
> ranges?

TMU_MUX only uses

(test_mux << test_mux_addr_shift) at tmu_ctrl register.


>
>
> > + con |= (pdata->test_mux <<
> > reg->test_mux_addr_shift); +
> > if (pdata->reference_voltage) {
> > con &= ~(reg->buf_vref_sel_mask <<
> > reg->buf_vref_sel_shift); con |= pdata->reference_voltage <<
> > reg->buf_vref_sel_shift; diff --git
> > a/drivers/thermal/samsung/exynos_tmu.h
> > b/drivers/thermal/samsung/exynos_tmu.h index b42ece4..3fb6554
> > 100644 --- a/drivers/thermal/samsung/exynos_tmu.h +++
> > b/drivers/thermal/samsung/exynos_tmu.h @@ -85,6 +85,7 @@ enum
> > soc_type {
> > * @triminfo_reload_shift: shift of triminfo reload enable bit in
> > triminfo_ctrl reg.
> > * @tmu_ctrl: TMU main controller register.
> > + * @test_mux_addr_shift: shift bits of test mux address.
> > * @buf_vref_sel_shift: shift bits of reference voltage in
> > tmu_ctrl register.
> > * @buf_vref_sel_mask: mask bits of reference voltage in tmu_ctrl
> > register.
> > * @therm_trip_mode_shift: shift bits of tripping mode in tmu_ctrl
> > register. @@ -151,6 +152,7 @@ struct exynos_tmu_registers {
> > u32 triminfo_reload_shift;
> >
> > u32 tmu_ctrl;
> > + u32 test_mux_addr_shift;
> > u32 buf_vref_sel_shift;
> > u32 buf_vref_sel_mask;
> > u32 therm_trip_mode_shift;
> > @@ -258,6 +260,7 @@ struct exynos_tmu_registers {
> > * @first_point_trim: temp value of the first point trimming
> > * @second_point_trim: temp value of the second point trimming
> > * @default_temp_offset: default temperature offset in case of no
> > trimming
> > + * @test_mux; information if SoC supports test MUX
> > * @cal_type: calibration type for temperature
> > * @cal_mode: calibration mode for temperature
> > * @freq_clip_table: Table representing frequency reduction
> > percentage. @@ -287,6 +290,7 @@ struct exynos_tmu_platform_data {
> > u8 first_point_trim;
> > u8 second_point_trim;
> > u8 default_temp_offset;
> > + u8 test_mux;
> >
> > enum calibration_type cal_type;
> > enum calibration_mode cal_mode;
> > diff --git a/drivers/thermal/samsung/exynos_tmu_data.c
> > b/drivers/thermal/samsung/exynos_tmu_data.c index d8de5c1..073c292
> > 100644 --- a/drivers/thermal/samsung/exynos_tmu_data.c
> > +++ b/drivers/thermal/samsung/exynos_tmu_data.c
> > @@ -98,6 +98,7 @@ static const struct exynos_tmu_registers
> > exynos4412_tmu_registers = { .triminfo_ctrl =
> > EXYNOS_TMU_TRIMINFO_CON, .triminfo_reload_shift =
> > EXYNOS_TRIMINFO_RELOAD_SHIFT, .tmu_ctrl = EXYNOS_TMU_REG_CONTROL,
> > + .test_mux_addr_shift = EXYNOS4412_MUX_ADDR_SHIFT,
> > .buf_vref_sel_shift = EXYNOS_TMU_REF_VOLTAGE_SHIFT,
> > .buf_vref_sel_mask = EXYNOS_TMU_REF_VOLTAGE_MASK,
> > .therm_trip_mode_shift = EXYNOS_TMU_TRIP_MODE_SHIFT,
> > @@ -174,6 +175,7 @@ struct exynos_tmu_init_data const
> > exynos4412_default_tmu_data = { {
> > EXYNOS4412_TMU_DATA,
> > .type = SOC_ARCH_EXYNOS4412,
> > + .test_mux = EXYNOS4412_MUX_ADDR_VALUE,
> > },
> > },
> > .tmu_count = 1,
> > diff --git a/drivers/thermal/samsung/exynos_tmu_data.h
> > b/drivers/thermal/samsung/exynos_tmu_data.h index b130b1e..a1ea19d
> > 100644 --- a/drivers/thermal/samsung/exynos_tmu_data.h
> > +++ b/drivers/thermal/samsung/exynos_tmu_data.h
> > @@ -95,6 +95,10 @@
> >
> > #define EXYNOS_MAX_TRIGGER_PER_REG 4
> >
> > +/* Exynos4412 specific */
> > +#define EXYNOS4412_MUX_ADDR_VALUE 6
>
> > +#define EXYNOS4412_MUX_ADDR_SHIFT 20
> > +
> > /*exynos5440 specific registers*/
> > #define EXYNOS5440_TMU_S0_7_TRIM 0x000
> > #define EXYNOS5440_TMU_S0_7_CTRL 0x020
> >
>
>



--
Best regards,

Lukasz Majewski

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

2013-10-14 19:13:25

by Eduardo Valentin

[permalink] [raw]
Subject: Re: [PATCH v2 0/5] thermal: exynos: Fixes for v3.12

On 14-10-2013 01:52, Zhang, Rui wrote:
> Eduardo,
>
> What's your opinion on this patch set?
> BTW, please send me all the urgent fixes for thermal soc drivers that
you think should go to 3.12.
>

I will be sending these + one fix on ti soc thermal for 3.12 soon.

The new chip support on exynos needs to be reworked and there are couple
of new drivers that needs to be reworked too. But those I don't think
are ready to go now.

> Thanks,
> rui
>> -----Original Message-----
>> From: Lukasz Majewski [mailto:[email protected]]
>> Sent: Monday, October 14, 2013 1:47 PM
>> To: Zhang, Rui; Eduardo Valentin; [email protected]
>> Cc: Lukasz Majewski; Linux PM list; Lukasz Majewski; linux-kernel;
>> Bartlomiej Zolnierkiewicz; [email protected]; Amit Daniel
>> Kachhap; [email protected]
>> Subject: Re: [PATCH v2 0/5] thermal: exynos: Fixes for v3.12
>> Importance: High
>>
>> Hi Zhang, Eduardo,
>>
>>> This patch series is divided into two parts:
>>> 1. Device tree node definition and enabelement for TMU at Exynos4412
>>> (Trats2) 2. Exynos thermal subsystem regressions for v3.12-rc4.
>>> Several commits were necessary to properly fix regression for TMU
>> test
>>> MUX address setting after reset.
>>>
>>> Test HW:
>>> - Exynos4412 - TRATS2 board (Linux v3.12-rc4)
>>> SHA1: 8b5ede69d24db939f52b47effff2f6fe1e83e08b
>>>
>>>
>>> Lukasz Majewski (5):
>>> thermal: exynos: Remove check for thermal device pointer at
>>> exynos_report_trigger()
>>> thermal: exynos: Provide separate TMU data for Exynos4412
>>> thermal: exynos: Provide initial setting for TMU's test MUX address
>>> at Exynos4412
>>> ARM: dts: exynos4x12: Device tree node definition for TMU on
>>> Exynos4x12
>>> ARM: dts: exynos4412-trats2: Enable TMU support at Trats2
>>>
>>
>> Zhang, Eduardo - any comments?
>>
>> Would it be possible to add them to v3.12 since they do fix critical
>> error and regression on Exynos4412.
>>
>>
>>> arch/arm/boot/dts/exynos4412-trats2.dts | 5 ++++
>>> arch/arm/boot/dts/exynos4x12.dtsi | 10 ++++++++
>>> drivers/thermal/samsung/exynos_thermal_common.c | 2 --
>>> drivers/thermal/samsung/exynos_tmu.c | 12 ++++++---
>>> drivers/thermal/samsung/exynos_tmu.h | 7 +++++-
>>> drivers/thermal/samsung/exynos_tmu_data.c | 30
>>> ++++++++++++++++++-----
>>> drivers/thermal/samsung/exynos_tmu_data.h | 13 +++++++++- 7
>>> files changed, 65 insertions(+), 14 deletions(-)
>>>
>>
>>
>>
>> --
>> 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 [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
>


--
You have got to be excited about what you are doing. (L. Lamport)

Eduardo Valentin


Attachments:
signature.asc (295.00 B)
OpenPGP digital signature

2013-10-14 19:20:51

by Eduardo Valentin

[permalink] [raw]
Subject: Re: [PATCH v2 3/5] thermal: exynos: Provide initial setting for TMU's test MUX address at Exynos4412

On 14-10-2013 11:00, Lukasz Majewski wrote:
> Hi Eduardo,
>
>> On 09-10-2013 02:29, Lukasz Majewski wrote:
>>> 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 <[email protected]>
>>> Reviewed-by: Bartlomiej Zolnierkiewicz <[email protected]>
>>> Reviewed-by: Tomasz Figa <[email protected]>
>>>
>>> ---
>>> Changes for v2:
>>> - Define test_mux and test_mux_addr_shift to not use direct
>>> register access
>>> - Remove pdata->type == SOC_ARCH_EXYNOS4412 check at
>>> exynos_tmu_control() and use only generic code
>>>
>>> drivers/thermal/samsung/exynos_tmu.c | 3 +++
>>> drivers/thermal/samsung/exynos_tmu.h | 4 ++++
>>> drivers/thermal/samsung/exynos_tmu_data.c | 2 ++
>>> drivers/thermal/samsung/exynos_tmu_data.h | 4 ++++
>>> 4 files changed, 13 insertions(+)
>>>
>>> diff --git a/drivers/thermal/samsung/exynos_tmu.c
>>> b/drivers/thermal/samsung/exynos_tmu.c index 1312b34..32f38b9 100644
>>> --- a/drivers/thermal/samsung/exynos_tmu.c
>>> +++ b/drivers/thermal/samsung/exynos_tmu.c
>>> @@ -317,6 +317,9 @@ static void exynos_tmu_control(struct
>>> platform_device *pdev, bool on)
>>> con = readl(data->base + reg->tmu_ctrl);
>>>
>>> + if (pdata->test_mux)
>>
>>
>> test_mux field is in fact an address, correct? Can 0 be a valid
>> address?
>
> No it isn't an address. It is the value which shall be written to
> test_mux field of TMU_CONTROL register.
>
>>
>> Why not using the feature flags to test for capabilities,
>
> It is easier to assign value to test_mux tmu_data struct, than write
> separate set of features for Exynos4412 and Exynos5250, which share the
> code.
>

It is harder to write, yes, but things that are easy to write are
usually harder to read. Besides, my concern is if 0x0 is a valid value
to be written. And if yes, then makes the patch you sent might be
incomplete.

> Also .features seems to define SoC independent features of TMU IP (like
> TMU_SUPPORT_EMULATION).
>
> The TEST_MUX setting is platform dependent (only Exynos4412 uses it),
> so this is the rationale to define it at tmu platform data.
>

Is test mux something pinctrl should be handling?

>> features and
>> required configurations instead of assuming obscure domain and address
>> ranges?
>
> TMU_MUX only uses
>
> (test_mux << test_mux_addr_shift) at tmu_ctrl register.
>
>
>>
>>
>>> + con |= (pdata->test_mux <<
>>> reg->test_mux_addr_shift); +
>>> if (pdata->reference_voltage) {
>>> con &= ~(reg->buf_vref_sel_mask <<
>>> reg->buf_vref_sel_shift); con |= pdata->reference_voltage <<
>>> reg->buf_vref_sel_shift; diff --git
>>> a/drivers/thermal/samsung/exynos_tmu.h
>>> b/drivers/thermal/samsung/exynos_tmu.h index b42ece4..3fb6554
>>> 100644 --- a/drivers/thermal/samsung/exynos_tmu.h +++
>>> b/drivers/thermal/samsung/exynos_tmu.h @@ -85,6 +85,7 @@ enum
>>> soc_type {
>>> * @triminfo_reload_shift: shift of triminfo reload enable bit in
>>> triminfo_ctrl reg.
>>> * @tmu_ctrl: TMU main controller register.
>>> + * @test_mux_addr_shift: shift bits of test mux address.
>>> * @buf_vref_sel_shift: shift bits of reference voltage in
>>> tmu_ctrl register.
>>> * @buf_vref_sel_mask: mask bits of reference voltage in tmu_ctrl
>>> register.
>>> * @therm_trip_mode_shift: shift bits of tripping mode in tmu_ctrl
>>> register. @@ -151,6 +152,7 @@ struct exynos_tmu_registers {
>>> u32 triminfo_reload_shift;
>>>
>>> u32 tmu_ctrl;
>>> + u32 test_mux_addr_shift;
>>> u32 buf_vref_sel_shift;
>>> u32 buf_vref_sel_mask;
>>> u32 therm_trip_mode_shift;
>>> @@ -258,6 +260,7 @@ struct exynos_tmu_registers {
>>> * @first_point_trim: temp value of the first point trimming
>>> * @second_point_trim: temp value of the second point trimming
>>> * @default_temp_offset: default temperature offset in case of no
>>> trimming
>>> + * @test_mux; information if SoC supports test MUX
>>> * @cal_type: calibration type for temperature
>>> * @cal_mode: calibration mode for temperature
>>> * @freq_clip_table: Table representing frequency reduction
>>> percentage. @@ -287,6 +290,7 @@ struct exynos_tmu_platform_data {
>>> u8 first_point_trim;
>>> u8 second_point_trim;
>>> u8 default_temp_offset;
>>> + u8 test_mux;
>>>
>>> enum calibration_type cal_type;
>>> enum calibration_mode cal_mode;
>>> diff --git a/drivers/thermal/samsung/exynos_tmu_data.c
>>> b/drivers/thermal/samsung/exynos_tmu_data.c index d8de5c1..073c292
>>> 100644 --- a/drivers/thermal/samsung/exynos_tmu_data.c
>>> +++ b/drivers/thermal/samsung/exynos_tmu_data.c
>>> @@ -98,6 +98,7 @@ static const struct exynos_tmu_registers
>>> exynos4412_tmu_registers = { .triminfo_ctrl =
>>> EXYNOS_TMU_TRIMINFO_CON, .triminfo_reload_shift =
>>> EXYNOS_TRIMINFO_RELOAD_SHIFT, .tmu_ctrl = EXYNOS_TMU_REG_CONTROL,
>>> + .test_mux_addr_shift = EXYNOS4412_MUX_ADDR_SHIFT,
>>> .buf_vref_sel_shift = EXYNOS_TMU_REF_VOLTAGE_SHIFT,
>>> .buf_vref_sel_mask = EXYNOS_TMU_REF_VOLTAGE_MASK,
>>> .therm_trip_mode_shift = EXYNOS_TMU_TRIP_MODE_SHIFT,
>>> @@ -174,6 +175,7 @@ struct exynos_tmu_init_data const
>>> exynos4412_default_tmu_data = { {
>>> EXYNOS4412_TMU_DATA,
>>> .type = SOC_ARCH_EXYNOS4412,
>>> + .test_mux = EXYNOS4412_MUX_ADDR_VALUE,
>>> },
>>> },
>>> .tmu_count = 1,
>>> diff --git a/drivers/thermal/samsung/exynos_tmu_data.h
>>> b/drivers/thermal/samsung/exynos_tmu_data.h index b130b1e..a1ea19d
>>> 100644 --- a/drivers/thermal/samsung/exynos_tmu_data.h
>>> +++ b/drivers/thermal/samsung/exynos_tmu_data.h
>>> @@ -95,6 +95,10 @@
>>>
>>> #define EXYNOS_MAX_TRIGGER_PER_REG 4
>>>
>>> +/* Exynos4412 specific */
>>> +#define EXYNOS4412_MUX_ADDR_VALUE 6
>>
>>> +#define EXYNOS4412_MUX_ADDR_SHIFT 20
>>> +
>>> /*exynos5440 specific registers*/
>>> #define EXYNOS5440_TMU_S0_7_TRIM 0x000
>>> #define EXYNOS5440_TMU_S0_7_CTRL 0x020
>>>
>>
>>
>
>
>


--
You have got to be excited about what you are doing. (L. Lamport)

Eduardo Valentin


Attachments:
signature.asc (295.00 B)
OpenPGP digital signature

2013-10-14 19:23:19

by Eduardo Valentin

[permalink] [raw]
Subject: Re: [PATCH v2 0/5] thermal: exynos: Fixes for v3.12

On 14-10-2013 15:13, Eduardo Valentin wrote:
> On 14-10-2013 01:52, Zhang, Rui wrote:
>> Eduardo,
>>
>> What's your opinion on this patch set?
>> BTW, please send me all the urgent fixes for thermal soc drivers that
> you think should go to 3.12.
>>
>
> I will be sending these + one fix on ti soc thermal for 3.12 soon.
>
> The new chip support on exynos needs to be reworked and there are couple
> of new drivers that needs to be reworked too. But those I don't think
> are ready to go now.
>

Just to be clear, on this patch set obviously I wont be sending the DT
changes. Those should go via the correct tree.

>> Thanks,
>> rui
>>> -----Original Message-----
>>> From: Lukasz Majewski [mailto:[email protected]]
>>> Sent: Monday, October 14, 2013 1:47 PM
>>> To: Zhang, Rui; Eduardo Valentin; [email protected]
>>> Cc: Lukasz Majewski; Linux PM list; Lukasz Majewski; linux-kernel;
>>> Bartlomiej Zolnierkiewicz; [email protected]; Amit Daniel
>>> Kachhap; [email protected]
>>> Subject: Re: [PATCH v2 0/5] thermal: exynos: Fixes for v3.12
>>> Importance: High
>>>
>>> Hi Zhang, Eduardo,
>>>
>>>> This patch series is divided into two parts:
>>>> 1. Device tree node definition and enabelement for TMU at Exynos4412
>>>> (Trats2) 2. Exynos thermal subsystem regressions for v3.12-rc4.
>>>> Several commits were necessary to properly fix regression for TMU
>>> test
>>>> MUX address setting after reset.
>>>>
>>>> Test HW:
>>>> - Exynos4412 - TRATS2 board (Linux v3.12-rc4)
>>>> SHA1: 8b5ede69d24db939f52b47effff2f6fe1e83e08b
>>>>
>>>>
>>>> Lukasz Majewski (5):
>>>> thermal: exynos: Remove check for thermal device pointer at
>>>> exynos_report_trigger()
>>>> thermal: exynos: Provide separate TMU data for Exynos4412
>>>> thermal: exynos: Provide initial setting for TMU's test MUX address
>>>> at Exynos4412
>>>> ARM: dts: exynos4x12: Device tree node definition for TMU on
>>>> Exynos4x12
>>>> ARM: dts: exynos4412-trats2: Enable TMU support at Trats2
>>>>
>>>
>>> Zhang, Eduardo - any comments?
>>>
>>> Would it be possible to add them to v3.12 since they do fix critical
>>> error and regression on Exynos4412.
>>>
>>>
>>>> arch/arm/boot/dts/exynos4412-trats2.dts | 5 ++++
>>>> arch/arm/boot/dts/exynos4x12.dtsi | 10 ++++++++
>>>> drivers/thermal/samsung/exynos_thermal_common.c | 2 --
>>>> drivers/thermal/samsung/exynos_tmu.c | 12 ++++++---
>>>> drivers/thermal/samsung/exynos_tmu.h | 7 +++++-
>>>> drivers/thermal/samsung/exynos_tmu_data.c | 30
>>>> ++++++++++++++++++-----
>>>> drivers/thermal/samsung/exynos_tmu_data.h | 13 +++++++++- 7
>>>> files changed, 65 insertions(+), 14 deletions(-)
>>>>
>>>
>>>
>>>
>>> --
>>> 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 [email protected]
>> More majordomo info at http://vger.kernel.org/majordomo-info.html
>>
>>
>
>


--
You have got to be excited about what you are doing. (L. Lamport)

Eduardo Valentin


Attachments:
signature.asc (295.00 B)
OpenPGP digital signature

2013-10-15 06:23:13

by Lukasz Majewski

[permalink] [raw]
Subject: Re: [PATCH v2 0/5] thermal: exynos: Fixes for v3.12

Hi Eduardo,

> On 14-10-2013 15:13, Eduardo Valentin wrote:
> > On 14-10-2013 01:52, Zhang, Rui wrote:
> >> Eduardo,
> >>
> >> What's your opinion on this patch set?
> >> BTW, please send me all the urgent fixes for thermal soc drivers
> >> that
> > you think should go to 3.12.
> >>
> >
> > I will be sending these + one fix on ti soc thermal for 3.12 soon.
> >
> > The new chip support on exynos needs to be reworked and there are
> > couple of new drivers that needs to be reworked too. But those I
> > don't think are ready to go now.
> >
>
> Just to be clear, on this patch set obviously I wont be sending the DT
> changes. Those should go via the correct tree.

I understand. I will ask Mr. Kukjin Kim to take the DT changes.

>
> >> Thanks,
> >> rui
> >>> -----Original Message-----
> >>> From: Lukasz Majewski [mailto:[email protected]]
> >>> Sent: Monday, October 14, 2013 1:47 PM
> >>> To: Zhang, Rui; Eduardo Valentin; [email protected]
> >>> Cc: Lukasz Majewski; Linux PM list; Lukasz Majewski; linux-kernel;
> >>> Bartlomiej Zolnierkiewicz; [email protected]; Amit Daniel
> >>> Kachhap; [email protected]
> >>> Subject: Re: [PATCH v2 0/5] thermal: exynos: Fixes for v3.12
> >>> Importance: High
> >>>
> >>> Hi Zhang, Eduardo,
> >>>
> >>>> This patch series is divided into two parts:
> >>>> 1. Device tree node definition and enabelement for TMU at
> >>>> Exynos4412 (Trats2) 2. Exynos thermal subsystem regressions for
> >>>> v3.12-rc4. Several commits were necessary to properly fix
> >>>> regression for TMU
> >>> test
> >>>> MUX address setting after reset.
> >>>>
> >>>> Test HW:
> >>>> - Exynos4412 - TRATS2 board (Linux v3.12-rc4)
> >>>> SHA1: 8b5ede69d24db939f52b47effff2f6fe1e83e08b
> >>>>
> >>>>
> >>>> Lukasz Majewski (5):
> >>>> thermal: exynos: Remove check for thermal device pointer at
> >>>> exynos_report_trigger()
> >>>> thermal: exynos: Provide separate TMU data for Exynos4412
> >>>> thermal: exynos: Provide initial setting for TMU's test MUX
> >>>> address at Exynos4412
> >>>> ARM: dts: exynos4x12: Device tree node definition for TMU on
> >>>> Exynos4x12
> >>>> ARM: dts: exynos4412-trats2: Enable TMU support at Trats2
> >>>>
> >>>
> >>> Zhang, Eduardo - any comments?
> >>>
> >>> Would it be possible to add them to v3.12 since they do fix
> >>> critical error and regression on Exynos4412.
> >>>
> >>>
> >>>> arch/arm/boot/dts/exynos4412-trats2.dts | 5 ++++
> >>>> arch/arm/boot/dts/exynos4x12.dtsi | 10 ++++++++
> >>>> drivers/thermal/samsung/exynos_thermal_common.c | 2 --
> >>>> drivers/thermal/samsung/exynos_tmu.c | 12 ++++++---
> >>>> drivers/thermal/samsung/exynos_tmu.h | 7 +++++-
> >>>> drivers/thermal/samsung/exynos_tmu_data.c | 30
> >>>> ++++++++++++++++++-----
> >>>> drivers/thermal/samsung/exynos_tmu_data.h | 13
> >>>> +++++++++- 7 files changed, 65 insertions(+), 14 deletions(-)
> >>>>
> >>>
> >>>
> >>>
> >>> --
> >>> 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 [email protected]
> >> More majordomo info at http://vger.kernel.org/majordomo-info.html
> >>
> >>
> >
> >
>
>



--
Best regards,

Lukasz Majewski

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

2014-11-14 10:03:57

by Lukasz Majewski

[permalink] [raw]
Subject: [RESEND PATCH 1/2] ARM: dts: exynos4x12: Device tree node definition for TMU on Exynos4x12

The TMU device tree node definition for Exynos4x12 family of SoCs.

Signed-off-by: Lukasz Majewski <[email protected]>
Reviewed-by: Bartlomiej Zolnierkiewicz <[email protected]>
Reviewed-by: Tomasz Figa <[email protected]>
---
arch/arm/boot/dts/exynos4x12.dtsi | 10 ++++++++++
1 file changed, 10 insertions(+)

diff --git a/arch/arm/boot/dts/exynos4x12.dtsi b/arch/arm/boot/dts/exynos4x12.dtsi
index 861bb91..2e9f1f7 100644
--- a/arch/arm/boot/dts/exynos4x12.dtsi
+++ b/arch/arm/boot/dts/exynos4x12.dtsi
@@ -271,4 +271,14 @@
compatible = "samsung,exynos4x12-usb2-phy";
samsung,sysreg-phandle = <&sys_reg>;
};
+
+ tmu@100C0000 {
+ compatible = "samsung,exynos4412-tmu";
+ interrupt-parent = <&combiner>;
+ interrupts = <2 4>;
+ reg = <0x100C0000 0x100>;
+ clocks = <&clock 383>;
+ clock-names = "tmu_apbif";
+ status = "disabled";
+ };
};
--
2.0.0.rc2

2014-11-14 10:04:12

by Lukasz Majewski

[permalink] [raw]
Subject: [RESEND PATCH 2/2] ARM: dts: exynos4412-trats2: Enable TMU support at Trats2

This patch enables support for TMU at Exynos4412 based Trats2 board.

Signed-off-by: Lukasz Majewski <[email protected]>
Reviewed-by: Bartlomiej Zolnierkiewicz <[email protected]>
Reviewed-by: Tomasz Figa <[email protected]>
---
arch/arm/boot/dts/exynos4412-trats2.dts | 5 +++++
1 file changed, 5 insertions(+)

diff --git a/arch/arm/boot/dts/exynos4412-trats2.dts b/arch/arm/boot/dts/exynos4412-trats2.dts
index 5e066cd..121430d 100644
--- a/arch/arm/boot/dts/exynos4412-trats2.dts
+++ b/arch/arm/boot/dts/exynos4412-trats2.dts
@@ -551,6 +551,11 @@
status = "okay";
};

+ tmu@100C0000 {
+ vtmu-supply = <&ldo10_reg>;
+ status = "okay";
+ };
+
i2c_ak8975: i2c-gpio-0 {
compatible = "i2c-gpio";
gpios = <&gpy2 4 0>, <&gpy2 5 0>;
--
2.0.0.rc2