Skip to content

Commit 78d4256

Browse files
committed
Merge tag 'platform-drivers-x86-v4.1-1' of git://git.infradead.org/users/dvhart/linux-platform-drivers-x86
Pull x86 platform driver updates from Darren Hart: "This series includes significant updates to the toshiba_acpi driver and the reintroduction of the dell-laptop keyboard backlight additions I had to revert previously. Also included are various fixes for typos, warnings, correctness, and minor bugs. Specifics: dell-laptop: - add support for keyboard backlight. toshiba_acpi: - adaptive keyboard, hotkey, USB sleep and charge, and backlight updates. Update sysfs documentation. toshiba_bluetooth: - fix enabling/disabling loop on recent devices apple-gmux: - lock iGP IO to protect from vgaarb changes other: - Fix typos, clear gcc warnings, clarify pr_* messages, correct return types, update MAINTAINERS" * tag 'platform-drivers-x86-v4.1-1' of git://git.infradead.org/users/dvhart/linux-platform-drivers-x86: (25 commits) toshiba_acpi: Do not register vendor backlight when acpi_video bl is available MAINTAINERS: Add me on list of Dell laptop drivers platform: x86: dell-laptop: Add support for keyboard backlight Documentation/ABI: Update sysfs-driver-toshiba_acpi entry toshiba_acpi: Fix pr_* messages from USB Sleep Functions toshiba_acpi: Update and fix USB Sleep and Charge modes wmi: Use bool function return values of true/false not 1/0 toshiba_bluetooth: Fix enabling/disabling loop on recent devices toshiba_bluetooth: Clean up *_add function and disable BT device at removal toshiba_bluetooth: Add three new functions to the driver toshiba_acpi: Fix the enabling of the Special Functions toshiba_acpi: Use the Hotkey Event Type function for keymap choosing toshiba_acpi: Add Hotkey Event Type function and definitions x86/wmi: delete unused wmi_data_lock mutex causing gcc warning apple-gmux: lock iGP IO to protect from vgaarb changes MAINTAINERS: Add missing Toshiba devices and add myself as maintainer toshiba_acpi: Update events in toshiba_acpi_notify intel-oaktrail: Fix trivial typo in comment thinkpad_acpi: off by one in adaptive_keyboard_hotkey_notify_hotkey() thinkpad_acpi: signedness bugs getting current_mode ...
2 parents 36a8032 + 358d6a2 commit 78d4256

File tree

12 files changed

+1838
-218
lines changed

12 files changed

+1838
-218
lines changed

Documentation/ABI/testing/sysfs-driver-toshiba_acpi

Lines changed: 80 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,11 @@ Description: This file controls the keyboard backlight operation mode, valid
88
* 0x2 -> AUTO (also called TIMER)
99
* 0x8 -> ON
1010
* 0x10 -> OFF
11-
Note that the kernel 3.16 onwards this file accepts all listed
11+
Note that from kernel 3.16 onwards this file accepts all listed
1212
parameters, kernel 3.15 only accepts the first two (FN-Z and
1313
AUTO).
14+
Also note that toggling this value on type 1 devices, requires
15+
a reboot for changes to take effect.
1416
Users: KToshiba
1517

1618
What: /sys/devices/LNXSYSTM:00/LNXSYBUS:00/TOS{1900,620{0,7,8}}:00/kbd_backlight_timeout
@@ -67,24 +69,81 @@ Description: This file shows the current keyboard backlight type,
6769
* 2 -> Type 2, supporting modes TIMER, ON and OFF
6870
Users: KToshiba
6971

