exynos_tmu.c (ef3f80fc7f79c32a1b015afcbffce2a2630011a4) | exynos_tmu.c (56adb9efeb8115d2a3a807d84a0d037398588911) |
---|---|
1/* 2 * exynos_tmu.c - Samsung EXYNOS TMU (Thermal Management Unit) 3 * 4 * Copyright (C) 2011 Samsung Electronics 5 * Donggeun Kim <dg77.kim@samsung.com> 6 * Amit Daniel Kachhap <amit.kachhap@linaro.org> 7 * 8 * This program is free software; you can redistribute it and/or modify --- 459 unchanged lines hidden (view full) --- 468 val = readl(data->base + EXYNOS5440_TMU_S0_7_DEBUG); 469 val = get_emul_con_reg(data, val, temp); 470 writel(val, data->base + EXYNOS5440_TMU_S0_7_DEBUG); 471} 472 473static int exynos_tmu_set_emulation(void *drv_data, unsigned long temp) 474{ 475 struct exynos_tmu_data *data = drv_data; | 1/* 2 * exynos_tmu.c - Samsung EXYNOS TMU (Thermal Management Unit) 3 * 4 * Copyright (C) 2011 Samsung Electronics 5 * Donggeun Kim <dg77.kim@samsung.com> 6 * Amit Daniel Kachhap <amit.kachhap@linaro.org> 7 * 8 * This program is free software; you can redistribute it and/or modify --- 459 unchanged lines hidden (view full) --- 468 val = readl(data->base + EXYNOS5440_TMU_S0_7_DEBUG); 469 val = get_emul_con_reg(data, val, temp); 470 writel(val, data->base + EXYNOS5440_TMU_S0_7_DEBUG); 471} 472 473static int exynos_tmu_set_emulation(void *drv_data, unsigned long temp) 474{ 475 struct exynos_tmu_data *data = drv_data; |
476 struct exynos_tmu_platform_data *pdata = data->pdata; | |
477 int ret = -EINVAL; 478 479 if (data->soc == SOC_ARCH_EXYNOS4210) 480 goto out; 481 482 if (temp && temp < MCELSIUS) 483 goto out; 484 --- 206 unchanged lines hidden (view full) --- 691 return -EADDRNOTAVAIL; 692 } 693 694 pdata = exynos_get_driver_data(pdev, data->id); 695 if (!pdata) { 696 dev_err(&pdev->dev, "No platform init data supplied.\n"); 697 return -ENODEV; 698 } | 476 int ret = -EINVAL; 477 478 if (data->soc == SOC_ARCH_EXYNOS4210) 479 goto out; 480 481 if (temp && temp < MCELSIUS) 482 goto out; 483 --- 206 unchanged lines hidden (view full) --- 690 return -EADDRNOTAVAIL; 691 } 692 693 pdata = exynos_get_driver_data(pdev, data->id); 694 if (!pdata) { 695 dev_err(&pdev->dev, "No platform init data supplied.\n"); 696 return -ENODEV; 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 /* 701 * Check if the TMU shares some registers and then try to map the 702 * memory of common registers. 703 */ | 733 /* 734 * Check if the TMU shares some registers and then try to map the 735 * memory of common registers. 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; 706 707 if (of_address_to_resource(pdev->dev.of_node, 1, &res)) { 708 dev_err(&pdev->dev, "failed to get Resource 1\n"); 709 return -ENODEV; 710 } 711 712 data->base_second = devm_ioremap(&pdev->dev, res.start, --- 50 unchanged lines hidden (view full) --- 763 } 764 765 ret = clk_prepare(data->clk); 766 if (ret) { 767 dev_err(&pdev->dev, "Failed to get clock\n"); 768 goto err_clk_sec; 769 } 770 | 739 return 0; 740 741 if (of_address_to_resource(pdev->dev.of_node, 1, &res)) { 742 dev_err(&pdev->dev, "failed to get Resource 1\n"); 743 return -ENODEV; 744 } 745 746 data->base_second = devm_ioremap(&pdev->dev, res.start, --- 50 unchanged lines hidden (view full) --- 797 } 798 799 ret = clk_prepare(data->clk); 800 if (ret) { 801 dev_err(&pdev->dev, "Failed to get clock\n"); 802 goto err_clk_sec; 803 } 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); 806 if (ret) { 807 dev_err(&pdev->dev, "Failed to initialize TMU\n"); 808 goto err_clk; 809 } 810 811 exynos_tmu_control(pdev, true); 812 --- 117 unchanged lines hidden --- | 805 ret = exynos_tmu_initialize(pdev); 806 if (ret) { 807 dev_err(&pdev->dev, "Failed to initialize TMU\n"); 808 goto err_clk; 809 } 810 811 exynos_tmu_control(pdev, true); 812 --- 117 unchanged lines hidden --- |