Message ID | 1344516365-7230-5-git-send-email-durgadoss.r@intel.com (mailing list archive) |
---|---|
State | Not Applicable, archived |
Headers | show |
On ?, 2012-08-09 at 18:15 +0530, Durgadoss R wrote: > This patch creates a structure to hold a thermal zone's > platform level info, and also defines an extern function to > retrieve zone parameters from thermal_sys.c. > > Signed-off-by: Durgadoss R <durgadoss.r@intel.com> > --- > drivers/thermal/thermal_sys.c | 3 +++ > include/linux/thermal.h | 43 +++++++++++++++++++++++++++++++++++++++++ > 2 files changed, 46 insertions(+) > > diff --git a/drivers/thermal/thermal_sys.c b/drivers/thermal/thermal_sys.c > index 998c16e..f043cd6 100644 > --- a/drivers/thermal/thermal_sys.c > +++ b/drivers/thermal/thermal_sys.c > @@ -49,6 +49,9 @@ static LIST_HEAD(thermal_tz_list); > static LIST_HEAD(thermal_cdev_list); > static DEFINE_MUTEX(thermal_list_lock); > > +int (*get_platform_thermal_params)(struct thermal_zone_device *); > +EXPORT_SYMBOL(get_platform_thermal_params); > + > static int get_idr(struct idr *idr, struct mutex *lock, int *id) > { > int err; > diff --git a/include/linux/thermal.h b/include/linux/thermal.h > index 757a007..f9ce1e2 100644 > --- a/include/linux/thermal.h > +++ b/include/linux/thermal.h > @@ -33,6 +33,8 @@ > #define THERMAL_MAX_TRIPS 12 > #define THERMAL_NAME_LENGTH 20 > > +#define MAX_COOLING_DEVS THERMAL_MAX_TRIPS > + why MAX_COOLING_DEVS equals THERMAL_MAX_TRIPS? if this is an arbitrary number, please use the number instead, or else this would be confusing. > /* Initial state of a cooling device during binding */ > #define THERMAL_NO_TARGET -1UL > > @@ -49,6 +51,11 @@ > #define THERMAL_GENL_VERSION 0x01 > #define THERMAL_GENL_MCAST_GROUP_NAME "thermal_mc_group" > > +/* Thermal policies */ > +#define THERMAL_USER_SPACE 0 > +#define THERMAL_FAIR_SHARE 1 > +#define THERMAL_STEP_WISE 2 coding style. thanks, rui -- To unsubscribe from this list: send the line "unsubscribe linux-pm" in the body of a message to majordomo@vger.kernel.org More maj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Qo+ID4NCj4gPiArLyogVGhlcm1hbCBwb2xp Y2llcyAqLw0KPiA+ICsjZGVmaW5lIFRIRVJNQUxfVVNFUl9TUEFDRQkwDQo+ID4gKyNkZWZpbmUg VEhFUk1BTF9GQUlSX1NIQVJFCTENCj4gPiArI2RlZmluZQlUSEVSTUFMX1NURVBfV0lTRQkyDQo+ IA0KPiBjb2Rpbmcgc3R5bGUuDQoNCldpbGwgZml4Li4NCg0KPiANCj4gdGhhbmtzLA0KPiBydWkN Cg0K -- To unsubscribe from this list: send the line "unsubscribe linux-pm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On ?, 2012-08-09 at 18:15 +0530, Durgadoss R wrote: > This patch creates a structure to hold a thermal zone's > platform level info, and also defines an extern function to > retrieve zone parameters from thermal_sys.c. > > Signed-off-by: Durgadoss R <durgadoss.r@intel.com> > --- > drivers/thermal/thermal_sys.c | 3 +++ > include/linux/thermal.h | 43 +++++++++++++++++++++++++++++++++++++++++ > 2 files changed, 46 insertions(+) > > diff --git a/drivers/thermal/thermal_sys.c b/drivers/thermal/thermal_sys.c > index 998c16e..f043cd6 100644 > --- a/drivers/thermal/thermal_sys.c > +++ b/drivers/thermal/thermal_sys.c > @@ -49,6 +49,9 @@ static LIST_HEAD(thermal_tz_list); > static LIST_HEAD(thermal_cdev_list); > static DEFINE_MUTEX(thermal_list_lock); > > +int (*get_platform_thermal_params)(struct thermal_zone_device *); > +EXPORT_SYMBOL(get_platform_thermal_params); > + > static int get_idr(struct idr *idr, struct mutex *lock, int *id) > { > int err; > diff --git a/include/linux/thermal.h b/include/linux/thermal.h > index 757a007..f9ce1e2 100644 > --- a/include/linux/thermal.h > +++ b/include/linux/thermal.h > @@ -33,6 +33,8 @@ > #define THERMAL_MAX_TRIPS 12 > #define THERMAL_NAME_LENGTH 20 > > +#define MAX_COOLING_DEVS THERMAL_MAX_TRIPS > + > /* Initial state of a cooling device during binding */ > #define THERMAL_NO_TARGET -1UL > > @@ -49,6 +51,11 @@ > #define THERMAL_GENL_VERSION 0x01 > #define THERMAL_GENL_MCAST_GROUP_NAME "thermal_mc_group" > > +/* Thermal policies */ > +#define THERMAL_USER_SPACE 0 > +#define THERMAL_FAIR_SHARE 1 > +#define THERMAL_STEP_WISE 2 > + I'd prefer using enum here, for thermal policies. > struct thermal_zone_device; > struct thermal_cooling_device; > > @@ -165,6 +172,7 @@ struct thermal_zone_device { > struct mutex lock; /* protect thermal_instances list */ > struct list_head node; > struct delayed_work poll_queue; > + struct thermal_zone_params *tzp; > }; > > /* > @@ -187,6 +195,31 @@ struct thermal_instance { > struct list_head cdev_node; /* node in cdev->thermal_instances */ > }; > > +/* Platform level parameters associated with a thermal zone */ > +struct thermal_zone_params { > + char *thermal_zone_name; > + int throttle_policy; > + > + /* Number of cooling devices associated with this thermal zone */ > + int num_cdevs; > + char *cdevs_name[MAX_COOLING_DEVS]; > + > + /* > + * This is a measure of 'how effectively these devices can > + * cool 'this' thermal zone. The shall be determined by platform > + * characterization. This is on a 'percentage' scale. > + * See Documentation/thermal/sysfs-api.txt for more information. > + */ > + int weights[MAX_COOLING_DEVS]; > + > + /* > + * This is a bit mask that gives the binding relation between this > + * thermal zone and cdev, for a particular trip point. > + * See Documentation/thermal/sysfs-api.txt for more information. > + */ > + int trip_mask[MAX_COOLING_DEVS]; > +}; > + > struct thermal_genl_event { > u32 orig; > enum events event; > @@ -213,6 +246,16 @@ struct thermal_cooling_device *get_cdev_by_name(const char *); > struct thermal_instance *get_thermal_instance(struct thermal_zone_device *, > struct thermal_cooling_device *, int); > > +/* > + * The platform layer shall define a 'function' that provides the > + * parameters for all thermal zones in the platform. This pointer > + * should point to that 'function'. > + * > + * In thermal_zone_device_register() we update the parameters > + * for the particular thermal zone. > + */ > +extern int (*get_platform_thermal_params)(struct thermal_zone_device *); > + > #ifdef CONFIG_NET > extern int thermal_generate_netlink_event(u32 orig, enum events event); > #else -- To unsubscribe from this list: send the line "unsubscribe linux-pm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Thu, Aug 09, 2012 at 06:15:56PM +0530, Durgadoss R wrote: > This patch creates a structure to hold a thermal zone's > platform level info, and also defines an extern function to > retrieve zone parameters from thermal_sys.c. > > Signed-off-by: Durgadoss R <durgadoss.r@intel.com> > --- > drivers/thermal/thermal_sys.c | 3 +++ > include/linux/thermal.h | 43 +++++++++++++++++++++++++++++++++++++++++ > 2 files changed, 46 insertions(+) > > diff --git a/drivers/thermal/thermal_sys.c b/drivers/thermal/thermal_sys.c > index 998c16e..f043cd6 100644 > --- a/drivers/thermal/thermal_sys.c > +++ b/drivers/thermal/thermal_sys.c > @@ -49,6 +49,9 @@ static LIST_HEAD(thermal_tz_list); > static LIST_HEAD(thermal_cdev_list); > static DEFINE_MUTEX(thermal_list_lock); > > +int (*get_platform_thermal_params)(struct thermal_zone_device *); > +EXPORT_SYMBOL(get_platform_thermal_params); > + > static int get_idr(struct idr *idr, struct mutex *lock, int *id) > { > int err; > diff --git a/include/linux/thermal.h b/include/linux/thermal.h > index 757a007..f9ce1e2 100644 > --- a/include/linux/thermal.h > +++ b/include/linux/thermal.h > @@ -33,6 +33,8 @@ > #define THERMAL_MAX_TRIPS 12 > #define THERMAL_NAME_LENGTH 20 > > +#define MAX_COOLING_DEVS THERMAL_MAX_TRIPS > + > /* Initial state of a cooling device during binding */ > #define THERMAL_NO_TARGET -1UL > > @@ -49,6 +51,11 @@ > #define THERMAL_GENL_VERSION 0x01 > #define THERMAL_GENL_MCAST_GROUP_NAME "thermal_mc_group" > > +/* Thermal policies */ > +#define THERMAL_USER_SPACE 0 > +#define THERMAL_FAIR_SHARE 1 > +#define THERMAL_STEP_WISE 2 > + > struct thermal_zone_device; > struct thermal_cooling_device; > > @@ -165,6 +172,7 @@ struct thermal_zone_device { > struct mutex lock; /* protect thermal_instances list */ > struct list_head node; > struct delayed_work poll_queue; > + struct thermal_zone_params *tzp; > }; > > /* > @@ -187,6 +195,31 @@ struct thermal_instance { > struct list_head cdev_node; /* node in cdev->thermal_instances */ > }; > > +/* Platform level parameters associated with a thermal zone */ > +struct thermal_zone_params { > + char *thermal_zone_name; I suppose this will be plat data definition right? does it make sense to make the above a const? > + int throttle_policy; > + > + /* Number of cooling devices associated with this thermal zone */ > + int num_cdevs; > + char *cdevs_name[MAX_COOLING_DEVS]; dito > + > + /* > + * This is a measure of 'how effectively these devices can > + * cool 'this' thermal zone. The shall be determined by platform > + * characterization. This is on a 'percentage' scale. > + * See Documentation/thermal/sysfs-api.txt for more information. > + */ > + int weights[MAX_COOLING_DEVS]; > + > + /* > + * This is a bit mask that gives the binding relation between this > + * thermal zone and cdev, for a particular trip point. > + * See Documentation/thermal/sysfs-api.txt for more information. > + */ > + int trip_mask[MAX_COOLING_DEVS]; just a matter of taste, but how about defining a struct with cdev_name, weight, trip_max, and then declaring an array in thermal_zone_params? > +}; > + > struct thermal_genl_event { > u32 orig; > enum events event; > @@ -213,6 +246,16 @@ struct thermal_cooling_device *get_cdev_by_name(const char *); > struct thermal_instance *get_thermal_instance(struct thermal_zone_device *, > struct thermal_cooling_device *, int); > > +/* > + * The platform layer shall define a 'function' that provides the > + * parameters for all thermal zones in the platform. This pointer > + * should point to that 'function'. > + * > + * In thermal_zone_device_register() we update the parameters > + * for the particular thermal zone. > + */ > +extern int (*get_platform_thermal_params)(struct thermal_zone_device *); > + > #ifdef CONFIG_NET > extern int thermal_generate_netlink_event(u32 orig, enum events event); > #else > -- > 1.7.9.5 > -- To unsubscribe from this list: send the line "unsubscribe linux-pm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/drivers/thermal/thermal_sys.c b/drivers/thermal/thermal_sys.c index 998c16e..f043cd6 100644 --- a/drivers/thermal/thermal_sys.c +++ b/drivers/thermal/thermal_sys.c @@ -49,6 +49,9 @@ static LIST_HEAD(thermal_tz_list); static LIST_HEAD(thermal_cdev_list); static DEFINE_MUTEX(thermal_list_lock); +int (*get_platform_thermal_params)(struct thermal_zone_device *); +EXPORT_SYMBOL(get_platform_thermal_params); + static int get_idr(struct idr *idr, struct mutex *lock, int *id) { int err; diff --git a/include/linux/thermal.h b/include/linux/thermal.h index 757a007..f9ce1e2 100644 --- a/include/linux/thermal.h +++ b/include/linux/thermal.h @@ -33,6 +33,8 @@ #define THERMAL_MAX_TRIPS 12 #define THERMAL_NAME_LENGTH 20 +#define MAX_COOLING_DEVS THERMAL_MAX_TRIPS + /* Initial state of a cooling device during binding */ #define THERMAL_NO_TARGET -1UL @@ -49,6 +51,11 @@ #define THERMAL_GENL_VERSION 0x01 #define THERMAL_GENL_MCAST_GROUP_NAME "thermal_mc_group" +/* Thermal policies */ +#define THERMAL_USER_SPACE 0 +#define THERMAL_FAIR_SHARE 1 +#define THERMAL_STEP_WISE 2 + struct thermal_zone_device; struct thermal_cooling_device; @@ -165,6 +172,7 @@ struct thermal_zone_device { struct mutex lock; /* protect thermal_instances list */ struct list_head node; struct delayed_work poll_queue; + struct thermal_zone_params *tzp; }; /* @@ -187,6 +195,31 @@ struct thermal_instance { struct list_head cdev_node; /* node in cdev->thermal_instances */ }; +/* Platform level parameters associated with a thermal zone */ +struct thermal_zone_params { + char *thermal_zone_name; + int throttle_policy; + + /* Number of cooling devices associated with this thermal zone */ + int num_cdevs; + char *cdevs_name[MAX_COOLING_DEVS]; + + /* + * This is a measure of 'how effectively these devices can + * cool 'this' thermal zone. The shall be determined by platform + * characterization. This is on a 'percentage' scale. + * See Documentation/thermal/sysfs-api.txt for more information. + */ + int weights[MAX_COOLING_DEVS]; + + /* + * This is a bit mask that gives the binding relation between this + * thermal zone and cdev, for a particular trip point. + * See Documentation/thermal/sysfs-api.txt for more information. + */ + int trip_mask[MAX_COOLING_DEVS]; +}; + struct thermal_genl_event { u32 orig; enum events event; @@ -213,6 +246,16 @@ struct thermal_cooling_device *get_cdev_by_name(const char *); struct thermal_instance *get_thermal_instance(struct thermal_zone_device *, struct thermal_cooling_device *, int); +/* + * The platform layer shall define a 'function' that provides the + * parameters for all thermal zones in the platform. This pointer + * should point to that 'function'. + * + * In thermal_zone_device_register() we update the parameters + * for the particular thermal zone. + */ +extern int (*get_platform_thermal_params)(struct thermal_zone_device *); + #ifdef CONFIG_NET extern int thermal_generate_netlink_event(u32 orig, enum events event); #else
This patch creates a structure to hold a thermal zone's platform level info, and also defines an extern function to retrieve zone parameters from thermal_sys.c. Signed-off-by: Durgadoss R <durgadoss.r@intel.com> --- drivers/thermal/thermal_sys.c | 3 +++ include/linux/thermal.h | 43 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+)