Skip to contentSkip to conversation

dt-bindings: document qcom tsens thermal

PATCH In review Narendran Rajan 5 participants 7 messages Jan 27, 2015 – Jan 29, 2015

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

PATCH 1/1 dt-bindings: document qcom tsens thermal

Add binding documentation for the QCOM tsens device tree node

---
 .../devicetree/bindings/thermal/qcom-thermal.txt   | 58 ++++++++++++++++++++++
 1 file changed, 58 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/thermal/qcom-thermal.txt
Documentation/devicetree/bindings/thermal/qcom-thermal.txt new file +58 -0
new file mode 100644
index 0000000..d2e99d6
@@ -0,0 +1,58 @@
+* QCOM SoC Temperature Sensor (TSENS)
+
+Required properties:
+- compatible : "qcom,ipq806x-tsens"
+- interrupts : The interrupt number to the cpu. The interrupt specifier format
+	       depends on the interrupt controller.
+- qcom,imem : Must contain phandle to imem syscon node
+- qcom,tsens-base : Must contain phandle to clock controller node
+- qcom,calib-offsets : Must contain offsets to primary and secondary
+			calibration data within imem
+- qcom,tsens-slopes : Must contain slope value for each of the sensors controlled
+			by this device
+- #thermal-sensor-cells : Should be 1. See ./thermal.txt for a description.
+
+Exiample:
+tsens: tsens-msm8960 {
+		compatible = "qcom,ipq806x-tsens";
+		interrupts = <0 178 1>;
+		qcom,imem = <&imem>;
+		qcom,tsens-base = <&gcc>;
+		qcom,calib-offsets = <0x400 0x410>;
+		qcom,tsens-slopes = <1176 1176 1154 1176 1111
+				1132 1132 1199 1132 1199
+				1132>;
+		#thermal-sensor-cells = <1>;
+	};
+
+Example: referring to thermal sensors:
+thermal-zones {
+	cpu_thermal: cpu_thermal {
+		polling-delay-passive = <1000>; /* milliseconds */
+		polling-delay = <5000>; /* milliseconds */
+
+		/* sensor	ID */
+		thermal-sensors = <&tsens	1>;
+
+		trips {
+			cpu_alert0: cpu_alert {
+				temperature = <80000>; /* millicelsius */
+				hysteresis = <2000>; /* millicelsius */
+				type = "passive";
+			};
+			cpu_crit: cpu_crit {
+				temperature = <120000>; /* millicelsius */
+				hysteresis = <2000>; /* millicelsius */
+				type = "critical";
+			};
+		};
+
+		cooling-maps {
+			map0 {
+				trip = <&cpu_alert0>;
+				cooling-device =
+					<&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
+			};
+		};
+	};
+};
Signature · 1 line
Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project
#1 lore raw

Hi Narendran,

What a coincidence.. I was just in the middle of forward porting the same driver from 3.4 kernel :-) You look fast... :-)

Quoted 12 lines · Narendran Rajan

Add binding documentation for the QCOM tsens device tree node

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

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

Documentation/devicetree/bindings/thermal/qcom-thermal.txt new file +0 -0
new file mode 100644
index 0000000..d2e99d6

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

Quoted 4 lines
Documentation/devicetree/bindings/thermal/qcom-thermal.txt new file +4 -0
@@ -0,0 +1,58 @@
+* QCOM SoC Temperature Sensor (TSENS)
+
+Required properties:
+- compatible : "qcom,ipq806x-tsens"

I think this should be something like qcom,msm8960-tsens as that is the first part where this tsens appeared.

Documentation/devicetree/bindings/thermal/qcom-thermal.txt line 7

Quoted 3 lines
Documentation/devicetree/bindings/thermal/qcom-thermal.txt new file +3 -0
+- interrupts : The interrupt number to the cpu. The interrupt specifier format
+	       depends on the interrupt controller.
+- qcom,imem : Must contain phandle to imem syscon node

Doing this way would work but not great, We should try to do this in an abstracted way so that all the drivers who are in need of qfprom would not add the same code all the time. I did send some WIP patches on msm mailing list.