72+
What: /sys/devices/LNXSYSTM:00/LNXSYBUS:00/TOS{1900,620{0,7,8}}:00/usb_sleep_charge
73+
Date: January 23, 2015
74+
KernelVersion: 4.0
75+
Contact: Azael Avalos <[email protected]>
76+
Description: This file controls the USB Sleep & Charge charging mode, which
77+
can be:
78+
* 0 -> Disabled (0x00)
79+
* 1 -> Alternate (0x09)
80+
* 2 -> Auto (0x21)
81+
* 3 -> Typical (0x11)
82+
Note that from kernel 4.1 onwards this file accepts all listed
83+
values, kernel 4.0 only supports the first three.
84+
Note that this feature only works when connected to power, if
85+
you want to use it under battery, see the entry named
86+
"sleep_functions_on_battery"
87+
Users: KToshiba
88+
89+
What: /sys/devices/LNXSYSTM:00/LNXSYBUS:00/TOS{1900,620{0,7,8}}:00/sleep_functions_on_battery
90+
Date: January 23, 2015
91+
KernelVersion: 4.0
92+
Contact: Azael Avalos <[email protected]>
93+
Description: This file controls the USB Sleep Functions under battery, and
94+
set the level at which point they will be disabled, accepted
95+
values can be:
96+
* 0 -> Disabled
97+
* 1-100 -> Battery level to disable sleep functions
98+
Currently it prints two values, the first one indicates if the
99+
feature is enabled or disabled, while the second one shows the
100+
current battery level set.
101+
Note that when the value is set to disabled, the sleep function
102+
will only work when connected to power.
103+
Users: KToshiba
104+
105+
What: /sys/devices/LNXSYSTM:00/LNXSYBUS:00/TOS{1900,620{0,7,8}}:00/usb_rapid_charge
106+
Date: January 23, 2015
107+
KernelVersion: 4.0
108+
Contact: Azael Avalos <[email protected]>
109+
Description: This file controls the USB Rapid Charge state, which can be:
110+
* 0 -> Disabled
111+
* 1 -> Enabled
112+
Note that toggling this value requires a reboot for changes to
113+
take effect.
114+
Users: KToshiba
115+
116+
What: /sys/devices/LNXSYSTM:00/LNXSYBUS:00/TOS{1900,620{0,7,8}}:00/usb_sleep_music
117+
Date: January 23, 2015
118+
KernelVersion: 4.0
119+
Contact: Azael Avalos <[email protected]>
120+
Description: This file controls the Sleep & Music state, which values can be:
121+
* 0 -> Disabled
122+
* 1 -> Enabled
123+
Note that this feature only works when connected to power, if
124+
you want to use it under battery, see the entry named
125+
"sleep_functions_on_battery"
126+
Users: KToshiba
127+
70128
What: /sys/devices/LNXSYSTM:00/LNXSYBUS:00/TOS{1900,620{0,7,8}}:00/version
71-
Date: February, 2015
72-
KernelVersion: 3.20
129+
Date: February 12, 2015
130+
KernelVersion: 4.0
73131
Contact: Azael Avalos <[email protected]>
74132
Description: This file shows the current version of the driver
133+
Users: KToshiba
75134

76135
What: /sys/devices/LNXSYSTM:00/LNXSYBUS:00/TOS{1900,620{0,7,8}}:00/fan
77-
Date: February, 2015
78-
KernelVersion: 3.20
136+
Date: February 12, 2015
137+
KernelVersion: 4.0
79138
Contact: Azael Avalos <[email protected]>
80139
Description: This file controls the state of the internal fan, valid
81140
values are:
82141
* 0 -> OFF
83142
* 1 -> ON
84143

85144
What: /sys/devices/LNXSYSTM:00/LNXSYBUS:00/TOS{1900,620{0,7,8}}:00/kbd_function_keys
86-
Date: February, 2015
87-
KernelVersion: 3.20
145+
Date: February 12, 2015
146+
KernelVersion: 4.0
88147
Contact: Azael Avalos <[email protected]>
89148
Description: This file controls the Special Functions (hotkeys) operation
90149
mode, valid values are:
@@ -94,21 +153,29 @@ Description: This file controls the Special Functions (hotkeys) operation
94153
and the hotkeys are accessed via FN-F{1-12}.
95154
In the "Special Functions" mode, the F{1-12} keys trigger the
96155
hotkey and the F{1-12} keys are accessed via FN-F{1-12}.
156+
Note that toggling this value requires a reboot for changes to
157+
take effect.
158+
Users: KToshiba
97159

98160
What: /sys/devices/LNXSYSTM:00/LNXSYBUS:00/TOS{1900,620{0,7,8}}:00/panel_power_on
99-
Date: February, 2015
100-
KernelVersion: 3.20
161+
Date: February 12, 2015
162+
KernelVersion: 4.0
101163
Contact: Azael Avalos <[email protected]>
102164
Description: This file controls whether the laptop should turn ON whenever
103165
the LID is opened, valid values are:
104166
* 0 -> Disabled
105167
* 1 -> Enabled
168+
Note that toggling this value requires a reboot for changes to
169+
take effect.
170+
Users: KToshiba
106171

107172
What: /sys/devices/LNXSYSTM:00/LNXSYBUS:00/TOS{1900,620{0,7,8}}:00/usb_three
108-
Date: February, 2015
109-
KernelVersion: 3.20
173+
Date: February 12, 2015
174+
KernelVersion: 4.0
110175
Contact: Azael Avalos <[email protected]>
111-
Description: This file controls whether the USB 3 functionality, valid
112-
values are:
176+
Description: This file controls the USB 3 functionality, valid values are:
113177
* 0 -> Disabled (Acts as a regular USB 2)
114178
* 1 -> Enabled (Full USB 3 functionality)
179+
Note that toggling this value requires a reboot for changes to
180+
take effect.
181+
Users: KToshiba
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
What: /sys/class/leds/dell::kbd_backlight/als_enabled
2+
Date: December 2014
3+
KernelVersion: 3.19
4+
Contact: Gabriele Mazzotta <[email protected]>,
5+
Pali Rohár <[email protected]>
6+
Description:
7+
This file allows to control the automatic keyboard
8+
illumination mode on some systems that have an ambient
9+
light sensor. Write 1 to this file to enable the auto
10+
mode, 0 to disable it.
11+
12+
What: /sys/class/leds/dell::kbd_backlight/als_setting
13+
Date: December 2014
14+
KernelVersion: 3.19
15+
Contact: Gabriele Mazzotta <[email protected]>,
16+
Pali Rohár <[email protected]>
17+
Description:
18+
This file allows to specifiy the on/off threshold value,
19+
as reported by the ambient light sensor.
20+
21+
What: /sys/class/leds/dell::kbd_backlight/start_triggers
22+
Date: December 2014
23+
KernelVersion: 3.19
24+
Contact: Gabriele Mazzotta <[email protected]>,
25+
Pali Rohár <[email protected]>
26+
Description:
27+
This file allows to control the input triggers that
28+
turn on the keyboard backlight illumination that is
29+
disabled because of inactivity.
30+
Read the file to see the triggers available. The ones
31+
enabled are preceded by '+', those disabled by '-'.
32+
33+
To enable a trigger, write its name preceded by '+' to
34+
this file. To disable a trigger, write its name preceded
35+
by '-' instead.
36+
37+
For example, to enable the keyboard as trigger run:
38+
echo +keyboard > /sys/class/leds/dell::kbd_backlight/start_triggers
39+
To disable it:
40+
echo -keyboard > /sys/class/leds/dell::kbd_backlight/start_triggers
41+
42+
Note that not all the available triggers can be configured.
43+
44+
What: /sys/class/leds/dell::kbd_backlight/stop_timeout
45+
Date: December 2014
46+
KernelVersion: 3.19
47+
Contact: Gabriele Mazzotta <[email protected]>,
48+
Pali Rohár <[email protected]>
49+
Description:
50+
This file allows to specify the interval after which the
51+
keyboard illumination is disabled because of inactivity.
52+
The timeouts are expressed in seconds, minutes, hours and
53+
days, for which the symbols are 's', 'm', 'h' and 'd'
54+
respectively.
55+
56+
To configure the timeout, write to this file a value along
57+
with any the above units. If no unit is specified, the value
58+
is assumed to be expressed in seconds.
59+
60+
For example, to set the timeout to 10 minutes run:
61+
echo 10m > /sys/class/leds/dell::kbd_backlight/stop_timeout
62+
63+
Note that when this file is read, the returned value might be
64+
expressed in a different unit than the one used when the timeout
65+
was set.
66+
67+
Also note that only some timeouts are supported and that
68+
some systems might fall back to a specific timeout in case
69+
an invalid timeout is written to this file.

