[PATCH 4/6] thermal: Support for TMU regulator defined at device tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.

Signed-off-by: Lukasz Majewski <l.majewski@xxxxxxxxxxx>
Signed-off-by: Kyungmin Park <kyungmin.park@xxxxxxxxxxx>
---
 drivers/thermal/exynos_thermal.c |   19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/drivers/thermal/exynos_thermal.c b/drivers/thermal/exynos_thermal.c
index ba6094c..e922fa4 100644
--- a/drivers/thermal/exynos_thermal.c
+++ b/drivers/thermal/exynos_thermal.c
@@ -38,6 +38,7 @@
 #include <linux/cpufreq.h>
 #include <linux/cpu_cooling.h>
 #include <linux/of.h>
+#include <linux/regulator/consumer.h>
 
 #include <plat/cpu.h>
 
@@ -119,6 +120,8 @@
 
 #define EXYNOS_ZONE_COUNT	3
 
+#define EXYNOS_TMU_REGULATOR "vdd_ts"
+
 struct exynos_tmu_data {
 	struct exynos_tmu_platform_data *pdata;
 	struct resource *mem;
@@ -944,6 +947,7 @@ static int exynos_tmu_probe(struct platform_device *pdev)
 {
 	struct exynos_tmu_data *data;
 	struct exynos_tmu_platform_data *pdata = pdev->dev.platform_data;
+	struct regulator *reg;
 	int ret, i;
 
 	if (!pdata)
@@ -953,6 +957,21 @@ static int exynos_tmu_probe(struct platform_device *pdev)
 		dev_err(&pdev->dev, "No platform init data supplied.\n");
 		return -ENODEV;
 	}
+
+	reg = regulator_get(&pdev->dev, EXYNOS_TMU_REGULATOR);
+	if (!IS_ERR(reg)) {
+		ret = regulator_enable(reg);
+		if (ret) {
+			dev_err(&pdev->dev, "Regulator %s not enabled.\n",
+				EXYNOS_TMU_REGULATOR);
+			return ret;
+		}
+	} else {
+		dev_info(&pdev->dev,
+			 "Regulator %s not defined at device tree.\n",
+			 EXYNOS_TMU_REGULATOR);
+	}
+
 	data = devm_kzalloc(&pdev->dev, sizeof(struct exynos_tmu_data),
 					GFP_KERNEL);
 	if (!data) {
-- 
1.7.10.4

--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux SoC Development]     [Linux Rockchip Development]     [Linux USB Development]     [Video for Linux]     [Linux Audio Users]     [Linux SCSI]     [Yosemite News]

  Powered by Linux