]> err.no Git - linux-2.6/blobdiff - drivers/acpi/hardware/hwgpe.c
Merge branch 'reg-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/lrg...
[linux-2.6] / drivers / acpi / hardware / hwgpe.c
index 5c8e5dfd024e5fea65c093a2afe7ca9912265799..0b80db9d91979e17ce418f840a56d3096afb5f2d 100644 (file)
@@ -6,7 +6,7 @@
  *****************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2005, R. Byron Moore
+ * Copyright (C) 2000 - 2008, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -53,6 +53,54 @@ static acpi_status
 acpi_hw_enable_wakeup_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info,
                                struct acpi_gpe_block_info *gpe_block);
 
+/******************************************************************************
+ *
+ * FUNCTION:   acpi_hw_low_disable_gpe
+ *
+ * PARAMETERS: gpe_event_info      - Info block for the GPE to be disabled
+ *
+ * RETURN:     Status
+ *
+ * DESCRIPTION: Disable a single GPE in the enable register.
+ *
+ ******************************************************************************/
+
+acpi_status acpi_hw_low_disable_gpe(struct acpi_gpe_event_info *gpe_event_info)
+{
+       struct acpi_gpe_register_info *gpe_register_info;
+       acpi_status status;
+       u32 enable_mask;
+
+       /* Get the info block for the entire GPE register */
+
+       gpe_register_info = gpe_event_info->register_info;
+       if (!gpe_register_info) {
+               return (AE_NOT_EXIST);
+       }
+
+       /* Get current value of the enable register that contains this GPE */
+
+       status = acpi_hw_low_level_read(ACPI_GPE_REGISTER_WIDTH, &enable_mask,
+                                       &gpe_register_info->enable_address);
+       if (ACPI_FAILURE(status)) {
+               return (status);
+       }
+
+       /* Clear just the bit that corresponds to this GPE */
+
+       ACPI_CLEAR_BIT(enable_mask,
+                      ((u32) 1 <<
+                       (gpe_event_info->gpe_number -
+                        gpe_register_info->base_gpe_number)));
+
+       /* Write the updated enable mask */
+
+       status = acpi_hw_low_level_write(ACPI_GPE_REGISTER_WIDTH, enable_mask,
+                                        &gpe_register_info->enable_address);
+
+       return (status);
+}
+
 /******************************************************************************
  *
  * FUNCTION:    acpi_hw_write_gpe_enable_reg
@@ -68,7 +116,7 @@ acpi_hw_enable_wakeup_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info,
  ******************************************************************************/
 
 acpi_status
-acpi_hw_write_gpe_enable_reg(struct acpi_gpe_event_info *gpe_event_info)
+acpi_hw_write_gpe_enable_reg(struct acpi_gpe_event_info * gpe_event_info)
 {
        struct acpi_gpe_register_info *gpe_register_info;
        acpi_status status;
@@ -105,14 +153,20 @@ acpi_hw_write_gpe_enable_reg(struct acpi_gpe_event_info *gpe_event_info)
 acpi_status acpi_hw_clear_gpe(struct acpi_gpe_event_info * gpe_event_info)
 {
        acpi_status status;
+       u8 register_bit;
 
        ACPI_FUNCTION_ENTRY();
 
+       register_bit = (u8)
+           (1 <<
+            (gpe_event_info->gpe_number -
+             gpe_event_info->register_info->base_gpe_number));
+
        /*
         * Write a one to the appropriate bit in the status register to
         * clear this GPE.
         */
-       status = acpi_hw_low_level_write(8, gpe_event_info->register_bit,
+       status = acpi_hw_low_level_write(8, register_bit,
                                         &gpe_event_info->register_info->
                                         status_address);
 
@@ -132,7 +186,6 @@ acpi_status acpi_hw_clear_gpe(struct acpi_gpe_event_info * gpe_event_info)
  *
  ******************************************************************************/
 
-#ifdef ACPI_FUTURE_USAGE
 acpi_status
 acpi_hw_get_gpe_status(struct acpi_gpe_event_info * gpe_event_info,
                       acpi_event_status * event_status)
@@ -155,7 +208,10 @@ acpi_hw_get_gpe_status(struct acpi_gpe_event_info * gpe_event_info,
 
        /* Get the register bitmask for this GPE */
 
-       register_bit = gpe_event_info->register_bit;
+       register_bit = (u8)
+           (1 <<
+            (gpe_event_info->gpe_number -
+             gpe_event_info->register_info->base_gpe_number));
 
        /* GPE currently enabled? (enabled for runtime?) */
 
@@ -189,7 +245,6 @@ acpi_hw_get_gpe_status(struct acpi_gpe_event_info * gpe_event_info,
       unlock_and_exit:
        return (status);
 }
-#endif                         /*  ACPI_FUTURE_USAGE  */
 
 /******************************************************************************
  *
@@ -214,6 +269,7 @@ acpi_hw_disable_gpe_block(struct acpi_gpe_xrupt_info * gpe_xrupt_info,
        /* Examine each GPE Register within the block */
 
        for (i = 0; i < gpe_block->register_count; i++) {
+
                /* Disable all GPEs in this register */
 
                status = acpi_hw_low_level_write(8, 0x00,
@@ -250,6 +306,7 @@ acpi_hw_clear_gpe_block(struct acpi_gpe_xrupt_info * gpe_xrupt_info,
        /* Examine each GPE Register within the block */
 
        for (i = 0; i < gpe_block->register_count; i++) {
+
                /* Clear status on all GPEs in this register */
 
                status = acpi_hw_low_level_write(8, 0xFF,
@@ -368,7 +425,7 @@ acpi_status acpi_hw_disable_all_gpes(void)
 {
        acpi_status status;
 
-       ACPI_FUNCTION_TRACE("hw_disable_all_gpes");
+       ACPI_FUNCTION_TRACE(hw_disable_all_gpes);
 
        status = acpi_ev_walk_gpe_list(acpi_hw_disable_gpe_block);
        status = acpi_ev_walk_gpe_list(acpi_hw_clear_gpe_block);
@@ -391,7 +448,7 @@ acpi_status acpi_hw_enable_all_runtime_gpes(void)
 {
        acpi_status status;
 
-       ACPI_FUNCTION_TRACE("hw_enable_all_runtime_gpes");
+       ACPI_FUNCTION_TRACE(hw_enable_all_runtime_gpes);
 
        status = acpi_ev_walk_gpe_list(acpi_hw_enable_runtime_gpe_block);
        return_ACPI_STATUS(status);
@@ -413,7 +470,7 @@ acpi_status acpi_hw_enable_all_wakeup_gpes(void)
 {
        acpi_status status;
 
-       ACPI_FUNCTION_TRACE("hw_enable_all_wakeup_gpes");
+       ACPI_FUNCTION_TRACE(hw_enable_all_wakeup_gpes);
 
        status = acpi_ev_walk_gpe_list(acpi_hw_enable_wakeup_gpe_block);
        return_ACPI_STATUS(status);