Skip to contentSkip to conversation

thermal:exynos4: Thermal Measurement Unit fixes for Samsung SoCs

PATCH In review Lukasz Majewski 8 participants 57 messages Apr 19, 2013 – Apr 29, 2013

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

cover thermal:exynos4: Thermal Measurement Unit fixes for Samsung SoCs

This patch series provide various fixes for TMU block.
Namely, support for common clock framework and proper regulator VDD_TS has been added.
Moreover device tree definitions and documentation entry are now in place.

Lukasz Majewski (6):
clk:exynos4:TMU Thermal Measurement Unit clock added to common clock
framework
thermal:exynos4: TMU Common clock framework support for TMU (Thermal
Monitoring Unit)
thermal:exynos4: TMU device tree support for Exynos4412 targets
thermal: Support for TMU regulator defined at device tree thermal:exynos4: Enable support for Exynos4412 SoCs thermal:exynos4: Add documentation for Exynos SoC thermal bindings

 .../devicetree/bindings/clock/exynos4-clock.txt    |    1 +
 .../devicetree/bindings/thermal/exynos-thermal.txt |   22 +++++++++++
 arch/arm/boot/dts/exynos4x12.dtsi                  |   10 +++++
 drivers/clk/samsung/clk-exynos4.c                  |    6 ++-
 drivers/thermal/exynos_thermal.c                   |   41 +++++++++++++++-----
 5 files changed, 70 insertions(+), 10 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/thermal/exynos-thermal.txt
Signature · 1 line
1.7.10.4
#1 lore raw

PATCH 1/6 clk:exynos4:TMU Thermal Measurement Unit clock added to common clock framework

TMU is now supported with a exynos4 common clock framework. "tmu_apbif" clock has been defined with a common clock framework.

---
 Documentation/devicetree/bindings/clock/exynos4-clock.txt |    1 +
 drivers/clk/samsung/clk-exynos4.c                         |    6 +++++-
 2 files changed, 6 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/clock/exynos4-clock.txt +1 -0
index ea5e26f..9afe6cb 100644
@@ -235,6 +235,7 @@ Exynos4 SoC and this is specified where applicable.
   spi0_isp_sclk       380     Exynos4x12
   spi1_isp_sclk       381     Exynos4x12
   uart_isp_sclk       382     Exynos4x12
+  tmu_apbif           383
 
 		[Mux Clocks]
 
drivers/clk/samsung/clk-exynos4.c +5 -1
index 7104669..66c4ce4 100644
@@ -170,7 +170,7 @@ enum exynos4_clks {
 	gicisp, smmu_isp, smmu_drc, smmu_fd, smmu_lite0, smmu_lite1, mcuctl_isp,
 	mpwm_isp, i2c0_isp, i2c1_isp, mtcadc_isp, pwm_isp, wdt_isp, uart_isp,
 	asyncaxim, smmu_ispcx, spi0_isp, spi1_isp, pwm_isp_sclk, spi0_isp_sclk,
-	spi1_isp_sclk, uart_isp_sclk,
+	spi1_isp_sclk, uart_isp_sclk, tmu_apbif,
 
 	/* mux clocks */
 	mout_fimc0 = 384, mout_fimc1, mout_fimc2, mout_fimc3, mout_cam0,
@@ -807,6 +807,8 @@ struct samsung_gate_clock exynos4210_gate_clks[] __initdata = {
 	GATE_A(wdt, "watchdog", "aclk100", E4210_GATE_IP_PERIR, 14, 0, 0, "watchdog"),
 	GATE_A(rtc, "rtc", "aclk100", E4210_GATE_IP_PERIR, 15, 0, 0, "rtc"),
 	GATE_A(keyif, "keyif", "aclk100", E4210_GATE_IP_PERIR, 16, 0, 0, "keypad"),
+	GATE_A(tmu_apbif, "tmu_apbif", "aclk100",
+	       E4210_GATE_IP_PERIR, 17, 0, 0, "tmu_apbif"),
 	GATE_DA(sclk_fimd1, "exynos4-fb.1", "sclk_fimd1", "div_fimd1",
 			E4210_SRC_MASK_LCD1, 0, CLK_SET_RATE_PARENT, 0, "sclk_fimd"),
 };
@@ -834,6 +836,8 @@ struct samsung_gate_clock exynos4x12_gate_clks[] __initdata = {
 	GATE_A(rtc, "rtc", "aclk100", E4X12_GATE_IP_PERIR, 15, 0, 0, "rtc"),
 	GATE_A(keyif, "keyif", "aclk100",
 			E4X12_GATE_IP_PERIR, 16, 0, 0, "keypad"),
+	GATE_A(tmu_apbif, "tmu_apbif", "aclk100",
+			E4X12_GATE_IP_PERIR, 17, 0, 0, "tmu_apbif"),
 	GATE(sclk_pwm_isp, "sclk_pwm_isp", "div_pwm_isp",
 			E4X12_SRC_MASK_ISP, 0, CLK_SET_RATE_PARENT, 0),
 	GATE(sclk_spi0_isp, "sclk_spi0_isp", "div_spi0_isp_pre",
Signature · 1 line
1.7.10.4
#2 lore raw

PATCH 2/6 thermal:exynos4: TMU Common clock framework support for TMU (Thermal Monitoring Unit)

In reply to Lukasz Majewski

This patch modifies exynos_thermal.c file to use clk_disable_unprepare() and clk_prepare_enable() instead of clk_{enable|disable}.

---
 drivers/thermal/exynos_thermal.c |   18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)
drivers/thermal/exynos_thermal.c +9 -9
index 46568c0..ba6094c 100644
@@ -584,7 +584,7 @@ static int exynos_tmu_initialize(struct platform_device *pdev)
 	int ret = 0, threshold_code, i, trigger_levs = 0;
 
 	mutex_lock(&data->lock);
-	clk_enable(data->clk);
+	clk_prepare_enable(data->clk);
 
 	status = readb(data->base + EXYNOS_TMU_REG_STATUS);
 	if (!status) {
@@ -655,7 +655,7 @@ static int exynos_tmu_initialize(struct platform_device *pdev)
 				data->base + EXYNOS_TMU_REG_INTCLEAR);
 	}
 out:
-	clk_disable(data->clk);
+	clk_disable_unprepare(data->clk);
 	mutex_unlock(&data->lock);
 
 	return ret;
@@ -668,7 +668,7 @@ static void exynos_tmu_control(struct platform_device *pdev, bool on)
 	unsigned int con, interrupt_en;
 
 	mutex_lock(&data->lock);
-	clk_enable(data->clk);
+	clk_prepare_enable(data->clk);
 
 	con = pdata->reference_voltage << EXYNOS_TMU_REF_VOLTAGE_SHIFT |
 		pdata->gain << EXYNOS_TMU_GAIN_SHIFT;
@@ -693,7 +693,7 @@ static void exynos_tmu_control(struct platform_device *pdev, bool on)
 	writel(interrupt_en, data->base + EXYNOS_TMU_REG_INTEN);
 	writel(con, data->base + EXYNOS_TMU_REG_CONTROL);
 
-	clk_disable(data->clk);
+	clk_disable_unprepare(data->clk);
 	mutex_unlock(&data->lock);
 }
 
@@ -703,12 +703,12 @@ static int exynos_tmu_read(struct exynos_tmu_data *data)
 	int temp;
 
 	mutex_lock(&data->lock);
-	clk_enable(data->clk);
+	clk_prepare_enable(data->clk);
 
 	temp_code = readb(data->base + EXYNOS_TMU_REG_CURRENT_TEMP);
 	temp = code_to_temp(data, temp_code);
 
-	clk_disable(data->clk);
+	clk_disable_unprepare(data->clk);
 	mutex_unlock(&data->lock);
 
 	return temp;
@@ -721,7 +721,7 @@ static void exynos_tmu_work(struct work_struct *work)
 
 	exynos_report_trigger();
 	mutex_lock(&data->lock);
-	clk_enable(data->clk);
+	clk_prepare_enable(data->clk);
 	if (data->soc == SOC_ARCH_EXYNOS)
 		writel(EXYNOS_TMU_CLEAR_RISE_INT |
 				EXYNOS_TMU_CLEAR_FALL_INT,
@@ -729,7 +729,7 @@ static void exynos_tmu_work(struct work_struct *work)
 	else
 		writel(EXYNOS4210_TMU_INTCLEAR_VAL,
 				data->base + EXYNOS_TMU_REG_INTCLEAR);
-	clk_disable(data->clk);
+	clk_disable_unprepare(data->clk);
 	mutex_unlock(&data->lock);
 
 	enable_irq(data->irq);
@@ -985,7 +985,7 @@ static int exynos_tmu_probe(struct platform_device *pdev)
 		return ret;
 	}
 
-	data->clk = clk_get(NULL, "tmu_apbif");
+	data->clk = clk_get(&pdev->dev, "tmu_apbif");
 	if (IS_ERR(data->clk)) {
 		dev_err(&pdev->dev, "Failed to get clock\n");
 		return  PTR_ERR(data->clk);
Signature · 1 line
1.7.10.4
#9 lore raw

PATCH 3/6 thermal:exynos4: TMU device tree support for Exynos4412 targets

In reply to Lukasz Majewski

Device tree support for TMU at Exynos4x12 targets.

---
 arch/arm/boot/dts/exynos4x12.dtsi |   10 ++++++++++
 1 file changed, 10 insertions(+)
arch/arm/boot/dts/exynos4x12.dtsi +10 -0
index e3380a7..ee920b3 100644
@@ -79,4 +79,14 @@
 		interrupts = <0 89 0>;
 		status = "disabled";
 	};
+
+	tmu@100C0000 {
+		compatible = "samsung,exynos4412-tmu";
+		interrupt-parent = <&combiner>;
+		reg = <0x100C0000 0x100>;
+		interrupts = <2 4>;
+		clocks = <&clock 383>;
+		clock-names = "tmu_apbif";
+		status = "disabled";
+	};
 };
Signature · 1 line
1.7.10.4
#14 lore raw

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

In reply to Lukasz Majewski

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.

---
 drivers/thermal/exynos_thermal.c |   19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
drivers/thermal/exynos_thermal.c +19 -0
index ba6094c..e922fa4 100644
@@ -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) {
Signature · 1 line
1.7.10.4
#18 lore raw

PATCH 5/6 thermal:exynos4: Enable support for Exynos4412 SoCs

In reply to Lukasz Majewski

Enable TMU support for Exynos4412 based target with device tree.

---
 drivers/thermal/exynos_thermal.c |    4 ++++
 1 file changed, 4 insertions(+)
drivers/thermal/exynos_thermal.c +4 -0
index e922fa4..f54066d 100644
@@ -819,6 +819,10 @@ static const struct of_device_id exynos_tmu_match[] = {
 		.data = (void *)EXYNOS4210_TMU_DRV_DATA,
 	},
 	{
+		.compatible = "samsung,exynos4412-tmu",
+		.data = (void *)EXYNOS_TMU_DRV_DATA,
+	},
+	{
 		.compatible = "samsung,exynos5250-tmu",
 		.data = (void *)EXYNOS_TMU_DRV_DATA,
 	},
Signature · 1 line
1.7.10.4
#25 lore raw

PATCH 6/6 thermal:exynos4: Add documentation for Exynos SoC thermal bindings

In reply to Lukasz Majewski

Proper description for Exynos4 bindings added to Documentation/devicetree/ bindings

---
 .../devicetree/bindings/thermal/exynos-thermal.txt |   22 ++++++++++++++++++++
 1 file changed, 22 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/thermal/exynos-thermal.txt
Documentation/devicetree/bindings/thermal/exynos-thermal.txt new file +22 -0
new file mode 100644
index 0000000..e994e1e
@@ -0,0 +1,22 @@
+* Exynos Thermal
+
+Required properties:
+- compatible : "samsung,exynos4412-tmu"
+- interrupts-parent : The phandle for the interrupt controller
+- reg : Address range of the thermal registers
+- interrupts : Should contain interrupt for thermal system
+- clocks : The main clock for TMU device
+- clocks-names : Thermal system clock name
+- status : Initial state of the device
+
+Example:
+
+	tmu@100C0000 {
+		compatible = "samsung,exynos4412-tmu";
+		interrupt-parent = <&combiner>;
+		reg = <0x100C0000 0x100>;
+		interrupts = <2 4>;
+		clocks = <&clock 383>;
+		clock-names = "tmu_apbif";
+		status = "disabled";
+	};
Signature · 1 line
1.7.10.4
#15 lore raw

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

In reply to Lukasz Majewski
Quoted 46 lines · Lukasz Majewski

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.

---
  drivers/thermal/exynos_thermal.c |   19 +++++++++++++++++++
  1 file changed, 19 insertions(+)
drivers/thermal/exynos_thermal.c +7 -0
index ba6094c..e922fa4 100644
@@ -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)) {

drivers/thermal/exynos_thermal.c static int exynos_tmu_probe(struct platform_device *pdev) · line 972

Quoted 10 lines
drivers/thermal/exynos_thermal.c +10 -0
+		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);

Maybe a dev_warn would fit better?

Quoted 6 lines
drivers/thermal/exynos_thermal.c +2 -0
+	}
+
  	data = devm_kzalloc(&pdev->dev, sizeof(struct exynos_tmu_data),
  					GFP_KERNEL);
  	if (!data) {
#3 lore raw

Re: [PATCH 2/6] thermal:exynos4: TMU Common clock framework support for TMU (Thermal Monitoring Unit)

In reply to Lukasz Majewski
Quoted 83 lines · Lukasz Majewski

This patch modifies exynos_thermal.c file to use clk_disable_unprepare() and clk_prepare_enable() instead of clk_{enable|disable}.

---
  drivers/thermal/exynos_thermal.c |   18 +++++++++---------
  1 file changed, 9 insertions(+), 9 deletions(-)
drivers/thermal/exynos_thermal.c +8 -8
index 46568c0..ba6094c 100644
@@ -584,7 +584,7 @@ static int exynos_tmu_initialize(struct platform_device *pdev)
  	int ret = 0, threshold_code, i, trigger_levs = 0;
 
  	mutex_lock(&data->lock);
-	clk_enable(data->clk);
+	clk_prepare_enable(data->clk);
 
  	status = readb(data->base + EXYNOS_TMU_REG_STATUS);
  	if (!status) {
@@ -655,7 +655,7 @@ static int exynos_tmu_initialize(struct platform_device *pdev)
  				data->base + EXYNOS_TMU_REG_INTCLEAR);
  	}
  out:
-	clk_disable(data->clk);
+	clk_disable_unprepare(data->clk);
  	mutex_unlock(&data->lock);
 
  	return ret;
@@ -668,7 +668,7 @@ static void exynos_tmu_control(struct platform_device *pdev, bool on)
  	unsigned int con, interrupt_en;
 
  	mutex_lock(&data->lock);
-	clk_enable(data->clk);
+	clk_prepare_enable(data->clk);
 
  	con = pdata->reference_voltage << EXYNOS_TMU_REF_VOLTAGE_SHIFT |
  		pdata->gain << EXYNOS_TMU_GAIN_SHIFT;
@@ -693,7 +693,7 @@ static void exynos_tmu_control(struct platform_device *pdev, bool on)
  	writel(interrupt_en, data->base + EXYNOS_TMU_REG_INTEN);
  	writel(con, data->base + EXYNOS_TMU_REG_CONTROL);
 
-	clk_disable(data->clk);
+	clk_disable_unprepare(data->clk);
  	mutex_unlock(&data->lock);
  }
 
@@ -703,12 +703,12 @@ static int exynos_tmu_read(struct exynos_tmu_data *data)
  	int temp;
 
  	mutex_lock(&data->lock);
-	clk_enable(data->clk);
+	clk_prepare_enable(data->clk);
 
  	temp_code = readb(data->base + EXYNOS_TMU_REG_CURRENT_TEMP);
  	temp = code_to_temp(data, temp_code);
 
-	clk_disable(data->clk);
+	clk_disable_unprepare(data->clk);
  	mutex_unlock(&data->lock);
 
  	return temp;
@@ -721,7 +721,7 @@ static void exynos_tmu_work(struct work_struct *work)
 
  	exynos_report_trigger();
  	mutex_lock(&data->lock);
-	clk_enable(data->clk);
+	clk_prepare_enable(data->clk);
  	if (data->soc == SOC_ARCH_EXYNOS)
  		writel(EXYNOS_TMU_CLEAR_RISE_INT |
  				EXYNOS_TMU_CLEAR_FALL_INT,
@@ -729,7 +729,7 @@ static void exynos_tmu_work(struct work_struct *work)
  	else
  		writel(EXYNOS4210_TMU_INTCLEAR_VAL,
  				data->base + EXYNOS_TMU_REG_INTCLEAR);
-	clk_disable(data->clk);
+	clk_disable_unprepare(data->clk);
  	mutex_unlock(&data->lock);
 
  	enable_irq(data->irq);

drivers/thermal/exynos_thermal.c static int exynos_tmu_probe(struct platform_device *pdev) · line 988

Quoted 5 lines
drivers/thermal/exynos_thermal.c +1 -1
@@ -985,7 +985,7 @@ static int exynos_tmu_probe(struct platform_device *pdev)
  		return ret;
  	}
 
-	data->clk = clk_get(NULL, "tmu_apbif");
+	data->clk = clk_get(&pdev->dev, "tmu_apbif");

This change does not seam to be part of the patch orginal purpose, at least not as described in your patch description.

Quoted 4 lines
drivers/thermal/exynos_thermal.c +0 -0
  	if (IS_ERR(data->clk)) {
  		dev_err(&pdev->dev, "Failed to get clock\n");
  		return  PTR_ERR(data->clk);
#10 lore raw

Re: [PATCH 3/6] thermal:exynos4: TMU device tree support for Exynos4412 targets

In reply to Lukasz Majewski
Quoted 13 lines · Lukasz Majewski

Device tree support for TMU at Exynos4x12 targets.

---
  arch/arm/boot/dts/exynos4x12.dtsi |   10 ++++++++++
  1 file changed, 10 insertions(+)
arch/arm/boot/dts/exynos4x12.dtsi +0 -0
index e3380a7..ee920b3 100644

arch/arm/boot/dts/exynos4x12.dtsi line 84

Quoted 6 lines
arch/arm/boot/dts/exynos4x12.dtsi +3 -0
@@ -79,4 +79,14 @@
  		interrupts = <0 89 0>;
  		status = "disabled";
  	};
+
+	tmu@100C0000 {
+		compatible = "samsung,exynos4412-tmu";

Is this one already documented?

Quoted 9 lines
arch/arm/boot/dts/exynos4x12.dtsi +7 -0
+		interrupt-parent = <&combiner>;
+		reg = <0x100C0000 0x100>;
+		interrupts = <2 4>;
+		clocks = <&clock 383>;
+		clock-names = "tmu_apbif";
+		status = "disabled";
+	};
  };
#4 lore raw

Re: [PATCH 2/6] thermal:exynos4: TMU Common clock framework support for TMU (Thermal Monitoring Unit)

In reply to Lukasz Majewski
Quoted 6 lines · Lukasz Majewski

This patch modifies exynos_thermal.c file to use clk_disable_unprepare() and clk_prepare_enable() instead of clk_{enable|disable}.

---

I have already submitted a similar patch for this:
http://permalink.gmane.org/gmane.linux.power-management.general/33310

Signature · 2 lines
With warm regards,
Sachin
#19 lore raw

Re: [PATCH 5/6] thermal:exynos4: Enable support for Exynos4412 SoCs

In reply to Lukasz Majewski
Quoted 5 lines · Lukasz Majewski

Enable TMU support for Exynos4412 based target with device tree.

---

I have already submitted a similar patch for doing this:
http://permalink.gmane.org/gmane.linux.power-management.general/33311

Signature · 2 lines
With warm regards,
Sachin
#20 lore raw

Re: [PATCH 5/6] thermal:exynos4: Enable support for Exynos4412 SoCs

Quoted 9 lines · On Friday 19 of April 2013 23:41:29 Sachin Kamat wrote:
Quoted 5 lines · Lukasz Majewski

Enable TMU support for Exynos4412 based target with device tree.

---

I have already submitted a similar patch for doing this:
http://permalink.gmane.org/gmane.linux.power-management.general/33311

Hmm, looks like we missed this series indeed. You haven't CC'ed linux- samsung-soc mailing list, though. I guess this is the reason.

Best regards,
Tomasz

#21 lore raw

Re: [PATCH 5/6] thermal:exynos4: Enable support for Exynos4412 SoCs

Quoted 8 lines · Tomasz Figa
Quoted 7 lines · On Friday 19 of April 2013 23:41:29 Sachin Kamat wrote:
Quoted 5 lines · Lukasz Majewski

Enable TMU support for Exynos4412 based target with device tree.

---

Quoted 5 lines
Quoted 2 lines

I have already submitted a similar patch for doing this:
http://permalink.gmane.org/gmane.linux.power-management.general/33311

Hmm, looks like we missed this series indeed. You haven't CC'ed linux- samsung-soc mailing list, though. I guess this is the reason.

Indeed I missed CCing linux-samsung-soc mailing list; sorry about that.

Signature · 2 lines
With warm regards,
Sachin
#12 lore raw

Re: [PATCH 3/6] thermal:exynos4: TMU device tree support for Exynos4412 targets

In reply to Lukasz Majewski

Hi Lukasz,

Quoted 4 lines · Lukasz Majewski

Device tree support for TMU at Exynos4x12 targets.

nit: Subject for these kind of patches should start with "ARM: dts: ..."

Otherwise looks good to me.

Quoted 30 lines
---
 arch/arm/boot/dts/exynos4x12.dtsi |   10 ++++++++++
 1 file changed, 10 insertions(+)
arch/arm/boot/dts/exynos4x12.dtsi +10 -1
index e3380a7..ee920b3 100644
@@ -79,4 +79,14 @@
                interrupts = <0 89 0>;
                status = "disabled";
        };
+
+       tmu@100C0000 {
+               compatible = "samsung,exynos4412-tmu";
+               interrupt-parent = <&combiner>;
+               reg = <0x100C0000 0x100>;
+               interrupts = <2 4>;
+               clocks = <&clock 383>;
+               clock-names = "tmu_apbif";
+               status = "disabled";
+       };
 };
--

1.7.10.4

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

Signature · 2 lines
With warm regards,
Sachin
#26 lore raw

Re: [PATCH 6/6] thermal:exynos4: Add documentation for Exynos SoC thermal bindings

In reply to Lukasz Majewski

Hi Lukasz,

Thanks for adding this. Some comments inline.

Quoted 16 lines · Lukasz Majewski

Proper description for Exynos4 bindings added to Documentation/devicetree/ bindings

---
 .../devicetree/bindings/thermal/exynos-thermal.txt |   22 ++++++++++++++++++++
 1 file changed, 22 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/thermal/exynos-thermal.txt
Documentation/devicetree/bindings/thermal/exynos-thermal.txt new file +0 -0
new file mode 100644
index 0000000..e994e1e

Documentation/devicetree/bindings/thermal/exynos-thermal.txt line 1

Quoted 1 line
Documentation/devicetree/bindings/thermal/exynos-thermal.txt new file +1 -0
@@ -0,0 +1,22 @@
+* Exynos Thermal

How about "Exynos Thermal Management Unit (TMU)"?

Documentation/devicetree/bindings/thermal/exynos-thermal.txt line 4

Quoted 3 lines
Documentation/devicetree/bindings/thermal/exynos-thermal.txt new file +3 -0
+
+Required properties:
+- compatible : "samsung,exynos4412-tmu"

Should be one of the following:
"samsung,exynos4210-tmu"
"samsung,exynos4412-tmu"
"samsung,exynos5250-tmu"

Documentation/devicetree/bindings/thermal/exynos-thermal.txt line 5

Quoted 1 line
Documentation/devicetree/bindings/thermal/exynos-thermal.txt new file +1 -0
+- interrupts-parent : The phandle for the interrupt controller

s/interrupts-parent /interrupt-parent

Documentation/devicetree/bindings/thermal/exynos-thermal.txt line 9

Quoted 4 lines
Documentation/devicetree/bindings/thermal/exynos-thermal.txt new file +4 -0
+- reg : Address range of the thermal registers
+- interrupts : Should contain interrupt for thermal system
+- clocks : The main clock for TMU device
+- clocks-names : Thermal system clock name

s/clocks-names /clock-names
You may also choose to add "from common clock binding" for clocks and clock-names properties above.

Documentation/devicetree/bindings/thermal/exynos-thermal.txt line 10

Quoted 1 line
Documentation/devicetree/bindings/thermal/exynos-thermal.txt new file +1 -0
+- status : Initial state of the device

You may remove this as it is quite obvious now. Even if you want to retain this, it should be under 'Optional properties:'

Signature · 2 lines
With warm regards,
Sachin
#22 lore raw

Re: [PATCH 5/6] thermal:exynos4: Enable support for Exynos4412 SoCs

In reply to Lukasz Majewski

Hi,

I have one suggestion,

Quoted 13 lines · Lukasz Majewski

Enable TMU support for Exynos4412 based target with device tree.

---
 drivers/thermal/exynos_thermal.c |    4 ++++
 1 file changed, 4 insertions(+)
drivers/thermal/exynos_thermal.c +0 -0
index e922fa4..f54066d 100644

drivers/thermal/exynos_thermal.c static const struct of_device_id exynos_tmu_match[] = { · line 824

Quoted 6 lines
drivers/thermal/exynos_thermal.c +3 -0
@@ -819,6 +819,10 @@ static const struct of_device_id exynos_tmu_match[] = {
                .data = (void *)EXYNOS4210_TMU_DRV_DATA,
        },
        {
+               .compatible = "samsung,exynos4412-tmu",
+               .data = (void *)EXYNOS_TMU_DRV_DATA,
+       },

Instead of adding a new compatible string, "exynos5250-tmu" name can be re-used in the 4412 DT node file as 4412 and 5250 TMU controller are same.

Thanks,
Amit Daniel

Quoted 11 lines
drivers/thermal/exynos_thermal.c +1 -1
+       {
                .compatible = "samsung,exynos5250-tmu",
                .data = (void *)EXYNOS_TMU_DRV_DATA,
        },
--

1.7.10.4

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

#23 lore raw

Re: [PATCH 5/6] thermal:exynos4: Enable support for Exynos4412 SoCs

Hi amit,

Quoted 14 lines

Hi,

I have one suggestion,

Quoted 8 lines · Lukasz Majewski

Enable TMU support for Exynos4412 based target with device tree.

---
 drivers/thermal/exynos_thermal.c |    4 ++++
 1 file changed, 4 insertions(+)
Quoted 14 lines

drivers/thermal/exynos_thermal.c static const struct of_device_id · line 824

Quoted 11 lines
(quoted diff) +0 -0

b/drivers/thermal/exynos_thermal.c index e922fa4..f54066d 100644

drivers/thermal/exynos_thermal.c +3 -0
@@ -819,6 +819,10 @@ static const struct of_device_id
 exynos_tmu_match[] = { .data = (void *)EXYNOS4210_TMU_DRV_DATA,
        },
        {
+               .compatible = "samsung,exynos4412-tmu",
+               .data = (void *)EXYNOS_TMU_DRV_DATA,
+       },

Instead of adding a new compatible string, "exynos5250-tmu" name can be re-used in the 4412 DT node file as 4412 and 5250 TMU controller are same.

Good point.

Quoted 15 lines

Thanks,
Amit Daniel

Quoted 12 lines
drivers/thermal/exynos_thermal.c +1 -1
+       {
                .compatible = "samsung,exynos5250-tmu",
                .data = (void *)EXYNOS_TMU_DRV_DATA,
        },
--

1.7.10.4

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

Signature · 5 lines
Best regards,

Lukasz Majewski

Samsung R&D Poland (SRPOL) | Linux Platform Group
#24 lore raw

Re: [PATCH 5/6] thermal:exynos4: Enable support for Exynos4412 SoCs

In reply to amit kachhap
Quoted 14 lines · amit kachhap

Hi,

I have one suggestion,

Quoted 8 lines · Lukasz Majewski

Enable TMU support for Exynos4412 based target with device tree.

---
 drivers/thermal/exynos_thermal.c |    4 ++++
 1 file changed, 4 insertions(+)
Quoted 14 lines

drivers/thermal/exynos_thermal.c static const struct of_device_id exynos_tmu_match[] = { · line 824

Quoted 11 lines
drivers/thermal/exynos_thermal.c +3 -0
index e922fa4..f54066d 100644
@@ -819,6 +819,10 @@ static const struct of_device_id exynos_tmu_match[] = {
                .data = (void *)EXYNOS4210_TMU_DRV_DATA,
        },
        {
+               .compatible = "samsung,exynos4412-tmu",
+               .data = (void *)EXYNOS_TMU_DRV_DATA,
+       },

Instead of adding a new compatible string, "exynos5250-tmu" name can be re-used in the 4412 DT node file as 4412 and 5250 TMU controller are same.

In cases where they are the same, it was generally the previous version of SoC that was added to the compatible list and re-used in the higher ones. IIRC, in cases where exynos5 based string was already defined a separate compatible string was added for exynos4 too (even if they used same driver data).

Signature · 2 lines
With warm regards,
Sachin
#29 lore raw
In reply to Lukasz Majewski
Quoted 15 lines · Lukasz Majewski

This patch series provide various fixes for TMU block.
Namely, support for common clock framework and proper regulator VDD_TS has been added.
Moreover device tree definitions and documentation entry are now in place.

Lukasz Majewski (6):
clk:exynos4:TMU Thermal Measurement Unit clock added to common clock
framework
thermal:exynos4: TMU Common clock framework support for TMU (Thermal
Monitoring Unit)
thermal:exynos4: TMU device tree support for Exynos4412 targets
thermal: Support for TMU regulator defined at device tree thermal:exynos4: Enable support for Exynos4412 SoCs thermal:exynos4: Add documentation for Exynos SoC thermal bindings

Quoted 8 lines
  .../devicetree/bindings/clock/exynos4-clock.txt    |    1 +
  .../devicetree/bindings/thermal/exynos-thermal.txt |   22 +++++++++++
  arch/arm/boot/dts/exynos4x12.dtsi                  |   10 +++++
  drivers/clk/samsung/clk-exynos4.c                  |    6 ++-
  drivers/thermal/exynos_thermal.c                   |   41 +++++++++++++++-----
  5 files changed, 70 insertions(+), 10 deletions(-)

create mode 100644 Documentation/devicetree/bindings/thermal/exynos-thermal.txt

Lukasz, please address comments from ml.

Others looks good to me.

- Kukjin

#5 lore raw

Re: [PATCH 2/6] thermal:exynos4: TMU Common clock framework support for TMU (Thermal Monitoring Unit)

In reply to Sachin Kamat

Hi Sachin,

Quoted 6 lines
Quoted 4 lines · Lukasz Majewski

This patch modifies exynos_thermal.c file to use clk_disable_unprepare() and clk_prepare_enable() instead of clk_{enable|disable}.

Quoted 8 lines
Quoted 3 lines

---

I have already submitted a similar patch for this:
http://permalink.gmane.org/gmane.linux.power-management.general/33310

Thanks for pointing to the correct patch.

However, I've got a question:

The patch only changes clock names at exynos_tmu_{probe|remove}.

Correct me if I'm wrong, but shouldn't we also change clock_enable to clk_prepare_enable at exynos_tmu_read()? (Are we guaranteed, that we will NOT sleep there?)

Signature · 5 lines
Best regards,

Lukasz Majewski

Samsung R&D Poland (SRPOL) | Linux Platform Group
#11 lore raw

Re: [PATCH 3/6] thermal:exynos4: TMU device tree support for Exynos4412 targets

In reply to Eduardo Valentin

Hi Eduardo,

Quoted 9 lines · Lukasz Majewski
Quoted 8 lines

Device tree support for TMU at Exynos4x12 targets.

---
  arch/arm/boot/dts/exynos4x12.dtsi |   10 ++++++++++
  1 file changed, 10 insertions(+)
Quoted 14 lines

arch/arm/boot/dts/exynos4x12.dtsi line 84

Quoted 11 lines
(quoted diff) +0 -0

b/arch/arm/boot/dts/exynos4x12.dtsi index e3380a7..ee920b3 100644

arch/arm/boot/dts/exynos4x12.dtsi +3 -0
@@ -79,4 +79,14 @@
  		interrupts = <0 89 0>;
  		status = "disabled";
  	};
+
+	tmu@100C0000 {
+		compatible = "samsung,exynos4412-tmu";

Is this one already documented?

The last commit in the series provide a documentation.

Quoted 10 lines
Quoted 10 lines
arch/arm/boot/dts/exynos4x12.dtsi +7 -0
+		interrupt-parent = <&combiner>;
+		reg = <0x100C0000 0x100>;
+		interrupts = <2 4>;
+		clocks = <&clock 383>;
+		clock-names = "tmu_apbif";
+		status = "disabled";
+	};
  };
Signature · 5 lines
Best regards,

Lukasz Majewski

Samsung R&D Poland (SRPOL) | Linux Platform Group
#13 lore raw

Re: [PATCH 3/6] thermal:exynos4: TMU device tree support for Exynos4412 targets

In reply to Sachin Kamat

Hi Sachin,

Quoted 4 lines

Hi Lukasz,

On 19 April 2013 22:08, Lukasz Majewski <[email protected]> wrote:

Quoted 8 lines
Quoted 4 lines

Device tree support for TMU at Exynos4x12 targets.

nit: Subject for these kind of patches should start with "ARM:
dts: ..."

Ok, I will correct that.

Quoted 1 line

Otherwise looks good to me.

Good :-)

Quoted 34 lines
Quoted 31 lines
---
 arch/arm/boot/dts/exynos4x12.dtsi |   10 ++++++++++
 1 file changed, 10 insertions(+)
