You've already forked linux-apfs
mirror of
https://github.com/linux-apfs/linux-apfs.git
synced 2026-05-01 15:00:59 -07:00
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input
Pull input updates from Dmitry Torokhov: "A new driver for slidebar on Ideapad laptops and a bunch of assorted driver fixes" * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input: (32 commits) Input: add SYN_MAX and SYN_CNT constants Input: max11801_ts - convert to devm Input: egalax-ts - fix typo and improve text Input: MAINTAINERS - change maintainer for cyttsp driver Input: cyttsp4 - kill 'defined but not used' compiler warnings Input: add driver for slidebar on Lenovo IdeaPad laptops Input: omap-keypad - set up irq type from DT Input: omap-keypad - enable wakeup capability for keypad. Input: omap-keypad - clear interrupts on open Input: omap-keypad - convert to threaded IRQ Input: omap-keypad - use bitfiled instead of hardcoded values Input: cyttsp4 - remove useless NULL test from cyttsp4_watchdog_timer() Input: wacom - fix error return code in wacom_probe() Input: as5011 - fix error return code in as5011_probe() Input: keyboard, serio - simplify use of devm_ioremap_resource Input: tegra-kbc - simplify use of devm_ioremap_resource Input: htcpen - fix incorrect placement of __initdata Input: qt1070 - add power management ops Input: wistron_btns - add MODULE_DEVICE_TABLE Input: wistron_btns - mark the Medion MD96500 keymap as tested ...
This commit is contained in:
@@ -234,7 +234,7 @@ static int as5011_probe(struct i2c_client *client,
|
||||
int irq;
|
||||
int error;
|
||||
|
||||
plat_data = client->dev.platform_data;
|
||||
plat_data = dev_get_platdata(&client->dev);
|
||||
if (!plat_data)
|
||||
return -EINVAL;
|
||||
|
||||
@@ -288,6 +288,7 @@ static int as5011_probe(struct i2c_client *client,
|
||||
if (irq < 0) {
|
||||
dev_err(&client->dev,
|
||||
"Failed to get irq number for button gpio\n");
|
||||
error = irq;
|
||||
goto err_free_button_gpio;
|
||||
}
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ static void dc_pad_callback(struct mapleq *mq)
|
||||
|
||||
static int dc_pad_open(struct input_dev *dev)
|
||||
{
|
||||
struct dc_pad *pad = dev->dev.platform_data;
|
||||
struct dc_pad *pad = dev_get_platdata(&dev->dev);
|
||||
|
||||
maple_getcond_callback(pad->mdev, dc_pad_callback, HZ/20,
|
||||
MAPLE_FUNC_CONTROLLER);
|
||||
@@ -71,7 +71,7 @@ static int dc_pad_open(struct input_dev *dev)
|
||||
|
||||
static void dc_pad_close(struct input_dev *dev)
|
||||
{
|
||||
struct dc_pad *pad = dev->dev.platform_data;
|
||||
struct dc_pad *pad = dev_get_platdata(&dev->dev);
|
||||
|
||||
maple_getcond_callback(pad->mdev, dc_pad_callback, 0,
|
||||
MAPLE_FUNC_CONTROLLER);
|
||||
|
||||
@@ -442,12 +442,6 @@ static int imx_keypad_probe(struct platform_device *pdev)
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||
if (res == NULL) {
|
||||
dev_err(&pdev->dev, "no I/O memory defined in platform data\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
input_dev = devm_input_allocate_device(&pdev->dev);
|
||||
if (!input_dev) {
|
||||
dev_err(&pdev->dev, "failed to allocate the input device\n");
|
||||
@@ -468,6 +462,7 @@ static int imx_keypad_probe(struct platform_device *pdev)
|
||||
setup_timer(&keypad->check_matrix_timer,
|
||||
imx_keypad_check_for_events, (unsigned long) keypad);
|
||||
|
||||
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||
keypad->mmio_base = devm_ioremap_resource(&pdev->dev, res);
|
||||
if (IS_ERR(keypad->mmio_base))
|
||||
return PTR_ERR(keypad->mmio_base);
|
||||
|
||||
@@ -271,7 +271,7 @@ static int max7359_remove(struct i2c_client *client)
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_PM
|
||||
#ifdef CONFIG_PM_SLEEP
|
||||
static int max7359_suspend(struct device *dev)
|
||||
{
|
||||
struct i2c_client *client = to_i2c_client(dev);
|
||||
|
||||
@@ -171,12 +171,6 @@ static int nspire_keypad_probe(struct platform_device *pdev)
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||
if (!res) {
|
||||
dev_err(&pdev->dev, "missing platform resources\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
keypad = devm_kzalloc(&pdev->dev, sizeof(struct nspire_keypad),
|
||||
GFP_KERNEL);
|
||||
if (!keypad) {
|
||||
@@ -208,6 +202,7 @@ static int nspire_keypad_probe(struct platform_device *pdev)
|
||||
return PTR_ERR(keypad->clk);
|
||||
}
|
||||
|
||||
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||
keypad->reg_base = devm_ioremap_resource(&pdev->dev, res);
|
||||
if (IS_ERR(keypad->reg_base))
|
||||
return PTR_ERR(keypad->reg_base);
|
||||
|
||||
@@ -53,21 +53,17 @@
|
||||
#define OMAP4_KBD_FULLCODE63_32 0x48
|
||||
|
||||
/* OMAP4 bit definitions */
|
||||
#define OMAP4_DEF_IRQENABLE_EVENTEN (1 << 0)
|
||||
#define OMAP4_DEF_IRQENABLE_LONGKEY (1 << 1)
|
||||
#define OMAP4_DEF_IRQENABLE_TIMEOUTEN (1 << 2)
|
||||
#define OMAP4_DEF_WUP_EVENT_ENA (1 << 0)
|
||||
#define OMAP4_DEF_WUP_LONG_KEY_ENA (1 << 1)
|
||||
#define OMAP4_DEF_CTRL_NOSOFTMODE (1 << 1)
|
||||
#define OMAP4_DEF_CTRLPTVVALUE (1 << 2)
|
||||
#define OMAP4_DEF_CTRLPTV (1 << 1)
|
||||
#define OMAP4_DEF_IRQENABLE_EVENTEN BIT(0)
|
||||
#define OMAP4_DEF_IRQENABLE_LONGKEY BIT(1)
|
||||
#define OMAP4_DEF_WUP_EVENT_ENA BIT(0)
|
||||
#define OMAP4_DEF_WUP_LONG_KEY_ENA BIT(1)
|
||||
#define OMAP4_DEF_CTRL_NOSOFTMODE BIT(1)
|
||||
#define OMAP4_DEF_CTRL_PTV_SHIFT 2
|
||||
|
||||
/* OMAP4 values */
|
||||
#define OMAP4_VAL_IRQDISABLE 0x00
|
||||
#define OMAP4_VAL_DEBOUNCINGTIME 0x07
|
||||
#define OMAP4_VAL_FUNCTIONALCFG 0x1E
|
||||
|
||||
#define OMAP4_MASK_IRQSTATUSDISABLE 0xFFFF
|
||||
#define OMAP4_VAL_IRQDISABLE 0x0
|
||||
#define OMAP4_VAL_DEBOUNCINGTIME 0x7
|
||||
#define OMAP4_VAL_PVT 0x7
|
||||
|
||||
enum {
|
||||
KBD_REVISION_OMAP4 = 0,
|
||||
@@ -78,6 +74,7 @@ struct omap4_keypad {
|
||||
struct input_dev *input;
|
||||
|
||||
void __iomem *base;
|
||||
bool irq_wake_enabled;
|
||||
unsigned int irq;
|
||||
|
||||
unsigned int rows;
|
||||
@@ -116,8 +113,22 @@ static void kbd_write_irqreg(struct omap4_keypad *keypad_data,
|
||||
}
|
||||
|
||||
|
||||
/* Interrupt handler */
|
||||
static irqreturn_t omap4_keypad_interrupt(int irq, void *dev_id)
|
||||
/* Interrupt handlers */
|
||||
static irqreturn_t omap4_keypad_irq_handler(int irq, void *dev_id)
|
||||
{
|
||||
struct omap4_keypad *keypad_data = dev_id;
|
||||
|
||||
if (kbd_read_irqreg(keypad_data, OMAP4_KBD_IRQSTATUS)) {
|
||||
/* Disable interrupts */
|
||||
kbd_write_irqreg(keypad_data, OMAP4_KBD_IRQENABLE,
|
||||
OMAP4_VAL_IRQDISABLE);
|
||||
return IRQ_WAKE_THREAD;
|
||||
}
|
||||
|
||||
return IRQ_NONE;
|
||||
}
|
||||
|
||||
static irqreturn_t omap4_keypad_irq_thread_fn(int irq, void *dev_id)
|
||||
{
|
||||
struct omap4_keypad *keypad_data = dev_id;
|
||||
struct input_dev *input_dev = keypad_data->input;
|
||||
@@ -125,10 +136,6 @@ static irqreturn_t omap4_keypad_interrupt(int irq, void *dev_id)
|
||||
unsigned int col, row, code, changed;
|
||||
u32 *new_state = (u32 *) key_state;
|
||||
|
||||
/* Disable interrupts */
|
||||
kbd_write_irqreg(keypad_data, OMAP4_KBD_IRQENABLE,
|
||||
OMAP4_VAL_IRQDISABLE);
|
||||
|
||||
*new_state = kbd_readl(keypad_data, OMAP4_KBD_FULLCODE31_0);
|
||||
*(new_state + 1) = kbd_readl(keypad_data, OMAP4_KBD_FULLCODE63_32);
|
||||
|
||||
@@ -175,11 +182,13 @@ static int omap4_keypad_open(struct input_dev *input)
|
||||
disable_irq(keypad_data->irq);
|
||||
|
||||
kbd_writel(keypad_data, OMAP4_KBD_CTRL,
|
||||
OMAP4_VAL_FUNCTIONALCFG);
|
||||
OMAP4_DEF_CTRL_NOSOFTMODE |
|
||||
(OMAP4_VAL_PVT << OMAP4_DEF_CTRL_PTV_SHIFT));
|
||||
kbd_writel(keypad_data, OMAP4_KBD_DEBOUNCINGTIME,
|
||||
OMAP4_VAL_DEBOUNCINGTIME);
|
||||
/* clear pending interrupts */
|
||||
kbd_write_irqreg(keypad_data, OMAP4_KBD_IRQSTATUS,
|
||||
OMAP4_VAL_IRQDISABLE);
|
||||
kbd_read_irqreg(keypad_data, OMAP4_KBD_IRQSTATUS));
|
||||
kbd_write_irqreg(keypad_data, OMAP4_KBD_IRQENABLE,
|
||||
OMAP4_DEF_IRQENABLE_EVENTEN |
|
||||
OMAP4_DEF_IRQENABLE_LONGKEY);
|
||||
@@ -363,14 +372,15 @@ static int omap4_keypad_probe(struct platform_device *pdev)
|
||||
goto err_free_keymap;
|
||||
}
|
||||
|
||||
error = request_irq(keypad_data->irq, omap4_keypad_interrupt,
|
||||
IRQF_TRIGGER_RISING,
|
||||
"omap4-keypad", keypad_data);
|
||||
error = request_threaded_irq(keypad_data->irq, omap4_keypad_irq_handler,
|
||||
omap4_keypad_irq_thread_fn, 0,
|
||||
"omap4-keypad", keypad_data);
|
||||
if (error) {
|
||||
dev_err(&pdev->dev, "failed to register interrupt\n");
|
||||
goto err_free_input;
|
||||
}
|
||||
|
||||
device_init_wakeup(&pdev->dev, true);
|
||||
pm_runtime_put_sync(&pdev->dev);
|
||||
|
||||
error = input_register_device(keypad_data->input);
|
||||
@@ -384,6 +394,7 @@ static int omap4_keypad_probe(struct platform_device *pdev)
|
||||
|
||||
err_pm_disable:
|
||||
pm_runtime_disable(&pdev->dev);
|
||||
device_init_wakeup(&pdev->dev, false);
|
||||
free_irq(keypad_data->irq, keypad_data);
|
||||
err_free_keymap:
|
||||
kfree(keypad_data->keymap);
|
||||
@@ -409,6 +420,8 @@ static int omap4_keypad_remove(struct platform_device *pdev)
|
||||
|
||||
pm_runtime_disable(&pdev->dev);
|
||||
|
||||
device_init_wakeup(&pdev->dev, false);
|
||||
|
||||
input_unregister_device(keypad_data->input);
|
||||
|
||||
iounmap(keypad_data->base);
|
||||
@@ -430,12 +443,46 @@ static const struct of_device_id omap_keypad_dt_match[] = {
|
||||
MODULE_DEVICE_TABLE(of, omap_keypad_dt_match);
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_PM_SLEEP
|
||||
static int omap4_keypad_suspend(struct device *dev)
|
||||
{
|
||||
struct platform_device *pdev = to_platform_device(dev);
|
||||
struct omap4_keypad *keypad_data = platform_get_drvdata(pdev);
|
||||
int error;
|
||||
|
||||
if (device_may_wakeup(&pdev->dev)) {
|
||||
error = enable_irq_wake(keypad_data->irq);
|
||||
if (!error)
|
||||
keypad_data->irq_wake_enabled = true;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int omap4_keypad_resume(struct device *dev)
|
||||
{
|
||||
struct platform_device *pdev = to_platform_device(dev);
|
||||
struct omap4_keypad *keypad_data = platform_get_drvdata(pdev);
|
||||
|
||||
if (device_may_wakeup(&pdev->dev) && keypad_data->irq_wake_enabled) {
|
||||
disable_irq_wake(keypad_data->irq);
|
||||
keypad_data->irq_wake_enabled = false;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
static SIMPLE_DEV_PM_OPS(omap4_keypad_pm_ops,
|
||||
omap4_keypad_suspend, omap4_keypad_resume);
|
||||
|
||||
static struct platform_driver omap4_keypad_driver = {
|
||||
.probe = omap4_keypad_probe,
|
||||
.remove = omap4_keypad_remove,
|
||||
.driver = {
|
||||
.name = "omap4-keypad",
|
||||
.owner = THIS_MODULE,
|
||||
.pm = &omap4_keypad_pm_ops,
|
||||
.of_match_table = of_match_ptr(omap_keypad_dt_match),
|
||||
},
|
||||
};
|
||||
|
||||
@@ -243,6 +243,32 @@ static int qt1070_remove(struct i2c_client *client)
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_PM_SLEEP
|
||||
static int qt1070_suspend(struct device *dev)
|
||||
{
|
||||
struct i2c_client *client = to_i2c_client(dev);
|
||||
struct qt1070_data *data = i2c_get_clientdata(client);
|
||||
|
||||
if (device_may_wakeup(dev))
|
||||
enable_irq_wake(data->irq);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int qt1070_resume(struct device *dev)
|
||||
{
|
||||
struct i2c_client *client = to_i2c_client(dev);
|
||||
struct qt1070_data *data = i2c_get_clientdata(client);
|
||||
|
||||
if (device_may_wakeup(dev))
|
||||
disable_irq_wake(data->irq);
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
static SIMPLE_DEV_PM_OPS(qt1070_pm_ops, qt1070_suspend, qt1070_resume);
|
||||
|
||||
static const struct i2c_device_id qt1070_id[] = {
|
||||
{ "qt1070", 0 },
|
||||
{ },
|
||||
@@ -253,6 +279,7 @@ static struct i2c_driver qt1070_driver = {
|
||||
.driver = {
|
||||
.name = "qt1070",
|
||||
.owner = THIS_MODULE,
|
||||
.pm = &qt1070_pm_ops,
|
||||
},
|
||||
.id_table = qt1070_id,
|
||||
.probe = qt1070_probe,
|
||||
|
||||
@@ -191,12 +191,6 @@ static int spear_kbd_probe(struct platform_device *pdev)
|
||||
int irq;
|
||||
int error;
|
||||
|
||||
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||
if (!res) {
|
||||
dev_err(&pdev->dev, "no keyboard resource defined\n");
|
||||
return -EBUSY;
|
||||
}
|
||||
|
||||
irq = platform_get_irq(pdev, 0);
|
||||
if (irq < 0) {
|
||||
dev_err(&pdev->dev, "not able to get irq for the device\n");
|
||||
@@ -228,6 +222,7 @@ static int spear_kbd_probe(struct platform_device *pdev)
|
||||
kbd->suspended_rate = pdata->suspended_rate;
|
||||
}
|
||||
|
||||
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||
kbd->io_base = devm_ioremap_resource(&pdev->dev, res);
|
||||
if (IS_ERR(kbd->io_base))
|
||||
return PTR_ERR(kbd->io_base);
|
||||
|
||||
@@ -638,12 +638,6 @@ static int tegra_kbc_probe(struct platform_device *pdev)
|
||||
if (!tegra_kbc_check_pin_cfg(kbc, &num_rows))
|
||||
return -EINVAL;
|
||||
|
||||
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||
if (!res) {
|
||||
dev_err(&pdev->dev, "failed to get I/O memory\n");
|
||||
return -ENXIO;
|
||||
}
|
||||
|
||||
kbc->irq = platform_get_irq(pdev, 0);
|
||||
if (kbc->irq < 0) {
|
||||
dev_err(&pdev->dev, "failed to get keyboard IRQ\n");
|
||||
@@ -658,6 +652,7 @@ static int tegra_kbc_probe(struct platform_device *pdev)
|
||||
|
||||
setup_timer(&kbc->timer, tegra_kbc_keypress_timer, (unsigned long)kbc);
|
||||
|
||||
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||
kbc->mmio = devm_ioremap_resource(&pdev->dev, res);
|
||||
if (IS_ERR(kbc->mmio))
|
||||
return PTR_ERR(kbc->mmio);
|
||||
|
||||
@@ -647,4 +647,14 @@ config INPUT_SIRFSOC_ONKEY
|
||||
|
||||
If unsure, say N.
|
||||
|
||||
config INPUT_IDEAPAD_SLIDEBAR
|
||||
tristate "IdeaPad Laptop Slidebar"
|
||||
depends on INPUT
|
||||
depends on SERIO_I8042
|
||||
help
|
||||
Say Y here if you have an IdeaPad laptop with a slidebar.
|
||||
|
||||
To compile this driver as a module, choose M here: the
|
||||
module will be called ideapad_slidebar.
|
||||
|
||||
endif
|
||||
|
||||
@@ -61,3 +61,4 @@ obj-$(CONFIG_INPUT_WISTRON_BTNS) += wistron_btns.o
|
||||
obj-$(CONFIG_INPUT_WM831X_ON) += wm831x-on.o
|
||||
obj-$(CONFIG_INPUT_XEN_KBDDEV_FRONTEND) += xen-kbdfront.o
|
||||
obj-$(CONFIG_INPUT_YEALINK) += yealink.o
|
||||
obj-$(CONFIG_INPUT_IDEAPAD_SLIDEBAR) += ideapad_slidebar.o
|
||||
|
||||
@@ -0,0 +1,358 @@
|
||||
/*
|
||||
* Input driver for slidebars on some Lenovo IdeaPad laptops
|
||||
*
|
||||
* Copyright (C) 2013 Andrey Moiseev <o2g.org.ru@gmail.com>
|
||||
*
|
||||
* Reverse-engineered from Lenovo SlideNav software (SBarHook.dll).
|
||||
*
|
||||
* 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; either version 2 of the License, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* Trademarks are the property of their respective owners.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Currently tested and works on:
|
||||
* Lenovo IdeaPad Y550
|
||||
* Lenovo IdeaPad Y550P
|
||||
*
|
||||
* Other models can be added easily. To test,
|
||||
* load with 'force' parameter set 'true'.
|
||||
*
|
||||
* LEDs blinking and input mode are managed via sysfs,
|
||||
* (hex, unsigned byte value):
|
||||
* /sys/devices/platform/ideapad_slidebar/slidebar_mode
|
||||
*
|
||||
* The value is in byte range, however, I only figured out
|
||||
* how bits 0b10011001 work. Some other bits, probably,
|
||||
* are meaningfull too.
|
||||
*
|
||||
* Possible states:
|
||||
*
|
||||
* STD_INT, ONMOV_INT, OFF_INT, LAST_POLL, OFF_POLL
|
||||
*
|
||||
* Meaning:
|
||||
* released touched
|
||||
* STD 'heartbeat' lights follow the finger
|
||||
* ONMOV no lights lights follow the finger
|
||||
* LAST at last pos lights follow the finger
|
||||
* OFF no lights no lights
|
||||
*
|
||||
* INT all input events are generated, interrupts are used
|
||||
* POLL no input events by default, to get them,
|
||||
* send 0b10000000 (read below)
|
||||
*
|
||||
* Commands: write
|
||||
*
|
||||
* All | 0b01001 -> STD_INT
|
||||
* possible | 0b10001 -> ONMOV_INT
|
||||
* states | 0b01000 -> OFF_INT
|
||||
*
|
||||
* | 0b0 -> LAST_POLL
|
||||
* STD_INT or ONMOV_INT |
|
||||
* | 0b1 -> STD_INT
|
||||
*
|
||||
* | 0b0 -> OFF_POLL
|
||||
* OFF_INT or OFF_POLL |
|
||||
* | 0b1 -> OFF_INT
|
||||
*
|
||||
* Any state | 0b10000000 -> if the slidebar has updated data,
|
||||
* produce one input event (last position),
|
||||
* switch to respective POLL mode
|
||||
* (like 0x0), if not in POLL mode yet.
|
||||
*
|
||||
* Get current state: read
|
||||
*
|
||||
* masked by 0x11 read value means:
|
||||
*
|
||||
* 0x00 LAST
|
||||
* 0x01 STD
|
||||
* 0x10 OFF
|
||||
* 0x11 ONMOV
|
||||
*/
|
||||
|
||||
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
|
||||
|
||||
#include <linux/module.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/dmi.h>
|
||||
#include <linux/spinlock.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/input.h>
|
||||
#include <linux/io.h>
|
||||
#include <linux/ioport.h>
|
||||
#include <linux/i8042.h>
|
||||
#include <linux/serio.h>
|
||||
|
||||
#define IDEAPAD_BASE 0xff29
|
||||
|
||||
static bool force;
|
||||
module_param(force, bool, 0);
|
||||
MODULE_PARM_DESC(force, "Force driver load, ignore DMI data");
|
||||
|
||||
static DEFINE_SPINLOCK(io_lock);
|
||||
|
||||
static struct input_dev *slidebar_input_dev;
|
||||
static struct platform_device *slidebar_platform_dev;
|
||||
|
||||
static u8 slidebar_pos_get(void)
|
||||
{
|
||||
u8 res;
|
||||
unsigned long flags;
|
||||
|
||||
spin_lock_irqsave(&io_lock, flags);
|
||||
outb(0xf4, 0xff29);
|
||||
outb(0xbf, 0xff2a);
|
||||
res = inb(0xff2b);
|
||||
spin_unlock_irqrestore(&io_lock, flags);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
static u8 slidebar_mode_get(void)
|
||||
{
|
||||
u8 res;
|
||||
unsigned long flags;
|
||||
|
||||
spin_lock_irqsave(&io_lock, flags);
|
||||
outb(0xf7, 0xff29);
|
||||
outb(0x8b, 0xff2a);
|
||||
res = inb(0xff2b);
|
||||
spin_unlock_irqrestore(&io_lock, flags);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
static void slidebar_mode_set(u8 mode)
|
||||
{
|
||||
unsigned long flags;
|
||||
|
||||
spin_lock_irqsave(&io_lock, flags);
|
||||
outb(0xf7, 0xff29);
|
||||
outb(0x8b, 0xff2a);
|
||||
outb(mode, 0xff2b);
|
||||
spin_unlock_irqrestore(&io_lock, flags);
|
||||
}
|
||||
|
||||
static bool slidebar_i8042_filter(unsigned char data, unsigned char str,
|
||||
struct serio *port)
|
||||
{
|
||||
static bool extended = false;
|
||||
|
||||
/* We are only interested in data coming form KBC port */
|
||||
if (str & I8042_STR_AUXDATA)
|
||||
return false;
|
||||
|
||||
/* Scancodes: e03b on move, e0bb on release. */
|
||||
if (data == 0xe0) {
|
||||
extended = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!extended)
|
||||
return false;
|
||||
|
||||
extended = false;
|
||||
|
||||
if (likely((data & 0x7f) != 0x3b)) {
|
||||
serio_interrupt(port, 0xe0, 0);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (data & 0x80) {
|
||||
input_report_key(slidebar_input_dev, BTN_TOUCH, 0);
|
||||
} else {
|
||||
input_report_key(slidebar_input_dev, BTN_TOUCH, 1);
|
||||
input_report_abs(slidebar_input_dev, ABS_X, slidebar_pos_get());
|
||||
}
|
||||
input_sync(slidebar_input_dev);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static ssize_t show_slidebar_mode(struct device *dev,
|
||||
struct device_attribute *attr,
|
||||
char *buf)
|
||||
{
|
||||
return sprintf(buf, "%x\n", slidebar_mode_get());
|
||||
}
|
||||
|
||||
static ssize_t store_slidebar_mode(struct device *dev,
|
||||
struct device_attribute *attr,
|
||||
const char *buf, size_t count)
|
||||
{
|
||||
u8 mode;
|
||||
int error;
|
||||
|
||||
error = kstrtou8(buf, 0, &mode);
|
||||
if (error)
|
||||
return error;
|
||||
|
||||
slidebar_mode_set(mode);
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
static DEVICE_ATTR(slidebar_mode, S_IWUSR | S_IRUGO,
|
||||
show_slidebar_mode, store_slidebar_mode);
|
||||
|
||||
static struct attribute *ideapad_attrs[] = {
|
||||
&dev_attr_slidebar_mode.attr,
|
||||
NULL
|
||||
};
|
||||
|
||||
static struct attribute_group ideapad_attr_group = {
|
||||
.attrs = ideapad_attrs
|
||||
};
|
||||
|
||||
static const struct attribute_group *ideapad_attr_groups[] = {
|
||||
&ideapad_attr_group,
|
||||
NULL
|
||||
};
|
||||
|
||||
static int __init ideapad_probe(struct platform_device* pdev)
|
||||
{
|
||||
int err;
|
||||
|
||||
if (!request_region(IDEAPAD_BASE, 3, "ideapad_slidebar")) {
|
||||
dev_err(&pdev->dev, "IO ports are busy\n");
|
||||
return -EBUSY;
|
||||
}
|
||||
|
||||
slidebar_input_dev = input_allocate_device();
|
||||
if (!slidebar_input_dev) {
|
||||
dev_err(&pdev->dev, "Failed to allocate input device\n");
|
||||
err = -ENOMEM;
|
||||
goto err_release_ports;
|
||||
}
|
||||
|
||||
slidebar_input_dev->name = "IdeaPad Slidebar";
|
||||
slidebar_input_dev->id.bustype = BUS_HOST;
|
||||
slidebar_input_dev->dev.parent = &pdev->dev;
|
||||
input_set_capability(slidebar_input_dev, EV_KEY, BTN_TOUCH);
|
||||
input_set_capability(slidebar_input_dev, EV_ABS, ABS_X);
|
||||
input_set_abs_params(slidebar_input_dev, ABS_X, 0, 0xff, 0, 0);
|
||||
|
||||
err = i8042_install_filter(slidebar_i8042_filter);
|
||||
if (err) {
|
||||
dev_err(&pdev->dev,
|
||||
"Failed to install i8042 filter: %d\n", err);
|
||||
goto err_free_dev;
|
||||
}
|
||||
|
||||
err = input_register_device(slidebar_input_dev);
|
||||
if (err) {
|
||||
dev_err(&pdev->dev,
|
||||
"Failed to register input device: %d\n", err);
|
||||
goto err_remove_filter;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
err_remove_filter:
|
||||
i8042_remove_filter(slidebar_i8042_filter);
|
||||
err_free_dev:
|
||||
input_free_device(slidebar_input_dev);
|
||||
err_release_ports:
|
||||
release_region(IDEAPAD_BASE, 3);
|
||||
return err;
|
||||
}
|
||||
|
||||
static int ideapad_remove(struct platform_device *pdev)
|
||||
{
|
||||
i8042_remove_filter(slidebar_i8042_filter);
|
||||
input_unregister_device(slidebar_input_dev);
|
||||
release_region(IDEAPAD_BASE, 3);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct platform_driver slidebar_drv = {
|
||||
.driver = {
|
||||
.name = "ideapad_slidebar",
|
||||
.owner = THIS_MODULE,
|
||||
},
|
||||
.remove = ideapad_remove,
|
||||
};
|
||||
|
||||
static int __init ideapad_dmi_check(const struct dmi_system_id *id)
|
||||
{
|
||||
pr_info("Laptop model '%s'\n", id->ident);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static const struct dmi_system_id ideapad_dmi[] __initconst = {
|
||||
{
|
||||
.ident = "Lenovo IdeaPad Y550",
|
||||
.matches = {
|
||||
DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
|
||||
DMI_MATCH(DMI_PRODUCT_NAME, "20017"),
|
||||
DMI_MATCH(DMI_PRODUCT_VERSION, "Lenovo IdeaPad Y550")
|
||||
},
|
||||
.callback = ideapad_dmi_check
|
||||
},
|
||||
{
|
||||
.ident = "Lenovo IdeaPad Y550P",
|
||||
.matches = {
|
||||
DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
|
||||
DMI_MATCH(DMI_PRODUCT_NAME, "20035"),
|
||||
DMI_MATCH(DMI_PRODUCT_VERSION, "Lenovo IdeaPad Y550P")
|
||||
},
|
||||
.callback = ideapad_dmi_check
|
||||
},
|
||||
{ NULL, }
|
||||
};
|
||||
MODULE_DEVICE_TABLE(dmi, ideapad_dmi);
|
||||
|
||||
static int __init slidebar_init(void)
|
||||
{
|
||||
int err;
|
||||
|
||||
if (!force && !dmi_check_system(ideapad_dmi)) {
|
||||
pr_err("DMI does not match\n");
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
slidebar_platform_dev = platform_device_alloc("ideapad_slidebar", -1);
|
||||
if (!slidebar_platform_dev) {
|
||||
pr_err("Not enough memory\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
slidebar_platform_dev->dev.groups = ideapad_attr_groups;
|
||||
|
||||
err = platform_device_add(slidebar_platform_dev);
|
||||
if (err) {
|
||||
pr_err("Failed to register platform device\n");
|
||||
goto err_free_dev;
|
||||
}
|
||||
|
||||
err = platform_driver_probe(&slidebar_drv, ideapad_probe);
|
||||
if (err) {
|
||||
pr_err("Failed to register platform driver\n");
|
||||
goto err_delete_dev;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
err_delete_dev:
|
||||
platform_device_del(slidebar_platform_dev);
|
||||
err_free_dev:
|
||||
platform_device_put(slidebar_platform_dev);
|
||||
return err;
|
||||
}
|
||||
|
||||
static void __exit slidebar_exit(void)
|
||||
{
|
||||
platform_device_unregister(slidebar_platform_dev);
|
||||
platform_driver_unregister(&slidebar_drv);
|
||||
}
|
||||
|
||||
module_init(slidebar_init);
|
||||
module_exit(slidebar_exit);
|
||||
|
||||
MODULE_AUTHOR("Andrey Moiseev <o2g.org.ru@gmail.com>");
|
||||
MODULE_DESCRIPTION("Slidebar input support for some Lenovo IdeaPad laptops");
|
||||
MODULE_LICENSE("GPL");
|
||||
@@ -143,7 +143,7 @@ static int pwm_beeper_remove(struct platform_device *pdev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_PM
|
||||
#ifdef CONFIG_PM_SLEEP
|
||||
static int pwm_beeper_suspend(struct device *dev)
|
||||
{
|
||||
struct pwm_beeper *beeper = dev_get_drvdata(dev);
|
||||
|
||||
@@ -257,7 +257,6 @@ static SIMPLE_DEV_PM_OPS(twl6040_vibra_pm_ops, twl6040_vibra_suspend, NULL);
|
||||
|
||||
static int twl6040_vibra_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct twl6040_vibra_data *pdata = pdev->dev.platform_data;
|
||||
struct device *twl6040_core_dev = pdev->dev.parent;
|
||||
struct device_node *twl6040_core_node = NULL;
|
||||
struct vibra_info *info;
|
||||
@@ -270,8 +269,8 @@ static int twl6040_vibra_probe(struct platform_device *pdev)
|
||||
"vibra");
|
||||
#endif
|
||||
|
||||
if (!pdata && !twl6040_core_node) {
|
||||
dev_err(&pdev->dev, "platform_data not available\n");
|
||||
if (!twl6040_core_node) {
|
||||
dev_err(&pdev->dev, "parent of node is missing?\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
@@ -284,27 +283,17 @@ static int twl6040_vibra_probe(struct platform_device *pdev)
|
||||
info->dev = &pdev->dev;
|
||||
|
||||
info->twl6040 = dev_get_drvdata(pdev->dev.parent);
|
||||
if (pdata) {
|
||||
info->vibldrv_res = pdata->vibldrv_res;
|
||||
info->vibrdrv_res = pdata->vibrdrv_res;
|
||||
info->viblmotor_res = pdata->viblmotor_res;
|
||||
info->vibrmotor_res = pdata->vibrmotor_res;
|
||||
vddvibl_uV = pdata->vddvibl_uV;
|
||||
vddvibr_uV = pdata->vddvibr_uV;
|
||||
} else {
|
||||
of_property_read_u32(twl6040_core_node, "ti,vibldrv-res",
|
||||
&info->vibldrv_res);
|
||||
of_property_read_u32(twl6040_core_node, "ti,vibrdrv-res",
|
||||
&info->vibrdrv_res);
|
||||
of_property_read_u32(twl6040_core_node, "ti,viblmotor-res",
|
||||
&info->viblmotor_res);
|
||||
of_property_read_u32(twl6040_core_node, "ti,vibrmotor-res",
|
||||
&info->vibrmotor_res);
|
||||
of_property_read_u32(twl6040_core_node, "ti,vddvibl-uV",
|
||||
&vddvibl_uV);
|
||||
of_property_read_u32(twl6040_core_node, "ti,vddvibr-uV",
|
||||
&vddvibr_uV);
|
||||
}
|
||||
|
||||
of_property_read_u32(twl6040_core_node, "ti,vibldrv-res",
|
||||
&info->vibldrv_res);
|
||||
of_property_read_u32(twl6040_core_node, "ti,vibrdrv-res",
|
||||
&info->vibrdrv_res);
|
||||
of_property_read_u32(twl6040_core_node, "ti,viblmotor-res",
|
||||
&info->viblmotor_res);
|
||||
of_property_read_u32(twl6040_core_node, "ti,vibrmotor-res",
|
||||
&info->vibrmotor_res);
|
||||
of_property_read_u32(twl6040_core_node, "ti,vddvibl-uV", &vddvibl_uV);
|
||||
of_property_read_u32(twl6040_core_node, "ti,vddvibr-uV", &vddvibr_uV);
|
||||
|
||||
if ((!info->vibldrv_res && !info->viblmotor_res) ||
|
||||
(!info->vibrdrv_res && !info->vibrmotor_res)) {
|
||||
@@ -334,8 +323,8 @@ static int twl6040_vibra_probe(struct platform_device *pdev)
|
||||
* When booted with Device tree the regulators are attached to the
|
||||
* parent device (twl6040 MFD core)
|
||||
*/
|
||||
ret = regulator_bulk_get(pdata ? info->dev : twl6040_core_dev,
|
||||
ARRAY_SIZE(info->supplies), info->supplies);
|
||||
ret = regulator_bulk_get(twl6040_core_dev, ARRAY_SIZE(info->supplies),
|
||||
info->supplies);
|
||||
if (ret) {
|
||||
dev_err(info->dev, "couldn't get regulators %d\n", ret);
|
||||
return ret;
|
||||
|
||||
@@ -46,7 +46,6 @@
|
||||
MODULE_AUTHOR("Miloslav Trmac <mitr@volny.cz>");
|
||||
MODULE_DESCRIPTION("Wistron laptop button driver");
|
||||
MODULE_LICENSE("GPL v2");
|
||||
MODULE_VERSION("0.3");
|
||||
|
||||
static bool force; /* = 0; */
|
||||
module_param(force, bool, 0);
|
||||
@@ -563,7 +562,7 @@ static struct key_entry keymap_wistron_md96500[] __initdata = {
|
||||
{ KE_KEY, 0x36, {KEY_WWW} },
|
||||
{ KE_WIFI, 0x30 },
|
||||
{ KE_BLUETOOTH, 0x44 },
|
||||
{ KE_END, FE_UNTESTED }
|
||||
{ KE_END, 0 }
|
||||
};
|
||||
|
||||
static struct key_entry keymap_wistron_generic[] __initdata = {
|
||||
@@ -635,7 +634,7 @@ static struct key_entry keymap_prestigio[] __initdata = {
|
||||
* a list of buttons and their key codes (reported when loading this module
|
||||
* with force=1) and the output of dmidecode to $MODULE_AUTHOR.
|
||||
*/
|
||||
static const struct dmi_system_id __initconst dmi_ids[] = {
|
||||
static const struct dmi_system_id dmi_ids[] __initconst = {
|
||||
{
|
||||
/* Fujitsu-Siemens Amilo Pro V2000 */
|
||||
.callback = dmi_matched,
|
||||
@@ -972,6 +971,7 @@ static const struct dmi_system_id __initconst dmi_ids[] = {
|
||||
},
|
||||
{ NULL, }
|
||||
};
|
||||
MODULE_DEVICE_TABLE(dmi, dmi_ids);
|
||||
|
||||
/* Copy the good keymap, as the original ones are free'd */
|
||||
static int __init copy_keymap(void)
|
||||
|
||||
@@ -44,7 +44,7 @@ static int lifebook_set_6byte_proto(const struct dmi_system_id *d)
|
||||
return 1;
|
||||
}
|
||||
|
||||
static const struct dmi_system_id __initconst lifebook_dmi_table[] = {
|
||||
static const struct dmi_system_id lifebook_dmi_table[] __initconst = {
|
||||
{
|
||||
/* FLORA-ie 55mi */
|
||||
.matches = {
|
||||
|
||||
@@ -1433,7 +1433,7 @@ static int synaptics_reconnect(struct psmouse *psmouse)
|
||||
|
||||
static bool impaired_toshiba_kbc;
|
||||
|
||||
static const struct dmi_system_id __initconst toshiba_dmi_table[] = {
|
||||
static const struct dmi_system_id toshiba_dmi_table[] __initconst = {
|
||||
#if defined(CONFIG_DMI) && defined(CONFIG_X86)
|
||||
{
|
||||
/* Toshiba Satellite */
|
||||
@@ -1472,7 +1472,7 @@ static const struct dmi_system_id __initconst toshiba_dmi_table[] = {
|
||||
|
||||
static bool broken_olpc_ec;
|
||||
|
||||
static const struct dmi_system_id __initconst olpc_dmi_table[] = {
|
||||
static const struct dmi_system_id olpc_dmi_table[] __initconst = {
|
||||
#if defined(CONFIG_DMI) && defined(CONFIG_OLPC)
|
||||
{
|
||||
/* OLPC XO-1 or XO-1.5 */
|
||||
|
||||
@@ -189,12 +189,6 @@ static int arc_ps2_probe(struct platform_device *pdev)
|
||||
int irq;
|
||||
int error, id, i;
|
||||
|
||||
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||
if (!res) {
|
||||
dev_err(&pdev->dev, "no IO memory defined\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
irq = platform_get_irq_byname(pdev, "arc_ps2_irq");
|
||||
if (irq < 0) {
|
||||
dev_err(&pdev->dev, "no IRQ defined\n");
|
||||
@@ -208,6 +202,7 @@ static int arc_ps2_probe(struct platform_device *pdev)
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||
arc_ps2->addr = devm_ioremap_resource(&pdev->dev, res);
|
||||
if (IS_ERR(arc_ps2->addr))
|
||||
return PTR_ERR(arc_ps2->addr);
|
||||
|
||||
@@ -40,30 +40,6 @@
|
||||
|
||||
#define I8042_CTL_TIMEOUT 10000
|
||||
|
||||
/*
|
||||
* Status register bits.
|
||||
*/
|
||||
|
||||
#define I8042_STR_PARITY 0x80
|
||||
#define I8042_STR_TIMEOUT 0x40
|
||||
#define I8042_STR_AUXDATA 0x20
|
||||
#define I8042_STR_KEYLOCK 0x10
|
||||
#define I8042_STR_CMDDAT 0x08
|
||||
#define I8042_STR_MUXERR 0x04
|
||||
#define I8042_STR_IBF 0x02
|
||||
#define I8042_STR_OBF 0x01
|
||||
|
||||
/*
|
||||
* Control register bits.
|
||||
*/
|
||||
|
||||
#define I8042_CTR_KBDINT 0x01
|
||||
#define I8042_CTR_AUXINT 0x02
|
||||
#define I8042_CTR_IGNKEYLOCK 0x08
|
||||
#define I8042_CTR_KBDDIS 0x10
|
||||
#define I8042_CTR_AUXDIS 0x20
|
||||
#define I8042_CTR_XLATE 0x40
|
||||
|
||||
/*
|
||||
* Return codes.
|
||||
*/
|
||||
|
||||
@@ -183,9 +183,6 @@ static int olpc_apsp_probe(struct platform_device *pdev)
|
||||
|
||||
np = pdev->dev.of_node;
|
||||
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||
if (!res)
|
||||
return -ENOENT;
|
||||
|
||||
priv->base = devm_ioremap_resource(&pdev->dev, res);
|
||||
if (IS_ERR(priv->base)) {
|
||||
dev_err(&pdev->dev, "Failed to map WTM registers\n");
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user