From c03d4317a6bc891cb4a5e89cbdd77f37c23aff86 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= Date: Fri, 14 Apr 2017 18:18:36 +0200 Subject: kernel: backport Broadcom thermal drivers MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This includes driver for Northstar and for Raspberry Pi. Signed-off-by: Rafał Miłecki --- ...-core-export-apis-to-get-slope-and-offset.patch | 101 +++++++++++++++++++++ 1 file changed, 101 insertions(+) create mode 100644 target/linux/generic/patches-4.4/086-0002-thermal-core-export-apis-to-get-slope-and-offset.patch (limited to 'target/linux/generic/patches-4.4/086-0002-thermal-core-export-apis-to-get-slope-and-offset.patch') diff --git a/target/linux/generic/patches-4.4/086-0002-thermal-core-export-apis-to-get-slope-and-offset.patch b/target/linux/generic/patches-4.4/086-0002-thermal-core-export-apis-to-get-slope-and-offset.patch new file mode 100644 index 0000000000..3fbe5f521a --- /dev/null +++ b/target/linux/generic/patches-4.4/086-0002-thermal-core-export-apis-to-get-slope-and-offset.patch @@ -0,0 +1,101 @@ +From 4a7069a32c99a81950de035535b0a064dcceaeba Mon Sep 17 00:00:00 2001 +From: Rajendra Nayak +Date: Thu, 5 May 2016 14:21:42 +0530 +Subject: [PATCH] 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: Rajendra Nayak +Signed-off-by: Eduardo Valentin +Signed-off-by: Zhang Rui +--- + Documentation/thermal/sysfs-api.txt | 12 ++++++++++++ + drivers/thermal/thermal_core.c | 30 ++++++++++++++++++++++++++++++ + include/linux/thermal.h | 8 ++++++++ + 3 files changed, 50 insertions(+) + +--- a/Documentation/thermal/sysfs-api.txt ++++ b/Documentation/thermal/sysfs-api.txt +@@ -72,6 +72,18 @@ temperature) and throttle appropriate de + It deletes the corresponding entry form /sys/class/thermal folder and + unbind all the thermal cooling devices it uses. + ++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.1 struct thermal_cooling_device *thermal_cooling_device_register(char *name, + void *devdata, struct thermal_cooling_device_ops *) +--- a/drivers/thermal/thermal_core.c ++++ b/drivers/thermal/thermal_core.c +@@ -2061,6 +2061,36 @@ exit: + } + 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 + static const struct genl_multicast_group thermal_event_mcgrps[] = { + { .name = THERMAL_GENL_MCAST_GROUP_NAME, }, +--- a/include/linux/thermal.h ++++ b/include/linux/thermal.h +@@ -432,6 +432,8 @@ thermal_of_cooling_device_register(struc + void thermal_cooling_device_unregister(struct thermal_cooling_device *); + 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_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); + struct thermal_instance *get_thermal_instance(struct thermal_zone_device *, +@@ -489,6 +491,12 @@ static inline struct thermal_zone_device + static inline int thermal_zone_get_temp( + struct thermal_zone_device *tz, int *temp) + { 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) + { return -ENODEV; } + static inline struct thermal_instance * -- cgit v1.2.3