(quoted diff) +0 -0

b/arch/arm/boot/dts/exynos4x12.dtsi index e3380a7..ee920b3 100644

arch/arm/boot/dts/exynos4x12.dtsi +10 -1
@@ -79,4 +79,14 @@
                interrupts = <0 89 0>;
                status = "disabled";
        };
+
+       tmu@100C0000 {
+               compatible = "samsung,exynos4412-tmu";
+               interrupt-parent = <&combiner>;
+               reg = <0x100C0000 0x100>;
+               interrupts = <2 4>;
+               clocks = <&clock 383>;
+               clock-names = "tmu_apbif";
+               status = "disabled";
+       };
 };
--

1.7.10.4

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

Signature · 5 lines
Best regards,

Lukasz Majewski

Samsung R&D Poland (SRPOL) | Linux Platform Group
#16 lore raw

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

In reply to Eduardo Valentin

Hi Eduardo,

Quoted 53 lines · Lukasz Majewski
Quoted 52 lines

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.

---
  drivers/thermal/exynos_thermal.c |   19 +++++++++++++++++++
  1 file changed, 19 insertions(+)
(quoted diff) +0 -0

b/drivers/thermal/exynos_thermal.c index ba6094c..e922fa4 100644

drivers/thermal/exynos_thermal.c +4 -0
@@ -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)

drivers/thermal/exynos_thermal.c +0 -0
@@ -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;
}

drivers/thermal/exynos_thermal.c +6 -0
+
+	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",

drivers/thermal/exynos_thermal.c +1 -0
+				EXYNOS_TMU_REGULATOR);
Quoted 8 lines

drivers/thermal/exynos_thermal.c

Quoted 7 lines
drivers/thermal/exynos_thermal.c +5 -0
+			return ret;
+		}
+	} else {
+		dev_info(&pdev->dev,
+			 "Regulator %s not defined at device

tree.\n",

drivers/thermal/exynos_thermal.c +1 -0
+			 EXYNOS_TMU_REGULATOR);

Maybe a dev_warn would fit better?

This is a bit tricky. I first wanted to return -ENODEV when regulator is not available. Then I understood, that some other SoCs (e.g. Exynos5) will not work.

The info here shall give a clear warn signal, that providing a regulator for VDD_TS is crucial (since by default it can be connected to other PMIC outputs and when other device puts down this regulator the TMU will crash and shut down a system).

Quoted 7 lines
Quoted 7 lines
drivers/thermal/exynos_thermal.c +2 -0
+	}
+
  	data = devm_kzalloc(&pdev->dev, sizeof(struct

exynos_tmu_data), GFP_KERNEL);
if (!data) {

Signature · 5 lines
Best regards,

Lukasz Majewski

Samsung R&D Poland (SRPOL) | Linux Platform Group
#27 lore raw

Re: [PATCH 6/6] thermal:exynos4: Add documentation for Exynos SoC thermal bindings

In reply to Sachin Kamat

Hi Sachin,

Quoted 27 lines

Hi Lukasz,

Thanks for adding this. Some comments inline.

Quoted 17 lines · Lukasz Majewski

Proper description for Exynos4 bindings added to
Documentation/devicetree/ bindings

---
 .../devicetree/bindings/thermal/exynos-thermal.txt |   22
++++++++++++++++++++ 1 file changed, 22 insertions(+)
 create mode 100644

Documentation/devicetree/bindings/thermal/exynos-thermal.txt

diff --git a/Documentation/devicetree/bindings/thermal/exynos-thermal.txt b/Documentation/devicetree/bindings/thermal/exynos-thermal.txt new file mode 100644 index 0000000..e994e1e --- /dev/null +++ b/Documentation/devicetree/bindings/thermal/exynos-thermal.txt

Documentation/devicetree/bindings/thermal/exynos-thermal.txt line 1

Quoted 1 line
Documentation/devicetree/bindings/thermal/exynos-thermal.txt new file +1 -0
@@ -0,0 +1,22 @@
+* Exynos Thermal

How about "Exynos Thermal Management Unit (TMU)"?

Quoted 6 lines

Documentation/devicetree/bindings/thermal/exynos-thermal.txt line 4

Quoted 3 lines
Documentation/devicetree/bindings/thermal/exynos-thermal.txt new file +3 -0
+
+Required properties:
+- compatible : "samsung,exynos4412-tmu"

Should be one of the following:
"samsung,exynos4210-tmu"
"samsung,exynos4412-tmu"

So all thee names shall be added? Right?

Quoted 14 lines

"samsung,exynos5250-tmu"

Documentation/devicetree/bindings/thermal/exynos-thermal.txt line 5

Quoted 1 line
Documentation/devicetree/bindings/thermal/exynos-thermal.txt new file +1 -0
+- interrupts-parent : The phandle for the interrupt controller

s/interrupts-parent /interrupt-parent

Documentation/devicetree/bindings/thermal/exynos-thermal.txt line 9

Quoted 4 lines
Documentation/devicetree/bindings/thermal/exynos-thermal.txt new file +4 -0
+- reg : Address range of the thermal registers
+- interrupts : Should contain interrupt for thermal system
+- clocks : The main clock for TMU device
+- clocks-names : Thermal system clock name
Quoted 9 lines

s/clocks-names /clock-names
You may also choose to add "from common clock binding" for clocks and clock-names properties above.

Documentation/devicetree/bindings/thermal/exynos-thermal.txt line 10

Quoted 1 line
Documentation/devicetree/bindings/thermal/exynos-thermal.txt new file +1 -0
+- status : Initial state of the device

You may remove this as it is quite obvious now. Even if you want to retain this, it should be under 'Optional properties:'

Ok, I will correct those names.

Signature · 5 lines
Best regards,

Lukasz Majewski

Samsung R&D Poland (SRPOL) | Linux Platform Group
#30 lore raw
In reply to Kukjin Kim

Hi Kukjin,

Quoted 27 lines · Lukasz Majewski
Quoted 17 lines

This patch series provide various fixes for TMU block. Namely, support for common clock framework and proper regulator VDD_TS has been added.
Moreover device tree definitions and documentation entry are now in place.

Lukasz Majewski (6):
clk:exynos4:TMU Thermal Measurement Unit clock added to common
clock framework
thermal:exynos4: TMU Common clock framework support for TMU
(Thermal Monitoring Unit)
thermal:exynos4: TMU device tree support for Exynos4412 targets
thermal: Support for TMU regulator defined at device tree thermal:exynos4: Enable support for Exynos4412 SoCs thermal:exynos4: Add documentation for Exynos SoC thermal
bindings

Quoted 9 lines
  .../devicetree/bindings/clock/exynos4-clock.txt    |    1 +
  .../devicetree/bindings/thermal/exynos-thermal.txt |   22

+++++++++++ arch/arm/boot/dts/exynos4x12.dtsi |
10 +++++ drivers/clk/samsung/clk-exynos4.c | 6
++- drivers/thermal/exynos_thermal.c | 41
+++++++++++++++----- 5 files changed, 70 insertions(+), 10 deletions(-) create mode 100644 Documentation/devicetree/bindings/thermal/exynos-thermal.txt

Quoted 2 lines

Lukasz, please address comments from ml.

Ok. I'm going to prepare v2

Quoted 3 lines

Others looks good to me.

- Kukjin

Signature · 5 lines
Best regards,

Lukasz Majewski

Samsung R&D Poland (SRPOL) | Linux Platform Group
#28 lore raw

Re: [PATCH 6/6] thermal:exynos4: Add documentation for Exynos SoC thermal bindings

In reply to Lukasz Majewski

Hi Lukasz,

Quoted 29 lines · Lukasz Majewski

Hi Sachin,

Quoted 27 lines

Hi Lukasz,

Thanks for adding this. Some comments inline.

Quoted 17 lines · Lukasz Majewski

Proper description for Exynos4 bindings added to
Documentation/devicetree/ bindings

---
 .../devicetree/bindings/thermal/exynos-thermal.txt |   22
++++++++++++++++++++ 1 file changed, 22 insertions(+)
 create mode 100644

Documentation/devicetree/bindings/thermal/exynos-thermal.txt

diff --git a/Documentation/devicetree/bindings/thermal/exynos-thermal.txt b/Documentation/devicetree/bindings/thermal/exynos-thermal.txt new file mode 100644 index 0000000..e994e1e --- /dev/null +++ b/Documentation/devicetree/bindings/thermal/exynos-thermal.txt

Documentation/devicetree/bindings/thermal/exynos-thermal.txt line 1

Quoted 1 line
Documentation/devicetree/bindings/thermal/exynos-thermal.txt new file +1 -0
@@ -0,0 +1,22 @@
+* Exynos Thermal

How about "Exynos Thermal Management Unit (TMU)"?

Quoted 8 lines
Quoted 6 lines

Documentation/devicetree/bindings/thermal/exynos-thermal.txt line 4

Quoted 3 lines
Documentation/devicetree/bindings/thermal/exynos-thermal.txt new file +3 -0
+
+Required properties:
+- compatible : "samsung,exynos4412-tmu"

Should be one of the following:
"samsung,exynos4210-tmu"
"samsung,exynos4412-tmu"

So all thee names shall be added? Right?

Yes, you need to add all supported compatible strings.

---
With warm regards,
Sachin

#6 lore raw

Re: [PATCH 2/6] thermal:exynos4: TMU Common clock framework support for TMU (Thermal Monitoring Unit)

In reply to Lukasz Majewski

Hi Lukasz,

Quoted 19 lines · Lukasz Majewski

Hi Sachin,

Quoted 6 lines
Quoted 4 lines · Lukasz Majewski

This patch modifies exynos_thermal.c file to use clk_disable_unprepare() and clk_prepare_enable() instead of clk_{enable|disable}.

Quoted 8 lines
Quoted 3 lines

---

I have already submitted a similar patch for this:
http://permalink.gmane.org/gmane.linux.power-management.general/33310

Thanks for pointing to the correct patch.

Quoted 7 lines

However, I've got a question:

The patch only changes clock names at exynos_tmu_{probe|remove}.

Correct me if I'm wrong, but shouldn't we also change clock_enable to clk_prepare_enable at exynos_tmu_read()? (Are we guaranteed, that we will NOT sleep there?)

Since clk_prepare does not do anything, i thought it was sufficient to have it once in probe and then unprepare in remove.
Do you see a real problem in this implementation. If so I can update it to use clk_prepare_enable at other places as well.

Signature · 2 lines
With warm regards,
Sachin
#31 lore raw
In reply to Lukasz Majewski

Hi Lukasz,

Quoted 29 lines · Lukasz Majewski

Hi Kukjin,

Quoted 27 lines · Lukasz Majewski
Quoted 26 lines

This patch series provide various fixes for TMU block. Namely, support for common clock framework and proper regulator VDD_TS has been added.
Moreover device tree definitions and documentation entry are now in place.

Lukasz Majewski (6):
clk:exynos4:TMU Thermal Measurement Unit clock added to common
clock framework
thermal:exynos4: TMU Common clock framework support for TMU
(Thermal Monitoring Unit)
thermal:exynos4: TMU device tree support for Exynos4412 targets
thermal: Support for TMU regulator defined at device tree thermal:exynos4: Enable support for Exynos4412 SoCs thermal:exynos4: Add documentation for Exynos SoC thermal
bindings

  .../devicetree/bindings/clock/exynos4-clock.txt    |    1 +
  .../devicetree/bindings/thermal/exynos-thermal.txt |   22

+++++++++++ arch/arm/boot/dts/exynos4x12.dtsi |
10 +++++ drivers/clk/samsung/clk-exynos4.c | 6
++- drivers/thermal/exynos_thermal.c | 41
+++++++++++++++----- 5 files changed, 70 insertions(+), 10 deletions(-) create mode 100644 Documentation/devicetree/bindings/thermal/exynos-thermal.txt

Quoted 4 lines
Quoted 2 lines

Lukasz, please address comments from ml.

Ok. I'm going to prepare v2

Please respin your v2 on top of my 3 patches to avoid merge conflicts.

Signature · 2 lines
With warm regards,
Sachin
#32 lore raw

Hi Sachin,

Quoted 33 lines

Hi Lukasz,

Quoted 29 lines · Lukasz Majewski

Hi Kukjin,

Quoted 27 lines · Lukasz Majewski
Quoted 26 lines

This patch series provide various fixes for TMU block. Namely, support for common clock framework and proper regulator VDD_TS has been added.
Moreover device tree definitions and documentation entry are now in place.

Lukasz Majewski (6):
clk:exynos4:TMU Thermal Measurement Unit clock added to common
clock framework
thermal:exynos4: TMU Common clock framework support for TMU
(Thermal Monitoring Unit)
thermal:exynos4: TMU device tree support for Exynos4412
targets thermal: Support for TMU regulator defined at device tree
thermal:exynos4: Enable support for Exynos4412 SoCs thermal:exynos4: Add documentation for Exynos SoC thermal
bindings

  .../devicetree/bindings/clock/exynos4-clock.txt    |    1 +
  .../devicetree/bindings/thermal/exynos-thermal.txt |   22

+++++++++++ arch/arm/boot/dts/exynos4x12.dtsi |
10 +++++ drivers/clk/samsung/clk-exynos4.c |
6 ++- drivers/thermal/exynos_thermal.c | 41
+++++++++++++++----- 5 files changed, 70 insertions(+), 10 deletions(-) create mode 100644 Documentation/devicetree/bindings/thermal/exynos-thermal.txt

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

Lukasz, please address comments from ml.

Ok. I'm going to prepare v2

Please respin your v2 on top of my 3 patches to avoid merge conflicts.

No problem.

Yours patches to be applied:

[PATCH 1/1] clk: exynos4: Add clock entries for TMU [PATCH 1/2] Thermal: exynos: Add clk_{un}prepare APIs [PATCH 2/2] Thermal: exynos: Add compatible string for exynos4412

Thanks for information.

Signature · 5 lines
Best regards,

Lukasz Majewski

Samsung R&D Poland (SRPOL) | Linux Platform Group
#7 lore raw

Re: [PATCH 2/6] thermal:exynos4: TMU Common clock framework support for TMU (Thermal Monitoring Unit)

In reply to Sachin Kamat

Hi Sachin,

Quoted 27 lines

Hi Lukasz,

Quoted 23 lines · Lukasz Majewski

Hi Sachin,

Quoted 6 lines
Quoted 4 lines · Lukasz Majewski

This patch modifies exynos_thermal.c file to use clk_disable_unprepare() and clk_prepare_enable() instead of clk_{enable|disable}.

Quoted 8 lines
Quoted 3 lines

---

I have already submitted a similar patch for this:
http://permalink.gmane.org/gmane.linux.power-management.general/33310

Thanks for pointing to the correct patch.

However, I've got a question:

The patch only changes clock names at exynos_tmu_{probe|remove}.

Quoted 9 lines
Quoted 3 lines

Correct me if I'm wrong, but shouldn't we also change clock_enable to clk_prepare_enable at exynos_tmu_read()? (Are we guaranteed, that we will NOT sleep there?)

Since clk_prepare does not do anything, i thought it was sufficient to have it once in probe and then unprepare in remove.
Do you see a real problem in this implementation. If so I can update it to use clk_prepare_enable at other places as well.

I just wanted to stick to the common clock new API. It seems to me that exynos_tmu_read() might sleep, but I'm quite novice at TMU :-).

If yours patches work, then we shall apply them.

I will do my best to test yours three patches ASAP on my setup.

Signature · 5 lines
Best regards,

Lukasz Majewski

Samsung R&D Poland (SRPOL) | Linux Platform Group
#8 lore raw

Re: [PATCH 2/6] thermal:exynos4: TMU Common clock framework support for TMU (Thermal Monitoring Unit)

Hi Lukasz,

Quoted 7 lines · Lukasz Majewski
Quoted 1 line

I just wanted to stick to the common clock new API. It seems to me that exynos_tmu_read() might sleep, but I'm quite novice at TMU :-).

If yours patches work, then we shall apply them.

I will do my best to test yours three patches ASAP on my setup.

Thanks. Please let me know if it works for you.

Signature · 2 lines
With warm regards,
Sachin
#17 lore raw

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

In reply to Lukasz Majewski
Quoted 64 lines · Lukasz Majewski

Hi Eduardo,

Quoted 53 lines · Lukasz Majewski
Quoted 52 lines

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.

---
   drivers/thermal/exynos_thermal.c |   19 +++++++++++++++++++
   1 file changed, 19 insertions(+)
(quoted diff) +0 -0

b/drivers/thermal/exynos_thermal.c index ba6094c..e922fa4 100644

drivers/thermal/exynos_thermal.c +4 -0
@@ -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)
drivers/thermal/exynos_thermal.c +0 -0
@@ -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;
   	}
