diff options
author | Amit Daniel Kachhap <amit.daniel@samsung.com> | 2013-06-24 06:50:47 -0400 |
---|---|---|
committer | Eduardo Valentin <eduardo.valentin@ti.com> | 2013-08-13 09:52:03 -0400 |
commit | 498d22f616f6880531b6d75630a9cc0ecd1f7865 (patch) | |
tree | 2ffd87f06d24719b179f530b5d9a1b8ab0928001 /drivers/thermal | |
parent | 1928457ea6337043a06ca2acd9b4d01e75810a3f (diff) |
thermal: exynos: Support for TMU regulator defined at device tree
TMU probe function now checks for a device tree defined regulator.
For compatibility reasons it is allowed to probe driver even without
this regulator defined.
Acked-by: Jonghwa Lee <jonghwa3.lee@samsung.com>
Acked-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Lukasz Majewski <l.majewski@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Amit Daniel Kachhap <amit.daniel@samsung.com>
Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Diffstat (limited to 'drivers/thermal')
-rw-r--r-- | drivers/thermal/samsung/exynos_tmu.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung/exynos_tmu.c index a6fc3798a6c4..ec01dfe4bef3 100644 --- a/drivers/thermal/samsung/exynos_tmu.c +++ b/drivers/thermal/samsung/exynos_tmu.c | |||
@@ -29,6 +29,7 @@ | |||
29 | #include <linux/of_address.h> | 29 | #include <linux/of_address.h> |
30 | #include <linux/of_irq.h> | 30 | #include <linux/of_irq.h> |
31 | #include <linux/platform_device.h> | 31 | #include <linux/platform_device.h> |
32 | #include <linux/regulator/consumer.h> | ||
32 | 33 | ||
33 | #include "exynos_thermal_common.h" | 34 | #include "exynos_thermal_common.h" |
34 | #include "exynos_tmu.h" | 35 | #include "exynos_tmu.h" |
@@ -48,6 +49,7 @@ | |||
48 | * @clk: pointer to the clock structure. | 49 | * @clk: pointer to the clock structure. |
49 | * @temp_error1: fused value of the first point trim. | 50 | * @temp_error1: fused value of the first point trim. |
50 | * @temp_error2: fused value of the second point trim. | 51 | * @temp_error2: fused value of the second point trim. |
52 | * @regulator: pointer to the TMU regulator structure. | ||
51 | * @reg_conf: pointer to structure to register with core thermal. | 53 | * @reg_conf: pointer to structure to register with core thermal. |
52 | */ | 54 | */ |
53 | struct exynos_tmu_data { | 55 | struct exynos_tmu_data { |
@@ -61,6 +63,7 @@ struct exynos_tmu_data { | |||
61 | struct mutex lock; | 63 | struct mutex lock; |
62 | struct clk *clk; | 64 | struct clk *clk; |
63 | u8 temp_error1, temp_error2; | 65 | u8 temp_error1, temp_error2; |
66 | struct regulator *regulator; | ||
64 | struct thermal_sensor_conf *reg_conf; | 67 | struct thermal_sensor_conf *reg_conf; |
65 | }; | 68 | }; |
66 | 69 | ||
@@ -527,10 +530,27 @@ static int exynos_map_dt_data(struct platform_device *pdev) | |||
527 | struct exynos_tmu_data *data = platform_get_drvdata(pdev); | 530 | struct exynos_tmu_data *data = platform_get_drvdata(pdev); |
528 | struct exynos_tmu_platform_data *pdata; | 531 | struct exynos_tmu_platform_data *pdata; |
529 | struct resource res; | 532 | struct resource res; |
533 | int ret; | ||
530 | 534 | ||
531 | if (!data) | 535 | if (!data) |
532 | return -ENODEV; | 536 | return -ENODEV; |
533 | 537 | ||
538 | /* | ||
539 | * Try enabling the regulator if found | ||
540 | * TODO: Add regulator as an SOC feature, so that regulator enable | ||
541 | * is a compulsory call. | ||
542 | */ | ||
543 | data->regulator = devm_regulator_get(&pdev->dev, "vtmu"); | ||
544 | if (!IS_ERR(data->regulator)) { | ||
545 | ret = regulator_enable(data->regulator); | ||
546 | if (ret) { | ||
547 | dev_err(&pdev->dev, "failed to enable vtmu\n"); | ||
548 | return ret; | ||
549 | } | ||
550 | } else { | ||
551 | dev_info(&pdev->dev, "Regulator node (vtmu) not found\n"); | ||
552 | } | ||
553 | |||
534 | data->id = of_alias_get_id(pdev->dev.of_node, "tmuctrl"); | 554 | data->id = of_alias_get_id(pdev->dev.of_node, "tmuctrl"); |
535 | if (data->id < 0) | 555 | if (data->id < 0) |
536 | data->id = 0; | 556 | data->id = 0; |
@@ -698,6 +718,9 @@ static int exynos_tmu_remove(struct platform_device *pdev) | |||
698 | 718 | ||
699 | clk_unprepare(data->clk); | 719 | clk_unprepare(data->clk); |
700 | 720 | ||
721 | if (!IS_ERR(data->regulator)) | ||
722 | regulator_disable(data->regulator); | ||
723 | |||
701 | return 0; | 724 | return 0; |
702 | } | 725 | } |
703 | 726 | ||