samsung-laptop: enable better lid handling
authorJulijonas Kikutis <julijonas.kikutis@gmail.com>
Thu, 29 Jan 2015 13:04:37 +0000 (13:04 +0000)
committerDarren Hart <dvhart@linux.intel.com>
Sat, 7 Feb 2015 02:33:55 +0000 (18:33 -0800)
commitb0dcaf4fbb36895175657be029ed64eda2a34707
treef3b0e8d1ba9d9c212ccd6c834e2d3deec0fb6609
parentfa465739d4dad4c04715f1e8f1416d86b5b71b64
samsung-laptop: enable better lid handling

Some Samsung laptops with SABI3 delay the sleep for 10 seconds after
the lid is closed and do not wake up from sleep after the lid is opened.
A SABI command is needed to enable the better behavior.

Command = 0x6e, d0 = 0x81 enables this behavior. Returns d0 = 0x01.
Command = 0x6e, d0 = 0x80 disables this behavior. Returns d0 = 0x00.

Command = 0x6d and any d0 queries the state. This returns:
d0 = 0x00000*01, d1 = 0x00, d2 = 0x00, d3 = 0x0* when it is enabled.
d0 = 0x00000*00, d1 = 0x00, d2 = 0x00, d3 = 0x0* when it is disabled.
Where * is 0 - laptop has never slept or hibernated after switch on,
           1 - laptop has hibernated just before,
           2 - laptop has slept just before.

Patch addresses bug https://bugzilla.kernel.org/show_bug.cgi?id=75901 .
It adds a sysfs attribute lid_handling with a description and also an
addition to the quirks structure to enable the mode by default.

A user with another laptop in the bug report says that "power button has
to be pressed twice to wake the machine" when he or she enabled the mode
manually using the SABI command. Therefore, it is enabled by default
only for the single laptop that I have tested.

Signed-off-by: Julijonas Kikutis <julijonas.kikutis@gmail.com>
Signed-off-by: Darren Hart <dvhart@linux.intel.com>
Documentation/ABI/testing/sysfs-driver-samsung-laptop
drivers/platform/x86/samsung-laptop.c