Skip to contentSkip to conversation

thermal: omap3 support

PATCH In review Eduardo Valentin 2 participants 4 messages Sep 29, 2015 – Sep 30, 2015

Subsystems (3)
lore
Share & tools
lore

Eduardo Valentin

author maintainer
#0 lore raw

cover thermal: omap3 support

Folks,

I am add these two patches for next merge window. Pavels patch was idling for some time in the mailing list and I found it and gave it a try. In the process, added 36xx support too.

DTS part is not done though.

Anyways, they are in linux-next now. Have fun.

BR,

Eduardo Valentin (1):
thermal: ti-soc-thermal: add OMAP36xx support

Pavel Machek (1):
ti-soc-thermal: implement omap3 support

 .../devicetree/bindings/thermal/ti_soc_thermal.txt |  14 ++
 drivers/thermal/ti-soc-thermal/Kconfig             |  15 ++
 drivers/thermal/ti-soc-thermal/Makefile            |   1 +
 .../thermal/ti-soc-thermal/omap3-thermal-data.c    | 176 +++++++++++++++++++++
 drivers/thermal/ti-soc-thermal/ti-bandgap.c        |  14 ++
 drivers/thermal/ti-soc-thermal/ti-bandgap.h        |  11 ++
 6 files changed, 231 insertions(+)
 create mode 100644 drivers/thermal/ti-soc-thermal/omap3-thermal-data.c
Signature · 1 line
2.5.0
author maintainer
#1 lore raw

PATCH 1/2 ti-soc-thermal: implement omap3 support

From: Pavel Machek <[email protected]>

This adds support for OMAP3 chips to ti-soc-thermal. As requested by TI people, it is marked unreliable and warning is printed.

---
 .../devicetree/bindings/thermal/ti_soc_thermal.txt |   7 ++
 drivers/thermal/ti-soc-thermal/Kconfig             |  15 +++
 drivers/thermal/ti-soc-thermal/Makefile            |   1 +
 .../thermal/ti-soc-thermal/omap3-thermal-data.c    | 103 +++++++++++++++++++++
 drivers/thermal/ti-soc-thermal/ti-bandgap.c        |  10 ++
 drivers/thermal/ti-soc-thermal/ti-bandgap.h        |   9 ++
 6 files changed, 145 insertions(+)
 create mode 100644 drivers/thermal/ti-soc-thermal/omap3-thermal-data.c
Documentation/devicetree/bindings/thermal/ti_soc_thermal.txt +7 -0
index 0c9222d..d9a1b54 100644
@@ -10,6 +10,7 @@ to the silicon temperature.
 
 Required properties:
 - compatible : Should be:
+  - "ti,omap34xx-bandgap" : for OMAP34xx bandgap
   - "ti,omap4430-bandgap" : for OMAP4430 bandgap
   - "ti,omap4460-bandgap" : for OMAP4460 bandgap
   - "ti,omap4470-bandgap" : for OMAP4470 bandgap
@@ -25,6 +26,12 @@ to each bandgap version, because the mapping may change from
 soc to soc, apart of depending on available features.
 
 Example:
