Skip to content

Commit 605f884

Browse files
committed
Merge branch 'for_linus' of git://cavan.codon.org.uk/platform-drivers-x86
Pull x86 platform driver updates from Matthew Garrett: "A moderate number of changes, but nothing awfully significant. A lot of const cleanups, some reworking and additions to the rfkill quirks in the asus driver, a new driver for generating falling laptop events on Toshibas and some misc fixes. Maybe vendors have stopped inventing things" * 'for_linus' of git://cavan.codon.org.uk/platform-drivers-x86: (41 commits) platform/x86: Enable build support for toshiba_haps Documentation: Add file about toshiba_haps module platform/x86: Toshiba HDD Active Protection Sensor asus-nb-wmi: Add wapf4 quirk for the U32U alienware-wmi: make hdmi_mux enabled on case-by-case basis ideapad-laptop: Constify DMI table and other r/o variables asus-nb-wmi.c: Rename x401u quirk to wapf4 compal-laptop: correct invalid hwmon name toshiba_acpi: Add Qosmio X75-A to the alt keymap dmi list toshiba_acpi: Add extra check to backlight code Fix log message about future removal of interface ideapad-laptop: Disable touchpad interface on Yoga models asus-nb-wmi: Add wapf4 quirk for the X550CC intel_ips: Make ips_mcp_limits variables static thinkpad_acpi: Mark volume_alsa_control_{vol,mute} as __initdata fujitsu-laptop: Mark fujitsu_dmi_table[] DMI table as __initconst hp-wmi: Add missing __init annotations to initialization code hp_accel: Constify ACPI and DMI tables fujitsu-tablet: Mark DMI callbacks as __init code dell-laptop: Mark dell_quirks[] DMI table as __initconst ...
2 parents 4989900 + 186e4e8 commit 605f884

24 files changed

+608
-108
lines changed

Documentation/laptops/00-INDEX

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,5 @@ sonypi.txt
1818
- info on Linux Sony Programmable I/O Device support.
1919
thinkpad-acpi.txt
2020
- information on the (IBM and Lenovo) ThinkPad ACPI Extras driver.
21+
toshiba_haps.txt
22+
- information on the Toshiba HDD Active Protection Sensor driver.
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
Kernel driver toshiba_haps
2+
Toshiba HDD Active Protection Sensor
3+
====================================
4+
5+
Author: Azael Avalos <[email protected]>
6+
7+
8+
0. Contents
9+
-----------
10+
11+
1. Description
12+
2. Interface
13+
3. Accelerometer axes
14+
4. Supported devices
15+
5. Usage
16+
17+
18+
1. Description
19+
--------------
20+
21+
This driver provides support for the accelerometer found in various Toshiba
22+
laptops, being called "Toshiba HDD Protection - Shock Sensor" officialy,
23+
and detects laptops automatically with this device.
24+
On Windows, Toshiba provided software monitors this device and provides
25+
automatic HDD protection (head unload) on sudden moves or harsh vibrations,
26+
however, this driver only provides a notification via a sysfs file to let
27+
userspace tools or daemons act accordingly, as well as providing a sysfs
28+
file to set the desired protection level or sensor sensibility.
29+
30+
31+
2. Interface
32+
------------
33+
34+
This device comes with 3 methods:
35+
_STA - Checks existence of the device, returning Zero if the device does not
36+
exists or is not supported.
37+
PTLV - Sets the desired protection level.
38+
RSSS - Shuts down the HDD protection interface for a few seconds,
39+
then restores normal operation.
40+
41+
Note:
42+
The presence of Solid State Drives (SSD) can make this driver to fail loading,
43+
given the fact that such drives have no movable parts, and thus, not requiring
44+
any "protection" as well as failing during the evaluation of the _STA method
45+
found under this device.
46+
47+
48+
3. Accelerometer axes
49+
---------------------
50+
51+
This device does not report any axes, however, to query the sensor position
52+
a couple HCI (Hardware Configuration Interface) calls (0x6D and 0xA6) are
53+
provided to query such information, handled by the kernel module toshiba_acpi
54+
since kernel version 3.15.
55+
56+
57+
4. Supported devices
58+
--------------------
59+
60+
This driver binds itself to the ACPI device TOS620A, and any Toshiba laptop
61+
with this device is supported, given the fact that they have the presence of
62+
conventional HDD and not only SSD, or a combination of both HDD and SSD.
63+
64+
65+
5. Usage
66+
--------
67+
68+
The sysfs files under /sys/devices/LNXSYSTM:00/LNXSYBUS:00/TOS620A:00/ are:
69+
protection_level - The protection_level is readable and writeable, and
70+
provides a way to let userspace query the current protection
71+
level, as well as set the desired protection level, the
72+
available protection levels are:
73+
0 - Disabled | 1 - Low | 2 - Medium | 3 - High
74+
reset_protection - The reset_protection entry is writeable only, being "1"
75+
the only parameter it accepts, it is used to trigger
76+
a reset of the protection interface.

MAINTAINERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10017,7 +10017,7 @@ F: arch/x86/
1001710017
X86 PLATFORM DRIVERS
1001810018
M: Matthew Garrett <[email protected]>
1001910019
10020-
T: git git://git.kernel.org/pub/scm/linux/kernel/git/mjg59/platform-drivers-x86.git
10020+
T: git git://cavan.codon.org.uk/platform-drivers-x86.git
1002110021
S: Maintained
1002210022
F: drivers/platform/x86/
1002310023

drivers/platform/x86/Kconfig

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -652,6 +652,25 @@ config TOSHIBA_BT_RFKILL
652652
If you have a modern Toshiba laptop with a Bluetooth and an
653653
RFKill switch (such as the Portege R500), say Y.
654654

655+
config TOSHIBA_HAPS
656+
tristate "Toshiba HDD Active Protection Sensor"
657+
depends on ACPI
658+
---help---
659+
This driver adds support for the built-in accelerometer
660+
found on recent Toshiba laptops equiped with HID TOS620A
661+
device.
662+
663+
This driver receives ACPI notify events 0x80 when the sensor
664+
detects a sudden move or a harsh vibration, as well as an
665+
ACPI notify event 0x81 whenever the movement or vibration has
666+
been stabilized.
667+
668+
Also provides sysfs entries to get/set the desired protection
669+
level and reseting the HDD protection interface.
670+
671+
If you have a recent Toshiba laptop with a built-in accelerometer
672+
device, say Y.
673+
655674
config ACPI_CMPC
656675
tristate "CMPC Laptop Extras"
657676
depends on X86 && ACPI

drivers/platform/x86/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ obj-$(CONFIG_TOPSTAR_LAPTOP) += topstar-laptop.o
3838
obj-$(CONFIG_ACPI_TOSHIBA) += toshiba_acpi.o
3939

4040
obj-$(CONFIG_TOSHIBA_BT_RFKILL) += toshiba_bluetooth.o
41+
obj-$(CONFIG_TOSHIBA_HAPS) += toshiba_haps.o
4142
obj-$(CONFIG_INTEL_SCU_IPC) += intel_scu_ipc.o
4243
obj-$(CONFIG_INTEL_SCU_IPC_UTIL) += intel_scu_ipcutil.o
4344
obj-$(CONFIG_INTEL_MFLD_THERMAL) += intel_mid_thermal.o

drivers/platform/x86/acer-wmi.c

Lines changed: 30 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ enum acer_wmi_event_ids {
9696
WMID_ACCEL_EVENT = 0x5,
9797
};
9898

