diff options
author | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2013-09-06 20:23:44 -0700 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2013-09-06 20:23:44 -0700 |
commit | 07176b988ebb20f46a317a60ee1d983fe1630203 (patch) | |
tree | e54affb1f823742078c68d9506e6035016bc2ea4 /drivers/input/keyboard | |
parent | fa46c7984092f3dbdbb3bcd7338d81a1168d9d2b (diff) | |
parent | 52764fed5049655926bcecaefd52f0a415ceb105 (diff) | |
download | blackbird-op-linux-07176b988ebb20f46a317a60ee1d983fe1630203.tar.gz blackbird-op-linux-07176b988ebb20f46a317a60ee1d983fe1630203.zip |
Merge branch 'next' into for-linus
Merge first round of changes for 3.12 merge window.
Diffstat (limited to 'drivers/input/keyboard')
-rw-r--r-- | drivers/input/keyboard/imx_keypad.c | 7 | ||||
-rw-r--r-- | drivers/input/keyboard/max7359_keypad.c | 2 | ||||
-rw-r--r-- | drivers/input/keyboard/nspire-keypad.c | 7 | ||||
-rw-r--r-- | drivers/input/keyboard/omap4-keypad.c | 95 | ||||
-rw-r--r-- | drivers/input/keyboard/qt1070.c | 27 | ||||
-rw-r--r-- | drivers/input/keyboard/spear-keyboard.c | 7 | ||||
-rw-r--r-- | drivers/input/keyboard/tegra-kbc.c | 7 |
7 files changed, 103 insertions, 49 deletions
diff --git a/drivers/input/keyboard/imx_keypad.c b/drivers/input/keyboard/imx_keypad.c index 03c8cc5cb6c1..328cfc1eed95 100644 --- a/drivers/input/keyboard/imx_keypad.c +++ b/drivers/input/keyboard/imx_keypad.c @@ -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); diff --git a/drivers/input/keyboard/max7359_keypad.c b/drivers/input/keyboard/max7359_keypad.c index 7c7af2b01e65..bc2cdaf563fd 100644 --- a/drivers/input/keyboard/max7359_keypad.c +++ b/drivers/input/keyboard/max7359_keypad.c @@ -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); diff --git a/drivers/input/keyboard/nspire-keypad.c b/drivers/input/keyboard/nspire-keypad.c index 20d872d6f603..b3e3edab6d9f 100644 --- a/drivers/input/keyboard/nspire-keypad.c +++ b/drivers/input/keyboard/nspire-keypad.c @@ -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); diff --git a/drivers/input/keyboard/omap4-keypad.c b/drivers/input/keyboard/omap4-keypad.c index f4aa53a1fd69..30acfd49fa6c 100644 --- a/drivers/input/keyboard/omap4-keypad.c +++ b/drivers/input/keyboard/omap4-keypad.c @@ -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), }, }; diff --git a/drivers/input/keyboard/qt1070.c b/drivers/input/keyboard/qt1070.c index 42b773b3125a..6c561ec3cc09 100644 --- a/drivers/input/keyboard/qt1070.c +++ b/drivers/input/keyboard/qt1070.c @@ -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, diff --git a/drivers/input/keyboard/spear-keyboard.c b/drivers/input/keyboard/spear-keyboard.c index 7111124b5362..85ff530d9a91 100644 --- a/drivers/input/keyboard/spear-keyboard.c +++ b/drivers/input/keyboard/spear-keyboard.c @@ -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); diff --git a/drivers/input/keyboard/tegra-kbc.c b/drivers/input/keyboard/tegra-kbc.c index b46142f78ef2..9cd20e6905a0 100644 --- a/drivers/input/keyboard/tegra-kbc.c +++ b/drivers/input/keyboard/tegra-kbc.c @@ -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); |