+OMAP34xx:
+bandgap {
+	reg = <0x48002524 0x4>;
+	compatible = "ti,omap34xx-bandgap";
+};
+
 OMAP4430:
 bandgap {
 	reg = <0x4a002260 0x4 0x4a00232C 0x4>;
drivers/thermal/ti-soc-thermal/Kconfig +15 -0
index cb6686f..ea8283f 100644
@@ -19,6 +19,21 @@ config TI_THERMAL
 	  This includes trip points definitions, extrapolation rules and
 	  CPU cooling device bindings.
 
+config OMAP3_THERMAL
+	bool "Texas Instruments OMAP3 thermal support"
+	depends on TI_SOC_THERMAL
+	depends on ARCH_OMAP3 || COMPILE_TEST
+	help
+	  If you say yes here you get thermal support for the Texas Instruments
+	  OMAP3 SoC family. The current chips supported are:
+	   - OMAP3430
+
+	  OMAP3 chips normally don't need thermal management, and sensors in
+	  this generation are not accurate, nor they are very close to
+	  the important hotspots.
+
+	  Say 'N' here.
+
 config OMAP4_THERMAL
 	bool "Texas Instruments OMAP4 thermal support"
 	depends on TI_SOC_THERMAL
drivers/thermal/ti-soc-thermal/Makefile +1 -0
index 1226b24..0f89bdf 100644
@@ -2,5 +2,6 @@ obj-$(CONFIG_TI_SOC_THERMAL)		+= ti-soc-thermal.o
 ti-soc-thermal-y			:= ti-bandgap.o
 ti-soc-thermal-$(CONFIG_TI_THERMAL)	+= ti-thermal-common.o
 ti-soc-thermal-$(CONFIG_DRA752_THERMAL)	+= dra752-thermal-data.o
+ti-soc-thermal-$(CONFIG_OMAP3_THERMAL)	+= omap3-thermal-data.o
 ti-soc-thermal-$(CONFIG_OMAP4_THERMAL)	+= omap4-thermal-data.o
 ti-soc-thermal-$(CONFIG_OMAP5_THERMAL)	+= omap5-thermal-data.o
drivers/thermal/ti-soc-thermal/omap3-thermal-data.c new file +103 -0

103 lines not on this page · raw message

drivers/thermal/ti-soc-thermal/ti-bandgap.c +10 -0
index 10c47c0..9f9ed72 100644
@@ -1274,6 +1274,10 @@ int ti_bandgap_probe(struct platform_device *pdev)
 	}
 	bgp->dev = &pdev->dev;
 