drivers/thermal/exynos_thermal.c +6 -0
+
+	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",

drivers/thermal/exynos_thermal.c +1 -0
+				EXYNOS_TMU_REGULATOR);
Quoted 8 lines

drivers/thermal/exynos_thermal.c

Quoted 7 lines
drivers/thermal/exynos_thermal.c +5 -0
+			return ret;
+		}
+	} else {
+		dev_info(&pdev->dev,
+			 "Regulator %s not defined at device

tree.\n",

drivers/thermal/exynos_thermal.c +1 -0
+			 EXYNOS_TMU_REGULATOR);

Maybe a dev_warn would fit better?

Quoted 8 lines

This is a bit tricky. I first wanted to return -ENODEV when regulator is not available. Then I understood, that some other SoCs (e.g. Exynos5) will not work.

The info here shall give a clear warn signal, that providing a regulator for VDD_TS is crucial (since by default it can be connected to other PMIC outputs and when other device puts down this regulator the TMU will crash and shut down a system).

OK. I understand your point. Well, it depends on how you want to design your driver. This is a clear case for having some sort of required feature set bitmap, for instance. Each supported soc for your driver would then have a bitmap indicating which features it actually supports. Based on the bitmap you make it mandatory on your regulator_get treatment. If it is mandatory, then you must clearly return an error code. I have done a similar thing for the ti-soc-thermal driver (drivers/staging/ti-soc-thermal/).

But again, this is your call, not sure if you want to go for that design just for this item,

Still, if you keep the code the way it is, I d request to change your message level to dev_warn. And in case you have a way to determine it is a mandatory entry, then to dev_err

Quoted 11 lines
Quoted 8 lines
Quoted 8 lines
drivers/thermal/exynos_thermal.c +2 -0
+	}
+
   	data = devm_kzalloc(&pdev->dev, sizeof(struct
exynos_tmu_data), GFP_KERNEL);
   	if (!data) {
#33 lore raw

v2 cover Thermal:exynos: Thermal Measurement Unit fix and Samsung SoCs support

In reply to Lukasz Majewski

This patch series provide various fixes for TMU block.
First of all it fixes a problem with get_cpu_frequency() lockup at cpu_cooling.c.

Secondly a proper regulator definition (VDD_TS) has been added. Moreover device tree definitions and documentation entry are now in place.

Dependencies (those patches shall be applied on top of):
- "clk: exynos4: Add clock entries for TMU"
- "Thermal: exynos: Add clk_{un}prepare APIs"
- "Thermal: exynos: Add compatible string for exynos4412"

Lukasz Majewski (4):
ARM: dts: thermal: exynos4: TMU device tree support for Exynos4412
targets
Thermal: exynos: Support for TMU regulator defined at device tree
ARM: dts: thermal: exynos4: Add documentation for Exynos SoC thermal
bindings
ARM:TMU:fix: Avoid lockup when first frequency table entry is
CPUFREQ_ENTRY_INVALID

 .../devicetree/bindings/thermal/exynos-thermal.txt |   25 ++++++++++++++++++++
 arch/arm/boot/dts/exynos4x12.dtsi                  |   10 ++++++++
 drivers/thermal/cpu_cooling.c                      |    3 +--
 drivers/thermal/exynos_thermal.c                   |   19 +++++++++++++++
 4 files changed, 55 insertions(+), 2 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/thermal/exynos-thermal.txt
Signature · 1 line
1.7.10.4
#34 lore raw

PATCH v2 1/4 ARM: dts: thermal: exynos4: TMU device tree support for Exynos4412 targets

Device tree support for TMU at Exynos4x12 targets.

---
Changes for v2:
- None

---
 arch/arm/boot/dts/exynos4x12.dtsi |   10 ++++++++++
 1 file changed, 10 insertions(+)
arch/arm/boot/dts/exynos4x12.dtsi +10 -0
index e3380a7..ee920b3 100644
@@ -79,4 +79,14 @@
 		interrupts = <0 89 0>;
 		status = "disabled";
 	};
+
+	tmu@100C0000 {
+		compatible = "samsung,exynos4412-tmu";
+		interrupt-parent = <&combiner>;
+		reg = <0x100C0000 0x100>;
+		interrupts = <2 4>;
+		clocks = <&clock 383>;
+		clock-names = "tmu_apbif";
+		status = "disabled";
+	};
 };
Signature · 1 line
1.7.10.4
#37 lore raw

PATCH v2 2/4 Thermal: exynos: Support for TMU regulator defined at device tree

In reply to Lukasz Majewski

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.

---
Changes for v2:
- Change dev_info() to dev_warn()

---
 drivers/thermal/exynos_thermal.c |   19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
