Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Amit Daniel Kachhap and committed by
Eduardo Valentin
e6b7991e 0c1836a6

+126 -65
+2 -1
drivers/thermal/samsung/Kconfig
··· 5 5 If you say yes here you get support for the TMU (Thermal Management 6 6 Unit) driver for SAMSUNG EXYNOS series of soc. This driver initialises 7 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 10 11 config EXYNOS_THERMAL_CORE 11 12 bool "Core thermal framework support for EXYNOS SOC's"
+1
drivers/thermal/samsung/Makefile
··· 3 3 # 4 4 obj-$(CONFIG_EXYNOS_THERMAL) += exynos_thermal.o 5 5 exynos_thermal-y := exynos_tmu.o 6 + exynos_thermal-y += exynos_tmu_data.o 6 7 exynos_thermal-$(CONFIG_EXYNOS_THERMAL_CORE) += exynos_thermal_common.o
+4 -64
drivers/thermal/samsung/exynos_tmu.c
··· 30 30 31 31 #include "exynos_thermal_common.h" 32 32 #include "exynos_tmu.h" 33 + #include "exynos_tmu_data.h" 33 34 34 35 /* Exynos generic registers */ 35 36 #define EXYNOS_TMU_REG_TRIMINFO 0x0 ··· 382 381 .write_emul_temp = exynos_tmu_set_emulation, 383 382 }; 384 383 385 - #if defined(CONFIG_CPU_EXYNOS4210) 386 - static struct exynos_tmu_platform_data const exynos4210_default_tmu_data = { 387 - .threshold = 80, 388 - .trigger_levels[0] = 5, 389 - .trigger_levels[1] = 20, 390 - .trigger_levels[2] = 30, 391 - .trigger_level0_en = 1, 392 - .trigger_level1_en = 1, 393 - .trigger_level2_en = 1, 394 - .trigger_level3_en = 0, 395 - .gain = 15, 396 - .reference_voltage = 7, 397 - .cal_type = TYPE_ONE_POINT_TRIMMING, 398 - .freq_tab[0] = { 399 - .freq_clip_max = 800 * 1000, 400 - .temp_level = 85, 401 - }, 402 - .freq_tab[1] = { 403 - .freq_clip_max = 200 * 1000, 404 - .temp_level = 100, 405 - }, 406 - .freq_tab_count = 2, 407 - .type = SOC_ARCH_EXYNOS4210, 408 - }; 409 - #define EXYNOS4210_TMU_DRV_DATA (&exynos4210_default_tmu_data) 410 - #else 411 - #define EXYNOS4210_TMU_DRV_DATA (NULL) 412 - #endif 413 - 414 - #if defined(CONFIG_SOC_EXYNOS5250) || defined(CONFIG_SOC_EXYNOS4412) || \ 415 - defined(CONFIG_SOC_EXYNOS4212) 416 - static struct exynos_tmu_platform_data const exynos_default_tmu_data = { 417 - .threshold_falling = 10, 418 - .trigger_levels[0] = 85, 419 - .trigger_levels[1] = 103, 420 - .trigger_levels[2] = 110, 421 - .trigger_level0_en = 1, 422 - .trigger_level1_en = 1, 423 - .trigger_level2_en = 1, 424 - .trigger_level3_en = 0, 425 - .gain = 8, 426 - .reference_voltage = 16, 427 - .noise_cancel_mode = 4, 428 - .cal_type = TYPE_ONE_POINT_TRIMMING, 429 - .efuse_value = 55, 430 - .freq_tab[0] = { 431 - .freq_clip_max = 800 * 1000, 432 - .temp_level = 85, 433 - }, 434 - .freq_tab[1] = { 435 - .freq_clip_max = 200 * 1000, 436 - .temp_level = 103, 437 - }, 438 - .freq_tab_count = 2, 439 - .type = SOC_ARCH_EXYNOS, 440 - }; 441 - #define EXYNOS_TMU_DRV_DATA (&exynos_default_tmu_data) 442 - #else 443 - #define EXYNOS_TMU_DRV_DATA (NULL) 444 - #endif 445 - 446 384 #ifdef CONFIG_OF 447 385 static const struct of_device_id exynos_tmu_match[] = { 448 386 { ··· 390 450 }, 391 451 { 392 452 .compatible = "samsung,exynos4412-tmu", 393 - .data = (void *)EXYNOS_TMU_DRV_DATA, 453 + .data = (void *)EXYNOS5250_TMU_DRV_DATA, 394 454 }, 395 455 { 396 456 .compatible = "samsung,exynos5250-tmu", 397 - .data = (void *)EXYNOS_TMU_DRV_DATA, 457 + .data = (void *)EXYNOS5250_TMU_DRV_DATA, 398 458 }, 399 459 {}, 400 460 }; ··· 408 468 }, 409 469 { 410 470 .name = "exynos5250-tmu", 411 - .driver_data = (kernel_ulong_t)EXYNOS_TMU_DRV_DATA, 471 + .driver_data = (kernel_ulong_t)EXYNOS5250_TMU_DRV_DATA, 412 472 }, 413 473 { }, 414 474 };
+79
drivers/thermal/samsung/exynos_tmu_data.c
··· 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) 28 + struct 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) 54 + struct 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
+40
drivers/thermal/samsung/exynos_tmu_data.h
··· 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) 27 + extern 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)) 34 + extern 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*/