diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2008-10-23 13:20:36 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-10-23 13:20:36 -0400 |
| commit | 765426e8ee4c0ab2bc9d44951f4865b8494cdbd0 (patch) | |
| tree | 2b46ab8953eff175c8d3474a9754c1ab1394e4de /drivers/misc/thinkpad_acpi.c | |
| parent | 36ec891895020f3bc9953c8b11d079c6d77d76bd (diff) | |
| parent | 898b054f3eec5921320ae8614b5bdd7b07ea5b43 (diff) | |
Merge branch 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6
* 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6: (123 commits)
dock: make dock driver not a module
ACPI: fix ia64 build warning
ACPI: hack around sysfs warning with link order
ACPI suspend: fix build warning when CONFIG_ACPI_SLEEP=n
intel_menlo: fix build warning
panasonic-laptop: fix build
ACPICA: Update version to 20080926
ACPICA: Add support for zero-length buffer-to-string conversions
ACPICA: New: Validation for predefined ACPI methods/objects
ACPICA: Fix for implicit return compatibility
ACPICA: Fixed a couple memory leaks associated with "implicit return"
ACPICA: Optimize buffer allocation procedure
ACPICA: Fix possible memory leak, error exit path
ACPICA: Fix fault after mem allocation failure in AML parser
ACPICA: Remove unused ACPI register bit definition
ACPICA: Update version to 20080829
ACPICA: Fix possible memory leak in acpi_ns_get_external_pathname
ACPICA: Cleanup for internal Reference Object
ACPICA: Update comments - no functional changes
ACPICA: Update for Reference ACPI_OPERAND_OBJECT
...
Diffstat (limited to 'drivers/misc/thinkpad_acpi.c')
| -rw-r--r-- | drivers/misc/thinkpad_acpi.c | 65 |
1 files changed, 62 insertions, 3 deletions
diff --git a/drivers/misc/thinkpad_acpi.c b/drivers/misc/thinkpad_acpi.c index 6b9300779a4..4db1cf9078d 100644 --- a/drivers/misc/thinkpad_acpi.c +++ b/drivers/misc/thinkpad_acpi.c | |||
| @@ -159,7 +159,6 @@ enum { | |||
| 159 | #define TPACPI_DEBUG KERN_DEBUG TPACPI_LOG | 159 | #define TPACPI_DEBUG KERN_DEBUG TPACPI_LOG |
| 160 | 160 | ||
| 161 | #define TPACPI_DBG_ALL 0xffff | 161 | #define TPACPI_DBG_ALL 0xffff |
| 162 | #define TPACPI_DBG_ALL 0xffff | ||
| 163 | #define TPACPI_DBG_INIT 0x0001 | 162 | #define TPACPI_DBG_INIT 0x0001 |
| 164 | #define TPACPI_DBG_EXIT 0x0002 | 163 | #define TPACPI_DBG_EXIT 0x0002 |
| 165 | #define dbg_printk(a_dbg_level, format, arg...) \ | 164 | #define dbg_printk(a_dbg_level, format, arg...) \ |
| @@ -543,7 +542,7 @@ static int __init setup_acpi_notify(struct ibm_struct *ibm) | |||
| 543 | return -ENODEV; | 542 | return -ENODEV; |
| 544 | } | 543 | } |
| 545 | 544 | ||
| 546 | acpi_driver_data(ibm->acpi->device) = ibm; | 545 | ibm->acpi->device->driver_data = ibm; |
| 547 | sprintf(acpi_device_class(ibm->acpi->device), "%s/%s", | 546 | sprintf(acpi_device_class(ibm->acpi->device), "%s/%s", |
| 548 | TPACPI_ACPI_EVENT_PREFIX, | 547 | TPACPI_ACPI_EVENT_PREFIX, |
| 549 | ibm->name); | 548 | ibm->name); |
| @@ -582,7 +581,8 @@ static int __init register_tpacpi_subdriver(struct ibm_struct *ibm) | |||
| 582 | 581 | ||
| 583 | ibm->acpi->driver = kzalloc(sizeof(struct acpi_driver), GFP_KERNEL); | 582 | ibm->acpi->driver = kzalloc(sizeof(struct acpi_driver), GFP_KERNEL); |
| 584 | if (!ibm->acpi->driver) { | 583 | if (!ibm->acpi->driver) { |
| 585 | printk(TPACPI_ERR "kzalloc(ibm->driver) failed\n"); | 584 | printk(TPACPI_ERR |
| 585 | "failed to allocate memory for ibm->acpi->driver\n"); | ||
| 586 | return -ENOMEM; | 586 | return -ENOMEM; |
| 587 | } | 587 | } |
| 588 | 588 | ||
| @@ -838,6 +838,13 @@ static int parse_strtoul(const char *buf, | |||
| 838 | return 0; | 838 | return 0; |
| 839 | } | 839 | } |
| 840 | 840 | ||
| 841 | static void tpacpi_disable_brightness_delay(void) | ||
| 842 | { | ||
| 843 | if (acpi_evalf(hkey_handle, NULL, "PWMS", "qvd", 0)) | ||
| 844 | printk(TPACPI_NOTICE | ||
| 845 | "ACPI backlight control delay disabled\n"); | ||
| 846 | } | ||
| 847 | |||
| 841 | static int __init tpacpi_query_bcl_levels(acpi_handle handle) | 848 | static int __init tpacpi_query_bcl_levels(acpi_handle handle) |
| 842 | { | 849 | { |
| 843 | struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; | 850 | struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; |
| @@ -2139,6 +2146,8 @@ static int __init hotkey_init(struct ibm_init_struct *iibm) | |||
| 2139 | if (!tp_features.hotkey) | 2146 | if (!tp_features.hotkey) |
| 2140 | return 1; | 2147 | return 1; |
| 2141 | 2148 | ||
| 2149 | tpacpi_disable_brightness_delay(); | ||
| 2150 | |||
| 2142 | hotkey_dev_attributes = create_attr_set(13, NULL); | 2151 | hotkey_dev_attributes = create_attr_set(13, NULL); |
| 2143 | if (!hotkey_dev_attributes) | 2152 | if (!hotkey_dev_attributes) |
| 2144 | return -ENOMEM; | 2153 | return -ENOMEM; |
| @@ -2512,6 +2521,8 @@ static void hotkey_suspend(pm_message_t state) | |||
| 2512 | 2521 | ||
| 2513 | static void hotkey_resume(void) | 2522 | static void hotkey_resume(void) |
| 2514 | { | 2523 | { |
| 2524 | tpacpi_disable_brightness_delay(); | ||
| 2525 | |||
| 2515 | if (hotkey_mask_get()) | 2526 | if (hotkey_mask_get()) |
| 2516 | printk(TPACPI_ERR | 2527 | printk(TPACPI_ERR |
| 2517 | "error while trying to read hot key mask " | 2528 | "error while trying to read hot key mask " |
| @@ -5983,6 +5994,52 @@ static void fan_exit(void) | |||
| 5983 | flush_workqueue(tpacpi_wq); | 5994 | flush_workqueue(tpacpi_wq); |
| 5984 | } | 5995 | } |
| 5985 | 5996 | ||
| 5997 | static void fan_suspend(pm_message_t state) | ||
| 5998 | { | ||
| 5999 | if (!fan_control_allowed) | ||
| 6000 | return; | ||
| 6001 | |||
| 6002 | /* Store fan status in cache */ | ||
| 6003 | fan_get_status_safe(NULL); | ||
| 6004 | if (tp_features.fan_ctrl_status_undef) | ||
| 6005 | fan_control_desired_level = TP_EC_FAN_AUTO; | ||
| 6006 | } | ||
| 6007 | |||
| 6008 | static void fan_resume(void) | ||
| 6009 | { | ||
| 6010 | u8 saved_fan_level; | ||
| 6011 | u8 current_level = 7; | ||
| 6012 | bool do_set = false; | ||
| 6013 | |||
| 6014 | /* DSDT *always* updates status on resume */ | ||
| 6015 | tp_features.fan_ctrl_status_undef = 0; | ||
| 6016 | |||
| 6017 | saved_fan_level = fan_control_desired_level; | ||
| 6018 | if (!fan_control_allowed || | ||
| 6019 | (fan_get_status_safe(¤t_level) < 0)) | ||
| 6020 | return; | ||
| 6021 | |||
| 6022 | switch (fan_control_access_mode) { | ||
| 6023 | case TPACPI_FAN_WR_ACPI_SFAN: | ||
| 6024 | do_set = (saved_fan_level > current_level); | ||
| 6025 | break; | ||
| 6026 | case TPACPI_FAN_WR_ACPI_FANS: | ||
| 6027 | case TPACPI_FAN_WR_TPEC: | ||
| 6028 | do_set = ((saved_fan_level & TP_EC_FAN_FULLSPEED) || | ||
| 6029 | (saved_fan_level == 7 && | ||
| 6030 | !(current_level & TP_EC_FAN_FULLSPEED))); | ||
| 6031 | break; | ||
| 6032 | default: | ||
| 6033 | return; | ||
| 6034 | } | ||
| 6035 | if (do_set) { | ||
| 6036 | printk(TPACPI_NOTICE | ||
| 6037 | "restoring fan level to 0x%02x\n", | ||
| 6038 | saved_fan_level); | ||
| 6039 | fan_set_level_safe(saved_fan_level); | ||
| 6040 | } | ||
| 6041 | } | ||
| 6042 | |||
| 5986 | static int fan_read(char *p) | 6043 | static int fan_read(char *p) |
| 5987 | { | 6044 | { |
| 5988 | int len = 0; | 6045 | int len = 0; |
| @@ -6174,6 +6231,8 @@ static struct ibm_struct fan_driver_data = { | |||
| 6174 | .read = fan_read, | 6231 | .read = fan_read, |
| 6175 | .write = fan_write, | 6232 | .write = fan_write, |
| 6176 | .exit = fan_exit, | 6233 | .exit = fan_exit, |
| 6234 | .suspend = fan_suspend, | ||
| 6235 | .resume = fan_resume, | ||
| 6177 | }; | 6236 | }; |
| 6178 | 6237 | ||
| 6179 | /**************************************************************************** | 6238 | /**************************************************************************** |
