Commit dbf0c5a6 authored by Matan Ziv-Av's avatar Matan Ziv-Av Committed by Andy Shevchenko
Browse files

platform/x86: Add LG Gram laptop special features driver



A driver for LG Gram laptop supporting features not available through the
standard interfaces:

- Support for the 5 Fn keys that generate ACPI or WMI events.

- Two software controlled LEDs: keyboard backlight (also controlled by
  hardware) and touchpad LED.

- Extra features: reader mode, Fn lock, cooling mode, USB charge mode, and
  maximal battery charging level.

Signed-off-by: default avatarMatan Ziv-Av <matan@svgalib.org>
Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
parent 9fe44fc9
Loading
Loading
Loading
Loading
+35 −0
Original line number Diff line number Diff line
What:		/sys/devices/platform/lg-laptop/reader_mode
Date:		October 2018
KernelVersion:	4.20
Contact:	"Matan Ziv-Av <matan@svgalib.org>
Description:
        Control reader mode. 1 means on, 0 means off.

What:		/sys/devices/platform/lg-laptop/fn_lock
Date:		October 2018
KernelVersion:	4.20
Contact:	"Matan Ziv-Av <matan@svgalib.org>
Description:
        Control FN lock mode. 1 means on, 0 means off.

What:		/sys/devices/platform/lg-laptop/battery_care_limit
Date:		October 2018
KernelVersion:	4.20
Contact:	"Matan Ziv-Av <matan@svgalib.org>
Description:
        Maximal battery charge level. Accepted values are 80 or 100.

What:		/sys/devices/platform/lg-laptop/fan_mode
Date:		October 2018
KernelVersion:	4.20
Contact:	"Matan Ziv-Av <matan@svgalib.org>
Description:
        Control fan mode. 1 for performance mode, 0 for silent mode.

What:		/sys/devices/platform/lg-laptop/usb_charge
Date:		October 2018
KernelVersion:	4.20
Contact:	"Matan Ziv-Av <matan@svgalib.org>
Description:
        Control USB port charging when device is turned off.
        1 means on, 0 means off.
+81 −0
Original line number Diff line number Diff line
.. SPDX-License-Identifier: GPL-2.0+
LG Gram laptop extra features
=============================

By Matan Ziv-Av <matan@svgalib.org>


Hotkeys
-------

The following FN keys are ignored by the kernel without this driver:
- FN-F1 (LG control panel)   - Generates F15
- FN-F5 (Touchpad toggle)    - Generates F13
- FN-F6 (Airplane mode)      - Generates RFKILL
- FN-F8 (Keyboard backlight) - Generates F16.
  This key also changes keyboard backlight mode.
- FN-F9 (Reader mode)        - Generates F14

The rest of the FN key work without a need for a special driver.


Reader mode
-----------

Writing 0/1 to /sys/devices/platform/lg-laptop/reader_mode disables/enables
reader mode. In this mode the screen colors change (blue color reduced),
and the reader mode indicator LED (on F9 key) turns on.


FN Lock
-------

Writing 0/1 to /sys/devices/platform/lg-laptop/fn_lock disables/enables
FN lock.


Battery care limit
------------------

Writing 80/100 to /sys/devices/platform/lg-laptop/battery_care_limit
sets the maximum capacity to charge the battery. Limiting the charge
reduces battery capacity loss over time.

This value is reset to 100 when the kernel boots.


Fan mode
--------

Writing 1/0 to /sys/devices/platform/lg-laptop/fan_mode disables/enables
the fan silent mode.


USB charge
----------

Writing 0/1 to /sys/devices/platform/lg-laptop/usb_charge disables/enables
charging another device from the USB port while the device is turned off.

This value is reset to 0 when the kernel boots.


LEDs
~~~~

The are two LED devices supported by the driver:

Keyboard backlight
------------------

A led device named kbd_led controls the keyboard backlight. There are three
lighting level: off (0), low (127) and high (255).

The keyboard backlight is also controlled by the key combination FN-F8
which cycles through those levels.


Touchpad indicator LED
----------------------

On the F5 key. Controlled by led device names tpad_led.
+8 −0
Original line number Diff line number Diff line
@@ -8231,6 +8231,14 @@ W: http://legousb.sourceforge.net/
S:	Maintained
F:	drivers/usb/misc/legousbtower.c

LG LAPTOP EXTRAS
M:	Matan Ziv-Av <matan@svgalib.org>
L:	platform-driver-x86@vger.kernel.org
S:	Maintained
F:	Documentation/ABI/testing/sysfs-platform-lg-laptop
F:	Documentation/laptops/lg-laptop.rst
F:	drivers/platform/x86/lg-laptop.c

LG2160 MEDIA DRIVER
M:	Michael Krufky <mkrufky@linuxtv.org>
L:	linux-media@vger.kernel.org
+14 −0
Original line number Diff line number Diff line
@@ -367,6 +367,20 @@ config HP_WMI
	 To compile this driver as a module, choose M here: the module will
	 be called hp-wmi.

config LG_LAPTOP
	tristate "LG Laptop Extras"
	depends on ACPI
	depends on ACPI_WMI
	depends on INPUT
	select INPUT_SPARSEKMAP
	select LEDS_CLASS
	help
	 This driver adds support for hotkeys as well as control of keyboard
	 backlight, battery maximum charge level and various other ACPI
	 features.

	 If you have an LG Gram laptop, say Y or M here.

config MSI_LAPTOP
	tristate "MSI Laptop Extras"
	depends on ACPI
+1 −0
Original line number Diff line number Diff line
@@ -9,6 +9,7 @@ obj-$(CONFIG_ASUS_NB_WMI) += asus-nb-wmi.o
obj-$(CONFIG_ASUS_WIRELESS)	+= asus-wireless.o
obj-$(CONFIG_EEEPC_LAPTOP)	+= eeepc-laptop.o
obj-$(CONFIG_EEEPC_WMI)		+= eeepc-wmi.o
obj-$(CONFIG_LG_LAPTOP)		+= lg-laptop.o
obj-$(CONFIG_MSI_LAPTOP)	+= msi-laptop.o
obj-$(CONFIG_ACPI_CMPC)		+= classmate-laptop.o
obj-$(CONFIG_COMPAL_LAPTOP)	+= compal-laptop.o
Loading