Skip to content

Commit

Permalink
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel…
Browse files Browse the repository at this point in the history
…/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
  ...
  • Loading branch information
torvalds committed Sep 7, 2013
2 parents b04c99e + 07176b9 commit 8b8a7df
Show file tree
Hide file tree
Showing 33 changed files with 770 additions and 321 deletions.
33 changes: 33 additions & 0 deletions Documentation/devicetree/bindings/input/input-reset.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
Input: sysrq reset sequence

A simple binding to represent a set of keys as described in
include/uapi/linux/input.h. This is to communicate a sequence of keys to the
sysrq driver. Upon holding the keys for a specified amount of time (if
specified) the system is sync'ed and reset.

Key sequences are global to the system but all the keys in a set must be coming
from the same input device.

The /chosen node should contain a 'linux,sysrq-reset-seq' child node to define
a set of keys.

Required property:
sysrq-reset-seq: array of Linux keycodes, one keycode per cell.

Optional property:
timeout-ms: duration keys must be pressed together in milliseconds before
generating a sysrq. If omitted the system is rebooted immediately when a valid
sequence has been recognized.

Example:

chosen {
linux,sysrq-reset-seq {
keyset = <0x03
0x04
0x0a>;
timeout-ms = <3000>;
};
};

Would represent KEY_2, KEY_3 and KEY_9.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Required properties:
- interrupt-parent: the phandle for the interrupt controller
- interrupts: touch controller interrupt
- wakeup-gpios: the gpio pin to be used for waking up the controller
as well as uased as irq pin
and also used as irq pin

Example:

Expand Down
11 changes: 9 additions & 2 deletions MAINTAINERS
Original file line number Diff line number Diff line change
Expand Up @@ -2494,9 +2494,9 @@ S: Maintained
F: drivers/media/common/cypress_firmware*

CYTTSP TOUCHSCREEN DRIVER
M: Javier Martinez Canillas <[email protected]>
M: Ferruh Yigit <[email protected]>
L: [email protected]
S: Maintained
S: Supported
F: drivers/input/touchscreen/cyttsp*
F: include/linux/input/cyttsp.h

Expand Down Expand Up @@ -4141,6 +4141,13 @@ W: http://launchpad.net/ideapad-laptop
S: Maintained
F: drivers/platform/x86/ideapad-laptop.c

IDEAPAD LAPTOP SLIDEBAR DRIVER
M: Andrey Moiseev <[email protected]>
L: [email protected]
W: https://github.com/o2genum/ideapad-slidebar
S: Maintained
F: drivers/input/misc/ideapad_slidebar.c

IDE/ATAPI DRIVERS
M: Borislav Petkov <[email protected]>
L: [email protected]
Expand Down
3 changes: 2 additions & 1 deletion drivers/input/joystick/as5011.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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;
}

Expand Down
4 changes: 2 additions & 2 deletions drivers/input/joystick/maplecontrol.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand Down
7 changes: 1 addition & 6 deletions drivers/input/keyboard/imx_keypad.c
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand All @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion drivers/input/keyboard/max7359_keypad.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
7 changes: 1 addition & 6 deletions drivers/input/keyboard/nspire-keypad.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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);
Expand Down
95 changes: 71 additions & 24 deletions drivers/input/keyboard/omap4-keypad.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -78,6 +74,7 @@ struct omap4_keypad {
struct input_dev *input;

void __iomem *base;
bool irq_wake_enabled;
unsigned int irq;

unsigned int rows;
Expand Down Expand Up @@ -116,19 +113,29 @@ 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;
unsigned char key_state[ARRAY_SIZE(keypad_data->key_state)];
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);

Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand All @@ -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);
Expand All @@ -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);
Expand All @@ -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),
},
};
Expand Down
27 changes: 27 additions & 0 deletions drivers/input/keyboard/qt1070.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 },
{ },
Expand All @@ -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,
Expand Down
7 changes: 1 addition & 6 deletions drivers/input/keyboard/spear-keyboard.c
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down Expand Up @@ -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);
Expand Down
Loading

0 comments on commit 8b8a7df

Please sign in to comment.