Documentation/devicetree/bindings/thermal/qcom-thermal.txt line 8

Quoted 1 line
Documentation/devicetree/bindings/thermal/qcom-thermal.txt new file +1 -0
+- qcom,tsens-base : Must contain phandle to clock controller node

This is not correct, you dont need this property.

AFAIK for APQ8064 Tsens should be a child of gcc as some of the registers are in already mapped by gcc. You should probably use this patch + do a

	base = dev_get_regmap(dev->parent, NULL);

------------------>cut<-----------------------------
From 87b71df272048fb3aaa89b77524e4b6426e5ddc5 Mon Sep 17 00:00:00 2001
From: Srinivas Kandagatla <[email protected]>
Date: Thu, 22 Jan 2015 14:03:53 +0000
Subject: [PATCH] clk: qcom: gcc-msm8960: add child devices support.

This patch adds support to add child devices to gcc as some of the registers mapped by gcc are used by things like thermal sensors.

---
 drivers/clk/qcom/gcc-msm8960.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/clk/qcom/gcc-msm8960.c +3 -1
index 0b61e8a..8307db3 100644
@@ -15,6 +15,7 @@
 #include <linux/bitops.h>
 #include <linux/err.h>
 #include <linux/platform_device.h>
+#include <linux/of_platform.h>
 #include <linux/module.h>
 #include <linux/of.h>
 #include <linux/of_device.h>
@@ -3666,7 +3667,8 @@ static int gcc_msm8960_probe(struct platform_device *pdev)
 		hfpll_l2.d = &hfpll_l2_8064_data;
 	}
 
-	return qcom_cc_probe(pdev, match->data);
+	qcom_cc_probe(pdev, match->data);
+	return of_platform_populate(pdev->dev.of_node, NULL, NULL, &pdev->dev);
 }
 
 static int gcc_msm8960_remove(struct platform_device *pdev)
Signature · 3 lines
2.2.1

------------------>cut<-----------------------------
Quoted 42 lines
Documentation/devicetree/bindings/thermal/qcom-thermal.txt new file +40 -0
+- qcom,calib-offsets : Must contain offsets to primary and secondary
+			calibration data within imem
+- qcom,tsens-slopes : Must contain slope value for each of the sensors controlled
+			by this device
+- #thermal-sensor-cells : Should be 1. See ./thermal.txt for a description.
+
+Exiample:
+tsens: tsens-msm8960 {
+		compatible = "qcom,ipq806x-tsens";
 
+		interrupts = <0 178 1>;
+		qcom,imem = <&imem>;
+		qcom,tsens-base = <&gcc>;
+		qcom,calib-offsets = <0x400 0x410>;
+		qcom,tsens-slopes = <1176 1176 1154 1176 1111
+				1132 1132 1199 1132 1199
+				1132>;
+		#thermal-sensor-cells = <1>;
+	};
+
+Example: referring to thermal sensors:
+thermal-zones {
+	cpu_thermal: cpu_thermal {
+		polling-delay-passive = <1000>; /* milliseconds */
+		polling-delay = <5000>; /* milliseconds */
+
+		/* sensor	ID */
+		thermal-sensors = <&tsens	1>;
+
+		trips {
+			cpu_alert0: cpu_alert {
+				temperature = <80000>; /* millicelsius */
+				hysteresis = <2000>; /* millicelsius */
+				type = "passive";
+			};
+			cpu_crit: cpu_crit {
+				temperature = <120000>; /* millicelsius */
+				hysteresis = <2000>; /* millicelsius */
+				type = "critical";
+			};
+		};

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

Quoted 10 lines
Documentation/devicetree/bindings/thermal/qcom-thermal.txt new file +10 -0
+
+		cooling-maps {
+			map0 {
+				trip = <&cpu_alert0>;
+				cooling-device =
+					<&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
+			};
+		};
+	};
+};

---srini

#2 lore raw

Hi Srini,

Thanks for the comments

Quoted 22 lines

