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-v5.10-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/thermal/linux

Pull thermal updates from Daniel Lezcano:

- Fix Kconfig typo "acces" -> "access" (Colin Ian King)

- Use dev_error_probe() to simplify the error handling on imx and imx8
platforms (Anson Huang)

- Use dedicated kobj_to_dev() instead of container_of() in the sysfs
core code (Tian Tao)

- Fix coding style by adding braces to a one line conditional statement
on rcar (Geert Uytterhoeven)

- Add DT binding documentation for the r8a774e1 platform and update the
Kconfig description supporting RZ/G2 SoCs (Lad Prabhakar)

- Simplify the return expression of stm_thermal_prepare on the stm32
platform (Qinglang Miao)

- Fix the unit in the function documentation for the idle injection
cooling device (Zhuguang Qing)

- Remove an unecessary mutex_init() in the core code (Qinglang Miao)

- Add support for keep alive events in the core code and the specific
int340x (Srinivas Pandruvada)

- Remove unused thermal zone variable in devfreq and cpufreq cooling
devices (Zhuguang Qing)

- Add the A100's THS controller support (Yangtao Li)

- Add power management on the omap3's bandgap sensor (Adam Ford)

- Fix a missing nlmsg_free in the netlink core error path (Jing
Xiangfeng)

* tag 'thermal-v5.10-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/thermal/linux:
thermal: core: Adding missing nlmsg_free() in thermal_genl_sampling_temp()
thermal: ti-soc-thermal: Enable addition power management
thermal: sun8i: Add A100's THS controller support
thermal: sun8i: add TEMP_CALIB_MASK for calibration data in sun50i_h6_ths_calibrate
dt-bindings: thermal: sun8i: Add binding for A100's THS controller
thermal: cooling: Remove unused variable *tz
thermal: int340x: Add keep alive response method
thermal: core: Add new event for sending keep alive notifications
thermal: int340x: Provide notification for OEM variable change
thermal: core: remove unnecessary mutex_init()
thermal/idle_inject: Fix comment of idle_duration_us and name of latency_ns
thermal: Kconfig: Update description for RCAR_GEN3_THERMAL config
thermal: stm32: simplify the return expression of stm_thermal_prepare()
dt-bindings: thermal: rcar-gen3-thermal: Add r8a774e1 support
thermal: rcar_thermal: Add missing braces to conditional statement
thermal: Use kobj_to_dev() instead of container_of()
thermal: imx8mm: Use dev_err_probe() to simplify error handling
thermal: imx: Use dev_err_probe() to simplify error handling
drivers: thermal: Kconfig: fix spelling mistake "acces" -> "access"