Documentation/laptops/thinkpad-acpi.txt

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1355,6 +1355,24 @@ Sysfs notes:
13551355
rfkill controller switch "tpacpi_uwb_sw": refer to
13561356
Documentation/rfkill.txt for details.
13571357

1358+
Adaptive keyboard
1359+
-----------------
1360+
1361+
sysfs device attribute: adaptive_kbd_mode
1362+
1363+
This sysfs attribute controls the keyboard "face" that will be shown on the
1364+
Lenovo X1 Carbon 2nd gen (2014)'s adaptive keyboard. The value can be read
1365+
and set.
1366+
1367+
1 = Home mode
1368+
2 = Web-browser mode
1369+
3 = Web-conference mode
1370+
4 = Function mode
1371+
5 = Layflat mode
1372+
1373+
For more details about which buttons will appear depending on the mode, please
1374+
review the laptop's user guide:
1375+
http://www.lenovo.com/shop/americas/content/user_guides/x1carbon_2_ug_en.pdf
13581376

13591377
Multiple Commands, Module Parameters
13601378
------------------------------------

MAINTAINERS

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3066,10 +3066,16 @@ F: drivers/net/fddi/defxx.*
30663066

30673067
DELL LAPTOP DRIVER
30683068
M: Matthew Garrett <[email protected]>
3069+
M: Pali Rohár <[email protected]>
30693070
30703071
S: Maintained
30713072
F: drivers/platform/x86/dell-laptop.c
30723073

3074+
DELL LAPTOP FREEFALL DRIVER
3075+
M: Pali Rohár <[email protected]>
3076+
S: Maintained
3077+
F: drivers/platform/x86/dell-smo8800.c
3078+
30733079
DELL LAPTOP SMM DRIVER
30743080
M: Guenter Roeck <[email protected]>
30753081
S: Maintained
@@ -3084,6 +3090,7 @@ F: drivers/firmware/dcdbas.*
30843090

30853091
DELL WMI EXTRAS DRIVER
30863092
M: Matthew Garrett <[email protected]>
3093+
M: Pali Rohár <[email protected]>
30873094
S: Maintained
30883095
F: drivers/platform/x86/dell-wmi.c
30893096

@@ -9949,10 +9956,23 @@ S: Maintained
99499956
F: drivers/platform/x86/topstar-laptop.c
99509957

99519958
TOSHIBA ACPI EXTRAS DRIVER
9959+
M: Azael Avalos <[email protected]>
99529960
9953-
S: Orphan
9961+
S: Maintained
99549962
F: drivers/platform/x86/toshiba_acpi.c
99559963

9964+
TOSHIBA BLUETOOTH DRIVER
9965+
M: Azael Avalos <[email protected]>
9966+
9967+
S: Maintained
9968+
F: drivers/platform/x86/toshiba_bluetooth.c
9969+
9970+
TOSHIBA HDD ACTIVE PROTECTION SENSOR DRIVER
9971+
M: Azael Avalos <[email protected]>
9972+
9973+
S: Maintained
9974+
F: drivers/platform/x86/toshiba_haps.c
9975+
99569976
TOSHIBA SMM DRIVER
99579977
M: Jonathan Buzzard <[email protected]>
99589978

drivers/platform/x86/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -614,6 +614,7 @@ config ACPI_TOSHIBA
614614
depends on INPUT
615615
depends on RFKILL || RFKILL = n
616616
depends on SERIO_I8042 || SERIO_I8042 = n
617+
depends on ACPI_VIDEO || ACPI_VIDEO = n
617618
select INPUT_POLLDEV
618619
select INPUT_SPARSEKMAP
619620
---help---

drivers/platform/x86/apple-gmux.c

Lines changed: 47 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#include <linux/delay.h>
2323
#include <linux/pci.h>
2424
#include <linux/vga_switcheroo.h>
25+
#include <linux/vgaarb.h>
2526
#include <acpi/video.h>
2627
#include <asm/io.h>
2728

@@ -31,6 +32,7 @@ struct apple_gmux_data {
3132
bool indexed;
3233
struct mutex index_lock;
3334

35+
struct pci_dev *pdev;
3436
struct backlight_device *bdev;
3537

3638
/* switcheroo data */
@@ -415,6 +417,23 @@ static int gmux_resume(struct device *dev)
415417
return 0;
416418
}
417419