-----Original Message-----
From: [email protected] [mailto:linux-arm-msm- [email protected]] On Behalf Of Srinivas Kandagatla
Sent: Monday, January 26, 2015 11:16 PM
To: Narendran Rajan; Zhang Rui; Eduardo Valentin
Cc: Linux ARM MSM; Linux PM
Subject: Re: [PATCH] dt-bindings: document qcom tsens thermal

Hi Narendran,

What a coincidence.. I was just in the middle of forward porting the same driver from 3.4 kernel :-) You look fast... :-)

Quoted 3 lines · Narendran Rajan

Add binding documentation for the QCOM tsens device tree node

---
  .../devicetree/bindings/thermal/qcom-thermal.txt   | 58

++++++++++++++++++++++

Quoted 4 lines
  1 file changed, 58 insertions(+)

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

Quoted 14 lines

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

Quoted 12 lines

diff --git a/Documentation/devicetree/bindings/thermal/qcom-thermal.txt b/Documentation/devicetree/bindings/thermal/qcom-thermal.txt new file mode 100644
index 0000000..d2e99d6

Documentation/devicetree/bindings/thermal/qcom-thermal.txt new file +4 -0
@@ -0,0 +1,58 @@
+* QCOM SoC Temperature Sensor (TSENS)
+
+Required properties:
+- compatible : "qcom,ipq806x-tsens"

I think this should be something like qcom,msm8960-tsens as that is the

first

Quoted 2 lines

part where this tsens appeared.

Will address in next version.

Quoted 9 lines

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

Quoted 1 line
Documentation/devicetree/bindings/thermal/qcom-thermal.txt new file +1 -0
+- interrupts : The interrupt number to the cpu. The interrupt specifier

format

Documentation/devicetree/bindings/thermal/qcom-thermal.txt line 7

Quoted 2 lines
Documentation/devicetree/bindings/thermal/qcom-thermal.txt new file +2 -0
+	       depends on the interrupt controller.
+- qcom,imem : Must contain phandle to imem syscon node

Doing this way would work but not great, We should try to do this in an abstracted way so that all the drivers who are in need of qfprom would not add the same code all the time. I did send some WIP patches on msm mailing list.

Quoted 4 lines

Documentation/devicetree/bindings/thermal/qcom-thermal.txt line 8

Quoted 1 line
Documentation/devicetree/bindings/thermal/qcom-thermal.txt new file +1 -0
+- qcom,tsens-base : Must contain phandle to clock controller node

This is not correct, you dont need this property.

AFAIK for APQ8064 Tsens should be a child of gcc as some of the registers

are

Quoted 3 lines

in already mapped by gcc. You should probably use this patch + do a

	base = dev_get_regmap(dev->parent, NULL);

I started with a child node version as you suggested, but later modified to be top
level device node. IMHO tsens register map sandwiched between gcc
registers
looked odd and didn't want to expose this in the device tree hierarchy, hence the
roundabout way to get the gcc phandle.

Let me please know your thoughts. I am open to either ways.

Quoted 8 lines

------------------>cut<-----------------------------
From 87b71df272048fb3aaa89b77524e4b6426e5ddc5 Mon Sep 17 00:00:00
2001
From: Srinivas Kandagatla <[email protected]>
Date: Thu, 22 Jan 2015 14:03:53 +0000
Subject: [PATCH] clk: qcom: gcc-msm8960: add child devices support.

This patch adds support to add child devices to gcc as some of the

registers

Quoted 34 lines

mapped by gcc are used by things like thermal sensors.

---
  drivers/clk/qcom/gcc-msm8960.c | 4 +++-
  1 file changed, 3 insertions(+), 1 deletion(-)
drivers/clk/qcom/gcc- renamed from drivers/clk/qcom/gcc-msm8960.c +0 -0

msm8960.c index 0b61e8a..8307db3 100644

drivers/clk/qcom/gcc-msm8960.c +4 -2
@@ -15,6 +15,7 @@
  #include <linux/bitops.h>
  #include <linux/err.h>
  #include <linux/platform_device.h>
+#include <linux/of_platform.h>
  #include <linux/module.h>
  #include <linux/of.h>
  #include <linux/of_device.h>
@@ -3666,7 +3667,8 @@ static int gcc_msm8960_probe(struct
 platform_device *pdev)
  		hfpll_l2.d = &hfpll_l2_8064_data;
  	}
 
