From: Stijn Tintel Date: Tue, 27 Jun 2017 08:05:04 +0000 (+0200) Subject: ipq806x: fixup thermal patches X-Git-Tag: v17.01.3~85 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=53eba6f58f791f5b585da6d2fe9316e579db915c;p=oweals%2Fopenwrt.git ipq806x: fixup thermal patches Fix conflict with thermal patches added in c03d4317a6bc891cb4a5e89cbdd77f37c23aff86. Signed-off-by: Stijn Tintel --- diff --git a/target/linux/ipq806x/patches-4.4/015-1-thermal-qcom-tsens-Add-a-skeletal-TSENS-drivers.patch b/target/linux/ipq806x/patches-4.4/015-1-thermal-qcom-tsens-Add-a-skeletal-TSENS-drivers.patch index ef7e2f4152..dd941cad70 100644 --- a/target/linux/ipq806x/patches-4.4/015-1-thermal-qcom-tsens-Add-a-skeletal-TSENS-drivers.patch +++ b/target/linux/ipq806x/patches-4.4/015-1-thermal-qcom-tsens-Add-a-skeletal-TSENS-drivers.patch @@ -63,9 +63,9 @@ Signed-off-by: Zhang Rui + }; --- a/drivers/thermal/Kconfig +++ b/drivers/thermal/Kconfig -@@ -391,4 +391,9 @@ config QCOM_SPMI_TEMP_ALARM - real time die temperature if an ADC is present or an estimate of the - temperature based upon the over temperature stage value. +@@ -404,4 +404,9 @@ config BCM2835_THERMAL + help + Support for thermal sensors on Broadcom bcm2835 SoCs. +menu "Qualcomm thermal drivers" +depends on (ARCH_QCOM && OF) || COMPILE_TEST @@ -75,10 +75,10 @@ Signed-off-by: Zhang Rui endif --- a/drivers/thermal/Makefile +++ b/drivers/thermal/Makefile -@@ -48,3 +48,4 @@ obj-$(CONFIG_INTEL_PCH_THERMAL) += intel - obj-$(CONFIG_ST_THERMAL) += st/ +@@ -50,3 +50,4 @@ obj-$(CONFIG_ST_THERMAL) += st/ obj-$(CONFIG_TEGRA_SOCTHERM) += tegra_soctherm.o obj-$(CONFIG_HISI_THERMAL) += hisi_thermal.o + obj-$(CONFIG_BCM2835_THERMAL) += bcm2835_thermal.o +obj-$(CONFIG_QCOM_TSENS) += qcom/ --- /dev/null +++ b/drivers/thermal/qcom/Kconfig diff --git a/target/linux/ipq806x/patches-4.4/016-2-thermal-of-thermal-Add-devm-version-of.patch b/target/linux/ipq806x/patches-4.4/016-2-thermal-of-thermal-Add-devm-version-of.patch deleted file mode 100644 index 1ca7326832..0000000000 --- a/target/linux/ipq806x/patches-4.4/016-2-thermal-of-thermal-Add-devm-version-of.patch +++ /dev/null @@ -1,143 +0,0 @@ -From e498b4984db82b4ba3ceea7dba813222a31e9c2e Mon Sep 17 00:00:00 2001 -From: Laxman Dewangan -Date: Wed, 9 Mar 2016 18:40:06 +0530 -Subject: thermal: of-thermal: Add devm version of - thermal_zone_of_sensor_register - -Add resource managed version of thermal_zone_of_sensor_register() and -thermal_zone_of_sensor_unregister(). - -This helps in reducing the code size in error path, remove of -driver remove callbacks and making proper sequence for deallocations. - -Signed-off-by: Laxman Dewangan -Signed-off-by: Eduardo Valentin ---- - drivers/thermal/of-thermal.c | 81 ++++++++++++++++++++++++++++++++++++++++++++ - include/linux/thermal.h | 18 ++++++++++ - 2 files changed, 99 insertions(+) - ---- a/drivers/thermal/of-thermal.c -+++ b/drivers/thermal/of-thermal.c -@@ -559,6 +559,87 @@ void thermal_zone_of_sensor_unregister(s - } - EXPORT_SYMBOL_GPL(thermal_zone_of_sensor_unregister); - -+static void devm_thermal_zone_of_sensor_release(struct device *dev, void *res) -+{ -+ thermal_zone_of_sensor_unregister(dev, -+ *(struct thermal_zone_device **)res); -+} -+ -+static int devm_thermal_zone_of_sensor_match(struct device *dev, void *res, -+ void *data) -+{ -+ struct thermal_zone_device **r = res; -+ -+ if (WARN_ON(!r || !*r)) -+ return 0; -+ -+ return *r == data; -+} -+ -+/** -+ * devm_thermal_zone_of_sensor_register - Resource managed version of -+ * thermal_zone_of_sensor_register() -+ * @dev: a valid struct device pointer of a sensor device. Must contain -+ * a valid .of_node, for the sensor node. -+ * @sensor_id: a sensor identifier, in case the sensor IP has more -+ * than one sensors -+ * @data: a private pointer (owned by the caller) that will be passed -+ * back, when a temperature reading is needed. -+ * @ops: struct thermal_zone_of_device_ops *. Must contain at least .get_temp. -+ * -+ * Refer thermal_zone_of_sensor_register() for more details. -+ * -+ * Return: On success returns a valid struct thermal_zone_device, -+ * otherwise, it returns a corresponding ERR_PTR(). Caller must -+ * check the return value with help of IS_ERR() helper. -+ * Registered hermal_zone_device device will automatically be -+ * released when device is unbounded. -+ */ -+struct thermal_zone_device *devm_thermal_zone_of_sensor_register( -+ struct device *dev, int sensor_id, -+ void *data, const struct thermal_zone_of_device_ops *ops) -+{ -+ struct thermal_zone_device **ptr, *tzd; -+ -+ ptr = devres_alloc(devm_thermal_zone_of_sensor_release, sizeof(*ptr), -+ GFP_KERNEL); -+ if (!ptr) -+ return ERR_PTR(-ENOMEM); -+ -+ tzd = thermal_zone_of_sensor_register(dev, sensor_id, data, ops); -+ if (IS_ERR(tzd)) { -+ devres_free(ptr); -+ return tzd; -+ } -+ -+ *ptr = tzd; -+ devres_add(dev, ptr); -+ -+ return tzd; -+} -+EXPORT_SYMBOL_GPL(devm_thermal_zone_of_sensor_register); -+ -+/** -+ * devm_thermal_zone_of_sensor_unregister - Resource managed version of -+ * thermal_zone_of_sensor_unregister(). -+ * @dev: Device for which which resource was allocated. -+ * @tzd: a pointer to struct thermal_zone_device where the sensor is registered. -+ * -+ * This function removes the sensor callbacks and private data from the -+ * thermal zone device registered with devm_thermal_zone_of_sensor_register() -+ * API. It will also silent the zone by remove the .get_temp() and .get_trend() -+ * thermal zone device callbacks. -+ * Normally this function will not need to be called and the resource -+ * management code will ensure that the resource is freed. -+ */ -+void devm_thermal_zone_of_sensor_unregister(struct device *dev, -+ struct thermal_zone_device *tzd) -+{ -+ WARN_ON(devres_release(dev, devm_thermal_zone_of_sensor_release, -+ devm_thermal_zone_of_sensor_match, tzd)); -+} -+EXPORT_SYMBOL_GPL(devm_thermal_zone_of_sensor_unregister); -+ - /*** functions parsing device tree nodes ***/ - - /** ---- a/include/linux/thermal.h -+++ b/include/linux/thermal.h -@@ -364,6 +364,11 @@ thermal_zone_of_sensor_register(struct d - const struct thermal_zone_of_device_ops *ops); - void thermal_zone_of_sensor_unregister(struct device *dev, - struct thermal_zone_device *tz); -+struct thermal_zone_device *devm_thermal_zone_of_sensor_register( -+ struct device *dev, int id, void *data, -+ const struct thermal_zone_of_device_ops *ops); -+void devm_thermal_zone_of_sensor_unregister(struct device *dev, -+ struct thermal_zone_device *tz); - #else - static inline struct thermal_zone_device * - thermal_zone_of_sensor_register(struct device *dev, int id, void *data, -@@ -378,6 +383,19 @@ void thermal_zone_of_sensor_unregister(s - { - } - -+static inline struct thermal_zone_device *devm_thermal_zone_of_sensor_register( -+ struct device *dev, int id, void *data, -+ const struct thermal_zone_of_device_ops *ops) -+{ -+ return ERR_PTR(-ENODEV); -+} -+ -+static inline -+void devm_thermal_zone_of_sensor_unregister(struct device *dev, -+ struct thermal_zone_device *tz) -+{ -+} -+ - #endif - - #if IS_ENABLED(CONFIG_THERMAL) diff --git a/target/linux/ipq806x/patches-4.4/017-09-thermal-core-export-apis-to-get-slope-and-offset.patch b/target/linux/ipq806x/patches-4.4/017-09-thermal-core-export-apis-to-get-slope-and-offset.patch deleted file mode 100644 index 3fbe5f521a..0000000000 --- a/target/linux/ipq806x/patches-4.4/017-09-thermal-core-export-apis-to-get-slope-and-offset.patch +++ /dev/null @@ -1,101 +0,0 @@ -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 *