diff options
author | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2009-07-21 01:12:12 -0700 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2009-07-21 01:14:13 -0700 |
commit | 24d01c0681bfbc10a99304c48a89ad213d2d7a4b (patch) | |
tree | 9a4257409ab8d2b81dbdaa43dd55143bbb5cb143 /drivers/input/keyboard/sh_keysc.c | |
parent | 99fde513f57db2c8e1b202ade4be7d47033ff09b (diff) |
Input: sh_keysc - allow modifying keymap from userspace
Adjust the driver so EVIOCGKEYCODE/EVIOCSKEYCODE work.
Acked-by: Magnus Damm <damm@igel.co.jp>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'drivers/input/keyboard/sh_keysc.c')
-rw-r--r-- | drivers/input/keyboard/sh_keysc.c | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/drivers/input/keyboard/sh_keysc.c b/drivers/input/keyboard/sh_keysc.c index cea70e6a103..0714bf2c28f 100644 --- a/drivers/input/keyboard/sh_keysc.c +++ b/drivers/input/keyboard/sh_keysc.c @@ -128,7 +128,7 @@ static int __devinit sh_keysc_probe(struct platform_device *pdev) struct resource *res; struct input_dev *input; char clk_name[8]; - int i, k; + int i; int irq, error; if (!pdev->dev.platform_data) { @@ -195,17 +195,19 @@ static int __devinit sh_keysc_probe(struct platform_device *pdev) input->id.product = 0x0001; input->id.version = 0x0100; + input->keycode = pdata->keycodes; + input->keycodesize = sizeof(pdata->keycodes[0]); + input->keycodemax = ARRAY_SIZE(pdata->keycodes); + error = request_irq(irq, sh_keysc_isr, 0, pdev->name, pdev); if (error) { dev_err(&pdev->dev, "failed to request IRQ\n"); goto err4; } - for (i = 0; i < SH_KEYSC_MAXKEYS; i++) { - k = pdata->keycodes[i]; - if (k) - input_set_capability(input, EV_KEY, k); - } + for (i = 0; i < SH_KEYSC_MAXKEYS; i++) + __set_bit(pdata->keycodes[i], input->keybit); + __clear_bit(KEY_RESERVED, input->keybit); error = input_register_device(input); if (error) { @@ -221,7 +223,9 @@ static int __devinit sh_keysc_probe(struct platform_device *pdev) iowrite16(KYCR2_IRQ_LEVEL, priv->iomem_base + KYCR2_OFFS); device_init_wakeup(&pdev->dev, 1); + return 0; + err5: free_irq(irq, pdev); err4: @@ -252,6 +256,7 @@ static int __devexit sh_keysc_remove(struct platform_device *pdev) platform_set_drvdata(pdev, NULL); kfree(priv); + return 0; } @@ -267,11 +272,12 @@ static int sh_keysc_suspend(struct device *dev) if (device_may_wakeup(dev)) { value |= 0x80; enable_irq_wake(irq); - } - else + } else { value &= ~0x80; + } iowrite16(value, priv->iomem_base + KYCR1_OFFS); + return 0; } |