Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'thermal-6.14-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm

Pull thermal control fixes from Rafael Wysocki:
"These fix the processing of DT thermal properties and the Power
Allocator thermal governor:

- Fix parsing cooling-maps in DT for trip points with more than one
cooling device (Rafael Wysocki)

- Fix granted_power computation in the Power Allocator thermal
governor and make it update total_weight on configuration changes
after the thermal zone has been registered (Yu-Che Cheng)"

* tag 'thermal-6.14-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
thermal: gov_power_allocator: Update total_weight on bind and cdev updates
thermal/of: Fix cdev lookup in thermal_of_should_bind()
thermal: gov_power_allocator: Fix incorrect calculation in divvy_up_power()

+52 -30
+23 -9
drivers/thermal/gov_power_allocator.c
··· 370 370 371 371 for (i = 0; i < num_actors; i++) { 372 372 struct power_actor *pa = &power[i]; 373 - u64 req_range = (u64)pa->req_power * power_range; 373 + u64 req_range = (u64)pa->weighted_req_power * power_range; 374 374 375 375 pa->granted_power = DIV_ROUND_CLOSEST_ULL(req_range, 376 376 total_req_power); ··· 641 641 return ret; 642 642 } 643 643 644 + static void power_allocator_update_weight(struct power_allocator_params *params) 645 + { 646 + const struct thermal_trip_desc *td; 647 + struct thermal_instance *instance; 648 + 649 + if (!params->trip_max) 650 + return; 651 + 652 + td = trip_to_trip_desc(params->trip_max); 653 + 654 + params->total_weight = 0; 655 + list_for_each_entry(instance, &td->thermal_instances, trip_node) 656 + if (power_actor_is_valid(instance)) 657 + params->total_weight += instance->weight; 658 + } 659 + 644 660 static void power_allocator_update_tz(struct thermal_zone_device *tz, 645 661 enum thermal_notify_event reason) 646 662 { ··· 672 656 if (power_actor_is_valid(instance)) 673 657 num_actors++; 674 658 675 - if (num_actors == params->num_actors) 676 - return; 659 + if (num_actors != params->num_actors) 660 + allocate_actors_buffer(params, num_actors); 677 661 678 - allocate_actors_buffer(params, num_actors); 679 - break; 662 + fallthrough; 680 663 case THERMAL_INSTANCE_WEIGHT_CHANGED: 681 - params->total_weight = 0; 682 - list_for_each_entry(instance, &td->thermal_instances, trip_node) 683 - if (power_actor_is_valid(instance)) 684 - params->total_weight += instance->weight; 664 + power_allocator_update_weight(params); 685 665 break; 686 666 default: 687 667 break; ··· 742 730 reset_pid_controller(params); 743 731 744 732 tz->governor_data = params; 733 + 734 + power_allocator_update_weight(params); 745 735 746 736 return 0; 747 737
+29 -21
drivers/thermal/thermal_of.c
··· 274 274 return true; 275 275 } 276 276 277 + static bool thermal_of_cm_lookup(struct device_node *cm_np, 278 + const struct thermal_trip *trip, 279 + struct thermal_cooling_device *cdev, 280 + struct cooling_spec *c) 281 + { 282 + for_each_child_of_node_scoped(cm_np, child) { 283 + struct device_node *tr_np; 284 + int count, i; 285 + 286 + tr_np = of_parse_phandle(child, "trip", 0); 287 + if (tr_np != trip->priv) 288 + continue; 289 + 290 + /* The trip has been found, look up the cdev. */ 291 + count = of_count_phandle_with_args(child, "cooling-device", 292 + "#cooling-cells"); 293 + if (count <= 0) 294 + pr_err("Add a cooling_device property with at least one device\n"); 295 + 296 + for (i = 0; i < count; i++) { 297 + if (thermal_of_get_cooling_spec(child, i, cdev, c)) 298 + return true; 299 + } 300 + } 301 + 302 + return false; 303 + } 304 + 277 305 static bool thermal_of_should_bind(struct thermal_zone_device *tz, 278 306 const struct thermal_trip *trip, 279 307 struct thermal_cooling_device *cdev, ··· 321 293 goto out; 322 294 323 295 /* Look up the trip and the cdev in the cooling maps. */ 324 - for_each_child_of_node_scoped(cm_np, child) { 325 - struct device_node *tr_np; 326 - int count, i; 327 - 328 - tr_np = of_parse_phandle(child, "trip", 0); 329 - if (tr_np != trip->priv) 330 - continue; 331 - 332 - /* The trip has been found, look up the cdev. */ 333 - count = of_count_phandle_with_args(child, "cooling-device", "#cooling-cells"); 334 - if (count <= 0) 335 - pr_err("Add a cooling_device property with at least one device\n"); 336 - 337 - for (i = 0; i < count; i++) { 338 - result = thermal_of_get_cooling_spec(child, i, cdev, c); 339 - if (result) 340 - break; 341 - } 342 - 343 - break; 344 - } 296 + result = thermal_of_cm_lookup(cm_np, trip, cdev, c); 345 297 346 298 of_node_put(cm_np); 347 299 out: