aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAmit Daniel Kachhap <amit.daniel@samsung.com>2013-06-24 06:50:28 -0400
committerEduardo Valentin <eduardo.valentin@ti.com>2013-08-13 09:52:00 -0400
commite6b7991ed50fea9bf8b36e8a4794ee36d35e1651 (patch)
tree3c111d0a4e6663c9f4b92931d9d7cf84f0a65260
parent0c1836a6563decc6de8622b2ed71523b3bdceb65 (diff)
thermal: exynos: Bifurcate exynos tmu driver and configuration data
This code splits the exynos tmu driver code into SOC specific data parts. This will simplify adding new SOC specific data to the same TMU controller. Acked-by: Kukjin Kim <kgene.kim@samsung.com> Acked-by: Jonghwa Lee <jonghwa3.lee@samsung.com> Acked-by: Eduardo Valentin <eduardo.valentin@ti.com> Signed-off-by: Amit Daniel Kachhap <amit.daniel@samsung.com> Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
-rw-r--r--drivers/thermal/samsung/Kconfig3
-rw-r--r--drivers/thermal/samsung/Makefile1
-rw-r--r--drivers/thermal/samsung/exynos_tmu.c68
-rw-r--r--drivers/thermal/samsung/exynos_tmu_data.c79
-rw-r--r--drivers/thermal/samsung/exynos_tmu_data.h40
5 files changed, 126 insertions, 65 deletions
diff --git a/drivers/thermal/samsung/Kconfig b/drivers/thermal/samsung/Kconfig
index f8100b1b953a..b653f1539148 100644
--- a/drivers/thermal/samsung/Kconfig
+++ b/drivers/thermal/samsung/Kconfig
@@ -5,7 +5,8 @@ config EXYNOS_THERMAL
5 If you say yes here you get support for the TMU (Thermal Management 5 If you say yes here you get support for the TMU (Thermal Management
6 Unit) driver for SAMSUNG EXYNOS series of soc. This driver initialises 6 Unit) driver for SAMSUNG EXYNOS series of soc. This driver initialises
7 the TMU, reports temperature and handles cooling action if defined. 7 the TMU, reports temperature and handles cooling action if defined.
8 This driver uses the exynos core thermal API's. 8 This driver uses the exynos core thermal API's and TMU configuration
9 data from the supported soc's.
9 10
10config EXYNOS_THERMAL_CORE 11config EXYNOS_THERMAL_CORE
11 bool "Core thermal framework support for EXYNOS SOC's" 12 bool "Core thermal framework support for EXYNOS SOC's"
diff --git a/drivers/thermal/samsung/Makefile b/drivers/thermal/samsung/Makefile
index 22528d6fa7f3..c09d83095dc2 100644
--- a/drivers/thermal/samsung/Makefile
+++ b/drivers/thermal/samsung/Makefile
@@ -3,4 +3,5 @@
3# 3#
4obj-$(CONFIG_EXYNOS_THERMAL) += exynos_thermal.o 4obj-$(CONFIG_EXYNOS_THERMAL) += exynos_thermal.o
5exynos_thermal-y := exynos_tmu.o 5exynos_thermal-y := exynos_tmu.o
6exynos_thermal-y += exynos_tmu_data.o
6exynos_thermal-$(CONFIG_EXYNOS_THERMAL_CORE) += exynos_thermal_common.o 7exynos_thermal-$(CONFIG_EXYNOS_THERMAL_CORE) += exynos_thermal_common.o
diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung/exynos_tmu.c
index 568c31d0d1cb..5df04a1294ec 100644
--- a/drivers/thermal/samsung/exynos_tmu.c
+++ b/drivers/thermal/samsung/exynos_tmu.c
@@ -30,6 +30,7 @@
30 30
31#include "exynos_thermal_common.h" 31#include "exynos_thermal_common.h"
32#include "exynos_tmu.h" 32#include "exynos_tmu.h"
33#include "exynos_tmu_data.h"
33 34
34/* Exynos generic registers */ 35/* Exynos generic registers */
35#define EXYNOS_TMU_REG_TRIMINFO 0x0 36#define EXYNOS_TMU_REG_TRIMINFO 0x0
@@ -381,67 +382,6 @@ static struct thermal_sensor_conf exynos_sensor_conf = {
381 .write_emul_temp = exynos_tmu_set_emulation, 382 .write_emul_temp = exynos_tmu_set_emulation,
382}; 383};
383 384
384#if defined(CONFIG_CPU_EXYNOS4210)
385static struct exynos_tmu_platform_data const exynos4210_default_tmu_data = {
386 .threshold = 80,
387 .trigger_levels[0] = 5,
388 .trigger_levels[1] = 20,
389 .trigger_levels[2] = 30,
390 .trigger_level0_en = 1,
391 .trigger_level1_en = 1,
392 .trigger_level2_en = 1,
393 .trigger_level3_en = 0,
394 .gain = 15,
395 .reference_voltage = 7,
396 .cal_type = TYPE_ONE_POINT_TRIMMING,
397 .freq_tab[0] = {
398 .freq_clip_max = 800 * 1000,
399 .temp_level = 85,
400 },
401 .freq_tab[1] = {
402 .freq_clip_max = 200 * 1000,
403 .temp_level = 100,
404 },
405 .freq_tab_count = 2,
406 .type = SOC_ARCH_EXYNOS4210,
407};
408#define EXYNOS4210_TMU_DRV_DATA (&exynos4210_default_tmu_data)
409#else
410#define EXYNOS4210_TMU_DRV_DATA (NULL)
411#endif
412
413#if defined(CONFIG_SOC_EXYNOS5250) || defined(CONFIG_SOC_EXYNOS4412) || \
414 defined(CONFIG_SOC_EXYNOS4212)
415static struct exynos_tmu_platform_data const exynos_default_tmu_data = {
416 .threshold_falling = 10,
417 .trigger_levels[0] = 85,
418 .trigger_levels[1] = 103,
419 .trigger_levels[2] = 110,
420 .trigger_level0_en = 1,
421 .trigger_level1_en = 1,
422 .trigger_level2_en = 1,
423 .trigger_level3_en = 0,
424 .gain = 8,
425 .reference_voltage = 16,
426 .noise_cancel_mode = 4,
427 .cal_type = TYPE_ONE_POINT_TRIMMING,
428 .efuse_value = 55,
429 .freq_tab[0] = {
430 .freq_clip_max = 800 * 1000,
431 .temp_level = 85,
432 },
433 .freq_tab[1] = {
434 .freq_clip_max = 200 * 1000,
435 .temp_level = 103,
436 },
437 .freq_tab_count = 2,
438 .type = SOC_ARCH_EXYNOS,
439};
440#define EXYNOS_TMU_DRV_DATA (&exynos_default_tmu_data)
441#else
442#define EXYNOS_TMU_DRV_DATA (NULL)
443#endif
444
445#ifdef CONFIG_OF 385#ifdef CONFIG_OF
446static const struct of_device_id exynos_tmu_match[] = { 386static const struct of_device_id exynos_tmu_match[] = {
447 { 387 {
@@ -450,11 +390,11 @@ static const struct of_device_id exynos_tmu_match[] = {
450 }, 390 },
451 { 391 {
452 .compatible = "samsung,exynos4412-tmu", 392 .compatible = "samsung,exynos4412-tmu",
453 .data = (void *)EXYNOS_TMU_DRV_DATA, 393 .data = (void *)EXYNOS5250_TMU_DRV_DATA,
454 }, 394 },
455 { 395 {
456 .compatible = "samsung,exynos5250-tmu", 396 .compatible = "samsung,exynos5250-tmu",
457 .data = (void *)EXYNOS_TMU_DRV_DATA, 397 .data = (void *)EXYNOS5250_TMU_DRV_DATA,
458 }, 398 },
459 {}, 399 {},
460}; 400};
@@ -468,7 +408,7 @@ static struct platform_device_id exynos_tmu_driver_ids[] = {
468 }, 408 },
469 { 409 {
470 .name = "exynos5250-tmu", 410 .name = "exynos5250-tmu",
471 .driver_data = (kernel_ulong_t)EXYNOS_TMU_DRV_DATA, 411 .driver_data = (kernel_ulong_t)EXYNOS5250_TMU_DRV_DATA,
472 }, 412 },
473 { }, 413 { },
474}; 414};
diff --git a/drivers/thermal/samsung/exynos_tmu_data.c b/drivers/thermal/samsung/exynos_tmu_data.c
new file mode 100644
index 000000000000..144ba44cc29c
--- /dev/null
+++ b/drivers/thermal/samsung/exynos_tmu_data.c
@@ -0,0 +1,79 @@
1/*
2 * exynos_tmu_data.c - Samsung EXYNOS tmu data file
3 *
4 * Copyright (C) 2013 Samsung Electronics
5 * Amit Daniel Kachhap <amit.daniel@samsung.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 *
21 */
22
23#include "exynos_thermal_common.h"
24#include "exynos_tmu.h"
25#include "exynos_tmu_data.h"
26
27#if defined(CONFIG_CPU_EXYNOS4210)
28struct exynos_tmu_platform_data const exynos4210_default_tmu_data = {
29 .threshold = 80,
30 .trigger_levels[0] = 5,
31 .trigger_levels[1] = 20,
32 .trigger_levels[2] = 30,
33 .trigger_level0_en = 1,
34 .trigger_level1_en = 1,
35 .trigger_level2_en = 1,
36 .trigger_level3_en = 0,
37 .gain = 15,
38 .reference_voltage = 7,
39 .cal_type = TYPE_ONE_POINT_TRIMMING,
40 .freq_tab[0] = {
41 .freq_clip_max = 800 * 1000,
42 .temp_level = 85,
43 },
44 .freq_tab[1] = {
45 .freq_clip_max = 200 * 1000,
46 .temp_level = 100,
47 },
48 .freq_tab_count = 2,
49 .type = SOC_ARCH_EXYNOS4210,
50};
51#endif
52
53#if defined(CONFIG_SOC_EXYNOS5250) || defined(CONFIG_SOC_EXYNOS4412)
54struct exynos_tmu_platform_data const exynos5250_default_tmu_data = {
55 .threshold_falling = 10,
56 .trigger_levels[0] = 85,
57 .trigger_levels[1] = 103,
58 .trigger_levels[2] = 110,
59 .trigger_level0_en = 1,
60 .trigger_level1_en = 1,
61 .trigger_level2_en = 1,
62 .trigger_level3_en = 0,
63 .gain = 8,
64 .reference_voltage = 16,
65 .noise_cancel_mode = 4,
66 .cal_type = TYPE_ONE_POINT_TRIMMING,
67 .efuse_value = 55,
68 .freq_tab[0] = {
69 .freq_clip_max = 800 * 1000,
70 .temp_level = 85,
71 },
72 .freq_tab[1] = {
73 .freq_clip_max = 200 * 1000,
74 .temp_level = 103,
75 },
76 .freq_tab_count = 2,
77 .type = SOC_ARCH_EXYNOS,
78};
79#endif
diff --git a/drivers/thermal/samsung/exynos_tmu_data.h b/drivers/thermal/samsung/exynos_tmu_data.h
new file mode 100644
index 000000000000..b7835fee6bef
--- /dev/null
+++ b/drivers/thermal/samsung/exynos_tmu_data.h
@@ -0,0 +1,40 @@
1/*
2 * exynos_tmu_data.h - Samsung EXYNOS tmu data header file
3 *
4 * Copyright (C) 2013 Samsung Electronics
5 * Amit Daniel Kachhap <amit.daniel@samsung.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 *
21 */
22
23#ifndef _EXYNOS_TMU_DATA_H
24#define _EXYNOS_TMU_DATA_H
25
26#if defined(CONFIG_CPU_EXYNOS4210)
27extern struct exynos_tmu_platform_data const exynos4210_default_tmu_data;
28#define EXYNOS4210_TMU_DRV_DATA (&exynos4210_default_tmu_data)
29#else
30#define EXYNOS4210_TMU_DRV_DATA (NULL)
31#endif
32
33#if (defined(CONFIG_SOC_EXYNOS5250) || defined(CONFIG_SOC_EXYNOS4412))
34extern struct exynos_tmu_platform_data const exynos5250_default_tmu_data;
35#define EXYNOS5250_TMU_DRV_DATA (&exynos5250_default_tmu_data)
36#else
37#define EXYNOS5250_TMU_DRV_DATA (NULL)
38#endif
39
40#endif /*_EXYNOS_TMU_DATA_H*/