-	return qcom_cc_probe(pdev, match->data);
+	qcom_cc_probe(pdev, match->data);
+	return of_platform_populate(pdev->dev.of_node, NULL, NULL,
+&pdev->dev);
  }
 
  static int gcc_msm8960_remove(struct platform_device *pdev)
--

2.2.1

Quoted 8 lines

------------------>cut<-----------------------------

Documentation/devicetree/bindings/thermal/qcom-thermal.txt line 11

Quoted 3 lines
Documentation/devicetree/bindings/thermal/qcom-thermal.txt new file +3 -0
+- qcom,calib-offsets : Must contain offsets to primary and secondary
+			calibration data within imem
+- qcom,tsens-slopes : Must contain slope value for each of the sensors

controlled

Documentation/devicetree/bindings/thermal/qcom-thermal.txt line 13

Quoted 2 lines
Documentation/devicetree/bindings/thermal/qcom-thermal.txt new file +2 -0
+			by this device
+- #thermal-sensor-cells : Should be 1. See ./thermal.txt for a

description.

Quoted 43 lines
Quoted 32 lines
Documentation/devicetree/bindings/thermal/qcom-thermal.txt new file +31 -0
+
+Exiample:
+tsens: tsens-msm8960 {
+		compatible = "qcom,ipq806x-tsens";
 
+		interrupts = <0 178 1>;
+		qcom,imem = <&imem>;
+		qcom,tsens-base = <&gcc>;
+		qcom,calib-offsets = <0x400 0x410>;
+		qcom,tsens-slopes = <1176 1176 1154 1176 1111
+				1132 1132 1199 1132 1199
+				1132>;
+		#thermal-sensor-cells = <1>;
+	};
+
+Example: referring to thermal sensors:
+thermal-zones {
+	cpu_thermal: cpu_thermal {
+		polling-delay-passive = <1000>; /* milliseconds */
+		polling-delay = <5000>; /* milliseconds */
+
+		/* sensor	ID */
+		thermal-sensors = <&tsens	1>;
+
+		trips {
+			cpu_alert0: cpu_alert {
+				temperature = <80000>; /* millicelsius */
+				hysteresis = <2000>; /* millicelsius */
+				type = "passive";
+			};
+			cpu_crit: cpu_crit {
+				temperature = <120000>; /* millicelsius */

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

Quoted 10 lines
Documentation/devicetree/bindings/thermal/qcom-thermal.txt new file +10 -0
+				hysteresis = <2000>; /* millicelsius */
+				type = "critical";
+			};
+		};
+
+		cooling-maps {
+			map0 {
+				trip = <&cpu_alert0>;
+				cooling-device =
+					<&cpu0 THERMAL_NO_LIMIT

THERMAL_NO_LIMIT>;

Quoted 9 lines

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

Quoted 5 lines
Documentation/devicetree/bindings/thermal/qcom-thermal.txt new file +4 -0
+			};
+		};
+	};
+};

---srini
--
To unsubscribe from this list: send the line "unsubscribe linux-arm-msm"

in

Quoted 2 lines

the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

--Naren

#3 lore raw
Quoted 4 lines · Narendran Rajan

Hi Srini,

Thanks for the comments

...

Quoted 26 lines
Quoted 9 lines
Quoted 1 line

+- interrupts : The interrupt number to the cpu. The interrupt specifier

format

Review

Quoted 2 lines
(quoted diff) +2 -0
+	       depends on the interrupt controller.
+- qcom,imem : Must contain phandle to imem syscon node

Doing this way would work but not great, We should try to do this in an abstracted way so that all the drivers who are in need of qfprom would not add the same code all the time. I did send some WIP patches on msm mailing list.

Quoted 4 lines
Quoted 1 line

+- qcom,tsens-base : Must contain phandle to clock controller node

This is not correct, you dont need this property.

AFAIK for APQ8064 Tsens should be a child of gcc as some of the registers

are

Quoted 3 lines

in already mapped by gcc. You should probably use this patch + do a

	base = dev_get_regmap(dev->parent, NULL);

I started with a child node version as you suggested, but later modified to be top
level device node. IMHO tsens register map sandwiched between gcc
registers
looked odd and didn't want to expose this in the device tree hierarchy, hence the
roundabout way to get the gcc phandle.

Quoted 2 lines

Let me please know your thoughts. I am open to either ways.

I think we should go with child node approch which makes more sense as the we follow same thing with other drivers too.

Quoted 110 lines
Quoted 8 lines

------------------>cut<-----------------------------
From 87b71df272048fb3aaa89b77524e4b6426e5ddc5 Mon Sep 17 00:00:00
2001
From: Srinivas Kandagatla <[email protected]>
Date: Thu, 22 Jan 2015 14:03:53 +0000
Subject: [PATCH] clk: qcom: gcc-msm8960: add child devices support.

This patch adds support to add child devices to gcc as some of the

registers

Quoted 34 lines

mapped by gcc are used by things like thermal sensors.

---
   drivers/clk/qcom/gcc-msm8960.c | 4 +++-
   1 file changed, 3 insertions(+), 1 deletion(-)
drivers/clk/qcom/gcc- renamed from drivers/clk/qcom/gcc-msm8960.c +0 -0

msm8960.c index 0b61e8a..8307db3 100644

drivers/clk/qcom/gcc-msm8960.c +4 -2
@@ -15,6 +15,7 @@
   #include <linux/bitops.h>
   #include <linux/err.h>
   #include <linux/platform_device.h>
+#include <linux/of_platform.h>
   #include <linux/module.h>
   #include <linux/of.h>
   #include <linux/of_device.h>
@@ -3666,7 +3667,8 @@ static int gcc_msm8960_probe(struct
 platform_device *pdev)
   		hfpll_l2.d = &hfpll_l2_8064_data;
   	}
 
-	return qcom_cc_probe(pdev, match->data);
+	qcom_cc_probe(pdev, match->data);
+	return of_platform_populate(pdev->dev.of_node, NULL, NULL,
+&pdev->dev);
   }
 
   static int gcc_msm8960_remove(struct platform_device *pdev)
--

2.2.1

Quoted 8 lines

------------------>cut<-----------------------------

Review

Quoted 3 lines

+- qcom,calib-offsets : Must contain offsets to primary and secondary

(quoted diff) +2 -0
+			calibration data within imem
+- qcom,tsens-slopes : Must contain slope value for each of the sensors

controlled

Review

Quoted 2 lines
(quoted diff) +2 -0
+			by this device
+- #thermal-sensor-cells : Should be 1. See ./thermal.txt for a

description.

Quoted 43 lines
Quoted 32 lines
(quoted diff) +31 -0
+
+Exiample:
+tsens: tsens-msm8960 {
+		compatible = "qcom,ipq806x-tsens";
 
+		interrupts = <0 178 1>;
+		qcom,imem = <&imem>;
+		qcom,tsens-base = <&gcc>;
+		qcom,calib-offsets = <0x400 0x410>;
+		qcom,tsens-slopes = <1176 1176 1154 1176 1111
+				1132 1132 1199 1132 1199
+				1132>;
+		#thermal-sensor-cells = <1>;
+	};
+
+Example: referring to thermal sensors:
+thermal-zones {
+	cpu_thermal: cpu_thermal {
+		polling-delay-passive = <1000>; /* milliseconds */
+		polling-delay = <5000>; /* milliseconds */
+
+		/* sensor	ID */
+		thermal-sensors = <&tsens	1>;
+
+		trips {
+			cpu_alert0: cpu_alert {
+				temperature = <80000>; /* millicelsius */
+				hysteresis = <2000>; /* millicelsius */
+				type = "passive";
+			};
+			cpu_crit: cpu_crit {
+				temperature = <120000>; /* millicelsius */

Review

Quoted 10 lines
(quoted diff) +10 -0
+				hysteresis = <2000>; /* millicelsius */
+				type = "critical";
+			};
+		};
+
+		cooling-maps {
+			map0 {
+				trip = <&cpu_alert0>;
+				cooling-device =
+					<&cpu0 THERMAL_NO_LIMIT

THERMAL_NO_LIMIT>;

Quoted 9 lines

Review

Quoted 5 lines
(quoted diff) +4 -0
+			};
+		};
+	};
+};