420+
static struct pci_dev *gmux_get_io_pdev(void)
421+
{
422+
struct pci_dev *pdev = NULL;
423+
424+
while ((pdev = pci_get_class(PCI_CLASS_DISPLAY_VGA << 8, pdev))) {
425+
u16 cmd;
426+
427+
pci_read_config_word(pdev, PCI_COMMAND, &cmd);
428+
if (!(cmd & PCI_COMMAND_IO))
429+
continue;
430+
431+
return pdev;
432+
}
433+
434+
return NULL;
435+
}
436+
418437
static int gmux_probe(struct pnp_dev *pnp, const struct pnp_device_id *id)
419438
{
420439
struct apple_gmux_data *gmux_data;
@@ -425,6 +444,7 @@ static int gmux_probe(struct pnp_dev *pnp, const struct pnp_device_id *id)
425444
int ret = -ENXIO;
426445
acpi_status status;
427446
unsigned long long gpe;
447+
struct pci_dev *pdev = NULL;
428448

429449
if (apple_gmux_data)
430450
return -EBUSY;
@@ -475,14 +495,31 @@ static int gmux_probe(struct pnp_dev *pnp, const struct pnp_device_id *id)
475495
ver_minor = (version >> 16) & 0xff;
476496
ver_release = (version >> 8) & 0xff;
477497
} else {
478-
pr_info("gmux device not present\n");
498+
pr_info("gmux device not present or IO disabled\n");
479499
ret = -ENODEV;
480500
goto err_release;
481501
}
482502
}
483503
pr_info("Found gmux version %d.%d.%d [%s]\n", ver_major, ver_minor,
484504
ver_release, (gmux_data->indexed ? "indexed" : "classic"));
485505

506+
/*
507+
* Apple systems with gmux are EFI based and normally don't use
508+
* VGA. In addition changing IO+MEM ownership between IGP and dGPU
509+
* disables IO/MEM used for backlight control on some systems.
510+
* Lock IO+MEM to GPU with active IO to prevent switch.
511+
*/
512+
pdev = gmux_get_io_pdev();
513+
if (pdev && vga_tryget(pdev,
514+
VGA_RSRC_NORMAL_IO | VGA_RSRC_NORMAL_MEM)) {
515+
pr_err("IO+MEM vgaarb-locking for PCI:%s failed\n",
516+
pci_name(pdev));
517+
ret = -EBUSY;
518+
goto err_release;
519+
} else if (pdev)
520+
pr_info("locked IO for PCI:%s\n", pci_name(pdev));
521+
gmux_data->pdev = pdev;
522+
486523
memset(&props, 0, sizeof(props));
487524
props.type = BACKLIGHT_PLATFORM;
488525
props.max_brightness = gmux_read32(gmux_data, GMUX_PORT_MAX_BRIGHTNESS);
@@ -574,6 +611,10 @@ static int gmux_probe(struct pnp_dev *pnp, const struct pnp_device_id *id)
574611
err_notify:
575612
backlight_device_unregister(bdev);
576613
err_release:
614+
if (gmux_data->pdev)
615+
vga_put(gmux_data->pdev,
616+
VGA_RSRC_NORMAL_IO | VGA_RSRC_NORMAL_MEM);
617+
pci_dev_put(pdev);
577618
release_region(gmux_data->iostart, gmux_data->iolen);
578619
err_free:
579620
kfree(gmux_data);
@@ -593,6 +634,11 @@ static void gmux_remove(struct pnp_dev *pnp)
593634
&gmux_notify_handler);
594635
}
595636

637+
if (gmux_data->pdev) {
638+
vga_put(gmux_data->pdev,
639+
VGA_RSRC_NORMAL_IO | VGA_RSRC_NORMAL_MEM);
640+
pci_dev_put(gmux_data->pdev);
641+
}
596642
backlight_device_unregister(gmux_data->bdev);
597643

598644
release_region(gmux_data->iostart, gmux_data->iolen);

0 commit comments

Comments
 (0)