acerhdf.c (1ee14820fd8ee79c4fc191155f48c985f28040e2) | acerhdf.c (7f4957be0d5b83c8964491863202136c916107ae) |
---|---|
1// SPDX-License-Identifier: GPL-2.0-or-later 2/* 3 * acerhdf - A driver which monitors the temperature 4 * of the aspire one netbook, turns on/off the fan 5 * as soon as the upper/lower threshold is reached. 6 * 7 * (C) 2009 - Peter Kaestle peter (a) piie.net 8 * http://piie.net --- 383 unchanged lines hidden (view full) --- 392 } 393 return 0; 394} 395 396static inline void acerhdf_revert_to_bios_mode(void) 397{ 398 acerhdf_change_fanstate(ACERHDF_FAN_AUTO); 399 kernelmode = 0; | 1// SPDX-License-Identifier: GPL-2.0-or-later 2/* 3 * acerhdf - A driver which monitors the temperature 4 * of the aspire one netbook, turns on/off the fan 5 * as soon as the upper/lower threshold is reached. 6 * 7 * (C) 2009 - Peter Kaestle peter (a) piie.net 8 * http://piie.net --- 383 unchanged lines hidden (view full) --- 392 } 393 return 0; 394} 395 396static inline void acerhdf_revert_to_bios_mode(void) 397{ 398 acerhdf_change_fanstate(ACERHDF_FAN_AUTO); 399 kernelmode = 0; |
400 if (thz_dev) { 401 thz_dev->mode = THERMAL_DEVICE_DISABLED; | 400 if (thz_dev) |
402 thz_dev->polling_delay = 0; | 401 thz_dev->polling_delay = 0; |
403 } | 402 |
404 pr_notice("kernel mode fan control OFF\n"); 405} 406static inline void acerhdf_enable_kernelmode(void) 407{ 408 kernelmode = 1; | 403 pr_notice("kernel mode fan control OFF\n"); 404} 405static inline void acerhdf_enable_kernelmode(void) 406{ 407 kernelmode = 1; |
409 thz_dev->mode = THERMAL_DEVICE_ENABLED; | |
410 411 thz_dev->polling_delay = interval*1000; | 408 409 thz_dev->polling_delay = interval*1000; |
412 thermal_zone_device_update(thz_dev, THERMAL_EVENT_UNSPECIFIED); | |
413 pr_notice("kernel mode fan control ON\n"); 414} 415 416/* 417 * set operation mode; 418 * enabled: the thermal layer of the kernel takes care about 419 * the temperature and the fan. 420 * disabled: the BIOS takes control of the fan. --- 297 unchanged lines hidden (view full) --- 718static void acerhdf_unregister_platform(void) 719{ 720 platform_device_unregister(acerhdf_dev); 721 platform_driver_unregister(&acerhdf_driver); 722} 723 724static int __init acerhdf_register_thermal(void) 725{ | 410 pr_notice("kernel mode fan control ON\n"); 411} 412 413/* 414 * set operation mode; 415 * enabled: the thermal layer of the kernel takes care about 416 * the temperature and the fan. 417 * disabled: the BIOS takes control of the fan. --- 297 unchanged lines hidden (view full) --- 715static void acerhdf_unregister_platform(void) 716{ 717 platform_device_unregister(acerhdf_dev); 718 platform_driver_unregister(&acerhdf_driver); 719} 720 721static int __init acerhdf_register_thermal(void) 722{ |
723 int ret; 724 |
|
726 cl_dev = thermal_cooling_device_register("acerhdf-fan", NULL, 727 &acerhdf_cooling_ops); 728 729 if (IS_ERR(cl_dev)) 730 return -EINVAL; 731 732 thz_dev = thermal_zone_device_register("acerhdf", 2, 0, NULL, 733 &acerhdf_dev_ops, 734 &acerhdf_zone_params, 0, 735 (kernelmode) ? interval*1000 : 0); 736 if (IS_ERR(thz_dev)) 737 return -EINVAL; 738 | 725 cl_dev = thermal_cooling_device_register("acerhdf-fan", NULL, 726 &acerhdf_cooling_ops); 727 728 if (IS_ERR(cl_dev)) 729 return -EINVAL; 730 731 thz_dev = thermal_zone_device_register("acerhdf", 2, 0, NULL, 732 &acerhdf_dev_ops, 733 &acerhdf_zone_params, 0, 734 (kernelmode) ? interval*1000 : 0); 735 if (IS_ERR(thz_dev)) 736 return -EINVAL; 737 |
739 thz_dev->mode = kernelmode ? 740 THERMAL_DEVICE_ENABLED : THERMAL_DEVICE_DISABLED; | 738 if (kernelmode) 739 ret = thermal_zone_device_enable(thz_dev); 740 else 741 ret = thermal_zone_device_disable(thz_dev); 742 if (ret) 743 return ret; |
741 742 if (strcmp(thz_dev->governor->name, 743 acerhdf_zone_params.governor_name)) { 744 pr_err("Didn't get thermal governor %s, perhaps not compiled into thermal subsystem.\n", 745 acerhdf_zone_params.governor_name); 746 return -EINVAL; 747 } 748 --- 78 unchanged lines hidden --- | 744 745 if (strcmp(thz_dev->governor->name, 746 acerhdf_zone_params.governor_name)) { 747 pr_err("Didn't get thermal governor %s, perhaps not compiled into thermal subsystem.\n", 748 acerhdf_zone_params.governor_name); 749 return -EINVAL; 750 } 751 --- 78 unchanged lines hidden --- |