Skip to contentSkip to conversation

ARM: imx: Add basic imx6q thermal management

RFC PATCH Superseded Robert Lee 2 participants 4 messages Jan 18, 2012

Subsystems (4)

v3 of 6 Superseded Latest is v6 →

lore
Share & tools
lore

Robert Lee

author
#0 lore raw

RFC PATCH v3 1/1 ARM: imx: Add basic imx6q thermal management

Based on v3.2 plus recently submitted cpu_cooling functionality here:

http://www.spinics.net/lists/linux-pm/msg26500.html

link to v2 submission:

http://www.spinics.net/lists/arm-kernel/msg155790.html

Changes since v2:
1. Fixed the various issues pointed out in v2
2. Made other code cleanup and a bit of re-organizing
3. Removed unecessary platform driver and device.

Performed some basic testing to ensure proper cooling operating. If you want to test this, full testing requires imx6q cpufreq implementation (not yet in v3.2) and requires an imx6q part that has temperature sensor calibration fuses correctly burned.

Robert Lee (1):
ARM: imx: Add basic imx6q thermal management

 arch/arm/boot/dts/imx6q.dtsi    |    1 +
 drivers/thermal/Kconfig         |    6 +
 drivers/thermal/Makefile        |    1 +
 drivers/thermal/imx6q_thermal.c |  520 +++++++++++++++++++++++++++++++++++++++
 4 files changed, 528 insertions(+), 0 deletions(-)
 create mode 100644 drivers/thermal/imx6q_thermal.c
author
#1 lore raw

RFC PATCH v3 1/1 ARM: imx: Add basic imx6q thermal management

Adds support for temperature sensor readings, registers with common thermal framework, and uses the new common cpu_cooling interface.

---
 arch/arm/boot/dts/imx6q.dtsi    |    1 +
 drivers/thermal/Kconfig         |    6 +
 drivers/thermal/Makefile        |    1 +
 drivers/thermal/imx6q_thermal.c |  520 +++++++++++++++++++++++++++++++++++++++
 4 files changed, 528 insertions(+), 0 deletions(-)
 create mode 100644 drivers/thermal/imx6q_thermal.c
arch/arm/boot/dts/imx6q.dtsi +1 -0
index 7dda599..d62b88d 100644
@@ -508,6 +508,7 @@
 			};
 
 			ocotp at 021bc000 {
+				compatible = "fsl,imx6q-ocotp";
 				reg = <0x021bc000 0x4000>;
 			};
 
drivers/thermal/Kconfig +6 -0
index 298c1cd..dd8cede 100644
@@ -29,3 +29,9 @@ config CPU_THERMAL
 	  This will be useful for platforms using the generic thermal interface
 	  and not the ACPI interface.
 	  If you want this support, you should say Y or M here.
+
+config IMX6Q_THERMAL
+	bool "IMX6Q Thermal interface support"
+	depends on THERMAL && CPU_THERMAL
+	help
+	  Adds thermal management for IMX6Q.
drivers/thermal/Makefile +1 -0
index 655cbc4..e2bcffe 100644
@@ -4,3 +4,4 @@
 
 obj-$(CONFIG_THERMAL)		+= thermal_sys.o
 obj-$(CONFIG_CPU_THERMAL)	+= cpu_cooling.o
+obj-$(CONFIG_IMX6Q_THERMAL)	+= imx6q_thermal.o
drivers/thermal/imx6q_thermal.c new file +520 -0

520 lines not on this page · raw message

Signature · 1 line
1.7.1
author
#2 lore raw
Quoted 3 lines

+ ? ? ? /* In the rarest of cases, order matters here - resume goes first */
+ ? ? ? th_zone->therm_dev->device.class->resume = imx6q_thermal_resume;
+ ? ? ? th_zone->therm_dev->device.class->suspend = imx6q_thermal_suspend;

On second thought, I should have barrier between these two statements to guarantee order. I think mb() would be ok.

#3 lore raw
Quoted 5 lines · Rob Lee
Quoted 3 lines

+ ? ? ? /* In the rarest of cases, order matters here - resume goes first */
+ ? ? ? th_zone->therm_dev->device.class->resume = imx6q_thermal_resume;
+ ? ? ? th_zone->therm_dev->device.class->suspend = imx6q_thermal_suspend;

On second thought, I should have barrier between these two statements to guarantee order. I think mb() would be ok.

Err, no. This is a serious bug.

You're writing to this structure:

static struct class thermal_class = {
.name = "thermal",
.dev_release = thermal_release,
};

in thermal_sys.c, which would be shared with other thermal drivers. This is far from safe - it's insane.

The ordering or mb() is the least of your problems.

If there isn't suspend/resume support provided, please talk to the thermal people about how to do this.