+	if (TI_BANDGAP_HAS(bgp, UNRELIABLE))
+		dev_warn(&pdev->dev,
+			 "This OMAP thermal sensor is unreliable. You've been warned\n");
+
 	if (TI_BANDGAP_HAS(bgp, TSHUT)) {
 		ret = ti_bandgap_tshut_init(bgp, pdev);
 		if (ret) {
@@ -1579,6 +1583,12 @@ static SIMPLE_DEV_PM_OPS(ti_bandgap_dev_pm_ops, ti_bandgap_suspend,
 #endif
 
 static const struct of_device_id of_ti_bandgap_match[] = {
+#ifdef CONFIG_OMAP3_THERMAL
+	{
+		.compatible = "ti,omap34xx-bandgap",
+		.data = (void *)&omap34xx_data,
+	},
+#endif
 #ifdef CONFIG_OMAP4_THERMAL
 	{
 		.compatible = "ti,omap4430-bandgap",
drivers/thermal/ti-soc-thermal/ti-bandgap.h +9 -0
index 0c52f7a..045f642 100644
@@ -322,6 +322,8 @@ struct ti_temp_sensor {
  *	has Errata 814
  * TI_BANDGAP_FEATURE_ERRATA_813 - used to workaorund when the bandgap device
  *	has Errata 813
+ * TI_BANDGAP_FEATURE_UNRELIABLE - used when the sensor readings are too
+ *	inaccurate.
  * TI_BANDGAP_HAS(b, f) - macro to check if a bandgap device is capable of a
  *      specific feature (above) or not. Return non-zero, if yes.
  */
@@ -337,6 +339,7 @@ struct ti_temp_sensor {
 #define TI_BANDGAP_FEATURE_HISTORY_BUFFER	BIT(9)
 #define TI_BANDGAP_FEATURE_ERRATA_814		BIT(10)
 #define TI_BANDGAP_FEATURE_ERRATA_813		BIT(11)
+#define TI_BANDGAP_FEATURE_UNRELIABLE		BIT(12)
 #define TI_BANDGAP_HAS(b, f)			\
 			((b)->conf->features & TI_BANDGAP_FEATURE_ ## f)
 
@@ -390,6 +393,12 @@ int ti_bandgap_set_sensor_data(struct ti_bandgap *bgp, int id, void *data);
 void *ti_bandgap_get_sensor_data(struct ti_bandgap *bgp, int id);
 int ti_bandgap_get_trend(struct ti_bandgap *bgp, int id, int *trend);
 
+#ifdef CONFIG_OMAP3_THERMAL
+extern const struct ti_bandgap_data omap34xx_data;
+#else
+#define omap34xx_data					NULL
+#endif
+
 #ifdef CONFIG_OMAP4_THERMAL
 extern const struct ti_bandgap_data omap4430_data;
 extern const struct ti_bandgap_data omap4460_data;
Signature · 1 line
2.5.0
author maintainer
#2 lore raw

PATCH 2/2 thermal: ti-soc-thermal: add OMAP36xx support

In reply to Eduardo Valentin

Add OMAP36xx support to ti-soc-thermal driver. This chip is also unreliable. The data provided here is based on OMAP36xx TRM:
http://www.ti.com/lit/ug/swpu177aa/swpu177aa.pdf

---
 .../devicetree/bindings/thermal/ti_soc_thermal.txt |  7 +++
 .../thermal/ti-soc-thermal/omap3-thermal-data.c    | 73 ++++++++++++++++++++++
 drivers/thermal/ti-soc-thermal/ti-bandgap.c        |  4 ++
 drivers/thermal/ti-soc-thermal/ti-bandgap.h        |  2 +
 4 files changed, 86 insertions(+)
Documentation/devicetree/bindings/thermal/ti_soc_thermal.txt +7 -0
index d9a1b54..6299dd8 100644
@@ -11,6 +11,7 @@ to the silicon temperature.
 Required properties:
 - compatible : Should be:
   - "ti,omap34xx-bandgap" : for OMAP34xx bandgap
+  - "ti,omap36xx-bandgap" : for OMAP36xx bandgap
   - "ti,omap4430-bandgap" : for OMAP4430 bandgap
   - "ti,omap4460-bandgap" : for OMAP4460 bandgap
   - "ti,omap4470-bandgap" : for OMAP4470 bandgap
@@ -32,6 +33,12 @@ bandgap {
 	compatible = "ti,omap34xx-bandgap";
 };
 
+OMAP36xx:
+bandgap {
+	reg = <0x48002524 0x4>;
+	compatible = "ti,omap36xx-bandgap";
+};
+
 OMAP4430:
 bandgap {
 	reg = <0x4a002260 0x4 0x4a00232C 0x4>;
drivers/thermal/ti-soc-thermal/omap3-thermal-data.c +73 -0

76 lines not on this page · raw message

drivers/thermal/ti-soc-thermal/ti-bandgap.c +4 -0
index 9f9ed72..1e34a1e 100644
@@ -1588,6 +1588,10 @@ static const struct of_device_id of_ti_bandgap_match[] = {
 		.compatible = "ti,omap34xx-bandgap",
 		.data = (void *)&omap34xx_data,
 	},
+	{
+		.compatible = "ti,omap36xx-bandgap",
+		.data = (void *)&omap36xx_data,
+	},
 #endif
 #ifdef CONFIG_OMAP4_THERMAL
 	{
drivers/thermal/ti-soc-thermal/ti-bandgap.h +2 -0
index 045f642..fe0adb8 100644
@@ -395,8 +395,10 @@ int ti_bandgap_get_trend(struct ti_bandgap *bgp, int id, int *trend);
 
 #ifdef CONFIG_OMAP3_THERMAL
 extern const struct ti_bandgap_data omap34xx_data;
+extern const struct ti_bandgap_data omap36xx_data;
 #else
 #define omap34xx_data					NULL
+#define omap36xx_data					NULL
 #endif
 
 #ifdef CONFIG_OMAP4_THERMAL
Signature · 1 line
2.5.0