---srini
--
To unsubscribe from this list: send the line "unsubscribe linux-arm-msm"

in

Quoted 2 lines

the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

--Naren

#5 lore raw
In reply to Narendran Rajan
Quoted 6 lines · Narendran Rajan

Add binding documentation for the QCOM tsens device tree node
---
.../devicetree/bindings/thermal/qcom-thermal.txt | 58 ++++++++++++++++++++++

1 file changed, 58 insertions(+)

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

This patch should go with the driver. I have not seen the actual DT nodes for TSENS on QCOM chipsets.

Lina

Quoted 71 lines
Documentation/devicetree/bindings/thermal/qcom-thermal.txt new file +58 -0
new file mode 100644
index 0000000..d2e99d6
@@ -0,0 +1,58 @@
+* QCOM SoC Temperature Sensor (TSENS)
+
+Required properties:
+- compatible : "qcom,ipq806x-tsens"
+- interrupts : The interrupt number to the cpu. The interrupt specifier format
+	       depends on the interrupt controller.
+- qcom,imem : Must contain phandle to imem syscon node
+- qcom,tsens-base : Must contain phandle to clock controller node
+- qcom,calib-offsets : Must contain offsets to primary and secondary
+			calibration data within imem
+- qcom,tsens-slopes : Must contain slope value for each of the sensors controlled
+			by this device
+- #thermal-sensor-cells : Should be 1. See ./thermal.txt for a description.
+
+Exiample:
+tsens: tsens-msm8960 {
+		compatible = "qcom,ipq806x-tsens";
+		interrupts = <0 178 1>;
+		qcom,imem = <&imem>;
+		qcom,tsens-base = <&gcc>;
+		qcom,calib-offsets = <0x400 0x410>;
+		qcom,tsens-slopes = <1176 1176 1154 1176 1111
+				1132 1132 1199 1132 1199
+				1132>;
+		#thermal-sensor-cells = <1>;
+	};
+
+Example: referring to thermal sensors:
+thermal-zones {
+	cpu_thermal: cpu_thermal {
+		polling-delay-passive = <1000>; /* milliseconds */
+		polling-delay = <5000>; /* milliseconds */
+
+		/* sensor	ID */
+		thermal-sensors = <&tsens	1>;
+
+		trips {
+			cpu_alert0: cpu_alert {
+				temperature = <80000>; /* millicelsius */
+				hysteresis = <2000>; /* millicelsius */
+				type = "passive";
+			};
+			cpu_crit: cpu_crit {
+				temperature = <120000>; /* millicelsius */
+				hysteresis = <2000>; /* millicelsius */
+				type = "critical";
+			};
+		};
+
+		cooling-maps {
+			map0 {
+				trip = <&cpu_alert0>;
+				cooling-device =
+					<&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
+			};
+		};
+	};
+};
Signature · 6 lines
Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project

--
To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#4 lore raw
In reply to Srinivas Kandagatla
Quoted 48 lines · Srinivas Kandagatla

Hi Narendran,

What a coincidence.. I was just in the middle of forward porting the same driver from 3.4 kernel :-) You look fast... :-)

Quoted 12 lines · Narendran Rajan

Add binding documentation for the QCOM tsens device tree node

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

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

Documentation/devicetree/bindings/thermal/qcom-thermal.txt new file +0 -0
new file mode 100644
index 0000000..d2e99d6

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

Quoted 4 lines
Documentation/devicetree/bindings/thermal/qcom-thermal.txt new file +4 -0
@@ -0,0 +1,58 @@
+* QCOM SoC Temperature Sensor (TSENS)
+
+Required properties:
+- compatible : "qcom,ipq806x-tsens"

I think this should be something like qcom,msm8960-tsens as that is the first part where this tsens appeared.

Documentation/devicetree/bindings/thermal/qcom-thermal.txt line 7