drivers/thermal/exynos_thermal.c +19 -0
index 3d6e32a..328fe7e 100644
@@ -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;
@@ -948,6 +951,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)
@@ -957,6 +961,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_warn(&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) {
Signature · 1 line
1.7.10.4
#45 lore raw

PATCH v2 3/4 ARM: dts: thermal: exynos4: Add documentation for Exynos SoC thermal bindings

In reply to Lukasz Majewski

Proper description for Exynos4 bindings added to Documentation/devicetree/ bindings

---
Changes for v2:
- Documentation extension according to ML feedback

---
 .../devicetree/bindings/thermal/exynos-thermal.txt |   25 ++++++++++++++++++++
 1 file changed, 25 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/thermal/exynos-thermal.txt
Documentation/devicetree/bindings/thermal/exynos-thermal.txt new file +25 -0
new file mode 100644
index 0000000..535fd0e
@@ -0,0 +1,25 @@
+* Exynos Thermal Management Unit (TMU)
+
+** Required properties:
+
+- compatible : One of the following:
+	       "samsung,exynos4412-tmu"
+	       "samsung,exynos4210-tmu"
+	       "samsung,exynos5250-tmu"
+- interrupt-parent : The phandle for the interrupt controller
+- reg : Address range of the thermal registers
+- interrupts : Should contain interrupt for thermal system
+- clocks : The main clock for TMU device
+- clock-names : Thermal system clock name
+
+Example:
+
+	tmu@100C0000 {
+		compatible = "samsung,exynos4412-tmu";
+		interrupt-parent = <&combiner>;
+		reg = <0x100C0000 0x100>;
+		interrupts = <2 4>;
+		clocks = <&clock 383>;
+		clock-names = "tmu_apbif";
+		status = "disabled";
+	};
Signature · 1 line
1.7.10.4
#48 lore raw

PATCH v2 4/4 ARM:TMU:fix: Avoid lockup when first frequency table entry is CPUFREQ_ENTRY_INVALID

In reply to Lukasz Majewski

With the while loop, when i=0 and first entry in the frequency table is CPUFREQ_ENTRY_INVALID, the code results in an endless loop (since i is not incremented).

To fix this problem the for loop has been chosen. Incrementing i in the for end block solves the problem.

---
Changes for v2:
- New in v2

---
 drivers/thermal/cpu_cooling.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/thermal/cpu_cooling.c +1 -2
index 8dc44cb..df79f5e8 100644
@@ -124,7 +124,7 @@ static unsigned int get_cpu_frequency(unsigned int cpu, unsigned long level)
 	if (!table)
 		return ret;
 
-	while (table[i].frequency != CPUFREQ_TABLE_END) {
+	for (; table[i].frequency != CPUFREQ_TABLE_END; i++) {
 		if (table[i].frequency == CPUFREQ_ENTRY_INVALID)
 			continue;
 
@@ -138,7 +138,6 @@ static unsigned int get_cpu_frequency(unsigned int cpu, unsigned long level)
 		/*return if level matched and table in descending order*/
 		if (descend && i == level)
 			return table[i].frequency;
-		i++;
 	}
 	i--;
 
Signature · 1 line
1.7.10.4
#38 lore raw

Re: [PATCH v2 2/4] Thermal: exynos: Support for TMU regulator defined at device tree

In reply to Lukasz Majewski

Hi Lukasz Majewski,

Sorry for late review but I am currently working on restructuring the whole exynos thermal driver and this support of LDO can be added as feature as not all socs support this. This is also suggested by Eduardo. All your other patches looks fine.

Thanks,
Amit Daniel

Quoted 71 lines · Lukasz Majewski

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.

---
Changes for v2:
- Change dev_info() to dev_warn()

---
 drivers/thermal/exynos_thermal.c |   19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
drivers/thermal/exynos_thermal.c +19 -1
index 3d6e32a..328fe7e 100644
@@ -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;
@@ -948,6 +951,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)
@@ -957,6 +961,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_warn(&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 [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#39 lore raw

Re: [PATCH v2 2/4] Thermal: exynos: Support for TMU regulator defined at device tree

Hi Amit,

Quoted 6 lines

Hi Lukasz Majewski,

Sorry for late review but I am currently working on restructuring the whole exynos thermal driver and this support of LDO can be added as feature as not all socs support this. This is also suggested by Eduardo. All your other patches looks fine.

But this is how it is already done. The VDD_TS is optional, so Exynos5440 and Exynos4210 will not be broken.

This shall preserve the correct behavior of the thermal driver.

Quoted 81 lines

Thanks,
Amit Daniel

Quoted 75 lines · Lukasz Majewski

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.

---
Changes for v2:
- Change dev_info() to dev_warn()

---
 drivers/thermal/exynos_thermal.c |   19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
(quoted diff) +0 -0

b/drivers/thermal/exynos_thermal.c index 3d6e32a..328fe7e 100644

drivers/thermal/exynos_thermal.c +4 -0
@@ -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;
@@ -948,6 +951,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)
drivers/thermal/exynos_thermal.c +0 -0
@@ -957,6 +961,21 @@ static int exynos_tmu_probe(struct

platform_device *pdev) dev_err(&pdev->dev, "No platform init data

supplied.\n"); return -ENODEV;
        }
drivers/thermal/exynos_thermal.c +6 -0
+
+       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",

drivers/thermal/exynos_thermal.c +6 -0
+                               EXYNOS_TMU_REGULATOR);
+                       return ret;
+               }
+       } else {
+               dev_warn(&pdev->dev,
+                        "Regulator %s not defined at device

tree.\n",

drivers/thermal/exynos_thermal.c +3 -0
+                        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 [email protected] More majordomo info at
http://vger.kernel.org/majordomo-info.html

Signature · 5 lines
Best regards,

Lukasz Majewski

Samsung R&D Poland (SRPOL) | Linux Platform Group
#49 lore raw

Re: [PATCH v2 4/4] ARM:TMU:fix: Avoid lockup when first frequency table entry is CPUFREQ_ENTRY_INVALID

In reply to Lukasz Majewski

Lukasz,

Quoted 4 lines · Lukasz Majewski

With the while loop, when i=0 and first entry in the frequency table is CPUFREQ_ENTRY_INVALID, the code results in an endless loop (since i is not incremented).

Quoted 8 lines

To fix this problem the for loop has been chosen. Incrementing i in the for end block solves the problem.

---
Changes for v2:
- New in v2

This patch wont apply on Rui's tree.

I believe this has been already fixed on Rui's tree (next branch).
Could you please check if the commit below fix your issue:
git.kernel.org/cgit/linux/kernel/git/rzhang/linux.git/commit/?h=thermal&id=fc35b35cbe24ef021ea9acfba21e54da958df747

commit fc35b35cbe24ef021ea9acfba21e54da958df747

Author: Zhang Rui <[email protected]>
Date:   Fri Feb 8 13:09:32 2013 +0800

Thermal: cpufreq cooling: fix parsing per_cpu cpufreq_frequency_table

Quoted 26 lines
---
  drivers/thermal/cpu_cooling.c |    3 +--
  1 file changed, 1 insertion(+), 2 deletions(-)
drivers/thermal/cpu_cooling.c +1 -2
index 8dc44cb..df79f5e8 100644
@@ -124,7 +124,7 @@ static unsigned int get_cpu_frequency(unsigned int cpu, unsigned long level)
  	if (!table)
  		return ret;
 
-	while (table[i].frequency != CPUFREQ_TABLE_END) {
+	for (; table[i].frequency != CPUFREQ_TABLE_END; i++) {
  		if (table[i].frequency == CPUFREQ_ENTRY_INVALID)
  			continue;
 
@@ -138,7 +138,6 @@ static unsigned int get_cpu_frequency(unsigned int cpu, unsigned long level)
  		/*return if level matched and table in descending order*/
  		if (descend && i == level)
  			return table[i].frequency;
-		i++;
  	}
  	i--;
 
#50 lore raw

Re: [PATCH v2 4/4] ARM:TMU:fix: Avoid lockup when first frequency table entry is CPUFREQ_ENTRY_INVALID

Hi Eduardo,

Quoted 22 lines

Lukasz,

Quoted 4 lines · Lukasz Majewski

With the while loop, when i=0 and first entry in the frequency table is CPUFREQ_ENTRY_INVALID, the code results in an endless loop (since i is not incremented).

Quoted 8 lines

To fix this problem the for loop has been chosen. Incrementing i in the for end block solves the problem.

---
Changes for v2:
- New in v2

This patch wont apply on Rui's tree.

I believe this has been already fixed on Rui's tree (next branch).
Could you please check if the commit below fix your issue:
git.kernel.org/cgit/linux/kernel/git/rzhang/linux.git/commit/?h=thermal&id=fc35b35cbe24ef021ea9acfba21e54da958df747

Quoted 7 lines

commit fc35b35cbe24ef021ea9acfba21e54da958df747

Author: Zhang Rui <[email protected]>
Date:   Fri Feb 8 13:09:32 2013 +0800

Thermal: cpufreq cooling: fix parsing per_cpu
cpufreq_frequency_table

Thanks for pointing out. It seems, that this function fixes this problem.

As a side note, is this problem fixed at stable kernels?

Quoted 28 lines
Quoted 28 lines

---
  drivers/thermal/cpu_cooling.c |    3 +--
  1 file changed, 1 insertion(+), 2 deletions(-)
(quoted diff) +0 -0

b/drivers/thermal/cpu_cooling.c index 8dc44cb..df79f5e8 100644

drivers/thermal/cpu_cooling.c +1 -1
@@ -124,7 +124,7 @@ static unsigned int get_cpu_frequency(unsigned
 int cpu, unsigned long level) if (!table)
  		return ret;
 
-	while (table[i].frequency != CPUFREQ_TABLE_END) {
+	for (; table[i].frequency != CPUFREQ_TABLE_END; i++) {
  		if (table[i].frequency == CPUFREQ_ENTRY_INVALID)
  			continue;
 
@@ -138,7 +138,6 @@ static unsigned int get_cpu_frequency(unsigned

int cpu, unsigned long level) /*return if level matched and table in descending order*/ if (descend && i == level)
return table[i].frequency;

drivers/thermal/cpu_cooling.c +0 -1
-		i++;
  	}
  	i--;
Signature · 5 lines
Best regards,

Lukasz Majewski

Samsung R&D Poland (SRPOL) | Linux Platform Group
#51 lore raw

Re: [PATCH v2 4/4] ARM:TMU:fix: Avoid lockup when first frequency table entry is CPUFREQ_ENTRY_INVALID

Quoted 28 lines · Lukasz Majewski

Hi Eduardo,

Quoted 26 lines

Lukasz,

Quoted 4 lines · Lukasz Majewski

With the while loop, when i=0 and first entry in the frequency table is CPUFREQ_ENTRY_INVALID, the code results in an endless loop (since i is not incremented).

Quoted 8 lines

To fix this problem the for loop has been chosen. Incrementing i in the for end block solves the problem.

---
Changes for v2:
- New in v2

This patch wont apply on Rui's tree.

I believe this has been already fixed on Rui's tree (next branch).
Could you please check if the commit below fix your issue:
git.kernel.org/cgit/linux/kernel/git/rzhang/linux.git/commit/?h=thermal&id=fc35b35cbe24ef021ea9acfba21e54da958df747

commit fc35b35cbe24ef021ea9acfba21e54da958df747

Author: Zhang Rui <[email protected]>
Date:   Fri Feb 8 13:09:32 2013 +0800
Quoted 6 lines
Quoted 3 lines

Thermal: cpufreq cooling: fix parsing per_cpu
cpufreq_frequency_table

Thanks for pointing out. It seems, that this function fixes this problem.

OK.

Quoted 2 lines

As a side note, is this problem fixed at stable kernels?

Good question, probably not!

Quoted 32 lines
Quoted 29 lines
Quoted 29 lines


---
   drivers/thermal/cpu_cooling.c |    3 +--
   1 file changed, 1 insertion(+), 2 deletions(-)
(quoted diff) +0 -0

b/drivers/thermal/cpu_cooling.c index 8dc44cb..df79f5e8 100644

drivers/thermal/cpu_cooling.c +1 -1
@@ -124,7 +124,7 @@ static unsigned int get_cpu_frequency(unsigned
 int cpu, unsigned long level) if (!table)
   		return ret;
 
-	while (table[i].frequency != CPUFREQ_TABLE_END) {
+	for (; table[i].frequency != CPUFREQ_TABLE_END; i++) {
   		if (table[i].frequency == CPUFREQ_ENTRY_INVALID)
   			continue;
 
@@ -138,7 +138,6 @@ static unsigned int get_cpu_frequency(unsigned

int cpu, unsigned long level) /*return if level matched and table in descending order*/ if (descend && i == level)
return table[i].frequency;

drivers/thermal/cpu_cooling.c +0 -1
-		i++;
   	}
   	i--;
#52 lore raw

Re: [PATCH v2 0/4] Thermal:exynos: Thermal Measurement Unit fix and Samsung SoCs support

In reply to Lukasz Majewski

Hello Lukasz,

Quoted 8 lines · Lukasz Majewski

This patch series provide various fixes for TMU block.
First of all it fixes a problem with get_cpu_frequency() lockup at cpu_cooling.c.

Secondly a proper regulator definition (VDD_TS) has been added. Moreover device tree definitions and documentation entry are now in place.

Dependencies (those patches shall be applied on top of):
- "clk: exynos4: Add clock entries for TMU"

Is this one same as [1/6] clk:exynos4:TMU Thermal Measurement Unit clock added to common clock framework in your previous series?

Quoted 1 line

- "Thermal: exynos: Add clk_{un}prepare APIs"

Same as
thermal:exynos4: TMU Common clock framework support for TMU (Thermal Monitoring Unit) in your previous series?

Quoted 2 lines

- "Thermal: exynos: Add compatible string for exynos4412"

This should be same as thermal:exynos4: Enable support for Exynos4412 SoCs in your previous series?

Quoted 9 lines

Lukasz Majewski (4):
ARM: dts: thermal: exynos4: TMU device tree support for Exynos4412
targets
Thermal: exynos: Support for TMU regulator defined at device tree
ARM: dts: thermal: exynos4: Add documentation for Exynos SoC thermal
bindings
ARM:TMU:fix: Avoid lockup when first frequency table entry is
CPUFREQ_ENTRY_INVALID

The above, as stated at the patch may not be needed.

Quoted 8 lines
  .../devicetree/bindings/thermal/exynos-thermal.txt |   25 ++++++++++++++++++++
  arch/arm/boot/dts/exynos4x12.dtsi                  |   10 ++++++++
  drivers/thermal/cpu_cooling.c                      |    3 +--
  drivers/thermal/exynos_thermal.c                   |   19 +++++++++++++++
  4 files changed, 55 insertions(+), 2 deletions(-)

create mode 100644 Documentation/devicetree/bindings/thermal/exynos-thermal.txt

#40 lore raw

Re: [PATCH v2 2/4] Thermal: exynos: Support for TMU regulator defined at device tree

In reply to Lukasz Majewski

Amit, Lukasz,

Quoted 9 lines · Lukasz Majewski

Hi Amit,

Quoted 6 lines

Hi Lukasz Majewski,

Sorry for late review but I am currently working on restructuring the whole exynos thermal driver and this support of LDO can be added as feature as not all socs support this. This is also suggested by Eduardo. All your other patches looks fine.

Quoted 5 lines

But this is how it is already done. The VDD_TS is optional, so Exynos5440 and Exynos4210 will not be broken.

This shall preserve the correct behavior of the thermal driver.

If you guys plan to move to feature based approach, like suggested in V1, then Id recommend adding a /* TODO: */ entry in your driver.

Amit, are you including this LDO support on your rework?

Quoted 84 lines
Quoted 81 lines

Thanks,
Amit Daniel

Quoted 75 lines · Lukasz Majewski

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.

---
Changes for v2:
- Change dev_info() to dev_warn()

---
  drivers/thermal/exynos_thermal.c |   19 +++++++++++++++++++
  1 file changed, 19 insertions(+)
(quoted diff) +0 -0

b/drivers/thermal/exynos_thermal.c index 3d6e32a..328fe7e 100644

drivers/thermal/exynos_thermal.c +4 -0
@@ -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;
@@ -948,6 +951,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)
drivers/thermal/exynos_thermal.c +0 -0
@@ -957,6 +961,21 @@ static int exynos_tmu_probe(struct

platform_device *pdev) dev_err(&pdev->dev, "No platform init data

supplied.\n"); return -ENODEV;
         }
drivers/thermal/exynos_thermal.c +6 -0
+
+       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",

drivers/thermal/exynos_thermal.c +6 -0
+                               EXYNOS_TMU_REGULATOR);
+                       return ret;
+               }
+       } else {
+               dev_warn(&pdev->dev,
+                        "Regulator %s not defined at device

tree.\n",

drivers/thermal/exynos_thermal.c +3 -0
+                        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 [email protected] More majordomo info at
http://vger.kernel.org/majordomo-info.html

Acked-by on v2 1/4
#35 lore raw

Re: [PATCH v2 1/4] ARM: dts: thermal: exynos4: TMU device tree support for Exynos4412 targets

In reply to Lukasz Majewski
Quoted 4 lines · Lukasz Majewski

Device tree support for TMU at Exynos4x12 targets.

This patch looks good to me:

Quoted 27 lines

---
Changes for v2:
- None

---
  arch/arm/boot/dts/exynos4x12.dtsi |   10 ++++++++++
  1 file changed, 10 insertions(+)
arch/arm/boot/dts/exynos4x12.dtsi +10 -0
index e3380a7..ee920b3 100644
@@ -79,4 +79,14 @@
  		interrupts = <0 89 0>;
  		status = "disabled";
  	};
+
+	tmu@100C0000 {
+		compatible = "samsung,exynos4412-tmu";
+		interrupt-parent = <&combiner>;
+		reg = <0x100C0000 0x100>;
+		interrupts = <2 4>;
+		clocks = <&clock 383>;
+		clock-names = "tmu_apbif";
+		status = "disabled";
+	};
  };
Reviewed-by on v2 3/4
#46 lore raw

Re: [PATCH v2 3/4] ARM: dts: thermal: exynos4: Add documentation for Exynos SoC thermal bindings

In reply to Lukasz Majewski
Quoted 5 lines · Lukasz Majewski

Proper description for Exynos4 bindings added to Documentation/devicetree/ bindings

I am fine with this one too.

Quoted 40 lines

---
Changes for v2:
- Documentation extension according to ML feedback

---
  .../devicetree/bindings/thermal/exynos-thermal.txt |   25 ++++++++++++++++++++
  1 file changed, 25 insertions(+)

create mode 100644 Documentation/devicetree/bindings/thermal/exynos-thermal.txt

Documentation/devicetree/bindings/thermal/exynos-thermal.txt new file +25 -0
new file mode 100644
index 0000000..535fd0e
@@ -0,0 +1,25 @@
+* Exynos Thermal Management Unit (TMU)
+
+** Required properties:
+
+- compatible : One of the following:
+	       "samsung,exynos4412-tmu"
+	       "samsung,exynos4210-tmu"
+	       "samsung,exynos5250-tmu"
+- interrupt-parent : The phandle for the interrupt controller
+- reg : Address range of the thermal registers
+- interrupts : Should contain interrupt for thermal system
+- clocks : The main clock for TMU device
+- clock-names : Thermal system clock name
+
+Example:
+
+	tmu@100C0000 {
+		compatible = "samsung,exynos4412-tmu";
+		interrupt-parent = <&combiner>;
+		reg = <0x100C0000 0x100>;
+		interrupts = <2 4>;
+		clocks = <&clock 383>;
+		clock-names = "tmu_apbif";
+		status = "disabled";
+	};
#53 lore raw

Re: [PATCH v2 0/4] Thermal:exynos: Thermal Measurement Unit fix and Samsung SoCs support

In reply to Eduardo Valentin

Hi Eduardo,

Quoted 11 lines

Hello Lukasz,

Quoted 8 lines · Lukasz Majewski

This patch series provide various fixes for TMU block. First of all it fixes a problem with get_cpu_frequency() lockup at cpu_cooling.c.

Secondly a proper regulator definition (VDD_TS) has been added. Moreover device tree definitions and documentation entry are now in place.

Quoted 5 lines
Quoted 2 lines

Dependencies (those patches shall be applied on top of):
- "clk: exynos4: Add clock entries for TMU"

Is this one same as [1/6] clk:exynos4:TMU Thermal Measurement Unit clock added to common clock framework in your previous series?

Yes, this is a similar patch. However I've changed more clocks to clk_prepare_enable (clk_unprepare_disable). I've spoken about this with Sachin recently.

Quoted 6 lines
Quoted 2 lines

- "Thermal: exynos: Add clk_{un}prepare APIs"

Same as
thermal:exynos4: TMU Common clock framework support for TMU (Thermal Monitoring Unit)
in your previous series?

Yes.

Quoted 5 lines
Quoted 3 lines

- "Thermal: exynos: Add compatible string for exynos4412"

This should be same as thermal:exynos4: Enable support for Exynos4412 SoCs in your previous series?

Yes.

Quoted 25 lines
Quoted 11 lines

Lukasz Majewski (4):
ARM: dts: thermal: exynos4: TMU device tree support for
Exynos4412 targets
Thermal: exynos: Support for TMU regulator defined at device tree
ARM: dts: thermal: exynos4: Add documentation for Exynos SoC
thermal bindings
ARM:TMU:fix: Avoid lockup when first frequency table entry is
CPUFREQ_ENTRY_INVALID

The above, as stated at the patch may not be needed.

Quoted 10 lines
  .../devicetree/bindings/thermal/exynos-thermal.txt |   25
++++++++++++++++++++
arch/arm/boot/dts/exynos4x12.dtsi                  |   10 ++++++++
drivers/thermal/cpu_cooling.c                      |    3 +--
drivers/thermal/exynos_thermal.c                   |   19

+++++++++++++++ 4 files changed, 55 insertions(+), 2 deletions(-) create mode 100644 Documentation/devicetree/bindings/thermal/exynos-thermal.txt

Signature · 5 lines
Best regards,

Lukasz Majewski

Samsung R&D Poland (SRPOL) | Linux Platform Group
#41 lore raw

Re: [PATCH v2 2/4] Thermal: exynos: Support for TMU regulator defined at device tree

In reply to Eduardo Valentin

Hi Eduardo,

Quoted 12 lines

Amit, Lukasz,

Quoted 9 lines · Lukasz Majewski

Hi Amit,

Quoted 6 lines

Hi Lukasz Majewski,

Sorry for late review but I am currently working on restructuring the whole exynos thermal driver and this support of LDO can be added as feature as not all socs support this. This is also suggested by Eduardo. All your other patches looks fine.

Quoted 8 lines
Quoted 5 lines

But this is how it is already done. The VDD_TS is optional, so Exynos5440 and Exynos4210 will not be broken.

This shall preserve the correct behavior of the thermal driver.

If you guys plan to move to feature based approach, like suggested in V1, then Id recommend adding a /* TODO: */ entry in your driver.

Ok, nice idea.

Quoted 2 lines

Amit, are you including this LDO support on your rework?

Signature · 5 lines
Best regards,

Lukasz Majewski

Samsung R&D Poland (SRPOL) | Linux Platform Group
#54 lore raw

Re: [PATCH v2 0/4] Thermal:exynos: Thermal Measurement Unit fix and Samsung SoCs support

In reply to Lukasz Majewski

Hi Eduardo,

Quoted 18 lines · Lukasz Majewski

Hi Eduardo,

Quoted 16 lines

Hello Lukasz,

Quoted 10 lines · Lukasz Majewski

This patch series provide various fixes for TMU block. First of all it fixes a problem with get_cpu_frequency() lockup at cpu_cooling.c.

Secondly a proper regulator definition (VDD_TS) has been added. Moreover device tree definitions and documentation entry are now in place.

Dependencies (those patches shall be applied on top of):
- "clk: exynos4: Add clock entries for TMU"

Is this one same as [1/6] clk:exynos4:TMU Thermal Measurement Unit clock added to common clock framework in your previous series?

The one sent by Lukasz has been dropped as an equivalent patch sent by me is already under review.

Quoted 4 lines

Yes, this is a similar patch. However I've changed more clocks to clk_prepare_enable (clk_unprepare_disable). I've spoken about this with Sachin recently.

The above description is actually for the below patch. Lukasz will test and see if additional changes are needed.
If so he will send an incremental patch to address it.

Quoted 11 lines
Quoted 11 lines
Quoted 3 lines

- "Thermal: exynos: Add clk_{un}prepare APIs"

Same as
thermal:exynos4: TMU Common clock framework support for TMU (Thermal Monitoring Unit)
in your previous series?

Quoted 1 line
Quoted 1 line
Quoted 1 line

- "Thermal: exynos: Add compatible string for exynos4412"

These 2 have been merged in the thermal next tree.

Quoted 6 lines
Quoted 3 lines
Quoted 1 line

This should be same as thermal:exynos4: Enable support for Exynos4412 SoCs in your previous series?

Yes.

Signature · 2 lines
With warm regards,
Sachin
#55 lore raw

Re: [PATCH v2 0/4] Thermal:exynos: Thermal Measurement Unit fix and Samsung SoCs support

Hi Sachin,

Quoted 10 lines
Quoted 4 lines

Yes, this is a similar patch. However I've changed more clocks to clk_prepare_enable (clk_unprepare_disable). I've spoken about this with Sachin recently.

The above description is actually for the below patch. Lukasz will test and see if additional changes are needed.
If so he will send an incremental patch to address it.

From tests, which I've done so far, TMU is working correctly.

Signature · 5 lines
Best regards,

Lukasz Majewski

Samsung R&D Poland (SRPOL) | Linux Platform Group
#56 lore raw

Re: [PATCH v2 0/4] Thermal:exynos: Thermal Measurement Unit fix and Samsung SoCs support

Hi Lukasz,

Quoted 7 lines · Lukasz Majewski

Hi Sachin,

Quoted 5 lines
Quoted 4 lines

Yes, this is a similar patch. However I've changed more clocks to clk_prepare_enable (clk_unprepare_disable). I've spoken about this with Sachin recently.

Quoted 5 lines
Quoted 3 lines

The above description is actually for the below patch. Lukasz will test and see if additional changes are needed.
If so he will send an incremental patch to address it.

From tests, which I've done so far, TMU is working correctly.

Thanks for the confirmation.

Signature · 2 lines
With warm regards,
Sachin
reviewer
#42 lore raw

Re: [PATCH v2 2/4] Thermal: exynos: Support for TMU regulator defined at device tree

In reply to Lukasz Majewski

Hi, all,

what is the status now?
which one is preferred, this one or the one from Amit's patch set?

thanks,
rui

Quoted 30 lines · Lukasz Majewski

Hi Eduardo,

Quoted 12 lines

Amit, Lukasz,

Quoted 9 lines · Lukasz Majewski

Hi Amit,

Quoted 6 lines

Hi Lukasz Majewski,

Sorry for late review but I am currently working on restructuring the whole exynos thermal driver and this support of LDO can be added as feature as not all socs support this. This is also suggested by Eduardo. All your other patches looks fine.

Quoted 8 lines
Quoted 5 lines

But this is how it is already done. The VDD_TS is optional, so Exynos5440 and Exynos4210 will not be broken.

This shall preserve the correct behavior of the thermal driver.

If you guys plan to move to feature based approach, like suggested in V1, then Id recommend adding a /* TODO: */ entry in your driver.

Ok, nice idea.

Quoted 2 lines

Amit, are you including this LDO support on your rework?

#44 lore raw

Re: [PATCH v2 2/4] Thermal: exynos: Support for TMU regulator defined at device tree

In reply to Eduardo Valentin

Hi Lukasz/Eduardo,

Quoted 19 lines · Eduardo Valentin

Amit, Lukasz,

Quoted 15 lines · Lukasz Majewski

Hi Amit,

Quoted 6 lines

Hi Lukasz Majewski,

Sorry for late review but I am currently working on restructuring the whole exynos thermal driver and this support of LDO can be added as feature as not all socs support this. This is also suggested by Eduardo. All your other patches looks fine.

But this is how it is already done. The VDD_TS is optional, so Exynos5440 and Exynos4210 will not be broken.

This shall preserve the correct behavior of the thermal driver.

Yes lukasz I saw your code that vdd_ts is optional but adding regulator support in submitted TMU V2 re-structured is more easier and even regulator_get function call can be avoided. If you are ok I can re-submit your patch series with regulator support present.

Quoted 6 lines
Quoted 1 line

If you guys plan to move to feature based approach, like suggested in V1, then Id recommend adding a /* TODO: */ entry in your driver.

Amit, are you including this LDO support on your rework?

I just submitted the re-structured patches without the LDO support. I will add the regulator support in a new patch.

Thanks,
Amit Daniel

Quoted 94 lines
Quoted 79 lines
Quoted 79 lines

Thanks,
Amit Daniel

Quoted 71 lines · Lukasz Majewski

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.

---
Changes for v2:
- Change dev_info() to dev_warn()

---
  drivers/thermal/exynos_thermal.c |   19 +++++++++++++++++++
  1 file changed, 19 insertions(+)
(quoted diff) +0 -0

b/drivers/thermal/exynos_thermal.c index 3d6e32a..328fe7e 100644

drivers/thermal/exynos_thermal.c +4 -0
@@ -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;
@@ -948,6 +951,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)
drivers/thermal/exynos_thermal.c +0 -0
@@ -957,6 +961,21 @@ static int exynos_tmu_probe(struct

platform_device *pdev) dev_err(&pdev->dev, "No platform init data

supplied.\n"); return -ENODEV;
         }
