Skip to content

Commit

Permalink
eeepc-wmi: use the presence bit correctly
Browse files Browse the repository at this point in the history
I checked some more DSDT, and it seems that I wasn't
totally right about the meaning of DSTS return value.
Bit 0 is clearly the status of the device, and I discovered
that bit 16 is set when the device is present.

Signed-off-by: Corentin Chary <corentincj@iksaif.net>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
  • Loading branch information
Corentin Chary authored and Matthew Garrett committed Mar 28, 2011
1 parent 33e0e6f commit aafa719
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions drivers/platform/x86/eeepc-wmi.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ MODULE_ALIAS("wmi:"EEEPC_WMI_MGMT_GUID);
#define EEEPC_WMI_DEVID_BACKLIGHT 0x00050012
#define EEEPC_WMI_DEVID_TPDLED 0x00100011

#define EEEPC_WMI_DSTS_STATUS_BIT 0x00000001
#define EEEPC_WMI_DSTS_PRESENCE_BIT 0x00010000

static bool hotplug_wireless;

module_param(hotplug_wireless, bool, 0444);
Expand Down Expand Up @@ -265,16 +268,10 @@ static int eeepc_wmi_get_devstate_simple(u32 dev_id)
if (ACPI_FAILURE(status))
return -EINVAL;

/* If the device is present, DSTS will always set some bits
* 0x00070000 - 1110000000000000000 - device supported
* 0x00060000 - 1100000000000000000 - not supported
* 0x00020000 - 0100000000000000000 - device supported
* 0x00010000 - 0010000000000000000 - not supported / special mode ?
*/
if (!retval || retval == 0x00060000)
if (!(retval & EEEPC_WMI_DSTS_PRESENCE_BIT))
return -ENODEV;

return retval & 0x1;
return retval & EEEPC_WMI_DSTS_STATUS_BIT;
}

/*
Expand Down

0 comments on commit aafa719

Please sign in to comment.