ti-soc-thermal: implement omap3 support
Subsystems (3)
Eduardo Valentin
maintainerPATCH v3 1/1 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
---
Just not leave Pavels work behind, I took his patch and amended a couple of things:
(1) added the omap3 DT example
(2) improved the dev_warn message
(3) improved the code documentation
Documentation/devicetree/bindings/thermal/ti_soc_thermal.txt +7 -0
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
Quoted 20 lines · Eduardo Valentin
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.
Cc Zhang Rui <[email protected]>Signed-off-by Pavel Machek <[email protected]>Signed-off-by Eduardo Valentin <[email protected]>--- .../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
Quoted 7 lines
---
Just not leave Pavels work behind, I took his patch and amended a couple of things:
(1) added the omap3 DT example
(2) improved thedev_warnmessage
(3) improved the code documentation
Thanks!
Is it on its way to mainline or is there something more to do?
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Eduardo Valentin
maintainerQuoted 29 lines · Pavel Machek
Quoted 20 lines · Eduardo Valentin
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.
Cc Zhang Rui <[email protected]>Signed-off-by Pavel Machek <[email protected]>Signed-off-by Eduardo Valentin <[email protected]>--- .../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.cQuoted 7 lines
---
Just not leave Pavels work behind, I took his patch and amended a couple of things:
(1) added the omap3 DT example
(2) improved thedev_warnmessage
(3) improved the code documentation
Quoted 3 lines
Thanks!
Is it on its way to mainline or is there something more to do?
Nothing else to do. I am applying to my next branch.
Quoted 6 lines
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html