]> git.karo-electronics.de Git - mv-sheeva.git/commitdiff
Pull dmi-2.6.24 into release branch
authorLen Brown <len.brown@intel.com>
Thu, 24 Jan 2008 04:50:01 +0000 (23:50 -0500)
committerLen Brown <len.brown@intel.com>
Thu, 24 Jan 2008 04:50:01 +0000 (23:50 -0500)
drivers/acpi/bus.c
drivers/acpi/ec.c
drivers/acpi/fan.c
drivers/acpi/processor_throttling.c
include/acpi/acpi_bus.h

index d7a115c362d1b53c84a61164c51ff24036684b28..f4487c38d9f294893ebc460f5f05c27b3918b77d 100644 (file)
@@ -200,7 +200,7 @@ int acpi_bus_set_power(acpi_handle handle, int state)
         * Get device's current power state
         */
        acpi_bus_get_power(device->handle, &device->power.state);
-       if (state == device->power.state) {
+       if ((state == device->power.state) && !device->flags.force_power_state) {
                ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device is already at D%d\n",
                                  state));
                return 0;
index 97dc16155a556d13c373535f767bc8faba76514f..987b967c74670728831af322571e4a182fb84d7e 100644 (file)
@@ -26,6 +26,9 @@
  * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  */
 
+/* Uncomment next line to get verbose print outs*/
+/* #define DEBUG */
+
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/init.h>
@@ -47,9 +50,6 @@
 #undef PREFIX
 #define PREFIX                         "ACPI: EC: "
 
-/* Uncomment next line to get verbose print outs*/
-/* #define DEBUG */
-
 /* EC status register */
 #define ACPI_EC_FLAG_OBF       0x01    /* Output buffer full */
 #define ACPI_EC_FLAG_IBF       0x02    /* Input buffer full */
@@ -82,6 +82,7 @@ enum {
        EC_FLAGS_ADDRESS,               /* Address is being written */
        EC_FLAGS_NO_WDATA_GPE,          /* Don't expect WDATA GPE event */
        EC_FLAGS_WDATA,                 /* Data is being written */
+       EC_FLAGS_NO_OBF1_GPE,           /* Don't expect GPE before read */
 };
 
 static int acpi_ec_remove(struct acpi_device *device, int type);
