diff options
| -rw-r--r-- | Documentation/devicetree/bindings/thermal/exynos-thermal.txt | 50 | ||||
| -rw-r--r-- | drivers/thermal/Kconfig | 2 | ||||
| -rw-r--r-- | drivers/thermal/samsung/exynos_tmu.c | 77 | ||||
| -rw-r--r-- | drivers/thermal/samsung/exynos_tmu.h | 23 | ||||
| -rw-r--r-- | drivers/thermal/samsung/exynos_tmu_data.c | 211 | ||||
| -rw-r--r-- | drivers/thermal/samsung/exynos_tmu_data.h | 31 | ||||
| -rw-r--r-- | drivers/thermal/ti-soc-thermal/ti-bandgap.c | 2 |
7 files changed, 355 insertions, 41 deletions
diff --git a/Documentation/devicetree/bindings/thermal/exynos-thermal.txt b/Documentation/devicetree/bindings/thermal/exynos-thermal.txt index 284f5300fd8b..c94909215c07 100644 --- a/Documentation/devicetree/bindings/thermal/exynos-thermal.txt +++ b/Documentation/devicetree/bindings/thermal/exynos-thermal.txt | |||
| @@ -6,16 +6,35 @@ | |||
| 6 | "samsung,exynos4412-tmu" | 6 | "samsung,exynos4412-tmu" |
| 7 | "samsung,exynos4210-tmu" | 7 | "samsung,exynos4210-tmu" |
| 8 | "samsung,exynos5250-tmu" | 8 | "samsung,exynos5250-tmu" |
| 9 | "samsung,exynos5260-tmu" | ||
| 10 | "samsung,exynos5420-tmu" for TMU channel 0, 1 on Exynos5420 | ||
| 11 | "samsung,exynos5420-tmu-ext-triminfo" for TMU channels 2, 3 and 4 | ||
| 12 | Exynos5420 (Must pass triminfo base and triminfo clock) | ||
| 9 | "samsung,exynos5440-tmu" | 13 | "samsung,exynos5440-tmu" |
| 10 | - interrupt-parent : The phandle for the interrupt controller | 14 | - interrupt-parent : The phandle for the interrupt controller |
| 11 | - reg : Address range of the thermal registers. For soc's which has multiple | 15 | - reg : Address range of the thermal registers. For soc's which has multiple |
| 12 | instances of TMU and some registers are shared across all TMU's like | 16 | instances of TMU and some registers are shared across all TMU's like |
| 13 | interrupt related then 2 set of register has to supplied. First set | 17 | interrupt related then 2 set of register has to supplied. First set |
| 14 | belongs to each instance of TMU and second set belongs to common TMU | 18 | belongs to register set of TMU instance and second set belongs to |
| 15 | registers. | 19 | registers shared with the TMU instance. |
| 20 | |||
| 21 | NOTE: On Exynos5420, the TRIMINFO register is misplaced for TMU | ||
| 22 | channels 2, 3 and 4 | ||
| 23 | Use "samsung,exynos5420-tmu-ext-triminfo" in cases, there is a misplaced | ||
| 24 | register, also provide clock to access that base. | ||
| 25 | |||
| 26 | TRIMINFO at 0x1006c000 contains data for TMU channel 3 | ||
| 27 | TRIMINFO at 0x100a0000 contains data for TMU channel 4 | ||
| 28 | TRIMINFO at 0x10068000 contains data for TMU channel 2 | ||
| 29 | |||
| 16 | - interrupts : Should contain interrupt for thermal system | 30 | - interrupts : Should contain interrupt for thermal system |
| 17 | - clocks : The main clock for TMU device | 31 | - clocks : The main clocks for TMU device |
| 32 | -- 1. operational clock for TMU channel | ||
| 33 | -- 2. optional clock to access the shared registers of TMU channel | ||
| 18 | - clock-names : Thermal system clock name | 34 | - clock-names : Thermal system clock name |
| 35 | -- "tmu_apbif" operational clock for current TMU channel | ||
| 36 | -- "tmu_triminfo_apbif" clock to access the shared triminfo register | ||
| 37 | for current TMU channel | ||
| 19 | - vtmu-supply: This entry is optional and provides the regulator node supplying | 38 | - vtmu-supply: This entry is optional and provides the regulator node supplying |
| 20 | voltage to TMU. If needed this entry can be placed inside | 39 | voltage to TMU. If needed this entry can be placed inside |
| 21 | board/platform specific dts file. | 40 | board/platform specific dts file. |
| @@ -43,6 +62,31 @@ Example 2): | |||
| 43 | clock-names = "tmu_apbif"; | 62 | clock-names = "tmu_apbif"; |
| 44 | }; | 63 | }; |
| 45 | 64 | ||
| 65 | Example 3): (In case of Exynos5420 "with misplaced TRIMINFO register") | ||
| 66 | tmu_cpu2: tmu@10068000 { | ||
| 67 | compatible = "samsung,exynos5420-tmu-ext-triminfo"; | ||
| 68 | reg = <0x10068000 0x100>, <0x1006c000 0x4>; | ||
| 69 | interrupts = <0 184 0>; | ||
| 70 | clocks = <&clock 318>, <&clock 318>; | ||
| 71 | clock-names = "tmu_apbif", "tmu_triminfo_apbif"; | ||
| 72 | }; | ||
| 73 | |||
| 74 | tmu_cpu3: tmu@1006c000 { | ||
| 75 | compatible = "samsung,exynos5420-tmu-ext-triminfo"; | ||
| 76 | reg = <0x1006c000 0x100>, <0x100a0000 0x4>; | ||
| 77 | interrupts = <0 185 0>; | ||
| 78 | clocks = <&clock 318>, <&clock 319>; | ||
| 79 | clock-names = "tmu_apbif", "tmu_triminfo_apbif"; | ||
| 80 | }; | ||
| 81 | |||
| 82 | tmu_gpu: tmu@100a0000 { | ||
| 83 | compatible = "samsung,exynos5420-tmu-ext-triminfo"; | ||
| 84 | reg = <0x100a0000 0x100>, <0x10068000 0x4>; | ||
| 85 | interrupts = <0 215 0>; | ||
| 86 | clocks = <&clock 319>, <&clock 318>; | ||
| 87 | clock-names = "tmu_apbif", "tmu_triminfo_apbif"; | ||
| 88 | }; | ||
| 89 | |||
| 46 | Note: For multi-instance tmu each instance should have an alias correctly | 90 | Note: For multi-instance tmu each instance should have an alias correctly |
| 47 | numbered in "aliases" node. | 91 | numbered in "aliases" node. |
| 48 | 92 | ||
diff --git a/drivers/thermal/Kconfig b/drivers/thermal/Kconfig index 2d51912a6e40..4eac89d0e5fc 100644 --- a/drivers/thermal/Kconfig +++ b/drivers/thermal/Kconfig | |||
| @@ -227,7 +227,7 @@ source "drivers/thermal/ti-soc-thermal/Kconfig" | |||
| 227 | endmenu | 227 | endmenu |
| 228 | 228 | ||
| 229 | menu "Samsung thermal drivers" | 229 | menu "Samsung thermal drivers" |
| 230 | depends on PLAT_SAMSUNG | 230 | depends on ARCH_EXYNOS |
| 231 | source "drivers/thermal/samsung/Kconfig" | 231 | source "drivers/thermal/samsung/Kconfig" |
| 232 | endmenu | 232 | endmenu |
| 233 | 233 | ||
diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung/exynos_tmu.c index 0d96a510389f..2412090f5982 100644 --- a/drivers/thermal/samsung/exynos_tmu.c +++ b/drivers/thermal/samsung/exynos_tmu.c | |||
| @@ -41,12 +41,13 @@ | |||
| 41 | * @id: identifier of the one instance of the TMU controller. | 41 | * @id: identifier of the one instance of the TMU controller. |
| 42 | * @pdata: pointer to the tmu platform/configuration data | 42 | * @pdata: pointer to the tmu platform/configuration data |
| 43 | * @base: base address of the single instance of the TMU controller. | 43 | * @base: base address of the single instance of the TMU controller. |
| 44 | * @base_common: base address of the common registers of the TMU controller. | 44 | * @base_second: base address of the common registers of the TMU controller. |
| 45 | * @irq: irq number of the TMU controller. | 45 | * @irq: irq number of the TMU controller. |
| 46 | * @soc: id of the SOC type. | 46 | * @soc: id of the SOC type. |
| 47 | * @irq_work: pointer to the irq work structure. | 47 | * @irq_work: pointer to the irq work structure. |
| 48 | * @lock: lock to implement synchronization. | 48 | * @lock: lock to implement synchronization. |
| 49 | * @clk: pointer to the clock structure. | 49 | * @clk: pointer to the clock structure. |
| 50 | * @clk_sec: pointer to the clock structure for accessing the base_second. | ||
| 50 | * @temp_error1: fused value of the first point trim. | 51 | * @temp_error1: fused value of the first point trim. |
| 51 | * @temp_error2: fused value of the second point trim. | 52 | * @temp_error2: fused value of the second point trim. |
| 52 | * @regulator: pointer to the TMU regulator structure. | 53 | * @regulator: pointer to the TMU regulator structure. |
| @@ -56,12 +57,12 @@ struct exynos_tmu_data { | |||
| 56 | int id; | 57 | int id; |
| 57 | struct exynos_tmu_platform_data *pdata; | 58 | struct exynos_tmu_platform_data *pdata; |
| 58 | void __iomem *base; | 59 | void __iomem *base; |
| 59 | void __iomem *base_common; | 60 | void __iomem *base_second; |
| 60 | int irq; | 61 | int irq; |
| 61 | enum soc_type soc; | 62 | enum soc_type soc; |
| 62 | struct work_struct irq_work; | 63 | struct work_struct irq_work; |
| 63 | struct mutex lock; | 64 | struct mutex lock; |
| 64 | struct clk *clk; | 65 | struct clk *clk, *clk_sec; |
| 65 | u8 temp_error1, temp_error2; | 66 | u8 temp_error1, temp_error2; |
| 66 | struct regulator *regulator; | 67 | struct regulator *regulator; |
| 67 | struct thermal_sensor_conf *reg_conf; | 68 | struct thermal_sensor_conf *reg_conf; |
| @@ -152,6 +153,8 @@ static int exynos_tmu_initialize(struct platform_device *pdev) | |||
| 152 | 153 | ||
| 153 | mutex_lock(&data->lock); | 154 | mutex_lock(&data->lock); |
| 154 | clk_enable(data->clk); | 155 | clk_enable(data->clk); |
| 156 | if (!IS_ERR(data->clk_sec)) | ||
| 157 | clk_enable(data->clk_sec); | ||
| 155 | 158 | ||
| 156 | if (TMU_SUPPORTS(pdata, READY_STATUS)) { | 159 | if (TMU_SUPPORTS(pdata, READY_STATUS)) { |
| 157 | status = readb(data->base + reg->tmu_status); | 160 | status = readb(data->base + reg->tmu_status); |
| @@ -186,7 +189,12 @@ static int exynos_tmu_initialize(struct platform_device *pdev) | |||
| 186 | EXYNOS5440_EFUSE_SWAP_OFFSET + reg->triminfo_data); | 189 | EXYNOS5440_EFUSE_SWAP_OFFSET + reg->triminfo_data); |
| 187 | } | 190 | } |
| 188 | } else { | 191 | } else { |
| 189 | trim_info = readl(data->base + reg->triminfo_data); | 192 | /* On exynos5420 the triminfo register is in the shared space */ |
| 193 | if (data->soc == SOC_ARCH_EXYNOS5420_TRIMINFO) | ||
| 194 | trim_info = readl(data->base_second + | ||
| 195 | reg->triminfo_data); | ||
| 196 | else | ||
| 197 | trim_info = readl(data->base + reg->triminfo_data); | ||
| 190 | } | 198 | } |
| 191 | data->temp_error1 = trim_info & EXYNOS_TMU_TEMP_MASK; | 199 | data->temp_error1 = trim_info & EXYNOS_TMU_TEMP_MASK; |
| 192 | data->temp_error2 = ((trim_info >> reg->triminfo_85_shift) & | 200 | data->temp_error2 = ((trim_info >> reg->triminfo_85_shift) & |
| @@ -238,7 +246,7 @@ skip_calib_data: | |||
| 238 | writeb(pdata->trigger_levels[i], data->base + | 246 | writeb(pdata->trigger_levels[i], data->base + |
| 239 | reg->threshold_th0 + i * sizeof(reg->threshold_th0)); | 247 | reg->threshold_th0 + i * sizeof(reg->threshold_th0)); |
| 240 | 248 | ||
| 241 | writel(reg->inten_rise_mask, data->base + reg->tmu_intclear); | 249 | writel(reg->intclr_rise_mask, data->base + reg->tmu_intclear); |
| 242 | } else { | 250 | } else { |
| 243 | /* Write temperature code for rising and falling threshold */ | 251 | /* Write temperature code for rising and falling threshold */ |
| 244 | for (i = 0; | 252 | for (i = 0; |
| @@ -265,8 +273,8 @@ skip_calib_data: | |||
| 265 | writel(falling_threshold, | 273 | writel(falling_threshold, |
| 266 | data->base + reg->threshold_th1); | 274 | data->base + reg->threshold_th1); |
| 267 | 275 | ||
| 268 | writel((reg->inten_rise_mask << reg->inten_rise_shift) | | 276 | writel((reg->intclr_rise_mask << reg->intclr_rise_shift) | |
| 269 | (reg->inten_fall_mask << reg->inten_fall_shift), | 277 | (reg->intclr_fall_mask << reg->intclr_fall_shift), |
| 270 | data->base + reg->tmu_intclear); | 278 | data->base + reg->tmu_intclear); |
| 271 | 279 | ||
| 272 | /* if last threshold limit is also present */ | 280 | /* if last threshold limit is also present */ |
| @@ -298,10 +306,12 @@ skip_calib_data: | |||
| 298 | } | 306 | } |
| 299 | /*Clear the PMIN in the common TMU register*/ | 307 | /*Clear the PMIN in the common TMU register*/ |
| 300 | if (reg->tmu_pmin && !data->id) | 308 | if (reg->tmu_pmin && !data->id) |
| 301 | writel(0, data->base_common + reg->tmu_pmin); | 309 | writel(0, data->base_second + reg->tmu_pmin); |
| 302 | out: | 310 | out: |
| 303 | clk_disable(data->clk); | 311 | clk_disable(data->clk); |
| 304 | mutex_unlock(&data->lock); | 312 | mutex_unlock(&data->lock); |
| 313 | if (!IS_ERR(data->clk_sec)) | ||
| 314 | clk_disable(data->clk_sec); | ||
| 305 | 315 | ||
| 306 | return ret; | 316 | return ret; |
| 307 | } | 317 | } |
| @@ -453,12 +463,16 @@ static void exynos_tmu_work(struct work_struct *work) | |||
| 453 | const struct exynos_tmu_registers *reg = pdata->registers; | 463 | const struct exynos_tmu_registers *reg = pdata->registers; |
| 454 | unsigned int val_irq, val_type; | 464 | unsigned int val_irq, val_type; |
| 455 | 465 | ||
| 466 | if (!IS_ERR(data->clk_sec)) | ||
| 467 | clk_enable(data->clk_sec); | ||
| 456 | /* Find which sensor generated this interrupt */ | 468 | /* Find which sensor generated this interrupt */ |
| 457 | if (reg->tmu_irqstatus) { | 469 | if (reg->tmu_irqstatus) { |
| 458 | val_type = readl(data->base_common + reg->tmu_irqstatus); | 470 | val_type = readl(data->base_second + reg->tmu_irqstatus); |
| 459 | if (!((val_type >> data->id) & 0x1)) | 471 | if (!((val_type >> data->id) & 0x1)) |
| 460 | goto out; | 472 | goto out; |
| 461 | } | 473 | } |
| 474 | if (!IS_ERR(data->clk_sec)) | ||
| 475 | clk_disable(data->clk_sec); | ||
| 462 | 476 | ||
| 463 | exynos_report_trigger(data->reg_conf); | 477 | exynos_report_trigger(data->reg_conf); |
| 464 | mutex_lock(&data->lock); | 478 | mutex_lock(&data->lock); |
| @@ -499,6 +513,18 @@ static const struct of_device_id exynos_tmu_match[] = { | |||
| 499 | .data = (void *)EXYNOS5250_TMU_DRV_DATA, | 513 | .data = (void *)EXYNOS5250_TMU_DRV_DATA, |
| 500 | }, | 514 | }, |
| 501 | { | 515 | { |
| 516 | .compatible = "samsung,exynos5260-tmu", | ||
| 517 | .data = (void *)EXYNOS5260_TMU_DRV_DATA, | ||
| 518 | }, | ||
| 519 | { | ||
| 520 | .compatible = "samsung,exynos5420-tmu", | ||
| 521 | .data = (void *)EXYNOS5420_TMU_DRV_DATA, | ||
| 522 | }, | ||
| 523 | { | ||
| 524 | .compatible = "samsung,exynos5420-tmu-ext-triminfo", | ||
| 525 | .data = (void *)EXYNOS5420_TMU_DRV_DATA, | ||
| 526 | }, | ||
| 527 | { | ||
| 502 | .compatible = "samsung,exynos5440-tmu", | 528 | .compatible = "samsung,exynos5440-tmu", |
| 503 | .data = (void *)EXYNOS5440_TMU_DRV_DATA, | 529 | .data = (void *)EXYNOS5440_TMU_DRV_DATA, |
| 504 | }, | 530 | }, |
| @@ -580,7 +606,7 @@ static int exynos_map_dt_data(struct platform_device *pdev) | |||
| 580 | * Check if the TMU shares some registers and then try to map the | 606 | * Check if the TMU shares some registers and then try to map the |
| 581 | * memory of common registers. | 607 | * memory of common registers. |
| 582 | */ | 608 | */ |
| 583 | if (!TMU_SUPPORTS(pdata, SHARED_MEMORY)) | 609 | if (!TMU_SUPPORTS(pdata, ADDRESS_MULTIPLE)) |
| 584 | return 0; | 610 | return 0; |
| 585 | 611 | ||
| 586 | if (of_address_to_resource(pdev->dev.of_node, 1, &res)) { | 612 | if (of_address_to_resource(pdev->dev.of_node, 1, &res)) { |
| @@ -588,9 +614,9 @@ static int exynos_map_dt_data(struct platform_device *pdev) | |||
| 588 | return -ENODEV; | 614 | return -ENODEV; |
| 589 | } | 615 | } |
| 590 | 616 | ||
| 591 | data->base_common = devm_ioremap(&pdev->dev, res.start, | 617 | data->base_second = devm_ioremap(&pdev->dev, res.start, |
| 592 | resource_size(&res)); | 618 | resource_size(&res)); |
| 593 | if (!data->base_common) { | 619 | if (!data->base_second) { |
| 594 | dev_err(&pdev->dev, "Failed to ioremap memory\n"); | 620 | dev_err(&pdev->dev, "Failed to ioremap memory\n"); |
| 595 | return -ENOMEM; | 621 | return -ENOMEM; |
| 596 | } | 622 | } |
| @@ -629,13 +655,31 @@ static int exynos_tmu_probe(struct platform_device *pdev) | |||
| 629 | return PTR_ERR(data->clk); | 655 | return PTR_ERR(data->clk); |
| 630 | } | 656 | } |
| 631 | 657 | ||
| 658 | data->clk_sec = devm_clk_get(&pdev->dev, "tmu_triminfo_apbif"); | ||
| 659 | if (IS_ERR(data->clk_sec)) { | ||
| 660 | if (data->soc == SOC_ARCH_EXYNOS5420_TRIMINFO) { | ||
| 661 | dev_err(&pdev->dev, "Failed to get triminfo clock\n"); | ||
| 662 | return PTR_ERR(data->clk_sec); | ||
| 663 | } | ||
| 664 | } else { | ||
| 665 | ret = clk_prepare(data->clk_sec); | ||
| 666 | if (ret) { | ||
| 667 | dev_err(&pdev->dev, "Failed to get clock\n"); | ||
| 668 | return ret; | ||
| 669 | } | ||
| 670 | } | ||
| 671 | |||
| 632 | ret = clk_prepare(data->clk); | 672 | ret = clk_prepare(data->clk); |
| 633 | if (ret) | 673 | if (ret) { |
| 634 | return ret; | 674 | dev_err(&pdev->dev, "Failed to get clock\n"); |
| 675 | goto err_clk_sec; | ||
| 676 | } | ||
| 635 | 677 | ||
| 636 | if (pdata->type == SOC_ARCH_EXYNOS4210 || | 678 | if (pdata->type == SOC_ARCH_EXYNOS4210 || |
| 637 | pdata->type == SOC_ARCH_EXYNOS4412 || | 679 | pdata->type == SOC_ARCH_EXYNOS4412 || |
| 638 | pdata->type == SOC_ARCH_EXYNOS5250 || | 680 | pdata->type == SOC_ARCH_EXYNOS5250 || |
| 681 | pdata->type == SOC_ARCH_EXYNOS5260 || | ||
| 682 | pdata->type == SOC_ARCH_EXYNOS5420_TRIMINFO || | ||
| 639 | pdata->type == SOC_ARCH_EXYNOS5440) | 683 | pdata->type == SOC_ARCH_EXYNOS5440) |
| 640 | data->soc = pdata->type; | 684 | data->soc = pdata->type; |
| 641 | else { | 685 | else { |
| @@ -704,6 +748,9 @@ static int exynos_tmu_probe(struct platform_device *pdev) | |||
| 704 | return 0; | 748 | return 0; |
| 705 | err_clk: | 749 | err_clk: |
| 706 | clk_unprepare(data->clk); | 750 | clk_unprepare(data->clk); |
| 751 | err_clk_sec: | ||
| 752 | if (!IS_ERR(data->clk_sec)) | ||
| 753 | clk_unprepare(data->clk_sec); | ||
| 707 | return ret; | 754 | return ret; |
| 708 | } | 755 | } |
| 709 | 756 | ||
| @@ -716,6 +763,8 @@ static int exynos_tmu_remove(struct platform_device *pdev) | |||
| 716 | exynos_unregister_thermal(data->reg_conf); | 763 | exynos_unregister_thermal(data->reg_conf); |
| 717 | 764 | ||
| 718 | clk_unprepare(data->clk); | 765 | clk_unprepare(data->clk); |
| 766 | if (!IS_ERR(data->clk_sec)) | ||
| 767 | clk_unprepare(data->clk_sec); | ||
| 719 | 768 | ||
| 720 | if (!IS_ERR(data->regulator)) | 769 | if (!IS_ERR(data->regulator)) |
| 721 | regulator_disable(data->regulator); | 770 | regulator_disable(data->regulator); |
diff --git a/drivers/thermal/samsung/exynos_tmu.h b/drivers/thermal/samsung/exynos_tmu.h index 3fb65547e64c..edd08cf76729 100644 --- a/drivers/thermal/samsung/exynos_tmu.h +++ b/drivers/thermal/samsung/exynos_tmu.h | |||
| @@ -43,6 +43,8 @@ enum soc_type { | |||
| 43 | SOC_ARCH_EXYNOS4210 = 1, | 43 | SOC_ARCH_EXYNOS4210 = 1, |
| 44 | SOC_ARCH_EXYNOS4412, | 44 | SOC_ARCH_EXYNOS4412, |
| 45 | SOC_ARCH_EXYNOS5250, | 45 | SOC_ARCH_EXYNOS5250, |
| 46 | SOC_ARCH_EXYNOS5260, | ||
| 47 | SOC_ARCH_EXYNOS5420_TRIMINFO, | ||
| 46 | SOC_ARCH_EXYNOS5440, | 48 | SOC_ARCH_EXYNOS5440, |
| 47 | }; | 49 | }; |
| 48 | 50 | ||
| @@ -60,7 +62,7 @@ enum soc_type { | |||
| 60 | * state(active/idle) can be checked. | 62 | * state(active/idle) can be checked. |
| 61 | * TMU_SUPPORT_EMUL_TIME - This features allows to set next temp emulation | 63 | * TMU_SUPPORT_EMUL_TIME - This features allows to set next temp emulation |
| 62 | * sample time. | 64 | * sample time. |
| 63 | * TMU_SUPPORT_SHARED_MEMORY - This feature tells that the different TMU | 65 | * TMU_SUPPORT_ADDRESS_MULTIPLE - This feature tells that the different TMU |
| 64 | * sensors shares some common registers. | 66 | * sensors shares some common registers. |
| 65 | * TMU_SUPPORT - macro to compare the above features with the supplied. | 67 | * TMU_SUPPORT - macro to compare the above features with the supplied. |
| 66 | */ | 68 | */ |
| @@ -70,7 +72,7 @@ enum soc_type { | |||
| 70 | #define TMU_SUPPORT_FALLING_TRIP BIT(3) | 72 | #define TMU_SUPPORT_FALLING_TRIP BIT(3) |
| 71 | #define TMU_SUPPORT_READY_STATUS BIT(4) | 73 | #define TMU_SUPPORT_READY_STATUS BIT(4) |
| 72 | #define TMU_SUPPORT_EMUL_TIME BIT(5) | 74 | #define TMU_SUPPORT_EMUL_TIME BIT(5) |
| 73 | #define TMU_SUPPORT_SHARED_MEMORY BIT(6) | 75 | #define TMU_SUPPORT_ADDRESS_MULTIPLE BIT(6) |
| 74 | 76 | ||
| 75 | #define TMU_SUPPORTS(a, b) (a->features & TMU_SUPPORT_ ## b) | 77 | #define TMU_SUPPORTS(a, b) (a->features & TMU_SUPPORT_ ## b) |
| 76 | 78 | ||
| @@ -122,10 +124,6 @@ enum soc_type { | |||
| 122 | * @threshold_th3_l0_shift: shift bits of level0 threshold temperature. | 124 | * @threshold_th3_l0_shift: shift bits of level0 threshold temperature. |
| 123 | * @tmu_inten: register containing the different threshold interrupt | 125 | * @tmu_inten: register containing the different threshold interrupt |
| 124 | enable bits. | 126 | enable bits. |
| 125 | * @inten_rise_shift: shift bits of all rising interrupt bits. | ||
| 126 | * @inten_rise_mask: mask bits of all rising interrupt bits. | ||
| 127 | * @inten_fall_shift: shift bits of all rising interrupt bits. | ||
| 128 | * @inten_fall_mask: mask bits of all rising interrupt bits. | ||
| 129 | * @inten_rise0_shift: shift bits of rising 0 interrupt bits. | 127 | * @inten_rise0_shift: shift bits of rising 0 interrupt bits. |
| 130 | * @inten_rise1_shift: shift bits of rising 1 interrupt bits. | 128 | * @inten_rise1_shift: shift bits of rising 1 interrupt bits. |
| 131 | * @inten_rise2_shift: shift bits of rising 2 interrupt bits. | 129 | * @inten_rise2_shift: shift bits of rising 2 interrupt bits. |
| @@ -136,6 +134,10 @@ enum soc_type { | |||
| 136 | * @inten_fall3_shift: shift bits of falling 3 interrupt bits. | 134 | * @inten_fall3_shift: shift bits of falling 3 interrupt bits. |
| 137 | * @tmu_intstat: Register containing the interrupt status values. | 135 | * @tmu_intstat: Register containing the interrupt status values. |
| 138 | * @tmu_intclear: Register for clearing the raised interrupt status. | 136 | * @tmu_intclear: Register for clearing the raised interrupt status. |
| 137 | * @intclr_fall_shift: shift bits for interrupt clear fall 0 | ||
| 138 | * @intclr_rise_shift: shift bits of all rising interrupt bits. | ||
| 139 | * @intclr_rise_mask: mask bits of all rising interrupt bits. | ||
| 140 | * @intclr_fall_mask: mask bits of all rising interrupt bits. | ||
| 139 | * @emul_con: TMU emulation controller register. | 141 | * @emul_con: TMU emulation controller register. |
| 140 | * @emul_temp_shift: shift bits of emulation temperature. | 142 | * @emul_temp_shift: shift bits of emulation temperature. |
| 141 | * @emul_time_shift: shift bits of emulation time. | 143 | * @emul_time_shift: shift bits of emulation time. |
| @@ -149,6 +151,7 @@ struct exynos_tmu_registers { | |||
| 149 | u32 triminfo_85_shift; | 151 | u32 triminfo_85_shift; |
| 150 | 152 | ||
| 151 | u32 triminfo_ctrl; | 153 | u32 triminfo_ctrl; |
| 154 | u32 triminfo_ctrl1; | ||
| 152 | u32 triminfo_reload_shift; | 155 | u32 triminfo_reload_shift; |
| 153 | 156 | ||
| 154 | u32 tmu_ctrl; | 157 | u32 tmu_ctrl; |
| @@ -191,10 +194,6 @@ struct exynos_tmu_registers { | |||
| 191 | u32 threshold_th3_l0_shift; | 194 | u32 threshold_th3_l0_shift; |
| 192 | 195 | ||
| 193 | u32 tmu_inten; | 196 | u32 tmu_inten; |
| 194 | u32 inten_rise_shift; | ||
| 195 | u32 inten_rise_mask; | ||
| 196 | u32 inten_fall_shift; | ||
| 197 | u32 inten_fall_mask; | ||
| 198 | u32 inten_rise0_shift; | 197 | u32 inten_rise0_shift; |
| 199 | u32 inten_rise1_shift; | 198 | u32 inten_rise1_shift; |
| 200 | u32 inten_rise2_shift; | 199 | u32 inten_rise2_shift; |
| @@ -207,6 +206,10 @@ struct exynos_tmu_registers { | |||
| 207 | u32 tmu_intstat; | 206 | u32 tmu_intstat; |
| 208 | 207 | ||
| 209 | u32 tmu_intclear; | 208 | u32 tmu_intclear; |
| 209 | u32 intclr_fall_shift; | ||
| 210 | u32 intclr_rise_shift; | ||
| 211 | u32 intclr_fall_mask; | ||
| 212 | u32 intclr_rise_mask; | ||
| 210 | 213 | ||
| 211 | u32 emul_con; | 214 | u32 emul_con; |
| 212 | u32 emul_temp_shift; | 215 | u32 emul_temp_shift; |
diff --git a/drivers/thermal/samsung/exynos_tmu_data.c b/drivers/thermal/samsung/exynos_tmu_data.c index 476b768c633e..c1d81dcd7819 100644 --- a/drivers/thermal/samsung/exynos_tmu_data.c +++ b/drivers/thermal/samsung/exynos_tmu_data.c | |||
| @@ -40,13 +40,13 @@ static const struct exynos_tmu_registers exynos4210_tmu_registers = { | |||
| 40 | .threshold_temp = EXYNOS4210_TMU_REG_THRESHOLD_TEMP, | 40 | .threshold_temp = EXYNOS4210_TMU_REG_THRESHOLD_TEMP, |
| 41 | .threshold_th0 = EXYNOS4210_TMU_REG_TRIG_LEVEL0, | 41 | .threshold_th0 = EXYNOS4210_TMU_REG_TRIG_LEVEL0, |
| 42 | .tmu_inten = EXYNOS_TMU_REG_INTEN, | 42 | .tmu_inten = EXYNOS_TMU_REG_INTEN, |
| 43 | .inten_rise_mask = EXYNOS4210_TMU_TRIG_LEVEL_MASK, | ||
| 44 | .inten_rise0_shift = EXYNOS_TMU_INTEN_RISE0_SHIFT, | 43 | .inten_rise0_shift = EXYNOS_TMU_INTEN_RISE0_SHIFT, |
| 45 | .inten_rise1_shift = EXYNOS_TMU_INTEN_RISE1_SHIFT, | 44 | .inten_rise1_shift = EXYNOS_TMU_INTEN_RISE1_SHIFT, |
| 46 | .inten_rise2_shift = EXYNOS_TMU_INTEN_RISE2_SHIFT, | 45 | .inten_rise2_shift = EXYNOS_TMU_INTEN_RISE2_SHIFT, |
| 47 | .inten_rise3_shift = EXYNOS_TMU_INTEN_RISE3_SHIFT, | 46 | .inten_rise3_shift = EXYNOS_TMU_INTEN_RISE3_SHIFT, |
| 48 | .tmu_intstat = EXYNOS_TMU_REG_INTSTAT, | 47 | .tmu_intstat = EXYNOS_TMU_REG_INTSTAT, |
| 49 | .tmu_intclear = EXYNOS_TMU_REG_INTCLEAR, | 48 | .tmu_intclear = EXYNOS_TMU_REG_INTCLEAR, |
| 49 | .intclr_rise_mask = EXYNOS4210_TMU_TRIG_LEVEL_MASK, | ||
| 50 | }; | 50 | }; |
| 51 | 51 | ||
| 52 | struct exynos_tmu_init_data const exynos4210_default_tmu_data = { | 52 | struct exynos_tmu_init_data const exynos4210_default_tmu_data = { |
| @@ -112,10 +112,6 @@ static const struct exynos_tmu_registers exynos4412_tmu_registers = { | |||
| 112 | .threshold_th0 = EXYNOS_THD_TEMP_RISE, | 112 | .threshold_th0 = EXYNOS_THD_TEMP_RISE, |
| 113 | .threshold_th1 = EXYNOS_THD_TEMP_FALL, | 113 | .threshold_th1 = EXYNOS_THD_TEMP_FALL, |
| 114 | .tmu_inten = EXYNOS_TMU_REG_INTEN, | 114 | .tmu_inten = EXYNOS_TMU_REG_INTEN, |
| 115 | .inten_rise_mask = EXYNOS_TMU_RISE_INT_MASK, | ||
| 116 | .inten_rise_shift = EXYNOS_TMU_RISE_INT_SHIFT, | ||
| 117 | .inten_fall_mask = EXYNOS_TMU_FALL_INT_MASK, | ||
| 118 | .inten_fall_shift = EXYNOS_TMU_FALL_INT_SHIFT, | ||
| 119 | .inten_rise0_shift = EXYNOS_TMU_INTEN_RISE0_SHIFT, | 115 | .inten_rise0_shift = EXYNOS_TMU_INTEN_RISE0_SHIFT, |
| 120 | .inten_rise1_shift = EXYNOS_TMU_INTEN_RISE1_SHIFT, | 116 | .inten_rise1_shift = EXYNOS_TMU_INTEN_RISE1_SHIFT, |
| 121 | .inten_rise2_shift = EXYNOS_TMU_INTEN_RISE2_SHIFT, | 117 | .inten_rise2_shift = EXYNOS_TMU_INTEN_RISE2_SHIFT, |
| @@ -123,6 +119,10 @@ static const struct exynos_tmu_registers exynos4412_tmu_registers = { | |||
| 123 | .inten_fall0_shift = EXYNOS_TMU_INTEN_FALL0_SHIFT, | 119 | .inten_fall0_shift = EXYNOS_TMU_INTEN_FALL0_SHIFT, |
| 124 | .tmu_intstat = EXYNOS_TMU_REG_INTSTAT, | 120 | .tmu_intstat = EXYNOS_TMU_REG_INTSTAT, |
| 125 | .tmu_intclear = EXYNOS_TMU_REG_INTCLEAR, | 121 | .tmu_intclear = EXYNOS_TMU_REG_INTCLEAR, |
| 122 | .intclr_fall_shift = EXYNOS_TMU_CLEAR_FALL_INT_SHIFT, | ||
| 123 | .intclr_rise_shift = EXYNOS_TMU_RISE_INT_SHIFT, | ||
| 124 | .intclr_rise_mask = EXYNOS_TMU_RISE_INT_MASK, | ||
| 125 | .intclr_fall_mask = EXYNOS_TMU_FALL_INT_MASK, | ||
| 126 | .emul_con = EXYNOS_EMUL_CON, | 126 | .emul_con = EXYNOS_EMUL_CON, |
| 127 | .emul_temp_shift = EXYNOS_EMUL_DATA_SHIFT, | 127 | .emul_temp_shift = EXYNOS_EMUL_DATA_SHIFT, |
| 128 | .emul_time_shift = EXYNOS_EMUL_TIME_SHIFT, | 128 | .emul_time_shift = EXYNOS_EMUL_TIME_SHIFT, |
| @@ -194,6 +194,197 @@ struct exynos_tmu_init_data const exynos5250_default_tmu_data = { | |||
| 194 | }; | 194 | }; |
| 195 | #endif | 195 | #endif |
| 196 | 196 | ||
| 197 | #if defined(CONFIG_SOC_EXYNOS5260) | ||
| 198 | static const struct exynos_tmu_registers exynos5260_tmu_registers = { | ||
| 199 | .triminfo_data = EXYNOS_TMU_REG_TRIMINFO, | ||
| 200 | .triminfo_25_shift = EXYNOS_TRIMINFO_25_SHIFT, | ||
| 201 | .triminfo_85_shift = EXYNOS_TRIMINFO_85_SHIFT, | ||
| 202 | .tmu_ctrl = EXYNOS_TMU_REG_CONTROL, | ||
| 203 | .tmu_ctrl = EXYNOS_TMU_REG_CONTROL1, | ||
| 204 | .buf_vref_sel_shift = EXYNOS_TMU_REF_VOLTAGE_SHIFT, | ||
| 205 | .buf_vref_sel_mask = EXYNOS_TMU_REF_VOLTAGE_MASK, | ||
| 206 | .therm_trip_mode_shift = EXYNOS_TMU_TRIP_MODE_SHIFT, | ||
| 207 | .therm_trip_mode_mask = EXYNOS_TMU_TRIP_MODE_MASK, | ||
| 208 | .therm_trip_en_shift = EXYNOS_TMU_THERM_TRIP_EN_SHIFT, | ||
| 209 | .buf_slope_sel_shift = EXYNOS_TMU_BUF_SLOPE_SEL_SHIFT, | ||
| 210 | .buf_slope_sel_mask = EXYNOS_TMU_BUF_SLOPE_SEL_MASK, | ||
| 211 | .core_en_shift = EXYNOS_TMU_CORE_EN_SHIFT, | ||
| 212 | .tmu_status = EXYNOS_TMU_REG_STATUS, | ||
| 213 | .tmu_cur_temp = EXYNOS_TMU_REG_CURRENT_TEMP, | ||
| 214 | .threshold_th0 = EXYNOS_THD_TEMP_RISE, | ||
| 215 | .threshold_th1 = EXYNOS_THD_TEMP_FALL, | ||
| 216 | .tmu_inten = EXYNOS5260_TMU_REG_INTEN, | ||
| 217 | .inten_rise0_shift = EXYNOS_TMU_INTEN_RISE0_SHIFT, | ||
| 218 | .inten_rise1_shift = EXYNOS_TMU_INTEN_RISE1_SHIFT, | ||
| 219 | .inten_rise2_shift = EXYNOS_TMU_INTEN_RISE2_SHIFT, | ||
| 220 | .inten_rise3_shift = EXYNOS_TMU_INTEN_RISE3_SHIFT, | ||
| 221 | .inten_fall0_shift = EXYNOS_TMU_INTEN_FALL0_SHIFT, | ||
| 222 | .tmu_intstat = EXYNOS5260_TMU_REG_INTSTAT, | ||
| 223 | .tmu_intclear = EXYNOS5260_TMU_REG_INTCLEAR, | ||
| 224 | .intclr_fall_shift = EXYNOS5420_TMU_CLEAR_FALL_INT_SHIFT, | ||
| 225 | .intclr_rise_shift = EXYNOS_TMU_RISE_INT_SHIFT, | ||
| 226 | .intclr_rise_mask = EXYNOS5260_TMU_RISE_INT_MASK, | ||
| 227 | .intclr_fall_mask = EXYNOS5260_TMU_FALL_INT_MASK, | ||
| 228 | .emul_con = EXYNOS5260_EMUL_CON, | ||
| 229 | .emul_temp_shift = EXYNOS_EMUL_DATA_SHIFT, | ||
| 230 | .emul_time_shift = EXYNOS_EMUL_TIME_SHIFT, | ||
| 231 | .emul_time_mask = EXYNOS_EMUL_TIME_MASK, | ||
| 232 | }; | ||
| 233 | |||
| 234 | #define __EXYNOS5260_TMU_DATA \ | ||
| 235 | .threshold_falling = 10, \ | ||
| 236 | .trigger_levels[0] = 85, \ | ||
| 237 | .trigger_levels[1] = 103, \ | ||
| 238 | .trigger_levels[2] = 110, \ | ||
| 239 | .trigger_levels[3] = 120, \ | ||
| 240 | .trigger_enable[0] = true, \ | ||
| 241 | .trigger_enable[1] = true, \ | ||
| 242 | .trigger_enable[2] = true, \ | ||
| 243 | .trigger_enable[3] = false, \ | ||
| 244 | .trigger_type[0] = THROTTLE_ACTIVE, \ | ||
| 245 | .trigger_type[1] = THROTTLE_ACTIVE, \ | ||
| 246 | .trigger_type[2] = SW_TRIP, \ | ||
| 247 | .trigger_type[3] = HW_TRIP, \ | ||
| 248 | .max_trigger_level = 4, \ | ||
| 249 | .gain = 8, \ | ||
| 250 | .reference_voltage = 16, \ | ||
| 251 | .noise_cancel_mode = 4, \ | ||
| 252 | .cal_type = TYPE_ONE_POINT_TRIMMING, \ | ||
| 253 | .efuse_value = 55, \ | ||
| 254 | .min_efuse_value = 40, \ | ||
| 255 | .max_efuse_value = 100, \ | ||
| 256 | .first_point_trim = 25, \ | ||
| 257 | .second_point_trim = 85, \ | ||
| 258 | .default_temp_offset = 50, \ | ||
| 259 | .freq_tab[0] = { \ | ||
| 260 | .freq_clip_max = 800 * 1000, \ | ||
| 261 | .temp_level = 85, \ | ||
| 262 | }, \ | ||
| 263 | .freq_tab[1] = { \ | ||
| 264 | .freq_clip_max = 200 * 1000, \ | ||
| 265 | .temp_level = 103, \ | ||
| 266 | }, \ | ||
| 267 | .freq_tab_count = 2, \ | ||
| 268 | .registers = &exynos5260_tmu_registers, \ | ||
| 269 | |||
| 270 | #define EXYNOS5260_TMU_DATA \ | ||
| 271 | __EXYNOS5260_TMU_DATA \ | ||
| 272 | .type = SOC_ARCH_EXYNOS5260, \ | ||
| 273 | .features = (TMU_SUPPORT_EMULATION | TMU_SUPPORT_TRIM_RELOAD | \ | ||
| 274 | TMU_SUPPORT_FALLING_TRIP | TMU_SUPPORT_READY_STATUS | \ | ||
| 275 | TMU_SUPPORT_EMUL_TIME) | ||
| 276 | |||
| 277 | struct exynos_tmu_init_data const exynos5260_default_tmu_data = { | ||
| 278 | .tmu_data = { | ||
| 279 | { EXYNOS5260_TMU_DATA }, | ||
| 280 | { EXYNOS5260_TMU_DATA }, | ||
| 281 | { EXYNOS5260_TMU_DATA }, | ||
| 282 | { EXYNOS5260_TMU_DATA }, | ||
| 283 | { EXYNOS5260_TMU_DATA }, | ||
| 284 | }, | ||
| 285 | .tmu_count = 5, | ||
| 286 | }; | ||
| 287 | #endif | ||
| 288 | |||
| 289 | #if defined(CONFIG_SOC_EXYNOS5420) | ||
| 290 | static const struct exynos_tmu_registers exynos5420_tmu_registers = { | ||
| 291 | .triminfo_data = EXYNOS_TMU_REG_TRIMINFO, | ||
| 292 | .triminfo_25_shift = EXYNOS_TRIMINFO_25_SHIFT, | ||
| 293 | .triminfo_85_shift = EXYNOS_TRIMINFO_85_SHIFT, | ||
| 294 | .tmu_ctrl = EXYNOS_TMU_REG_CONTROL, | ||
| 295 | .buf_vref_sel_shift = EXYNOS_TMU_REF_VOLTAGE_SHIFT, | ||
| 296 | .buf_vref_sel_mask = EXYNOS_TMU_REF_VOLTAGE_MASK, | ||
| 297 | .therm_trip_mode_shift = EXYNOS_TMU_TRIP_MODE_SHIFT, | ||
| 298 | .therm_trip_mode_mask = EXYNOS_TMU_TRIP_MODE_MASK, | ||
| 299 | .therm_trip_en_shift = EXYNOS_TMU_THERM_TRIP_EN_SHIFT, | ||
| 300 | .buf_slope_sel_shift = EXYNOS_TMU_BUF_SLOPE_SEL_SHIFT, | ||
| 301 | .buf_slope_sel_mask = EXYNOS_TMU_BUF_SLOPE_SEL_MASK, | ||
| 302 | .core_en_shift = EXYNOS_TMU_CORE_EN_SHIFT, | ||
| 303 | .tmu_status = EXYNOS_TMU_REG_STATUS, | ||
| 304 | .tmu_cur_temp = EXYNOS_TMU_REG_CURRENT_TEMP, | ||
| 305 | .threshold_th0 = EXYNOS_THD_TEMP_RISE, | ||
| 306 | .threshold_th1 = EXYNOS_THD_TEMP_FALL, | ||
| 307 | .tmu_inten = EXYNOS_TMU_REG_INTEN, | ||
| 308 | .inten_rise0_shift = EXYNOS_TMU_INTEN_RISE0_SHIFT, | ||
| 309 | .inten_rise1_shift = EXYNOS_TMU_INTEN_RISE1_SHIFT, | ||
| 310 | .inten_rise2_shift = EXYNOS_TMU_INTEN_RISE2_SHIFT, | ||
| 311 | /* INTEN_RISE3 Not availble in exynos5420 */ | ||
| 312 | .inten_rise3_shift = EXYNOS_TMU_INTEN_RISE3_SHIFT, | ||
| 313 | .inten_fall0_shift = EXYNOS_TMU_INTEN_FALL0_SHIFT, | ||
| 314 | .tmu_intstat = EXYNOS_TMU_REG_INTSTAT, | ||
| 315 | .tmu_intclear = EXYNOS_TMU_REG_INTCLEAR, | ||
| 316 | .intclr_fall_shift = EXYNOS5420_TMU_CLEAR_FALL_INT_SHIFT, | ||
| 317 | .intclr_rise_shift = EXYNOS_TMU_RISE_INT_SHIFT, | ||
| 318 | .intclr_rise_mask = EXYNOS_TMU_RISE_INT_MASK, | ||
| 319 | .intclr_fall_mask = EXYNOS_TMU_FALL_INT_MASK, | ||
| 320 | .emul_con = EXYNOS_EMUL_CON, | ||
| 321 | .emul_temp_shift = EXYNOS_EMUL_DATA_SHIFT, | ||
| 322 | .emul_time_shift = EXYNOS_EMUL_TIME_SHIFT, | ||
| 323 | .emul_time_mask = EXYNOS_EMUL_TIME_MASK, | ||
| 324 | }; | ||
| 325 | |||
| 326 | #define __EXYNOS5420_TMU_DATA \ | ||
| 327 | .threshold_falling = 10, \ | ||
| 328 | .trigger_levels[0] = 85, \ | ||
| 329 | .trigger_levels[1] = 103, \ | ||
| 330 | .trigger_levels[2] = 110, \ | ||
| 331 | .trigger_levels[3] = 120, \ | ||
| 332 | .trigger_enable[0] = true, \ | ||
| 333 | .trigger_enable[1] = true, \ | ||
| 334 | .trigger_enable[2] = true, \ | ||
| 335 | .trigger_enable[3] = false, \ | ||
| 336 | .trigger_type[0] = THROTTLE_ACTIVE, \ | ||
| 337 | .trigger_type[1] = THROTTLE_ACTIVE, \ | ||
| 338 | .trigger_type[2] = SW_TRIP, \ | ||
| 339 | .trigger_type[3] = HW_TRIP, \ | ||
| 340 | .max_trigger_level = 4, \ | ||
| 341 | .gain = 8, \ | ||
| 342 | .reference_voltage = 16, \ | ||
| 343 | .noise_cancel_mode = 4, \ | ||
| 344 | .cal_type = TYPE_ONE_POINT_TRIMMING, \ | ||
| 345 | .efuse_value = 55, \ | ||
| 346 | .min_efuse_value = 40, \ | ||
| 347 | .max_efuse_value = 100, \ | ||
| 348 | .first_point_trim = 25, \ | ||
| 349 | .second_point_trim = 85, \ | ||
| 350 | .default_temp_offset = 50, \ | ||
| 351 | .freq_tab[0] = { \ | ||
| 352 | .freq_clip_max = 800 * 1000, \ | ||
| 353 | .temp_level = 85, \ | ||
| 354 | }, \ | ||
| 355 | .freq_tab[1] = { \ | ||
| 356 | .freq_clip_max = 200 * 1000, \ | ||
| 357 | .temp_level = 103, \ | ||
| 358 | }, \ | ||
| 359 | .freq_tab_count = 2, \ | ||
| 360 | .registers = &exynos5420_tmu_registers, \ | ||
| 361 | |||
| 362 | #define EXYNOS5420_TMU_DATA \ | ||
| 363 | __EXYNOS5420_TMU_DATA \ | ||
| 364 | .type = SOC_ARCH_EXYNOS5250, \ | ||
| 365 | .features = (TMU_SUPPORT_EMULATION | TMU_SUPPORT_TRIM_RELOAD | \ | ||
| 366 | TMU_SUPPORT_FALLING_TRIP | TMU_SUPPORT_READY_STATUS | \ | ||
| 367 | TMU_SUPPORT_EMUL_TIME) | ||
| 368 | |||
| 369 | #define EXYNOS5420_TMU_DATA_SHARED \ | ||
| 370 | __EXYNOS5420_TMU_DATA \ | ||
| 371 | .type = SOC_ARCH_EXYNOS5420_TRIMINFO, \ | ||
| 372 | .features = (TMU_SUPPORT_EMULATION | TMU_SUPPORT_TRIM_RELOAD | \ | ||
| 373 | TMU_SUPPORT_FALLING_TRIP | TMU_SUPPORT_READY_STATUS | \ | ||
| 374 | TMU_SUPPORT_EMUL_TIME | TMU_SUPPORT_ADDRESS_MULTIPLE) | ||
| 375 | |||
| 376 | struct exynos_tmu_init_data const exynos5420_default_tmu_data = { | ||
| 377 | .tmu_data = { | ||
| 378 | { EXYNOS5420_TMU_DATA }, | ||
| 379 | { EXYNOS5420_TMU_DATA }, | ||
| 380 | { EXYNOS5420_TMU_DATA_SHARED }, | ||
| 381 | { EXYNOS5420_TMU_DATA_SHARED }, | ||
| 382 | { EXYNOS5420_TMU_DATA_SHARED }, | ||
| 383 | }, | ||
| 384 | .tmu_count = 5, | ||
| 385 | }; | ||
| 386 | #endif | ||
| 387 | |||
| 197 | #if defined(CONFIG_SOC_EXYNOS5440) | 388 | #if defined(CONFIG_SOC_EXYNOS5440) |
| 198 | static const struct exynos_tmu_registers exynos5440_tmu_registers = { | 389 | static const struct exynos_tmu_registers exynos5440_tmu_registers = { |
| 199 | .triminfo_data = EXYNOS5440_TMU_S0_7_TRIM, | 390 | .triminfo_data = EXYNOS5440_TMU_S0_7_TRIM, |
| @@ -217,10 +408,6 @@ static const struct exynos_tmu_registers exynos5440_tmu_registers = { | |||
| 217 | .threshold_th2 = EXYNOS5440_TMU_S0_7_TH2, | 408 | .threshold_th2 = EXYNOS5440_TMU_S0_7_TH2, |
| 218 | .threshold_th3_l0_shift = EXYNOS5440_TMU_TH_RISE4_SHIFT, | 409 | .threshold_th3_l0_shift = EXYNOS5440_TMU_TH_RISE4_SHIFT, |
| 219 | .tmu_inten = EXYNOS5440_TMU_S0_7_IRQEN, | 410 | .tmu_inten = EXYNOS5440_TMU_S0_7_IRQEN, |
| 220 | .inten_rise_mask = EXYNOS5440_TMU_RISE_INT_MASK, | ||
| 221 | .inten_rise_shift = EXYNOS5440_TMU_RISE_INT_SHIFT, | ||
| 222 | .inten_fall_mask = EXYNOS5440_TMU_FALL_INT_MASK, | ||
| 223 | .inten_fall_shift = EXYNOS5440_TMU_FALL_INT_SHIFT, | ||
| 224 | .inten_rise0_shift = EXYNOS5440_TMU_INTEN_RISE0_SHIFT, | 411 | .inten_rise0_shift = EXYNOS5440_TMU_INTEN_RISE0_SHIFT, |
| 225 | .inten_rise1_shift = EXYNOS5440_TMU_INTEN_RISE1_SHIFT, | 412 | .inten_rise1_shift = EXYNOS5440_TMU_INTEN_RISE1_SHIFT, |
| 226 | .inten_rise2_shift = EXYNOS5440_TMU_INTEN_RISE2_SHIFT, | 413 | .inten_rise2_shift = EXYNOS5440_TMU_INTEN_RISE2_SHIFT, |
| @@ -228,6 +415,10 @@ static const struct exynos_tmu_registers exynos5440_tmu_registers = { | |||
| 228 | .inten_fall0_shift = EXYNOS5440_TMU_INTEN_FALL0_SHIFT, | 415 | .inten_fall0_shift = EXYNOS5440_TMU_INTEN_FALL0_SHIFT, |
| 229 | .tmu_intstat = EXYNOS5440_TMU_S0_7_IRQ, | 416 | .tmu_intstat = EXYNOS5440_TMU_S0_7_IRQ, |
| 230 | .tmu_intclear = EXYNOS5440_TMU_S0_7_IRQ, | 417 | .tmu_intclear = EXYNOS5440_TMU_S0_7_IRQ, |
| 418 | .intclr_fall_shift = EXYNOS5440_TMU_CLEAR_FALL_INT_SHIFT, | ||
| 419 | .intclr_rise_shift = EXYNOS5440_TMU_RISE_INT_SHIFT, | ||
| 420 | .intclr_rise_mask = EXYNOS5440_TMU_RISE_INT_MASK, | ||
| 421 | .intclr_fall_mask = EXYNOS5440_TMU_FALL_INT_MASK, | ||
| 231 | .tmu_irqstatus = EXYNOS5440_TMU_IRQ_STATUS, | 422 | .tmu_irqstatus = EXYNOS5440_TMU_IRQ_STATUS, |
| 232 | .emul_con = EXYNOS5440_TMU_S0_7_DEBUG, | 423 | .emul_con = EXYNOS5440_TMU_S0_7_DEBUG, |
| 233 | .emul_temp_shift = EXYNOS_EMUL_DATA_SHIFT, | 424 | .emul_temp_shift = EXYNOS_EMUL_DATA_SHIFT, |
| @@ -255,7 +446,7 @@ static const struct exynos_tmu_registers exynos5440_tmu_registers = { | |||
| 255 | .type = SOC_ARCH_EXYNOS5440, \ | 446 | .type = SOC_ARCH_EXYNOS5440, \ |
| 256 | .registers = &exynos5440_tmu_registers, \ | 447 | .registers = &exynos5440_tmu_registers, \ |
| 257 | .features = (TMU_SUPPORT_EMULATION | TMU_SUPPORT_FALLING_TRIP | \ | 448 | .features = (TMU_SUPPORT_EMULATION | TMU_SUPPORT_FALLING_TRIP | \ |
| 258 | TMU_SUPPORT_MULTI_INST | TMU_SUPPORT_SHARED_MEMORY), | 449 | TMU_SUPPORT_MULTI_INST | TMU_SUPPORT_ADDRESS_MULTIPLE), |
| 259 | 450 | ||
| 260 | struct exynos_tmu_init_data const exynos5440_default_tmu_data = { | 451 | struct exynos_tmu_init_data const exynos5440_default_tmu_data = { |
| 261 | .tmu_data = { | 452 | .tmu_data = { |
diff --git a/drivers/thermal/samsung/exynos_tmu_data.h b/drivers/thermal/samsung/exynos_tmu_data.h index a1ea19d9e0a6..d268981b65e5 100644 --- a/drivers/thermal/samsung/exynos_tmu_data.h +++ b/drivers/thermal/samsung/exynos_tmu_data.h | |||
| @@ -69,9 +69,11 @@ | |||
| 69 | #define EXYNOS_TMU_RISE_INT_MASK 0x111 | 69 | #define EXYNOS_TMU_RISE_INT_MASK 0x111 |
| 70 | #define EXYNOS_TMU_RISE_INT_SHIFT 0 | 70 | #define EXYNOS_TMU_RISE_INT_SHIFT 0 |
| 71 | #define EXYNOS_TMU_FALL_INT_MASK 0x111 | 71 | #define EXYNOS_TMU_FALL_INT_MASK 0x111 |
| 72 | #define EXYNOS_TMU_FALL_INT_SHIFT 12 | ||
| 73 | #define EXYNOS_TMU_CLEAR_RISE_INT 0x111 | 72 | #define EXYNOS_TMU_CLEAR_RISE_INT 0x111 |
| 74 | #define EXYNOS_TMU_CLEAR_FALL_INT (0x111 << 12) | 73 | #define EXYNOS_TMU_CLEAR_FALL_INT (0x111 << 12) |
| 74 | #define EXYNOS_TMU_CLEAR_FALL_INT_SHIFT 12 | ||
| 75 | #define EXYNOS5420_TMU_CLEAR_FALL_INT_SHIFT 16 | ||
| 76 | #define EXYNOS5440_TMU_CLEAR_FALL_INT_SHIFT 4 | ||
| 75 | #define EXYNOS_TMU_TRIP_MODE_SHIFT 13 | 77 | #define EXYNOS_TMU_TRIP_MODE_SHIFT 13 |
| 76 | #define EXYNOS_TMU_TRIP_MODE_MASK 0x7 | 78 | #define EXYNOS_TMU_TRIP_MODE_MASK 0x7 |
| 77 | #define EXYNOS_TMU_THERM_TRIP_EN_SHIFT 12 | 79 | #define EXYNOS_TMU_THERM_TRIP_EN_SHIFT 12 |
| @@ -85,6 +87,7 @@ | |||
| 85 | #define EXYNOS_TMU_INTEN_FALL0_SHIFT 16 | 87 | #define EXYNOS_TMU_INTEN_FALL0_SHIFT 16 |
| 86 | #define EXYNOS_TMU_INTEN_FALL1_SHIFT 20 | 88 | #define EXYNOS_TMU_INTEN_FALL1_SHIFT 20 |
| 87 | #define EXYNOS_TMU_INTEN_FALL2_SHIFT 24 | 89 | #define EXYNOS_TMU_INTEN_FALL2_SHIFT 24 |
| 90 | #define EXYNOS_TMU_INTEN_FALL3_SHIFT 28 | ||
| 88 | 91 | ||
| 89 | #define EXYNOS_EMUL_TIME 0x57F0 | 92 | #define EXYNOS_EMUL_TIME 0x57F0 |
| 90 | #define EXYNOS_EMUL_TIME_MASK 0xffff | 93 | #define EXYNOS_EMUL_TIME_MASK 0xffff |
| @@ -95,6 +98,17 @@ | |||
| 95 | 98 | ||
| 96 | #define EXYNOS_MAX_TRIGGER_PER_REG 4 | 99 | #define EXYNOS_MAX_TRIGGER_PER_REG 4 |
| 97 | 100 | ||
| 101 | /* Exynos5260 specific */ | ||
| 102 | #define EXYNOS_TMU_REG_CONTROL1 0x24 | ||
| 103 | #define EXYNOS5260_TMU_REG_INTEN 0xC0 | ||
| 104 | #define EXYNOS5260_TMU_REG_INTSTAT 0xC4 | ||
| 105 | #define EXYNOS5260_TMU_REG_INTCLEAR 0xC8 | ||
| 106 | #define EXYNOS5260_TMU_CLEAR_RISE_INT 0x1111 | ||
| 107 | #define EXYNOS5260_TMU_CLEAR_FALL_INT (0x1111 << 16) | ||
| 108 | #define EXYNOS5260_TMU_RISE_INT_MASK 0x1111 | ||
| 109 | #define EXYNOS5260_TMU_FALL_INT_MASK 0x1111 | ||
| 110 | #define EXYNOS5260_EMUL_CON 0x100 | ||
| 111 | |||
| 98 | /* Exynos4412 specific */ | 112 | /* Exynos4412 specific */ |
| 99 | #define EXYNOS4412_MUX_ADDR_VALUE 6 | 113 | #define EXYNOS4412_MUX_ADDR_VALUE 6 |
| 100 | #define EXYNOS4412_MUX_ADDR_SHIFT 20 | 114 | #define EXYNOS4412_MUX_ADDR_SHIFT 20 |
| @@ -119,7 +133,6 @@ | |||
| 119 | #define EXYNOS5440_TMU_RISE_INT_MASK 0xf | 133 | #define EXYNOS5440_TMU_RISE_INT_MASK 0xf |
| 120 | #define EXYNOS5440_TMU_RISE_INT_SHIFT 0 | 134 | #define EXYNOS5440_TMU_RISE_INT_SHIFT 0 |
| 121 | #define EXYNOS5440_TMU_FALL_INT_MASK 0xf | 135 | #define EXYNOS5440_TMU_FALL_INT_MASK 0xf |
| 122 | #define EXYNOS5440_TMU_FALL_INT_SHIFT 4 | ||
| 123 | #define EXYNOS5440_TMU_INTEN_RISE0_SHIFT 0 | 136 | #define EXYNOS5440_TMU_INTEN_RISE0_SHIFT 0 |
| 124 | #define EXYNOS5440_TMU_INTEN_RISE1_SHIFT 1 | 137 | #define EXYNOS5440_TMU_INTEN_RISE1_SHIFT 1 |
| 125 | #define EXYNOS5440_TMU_INTEN_RISE2_SHIFT 2 | 138 | #define EXYNOS5440_TMU_INTEN_RISE2_SHIFT 2 |
| @@ -156,6 +169,20 @@ extern struct exynos_tmu_init_data const exynos5250_default_tmu_data; | |||
| 156 | #define EXYNOS5250_TMU_DRV_DATA (NULL) | 169 | #define EXYNOS5250_TMU_DRV_DATA (NULL) |
| 157 | #endif | 170 | #endif |
| 158 | 171 | ||
| 172 | #if defined(CONFIG_SOC_EXYNOS5260) | ||
| 173 | extern struct exynos_tmu_init_data const exynos5260_default_tmu_data; | ||
| 174 | #define EXYNOS5260_TMU_DRV_DATA (&exynos5260_default_tmu_data) | ||
| 175 | #else | ||
| 176 | #define EXYNOS5260_TMU_DRV_DATA (NULL) | ||
| 177 | #endif | ||
| 178 | |||
| 179 | #if defined(CONFIG_SOC_EXYNOS5420) | ||
| 180 | extern struct exynos_tmu_init_data const exynos5420_default_tmu_data; | ||
| 181 | #define EXYNOS5420_TMU_DRV_DATA (&exynos5420_default_tmu_data) | ||
| 182 | #else | ||
| 183 | #define EXYNOS5420_TMU_DRV_DATA (NULL) | ||
| 184 | #endif | ||
| 185 | |||
| 159 | #if defined(CONFIG_SOC_EXYNOS5440) | 186 | #if defined(CONFIG_SOC_EXYNOS5440) |
| 160 | extern struct exynos_tmu_init_data const exynos5440_default_tmu_data; | 187 | extern struct exynos_tmu_init_data const exynos5440_default_tmu_data; |
| 161 | #define EXYNOS5440_TMU_DRV_DATA (&exynos5440_default_tmu_data) | 188 | #define EXYNOS5440_TMU_DRV_DATA (&exynos5440_default_tmu_data) |
diff --git a/drivers/thermal/ti-soc-thermal/ti-bandgap.c b/drivers/thermal/ti-soc-thermal/ti-bandgap.c index 3ab12ee359b7..a1271b55103a 100644 --- a/drivers/thermal/ti-soc-thermal/ti-bandgap.c +++ b/drivers/thermal/ti-soc-thermal/ti-bandgap.c | |||
| @@ -1248,7 +1248,7 @@ int ti_bandgap_probe(struct platform_device *pdev) | |||
| 1248 | clk_rate = clk_round_rate(bgp->div_clk, | 1248 | clk_rate = clk_round_rate(bgp->div_clk, |
| 1249 | bgp->conf->sensors[0].ts_data->max_freq); | 1249 | bgp->conf->sensors[0].ts_data->max_freq); |
| 1250 | if (clk_rate < bgp->conf->sensors[0].ts_data->min_freq || | 1250 | if (clk_rate < bgp->conf->sensors[0].ts_data->min_freq || |
| 1251 | clk_rate == 0xffffffff) { | 1251 | clk_rate <= 0) { |
| 1252 | ret = -ENODEV; | 1252 | ret = -ENODEV; |
| 1253 | dev_err(&pdev->dev, "wrong clock rate (%d)\n", clk_rate); | 1253 | dev_err(&pdev->dev, "wrong clock rate (%d)\n", clk_rate); |
| 1254 | goto put_clks; | 1254 | goto put_clks; |
