aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/misc
diff options
context:
space:
mode:
authorLen Brown <len.brown@intel.com>2008-10-22 23:28:48 -0400
committerLen Brown <len.brown@intel.com>2008-10-22 23:28:48 -0400
commit0ca9413c234aa5a49ffaf80e46b50721a752e45a (patch)
tree2337ac22810f77c0ddb9b00391feab31175c0bd2 /drivers/misc
parentacd41d36e5a813501da92156f325ce15ddcd58ff (diff)
parentd64c81c4cea0a14e88fc76e2c845e4885e491754 (diff)
Merge branch 'thinkpad' into test
Diffstat (limited to 'drivers/misc')
-rw-r--r--drivers/misc/thinkpad_acpi.c63
1 files changed, 61 insertions, 2 deletions
diff --git a/drivers/misc/thinkpad_acpi.c b/drivers/misc/thinkpad_acpi.c
index 62aebaa85913..4db1cf9078d9 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...) \
@@ -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
841static 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
841static int __init tpacpi_query_bcl_levels(acpi_handle handle) 848static 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
2513static void hotkey_resume(void) 2522static 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
5997static 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
6008static 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(&current_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
5986static int fan_read(char *p) 6043static 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/****************************************************************************