提交 3af6e98f 编写于 作者: L Linus Torvalds

Merge tag 'platform-drivers-x86-v4.3-1' of...

Merge tag 'platform-drivers-x86-v4.3-1' of git://git.infradead.org/users/dvhart/linux-platform-drivers-x86

Pull x86 platform driver updates from Darren Hart:
 "Significant work on toshiba_acpi, including new hardware support,
  refactoring, and cleanups.  Extend device support for asus, ideapad,
  and acer systems.  New surface pro 3 buttons driver.  Misc minor
  cleanups for thinkpad and hp-wireless.

  acer-wmi:
   - No rfkill on HP Omen 15 wifi

  thinkpad_acpi:
   - Remove side effects from vdbg_printk -> no_printk macro

  surface pro 3:
   - Add support driver for Surface Pro 3 buttons

  hp-wireless:
   - remove unneeded goto/label in hpwl_init

  ideapad-laptop:
   - add alternative representation for Yoga 2 to DMI table
   - Add Lenovo Yoga 3 14 to no_hw_rfkill dmi list

  asus-laptop:
   - Add key found on Asus F3M

  MAINTAINERS:
   - Remove Toshiba Linux mailing list address

  toshiba_acpi:
   - Bump driver version to 0.23
   - Remove unnecessary checks and returns in HCI/SCI functions
   - Refactor *{get, set} functions return value
   - Remove "*not supported" feature prints
   - Change *available functions return type
   - Add set_fan_status function
   - Change some variables to avoid warnings from ninja-check
   - Reorder toshiba_acpi_alt_keymap entries
   - Remove unused wireless defines
   - Transflective backlight updates
   - Avoid registering input device on WMI event laptops
   - Add /dev/toshiba_acpi device
   - Adapt /proc/acpi/toshiba/keys to TOS1900 devices"

* tag 'platform-drivers-x86-v4.3-1' of git://git.infradead.org/users/dvhart/linux-platform-drivers-x86: (21 commits)
  acer-wmi: No rfkill on HP Omen 15 wifi
  thinkpad_acpi: Remove side effects from vdbg_printk -> no_printk macro
  surface pro 3: Add support driver for Surface Pro 3 buttons
  hp-wireless: remove unneeded goto/label in hpwl_init
  ideapad-laptop: add alternative representation for Yoga 2 to DMI table
  asus-laptop: Add key found on Asus F3M
  MAINTAINERS: Remove Toshiba Linux mailing list address
  ideapad-laptop: Add Lenovo Yoga 3 14 to no_hw_rfkill dmi list
  toshiba_acpi: Bump driver version to 0.23
  toshiba_acpi: Remove unnecessary checks and returns in HCI/SCI functions
  toshiba_acpi: Refactor *{get, set} functions return value
  toshiba_acpi: Remove "*not supported" feature prints
  toshiba_acpi: Change *available functions return type
  toshiba_acpi: Add set_fan_status function
  toshiba_acpi: Change some variables to avoid warnings from ninja-check
  toshiba_acpi: Reorder toshiba_acpi_alt_keymap entries
  toshiba_acpi: Remove unused wireless defines
  toshiba_acpi: Transflective backlight updates
  toshiba_acpi: Avoid registering input device on WMI event laptops
  toshiba_acpi: Add /dev/toshiba_acpi device
  ...
......@@ -265,7 +265,7 @@ Code Seq#(hex) Include File Comments
's' all linux/cdk.h
't' 00-7F linux/ppp-ioctl.h
't' 80-8F linux/isdn_ppp.h
't' 90 linux/toshiba.h
't' 90-91 linux/toshiba.h toshiba and toshiba_acpi SMM
'u' 00-1F linux/smb_fs.h gone
'u' 20-3F linux/uvcvideo.h USB video class host driver
'v' 00-1F linux/ext2_fs.h conflict!
......
......@@ -6847,6 +6847,12 @@ T: git git://git.monstr.eu/linux-2.6-microblaze.git
S: Supported
F: arch/microblaze/
MICROSOFT SURFACE PRO 3 BUTTON DRIVER
M: Chen Yu <yu.c.chen@intel.com>
L: platform-driver-x86@vger.kernel.org
S: Supported
F: drivers/platform/x86/surfacepro3_button.c
MICROTEK X6 SCANNER
M: Oliver Neukum <oliver@neukum.org>
S: Maintained
......@@ -10489,7 +10495,6 @@ F: drivers/platform/x86/toshiba_haps.c
TOSHIBA SMM DRIVER
M: Jonathan Buzzard <jonathan@buzzard.org.uk>
L: tlinux-users@tce.toshiba-dme.co.jp
W: http://www.buzzard.org.uk/toshiba/
S: Maintained
F: drivers/char/toshiba.c
......
......@@ -919,4 +919,9 @@ config INTEL_PMC_IPC
The PMC is an ARC processor which defines IPC commands for communication
with other entities in the CPU.
config SURFACE_PRO3_BUTTON
tristate "Power/home/volume buttons driver for Microsoft Surface Pro 3 tablet"
depends on ACPI && INPUT
---help---
This driver handles the power/home/volume buttons on the Microsoft Surface Pro 3 tablet.
endif # X86_PLATFORM_DEVICES
......@@ -60,3 +60,4 @@ obj-$(CONFIG_INTEL_SMARTCONNECT) += intel-smartconnect.o
obj-$(CONFIG_PVPANIC) += pvpanic.o
obj-$(CONFIG_ALIENWARE_WMI) += alienware-wmi.o
obj-$(CONFIG_INTEL_PMC_IPC) += intel_pmc_ipc.o
obj-$(CONFIG_SURFACE_PRO3_BUTTON) += surfacepro3_button.o
......@@ -807,6 +807,7 @@ static const struct acpi_device_id norfkill_ids[] __initconst = {
{ "IBM0068", 0},
{ "LEN0068", 0},
{ "SNY5001", 0}, /* sony-laptop in charge */
{ "HPQ6601", 0},
{ "", 0},
};
......
......@@ -332,6 +332,7 @@ static const struct key_entry asus_keymap[] = {
{KE_KEY, 0x65, { KEY_SWITCHVIDEOMODE } }, /* SDSP LCD + TV */
{KE_KEY, 0x66, { KEY_SWITCHVIDEOMODE } }, /* SDSP CRT + TV */
{KE_KEY, 0x67, { KEY_SWITCHVIDEOMODE } }, /* SDSP LCD + CRT + TV */
{KE_KEY, 0x6A, { KEY_TOUCHPAD_TOGGLE } }, /* Lock Touchpad Fn + F9 */
{KE_KEY, 0x6B, { KEY_TOUCHPAD_TOGGLE } }, /* Lock Touchpad */
{KE_KEY, 0x6C, { KEY_SLEEP } }, /* Suspend */
{KE_KEY, 0x6D, { KEY_SLEEP } }, /* Hibernate */
......
......@@ -114,14 +114,9 @@ static int __init hpwl_init(void)
pr_info("Initializing HPQ6001 module\n");
err = acpi_bus_register_driver(&hpwl_driver);
if (err) {
if (err)
pr_err("Unable to register HP wireless control driver.\n");
goto error_acpi_register;
}
return 0;
error_acpi_register:
return err;
}
......
......@@ -852,6 +852,20 @@ static const struct dmi_system_id no_hw_rfkill_list[] = {
DMI_MATCH(DMI_PRODUCT_VERSION, "Lenovo Yoga 2"),
},
},
{
.ident = "Lenovo Yoga 3 14",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
DMI_MATCH(DMI_PRODUCT_VERSION, "Lenovo Yoga 3 14"),
},
},
{
.ident = "Lenovo Yoga 2 11 / 13 / Pro",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
DMI_MATCH(DMI_BOARD_NAME, "Yoga2"),
},
},
{
.ident = "Lenovo Yoga 3 Pro 1370",
.matches = {
......
/*
* power/home/volume button support for
* Microsoft Surface Pro 3 tablet.
*
* Copyright (c) 2015 Intel Corporation.
* All rights reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; version 2
* of the License.
*/
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/types.h>
#include <linux/input.h>
#include <linux/acpi.h>
#include <acpi/button.h>
#define SURFACE_BUTTON_HID "MSHW0028"
#define SURFACE_BUTTON_OBJ_NAME "VGBI"
#define SURFACE_BUTTON_DEVICE_NAME "Surface Pro 3 Buttons"
#define SURFACE_BUTTON_NOTIFY_PRESS_POWER 0xc6
#define SURFACE_BUTTON_NOTIFY_RELEASE_POWER 0xc7
#define SURFACE_BUTTON_NOTIFY_PRESS_HOME 0xc4
#define SURFACE_BUTTON_NOTIFY_RELEASE_HOME 0xc5
#define SURFACE_BUTTON_NOTIFY_PRESS_VOLUME_UP 0xc0
#define SURFACE_BUTTON_NOTIFY_RELEASE_VOLUME_UP 0xc1
#define SURFACE_BUTTON_NOTIFY_PRESS_VOLUME_DOWN 0xc2
#define SURFACE_BUTTON_NOTIFY_RELEASE_VOLUME_DOWN 0xc3
ACPI_MODULE_NAME("surface pro 3 button");
MODULE_AUTHOR("Chen Yu");
MODULE_DESCRIPTION("Surface Pro3 Button Driver");
MODULE_LICENSE("GPL v2");
/*
* Power button, Home button, Volume buttons support is supposed to
* be covered by drivers/input/misc/soc_button_array.c, which is implemented
* according to "Windows ACPI Design Guide for SoC Platforms".
* However surface pro3 seems not to obey the specs, instead it uses
* device VGBI(MSHW0028) for dispatching the events.
* We choose acpi_driver rather than platform_driver/i2c_driver because
* although VGBI has an i2c resource connected to i2c controller, it
* is not embedded in any i2c controller's scope, thus neither platform_device
* will be created, nor i2c_client will be enumerated, we have to use
* acpi_driver.
*/
static const struct acpi_device_id surface_button_device_ids[] = {
{SURFACE_BUTTON_HID, 0},
{"", 0},
};
MODULE_DEVICE_TABLE(acpi, surface_button_device_ids);
struct surface_button {
unsigned int type;
struct input_dev *input;
char phys[32]; /* for input device */
unsigned long pushed;
bool suspended;
};
static void surface_button_notify(struct acpi_device *device, u32 event)
{
struct surface_button *button = acpi_driver_data(device);
struct input_dev *input;
int key_code = KEY_RESERVED;
bool pressed = false;
switch (event) {
/* Power button press,release handle */
case SURFACE_BUTTON_NOTIFY_PRESS_POWER:
pressed = true;
/*fall through*/
case SURFACE_BUTTON_NOTIFY_RELEASE_POWER:
key_code = KEY_POWER;
break;
/* Home button press,release handle */
case SURFACE_BUTTON_NOTIFY_PRESS_HOME:
pressed = true;
/*fall through*/
case SURFACE_BUTTON_NOTIFY_RELEASE_HOME:
key_code = KEY_LEFTMETA;
break;
/* Volume up button press,release handle */
case SURFACE_BUTTON_NOTIFY_PRESS_VOLUME_UP:
pressed = true;
/*fall through*/
case SURFACE_BUTTON_NOTIFY_RELEASE_VOLUME_UP:
key_code = KEY_VOLUMEUP;
break;
/* Volume down button press,release handle */
case SURFACE_BUTTON_NOTIFY_PRESS_VOLUME_DOWN:
pressed = true;
/*fall through*/
case SURFACE_BUTTON_NOTIFY_RELEASE_VOLUME_DOWN:
key_code = KEY_VOLUMEDOWN;
break;
default:
dev_info_ratelimited(&device->dev,
"Unsupported event [0x%x]\n", event);
break;
}
input = button->input;
if (KEY_RESERVED == key_code)
return;
if (pressed)
pm_wakeup_event(&device->dev, 0);
if (button->suspended)
return;
input_report_key(input, key_code, pressed?1:0);
input_sync(input);
}
#ifdef CONFIG_PM_SLEEP
static int surface_button_suspend(struct device *dev)
{
struct acpi_device *device = to_acpi_device(dev);
struct surface_button *button = acpi_driver_data(device);
button->suspended = true;
return 0;
}
static int surface_button_resume(struct device *dev)
{
struct acpi_device *device = to_acpi_device(dev);
struct surface_button *button = acpi_driver_data(device);
button->suspended = false;
return 0;
}
#endif
static int surface_button_add(struct acpi_device *device)
{
struct surface_button *button;
struct input_dev *input;
const char *hid = acpi_device_hid(device);
char *name;
int error;
if (strncmp(acpi_device_bid(device), SURFACE_BUTTON_OBJ_NAME,
strlen(SURFACE_BUTTON_OBJ_NAME)))
return -ENODEV;
button = kzalloc(sizeof(struct surface_button), GFP_KERNEL);
if (!button)
return -ENOMEM;
device->driver_data = button;
button->input = input = input_allocate_device();
if (!input) {
error = -ENOMEM;
goto err_free_button;
}
name = acpi_device_name(device);
strcpy(name, SURFACE_BUTTON_DEVICE_NAME);
snprintf(button->phys, sizeof(button->phys), "%s/buttons", hid);
input->name = name;
input->phys = button->phys;
input->id.bustype = BUS_HOST;
input->dev.parent = &device->dev;
input_set_capability(input, EV_KEY, KEY_POWER);
input_set_capability(input, EV_KEY, KEY_LEFTMETA);
input_set_capability(input, EV_KEY, KEY_VOLUMEUP);
input_set_capability(input, EV_KEY, KEY_VOLUMEDOWN);
error = input_register_device(input);
if (error)
goto err_free_input;
dev_info(&device->dev,
"%s [%s]\n", name, acpi_device_bid(device));
return 0;
err_free_input:
input_free_device(input);
err_free_button:
kfree(button);
return error;
}
static int surface_button_remove(struct acpi_device *device)
{
struct surface_button *button = acpi_driver_data(device);
input_unregister_device(button->input);
kfree(button);
return 0;
}
static SIMPLE_DEV_PM_OPS(surface_button_pm,
surface_button_suspend, surface_button_resume);
static struct acpi_driver surface_button_driver = {
.name = "surface_pro3_button",
.class = "SurfacePro3",
.ids = surface_button_device_ids,
.ops = {
.add = surface_button_add,
.remove = surface_button_remove,
.notify = surface_button_notify,
},
.drv.pm = &surface_button_pm,
};
module_acpi_driver(surface_button_driver);
......@@ -402,7 +402,7 @@ static const char *str_supported(int is_supported);
#else
static inline const char *str_supported(int is_supported) { return ""; }
#define vdbg_printk(a_dbg_level, format, arg...) \
no_printk(format, ##arg)
do { if (0) no_printk(format, ##arg); } while (0)
#endif
static void tpacpi_log_usertask(const char * const what)
......
此差异已折叠。
/* toshiba.h -- Linux driver for accessing the SMM on Toshiba laptops
*
* Copyright (c) 1996-2000 Jonathan A. Buzzard (jonathan@buzzard.org.uk)
* Copyright (c) 2015 Azael Avalos <coproscefalo@gmail.com>
*
* Thanks to Juergen Heinzl <juergen@monocerus.demon.co.uk> for the pointers
* on making sure the structure is aligned and packed.
......@@ -20,9 +21,18 @@
#ifndef _UAPI_LINUX_TOSHIBA_H
#define _UAPI_LINUX_TOSHIBA_H
#define TOSH_PROC "/proc/toshiba"
#define TOSH_DEVICE "/dev/toshiba"
#define TOSH_SMM _IOWR('t', 0x90, int) /* broken: meant 24 bytes */
/*
* Toshiba modules paths
*/
#define TOSH_PROC "/proc/toshiba"
#define TOSH_DEVICE "/dev/toshiba"
#define TOSHIBA_ACPI_PROC "/proc/acpi/toshiba"
#define TOSHIBA_ACPI_DEVICE "/dev/toshiba_acpi"
/*
* Toshiba SMM structure
*/
typedef struct {
unsigned int eax;
......@@ -33,5 +43,21 @@ typedef struct {
unsigned int edi __attribute__ ((packed));
} SMMRegisters;
/*
* IOCTLs (0x90 - 0x91)
*/
#define TOSH_SMM _IOWR('t', 0x90, SMMRegisters)
/*
* Convenience toshiba_acpi command.
*
* The System Configuration Interface (SCI) is opened/closed internally
* to avoid userspace of buggy BIOSes.
*
* The toshiba_acpi module checks whether the eax register is set with
* SCI_GET (0xf300) or SCI_SET (0xf400), returning -EINVAL if not.
*/
#define TOSHIBA_ACPI_SCI _IOWR('t', 0x91, SMMRegisters)
#endif /* _UAPI_LINUX_TOSHIBA_H */
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册