Re: [PATCH V6 04/30] thermal: exynos: Bifurcate exynos thermal common and tmu controller code
On 20-06-2013 21:50, amit daniel kachhap wrote: > On Thu, Jun 20, 2013 at 12:15 AM, Eduardo Valentin > wrote: >> Amit, >> >> On 17-06-2013 02:46, Amit Daniel Kachhap wrote: >>> This code bifurcates exynos thermal implementation into common and sensor >>> specific parts. The common thermal code interacts with core thermal layer >>> and >>> core cpufreq cooling parts and is independent of SOC specific driver. This >>> change is needed to cleanly add support for new TMU sensors. >>> >>> Acked-by: Kukjin Kim >>> Acked-by: Jonghwa Lee >>> Signed-off-by: Amit Daniel Kachhap >>> --- >>> drivers/thermal/samsung/Kconfig | 19 +- >>> drivers/thermal/samsung/Makefile|4 +- >>> drivers/thermal/samsung/exynos_thermal.c| 419 >>> +-- >>> drivers/thermal/samsung/exynos_thermal_common.c | 384 >>> + >>> drivers/thermal/samsung/exynos_thermal_common.h | 83 + >>> 5 files changed, 490 insertions(+), 419 deletions(-) >>> create mode 100644 drivers/thermal/samsung/exynos_thermal_common.c >>> create mode 100644 drivers/thermal/samsung/exynos_thermal_common.h >>> >>> diff --git a/drivers/thermal/samsung/Kconfig >>> b/drivers/thermal/samsung/Kconfig >>> index 2cf31ad..f8100b1 100644 >>> --- a/drivers/thermal/samsung/Kconfig >>> +++ b/drivers/thermal/samsung/Kconfig >>> @@ -1,8 +1,17 @@ >>> config EXYNOS_THERMAL >>> - tristate "Temperature sensor on Samsung EXYNOS" >>> + tristate "Exynos thermal management unit driver" >>> depends on ARCH_HAS_BANDGAP >>> help >>> - If you say yes here you get support for TMU (Thermal Management >>> - Unit) on SAMSUNG EXYNOS series of SoC. This helps in registering >>> - the exynos thermal driver with the core thermal layer and cpu >>> - cooling API's. >>> + If you say yes here you get support for the TMU (Thermal Management >>> + Unit) driver for SAMSUNG EXYNOS series of soc. This driver >>> initialises >>> + the TMU, reports temperature and handles cooling action if defined. >>> + This driver uses the exynos core thermal API's. >>> + >>> +config EXYNOS_THERMAL_CORE >>> + bool "Core thermal framework support for EXYNOS SOC's" >>> + depends on EXYNOS_THERMAL >>> + help >>> + If you say yes here you get support for EXYNOS TMU >>> + (Thermal Management Unit) common registration/unregistration >>> + functions to the core thermal layer and also to use the generic >>> + cpu cooling API's. >> Should this one depend on CPU_THERMAL? Is it mandatory? > Hi Eduardo, > > No it is not mandatory. If CPU_THERMAL is not present then cooling > device is not created and only temp/trip_points etc sysfs are created. OK. > > Thanks, > Amit Daniel >> >>> diff --git a/drivers/thermal/samsung/Makefile >>> b/drivers/thermal/samsung/Makefile >>> index 1fe6d93..6227d4f 100644 >>> --- a/drivers/thermal/samsung/Makefile >>> +++ b/drivers/thermal/samsung/Makefile >>> @@ -1,4 +1,6 @@ >>> # >>> # Samsung thermal specific Makefile >>> # >>> -obj-$(CONFIG_EXYNOS_THERMAL) += exynos_thermal.o >>> +obj-$(CONFIG_EXYNOS_THERMAL) += exynos_soc_thermal.o >>> +exynos_soc_thermal-y := exynos_thermal.o >>> +exynos_soc_thermal-$(CONFIG_EXYNOS_THERMAL_CORE) += exynos_thermal_common.o >>> diff --git a/drivers/thermal/samsung/exynos_thermal.c >>> b/drivers/thermal/samsung/exynos_thermal.c >>> index 03e4bbc..5293849 100644 >>> --- a/drivers/thermal/samsung/exynos_thermal.c >>> +++ b/drivers/thermal/samsung/exynos_thermal.c >>> @@ -21,23 +21,15 @@ >>> * >>> */ >>> >>> -#include >>> -#include >>> -#include >>> -#include >>> -#include >>> -#include >>> #include >>> -#include >>> -#include >>> -#include >>> #include >>> -#include >>> -#include >>> -#include >>> -#include >>> -#include >>> +#include >>> +#include >>> #include >>> +#include >>> +#include >>> + >>> +#include "exynos_thermal_common.h" >>> >>> /* Exynos generic registers */ >>> #define EXYNOS_TMU_REG_TRIMINFO 0x0 >>> @@ -88,16 +80,6 @@ >>> #define EFUSE_MIN_VALUE 40 >>> #define EFUSE_MAX_VALUE 100 >>> >>> -/* In-kernel thermal framework related macros & definations */ >>> -#define SENSOR_NAME_LEN 16 >>> -#define MAX_TRIP_COUNT 8 >>> -#define MAX_COOLING_DEVICE 4 >>> -#define MAX_THRESHOLD_LEVS 4 >>> - >>> -#define ACTIVE_INTERVAL 500 >>> -#define IDLE_INTERVAL 1 >>> -#define MCELSIUS 1000 >>> - >>> #ifdef CONFIG_THERMAL_EMULATION >>> #define EXYNOS_EMUL_TIME 0x57F0 >>> #define EXYNOS_EMUL_TIME_SHIFT 16 >>> @@ -106,17 +88,6 @@ >>> #define EXYNOS_EMUL_ENABLE 0x1 >>> #endif /* CONFIG_THERMAL_EMULATION */ >>> >>> -/* CPU Zone information */ >>> -#define PANIC_ZONE 4 >>> -#define WARN_ZONE 3 >>> -#define MONITOR_ZONE2 >>> -#define SAFE_ZONE 1 >>> - >>> -#define GET_ZONE(trip) (trip + 2) >>> -#define GET_TRIP(zone) (zone - 2) >>> - >>>
Re: [PATCH V6 04/30] thermal: exynos: Bifurcate exynos thermal common and tmu controller code
On 17-06-2013 02:46, Amit Daniel Kachhap wrote: > This code bifurcates exynos thermal implementation into common and sensor > specific parts. The common thermal code interacts with core thermal layer and > core cpufreq cooling parts and is independent of SOC specific driver. This > change is needed to cleanly add support for new TMU sensors. > > Acked-by: Kukjin Kim > Acked-by: Jonghwa Lee > Signed-off-by: Amit Daniel Kachhap Acked-by: Eduardo Valentin > --- > drivers/thermal/samsung/Kconfig | 19 +- > drivers/thermal/samsung/Makefile|4 +- > drivers/thermal/samsung/exynos_thermal.c| 419 > +-- > drivers/thermal/samsung/exynos_thermal_common.c | 384 + > drivers/thermal/samsung/exynos_thermal_common.h | 83 + > 5 files changed, 490 insertions(+), 419 deletions(-) > create mode 100644 drivers/thermal/samsung/exynos_thermal_common.c > create mode 100644 drivers/thermal/samsung/exynos_thermal_common.h > > diff --git a/drivers/thermal/samsung/Kconfig b/drivers/thermal/samsung/Kconfig > index 2cf31ad..f8100b1 100644 > --- a/drivers/thermal/samsung/Kconfig > +++ b/drivers/thermal/samsung/Kconfig > @@ -1,8 +1,17 @@ > config EXYNOS_THERMAL > - tristate "Temperature sensor on Samsung EXYNOS" > + tristate "Exynos thermal management unit driver" > depends on ARCH_HAS_BANDGAP > help > - If you say yes here you get support for TMU (Thermal Management > - Unit) on SAMSUNG EXYNOS series of SoC. This helps in registering > - the exynos thermal driver with the core thermal layer and cpu > - cooling API's. > + If you say yes here you get support for the TMU (Thermal Management > + Unit) driver for SAMSUNG EXYNOS series of soc. This driver initialises > + the TMU, reports temperature and handles cooling action if defined. > + This driver uses the exynos core thermal API's. > + > +config EXYNOS_THERMAL_CORE > + bool "Core thermal framework support for EXYNOS SOC's" > + depends on EXYNOS_THERMAL > + help > + If you say yes here you get support for EXYNOS TMU > + (Thermal Management Unit) common registration/unregistration > + functions to the core thermal layer and also to use the generic > + cpu cooling API's. > diff --git a/drivers/thermal/samsung/Makefile > b/drivers/thermal/samsung/Makefile > index 1fe6d93..6227d4f 100644 > --- a/drivers/thermal/samsung/Makefile > +++ b/drivers/thermal/samsung/Makefile > @@ -1,4 +1,6 @@ > # > # Samsung thermal specific Makefile > # > -obj-$(CONFIG_EXYNOS_THERMAL) += exynos_thermal.o > +obj-$(CONFIG_EXYNOS_THERMAL) += exynos_soc_thermal.o > +exynos_soc_thermal-y := exynos_thermal.o > +exynos_soc_thermal-$(CONFIG_EXYNOS_THERMAL_CORE) += exynos_thermal_common.o > diff --git a/drivers/thermal/samsung/exynos_thermal.c > b/drivers/thermal/samsung/exynos_thermal.c > index 03e4bbc..5293849 100644 > --- a/drivers/thermal/samsung/exynos_thermal.c > +++ b/drivers/thermal/samsung/exynos_thermal.c > @@ -21,23 +21,15 @@ > * > */ > > -#include > -#include > -#include > -#include > -#include > -#include > #include > -#include > -#include > -#include > #include > -#include > -#include > -#include > -#include > -#include > +#include > +#include > #include > +#include > +#include > + > +#include "exynos_thermal_common.h" > > /* Exynos generic registers */ > #define EXYNOS_TMU_REG_TRIMINFO 0x0 > @@ -88,16 +80,6 @@ > #define EFUSE_MIN_VALUE 40 > #define EFUSE_MAX_VALUE 100 > > -/* In-kernel thermal framework related macros & definations */ > -#define SENSOR_NAME_LEN 16 > -#define MAX_TRIP_COUNT 8 > -#define MAX_COOLING_DEVICE 4 > -#define MAX_THRESHOLD_LEVS 4 > - > -#define ACTIVE_INTERVAL 500 > -#define IDLE_INTERVAL 1 > -#define MCELSIUS 1000 > - > #ifdef CONFIG_THERMAL_EMULATION > #define EXYNOS_EMUL_TIME 0x57F0 > #define EXYNOS_EMUL_TIME_SHIFT 16 > @@ -106,17 +88,6 @@ > #define EXYNOS_EMUL_ENABLE 0x1 > #endif /* CONFIG_THERMAL_EMULATION */ > > -/* CPU Zone information */ > -#define PANIC_ZONE 4 > -#define WARN_ZONE 3 > -#define MONITOR_ZONE2 > -#define SAFE_ZONE 1 > - > -#define GET_ZONE(trip) (trip + 2) > -#define GET_TRIP(zone) (zone - 2) > - > -#define EXYNOS_ZONE_COUNT3 > - > struct exynos_tmu_data { > struct exynos_tmu_platform_data *pdata; > struct resource *mem; > @@ -129,384 +100,6 @@ struct exynos_tmu_data { > u8 temp_error1, temp_error2; > }; > > -struct thermal_trip_point_conf { > - int trip_val[MAX_TRIP_COUNT]; > - int trip_count; > - u8 trigger_falling; > -}; > - > -struct thermal_cooling_conf { > - struct freq_clip_table freq_data[MAX_TRIP_COUNT]; > - int freq_clip_count; > -}; > - > -struct thermal_sensor_conf { > - char name[SENSOR_NAME_LEN]; > - int
Re: [PATCH V6 04/30] thermal: exynos: Bifurcate exynos thermal common and tmu controller code
On 20-06-2013 21:50, amit daniel kachhap wrote: On Thu, Jun 20, 2013 at 12:15 AM, Eduardo Valentin eduardo.valen...@ti.com wrote: Amit, On 17-06-2013 02:46, Amit Daniel Kachhap wrote: This code bifurcates exynos thermal implementation into common and sensor specific parts. The common thermal code interacts with core thermal layer and core cpufreq cooling parts and is independent of SOC specific driver. This change is needed to cleanly add support for new TMU sensors. Acked-by: Kukjin Kim kgene@samsung.com Acked-by: Jonghwa Lee jonghwa3@samsung.com Signed-off-by: Amit Daniel Kachhap amit.dan...@samsung.com --- drivers/thermal/samsung/Kconfig | 19 +- drivers/thermal/samsung/Makefile|4 +- drivers/thermal/samsung/exynos_thermal.c| 419 +-- drivers/thermal/samsung/exynos_thermal_common.c | 384 + drivers/thermal/samsung/exynos_thermal_common.h | 83 + 5 files changed, 490 insertions(+), 419 deletions(-) create mode 100644 drivers/thermal/samsung/exynos_thermal_common.c create mode 100644 drivers/thermal/samsung/exynos_thermal_common.h diff --git a/drivers/thermal/samsung/Kconfig b/drivers/thermal/samsung/Kconfig index 2cf31ad..f8100b1 100644 --- a/drivers/thermal/samsung/Kconfig +++ b/drivers/thermal/samsung/Kconfig @@ -1,8 +1,17 @@ config EXYNOS_THERMAL - tristate Temperature sensor on Samsung EXYNOS + tristate Exynos thermal management unit driver depends on ARCH_HAS_BANDGAP help - If you say yes here you get support for TMU (Thermal Management - Unit) on SAMSUNG EXYNOS series of SoC. This helps in registering - the exynos thermal driver with the core thermal layer and cpu - cooling API's. + If you say yes here you get support for the TMU (Thermal Management + Unit) driver for SAMSUNG EXYNOS series of soc. This driver initialises + the TMU, reports temperature and handles cooling action if defined. + This driver uses the exynos core thermal API's. + +config EXYNOS_THERMAL_CORE + bool Core thermal framework support for EXYNOS SOC's + depends on EXYNOS_THERMAL + help + If you say yes here you get support for EXYNOS TMU + (Thermal Management Unit) common registration/unregistration + functions to the core thermal layer and also to use the generic + cpu cooling API's. Should this one depend on CPU_THERMAL? Is it mandatory? Hi Eduardo, No it is not mandatory. If CPU_THERMAL is not present then cooling device is not created and only temp/trip_points etc sysfs are created. OK. Thanks, Amit Daniel diff --git a/drivers/thermal/samsung/Makefile b/drivers/thermal/samsung/Makefile index 1fe6d93..6227d4f 100644 --- a/drivers/thermal/samsung/Makefile +++ b/drivers/thermal/samsung/Makefile @@ -1,4 +1,6 @@ # # Samsung thermal specific Makefile # -obj-$(CONFIG_EXYNOS_THERMAL) += exynos_thermal.o +obj-$(CONFIG_EXYNOS_THERMAL) += exynos_soc_thermal.o +exynos_soc_thermal-y := exynos_thermal.o +exynos_soc_thermal-$(CONFIG_EXYNOS_THERMAL_CORE) += exynos_thermal_common.o diff --git a/drivers/thermal/samsung/exynos_thermal.c b/drivers/thermal/samsung/exynos_thermal.c index 03e4bbc..5293849 100644 --- a/drivers/thermal/samsung/exynos_thermal.c +++ b/drivers/thermal/samsung/exynos_thermal.c @@ -21,23 +21,15 @@ * */ -#include linux/module.h -#include linux/err.h -#include linux/kernel.h -#include linux/slab.h -#include linux/platform_device.h -#include linux/interrupt.h #include linux/clk.h -#include linux/workqueue.h -#include linux/sysfs.h -#include linux/kobject.h #include linux/io.h -#include linux/mutex.h -#include linux/platform_data/exynos_thermal.h -#include linux/thermal.h -#include linux/cpufreq.h -#include linux/cpu_cooling.h +#include linux/interrupt.h +#include linux/module.h #include linux/of.h +#include linux/platform_device.h +#include linux/platform_data/exynos_thermal.h + +#include exynos_thermal_common.h /* Exynos generic registers */ #define EXYNOS_TMU_REG_TRIMINFO 0x0 @@ -88,16 +80,6 @@ #define EFUSE_MIN_VALUE 40 #define EFUSE_MAX_VALUE 100 -/* In-kernel thermal framework related macros definations */ -#define SENSOR_NAME_LEN 16 -#define MAX_TRIP_COUNT 8 -#define MAX_COOLING_DEVICE 4 -#define MAX_THRESHOLD_LEVS 4 - -#define ACTIVE_INTERVAL 500 -#define IDLE_INTERVAL 1 -#define MCELSIUS 1000 - #ifdef CONFIG_THERMAL_EMULATION #define EXYNOS_EMUL_TIME 0x57F0 #define EXYNOS_EMUL_TIME_SHIFT 16 @@ -106,17 +88,6 @@ #define EXYNOS_EMUL_ENABLE 0x1 #endif /* CONFIG_THERMAL_EMULATION */ -/* CPU Zone information */ -#define PANIC_ZONE 4 -#define WARN_ZONE 3 -#define MONITOR_ZONE2 -#define SAFE_ZONE 1 - -#define GET_ZONE(trip) (trip + 2) -#define
Re: [PATCH V6 04/30] thermal: exynos: Bifurcate exynos thermal common and tmu controller code
On 17-06-2013 02:46, Amit Daniel Kachhap wrote: This code bifurcates exynos thermal implementation into common and sensor specific parts. The common thermal code interacts with core thermal layer and core cpufreq cooling parts and is independent of SOC specific driver. This change is needed to cleanly add support for new TMU sensors. Acked-by: Kukjin Kim kgene@samsung.com Acked-by: Jonghwa Lee jonghwa3@samsung.com Signed-off-by: Amit Daniel Kachhap amit.dan...@samsung.com Acked-by: Eduardo Valentin eduardo.valen...@ti.com --- drivers/thermal/samsung/Kconfig | 19 +- drivers/thermal/samsung/Makefile|4 +- drivers/thermal/samsung/exynos_thermal.c| 419 +-- drivers/thermal/samsung/exynos_thermal_common.c | 384 + drivers/thermal/samsung/exynos_thermal_common.h | 83 + 5 files changed, 490 insertions(+), 419 deletions(-) create mode 100644 drivers/thermal/samsung/exynos_thermal_common.c create mode 100644 drivers/thermal/samsung/exynos_thermal_common.h diff --git a/drivers/thermal/samsung/Kconfig b/drivers/thermal/samsung/Kconfig index 2cf31ad..f8100b1 100644 --- a/drivers/thermal/samsung/Kconfig +++ b/drivers/thermal/samsung/Kconfig @@ -1,8 +1,17 @@ config EXYNOS_THERMAL - tristate Temperature sensor on Samsung EXYNOS + tristate Exynos thermal management unit driver depends on ARCH_HAS_BANDGAP help - If you say yes here you get support for TMU (Thermal Management - Unit) on SAMSUNG EXYNOS series of SoC. This helps in registering - the exynos thermal driver with the core thermal layer and cpu - cooling API's. + If you say yes here you get support for the TMU (Thermal Management + Unit) driver for SAMSUNG EXYNOS series of soc. This driver initialises + the TMU, reports temperature and handles cooling action if defined. + This driver uses the exynos core thermal API's. + +config EXYNOS_THERMAL_CORE + bool Core thermal framework support for EXYNOS SOC's + depends on EXYNOS_THERMAL + help + If you say yes here you get support for EXYNOS TMU + (Thermal Management Unit) common registration/unregistration + functions to the core thermal layer and also to use the generic + cpu cooling API's. diff --git a/drivers/thermal/samsung/Makefile b/drivers/thermal/samsung/Makefile index 1fe6d93..6227d4f 100644 --- a/drivers/thermal/samsung/Makefile +++ b/drivers/thermal/samsung/Makefile @@ -1,4 +1,6 @@ # # Samsung thermal specific Makefile # -obj-$(CONFIG_EXYNOS_THERMAL) += exynos_thermal.o +obj-$(CONFIG_EXYNOS_THERMAL) += exynos_soc_thermal.o +exynos_soc_thermal-y := exynos_thermal.o +exynos_soc_thermal-$(CONFIG_EXYNOS_THERMAL_CORE) += exynos_thermal_common.o diff --git a/drivers/thermal/samsung/exynos_thermal.c b/drivers/thermal/samsung/exynos_thermal.c index 03e4bbc..5293849 100644 --- a/drivers/thermal/samsung/exynos_thermal.c +++ b/drivers/thermal/samsung/exynos_thermal.c @@ -21,23 +21,15 @@ * */ -#include linux/module.h -#include linux/err.h -#include linux/kernel.h -#include linux/slab.h -#include linux/platform_device.h -#include linux/interrupt.h #include linux/clk.h -#include linux/workqueue.h -#include linux/sysfs.h -#include linux/kobject.h #include linux/io.h -#include linux/mutex.h -#include linux/platform_data/exynos_thermal.h -#include linux/thermal.h -#include linux/cpufreq.h -#include linux/cpu_cooling.h +#include linux/interrupt.h +#include linux/module.h #include linux/of.h +#include linux/platform_device.h +#include linux/platform_data/exynos_thermal.h + +#include exynos_thermal_common.h /* Exynos generic registers */ #define EXYNOS_TMU_REG_TRIMINFO 0x0 @@ -88,16 +80,6 @@ #define EFUSE_MIN_VALUE 40 #define EFUSE_MAX_VALUE 100 -/* In-kernel thermal framework related macros definations */ -#define SENSOR_NAME_LEN 16 -#define MAX_TRIP_COUNT 8 -#define MAX_COOLING_DEVICE 4 -#define MAX_THRESHOLD_LEVS 4 - -#define ACTIVE_INTERVAL 500 -#define IDLE_INTERVAL 1 -#define MCELSIUS 1000 - #ifdef CONFIG_THERMAL_EMULATION #define EXYNOS_EMUL_TIME 0x57F0 #define EXYNOS_EMUL_TIME_SHIFT 16 @@ -106,17 +88,6 @@ #define EXYNOS_EMUL_ENABLE 0x1 #endif /* CONFIG_THERMAL_EMULATION */ -/* CPU Zone information */ -#define PANIC_ZONE 4 -#define WARN_ZONE 3 -#define MONITOR_ZONE2 -#define SAFE_ZONE 1 - -#define GET_ZONE(trip) (trip + 2) -#define GET_TRIP(zone) (zone - 2) - -#define EXYNOS_ZONE_COUNT3 - struct exynos_tmu_data { struct exynos_tmu_platform_data *pdata; struct resource *mem; @@ -129,384 +100,6 @@ struct exynos_tmu_data { u8 temp_error1, temp_error2; }; -struct thermal_trip_point_conf { - int
Re: [PATCH V6 04/30] thermal: exynos: Bifurcate exynos thermal common and tmu controller code
On Thu, Jun 20, 2013 at 12:31 AM, Eduardo Valentin wrote: > On 17-06-2013 02:46, Amit Daniel Kachhap wrote: >> This code bifurcates exynos thermal implementation into common and sensor >> specific parts. The common thermal code interacts with core thermal layer and >> core cpufreq cooling parts and is independent of SOC specific driver. This >> change is needed to cleanly add support for new TMU sensors. >> >> Acked-by: Kukjin Kim >> Acked-by: Jonghwa Lee >> Signed-off-by: Amit Daniel Kachhap >> --- >> drivers/thermal/samsung/Kconfig | 19 +- >> drivers/thermal/samsung/Makefile|4 +- >> drivers/thermal/samsung/exynos_thermal.c| 419 >> +-- >> drivers/thermal/samsung/exynos_thermal_common.c | 384 + >> drivers/thermal/samsung/exynos_thermal_common.h | 83 + >> 5 files changed, 490 insertions(+), 419 deletions(-) >> create mode 100644 drivers/thermal/samsung/exynos_thermal_common.c >> create mode 100644 drivers/thermal/samsung/exynos_thermal_common.h >> >> diff --git a/drivers/thermal/samsung/Kconfig >> b/drivers/thermal/samsung/Kconfig >> index 2cf31ad..f8100b1 100644 >> --- a/drivers/thermal/samsung/Kconfig >> +++ b/drivers/thermal/samsung/Kconfig >> @@ -1,8 +1,17 @@ >> config EXYNOS_THERMAL >> - tristate "Temperature sensor on Samsung EXYNOS" >> + tristate "Exynos thermal management unit driver" >> depends on ARCH_HAS_BANDGAP > > This is not really on this patch, but I think this one needs to depend > on CONFIG_OF too. In the driver CONFIG_OF is used for DT api's so this is not needed here. > >> help >> - If you say yes here you get support for TMU (Thermal Management >> - Unit) on SAMSUNG EXYNOS series of SoC. This helps in registering >> - the exynos thermal driver with the core thermal layer and cpu >> - cooling API's. >> + If you say yes here you get support for the TMU (Thermal Management >> + Unit) driver for SAMSUNG EXYNOS series of soc. This driver >> initialises >> + the TMU, reports temperature and handles cooling action if defined. >> + This driver uses the exynos core thermal API's. >> + >> +config EXYNOS_THERMAL_CORE >> + bool "Core thermal framework support for EXYNOS SOC's" >> + depends on EXYNOS_THERMAL >> + help >> + If you say yes here you get support for EXYNOS TMU >> + (Thermal Management Unit) common registration/unregistration >> + functions to the core thermal layer and also to use the generic >> + cpu cooling API's. >> diff --git a/drivers/thermal/samsung/Makefile >> b/drivers/thermal/samsung/Makefile >> index 1fe6d93..6227d4f 100644 >> --- a/drivers/thermal/samsung/Makefile >> +++ b/drivers/thermal/samsung/Makefile >> @@ -1,4 +1,6 @@ >> # >> # Samsung thermal specific Makefile >> # >> -obj-$(CONFIG_EXYNOS_THERMAL) += exynos_thermal.o >> +obj-$(CONFIG_EXYNOS_THERMAL) += exynos_soc_thermal.o >> +exynos_soc_thermal-y := exynos_thermal.o >> +exynos_soc_thermal-$(CONFIG_EXYNOS_THERMAL_CORE) += exynos_thermal_common.o >> diff --git a/drivers/thermal/samsung/exynos_thermal.c >> b/drivers/thermal/samsung/exynos_thermal.c >> index 03e4bbc..5293849 100644 >> --- a/drivers/thermal/samsung/exynos_thermal.c >> +++ b/drivers/thermal/samsung/exynos_thermal.c >> @@ -21,23 +21,15 @@ >> * >> */ >> >> -#include >> -#include >> -#include >> -#include >> -#include >> -#include >> #include >> -#include >> -#include >> -#include >> #include >> -#include >> -#include >> -#include >> -#include >> -#include >> +#include >> +#include >> #include >> +#include >> +#include >> + >> +#include "exynos_thermal_common.h" >> >> /* Exynos generic registers */ >> #define EXYNOS_TMU_REG_TRIMINFO 0x0 >> @@ -88,16 +80,6 @@ >> #define EFUSE_MIN_VALUE 40 >> #define EFUSE_MAX_VALUE 100 >> >> -/* In-kernel thermal framework related macros & definations */ >> -#define SENSOR_NAME_LEN 16 >> -#define MAX_TRIP_COUNT 8 >> -#define MAX_COOLING_DEVICE 4 >> -#define MAX_THRESHOLD_LEVS 4 >> - >> -#define ACTIVE_INTERVAL 500 >> -#define IDLE_INTERVAL 1 >> -#define MCELSIUS 1000 >> - >> #ifdef CONFIG_THERMAL_EMULATION >> #define EXYNOS_EMUL_TIME 0x57F0 >> #define EXYNOS_EMUL_TIME_SHIFT 16 >> @@ -106,17 +88,6 @@ >> #define EXYNOS_EMUL_ENABLE 0x1 >> #endif /* CONFIG_THERMAL_EMULATION */ >> >> -/* CPU Zone information */ >> -#define PANIC_ZONE 4 >> -#define WARN_ZONE 3 >> -#define MONITOR_ZONE2 >> -#define SAFE_ZONE 1 >> - >> -#define GET_ZONE(trip) (trip + 2) >> -#define GET_TRIP(zone) (zone - 2) >> - >> -#define EXYNOS_ZONE_COUNT3 >> - >> struct exynos_tmu_data { >> struct exynos_tmu_platform_data *pdata; >> struct resource *mem; >> @@ -129,384 +100,6 @@ struct exynos_tmu_data { >> u8 temp_error1, temp_error2; >> }; >> >> -struct thermal_trip_point_conf {
Re: [PATCH V6 04/30] thermal: exynos: Bifurcate exynos thermal common and tmu controller code
On Thu, Jun 20, 2013 at 12:15 AM, Eduardo Valentin wrote: > Amit, > > On 17-06-2013 02:46, Amit Daniel Kachhap wrote: >> This code bifurcates exynos thermal implementation into common and sensor >> specific parts. The common thermal code interacts with core thermal layer and >> core cpufreq cooling parts and is independent of SOC specific driver. This >> change is needed to cleanly add support for new TMU sensors. >> >> Acked-by: Kukjin Kim >> Acked-by: Jonghwa Lee >> Signed-off-by: Amit Daniel Kachhap >> --- >> drivers/thermal/samsung/Kconfig | 19 +- >> drivers/thermal/samsung/Makefile|4 +- >> drivers/thermal/samsung/exynos_thermal.c| 419 >> +-- >> drivers/thermal/samsung/exynos_thermal_common.c | 384 + >> drivers/thermal/samsung/exynos_thermal_common.h | 83 + >> 5 files changed, 490 insertions(+), 419 deletions(-) >> create mode 100644 drivers/thermal/samsung/exynos_thermal_common.c >> create mode 100644 drivers/thermal/samsung/exynos_thermal_common.h >> >> diff --git a/drivers/thermal/samsung/Kconfig >> b/drivers/thermal/samsung/Kconfig >> index 2cf31ad..f8100b1 100644 >> --- a/drivers/thermal/samsung/Kconfig >> +++ b/drivers/thermal/samsung/Kconfig >> @@ -1,8 +1,17 @@ >> config EXYNOS_THERMAL >> - tristate "Temperature sensor on Samsung EXYNOS" >> + tristate "Exynos thermal management unit driver" >> depends on ARCH_HAS_BANDGAP >> help >> - If you say yes here you get support for TMU (Thermal Management >> - Unit) on SAMSUNG EXYNOS series of SoC. This helps in registering >> - the exynos thermal driver with the core thermal layer and cpu >> - cooling API's. >> + If you say yes here you get support for the TMU (Thermal Management >> + Unit) driver for SAMSUNG EXYNOS series of soc. This driver >> initialises >> + the TMU, reports temperature and handles cooling action if defined. >> + This driver uses the exynos core thermal API's. >> + >> +config EXYNOS_THERMAL_CORE >> + bool "Core thermal framework support for EXYNOS SOC's" >> + depends on EXYNOS_THERMAL >> + help >> + If you say yes here you get support for EXYNOS TMU >> + (Thermal Management Unit) common registration/unregistration >> + functions to the core thermal layer and also to use the generic >> + cpu cooling API's. > Should this one depend on CPU_THERMAL? Is it mandatory? Hi Eduardo, No it is not mandatory. If CPU_THERMAL is not present then cooling device is not created and only temp/trip_points etc sysfs are created. Thanks, Amit Daniel > >> diff --git a/drivers/thermal/samsung/Makefile >> b/drivers/thermal/samsung/Makefile >> index 1fe6d93..6227d4f 100644 >> --- a/drivers/thermal/samsung/Makefile >> +++ b/drivers/thermal/samsung/Makefile >> @@ -1,4 +1,6 @@ >> # >> # Samsung thermal specific Makefile >> # >> -obj-$(CONFIG_EXYNOS_THERMAL) += exynos_thermal.o >> +obj-$(CONFIG_EXYNOS_THERMAL) += exynos_soc_thermal.o >> +exynos_soc_thermal-y := exynos_thermal.o >> +exynos_soc_thermal-$(CONFIG_EXYNOS_THERMAL_CORE) += exynos_thermal_common.o >> diff --git a/drivers/thermal/samsung/exynos_thermal.c >> b/drivers/thermal/samsung/exynos_thermal.c >> index 03e4bbc..5293849 100644 >> --- a/drivers/thermal/samsung/exynos_thermal.c >> +++ b/drivers/thermal/samsung/exynos_thermal.c >> @@ -21,23 +21,15 @@ >> * >> */ >> >> -#include >> -#include >> -#include >> -#include >> -#include >> -#include >> #include >> -#include >> -#include >> -#include >> #include >> -#include >> -#include >> -#include >> -#include >> -#include >> +#include >> +#include >> #include >> +#include >> +#include >> + >> +#include "exynos_thermal_common.h" >> >> /* Exynos generic registers */ >> #define EXYNOS_TMU_REG_TRIMINFO 0x0 >> @@ -88,16 +80,6 @@ >> #define EFUSE_MIN_VALUE 40 >> #define EFUSE_MAX_VALUE 100 >> >> -/* In-kernel thermal framework related macros & definations */ >> -#define SENSOR_NAME_LEN 16 >> -#define MAX_TRIP_COUNT 8 >> -#define MAX_COOLING_DEVICE 4 >> -#define MAX_THRESHOLD_LEVS 4 >> - >> -#define ACTIVE_INTERVAL 500 >> -#define IDLE_INTERVAL 1 >> -#define MCELSIUS 1000 >> - >> #ifdef CONFIG_THERMAL_EMULATION >> #define EXYNOS_EMUL_TIME 0x57F0 >> #define EXYNOS_EMUL_TIME_SHIFT 16 >> @@ -106,17 +88,6 @@ >> #define EXYNOS_EMUL_ENABLE 0x1 >> #endif /* CONFIG_THERMAL_EMULATION */ >> >> -/* CPU Zone information */ >> -#define PANIC_ZONE 4 >> -#define WARN_ZONE 3 >> -#define MONITOR_ZONE2 >> -#define SAFE_ZONE 1 >> - >> -#define GET_ZONE(trip) (trip + 2) >> -#define GET_TRIP(zone) (zone - 2) >> - >> -#define EXYNOS_ZONE_COUNT3 >> - >> struct exynos_tmu_data { >> struct exynos_tmu_platform_data *pdata; >> struct resource *mem; >> @@ -129,384 +100,6 @@ struct exynos_tmu_data { >> u8
Re: [PATCH V6 04/30] thermal: exynos: Bifurcate exynos thermal common and tmu controller code
On Thu, Jun 20, 2013 at 12:15 AM, Eduardo Valentin eduardo.valen...@ti.com wrote: Amit, On 17-06-2013 02:46, Amit Daniel Kachhap wrote: This code bifurcates exynos thermal implementation into common and sensor specific parts. The common thermal code interacts with core thermal layer and core cpufreq cooling parts and is independent of SOC specific driver. This change is needed to cleanly add support for new TMU sensors. Acked-by: Kukjin Kim kgene@samsung.com Acked-by: Jonghwa Lee jonghwa3@samsung.com Signed-off-by: Amit Daniel Kachhap amit.dan...@samsung.com --- drivers/thermal/samsung/Kconfig | 19 +- drivers/thermal/samsung/Makefile|4 +- drivers/thermal/samsung/exynos_thermal.c| 419 +-- drivers/thermal/samsung/exynos_thermal_common.c | 384 + drivers/thermal/samsung/exynos_thermal_common.h | 83 + 5 files changed, 490 insertions(+), 419 deletions(-) create mode 100644 drivers/thermal/samsung/exynos_thermal_common.c create mode 100644 drivers/thermal/samsung/exynos_thermal_common.h diff --git a/drivers/thermal/samsung/Kconfig b/drivers/thermal/samsung/Kconfig index 2cf31ad..f8100b1 100644 --- a/drivers/thermal/samsung/Kconfig +++ b/drivers/thermal/samsung/Kconfig @@ -1,8 +1,17 @@ config EXYNOS_THERMAL - tristate Temperature sensor on Samsung EXYNOS + tristate Exynos thermal management unit driver depends on ARCH_HAS_BANDGAP help - If you say yes here you get support for TMU (Thermal Management - Unit) on SAMSUNG EXYNOS series of SoC. This helps in registering - the exynos thermal driver with the core thermal layer and cpu - cooling API's. + If you say yes here you get support for the TMU (Thermal Management + Unit) driver for SAMSUNG EXYNOS series of soc. This driver initialises + the TMU, reports temperature and handles cooling action if defined. + This driver uses the exynos core thermal API's. + +config EXYNOS_THERMAL_CORE + bool Core thermal framework support for EXYNOS SOC's + depends on EXYNOS_THERMAL + help + If you say yes here you get support for EXYNOS TMU + (Thermal Management Unit) common registration/unregistration + functions to the core thermal layer and also to use the generic + cpu cooling API's. Should this one depend on CPU_THERMAL? Is it mandatory? Hi Eduardo, No it is not mandatory. If CPU_THERMAL is not present then cooling device is not created and only temp/trip_points etc sysfs are created. Thanks, Amit Daniel diff --git a/drivers/thermal/samsung/Makefile b/drivers/thermal/samsung/Makefile index 1fe6d93..6227d4f 100644 --- a/drivers/thermal/samsung/Makefile +++ b/drivers/thermal/samsung/Makefile @@ -1,4 +1,6 @@ # # Samsung thermal specific Makefile # -obj-$(CONFIG_EXYNOS_THERMAL) += exynos_thermal.o +obj-$(CONFIG_EXYNOS_THERMAL) += exynos_soc_thermal.o +exynos_soc_thermal-y := exynos_thermal.o +exynos_soc_thermal-$(CONFIG_EXYNOS_THERMAL_CORE) += exynos_thermal_common.o diff --git a/drivers/thermal/samsung/exynos_thermal.c b/drivers/thermal/samsung/exynos_thermal.c index 03e4bbc..5293849 100644 --- a/drivers/thermal/samsung/exynos_thermal.c +++ b/drivers/thermal/samsung/exynos_thermal.c @@ -21,23 +21,15 @@ * */ -#include linux/module.h -#include linux/err.h -#include linux/kernel.h -#include linux/slab.h -#include linux/platform_device.h -#include linux/interrupt.h #include linux/clk.h -#include linux/workqueue.h -#include linux/sysfs.h -#include linux/kobject.h #include linux/io.h -#include linux/mutex.h -#include linux/platform_data/exynos_thermal.h -#include linux/thermal.h -#include linux/cpufreq.h -#include linux/cpu_cooling.h +#include linux/interrupt.h +#include linux/module.h #include linux/of.h +#include linux/platform_device.h +#include linux/platform_data/exynos_thermal.h + +#include exynos_thermal_common.h /* Exynos generic registers */ #define EXYNOS_TMU_REG_TRIMINFO 0x0 @@ -88,16 +80,6 @@ #define EFUSE_MIN_VALUE 40 #define EFUSE_MAX_VALUE 100 -/* In-kernel thermal framework related macros definations */ -#define SENSOR_NAME_LEN 16 -#define MAX_TRIP_COUNT 8 -#define MAX_COOLING_DEVICE 4 -#define MAX_THRESHOLD_LEVS 4 - -#define ACTIVE_INTERVAL 500 -#define IDLE_INTERVAL 1 -#define MCELSIUS 1000 - #ifdef CONFIG_THERMAL_EMULATION #define EXYNOS_EMUL_TIME 0x57F0 #define EXYNOS_EMUL_TIME_SHIFT 16 @@ -106,17 +88,6 @@ #define EXYNOS_EMUL_ENABLE 0x1 #endif /* CONFIG_THERMAL_EMULATION */ -/* CPU Zone information */ -#define PANIC_ZONE 4 -#define WARN_ZONE 3 -#define MONITOR_ZONE2 -#define SAFE_ZONE 1 - -#define GET_ZONE(trip) (trip + 2) -#define GET_TRIP(zone) (zone - 2) - -#define EXYNOS_ZONE_COUNT3 -
Re: [PATCH V6 04/30] thermal: exynos: Bifurcate exynos thermal common and tmu controller code
On Thu, Jun 20, 2013 at 12:31 AM, Eduardo Valentin eduardo.valen...@ti.com wrote: On 17-06-2013 02:46, Amit Daniel Kachhap wrote: This code bifurcates exynos thermal implementation into common and sensor specific parts. The common thermal code interacts with core thermal layer and core cpufreq cooling parts and is independent of SOC specific driver. This change is needed to cleanly add support for new TMU sensors. Acked-by: Kukjin Kim kgene@samsung.com Acked-by: Jonghwa Lee jonghwa3@samsung.com Signed-off-by: Amit Daniel Kachhap amit.dan...@samsung.com --- drivers/thermal/samsung/Kconfig | 19 +- drivers/thermal/samsung/Makefile|4 +- drivers/thermal/samsung/exynos_thermal.c| 419 +-- drivers/thermal/samsung/exynos_thermal_common.c | 384 + drivers/thermal/samsung/exynos_thermal_common.h | 83 + 5 files changed, 490 insertions(+), 419 deletions(-) create mode 100644 drivers/thermal/samsung/exynos_thermal_common.c create mode 100644 drivers/thermal/samsung/exynos_thermal_common.h diff --git a/drivers/thermal/samsung/Kconfig b/drivers/thermal/samsung/Kconfig index 2cf31ad..f8100b1 100644 --- a/drivers/thermal/samsung/Kconfig +++ b/drivers/thermal/samsung/Kconfig @@ -1,8 +1,17 @@ config EXYNOS_THERMAL - tristate Temperature sensor on Samsung EXYNOS + tristate Exynos thermal management unit driver depends on ARCH_HAS_BANDGAP This is not really on this patch, but I think this one needs to depend on CONFIG_OF too. In the driver CONFIG_OF is used for DT api's so this is not needed here. help - If you say yes here you get support for TMU (Thermal Management - Unit) on SAMSUNG EXYNOS series of SoC. This helps in registering - the exynos thermal driver with the core thermal layer and cpu - cooling API's. + If you say yes here you get support for the TMU (Thermal Management + Unit) driver for SAMSUNG EXYNOS series of soc. This driver initialises + the TMU, reports temperature and handles cooling action if defined. + This driver uses the exynos core thermal API's. + +config EXYNOS_THERMAL_CORE + bool Core thermal framework support for EXYNOS SOC's + depends on EXYNOS_THERMAL + help + If you say yes here you get support for EXYNOS TMU + (Thermal Management Unit) common registration/unregistration + functions to the core thermal layer and also to use the generic + cpu cooling API's. diff --git a/drivers/thermal/samsung/Makefile b/drivers/thermal/samsung/Makefile index 1fe6d93..6227d4f 100644 --- a/drivers/thermal/samsung/Makefile +++ b/drivers/thermal/samsung/Makefile @@ -1,4 +1,6 @@ # # Samsung thermal specific Makefile # -obj-$(CONFIG_EXYNOS_THERMAL) += exynos_thermal.o +obj-$(CONFIG_EXYNOS_THERMAL) += exynos_soc_thermal.o +exynos_soc_thermal-y := exynos_thermal.o +exynos_soc_thermal-$(CONFIG_EXYNOS_THERMAL_CORE) += exynos_thermal_common.o diff --git a/drivers/thermal/samsung/exynos_thermal.c b/drivers/thermal/samsung/exynos_thermal.c index 03e4bbc..5293849 100644 --- a/drivers/thermal/samsung/exynos_thermal.c +++ b/drivers/thermal/samsung/exynos_thermal.c @@ -21,23 +21,15 @@ * */ -#include linux/module.h -#include linux/err.h -#include linux/kernel.h -#include linux/slab.h -#include linux/platform_device.h -#include linux/interrupt.h #include linux/clk.h -#include linux/workqueue.h -#include linux/sysfs.h -#include linux/kobject.h #include linux/io.h -#include linux/mutex.h -#include linux/platform_data/exynos_thermal.h -#include linux/thermal.h -#include linux/cpufreq.h -#include linux/cpu_cooling.h +#include linux/interrupt.h +#include linux/module.h #include linux/of.h +#include linux/platform_device.h +#include linux/platform_data/exynos_thermal.h + +#include exynos_thermal_common.h /* Exynos generic registers */ #define EXYNOS_TMU_REG_TRIMINFO 0x0 @@ -88,16 +80,6 @@ #define EFUSE_MIN_VALUE 40 #define EFUSE_MAX_VALUE 100 -/* In-kernel thermal framework related macros definations */ -#define SENSOR_NAME_LEN 16 -#define MAX_TRIP_COUNT 8 -#define MAX_COOLING_DEVICE 4 -#define MAX_THRESHOLD_LEVS 4 - -#define ACTIVE_INTERVAL 500 -#define IDLE_INTERVAL 1 -#define MCELSIUS 1000 - #ifdef CONFIG_THERMAL_EMULATION #define EXYNOS_EMUL_TIME 0x57F0 #define EXYNOS_EMUL_TIME_SHIFT 16 @@ -106,17 +88,6 @@ #define EXYNOS_EMUL_ENABLE 0x1 #endif /* CONFIG_THERMAL_EMULATION */ -/* CPU Zone information */ -#define PANIC_ZONE 4 -#define WARN_ZONE 3 -#define MONITOR_ZONE2 -#define SAFE_ZONE 1 - -#define GET_ZONE(trip) (trip + 2) -#define GET_TRIP(zone) (zone - 2) - -#define EXYNOS_ZONE_COUNT3 - struct exynos_tmu_data { struct exynos_tmu_platform_data *pdata;
Re: [PATCH V6 04/30] thermal: exynos: Bifurcate exynos thermal common and tmu controller code
On 17-06-2013 02:46, Amit Daniel Kachhap wrote: > This code bifurcates exynos thermal implementation into common and sensor > specific parts. The common thermal code interacts with core thermal layer and > core cpufreq cooling parts and is independent of SOC specific driver. This > change is needed to cleanly add support for new TMU sensors. > > Acked-by: Kukjin Kim > Acked-by: Jonghwa Lee > Signed-off-by: Amit Daniel Kachhap > --- > drivers/thermal/samsung/Kconfig | 19 +- > drivers/thermal/samsung/Makefile|4 +- > drivers/thermal/samsung/exynos_thermal.c| 419 > +-- > drivers/thermal/samsung/exynos_thermal_common.c | 384 + > drivers/thermal/samsung/exynos_thermal_common.h | 83 + > 5 files changed, 490 insertions(+), 419 deletions(-) > create mode 100644 drivers/thermal/samsung/exynos_thermal_common.c > create mode 100644 drivers/thermal/samsung/exynos_thermal_common.h > > diff --git a/drivers/thermal/samsung/Kconfig b/drivers/thermal/samsung/Kconfig > index 2cf31ad..f8100b1 100644 > --- a/drivers/thermal/samsung/Kconfig > +++ b/drivers/thermal/samsung/Kconfig > @@ -1,8 +1,17 @@ > config EXYNOS_THERMAL > - tristate "Temperature sensor on Samsung EXYNOS" > + tristate "Exynos thermal management unit driver" > depends on ARCH_HAS_BANDGAP This is not really on this patch, but I think this one needs to depend on CONFIG_OF too. > help > - If you say yes here you get support for TMU (Thermal Management > - Unit) on SAMSUNG EXYNOS series of SoC. This helps in registering > - the exynos thermal driver with the core thermal layer and cpu > - cooling API's. > + If you say yes here you get support for the TMU (Thermal Management > + Unit) driver for SAMSUNG EXYNOS series of soc. This driver initialises > + the TMU, reports temperature and handles cooling action if defined. > + This driver uses the exynos core thermal API's. > + > +config EXYNOS_THERMAL_CORE > + bool "Core thermal framework support for EXYNOS SOC's" > + depends on EXYNOS_THERMAL > + help > + If you say yes here you get support for EXYNOS TMU > + (Thermal Management Unit) common registration/unregistration > + functions to the core thermal layer and also to use the generic > + cpu cooling API's. > diff --git a/drivers/thermal/samsung/Makefile > b/drivers/thermal/samsung/Makefile > index 1fe6d93..6227d4f 100644 > --- a/drivers/thermal/samsung/Makefile > +++ b/drivers/thermal/samsung/Makefile > @@ -1,4 +1,6 @@ > # > # Samsung thermal specific Makefile > # > -obj-$(CONFIG_EXYNOS_THERMAL) += exynos_thermal.o > +obj-$(CONFIG_EXYNOS_THERMAL) += exynos_soc_thermal.o > +exynos_soc_thermal-y := exynos_thermal.o > +exynos_soc_thermal-$(CONFIG_EXYNOS_THERMAL_CORE) += exynos_thermal_common.o > diff --git a/drivers/thermal/samsung/exynos_thermal.c > b/drivers/thermal/samsung/exynos_thermal.c > index 03e4bbc..5293849 100644 > --- a/drivers/thermal/samsung/exynos_thermal.c > +++ b/drivers/thermal/samsung/exynos_thermal.c > @@ -21,23 +21,15 @@ > * > */ > > -#include > -#include > -#include > -#include > -#include > -#include > #include > -#include > -#include > -#include > #include > -#include > -#include > -#include > -#include > -#include > +#include > +#include > #include > +#include > +#include > + > +#include "exynos_thermal_common.h" > > /* Exynos generic registers */ > #define EXYNOS_TMU_REG_TRIMINFO 0x0 > @@ -88,16 +80,6 @@ > #define EFUSE_MIN_VALUE 40 > #define EFUSE_MAX_VALUE 100 > > -/* In-kernel thermal framework related macros & definations */ > -#define SENSOR_NAME_LEN 16 > -#define MAX_TRIP_COUNT 8 > -#define MAX_COOLING_DEVICE 4 > -#define MAX_THRESHOLD_LEVS 4 > - > -#define ACTIVE_INTERVAL 500 > -#define IDLE_INTERVAL 1 > -#define MCELSIUS 1000 > - > #ifdef CONFIG_THERMAL_EMULATION > #define EXYNOS_EMUL_TIME 0x57F0 > #define EXYNOS_EMUL_TIME_SHIFT 16 > @@ -106,17 +88,6 @@ > #define EXYNOS_EMUL_ENABLE 0x1 > #endif /* CONFIG_THERMAL_EMULATION */ > > -/* CPU Zone information */ > -#define PANIC_ZONE 4 > -#define WARN_ZONE 3 > -#define MONITOR_ZONE2 > -#define SAFE_ZONE 1 > - > -#define GET_ZONE(trip) (trip + 2) > -#define GET_TRIP(zone) (zone - 2) > - > -#define EXYNOS_ZONE_COUNT3 > - > struct exynos_tmu_data { > struct exynos_tmu_platform_data *pdata; > struct resource *mem; > @@ -129,384 +100,6 @@ struct exynos_tmu_data { > u8 temp_error1, temp_error2; > }; > > -struct thermal_trip_point_conf { > - int trip_val[MAX_TRIP_COUNT]; > - int trip_count; > - u8 trigger_falling; > -}; > - > -struct thermal_cooling_conf { > - struct freq_clip_table freq_data[MAX_TRIP_COUNT]; > - int freq_clip_count; > -}; > - > -struct thermal_sensor_conf { >
Re: [PATCH V6 04/30] thermal: exynos: Bifurcate exynos thermal common and tmu controller code
Amit, On 17-06-2013 02:46, Amit Daniel Kachhap wrote: > This code bifurcates exynos thermal implementation into common and sensor > specific parts. The common thermal code interacts with core thermal layer and > core cpufreq cooling parts and is independent of SOC specific driver. This > change is needed to cleanly add support for new TMU sensors. > > Acked-by: Kukjin Kim > Acked-by: Jonghwa Lee > Signed-off-by: Amit Daniel Kachhap > --- > drivers/thermal/samsung/Kconfig | 19 +- > drivers/thermal/samsung/Makefile|4 +- > drivers/thermal/samsung/exynos_thermal.c| 419 > +-- > drivers/thermal/samsung/exynos_thermal_common.c | 384 + > drivers/thermal/samsung/exynos_thermal_common.h | 83 + > 5 files changed, 490 insertions(+), 419 deletions(-) > create mode 100644 drivers/thermal/samsung/exynos_thermal_common.c > create mode 100644 drivers/thermal/samsung/exynos_thermal_common.h > > diff --git a/drivers/thermal/samsung/Kconfig b/drivers/thermal/samsung/Kconfig > index 2cf31ad..f8100b1 100644 > --- a/drivers/thermal/samsung/Kconfig > +++ b/drivers/thermal/samsung/Kconfig > @@ -1,8 +1,17 @@ > config EXYNOS_THERMAL > - tristate "Temperature sensor on Samsung EXYNOS" > + tristate "Exynos thermal management unit driver" > depends on ARCH_HAS_BANDGAP > help > - If you say yes here you get support for TMU (Thermal Management > - Unit) on SAMSUNG EXYNOS series of SoC. This helps in registering > - the exynos thermal driver with the core thermal layer and cpu > - cooling API's. > + If you say yes here you get support for the TMU (Thermal Management > + Unit) driver for SAMSUNG EXYNOS series of soc. This driver initialises > + the TMU, reports temperature and handles cooling action if defined. > + This driver uses the exynos core thermal API's. > + > +config EXYNOS_THERMAL_CORE > + bool "Core thermal framework support for EXYNOS SOC's" > + depends on EXYNOS_THERMAL > + help > + If you say yes here you get support for EXYNOS TMU > + (Thermal Management Unit) common registration/unregistration > + functions to the core thermal layer and also to use the generic > + cpu cooling API's. Should this one depend on CPU_THERMAL? Is it mandatory? > diff --git a/drivers/thermal/samsung/Makefile > b/drivers/thermal/samsung/Makefile > index 1fe6d93..6227d4f 100644 > --- a/drivers/thermal/samsung/Makefile > +++ b/drivers/thermal/samsung/Makefile > @@ -1,4 +1,6 @@ > # > # Samsung thermal specific Makefile > # > -obj-$(CONFIG_EXYNOS_THERMAL) += exynos_thermal.o > +obj-$(CONFIG_EXYNOS_THERMAL) += exynos_soc_thermal.o > +exynos_soc_thermal-y := exynos_thermal.o > +exynos_soc_thermal-$(CONFIG_EXYNOS_THERMAL_CORE) += exynos_thermal_common.o > diff --git a/drivers/thermal/samsung/exynos_thermal.c > b/drivers/thermal/samsung/exynos_thermal.c > index 03e4bbc..5293849 100644 > --- a/drivers/thermal/samsung/exynos_thermal.c > +++ b/drivers/thermal/samsung/exynos_thermal.c > @@ -21,23 +21,15 @@ > * > */ > > -#include > -#include > -#include > -#include > -#include > -#include > #include > -#include > -#include > -#include > #include > -#include > -#include > -#include > -#include > -#include > +#include > +#include > #include > +#include > +#include > + > +#include "exynos_thermal_common.h" > > /* Exynos generic registers */ > #define EXYNOS_TMU_REG_TRIMINFO 0x0 > @@ -88,16 +80,6 @@ > #define EFUSE_MIN_VALUE 40 > #define EFUSE_MAX_VALUE 100 > > -/* In-kernel thermal framework related macros & definations */ > -#define SENSOR_NAME_LEN 16 > -#define MAX_TRIP_COUNT 8 > -#define MAX_COOLING_DEVICE 4 > -#define MAX_THRESHOLD_LEVS 4 > - > -#define ACTIVE_INTERVAL 500 > -#define IDLE_INTERVAL 1 > -#define MCELSIUS 1000 > - > #ifdef CONFIG_THERMAL_EMULATION > #define EXYNOS_EMUL_TIME 0x57F0 > #define EXYNOS_EMUL_TIME_SHIFT 16 > @@ -106,17 +88,6 @@ > #define EXYNOS_EMUL_ENABLE 0x1 > #endif /* CONFIG_THERMAL_EMULATION */ > > -/* CPU Zone information */ > -#define PANIC_ZONE 4 > -#define WARN_ZONE 3 > -#define MONITOR_ZONE2 > -#define SAFE_ZONE 1 > - > -#define GET_ZONE(trip) (trip + 2) > -#define GET_TRIP(zone) (zone - 2) > - > -#define EXYNOS_ZONE_COUNT3 > - > struct exynos_tmu_data { > struct exynos_tmu_platform_data *pdata; > struct resource *mem; > @@ -129,384 +100,6 @@ struct exynos_tmu_data { > u8 temp_error1, temp_error2; > }; > > -struct thermal_trip_point_conf { > - int trip_val[MAX_TRIP_COUNT]; > - int trip_count; > - u8 trigger_falling; > -}; > - > -struct thermal_cooling_conf { > - struct freq_clip_table freq_data[MAX_TRIP_COUNT]; > - int freq_clip_count; > -}; > - > -struct thermal_sensor_conf { > - char
Re: [PATCH V6 04/30] thermal: exynos: Bifurcate exynos thermal common and tmu controller code
Amit, On 17-06-2013 02:46, Amit Daniel Kachhap wrote: This code bifurcates exynos thermal implementation into common and sensor specific parts. The common thermal code interacts with core thermal layer and core cpufreq cooling parts and is independent of SOC specific driver. This change is needed to cleanly add support for new TMU sensors. Acked-by: Kukjin Kim kgene@samsung.com Acked-by: Jonghwa Lee jonghwa3@samsung.com Signed-off-by: Amit Daniel Kachhap amit.dan...@samsung.com --- drivers/thermal/samsung/Kconfig | 19 +- drivers/thermal/samsung/Makefile|4 +- drivers/thermal/samsung/exynos_thermal.c| 419 +-- drivers/thermal/samsung/exynos_thermal_common.c | 384 + drivers/thermal/samsung/exynos_thermal_common.h | 83 + 5 files changed, 490 insertions(+), 419 deletions(-) create mode 100644 drivers/thermal/samsung/exynos_thermal_common.c create mode 100644 drivers/thermal/samsung/exynos_thermal_common.h diff --git a/drivers/thermal/samsung/Kconfig b/drivers/thermal/samsung/Kconfig index 2cf31ad..f8100b1 100644 --- a/drivers/thermal/samsung/Kconfig +++ b/drivers/thermal/samsung/Kconfig @@ -1,8 +1,17 @@ config EXYNOS_THERMAL - tristate Temperature sensor on Samsung EXYNOS + tristate Exynos thermal management unit driver depends on ARCH_HAS_BANDGAP help - If you say yes here you get support for TMU (Thermal Management - Unit) on SAMSUNG EXYNOS series of SoC. This helps in registering - the exynos thermal driver with the core thermal layer and cpu - cooling API's. + If you say yes here you get support for the TMU (Thermal Management + Unit) driver for SAMSUNG EXYNOS series of soc. This driver initialises + the TMU, reports temperature and handles cooling action if defined. + This driver uses the exynos core thermal API's. + +config EXYNOS_THERMAL_CORE + bool Core thermal framework support for EXYNOS SOC's + depends on EXYNOS_THERMAL + help + If you say yes here you get support for EXYNOS TMU + (Thermal Management Unit) common registration/unregistration + functions to the core thermal layer and also to use the generic + cpu cooling API's. Should this one depend on CPU_THERMAL? Is it mandatory? diff --git a/drivers/thermal/samsung/Makefile b/drivers/thermal/samsung/Makefile index 1fe6d93..6227d4f 100644 --- a/drivers/thermal/samsung/Makefile +++ b/drivers/thermal/samsung/Makefile @@ -1,4 +1,6 @@ # # Samsung thermal specific Makefile # -obj-$(CONFIG_EXYNOS_THERMAL) += exynos_thermal.o +obj-$(CONFIG_EXYNOS_THERMAL) += exynos_soc_thermal.o +exynos_soc_thermal-y := exynos_thermal.o +exynos_soc_thermal-$(CONFIG_EXYNOS_THERMAL_CORE) += exynos_thermal_common.o diff --git a/drivers/thermal/samsung/exynos_thermal.c b/drivers/thermal/samsung/exynos_thermal.c index 03e4bbc..5293849 100644 --- a/drivers/thermal/samsung/exynos_thermal.c +++ b/drivers/thermal/samsung/exynos_thermal.c @@ -21,23 +21,15 @@ * */ -#include linux/module.h -#include linux/err.h -#include linux/kernel.h -#include linux/slab.h -#include linux/platform_device.h -#include linux/interrupt.h #include linux/clk.h -#include linux/workqueue.h -#include linux/sysfs.h -#include linux/kobject.h #include linux/io.h -#include linux/mutex.h -#include linux/platform_data/exynos_thermal.h -#include linux/thermal.h -#include linux/cpufreq.h -#include linux/cpu_cooling.h +#include linux/interrupt.h +#include linux/module.h #include linux/of.h +#include linux/platform_device.h +#include linux/platform_data/exynos_thermal.h + +#include exynos_thermal_common.h /* Exynos generic registers */ #define EXYNOS_TMU_REG_TRIMINFO 0x0 @@ -88,16 +80,6 @@ #define EFUSE_MIN_VALUE 40 #define EFUSE_MAX_VALUE 100 -/* In-kernel thermal framework related macros definations */ -#define SENSOR_NAME_LEN 16 -#define MAX_TRIP_COUNT 8 -#define MAX_COOLING_DEVICE 4 -#define MAX_THRESHOLD_LEVS 4 - -#define ACTIVE_INTERVAL 500 -#define IDLE_INTERVAL 1 -#define MCELSIUS 1000 - #ifdef CONFIG_THERMAL_EMULATION #define EXYNOS_EMUL_TIME 0x57F0 #define EXYNOS_EMUL_TIME_SHIFT 16 @@ -106,17 +88,6 @@ #define EXYNOS_EMUL_ENABLE 0x1 #endif /* CONFIG_THERMAL_EMULATION */ -/* CPU Zone information */ -#define PANIC_ZONE 4 -#define WARN_ZONE 3 -#define MONITOR_ZONE2 -#define SAFE_ZONE 1 - -#define GET_ZONE(trip) (trip + 2) -#define GET_TRIP(zone) (zone - 2) - -#define EXYNOS_ZONE_COUNT3 - struct exynos_tmu_data { struct exynos_tmu_platform_data *pdata; struct resource *mem; @@ -129,384 +100,6 @@ struct exynos_tmu_data { u8 temp_error1, temp_error2; }; -struct thermal_trip_point_conf { - int
Re: [PATCH V6 04/30] thermal: exynos: Bifurcate exynos thermal common and tmu controller code
On 17-06-2013 02:46, Amit Daniel Kachhap wrote: This code bifurcates exynos thermal implementation into common and sensor specific parts. The common thermal code interacts with core thermal layer and core cpufreq cooling parts and is independent of SOC specific driver. This change is needed to cleanly add support for new TMU sensors. Acked-by: Kukjin Kim kgene@samsung.com Acked-by: Jonghwa Lee jonghwa3@samsung.com Signed-off-by: Amit Daniel Kachhap amit.dan...@samsung.com --- drivers/thermal/samsung/Kconfig | 19 +- drivers/thermal/samsung/Makefile|4 +- drivers/thermal/samsung/exynos_thermal.c| 419 +-- drivers/thermal/samsung/exynos_thermal_common.c | 384 + drivers/thermal/samsung/exynos_thermal_common.h | 83 + 5 files changed, 490 insertions(+), 419 deletions(-) create mode 100644 drivers/thermal/samsung/exynos_thermal_common.c create mode 100644 drivers/thermal/samsung/exynos_thermal_common.h diff --git a/drivers/thermal/samsung/Kconfig b/drivers/thermal/samsung/Kconfig index 2cf31ad..f8100b1 100644 --- a/drivers/thermal/samsung/Kconfig +++ b/drivers/thermal/samsung/Kconfig @@ -1,8 +1,17 @@ config EXYNOS_THERMAL - tristate Temperature sensor on Samsung EXYNOS + tristate Exynos thermal management unit driver depends on ARCH_HAS_BANDGAP This is not really on this patch, but I think this one needs to depend on CONFIG_OF too. help - If you say yes here you get support for TMU (Thermal Management - Unit) on SAMSUNG EXYNOS series of SoC. This helps in registering - the exynos thermal driver with the core thermal layer and cpu - cooling API's. + If you say yes here you get support for the TMU (Thermal Management + Unit) driver for SAMSUNG EXYNOS series of soc. This driver initialises + the TMU, reports temperature and handles cooling action if defined. + This driver uses the exynos core thermal API's. + +config EXYNOS_THERMAL_CORE + bool Core thermal framework support for EXYNOS SOC's + depends on EXYNOS_THERMAL + help + If you say yes here you get support for EXYNOS TMU + (Thermal Management Unit) common registration/unregistration + functions to the core thermal layer and also to use the generic + cpu cooling API's. diff --git a/drivers/thermal/samsung/Makefile b/drivers/thermal/samsung/Makefile index 1fe6d93..6227d4f 100644 --- a/drivers/thermal/samsung/Makefile +++ b/drivers/thermal/samsung/Makefile @@ -1,4 +1,6 @@ # # Samsung thermal specific Makefile # -obj-$(CONFIG_EXYNOS_THERMAL) += exynos_thermal.o +obj-$(CONFIG_EXYNOS_THERMAL) += exynos_soc_thermal.o +exynos_soc_thermal-y := exynos_thermal.o +exynos_soc_thermal-$(CONFIG_EXYNOS_THERMAL_CORE) += exynos_thermal_common.o diff --git a/drivers/thermal/samsung/exynos_thermal.c b/drivers/thermal/samsung/exynos_thermal.c index 03e4bbc..5293849 100644 --- a/drivers/thermal/samsung/exynos_thermal.c +++ b/drivers/thermal/samsung/exynos_thermal.c @@ -21,23 +21,15 @@ * */ -#include linux/module.h -#include linux/err.h -#include linux/kernel.h -#include linux/slab.h -#include linux/platform_device.h -#include linux/interrupt.h #include linux/clk.h -#include linux/workqueue.h -#include linux/sysfs.h -#include linux/kobject.h #include linux/io.h -#include linux/mutex.h -#include linux/platform_data/exynos_thermal.h -#include linux/thermal.h -#include linux/cpufreq.h -#include linux/cpu_cooling.h +#include linux/interrupt.h +#include linux/module.h #include linux/of.h +#include linux/platform_device.h +#include linux/platform_data/exynos_thermal.h + +#include exynos_thermal_common.h /* Exynos generic registers */ #define EXYNOS_TMU_REG_TRIMINFO 0x0 @@ -88,16 +80,6 @@ #define EFUSE_MIN_VALUE 40 #define EFUSE_MAX_VALUE 100 -/* In-kernel thermal framework related macros definations */ -#define SENSOR_NAME_LEN 16 -#define MAX_TRIP_COUNT 8 -#define MAX_COOLING_DEVICE 4 -#define MAX_THRESHOLD_LEVS 4 - -#define ACTIVE_INTERVAL 500 -#define IDLE_INTERVAL 1 -#define MCELSIUS 1000 - #ifdef CONFIG_THERMAL_EMULATION #define EXYNOS_EMUL_TIME 0x57F0 #define EXYNOS_EMUL_TIME_SHIFT 16 @@ -106,17 +88,6 @@ #define EXYNOS_EMUL_ENABLE 0x1 #endif /* CONFIG_THERMAL_EMULATION */ -/* CPU Zone information */ -#define PANIC_ZONE 4 -#define WARN_ZONE 3 -#define MONITOR_ZONE2 -#define SAFE_ZONE 1 - -#define GET_ZONE(trip) (trip + 2) -#define GET_TRIP(zone) (zone - 2) - -#define EXYNOS_ZONE_COUNT3 - struct exynos_tmu_data { struct exynos_tmu_platform_data *pdata; struct resource *mem; @@ -129,384 +100,6 @@ struct exynos_tmu_data { u8 temp_error1, temp_error2; }; -struct