Quoted 3 lines
Documentation/devicetree/bindings/thermal/qcom-thermal.txt new file +3 -0
+- interrupts : The interrupt number to the cpu. The interrupt specifier format
+	       depends on the interrupt controller.
+- qcom,imem : Must contain phandle to imem syscon node

Doing this way would work but not great, We should try to do this in an abstracted way so that all the drivers who are in need of qfprom would not add the same code all the time. I did send some WIP patches on msm mailing list.

Documentation/devicetree/bindings/thermal/qcom-thermal.txt line 8

Quoted 1 line
Documentation/devicetree/bindings/thermal/qcom-thermal.txt new file +1 -0
+- qcom,tsens-base : Must contain phandle to clock controller node

This is not correct, you dont need this property.

AFAIK for APQ8064 Tsens should be a child of gcc as some of the registers are in already mapped by gcc. You should probably use this patch + do a

	base = dev_get_regmap(dev->parent, NULL);

------------------>cut<-----------------------------
From 87b71df272048fb3aaa89b77524e4b6426e5ddc5 Mon Sep 17 00:00:00 2001
From: Srinivas Kandagatla <[email protected]>
Date: Thu, 22 Jan 2015 14:03:53 +0000
Subject: [PATCH] clk: qcom: gcc-msm8960: add child devices support.

Quoted 4 lines

This patch adds support to add child devices to gcc as some of the registers mapped by gcc are used by things like thermal sensors.

Srinivas,

Can you please send this as proper separated patch?

Quoted 86 lines
---
  drivers/clk/qcom/gcc-msm8960.c | 4 +++-
  1 file changed, 3 insertions(+), 1 deletion(-)
drivers/clk/qcom/gcc-msm8960.c +3 -1
index 0b61e8a..8307db3 100644
@@ -15,6 +15,7 @@
  #include <linux/bitops.h>
  #include <linux/err.h>
  #include <linux/platform_device.h>
+#include <linux/of_platform.h>
  #include <linux/module.h>
  #include <linux/of.h>
  #include <linux/of_device.h>
@@ -3666,7 +3667,8 @@ static int gcc_msm8960_probe(struct 
 platform_device *pdev)
  		hfpll_l2.d = &hfpll_l2_8064_data;
  	}
 
-	return qcom_cc_probe(pdev, match->data);
+	qcom_cc_probe(pdev, match->data);
+	return of_platform_populate(pdev->dev.of_node, NULL, NULL, &pdev->dev);
  }
 

static int gcc_msm8960_remove(struct platform_device *pdev)

Signature · 3 lines
2.2.1

------------------>cut<-----------------------------
Quoted 42 lines
Documentation/devicetree/bindings/thermal/qcom-thermal.txt new file +40 -0
+- qcom,calib-offsets : Must contain offsets to primary and secondary
+			calibration data within imem
+- qcom,tsens-slopes : Must contain slope value for each of the sensors controlled
+			by this device
+- #thermal-sensor-cells : Should be 1. See ./thermal.txt for a description.
+
+Exiample:
+tsens: tsens-msm8960 {
+		compatible = "qcom,ipq806x-tsens";
 
+		interrupts = <0 178 1>;
+		qcom,imem = <&imem>;
+		qcom,tsens-base = <&gcc>;
+		qcom,calib-offsets = <0x400 0x410>;
+		qcom,tsens-slopes = <1176 1176 1154 1176 1111
+				1132 1132 1199 1132 1199
+				1132>;
+		#thermal-sensor-cells = <1>;
+	};
+
+Example: referring to thermal sensors:
+thermal-zones {
+	cpu_thermal: cpu_thermal {
+		polling-delay-passive = <1000>; /* milliseconds */
+		polling-delay = <5000>; /* milliseconds */
+
+		/* sensor	ID */
+		thermal-sensors = <&tsens	1>;
+
+		trips {
+			cpu_alert0: cpu_alert {
+				temperature = <80000>; /* millicelsius */
+				hysteresis = <2000>; /* millicelsius */
+				type = "passive";
+			};
+			cpu_crit: cpu_crit {
+				temperature = <120000>; /* millicelsius */
+				hysteresis = <2000>; /* millicelsius */
+				type = "critical";
+			};
+		};

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

Quoted 10 lines
Documentation/devicetree/bindings/thermal/qcom-thermal.txt new file +10 -0
+
+		cooling-maps {
+			map0 {
+				trip = <&cpu_alert0>;
+				cooling-device =
+					<&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
+			};
+		};
+	};
+};