99-
static const struct key_entry acer_wmi_keymap[] = {
99+
static const struct key_entry acer_wmi_keymap[] __initconst = {
100100
{KE_KEY, 0x01, {KEY_WLAN} }, /* WiFi */
101101
{KE_KEY, 0x03, {KEY_WLAN} }, /* WiFi */
102102
{KE_KEY, 0x04, {KEY_WLAN} }, /* WiFi */
@@ -294,7 +294,7 @@ struct quirk_entry {
294294

295295
static struct quirk_entry *quirks;
296296

297-
static void set_quirks(void)
297+
static void __init set_quirks(void)
298298
{
299299
if (!interface)
300300
return;
@@ -306,7 +306,7 @@ static void set_quirks(void)
306306
interface->capability |= ACER_CAP_BRIGHTNESS;
307307
}
308308

309-
static int dmi_matched(const struct dmi_system_id *dmi)
309+
static int __init dmi_matched(const struct dmi_system_id *dmi)
310310
{
311311
quirks = dmi->driver_data;
312312
return 1;
@@ -337,7 +337,7 @@ static struct quirk_entry quirk_lenovo_ideapad_s205 = {
337337
};
338338

339339
/* The Aspire One has a dummy ACPI-WMI interface - disable it */
340-
static struct dmi_system_id acer_blacklist[] = {
340+
static const struct dmi_system_id acer_blacklist[] __initconst = {
341341
{
342342
.ident = "Acer Aspire One (SSD)",
343343
.matches = {
@@ -355,7 +355,7 @@ static struct dmi_system_id acer_blacklist[] = {
355355
{}
356356
};
357357

358-
static struct dmi_system_id acer_quirks[] = {
358+
static const struct dmi_system_id acer_quirks[] __initconst = {
359359
{
360360
.callback = dmi_matched,
361361
.ident = "Acer Aspire 1360",
@@ -530,14 +530,15 @@ static struct dmi_system_id acer_quirks[] = {
530530
{}
531531
};
532532

533-
static int video_set_backlight_video_vendor(const struct dmi_system_id *d)
533+
static int __init
534+
video_set_backlight_video_vendor(const struct dmi_system_id *d)
534535
{
535536
interface->capability &= ~ACER_CAP_BRIGHTNESS;
536537
pr_info("Brightness must be controlled by generic video driver\n");
537538
return 0;
538539
}
539540

540-
static const struct dmi_system_id video_vendor_dmi_table[] = {
541+
static const struct dmi_system_id video_vendor_dmi_table[] __initconst = {
541542
{
542543
.callback = video_set_backlight_video_vendor,
543544
.ident = "Acer TravelMate 4750",
@@ -582,7 +583,7 @@ static const struct dmi_system_id video_vendor_dmi_table[] = {
582583
};
583584

584585
/* Find which quirks are needed for a particular vendor/ model pair */
585-
static void find_quirks(void)
586+
static void __init find_quirks(void)
586587
{
587588
if (!force_series) {
588589
dmi_check_system(acer_quirks);
@@ -749,7 +750,7 @@ static acpi_status AMW0_set_u32(u32 value, u32 cap)
749750
return wmab_execute(&args, NULL);
750751
}
751752

752-
static acpi_status AMW0_find_mailled(void)
753+
static acpi_status __init AMW0_find_mailled(void)
753754
{
754755
struct wmab_args args;
755756
struct wmab_ret ret;
@@ -781,24 +782,24 @@ static acpi_status AMW0_find_mailled(void)
781782
return AE_OK;
782783
}
783784

784-
static int AMW0_set_cap_acpi_check_device_found;
785+
static int AMW0_set_cap_acpi_check_device_found __initdata;
785786

786-
static acpi_status AMW0_set_cap_acpi_check_device_cb(acpi_handle handle,
787+
static acpi_status __init AMW0_set_cap_acpi_check_device_cb(acpi_handle handle,
787788
u32 level, void *context, void **retval)
788789
{
789790
AMW0_set_cap_acpi_check_device_found = 1;
790791
return AE_OK;
791792
}
792793

793-
static const struct acpi_device_id norfkill_ids[] = {
794+
static const struct acpi_device_id norfkill_ids[] __initconst = {
794795
{ "VPC2004", 0},
795796
{ "IBM0068", 0},
796797
{ "LEN0068", 0},
797798
{ "SNY5001", 0}, /* sony-laptop in charge */
798799
{ "", 0},
799800
};
800801

801-
static int AMW0_set_cap_acpi_check_device(void)
802+
static int __init AMW0_set_cap_acpi_check_device(void)
802803
{
803804
const struct acpi_device_id *id;
804805

@@ -808,7 +809,7 @@ static int AMW0_set_cap_acpi_check_device(void)
808809
return AMW0_set_cap_acpi_check_device_found;
809810
}
810811

811-
static acpi_status AMW0_set_capabilities(void)
812+
static acpi_status __init AMW0_set_capabilities(void)
812813
{
813814
struct wmab_args args;
814815
struct wmab_ret ret;
@@ -1184,7 +1185,7 @@ static acpi_status wmid_v2_set_u32(u32 value, u32 cap)
11841185
return wmid3_set_device_status(value, device);
11851186
}
11861187

1187-
static void type_aa_dmi_decode(const struct dmi_header *header, void *dummy)
1188+
static void __init type_aa_dmi_decode(const struct dmi_header *header, void *d)
11881189
{
11891190
struct hotkey_function_type_aa *type_aa;
11901191

@@ -1209,7 +1210,7 @@ static void type_aa_dmi_decode(const struct dmi_header *header, void *dummy)
12091210
commun_fn_key_number = type_aa->commun_fn_key_number;
12101211
}
12111212

1212-
static acpi_status WMID_set_capabilities(void)
1213+
static acpi_status __init WMID_set_capabilities(void)
12131214
{
12141215
struct acpi_buffer out = {ACPI_ALLOCATE_BUFFER, NULL};
12151216
union acpi_object *obj;
@@ -1658,7 +1659,7 @@ static ssize_t show_bool_threeg(struct device *dev,
16581659
u32 result; \
16591660
acpi_status status;
16601661

1661-
pr_info("This threeg sysfs will be removed in 2012 - used by: %s\n",
1662+
pr_info("This threeg sysfs will be removed in 2014 - used by: %s\n",
16621663
current->comm);
16631664
status = get_u32(&result, ACER_CAP_THREEG);
16641665
if (ACPI_SUCCESS(status))
@@ -1671,7 +1672,7 @@ static ssize_t set_bool_threeg(struct device *dev,
16711672
{
16721673
u32 tmp = simple_strtoul(buf, NULL, 10);
16731674
acpi_status status = set_u32(tmp, ACER_CAP_THREEG);
1674-
pr_info("This threeg sysfs will be removed in 2012 - used by: %s\n",
1675+
pr_info("This threeg sysfs will be removed in 2014 - used by: %s\n",
16751676
current->comm);
16761677
if (ACPI_FAILURE(status))
16771678
return -EINVAL;
@@ -1683,7 +1684,7 @@ static DEVICE_ATTR(threeg, S_IRUGO | S_IWUSR, show_bool_threeg,
16831684
static ssize_t show_interface(struct device *dev, struct device_attribute *attr,
16841685
char *buf)
16851686
{
1686-
pr_info("This interface sysfs will be removed in 2012 - used by: %s\n",
1687+
pr_info("This interface sysfs will be removed in 2014 - used by: %s\n",
16871688
current->comm);
16881689
switch (interface->type) {
16891690
case ACER_AMW0:
@@ -1777,7 +1778,7 @@ static void acer_wmi_notify(u32 value, void *context)
17771778
}
17781779
}
17791780

1780-
static acpi_status
1781+
static acpi_status __init
17811782
wmid3_set_lm_mode(struct lm_input_params *params,
17821783
struct lm_return_value *return_value)
17831784
{
@@ -1811,7 +1812,7 @@ wmid3_set_lm_mode(struct lm_input_params *params,
18111812
return status;
18121813
}
18131814

1814-
static int acer_wmi_enable_ec_raw(void)
1815+
static int __init acer_wmi_enable_ec_raw(void)
18151816
{
18161817
struct lm_return_value return_value;
18171818
acpi_status status;
@@ -1834,7 +1835,7 @@ static int acer_wmi_enable_ec_raw(void)
18341835
return status;
18351836
}
18361837

1837-
static int acer_wmi_enable_lm(void)
1838+
static int __init acer_wmi_enable_lm(void)
18381839
{
18391840
struct lm_return_value return_value;
18401841
acpi_status status;
@@ -2043,6 +2044,7 @@ static int acer_platform_remove(struct platform_device *device)
20432044
return 0;
20442045
}
20452046

2047+
#ifdef CONFIG_PM_SLEEP
20462048
static int acer_suspend(struct device *dev)
20472049
{
20482050
u32 value;
@@ -2083,6 +2085,10 @@ static int acer_resume(struct device *dev)
20832085

20842086
return 0;
20852087
}
2088+
#else
2089+
#define acer_suspend NULL
2090+
#define acer_resume NULL
2091+
#endif
20862092

20872093
static SIMPLE_DEV_PM_OPS(acer_pm, acer_suspend, acer_resume);
20882094

@@ -2120,7 +2126,7 @@ static int remove_sysfs(struct platform_device *device)
21202126
return 0;
21212127
}
21222128

2123-
static int create_sysfs(void)
2129+
static int __init create_sysfs(void)
21242130
{
21252131
int retval = -ENOMEM;
21262132

@@ -2149,7 +2155,7 @@ static void remove_debugfs(void)
21492155
debugfs_remove(interface->debug.root);
21502156
}
21512157

2152-
static int create_debugfs(void)
2158+
static int __init create_debugfs(void)
21532159
{
21542160
interface->debug.root = debugfs_create_dir("acer-wmi", NULL);
21552161
if (!interface->debug.root) {

0 commit comments

Comments
 (0)