drivers/thermal/exynos_thermal.c +6 -0
+
+       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",

drivers/thermal/exynos_thermal.c +6 -0
+                               EXYNOS_TMU_REGULATOR);
+                       return ret;
+               }
+       } else {
+               dev_warn(&pdev->dev,
+                        "Regulator %s not defined at device

tree.\n",

drivers/thermal/exynos_thermal.c +3 -0
+                        EXYNOS_TMU_REGULATOR);
+       }
+
         data = devm_kzalloc(&pdev->dev, sizeof(struct
exynos_tmu_data), GFP_KERNEL);
         if (!data) {

--
1.7.10.4

Quoted 9 lines
Quoted 5 lines
Quoted 5 lines

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

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

#43 lore raw

Re: [PATCH v2 2/4] Thermal: exynos: Support for TMU regulator defined at device tree

In reply to Zhang Rui
Quoted 4 lines · Zhang Rui

Hi, all,

what is the status now?
which one is preferred, this one or the one from Amit's patch set?

Hi Rui,

I have still not submitted LDO support in the TMU driver. I will re-base Lukasz patches on top of my patch series and submit shortly as his changes are also important.

Thanks,
Amit Daniel

Quoted 42 lines

thanks,
rui

Quoted 17 lines · Lukasz Majewski

Hi Eduardo,

Quoted 15 lines

Amit, Lukasz,

Quoted 12 lines · Lukasz Majewski

Hi Amit,

Quoted 6 lines

Hi Lukasz Majewski,

Sorry for late review but I am currently working on restructuring the whole exynos thermal driver and this support of LDO can be added as feature as not all socs support this. This is also suggested by Eduardo. All your other patches looks fine.

But this is how it is already done. The VDD_TS is optional, so Exynos5440 and Exynos4210 will not be broken.

Quoted 13 lines
Quoted 5 lines
Quoted 2 lines

This shall preserve the correct behavior of the thermal driver.

If you guys plan to move to feature based approach, like suggested in V1, then Id recommend adding a /* TODO: */ entry in your driver.

Ok, nice idea.

Quoted 2 lines

Amit, are you including this LDO support on your rework?

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

#36 lore raw

Re: [PATCH v2 1/4] ARM: dts: thermal: exynos4: TMU device tree support for Exynos4412 targets

In reply to Eduardo Valentin

Hi,

Quoted 10 lines · Eduardo Valentin
Quoted 5 lines · Lukasz Majewski

Device tree support for TMU at Exynos4x12 targets.

This patch looks good to me:

This patch looks nice but I guess this patch should go via Kukjin Kim's samsung tree.

Thanks,
Amit Daniel

Quoted 35 lines
Quoted 19 lines

---
Changes for v2:
- None

---
  arch/arm/boot/dts/exynos4x12.dtsi |   10 ++++++++++
  1 file changed, 10 insertions(+)
arch/arm/boot/dts/exynos4x12.dtsi +1 -0
index e3380a7..ee920b3 100644
@@ -79,4 +79,14 @@
                interrupts = <0 89 0>;
                status = "disabled";
        };