---srini

#6 lore raw
In reply to Narendran Rajan
Quoted 14 lines · Narendran Rajan

Add binding documentation for the QCOM tsens device tree node

---
 .../devicetree/bindings/thermal/qcom-thermal.txt   | 58 ++++++++++++++++++++++
 1 file changed, 58 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/thermal/qcom-thermal.txt
Documentation/devicetree/bindings/thermal/qcom-thermal.txt new file +2 -0
new file mode 100644
index 0000000..d2e99d6
@@ -0,0 +1,58 @@
+* QCOM SoC Temperature Sensor (TSENS)
+

Documentation/devicetree/bindings/thermal/qcom-thermal.txt line 12

Quoted 10 lines
Documentation/devicetree/bindings/thermal/qcom-thermal.txt new file +10 -0
+Required properties:
+- compatible : "qcom,ipq806x-tsens"
+- interrupts : The interrupt number to the cpu. The interrupt specifier format
+	       depends on the interrupt controller.
+- qcom,imem : Must contain phandle to imem syscon node
+- qcom,tsens-base : Must contain phandle to clock controller node
+- qcom,calib-offsets : Must contain offsets to primary and secondary
+			calibration data within imem
+- qcom,tsens-slopes : Must contain slope value for each of the sensors controlled
+			by this device

Can you please check if the above two properties can be mapped into the 'coefficients' property? It is an optional property of the thermal zone node.

Check Documentation/devicetree/bindings/thermal/thermal.txt

However, it might require additional implementation in the of thermal code, as we still have not got that done in any other driver.

My concern here is to avoid adding specific DT entries while we already defined generic options that can be used.

Documentation/devicetree/bindings/thermal/qcom-thermal.txt line 15

Quoted 3 lines
Documentation/devicetree/bindings/thermal/qcom-thermal.txt new file +3 -0
+- #thermal-sensor-cells : Should be 1. See ./thermal.txt for a description.
+
+Exiample:

s/Exiample/Example/g

Quoted 11 lines
Documentation/devicetree/bindings/thermal/qcom-thermal.txt new file +11 -0
+tsens: tsens-msm8960 {
+		compatible = "qcom,ipq806x-tsens";
+		interrupts = <0 178 1>;
+		qcom,imem = <&imem>;
+		qcom,tsens-base = <&gcc>;
+		qcom,calib-offsets = <0x400 0x410>;
+		qcom,tsens-slopes = <1176 1176 1154 1176 1111
+				1132 1132 1199 1132 1199
+				1132>;
+		#thermal-sensor-cells = <1>;
+	};

Documentation/devicetree/bindings/thermal/qcom-thermal.txt line 36

Quoted 10 lines
Documentation/devicetree/bindings/thermal/qcom-thermal.txt new file +10 -0
+
+Example: referring to thermal sensors:
+thermal-zones {
+	cpu_thermal: cpu_thermal {
+		polling-delay-passive = <1000>; /* milliseconds */
+		polling-delay = <5000>; /* milliseconds */
+
+		/* sensor	ID */
+		thermal-sensors = <&tsens	1>;
+

Something like:

                coefficients =          <[slope] [offset]>;
Quoted 25 lines
Documentation/devicetree/bindings/thermal/qcom-thermal.txt new file +22 -0
+		trips {
+			cpu_alert0: cpu_alert {
+				temperature = <80000>; /* millicelsius */
+				hysteresis = <2000>; /* millicelsius */
+				type = "passive";
+			};
+			cpu_crit: cpu_crit {
+				temperature = <120000>; /* millicelsius */
+				hysteresis = <2000>; /* millicelsius */
+				type = "critical";
+			};
+		};
+
+		cooling-maps {
+			map0 {
+				trip = <&cpu_alert0>;
+				cooling-device =
+					<&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
+			};
+		};
+	};
+};
Signature · 1 line
Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project