Commit 593681e2 authored by Hans de Goede's avatar Hans de Goede Committed by Rafael J. Wysocki

ACPI: button: Allow disabling LID support with the lid_init_state module option

Add a new "disabled" value for the lid_init_state module option, which can
be used to disable LID support on devices where it is completely broken.

Sometimes devices seem to spontaneously suspend and the cause for this is
not clear. The LID switch is known to be one possible cause for this,
this commit allows easily disabling the LID switch for testing if it
is the cause.

For example some devices which do not even have a lid, still have a LID
device in their ACPI tables, pointing to a floating GPIO.

This is not really related to the initial LID state, but re-using the
existing option keeps things simple and it will make it much easier to
add DMI quirks which can either disable the LID completely or set another
non-default lid_init_state value, both of which are necessary on some
devices.
Reviewed-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
parent 065bd4d3
...@@ -48,12 +48,14 @@ enum { ...@@ -48,12 +48,14 @@ enum {
ACPI_BUTTON_LID_INIT_IGNORE, ACPI_BUTTON_LID_INIT_IGNORE,
ACPI_BUTTON_LID_INIT_OPEN, ACPI_BUTTON_LID_INIT_OPEN,
ACPI_BUTTON_LID_INIT_METHOD, ACPI_BUTTON_LID_INIT_METHOD,
ACPI_BUTTON_LID_INIT_DISABLED,
}; };
static const char * const lid_init_state_str[] = { static const char * const lid_init_state_str[] = {
[ACPI_BUTTON_LID_INIT_IGNORE] = "ignore", [ACPI_BUTTON_LID_INIT_IGNORE] = "ignore",
[ACPI_BUTTON_LID_INIT_OPEN] = "open", [ACPI_BUTTON_LID_INIT_OPEN] = "open",
[ACPI_BUTTON_LID_INIT_METHOD] = "method", [ACPI_BUTTON_LID_INIT_METHOD] = "method",
[ACPI_BUTTON_LID_INIT_DISABLED] = "disabled",
}; };
#define _COMPONENT ACPI_BUTTON_COMPONENT #define _COMPONENT ACPI_BUTTON_COMPONENT
...@@ -480,7 +482,9 @@ static int acpi_button_add(struct acpi_device *device) ...@@ -480,7 +482,9 @@ static int acpi_button_add(struct acpi_device *device)
char *name, *class; char *name, *class;
int error; int error;
if (!strcmp(hid, ACPI_BUTTON_HID_LID) && dmi_check_system(lid_blacklst)) if (!strcmp(hid, ACPI_BUTTON_HID_LID) &&
(dmi_check_system(lid_blacklst) ||
lid_init_state == ACPI_BUTTON_LID_INIT_DISABLED))
return -ENODEV; return -ENODEV;
button = kzalloc(sizeof(struct acpi_button), GFP_KERNEL); button = kzalloc(sizeof(struct acpi_button), GFP_KERNEL);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment