aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi')
-rw-r--r--drivers/acpi/Kconfig1
-rw-r--r--drivers/acpi/hardware/hwsleep.c10
-rw-r--r--drivers/acpi/sleep/main.c5
-rw-r--r--drivers/acpi/tables/tbutils.c2
-rw-r--r--drivers/acpi/thermal.c28
-rw-r--r--drivers/acpi/video.c30
6 files changed, 50 insertions, 26 deletions
diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig
index a858bc528ec3..b83389145f28 100644
--- a/drivers/acpi/Kconfig
+++ b/drivers/acpi/Kconfig
@@ -117,6 +117,7 @@ config ACPI_BUTTON
117config ACPI_VIDEO 117config ACPI_VIDEO
118 tristate "Video" 118 tristate "Video"
119 depends on X86 && BACKLIGHT_CLASS_DEVICE && VIDEO_OUTPUT_CONTROL 119 depends on X86 && BACKLIGHT_CLASS_DEVICE && VIDEO_OUTPUT_CONTROL
120 depends on INPUT
120 help 121 help
121 This driver implement the ACPI Extensions For Display Adapters 122 This driver implement the ACPI Extensions For Display Adapters
122 for integrated graphics devices on motherboard, as specified in 123 for integrated graphics devices on motherboard, as specified in
diff --git a/drivers/acpi/hardware/hwsleep.c b/drivers/acpi/hardware/hwsleep.c
index cf69c0040a39..8181afbd1d4d 100644
--- a/drivers/acpi/hardware/hwsleep.c
+++ b/drivers/acpi/hardware/hwsleep.c
@@ -234,15 +234,11 @@ acpi_status acpi_enter_sleep_state_prep(u8 sleep_state)
234 "While executing method _SST")); 234 "While executing method _SST"));
235 } 235 }
236 236
237 /* 237 /* Disable/Clear all GPEs */
238 * 1) Disable/Clear all GPEs 238
239 */
240 status = acpi_hw_disable_all_gpes(); 239 status = acpi_hw_disable_all_gpes();
241 if (ACPI_FAILURE(status)) {
242 return_ACPI_STATUS(status);
243 }
244 240
245 return_ACPI_STATUS(AE_OK); 241 return_ACPI_STATUS(status);
246} 242}
247 243
248ACPI_EXPORT_SYMBOL(acpi_enter_sleep_state_prep) 244ACPI_EXPORT_SYMBOL(acpi_enter_sleep_state_prep)
diff --git a/drivers/acpi/sleep/main.c b/drivers/acpi/sleep/main.c
index 2cbb9aabd00e..caf8721ae6fb 100644
--- a/drivers/acpi/sleep/main.c
+++ b/drivers/acpi/sleep/main.c
@@ -256,6 +256,11 @@ static int acpi_hibernation_enter(void)
256 256
257static void acpi_hibernation_finish(void) 257static void acpi_hibernation_finish(void)
258{ 258{
259 /*
260 * If ACPI is not enabled by the BIOS and the boot kernel, we need to
261 * enable it here.
262 */
263 acpi_enable();
259 acpi_leave_sleep_state(ACPI_STATE_S4); 264 acpi_leave_sleep_state(ACPI_STATE_S4);
260 acpi_disable_wakeup_device(ACPI_STATE_S4); 265 acpi_disable_wakeup_device(ACPI_STATE_S4);
261 266
diff --git a/drivers/acpi/tables/tbutils.c b/drivers/acpi/tables/tbutils.c
index 8cc9492ffbf2..5f1d85f2ffe4 100644
--- a/drivers/acpi/tables/tbutils.c
+++ b/drivers/acpi/tables/tbutils.c
@@ -400,7 +400,7 @@ acpi_tb_parse_root_table(acpi_physical_address rsdp_address, u8 flags)
400 u32 table_count; 400 u32 table_count;
401 struct acpi_table_header *table; 401 struct acpi_table_header *table;
402 acpi_physical_address address; 402 acpi_physical_address address;
403 acpi_physical_address rsdt_address; 403 acpi_physical_address uninitialized_var(rsdt_address);
404 u32 length; 404 u32 length;
405 u8 *table_entry; 405 u8 *table_entry;
406 acpi_status status; 406 acpi_status status;
diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c
index bc6d5866ef98..69ec73b0239d 100644
--- a/drivers/acpi/thermal.c
+++ b/drivers/acpi/thermal.c
@@ -195,6 +195,7 @@ struct acpi_thermal {
195 struct acpi_thermal_trips trips; 195 struct acpi_thermal_trips trips;
196 struct acpi_handle_list devices; 196 struct acpi_handle_list devices;
197 struct timer_list timer; 197 struct timer_list timer;
198 struct mutex lock;
198}; 199};
199 200
200static const struct file_operations acpi_thermal_state_fops = { 201static const struct file_operations acpi_thermal_state_fops = {
@@ -711,6 +712,7 @@ static void acpi_thermal_check(void *data)
711 int result = 0; 712 int result = 0;
712 struct acpi_thermal *tz = data; 713 struct acpi_thermal *tz = data;
713 unsigned long sleep_time = 0; 714 unsigned long sleep_time = 0;
715 unsigned long timeout_jiffies = 0;
714 int i = 0; 716 int i = 0;
715 struct acpi_thermal_state state; 717 struct acpi_thermal_state state;
716 718
@@ -720,11 +722,15 @@ static void acpi_thermal_check(void *data)
720 return; 722 return;
721 } 723 }
722 724
725 /* Check if someone else is already running */
726 if (!mutex_trylock(&tz->lock))
727 return;
728
723 state = tz->state; 729 state = tz->state;
724 730
725 result = acpi_thermal_get_temperature(tz); 731 result = acpi_thermal_get_temperature(tz);
726 if (result) 732 if (result)
727 return; 733 goto unlock;
728 734
729 memset(&tz->state, 0, sizeof(tz->state)); 735 memset(&tz->state, 0, sizeof(tz->state));
730 736
@@ -787,10 +793,13 @@ static void acpi_thermal_check(void *data)
787 * a thermal event occurs). Note that _TSP and _TZD values are 793 * a thermal event occurs). Note that _TSP and _TZD values are
788 * given in 1/10th seconds (we must covert to milliseconds). 794 * given in 1/10th seconds (we must covert to milliseconds).
789 */ 795 */
790 if (tz->state.passive) 796 if (tz->state.passive) {
791 sleep_time = tz->trips.passive.tsp * 100; 797 sleep_time = tz->trips.passive.tsp * 100;
792 else if (tz->polling_frequency > 0) 798 timeout_jiffies = jiffies + (HZ * sleep_time) / 1000;
799 } else if (tz->polling_frequency > 0) {
793 sleep_time = tz->polling_frequency * 100; 800 sleep_time = tz->polling_frequency * 100;
801 timeout_jiffies = round_jiffies(jiffies + (HZ * sleep_time) / 1000);
802 }
794 803
795 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "%s: temperature[%lu] sleep[%lu]\n", 804 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "%s: temperature[%lu] sleep[%lu]\n",
796 tz->name, tz->temperature, sleep_time)); 805 tz->name, tz->temperature, sleep_time));
@@ -804,17 +813,16 @@ static void acpi_thermal_check(void *data)
804 del_timer(&(tz->timer)); 813 del_timer(&(tz->timer));
805 } else { 814 } else {
806 if (timer_pending(&(tz->timer))) 815 if (timer_pending(&(tz->timer)))
807 mod_timer(&(tz->timer), 816 mod_timer(&(tz->timer), timeout_jiffies);
808 jiffies + (HZ * sleep_time) / 1000);
809 else { 817 else {
810 tz->timer.data = (unsigned long)tz; 818 tz->timer.data = (unsigned long)tz;
811 tz->timer.function = acpi_thermal_run; 819 tz->timer.function = acpi_thermal_run;
812 tz->timer.expires = jiffies + (HZ * sleep_time) / 1000; 820 tz->timer.expires = timeout_jiffies;
813 add_timer(&(tz->timer)); 821 add_timer(&(tz->timer));
814 } 822 }
815 } 823 }
816 824 unlock:
817 return; 825 mutex_unlock(&tz->lock);
818} 826}
819 827
820/* -------------------------------------------------------------------------- 828/* --------------------------------------------------------------------------
@@ -1251,7 +1259,7 @@ static int acpi_thermal_add(struct acpi_device *device)
1251 strcpy(acpi_device_name(device), ACPI_THERMAL_DEVICE_NAME); 1259 strcpy(acpi_device_name(device), ACPI_THERMAL_DEVICE_NAME);
1252 strcpy(acpi_device_class(device), ACPI_THERMAL_CLASS); 1260 strcpy(acpi_device_class(device), ACPI_THERMAL_CLASS);
1253 acpi_driver_data(device) = tz; 1261 acpi_driver_data(device) = tz;
1254 1262 mutex_init(&tz->lock);
1255 result = acpi_thermal_get_info(tz); 1263 result = acpi_thermal_get_info(tz);
1256 if (result) 1264 if (result)
1257 goto end; 1265 goto end;
@@ -1321,7 +1329,7 @@ static int acpi_thermal_remove(struct acpi_device *device, int type)
1321 } 1329 }
1322 1330
1323 acpi_thermal_remove_fs(device); 1331 acpi_thermal_remove_fs(device);
1324 1332 mutex_destroy(&tz->lock);
1325 kfree(tz); 1333 kfree(tz);
1326 return 0; 1334 return 0;
1327} 1335}
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c
index d05891f16282..f31e3c8749e0 100644
--- a/drivers/acpi/video.c
+++ b/drivers/acpi/video.c
@@ -409,14 +409,17 @@ acpi_video_device_lcd_query_levels(struct acpi_video_device *device,
409static int 409static int
410acpi_video_device_lcd_set_level(struct acpi_video_device *device, int level) 410acpi_video_device_lcd_set_level(struct acpi_video_device *device, int level)
411{ 411{
412 int status; 412 int status = AE_OK;
413 union acpi_object arg0 = { ACPI_TYPE_INTEGER }; 413 union acpi_object arg0 = { ACPI_TYPE_INTEGER };
414 struct acpi_object_list args = { 1, &arg0 }; 414 struct acpi_object_list args = { 1, &arg0 };
415 415
416 416
417 arg0.integer.value = level; 417 arg0.integer.value = level;
418 status = acpi_evaluate_object(device->dev->handle, "_BCM", &args, NULL);
419 418
419 if (device->cap._BCM)
420 status = acpi_evaluate_object(device->dev->handle, "_BCM",
421 &args, NULL);
422 device->brightness->curr = level;
420 return status; 423 return status;
421} 424}
422 425
@@ -424,11 +427,11 @@ static int
424acpi_video_device_lcd_get_level_current(struct acpi_video_device *device, 427acpi_video_device_lcd_get_level_current(struct acpi_video_device *device,
425 unsigned long *level) 428 unsigned long *level)
426{ 429{
427 int status; 430 if (device->cap._BQC)
428 431 return acpi_evaluate_integer(device->dev->handle, "_BQC", NULL,
429 status = acpi_evaluate_integer(device->dev->handle, "_BQC", NULL, level); 432 level);
430 433 *level = device->brightness->curr;
431 return status; 434 return AE_OK;
432} 435}
433 436
434static int 437static int
@@ -1633,9 +1636,20 @@ static int
1633acpi_video_get_next_level(struct acpi_video_device *device, 1636acpi_video_get_next_level(struct acpi_video_device *device,
1634 u32 level_current, u32 event) 1637 u32 level_current, u32 event)
1635{ 1638{
1636 int min, max, min_above, max_below, i, l; 1639 int min, max, min_above, max_below, i, l, delta = 255;
1637 max = max_below = 0; 1640 max = max_below = 0;
1638 min = min_above = 255; 1641 min = min_above = 255;
1642 /* Find closest level to level_current */
1643 for (i = 0; i < device->brightness->count; i++) {
1644 l = device->brightness->levels[i];
1645 if (abs(l - level_current) < abs(delta)) {
1646 delta = l - level_current;
1647 if (!delta)
1648 break;
1649 }
1650 }
1651 /* Ajust level_current to closest available level */
1652 level_current += delta;
1639 for (i = 0; i < device->brightness->count; i++) { 1653 for (i = 0; i < device->brightness->count; i++) {
1640 l = device->brightness->levels[i]; 1654 l = device->brightness->levels[i];
1641 if (l < min) 1655 if (l < min)