diff options
Diffstat (limited to 'target/linux/mediatek')
12 files changed, 116 insertions, 123 deletions
diff --git a/target/linux/mediatek/patches/0010-thermal-consistently-use-int-for-temperatures.patch b/target/linux/mediatek/patches/0010-thermal-consistently-use-int-for-temperatures.patch index 88aa72553c..26276aff7a 100644 --- a/target/linux/mediatek/patches/0010-thermal-consistently-use-int-for-temperatures.patch +++ b/target/linux/mediatek/patches/0010-thermal-consistently-use-int-for-temperatures.patch @@ -746,7 +746,7 @@ Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> struct device *dev = sensor->dev; --- a/drivers/thermal/step_wise.c +++ b/drivers/thermal/step_wise.c -@@ -113,7 +113,7 @@ static void update_passive_instance(stru +@@ -126,7 +126,7 @@ static void update_passive_instance(stru static void thermal_zone_trip_update(struct thermal_zone_device *tz, int trip) { @@ -755,7 +755,7 @@ Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> enum thermal_trip_type trip_type; enum thermal_trend trend; struct thermal_instance *instance; -@@ -135,7 +135,7 @@ static void thermal_zone_trip_update(str +@@ -148,7 +148,7 @@ static void thermal_zone_trip_update(str trace_thermal_zone_trip(tz, trip, trip_type); } @@ -786,7 +786,7 @@ Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> u32 val; --- a/drivers/thermal/thermal_core.c +++ b/drivers/thermal/thermal_core.c -@@ -363,7 +363,7 @@ static void handle_non_critical_trips(st +@@ -366,7 +366,7 @@ static void handle_non_critical_trips(st static void handle_critical_trips(struct thermal_zone_device *tz, int trip, enum thermal_trip_type trip_type) { @@ -795,7 +795,7 @@ Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> tz->ops->get_trip_temp(tz, trip, &trip_temp); -@@ -411,12 +411,12 @@ static void handle_thermal_trip(struct t +@@ -414,12 +414,12 @@ static void handle_thermal_trip(struct t * * Return: On success returns 0, an error code otherwise */ @@ -810,7 +810,7 @@ Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> enum thermal_trip_type type; #endif -@@ -453,8 +453,7 @@ EXPORT_SYMBOL_GPL(thermal_zone_get_temp) +@@ -456,8 +456,7 @@ EXPORT_SYMBOL_GPL(thermal_zone_get_temp) static void update_temperature(struct thermal_zone_device *tz) { @@ -820,7 +820,7 @@ Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> ret = thermal_zone_get_temp(tz, &temp); if (ret) { -@@ -514,15 +513,14 @@ static ssize_t +@@ -534,15 +533,14 @@ static ssize_t temp_show(struct device *dev, struct device_attribute *attr, char *buf) { struct thermal_zone_device *tz = to_thermal_zone(dev); @@ -838,7 +838,7 @@ Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> } static ssize_t -@@ -626,7 +624,7 @@ trip_point_temp_show(struct device *dev, +@@ -646,7 +644,7 @@ trip_point_temp_show(struct device *dev, { struct thermal_zone_device *tz = to_thermal_zone(dev); int trip, ret; @@ -847,7 +847,7 @@ Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> if (!tz->ops->get_trip_temp) return -EPERM; -@@ -639,7 +637,7 @@ trip_point_temp_show(struct device *dev, +@@ -659,7 +657,7 @@ trip_point_temp_show(struct device *dev, if (ret) return ret; @@ -856,7 +856,7 @@ Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> } static ssize_t -@@ -648,7 +646,7 @@ trip_point_hyst_store(struct device *dev +@@ -668,7 +666,7 @@ trip_point_hyst_store(struct device *dev { struct thermal_zone_device *tz = to_thermal_zone(dev); int trip, ret; @@ -865,7 +865,7 @@ Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> if (!tz->ops->set_trip_hyst) return -EPERM; -@@ -656,7 +654,7 @@ trip_point_hyst_store(struct device *dev +@@ -676,7 +674,7 @@ trip_point_hyst_store(struct device *dev if (!sscanf(attr->attr.name, "trip_point_%d_hyst", &trip)) return -EINVAL; @@ -874,7 +874,7 @@ Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> return -EINVAL; /* -@@ -675,7 +673,7 @@ trip_point_hyst_show(struct device *dev, +@@ -695,7 +693,7 @@ trip_point_hyst_show(struct device *dev, { struct thermal_zone_device *tz = to_thermal_zone(dev); int trip, ret; @@ -883,7 +883,7 @@ Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> if (!tz->ops->get_trip_hyst) return -EPERM; -@@ -685,7 +683,7 @@ trip_point_hyst_show(struct device *dev, +@@ -705,7 +703,7 @@ trip_point_hyst_show(struct device *dev, ret = tz->ops->get_trip_hyst(tz, trip, &temperature); @@ -1031,7 +1031,7 @@ Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> struct phy_dev_entry *phy_dev_entry; --- a/include/linux/thermal.h +++ b/include/linux/thermal.h -@@ -86,23 +86,19 @@ struct thermal_zone_device_ops { +@@ -89,23 +89,19 @@ struct thermal_zone_device_ops { struct thermal_cooling_device *); int (*unbind) (struct thermal_zone_device *, struct thermal_cooling_device *); @@ -1062,7 +1062,7 @@ Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> int (*get_trend) (struct thermal_zone_device *, int, enum thermal_trend *); int (*notify) (struct thermal_zone_device *, int, -@@ -272,9 +268,9 @@ struct thermal_genl_event { +@@ -277,9 +273,9 @@ struct thermal_genl_event { * temperature. */ struct thermal_zone_of_device_ops { @@ -1074,7 +1074,7 @@ Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> }; /** -@@ -335,7 +331,7 @@ thermal_of_cooling_device_register(struc +@@ -340,7 +336,7 @@ thermal_of_cooling_device_register(struc const struct thermal_cooling_device_ops *); void thermal_cooling_device_unregister(struct thermal_cooling_device *); struct thermal_zone_device *thermal_zone_get_zone_by_name(const char *name); @@ -1083,7 +1083,7 @@ Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> int get_tz_trend(struct thermal_zone_device *, int); struct thermal_instance *get_thermal_instance(struct thermal_zone_device *, -@@ -378,7 +374,7 @@ static inline struct thermal_zone_device +@@ -383,7 +379,7 @@ static inline struct thermal_zone_device const char *name) { return ERR_PTR(-ENODEV); } static inline int thermal_zone_get_temp( diff --git a/target/linux/mediatek/patches/0011-thermal-trivial-fix-typo-in-comment.patch b/target/linux/mediatek/patches/0011-thermal-trivial-fix-typo-in-comment.patch index db06362a75..3c0dca68cc 100644 --- a/target/linux/mediatek/patches/0011-thermal-trivial-fix-typo-in-comment.patch +++ b/target/linux/mediatek/patches/0011-thermal-trivial-fix-typo-in-comment.patch @@ -11,7 +11,7 @@ Acked-by: Eduardo Valentin <edubezval@gmail.com> --- a/drivers/thermal/thermal_core.c +++ b/drivers/thermal/thermal_core.c -@@ -402,7 +402,7 @@ static void handle_thermal_trip(struct t +@@ -405,7 +405,7 @@ static void handle_thermal_trip(struct t } /** diff --git a/target/linux/mediatek/patches/0012-thermal-remove-useless-call-to-thermal_zone_device_s.patch b/target/linux/mediatek/patches/0012-thermal-remove-useless-call-to-thermal_zone_device_s.patch index f4e237f369..7bdff55384 100644 --- a/target/linux/mediatek/patches/0012-thermal-remove-useless-call-to-thermal_zone_device_s.patch +++ b/target/linux/mediatek/patches/0012-thermal-remove-useless-call-to-thermal_zone_device_s.patch @@ -17,13 +17,13 @@ Acked-by: Eduardo Valentin <edubezval@gmail.com> --- a/drivers/thermal/thermal_core.c +++ b/drivers/thermal/thermal_core.c -@@ -1571,9 +1571,6 @@ struct thermal_zone_device *thermal_zone +@@ -1601,9 +1601,6 @@ struct thermal_zone_device *thermal_zone INIT_DELAYED_WORK(&(tz->poll_queue), thermal_zone_device_check); - if (!tz->ops->get_temp) - thermal_zone_device_set_polling(tz, 0); - - thermal_zone_device_update(tz); - - return tz; + thermal_zone_device_reset(tz); + /* Update the new thermal zone and mark it as already updated. */ + if (atomic_cmpxchg(&tz->need_update, 1, 0)) diff --git a/target/linux/mediatek/patches/0013-thermal-Use-IS_ENABLED-instead-of-ifdef.patch b/target/linux/mediatek/patches/0013-thermal-Use-IS_ENABLED-instead-of-ifdef.patch index f0cbdb380b..6f4ca5a24b 100644 --- a/target/linux/mediatek/patches/0013-thermal-Use-IS_ENABLED-instead-of-ifdef.patch +++ b/target/linux/mediatek/patches/0013-thermal-Use-IS_ENABLED-instead-of-ifdef.patch @@ -14,7 +14,7 @@ Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> --- a/drivers/thermal/thermal_core.c +++ b/drivers/thermal/thermal_core.c -@@ -414,11 +414,9 @@ static void handle_thermal_trip(struct t +@@ -417,11 +417,9 @@ static void handle_thermal_trip(struct t int thermal_zone_get_temp(struct thermal_zone_device *tz, int *temp) { int ret = -EINVAL; @@ -26,7 +26,7 @@ Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> if (!tz || IS_ERR(tz) || !tz->ops->get_temp) goto exit; -@@ -426,25 +424,21 @@ int thermal_zone_get_temp(struct thermal +@@ -429,25 +427,21 @@ int thermal_zone_get_temp(struct thermal mutex_lock(&tz->lock); ret = tz->ops->get_temp(tz, temp); @@ -65,7 +65,7 @@ Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> mutex_unlock(&tz->lock); exit: return ret; -@@ -780,7 +774,6 @@ policy_show(struct device *dev, struct d +@@ -800,7 +794,6 @@ policy_show(struct device *dev, struct d return sprintf(buf, "%s\n", tz->governor->name); } @@ -73,7 +73,7 @@ Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> static ssize_t emul_temp_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) -@@ -806,7 +799,6 @@ emul_temp_store(struct device *dev, stru +@@ -826,7 +819,6 @@ emul_temp_store(struct device *dev, stru return ret ? ret : count; } static DEVICE_ATTR(emul_temp, S_IWUSR, NULL, emul_temp_store); @@ -81,7 +81,7 @@ Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> static DEVICE_ATTR(type, 0444, type_show, NULL); static DEVICE_ATTR(temp, 0444, temp_show, NULL); -@@ -1536,11 +1528,12 @@ struct thermal_zone_device *thermal_zone +@@ -1566,11 +1558,12 @@ struct thermal_zone_device *thermal_zone goto unregister; } diff --git a/target/linux/mediatek/patches/0014-thermal-Add-comment-explaining-test-for-critical-tem.patch b/target/linux/mediatek/patches/0014-thermal-Add-comment-explaining-test-for-critical-tem.patch index 8f7ee00cae..4d3581283b 100644 --- a/target/linux/mediatek/patches/0014-thermal-Add-comment-explaining-test-for-critical-tem.patch +++ b/target/linux/mediatek/patches/0014-thermal-Add-comment-explaining-test-for-critical-tem.patch @@ -15,7 +15,7 @@ Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com> --- a/drivers/thermal/thermal_core.c +++ b/drivers/thermal/thermal_core.c -@@ -435,6 +435,11 @@ int thermal_zone_get_temp(struct thermal +@@ -438,6 +438,11 @@ int thermal_zone_get_temp(struct thermal } } diff --git a/target/linux/mediatek/patches/0015-thermal-inline-only-once-used-function.patch b/target/linux/mediatek/patches/0015-thermal-inline-only-once-used-function.patch index e3ffb330f5..0ac3aa95f0 100644 --- a/target/linux/mediatek/patches/0015-thermal-inline-only-once-used-function.patch +++ b/target/linux/mediatek/patches/0015-thermal-inline-only-once-used-function.patch @@ -14,7 +14,7 @@ Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com> --- a/drivers/thermal/thermal_core.c +++ b/drivers/thermal/thermal_core.c -@@ -450,9 +450,12 @@ exit: +@@ -453,9 +453,15 @@ exit: } EXPORT_SYMBOL_GPL(thermal_zone_get_temp); @@ -24,25 +24,47 @@ Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com> - int temp, ret; + int temp, ret, count; + ++ if (atomic_read(&in_suspend)) ++ return; ++ + if (!tz->ops->get_temp) + return; ret = thermal_zone_get_temp(tz, &temp); if (ret) { -@@ -471,16 +474,6 @@ static void update_temperature(struct th - trace_thermal_temperature(tz); - dev_dbg(&tz->device, "last_temperature=%d, current_temperature=%d\n", - tz->last_temperature, tz->temperature); --} -- +@@ -478,7 +484,11 @@ static void update_temperature(struct th + else + dev_dbg(&tz->device, "last_temperature=%d, current_temperature=%d\n", + tz->last_temperature, tz->temperature); ++ ++ for (count = 0; count < tz->trips; count++) ++ handle_thermal_trip(tz, count); + } ++EXPORT_SYMBOL_GPL(thermal_zone_device_update); + + static void thermal_zone_device_reset(struct thermal_zone_device *tz) + { +@@ -490,23 +500,6 @@ static void thermal_zone_device_reset(st + pos->initialized = false; + } + -void thermal_zone_device_update(struct thermal_zone_device *tz) -{ - int count; - +- if (atomic_read(&in_suspend)) +- return; +- - if (!tz->ops->get_temp) - return; - - update_temperature(tz); - - for (count = 0; count < tz->trips; count++) - handle_thermal_trip(tz, count); +- +- for (count = 0; count < tz->trips; count++) +- handle_thermal_trip(tz, count); +-} +-EXPORT_SYMBOL_GPL(thermal_zone_device_update); +- + static void thermal_zone_device_check(struct work_struct *work) + { + struct thermal_zone_device *tz = container_of(work, struct diff --git a/target/linux/mediatek/patches/0016-thermal-streamline-get_trend-callbacks.patch b/target/linux/mediatek/patches/0016-thermal-streamline-get_trend-callbacks.patch index 3ee345e688..37c580ac82 100644 --- a/target/linux/mediatek/patches/0016-thermal-streamline-get_trend-callbacks.patch +++ b/target/linux/mediatek/patches/0016-thermal-streamline-get_trend-callbacks.patch @@ -103,7 +103,7 @@ Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> int *temp) --- a/include/linux/thermal.h +++ b/include/linux/thermal.h -@@ -269,7 +269,7 @@ struct thermal_genl_event { +@@ -274,7 +274,7 @@ struct thermal_genl_event { */ struct thermal_zone_of_device_ops { int (*get_temp)(void *, int *); diff --git a/target/linux/mediatek/patches/0017-thermal-Allow-sensor-ops-to-fail-with-ENOSYS.patch b/target/linux/mediatek/patches/0017-thermal-Allow-sensor-ops-to-fail-with-ENOSYS.patch index 65c76c3a26..5a4c1da2b1 100644 --- a/target/linux/mediatek/patches/0017-thermal-Allow-sensor-ops-to-fail-with-ENOSYS.patch +++ b/target/linux/mediatek/patches/0017-thermal-Allow-sensor-ops-to-fail-with-ENOSYS.patch @@ -22,7 +22,7 @@ Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> --- a/drivers/thermal/thermal_core.c +++ b/drivers/thermal/thermal_core.c -@@ -413,13 +413,16 @@ static void handle_thermal_trip(struct t +@@ -416,13 +416,16 @@ static void handle_thermal_trip(struct t */ int thermal_zone_get_temp(struct thermal_zone_device *tz, int *temp) { @@ -42,7 +42,7 @@ Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> mutex_lock(&tz->lock); -@@ -445,7 +448,7 @@ int thermal_zone_get_temp(struct thermal +@@ -448,7 +451,7 @@ int thermal_zone_get_temp(struct thermal } mutex_unlock(&tz->lock); @@ -51,9 +51,9 @@ Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> return ret; } EXPORT_SYMBOL_GPL(thermal_zone_get_temp); -@@ -454,10 +457,11 @@ void thermal_zone_device_update(struct t - { - int temp, ret, count; +@@ -460,10 +463,11 @@ void thermal_zone_device_update(struct t + if (atomic_read(&in_suspend)) + return; - if (!tz->ops->get_temp) + ret = thermal_zone_get_temp(tz, &temp); @@ -65,7 +65,7 @@ Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> if (ret) { if (ret != -EAGAIN) dev_warn(&tz->device, -@@ -783,10 +787,16 @@ emul_temp_store(struct device *dev, stru +@@ -803,10 +807,16 @@ emul_temp_store(struct device *dev, stru if (kstrtoul(buf, 10, &temperature)) return -EINVAL; diff --git a/target/linux/mediatek/patches/0019-thermal-Make-struct-thermal_zone_device_ops-const.patch b/target/linux/mediatek/patches/0019-thermal-Make-struct-thermal_zone_device_ops-const.patch index 36f7ccf1ea..c91f6c8b31 100644 --- a/target/linux/mediatek/patches/0019-thermal-Make-struct-thermal_zone_device_ops-const.patch +++ b/target/linux/mediatek/patches/0019-thermal-Make-struct-thermal_zone_device_ops-const.patch @@ -220,7 +220,7 @@ Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> .get_trip_temp = st_thermal_get_trip_temp, --- a/drivers/thermal/thermal_core.c +++ b/drivers/thermal/thermal_core.c -@@ -1451,7 +1451,7 @@ static void remove_trip_attrs(struct the +@@ -1479,7 +1479,7 @@ static void remove_trip_attrs(struct the */ struct thermal_zone_device *thermal_zone_device_register(const char *type, int trips, int mask, void *devdata, @@ -253,16 +253,16 @@ Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> .get_trip_type = sys_get_trip_type, --- a/include/linux/thermal.h +++ b/include/linux/thermal.h -@@ -181,7 +181,7 @@ struct thermal_zone_device { - int emul_temperature; +@@ -186,7 +186,7 @@ struct thermal_zone_device { int passive; unsigned int forced_passive; + atomic_t need_update; - struct thermal_zone_device_ops *ops; + const struct thermal_zone_device_ops *ops; const struct thermal_zone_params *tzp; struct thermal_governor *governor; struct list_head thermal_instances; -@@ -313,7 +313,7 @@ void thermal_zone_of_sensor_unregister(s +@@ -318,7 +318,7 @@ void thermal_zone_of_sensor_unregister(s #if IS_ENABLED(CONFIG_THERMAL) struct thermal_zone_device *thermal_zone_device_register(const char *, int, int, @@ -271,7 +271,7 @@ Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> const struct thermal_zone_params *, int, int); void thermal_zone_device_unregister(struct thermal_zone_device *); -@@ -341,7 +341,7 @@ void thermal_notify_framework(struct the +@@ -346,7 +346,7 @@ void thermal_notify_framework(struct the #else static inline struct thermal_zone_device *thermal_zone_device_register( const char *type, int trips, int mask, void *devdata, diff --git a/target/linux/mediatek/patches/0020-thermal-thermal-Add-support-for-hardware-tracked-tri.patch b/target/linux/mediatek/patches/0020-thermal-thermal-Add-support-for-hardware-tracked-tri.patch index d492a0683f..ab305e73a9 100644 --- a/target/linux/mediatek/patches/0020-thermal-thermal-Add-support-for-hardware-tracked-tri.patch +++ b/target/linux/mediatek/patches/0020-thermal-thermal-Add-support-for-hardware-tracked-tri.patch @@ -32,7 +32,7 @@ Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> --- a/drivers/thermal/thermal_core.c +++ b/drivers/thermal/thermal_core.c -@@ -453,6 +453,45 @@ int thermal_zone_get_temp(struct thermal +@@ -456,6 +456,45 @@ int thermal_zone_get_temp(struct thermal } EXPORT_SYMBOL_GPL(thermal_zone_get_temp); @@ -78,27 +78,27 @@ Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> void thermal_zone_device_update(struct thermal_zone_device *tz) { int temp, ret, count; -@@ -479,6 +518,8 @@ void thermal_zone_device_update(struct t - dev_dbg(&tz->device, "last_temperature=%d, current_temperature=%d\n", - tz->last_temperature, tz->temperature); +@@ -489,6 +528,8 @@ void thermal_zone_device_update(struct t + dev_dbg(&tz->device, "last_temperature=%d, current_temperature=%d\n", + tz->last_temperature, tz->temperature); + thermal_zone_set_trips(tz); + for (count = 0; count < tz->trips; count++) handle_thermal_trip(tz, count); } -@@ -1494,6 +1535,8 @@ struct thermal_zone_device *thermal_zone +@@ -1522,6 +1563,8 @@ struct thermal_zone_device *thermal_zone tz->trips = trips; tz->passive_delay = passive_delay; tz->polling_delay = polling_delay; + tz->prev_low_trip = INT_MAX; + tz->prev_high_trip = -INT_MAX; + /* A new thermal zone needs to be updated anyway. */ + atomic_set(&tz->need_update, 1); - dev_set_name(&tz->device, "thermal_zone%d", tz->id); - result = device_register(&tz->device); --- a/include/linux/thermal.h +++ b/include/linux/thermal.h -@@ -87,6 +87,7 @@ struct thermal_zone_device_ops { +@@ -90,6 +90,7 @@ struct thermal_zone_device_ops { int (*unbind) (struct thermal_zone_device *, struct thermal_cooling_device *); int (*get_temp) (struct thermal_zone_device *, int *); @@ -106,12 +106,12 @@ Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> int (*get_mode) (struct thermal_zone_device *, enum thermal_device_mode *); int (*set_mode) (struct thermal_zone_device *, -@@ -180,6 +181,8 @@ struct thermal_zone_device { +@@ -184,6 +185,8 @@ struct thermal_zone_device { int last_temperature; int emul_temperature; int passive; + int prev_low_trip; + int prev_high_trip; unsigned int forced_passive; + atomic_t need_update; const struct thermal_zone_device_ops *ops; - const struct thermal_zone_params *tzp; diff --git a/target/linux/mediatek/patches/0021-thermal-of-implement-.set_trips-for-device-tree-ther.patch b/target/linux/mediatek/patches/0021-thermal-of-implement-.set_trips-for-device-tree-ther.patch index 149ba000af..09c9f24a4d 100644 --- a/target/linux/mediatek/patches/0021-thermal-of-implement-.set_trips-for-device-tree-ther.patch +++ b/target/linux/mediatek/patches/0021-thermal-of-implement-.set_trips-for-device-tree-ther.patch @@ -40,7 +40,7 @@ Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> --- a/include/linux/thermal.h +++ b/include/linux/thermal.h -@@ -267,12 +267,15 @@ struct thermal_genl_event { +@@ -272,12 +272,15 @@ struct thermal_genl_event { * * Optional: * @get_trend: a pointer to a function that reads the sensor temperature trend. diff --git a/target/linux/mediatek/patches/0047-xhci-mediatek-support-MTK-xHCI-host-controller.patch b/target/linux/mediatek/patches/0047-xhci-mediatek-support-MTK-xHCI-host-controller.patch index 55e340d74f..54c5bfc098 100644 --- a/target/linux/mediatek/patches/0047-xhci-mediatek-support-MTK-xHCI-host-controller.patch +++ b/target/linux/mediatek/patches/0047-xhci-mediatek-support-MTK-xHCI-host-controller.patch @@ -709,71 +709,42 @@ Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com> /* * Returns zero if the TRB isn't in this segment, otherwise it returns the DMA -@@ -3173,9 +3174,14 @@ static int queue_bulk_sg_tx(struct xhci_ +@@ -3026,17 +3027,22 @@ static u32 xhci_td_remainder(struct xhci + { + u32 maxp, total_packet_count; - /* Set the TRB length, TD size, and interrupter fields. */ - if (xhci->hci_version < 0x100) { -- remainder = xhci_td_remainder( -+ if (xhci->quirks & XHCI_MTK_HOST) { -+ remainder = xhci_mtk_td_remainder_quirk( -+ running_total, trb_buff_len, urb); -+ } else { -+ remainder = xhci_td_remainder( - urb->transfer_buffer_length - - running_total); -+ } - } else { - remainder = xhci_v1_0_td_remainder(running_total, - trb_buff_len, total_packet_count, urb, -@@ -3346,9 +3352,14 @@ int xhci_queue_bulk_tx(struct xhci_hcd * +- if (xhci->hci_version < 0x100) ++ /* MTK xHCI is mostly 0.97 but contains some features from 1.0 */ ++ if (xhci->hci_version < 0x100 && !(xhci->quirks & XHCI_MTK_HOST)) + return ((td_total_len - transferred) >> 10); - /* Set the TRB length, TD size, and interrupter fields. */ - if (xhci->hci_version < 0x100) { -- remainder = xhci_td_remainder( -+ if (xhci->quirks & XHCI_MTK_HOST) { -+ remainder = xhci_mtk_td_remainder_quirk( -+ running_total, trb_buff_len, urb); -+ } else { -+ remainder = xhci_td_remainder( - urb->transfer_buffer_length - - running_total); -+ } - } else { - remainder = xhci_v1_0_td_remainder(running_total, - trb_buff_len, total_packet_count, urb, -@@ -3467,8 +3478,14 @@ int xhci_queue_ctrl_tx(struct xhci_hcd * - field = TRB_TYPE(TRB_DATA); +- maxp = GET_MAX_PACKET(usb_endpoint_maxp(&urb->ep->desc)); +- total_packet_count = DIV_ROUND_UP(td_total_len, maxp); +- + /* One TRB with a zero-length data packet. */ + if (num_trbs_left == 0 || (transferred == 0 && trb_buff_len == 0) || + trb_buff_len == td_total_len) + return 0; - length_field = TRB_LEN(urb->transfer_buffer_length) | -- xhci_td_remainder(urb->transfer_buffer_length) | - TRB_INTR_TARGET(0); -+ ++ /* for MTK xHCI, TD size doesn't include this TRB */ + if (xhci->quirks & XHCI_MTK_HOST) -+ length_field |= xhci_mtk_td_remainder_quirk(0, -+ urb->transfer_buffer_length, urb); -+ else -+ length_field |= xhci_td_remainder(urb->transfer_buffer_length); ++ trb_buff_len = 0; + - if (urb->transfer_buffer_length > 0) { - if (setup->bRequestType & USB_DIR_IN) - field |= TRB_DIR_IN; -@@ -3692,8 +3709,14 @@ static int xhci_queue_isoc_tx(struct xhc ++ maxp = GET_MAX_PACKET(usb_endpoint_maxp(&urb->ep->desc)); ++ total_packet_count = DIV_ROUND_UP(td_total_len, maxp); ++ + /* Queueing functions don't count the current TRB into transferred */ + return (total_packet_count - ((transferred + trb_buff_len) / maxp)); + } +@@ -3424,7 +3430,7 @@ int xhci_queue_ctrl_tx(struct xhci_hcd * + field |= 0x1; - /* Set the TRB length, TD size, & interrupter fields. */ - if (xhci->hci_version < 0x100) { -- remainder = xhci_td_remainder( -- td_len - running_total); -+ if (xhci->quirks & XHCI_MTK_HOST) { -+ remainder = xhci_mtk_td_remainder_quirk( -+ running_total, trb_buff_len, -+ urb); -+ } else { -+ remainder = xhci_td_remainder( -+ td_len - running_total); -+ } - } else { - remainder = xhci_v1_0_td_remainder( - running_total, trb_buff_len, + /* xHCI 1.0/1.1 6.4.1.2.1: Transfer Type field */ +- if (xhci->hci_version >= 0x100) { ++ if ((xhci->hci_version >= 0x100) || (xhci->quirks & XHCI_MTK_HOST)) { + if (urb->transfer_buffer_length > 0) { + if (setup->bRequestType & USB_DIR_IN) + field |= TRB_TX_TYPE(TRB_DATA_IN); --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c @@ -31,6 +31,7 @@ @@ -797,7 +768,7 @@ Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com> writel(temp, &xhci->ir_set->irq_control); /* Set the HCD state before we enable the irqs */ -@@ -1708,6 +1713,9 @@ int xhci_drop_endpoint(struct usb_hcd *h +@@ -1710,6 +1715,9 @@ int xhci_drop_endpoint(struct usb_hcd *h xhci_endpoint_zero(xhci, xhci->devs[udev->slot_id], ep); @@ -807,7 +778,7 @@ Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com> xhci_dbg(xhci, "drop ep 0x%x, slot id %d, new drop flags = %#x, new add flags = %#x\n", (unsigned int) ep->desc.bEndpointAddress, udev->slot_id, -@@ -1803,6 +1811,12 @@ int xhci_add_endpoint(struct usb_hcd *hc +@@ -1805,6 +1813,12 @@ int xhci_add_endpoint(struct usb_hcd *hc return -ENOMEM; } @@ -822,11 +793,11 @@ Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com> --- a/drivers/usb/host/xhci.h +++ b/drivers/usb/host/xhci.h -@@ -1568,6 +1568,7 @@ struct xhci_hcd { +@@ -1570,6 +1570,7 @@ struct xhci_hcd { /* For controllers with a broken beyond repair streams implementation */ #define XHCI_BROKEN_STREAMS (1 << 19) #define XHCI_PME_STUCK_QUIRK (1 << 20) +#define XHCI_MTK_HOST (1 << 21) + #define XHCI_SSIC_PORT_UNUSED (1 << 22) unsigned int num_active_eps; unsigned int limit_active_eps; - /* There are two roothubs to keep track of bus suspend info for */ |