Commit 4a7069a3 authored by Rajendra Nayak's avatar Rajendra Nayak Committed by Zhang Rui

thermal: core: export apis to get slope and offset

Add apis for platform thermal drivers to query for slope and offset
attributes, which might be needed for temperature calculations.
Signed-off-by: default avatarRajendra Nayak <rnayak@codeaurora.org>
Signed-off-by: default avatarEduardo Valentin <edubezval@gmail.com>
Signed-off-by: default avatarZhang Rui <rui.zhang@intel.com>
parent 5e6703bd
...@@ -140,6 +140,18 @@ temperature) and throttle appropriate devices. ...@@ -140,6 +140,18 @@ temperature) and throttle appropriate devices.
Normally this function will not need to be called and the resource Normally this function will not need to be called and the resource
management code will ensure that the resource is freed. management code will ensure that the resource is freed.
1.1.7 int thermal_zone_get_slope(struct thermal_zone_device *tz)
This interface is used to read the slope attribute value
for the thermal zone device, which might be useful for platform
drivers for temperature calculations.
1.1.8 int thermal_zone_get_offset(struct thermal_zone_device *tz)
This interface is used to read the offset attribute value
for the thermal zone device, which might be useful for platform
drivers for temperature calculations.
1.2 thermal cooling device interface 1.2 thermal cooling device interface
1.2.1 struct thermal_cooling_device *thermal_cooling_device_register(char *name, 1.2.1 struct thermal_cooling_device *thermal_cooling_device_register(char *name,
void *devdata, struct thermal_cooling_device_ops *) void *devdata, struct thermal_cooling_device_ops *)
......
...@@ -2069,6 +2069,36 @@ struct thermal_zone_device *thermal_zone_get_zone_by_name(const char *name) ...@@ -2069,6 +2069,36 @@ struct thermal_zone_device *thermal_zone_get_zone_by_name(const char *name)
} }
EXPORT_SYMBOL_GPL(thermal_zone_get_zone_by_name); EXPORT_SYMBOL_GPL(thermal_zone_get_zone_by_name);
/**
* thermal_zone_get_slope - return the slope attribute of the thermal zone
* @tz: thermal zone device with the slope attribute
*
* Return: If the thermal zone device has a slope attribute, return it, else
* return 1.
*/
int thermal_zone_get_slope(struct thermal_zone_device *tz)
{
if (tz && tz->tzp)
return tz->tzp->slope;
return 1;
}
EXPORT_SYMBOL_GPL(thermal_zone_get_slope);
/**
* thermal_zone_get_offset - return the offset attribute of the thermal zone
* @tz: thermal zone device with the offset attribute
*
* Return: If the thermal zone device has a offset attribute, return it, else
* return 0.
*/
int thermal_zone_get_offset(struct thermal_zone_device *tz)
{
if (tz && tz->tzp)
return tz->tzp->offset;
return 0;
}
EXPORT_SYMBOL_GPL(thermal_zone_get_offset);
#ifdef CONFIG_NET #ifdef CONFIG_NET
static const struct genl_multicast_group thermal_event_mcgrps[] = { static const struct genl_multicast_group thermal_event_mcgrps[] = {
{ .name = THERMAL_GENL_MCAST_GROUP_NAME, }, { .name = THERMAL_GENL_MCAST_GROUP_NAME, },
......
...@@ -435,6 +435,8 @@ thermal_of_cooling_device_register(struct device_node *np, char *, void *, ...@@ -435,6 +435,8 @@ thermal_of_cooling_device_register(struct device_node *np, char *, void *,
void thermal_cooling_device_unregister(struct thermal_cooling_device *); void thermal_cooling_device_unregister(struct thermal_cooling_device *);
struct thermal_zone_device *thermal_zone_get_zone_by_name(const char *name); struct thermal_zone_device *thermal_zone_get_zone_by_name(const char *name);
int thermal_zone_get_temp(struct thermal_zone_device *tz, int *temp); int thermal_zone_get_temp(struct thermal_zone_device *tz, int *temp);
int thermal_zone_get_slope(struct thermal_zone_device *tz);
int thermal_zone_get_offset(struct thermal_zone_device *tz);
int get_tz_trend(struct thermal_zone_device *, int); int get_tz_trend(struct thermal_zone_device *, int);
struct thermal_instance *get_thermal_instance(struct thermal_zone_device *, struct thermal_instance *get_thermal_instance(struct thermal_zone_device *,
...@@ -492,6 +494,12 @@ static inline struct thermal_zone_device *thermal_zone_get_zone_by_name( ...@@ -492,6 +494,12 @@ static inline struct thermal_zone_device *thermal_zone_get_zone_by_name(
static inline int thermal_zone_get_temp( static inline int thermal_zone_get_temp(
struct thermal_zone_device *tz, int *temp) struct thermal_zone_device *tz, int *temp)
{ return -ENODEV; } { return -ENODEV; }
static inline int thermal_zone_get_slope(
struct thermal_zone_device *tz)
{ return -ENODEV; }
static inline int thermal_zone_get_offset(
struct thermal_zone_device *tz)
{ return -ENODEV; }
static inline int get_tz_trend(struct thermal_zone_device *tz, int trip) static inline int get_tz_trend(struct thermal_zone_device *tz, int trip)
{ return -ENODEV; } { return -ENODEV; }
static inline struct thermal_instance * static inline struct thermal_instance *
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment