aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/thermal/samsung
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/thermal/samsung')
-rw-r--r--drivers/thermal/samsung/exynos_tmu.c72
-rw-r--r--drivers/thermal/samsung/exynos_tmu.h3
-rw-r--r--drivers/thermal/samsung/exynos_tmu_data.c5
3 files changed, 38 insertions, 42 deletions
diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung/exynos_tmu.c
index 51d8cc70b6d6..65eeeccff78b 100644
--- a/drivers/thermal/samsung/exynos_tmu.c
+++ b/drivers/thermal/samsung/exynos_tmu.c
@@ -473,7 +473,6 @@ static void exynos5440_tmu_set_emulation(struct exynos_tmu_data *data,
473static int exynos_tmu_set_emulation(void *drv_data, unsigned long temp) 473static int exynos_tmu_set_emulation(void *drv_data, unsigned long temp)
474{ 474{
475 struct exynos_tmu_data *data = drv_data; 475 struct exynos_tmu_data *data = drv_data;
476 struct exynos_tmu_platform_data *pdata = data->pdata;
477 int ret = -EINVAL; 476 int ret = -EINVAL;
478 477
479 if (data->soc == SOC_ARCH_EXYNOS4210) 478 if (data->soc == SOC_ARCH_EXYNOS4210)
@@ -696,12 +695,47 @@ static int exynos_map_dt_data(struct platform_device *pdev)
696 dev_err(&pdev->dev, "No platform init data supplied.\n"); 695 dev_err(&pdev->dev, "No platform init data supplied.\n");
697 return -ENODEV; 696 return -ENODEV;
698 } 697 }
698
699 data->pdata = pdata; 699 data->pdata = pdata;
700 data->soc = pdata->type;
701
702 switch (data->soc) {
703 case SOC_ARCH_EXYNOS4210:
704 data->tmu_initialize = exynos4210_tmu_initialize;
705 data->tmu_control = exynos4210_tmu_control;
706 data->tmu_read = exynos4210_tmu_read;
707 data->tmu_clear_irqs = exynos4210_tmu_clear_irqs;
708 break;
709 case SOC_ARCH_EXYNOS3250:
710 case SOC_ARCH_EXYNOS4412:
711 case SOC_ARCH_EXYNOS5250:
712 case SOC_ARCH_EXYNOS5260:
713 case SOC_ARCH_EXYNOS5420:
714 case SOC_ARCH_EXYNOS5420_TRIMINFO:
715 data->tmu_initialize = exynos4412_tmu_initialize;
716 data->tmu_control = exynos4210_tmu_control;
717 data->tmu_read = exynos4412_tmu_read;
718 data->tmu_set_emulation = exynos4412_tmu_set_emulation;
719 data->tmu_clear_irqs = exynos4210_tmu_clear_irqs;
720 break;
721 case SOC_ARCH_EXYNOS5440:
722 data->tmu_initialize = exynos5440_tmu_initialize;
723 data->tmu_control = exynos5440_tmu_control;
724 data->tmu_read = exynos5440_tmu_read;
725 data->tmu_set_emulation = exynos5440_tmu_set_emulation;
726 data->tmu_clear_irqs = exynos5440_tmu_clear_irqs;
727 break;
728 default:
729 dev_err(&pdev->dev, "Platform not supported\n");
730 return -EINVAL;
731 }
732
700 /* 733 /*
701 * Check if the TMU shares some registers and then try to map the 734 * Check if the TMU shares some registers and then try to map the
702 * memory of common registers. 735 * memory of common registers.
703 */ 736 */
704 if (!TMU_SUPPORTS(pdata, ADDRESS_MULTIPLE)) 737 if (data->soc != SOC_ARCH_EXYNOS5420_TRIMINFO &&
738 data->soc != SOC_ARCH_EXYNOS5440)
705 return 0; 739 return 0;
706 740
707 if (of_address_to_resource(pdev->dev.of_node, 1, &res)) { 741 if (of_address_to_resource(pdev->dev.of_node, 1, &res)) {
@@ -768,40 +802,6 @@ static int exynos_tmu_probe(struct platform_device *pdev)
768 goto err_clk_sec; 802 goto err_clk_sec;
769 } 803 }
770 804
771 data->soc = pdata->type;
772
773 switch (data->soc) {
774 case SOC_ARCH_EXYNOS4210:
775 data->tmu_initialize = exynos4210_tmu_initialize;
776 data->tmu_control = exynos4210_tmu_control;
777 data->tmu_read = exynos4210_tmu_read;
778 data->tmu_clear_irqs = exynos4210_tmu_clear_irqs;
779 break;
780 case SOC_ARCH_EXYNOS3250:
781 case SOC_ARCH_EXYNOS4412:
782 case SOC_ARCH_EXYNOS5250:
783 case SOC_ARCH_EXYNOS5260:
784 case SOC_ARCH_EXYNOS5420:
785 case SOC_ARCH_EXYNOS5420_TRIMINFO:
786 data->tmu_initialize = exynos4412_tmu_initialize;
787 data->tmu_control = exynos4210_tmu_control;
788 data->tmu_read = exynos4412_tmu_read;
789 data->tmu_set_emulation = exynos4412_tmu_set_emulation;
790 data->tmu_clear_irqs = exynos4210_tmu_clear_irqs;
791 break;
792 case SOC_ARCH_EXYNOS5440:
793 data->tmu_initialize = exynos5440_tmu_initialize;
794 data->tmu_control = exynos5440_tmu_control;
795 data->tmu_read = exynos5440_tmu_read;
796 data->tmu_set_emulation = exynos5440_tmu_set_emulation;
797 data->tmu_clear_irqs = exynos5440_tmu_clear_irqs;
798 break;
799 default:
800 ret = -EINVAL;
801 dev_err(&pdev->dev, "Platform not supported\n");
802 goto err_clk;
803 }
804
805 ret = exynos_tmu_initialize(pdev); 805 ret = exynos_tmu_initialize(pdev);
806 if (ret) { 806 if (ret) {
807 dev_err(&pdev->dev, "Failed to initialize TMU\n"); 807 dev_err(&pdev->dev, "Failed to initialize TMU\n");
diff --git a/drivers/thermal/samsung/exynos_tmu.h b/drivers/thermal/samsung/exynos_tmu.h
index 5ad3f3fbc6f0..54f018d6c382 100644
--- a/drivers/thermal/samsung/exynos_tmu.h
+++ b/drivers/thermal/samsung/exynos_tmu.h
@@ -49,12 +49,9 @@ enum soc_type {
49 * EXYNOS TMU supported features. 49 * EXYNOS TMU supported features.
50 * TMU_SUPPORT_MULTI_INST - This features denotes that the soc 50 * TMU_SUPPORT_MULTI_INST - This features denotes that the soc
51 * has many instances of TMU. 51 * has many instances of TMU.
52 * TMU_SUPPORT_ADDRESS_MULTIPLE - This feature tells that the different TMU
53 * sensors shares some common registers.
54 * TMU_SUPPORT - macro to compare the above features with the supplied. 52 * TMU_SUPPORT - macro to compare the above features with the supplied.
55 */ 53 */
56#define TMU_SUPPORT_MULTI_INST BIT(0) 54#define TMU_SUPPORT_MULTI_INST BIT(0)
57#define TMU_SUPPORT_ADDRESS_MULTIPLE BIT(1)
58 55
59#define TMU_SUPPORTS(a, b) (a->features & TMU_SUPPORT_ ## b) 56#define TMU_SUPPORTS(a, b) (a->features & TMU_SUPPORT_ ## b)
60 57
diff --git a/drivers/thermal/samsung/exynos_tmu_data.c b/drivers/thermal/samsung/exynos_tmu_data.c
index 4dd8d1c1b822..13ac00b88e6b 100644
--- a/drivers/thermal/samsung/exynos_tmu_data.c
+++ b/drivers/thermal/samsung/exynos_tmu_data.c
@@ -275,8 +275,7 @@ struct exynos_tmu_init_data const exynos5260_default_tmu_data = {
275 275
276#define EXYNOS5420_TMU_DATA_SHARED \ 276#define EXYNOS5420_TMU_DATA_SHARED \
277 __EXYNOS5420_TMU_DATA \ 277 __EXYNOS5420_TMU_DATA \
278 .type = SOC_ARCH_EXYNOS5420_TRIMINFO, \ 278 .type = SOC_ARCH_EXYNOS5420_TRIMINFO
279 .features = TMU_SUPPORT_ADDRESS_MULTIPLE
280 279
281struct exynos_tmu_init_data const exynos5420_default_tmu_data = { 280struct exynos_tmu_init_data const exynos5420_default_tmu_data = {
282 .tmu_data = { 281 .tmu_data = {
@@ -310,7 +309,7 @@ struct exynos_tmu_init_data const exynos5420_default_tmu_data = {
310 .second_point_trim = 70, \ 309 .second_point_trim = 70, \
311 .default_temp_offset = 25, \ 310 .default_temp_offset = 25, \
312 .type = SOC_ARCH_EXYNOS5440, \ 311 .type = SOC_ARCH_EXYNOS5440, \
313 .features = (TMU_SUPPORT_MULTI_INST | TMU_SUPPORT_ADDRESS_MULTIPLE), 312 .features = TMU_SUPPORT_MULTI_INST,
314 313
315struct exynos_tmu_init_data const exynos5440_default_tmu_data = { 314struct exynos_tmu_init_data const exynos5440_default_tmu_data = {
316 .tmu_data = { 315 .tmu_data = {