+156 -82
+5 -1
Documentation/devicetree/bindings/thermal/allwinner,sun8i-a83t-ths.yaml
··· 17 17 - allwinner,sun8i-h3-ths 18 18 - allwinner,sun8i-r40-ths 19 19 - allwinner,sun50i-a64-ths 20 + - allwinner,sun50i-a100-ths 20 21 - allwinner,sun50i-h5-ths 21 22 - allwinner,sun50i-h6-ths 22 23 ··· 62 61 properties: 63 62 compatible: 64 63 contains: 65 - const: allwinner,sun50i-h6-ths 64 + enum: 65 + - allwinner,sun50i-a100-ths 66 + - allwinner,sun50i-h6-ths 66 67 67 68 then: 68 69 properties: ··· 106 103 - const: allwinner,sun8i-h3-ths 107 104 - const: allwinner,sun8i-r40-ths 108 105 - const: allwinner,sun50i-a64-ths 106 + - const: allwinner,sun50i-a100-ths 109 107 - const: allwinner,sun50i-h5-ths 110 108 - const: allwinner,sun50i-h6-ths 111 109
+1
Documentation/devicetree/bindings/thermal/rcar-gen3-thermal.yaml
··· 20 20 enum: 21 21 - renesas,r8a774a1-thermal # RZ/G2M 22 22 - renesas,r8a774b1-thermal # RZ/G2N 23 + - renesas,r8a774e1-thermal # RZ/G2H 23 24 - renesas,r8a7795-thermal # R-Car H3 24 25 - renesas,r8a7796-thermal # R-Car M3-W 25 26 - renesas,r8a77961-thermal # R-Car M3-W+
+3 -3
drivers/thermal/Kconfig
··· 346 346 thermal framework. 347 347 348 348 config RCAR_GEN3_THERMAL 349 - tristate "Renesas R-Car Gen3 thermal driver" 349 + tristate "Renesas R-Car Gen3 and RZ/G2 thermal driver" 350 350 depends on ARCH_RENESAS || COMPILE_TEST 351 351 depends on HAS_IOMEM 352 352 depends on OF 353 353 help 354 - Enable this to plug the R-Car Gen3 thermal sensor driver into the Linux 355 - thermal framework. 354 + Enable this to plug the R-Car Gen3 or RZ/G2 thermal sensor driver into 355 + the Linux thermal framework. 356 356 357 357 config KIRKWOOD_THERMAL 358 358 tristate "Temperature sensor on Marvell Kirkwood SoCs"
+1 -7
drivers/thermal/cpufreq_cooling.c
··· 182 182 /** 183 183 * cpufreq_get_requested_power() - get the current power 184 184 * @cdev: &thermal_cooling_device pointer 185 - * @tz: a valid thermal zone device pointer 186 185 * @power: pointer in which to store the resulting power 187 186 * 188 187 * Calculate the current power consumption of the cpus in milliwatts ··· 202 203 * Return: 0 on success, -E* if getting the static power failed. 203 204 */ 204 205 static int cpufreq_get_requested_power(struct thermal_cooling_device *cdev, 205 - struct thermal_zone_device *tz, 206 206 u32 *power) 207 207 { 208 208 unsigned long freq; ··· 251 253 /** 252 254 * cpufreq_state2power() - convert a cpu cdev state to power consumed 253 255 * @cdev: &thermal_cooling_device pointer 254 - * @tz: a valid thermal zone device pointer 255 256 * @state: cooling device state to be converted 256 257 * @power: pointer in which to store the resulting power 257 258 * ··· 263 266 * when calculating the static power. 264 267 */ 265 268 static int cpufreq_state2power(struct thermal_cooling_device *cdev, 266 - struct thermal_zone_device *tz, 267 269 unsigned long state, u32 *power) 268 270 { 269 271 unsigned int freq, num_cpus, idx; ··· 284 288 /** 285 289 * cpufreq_power2state() - convert power to a cooling device state 286 290 * @cdev: &thermal_cooling_device pointer 287 - * @tz: a valid thermal zone device pointer 288 291 * @power: power in milliwatts to be converted 289 292 * @state: pointer in which to store the resulting state 290 293 * ··· 301 306 * device. 302 307 */ 303 308 static int cpufreq_power2state(struct thermal_cooling_device *cdev, 304 - struct thermal_zone_device *tz, u32 power, 305 - unsigned long *state) 309 + u32 power, unsigned long *state) 306 310 { 307 311 unsigned int target_freq; 308 312 u32 last_load, normalised_power;
+1 -1
drivers/thermal/cpuidle_cooling.c
··· 30 30 31 31 /** 32 32 * cpuidle_cooling_runtime - Running time computation 33 - * @idle_duration_us: the idle cooling device 33 + * @idle_duration_us: CPU idle time to inject in microseconds 34 34 * @state: a percentile based number 35 35 * 36 36 * The running duration is computed from the idle injection duration
-3
drivers/thermal/devfreq_cooling.c
··· 229 229 230 230 231 231 static int devfreq_cooling_get_requested_power(struct thermal_cooling_device *cdev, 232 - struct thermal_zone_device *tz, 233 232 u32 *power) 234 233 { 235 234 struct devfreq_cooling_device *dfc = cdev->devdata; ··· 288 289 } 289 290 290 291 static int devfreq_cooling_state2power(struct thermal_cooling_device *cdev, 291 - struct thermal_zone_device *tz, 292 292 unsigned long state, 293 293 u32 *power) 294 294 { ··· 306 308 } 307 309 308 310 static int devfreq_cooling_power2state(struct thermal_cooling_device *cdev, 309 - struct thermal_zone_device *tz, 310 311 u32 power, unsigned long *state) 311 312 { 312 313 struct devfreq_cooling_device *dfc = cdev->devdata;
+3 -3
drivers/thermal/gov_power_allocator.c
··· 96 96 if (instance->trip != params->trip_max_desired_temperature) 97 97 continue; 98 98 99 - if (power_actor_get_min_power(cdev, tz, &min_power)) 99 + if (power_actor_get_min_power(cdev, &min_power)) 100 100 continue; 101 101 102 102 sustainable_power += min_power; ··· 388 388 if (!cdev_is_power_actor(cdev)) 389 389 continue; 390 390 391 - if (cdev->ops->get_requested_power(cdev, tz, &req_power[i])) 391 + if (cdev->ops->get_requested_power(cdev, &req_power[i])) 392 392 continue; 393 393 394 394 if (!total_weight) ··· 398 398 399 399 weighted_req_power[i] = frac_to_int(weight * req_power[i]); 400 400 401 - if (power_actor_get_max_power(cdev, tz, &max_power[i])) 401 + if (power_actor_get_max_power(cdev, &max_power[i])) 402 402 continue; 403 403 404 404 total_req_power += req_power[i];
+3 -7
drivers/thermal/imx8mm_thermal.c
··· 146 146 return PTR_ERR(tmu->base); 147 147 148 148 tmu->clk = devm_clk_get(&pdev->dev, NULL); 149 - if (IS_ERR(tmu->clk)) { 150 - ret = PTR_ERR(tmu->clk); 151 - if (ret != -EPROBE_DEFER) 152 - dev_err(&pdev->dev, 153 - "failed to get tmu clock: %d\n", ret); 154 - return ret; 155 - } 149 + if (IS_ERR(tmu->clk)) 150 + return dev_err_probe(&pdev->dev, PTR_ERR(tmu->clk), 151 + "failed to get tmu clock\n"); 156 152 157 153 ret = clk_prepare_enable(tmu->clk); 158 154 if (ret) {
+6 -16
drivers/thermal/imx_thermal.c
··· 716 716 717 717 if (of_find_property(pdev->dev.of_node, "nvmem-cells", NULL)) { 718 718 ret = imx_init_from_nvmem_cells(pdev); 719 - if (ret) { 720 - if (ret == -EPROBE_DEFER) 721 - return ret; 722 - 723 - dev_err(&pdev->dev, "failed to init from nvmem: %d\n", 724 - ret); 725 - return ret; 726 - } 719 + if (ret) 720 + return dev_err_probe(&pdev->dev, ret, 721 + "failed to init from nvmem\n"); 727 722 } else { 728 723 ret = imx_init_from_tempmon_data(pdev); 729 724 if (ret) { ··· 741 746 data->socdata->power_down_mask); 742 747 743 748 ret = imx_thermal_register_legacy_cooling(data); 744 - if (ret) { 745 - if (ret == -EPROBE_DEFER) 746 - return ret; 747 - 748 - dev_err(&pdev->dev, 749 - "failed to register cpufreq cooling device: %d\n", ret); 750 - return ret; 751 - } 749 + if (ret) 750 + return dev_err_probe(&pdev->dev, ret, 751 + "failed to register cpufreq cooling device\n"); 752 752 753 753 data->thermal_clk = devm_clk_get(&pdev->dev, NULL); 754 754 if (IS_ERR(data->thermal_clk)) {
+40 -11
drivers/thermal/intel/int340x_thermal/int3400_thermal.c
··· 14 14 15 15 #define INT3400_THERMAL_TABLE_CHANGED 0x83 16 16 #define INT3400_ODVP_CHANGED 0x88 17 + #define INT3400_KEEP_ALIVE 0xA0 17 18 18 19 enum int3400_thermal_uuid { 19 20 INT3400_THERMAL_PASSIVE_1, ··· 84 83 NULL, 85 84 }; 86 85 86 + static ssize_t imok_store(struct device *dev, struct device_attribute *attr, 87 + const char *buf, size_t count) 88 + { 89 + struct int3400_thermal_priv *priv = dev_get_drvdata(dev); 90 + acpi_status status; 91 + int input, ret; 92 + 93 + ret = kstrtouint(buf, 10, &input); 94 + if (ret) 95 + return ret; 96 + status = acpi_execute_simple_method(priv->adev->handle, "IMOK", input); 97 + if (ACPI_FAILURE(status)) 98 + return -EIO; 99 + 100 + return count; 101 + } 102 + 103 + static DEVICE_ATTR_WO(imok); 104 + 105 + static struct attribute *imok_attr[] = { 106 + &dev_attr_imok.attr, 107 + NULL 108 + }; 109 + 87 110 static const struct attribute_group data_attribute_group = { 88 111 .bin_attrs = data_attributes, 112 + .attrs = imok_attr, 89 113 }; 90 114 91 115 static ssize_t available_uuids_show(struct device *dev, ··· 375 349 { 376 350 struct int3400_thermal_priv *priv = data; 377 351 char *thermal_prop[5]; 352 + int therm_event; 378 353 379 354 if (!priv) 380 355 return; 381 356 382 357 switch (event) { 383 358 case INT3400_THERMAL_TABLE_CHANGED: 384 - thermal_prop[0] = kasprintf(GFP_KERNEL, "NAME=%s", 385 - priv->thermal->type); 386 - thermal_prop[1] = kasprintf(GFP_KERNEL, "TEMP=%d", 387 - priv->thermal->temperature); 388 - thermal_prop[2] = kasprintf(GFP_KERNEL, "TRIP="); 389 - thermal_prop[3] = kasprintf(GFP_KERNEL, "EVENT=%d", 390 - THERMAL_TABLE_CHANGED); 391 - thermal_prop[4] = NULL; 392 - kobject_uevent_env(&priv->thermal->device.kobj, KOBJ_CHANGE, 393 - thermal_prop); 359 + therm_event = THERMAL_TABLE_CHANGED; 360 + break; 361 + case INT3400_KEEP_ALIVE: 362 + therm_event = THERMAL_EVENT_KEEP_ALIVE; 394 363 break; 395 364 case INT3400_ODVP_CHANGED: 396 365 evaluate_odvp(priv); 366 + therm_event = THERMAL_DEVICE_POWER_CAPABILITY_CHANGED; 397 367 break; 398 368 default: 399 369 /* Ignore unknown notification codes sent to INT3400 device */ 400 - break; 370 + return; 401 371 } 372 + 373 + thermal_prop[0] = kasprintf(GFP_KERNEL, "NAME=%s", priv->thermal->type); 374 + thermal_prop[1] = kasprintf(GFP_KERNEL, "TEMP=%d", priv->thermal->temperature); 375 + thermal_prop[2] = kasprintf(GFP_KERNEL, "TRIP="); 376 + thermal_prop[3] = kasprintf(GFP_KERNEL, "EVENT=%d", therm_event); 377 + thermal_prop[4] = NULL; 378 + kobject_uevent_env(&priv->thermal->device.kobj, KOBJ_CHANGE, thermal_prop); 402 379 } 403 380 404 381 static int int3400_thermal_get_temp(struct thermal_zone_device *thermal,
+2 -2
drivers/thermal/rcar_thermal.c
··· 546 546 if (ret < 0) 547 547 goto error_unregister; 548 548 549 - if (chip->use_of_thermal) 549 + if (chip->use_of_thermal) { 550 550 priv->zone = devm_thermal_zone_of_sensor_register( 551 551 dev, i, priv, 552 552 &rcar_thermal_zone_of_ops); 553 - else { 553 + } else { 554 554 priv->zone = thermal_zone_device_register( 555 555 "rcar_thermal", 556 556 1, 0, priv,
+1 -1
drivers/thermal/st/Kconfig
··· 23 23 help 24 24 Support for thermal framework on STMicroelectronics STM32 series of 25 25 SoCs. This thermal driver allows to access to general thermal framework 26 - functionalities and to acces to SoC sensor functionalities. This 26 + functionalities and to access to SoC sensor functionalities. This 27 27 configuration is fully dependent of MACH_STM32MP157.
+1 -6
drivers/thermal/st/stm_thermal.c
··· 446 446 #ifdef CONFIG_PM_SLEEP 447 447 static int stm_thermal_suspend(struct device *dev) 448 448 { 449 - int ret; 450 449 struct stm_thermal_sensor *sensor = dev_get_drvdata(dev); 451 450 452 - ret = stm_thermal_sensor_off(sensor); 453 - if (ret) 454 - return ret; 455 - 456 - return 0; 451 + return stm_thermal_sensor_off(sensor); 457 452 } 458 453 459 454 static int stm_thermal_resume(struct device *dev)
+15 -1
drivers/thermal/sun8i_thermal.c
··· 244 244 ft_temp = (caldata[0] & FT_TEMP_MASK) * 100; 245 245 246 246 for (i = 0; i < tmdev->chip->sensor_num; i++) { 247 - int sensor_reg = caldata[i + 1]; 247 + int sensor_reg = caldata[i + 1] & TEMP_CALIB_MASK; 248 248 int cdata, offset; 249 249 int sensor_temp = tmdev->chip->calc_temp(tmdev, i, sensor_reg); 250 250 ··· 590 590 .calc_temp = sun8i_ths_calc_temp, 591 591 }; 592 592 593 + static const struct ths_thermal_chip sun50i_a100_ths = { 594 + .sensor_num = 3, 595 + .has_bus_clk_reset = true, 596 + .ft_deviation = 8000, 597 + .offset = 187744, 598 + .scale = 672, 599 + .temp_data_base = SUN50I_H6_THS_TEMP_DATA, 600 + .calibrate = sun50i_h6_ths_calibrate, 601 + .init = sun50i_h6_thermal_init, 602 + .irq_ack = sun50i_h6_irq_ack, 603 + .calc_temp = sun8i_ths_calc_temp, 604 + }; 605 + 593 606 static const struct ths_thermal_chip sun50i_h5_ths = { 594 607 .sensor_num = 2, 595 608 .has_mod_clk = true, ··· 632 619 { .compatible = "allwinner,sun8i-h3-ths", .data = &sun8i_h3_ths }, 633 620 { .compatible = "allwinner,sun8i-r40-ths", .data = &sun8i_r40_ths }, 634 621 { .compatible = "allwinner,sun50i-a64-ths", .data = &sun50i_a64_ths }, 622 + { .compatible = "allwinner,sun50i-a100-ths", .data = &sun50i_a100_ths }, 635 623 { .compatible = "allwinner,sun50i-h5-ths", .data = &sun50i_h5_ths }, 636 624 { .compatible = "allwinner,sun50i-h6-ths", .data = &sun50i_h6_ths }, 637 625 { /* sentinel */ },
+5 -8
drivers/thermal/thermal_core.c
··· 603 603 /** 604 604 * power_actor_get_max_power() - get the maximum power that a cdev can consume 605 605 * @cdev: pointer to &thermal_cooling_device 606 - * @tz: a valid thermal zone device pointer 607 606 * @max_power: pointer in which to store the maximum power 608 607 * 609 608 * Calculate the maximum power consumption in milliwats that the ··· 612 613 * power_actor API or -E* on other error. 613 614 */ 614 615 int power_actor_get_max_power(struct thermal_cooling_device *cdev, 615 - struct thermal_zone_device *tz, u32 *max_power) 616 + u32 *max_power) 616 617 { 617 618 if (!cdev_is_power_actor(cdev)) 618 619 return -EINVAL; 619 620 620 - return cdev->ops->state2power(cdev, tz, 0, max_power); 621 + return cdev->ops->state2power(cdev, 0, max_power); 621 622 } 622 623 623 624 /** 624 625 * power_actor_get_min_power() - get the mainimum power that a cdev can consume 625 626 * @cdev: pointer to &thermal_cooling_device 626 - * @tz: a valid thermal zone device pointer 627 627 * @min_power: pointer in which to store the minimum power 628 628 * 629 629 * Calculate the minimum power consumption in milliwatts that the ··· 632 634 * power_actor API or -E* on other error. 633 635 */ 634 636 int power_actor_get_min_power(struct thermal_cooling_device *cdev, 635 - struct thermal_zone_device *tz, u32 *min_power) 637 + u32 *min_power) 636 638 { 637 639 unsigned long max_state; 638 640 int ret; ··· 644 646 if (ret) 645 647 return ret; 646 648 647 - return cdev->ops->state2power(cdev, tz, max_state, min_power); 649 + return cdev->ops->state2power(cdev, max_state, min_power); 648 650 } 649 651 650 652 /** ··· 668 670 if (!cdev_is_power_actor(cdev)) 669 671 return -EINVAL; 670 672 671 - ret = cdev->ops->power2state(cdev, instance->tz, power, &state); 673 + ret = cdev->ops->power2state(cdev, power, &state); 672 674 if (ret) 673 675 return ret; 674 676 ··· 1650 1652 if (result) 1651 1653 goto error; 1652 1654 1653 - mutex_init(&poweroff_lock); 1654 1655 result = thermal_register_governors(); 1655 1656 if (result) 1656 1657 goto error;
+2 -2
drivers/thermal/thermal_core.h
··· 66 66 } 67 67 68 68 int power_actor_get_max_power(struct thermal_cooling_device *cdev, 69 - struct thermal_zone_device *tz, u32 *max_power); 69 + u32 *max_power); 70 70 int power_actor_get_min_power(struct thermal_cooling_device *cdev, 71 - struct thermal_zone_device *tz, u32 *min_power); 71 + u32 *min_power); 72 72 int power_actor_set_power(struct thermal_cooling_device *cdev, 73 73 struct thermal_instance *ti, u32 power); 74 74 /**
+2 -1
drivers/thermal/thermal_netlink.c
··· 78 78 hdr = genlmsg_put(skb, 0, 0, &thermal_gnl_family, 0, 79 79 THERMAL_GENL_SAMPLING_TEMP); 80 80 if (!hdr) 81 - return -EMSGSIZE; 81 + goto out_free; 82 82 83 83 if (nla_put_u32(skb, THERMAL_GENL_ATTR_TZ_ID, id)) 84 84 goto out_cancel; ··· 93 93 return 0; 94 94 out_cancel: 95 95 genlmsg_cancel(skb, hdr); 96 + out_free: 96 97 nlmsg_free(skb); 97 98 98 99 return -EMSGSIZE;
+1 -1
drivers/thermal/thermal_sysfs.c
··· 448 448 struct attribute *attr, 449 449 int attrno) 450 450 { 451 - struct device *dev = container_of(kobj, struct device, kobj); 451 + struct device *dev = kobj_to_dev(kobj); 452 452 struct thermal_zone_device *tz; 453 453 enum thermal_trip_type trip_type; 454 454 int count, passive = 0;
+53 -1
drivers/thermal/ti-soc-thermal/ti-bandgap.c
··· 25 25 #include <linux/of_platform.h> 26 26 #include <linux/of_irq.h> 27 27 #include <linux/io.h> 28 + #include <linux/cpu_pm.h> 29 + #include <linux/device.h> 30 + #include <linux/pm_runtime.h> 31 + #include <linux/pm.h> 32 + #include <linux/of.h> 33 + #include <linux/of_device.h> 28 34 29 35 #include "ti-bandgap.h" 30 36 31 37 static int ti_bandgap_force_single_read(struct ti_bandgap *bgp, int id); 38 + #ifdef CONFIG_PM_SLEEP 39 + static int bandgap_omap_cpu_notifier(struct notifier_block *nb, 40 + unsigned long cmd, void *v); 41 + #endif 32 42 33 43 /*** Helper functions to access registers and their bitfields ***/ 34 44 ··· 1018 1008 } 1019 1009 } 1020 1010 1011 + #ifdef CONFIG_PM_SLEEP 1012 + bgp->nb.notifier_call = bandgap_omap_cpu_notifier; 1013 + cpu_pm_register_notifier(&bgp->nb); 1014 + #endif 1015 + 1021 1016 return 0; 1022 1017 1023 1018 remove_last_cooling: ··· 1056 1041 struct ti_bandgap *bgp = platform_get_drvdata(pdev); 1057 1042 int i; 1058 1043 1059 - /* First thing is to remove sensor interfaces */ 1044 + cpu_pm_unregister_notifier(&bgp->nb); 1045 + 1046 + /* Remove sensor interfaces */ 1060 1047 for (i = 0; i < bgp->conf->sensor_count; i++) { 1061 1048 if (bgp->conf->sensors[i].unregister_cooling) 1062 1049 bgp->conf->sensors[i].unregister_cooling(bgp, i); ··· 1167 1150 if (TI_BANDGAP_HAS(bgp, CLK_CTRL)) 1168 1151 clk_disable_unprepare(bgp->fclock); 1169 1152 1153 + bgp->is_suspended = true; 1154 + 1170 1155 return err; 1156 + } 1157 + 1158 + static int bandgap_omap_cpu_notifier(struct notifier_block *nb, 1159 + unsigned long cmd, void *v) 1160 + { 1161 + struct ti_bandgap *bgp; 1162 + 1163 + bgp = container_of(nb, struct ti_bandgap, nb); 1164 + 1165 + spin_lock(&bgp->lock); 1166 + switch (cmd) { 1167 + case CPU_CLUSTER_PM_ENTER: 1168 + if (bgp->is_suspended) 1169 + break; 1170 + ti_bandgap_save_ctxt(bgp); 1171 + ti_bandgap_power(bgp, false); 1172 + if (TI_BANDGAP_HAS(bgp, CLK_CTRL)) 1173 + clk_disable(bgp->fclock); 1174 + break; 1175 + case CPU_CLUSTER_PM_ENTER_FAILED: 1176 + case CPU_CLUSTER_PM_EXIT: 1177 + if (bgp->is_suspended) 1178 + break; 1179 + if (TI_BANDGAP_HAS(bgp, CLK_CTRL)) 1180 + clk_enable(bgp->fclock); 1181 + ti_bandgap_power(bgp, true); 1182 + ti_bandgap_restore_ctxt(bgp); 1183 + break; 1184 + } 1185 + spin_unlock(&bgp->lock); 1186 + 1187 + return NOTIFY_OK; 1171 1188 } 1172 1189 1173 1190 static int ti_bandgap_resume(struct device *dev) ··· 1212 1161 clk_prepare_enable(bgp->fclock); 1213 1162 1214 1163 ti_bandgap_power(bgp, true); 1164 + bgp->is_suspended = false; 1215 1165 1216 1166 return ti_bandgap_restore_ctxt(bgp); 1217 1167 }
+6
drivers/thermal/ti-soc-thermal/ti-bandgap.h
··· 12 12 #include <linux/spinlock.h> 13 13 #include <linux/types.h> 14 14 #include <linux/err.h> 15 + #include <linux/cpu_pm.h> 16 + #include <linux/device.h> 17 + #include <linux/pm_runtime.h> 18 + #include <linux/pm.h> 15 19 16 20 struct gpio_desc; 17 21 ··· 207 203 int irq; 208 204 struct gpio_desc *tshut_gpiod; 209 205 u32 clk_rate; 206 + struct notifier_block nb; 207 + unsigned int is_suspended:1; 210 208 }; 211 209 212 210 /**
+1 -1
include/linux/idle_inject.h
··· 28 28 unsigned int *idle_duration_us); 29 29 30 30 void idle_inject_set_latency(struct idle_inject_device *ii_dev, 31 - unsigned int latency_ns); 31 + unsigned int latency_us); 32 32 33 33 #endif /* __IDLE_INJECT_H__ */
+4 -6
include/linux/thermal.h
··· 55 55 THERMAL_DEVICE_UP, /* Thermal device is up after a down event */ 56 56 THERMAL_DEVICE_POWER_CAPABILITY_CHANGED, /* power capability changed */ 57 57 THERMAL_TABLE_CHANGED, /* Thermal table(s) changed */ 58 + THERMAL_EVENT_KEEP_ALIVE, /* Request for user space handler to respond */ 58 59 }; 59 60 60 61 struct thermal_zone_device_ops { ··· 85 84 int (*get_max_state) (struct thermal_cooling_device *, unsigned long *); 86 85 int (*get_cur_state) (struct thermal_cooling_device *, unsigned long *); 87 86 int (*set_cur_state) (struct thermal_cooling_device *, unsigned long); 88 - int (*get_requested_power)(struct thermal_cooling_device *, 89 - struct thermal_zone_device *, u32 *); 90 - int (*state2power)(struct thermal_cooling_device *, 91 - struct thermal_zone_device *, unsigned long, u32 *); 92 - int (*power2state)(struct thermal_cooling_device *, 93 - struct thermal_zone_device *, u32, unsigned long *); 87 + int (*get_requested_power)(struct thermal_cooling_device *, u32 *); 88 + int (*state2power)(struct thermal_cooling_device *, unsigned long, u32 *); 89 + int (*power2state)(struct thermal_cooling_device *, u32, unsigned long *); 94 90 }; 95 91 96 92 struct thermal_cooling_device {