@@ -138,26 +139,26 @@ static struct acpi_ec {
 static inline u8 acpi_ec_read_status(struct acpi_ec *ec)
 {
        u8 x = inb(ec->command_addr);
-       pr_debug(PREFIX "---> status = 0x%2x\n", x);
+       pr_debug(PREFIX "---> status = 0x%2.2x\n", x);
        return x;
 }
 
 static inline u8 acpi_ec_read_data(struct acpi_ec *ec)
 {
        u8 x = inb(ec->data_addr);
-       pr_debug(PREFIX "---> data = 0x%2x\n", x);
+       pr_debug(PREFIX "---> data = 0x%2.2x\n", x);
        return inb(ec->data_addr);
 }
 
 static inline void acpi_ec_write_cmd(struct acpi_ec *ec, u8 command)
 {
-       pr_debug(PREFIX "<--- command = 0x%2x\n", command);
+       pr_debug(PREFIX "<--- command = 0x%2.2x\n", command);
        outb(command, ec->command_addr);
 }
 
 static inline void acpi_ec_write_data(struct acpi_ec *ec, u8 data)
 {
-       pr_debug(PREFIX "<--- data = 0x%2x\n", data);
+       pr_debug(PREFIX "<--- data = 0x%2.2x\n", data);
        outb(data, ec->data_addr);
 }
 
@@ -179,6 +180,10 @@ static inline int acpi_ec_check_status(struct acpi_ec *ec, enum ec_event event)
 static int acpi_ec_wait(struct acpi_ec *ec, enum ec_event event, int force_poll)
 {
        int ret = 0;
+
+       if (unlikely(event == ACPI_EC_EVENT_OBF_1 &&
+                    test_bit(EC_FLAGS_NO_OBF1_GPE, &ec->flags)))
+               force_poll = 1;
        if (unlikely(test_bit(EC_FLAGS_ADDRESS, &ec->flags) &&
                     test_bit(EC_FLAGS_NO_ADDRESS_GPE, &ec->flags)))
                force_poll = 1;
@@ -192,7 +197,12 @@ static int acpi_ec_wait(struct acpi_ec *ec, enum ec_event event, int force_poll)
                        goto end;
                clear_bit(EC_FLAGS_WAIT_GPE, &ec->flags);
                if (acpi_ec_check_status(ec, event)) {
-                       if (test_bit(EC_FLAGS_ADDRESS, &ec->flags)) {
+                       if (event == ACPI_EC_EVENT_OBF_1) {
+                               /* miss OBF_1 GPE, don't expect it */
+                               pr_info(PREFIX "missing OBF confirmation, "
+                                       "don't expect it any longer.\n");
+                               set_bit(EC_FLAGS_NO_OBF1_GPE, &ec->flags);
+                       } else if (test_bit(EC_FLAGS_ADDRESS, &ec->flags)) {
                                /* miss address GPE, don't expect it anymore */
                                pr_info(PREFIX "missing address confirmation, "
                                        "don't expect it any longer.\n");
index a5a5532db268084307ae31d655a04af6b9913925..a6e149d692cbd332aaf947d689815392474cda34 100644 (file)
@@ -47,6 +47,8 @@ MODULE_LICENSE("GPL");
 
 static int acpi_fan_add(struct acpi_device *device);
 static int acpi_fan_remove(struct acpi_device *device, int type);
+static int acpi_fan_suspend(struct acpi_device *device, pm_message_t state);
+static int acpi_fan_resume(struct acpi_device *device);
 
 static const struct acpi_device_id fan_device_ids[] = {
        {"PNP0C0B", 0},
@@ -61,6 +63,8 @@ static struct acpi_driver acpi_fan_driver = {
        .ops = {
                .add = acpi_fan_add,
                .remove = acpi_fan_remove,
+               .suspend = acpi_fan_suspend,
+               .resume = acpi_fan_resume,
                },
 };
 
@@ -191,6 +195,10 @@ static int acpi_fan_add(struct acpi_device *device)
                goto end;
        }
 
+       device->flags.force_power_state = 1;
+       acpi_bus_set_power(device->handle, state);
+       device->flags.force_power_state = 0;
+
        result = acpi_fan_add_fs(device);
        if (result)
                goto end;
@@ -216,6 +224,38 @@ static int acpi_fan_remove(struct acpi_device *device, int type)
        return 0;
 }
 
+static int acpi_fan_suspend(struct acpi_device *device, pm_message_t state)
+{
+       if (!device)
+               return -EINVAL;
+
+       acpi_bus_set_power(device->handle, ACPI_STATE_D0);
+
+       return AE_OK;
+}
+
+static int acpi_fan_resume(struct acpi_device *device)
+{
+       int result = 0;
+       int power_state = 0;
+
+       if (!device)
+               return -EINVAL;
+
+       result = acpi_bus_get_power(device->handle, &power_state);
+       if (result) {
+               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                 "Error reading fan power state\n"));
+               return result;
+       }
+
+       device->flags.force_power_state = 1;
+       acpi_bus_set_power(device->handle, power_state);
+       device->flags.force_power_state = 0;
+
+       return result;
+}
+
 static int __init acpi_fan_init(void)
 {
        int result = 0;
index 6742d7bc4777d8343d10aa34aa5d40a920f5f41a..1685b40abda7c2dba944939917a4993f8a4a5f3d 100644 (file)
@@ -775,12 +775,12 @@ int acpi_processor_get_throttling_info(struct acpi_processor *pr)
                acpi_processor_get_throttling_states(pr) ||
                acpi_processor_get_platform_limit(pr))
        {
-               if (acpi_processor_get_fadt_info(pr))
-                       return 0;
                pr->throttling.acpi_processor_get_throttling =
                    &acpi_processor_get_throttling_fadt;
                pr->throttling.acpi_processor_set_throttling =
                    &acpi_processor_set_throttling_fadt;
+               if (acpi_processor_get_fadt_info(pr))
+                       return 0;
        } else {
                pr->throttling.acpi_processor_get_throttling =
                    &acpi_processor_get_throttling_ptc;
index 19c3ead2a90bb768f98e077ff91c050ae290e737..7b74b60a68a47b26d3addf541b3440f23bd947ad 100644 (file)
@@ -168,7 +168,8 @@ struct acpi_device_flags {
        u32 power_manageable:1;
        u32 performance_manageable:1;
        u32 wake_capable:1;     /* Wakeup(_PRW) supported? */
-       u32 reserved:20;
+       u32 force_power_state:1;
+       u32 reserved:19;
 };
 
 /* File System */