+

arch/arm/boot/dts/exynos4x12.dtsi line 92

Quoted 10 lines
arch/arm/boot/dts/exynos4x12.dtsi +9 -0
+       tmu@100C0000 {
+               compatible = "samsung,exynos4412-tmu";
+               interrupt-parent = <&combiner>;
+               reg = <0x100C0000 0x100>;
+               interrupts = <2 4>;
+               clocks = <&clock 383>;
+               clock-names = "tmu_apbif";
+               status = "disabled";
+       };
  };

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

#47 lore raw

Re: [PATCH v2 3/4] ARM: dts: thermal: exynos4: Add documentation for Exynos SoC thermal bindings

In reply to Eduardo Valentin

Hi Rui,

Quoted 5 lines · Eduardo Valentin
Quoted 4 lines · Lukasz Majewski

Proper description for Exynos4 bindings added to Documentation/devicetree/ bindings

Quoted 7 lines
Quoted 2 lines

I am fine with this one too.

This patch looks fine and can be merged.

Thanks,
Amit Daniel

Quoted 50 lines
Quoted 35 lines

---
Changes for v2:
- Documentation extension according to ML feedback

---
  .../devicetree/bindings/thermal/exynos-thermal.txt |   25
++++++++++++++++++++
  1 file changed, 25 insertions(+)

create mode 100644
Documentation/devicetree/bindings/thermal/exynos-thermal.txt

Documentation/devicetree/bindings/thermal/exynos-thermal.txt new file +15 -0
new file mode 100644
index 0000000..535fd0e
@@ -0,0 +1,25 @@
+* Exynos Thermal Management Unit (TMU)
+
+** Required properties:
+
+- compatible : One of the following:
+              "samsung,exynos4412-tmu"
+              "samsung,exynos4210-tmu"
+              "samsung,exynos5250-tmu"
+- interrupt-parent : The phandle for the interrupt controller
+- reg : Address range of the thermal registers
+- interrupts : Should contain interrupt for thermal system
+- clocks : The main clock for TMU device
+- clock-names : Thermal system clock name
+
+Example:

Documentation/devicetree/bindings/thermal/exynos-thermal.txt line 25

Quoted 10 lines
Documentation/devicetree/bindings/thermal/exynos-thermal.txt new file +10 -0
+
+       tmu@100C0000 {
+               compatible = "samsung,exynos4412-tmu";
+               interrupt-parent = <&combiner>;
+               reg = <0x100C0000 0x100>;
+               interrupts = <2 4>;
+               clocks = <&clock 383>;
+               clock-names = "tmu_apbif";
+               status = "disabled";
+       };

--
To unsubscribe from this list: send the line "unsubscribe linux-pm" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html