diff options
author | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2009-07-21 04:12:12 -0400 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2009-07-21 04:14:13 -0400 |
commit | 24d01c0681bfbc10a99304c48a89ad213d2d7a4b (patch) | |
tree | 9a4257409ab8d2b81dbdaa43dd55143bbb5cb143 /drivers/input/keyboard | |
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')
-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 cea70e6a1031..0714bf2c28fc 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) | |||
128 | struct resource *res; | 128 | struct resource *res; |
129 | struct input_dev *input; | 129 | struct input_dev *input; |
130 | char clk_name[8]; | 130 | char clk_name[8]; |
131 | int i, k; | 131 | int i; |
132 | int irq, error; | 132 | int irq, error; |
133 | 133 | ||
134 | if (!pdev->dev.platform_data) { | 134 | if (!pdev->dev.platform_data) { |
@@ -195,17 +195,19 @@ static int __devinit sh_keysc_probe(struct platform_device *pdev) | |||
195 | input->id.product = 0x0001; | 195 | input->id.product = 0x0001; |
196 | input->id.version = 0x0100; | 196 | input->id.version = 0x0100; |
197 | 197 | ||
198 | input->keycode = pdata->keycodes; | ||
199 | input->keycodesize = sizeof(pdata->keycodes[0]); | ||
200 | input->keycodemax = ARRAY_SIZE(pdata->keycodes); | ||
201 | |||
198 | error = request_irq(irq, sh_keysc_isr, 0, pdev->name, pdev); | 202 | error = request_irq(irq, sh_keysc_isr, 0, pdev->name, pdev); |
199 | if (error) { | 203 | if (error) { |
200 | dev_err(&pdev->dev, "failed to request IRQ\n"); | 204 | dev_err(&pdev->dev, "failed to request IRQ\n"); |
201 | goto err4; | 205 | goto err4; |
202 | } | 206 | } |
203 | 207 | ||
204 | for (i = 0; i < SH_KEYSC_MAXKEYS; i++) { | 208 | for (i = 0; i < SH_KEYSC_MAXKEYS; i++) |
205 | k = pdata->keycodes[i]; | 209 | __set_bit(pdata->keycodes[i], input->keybit); |
206 | if (k) | 210 | __clear_bit(KEY_RESERVED, input->keybit); |
207 | input_set_capability(input, EV_KEY, k); | ||
208 | } | ||
209 | 211 | ||
210 | error = input_register_device(input); | 212 | error = input_register_device(input); |
211 | if (error) { | 213 | if (error) { |
@@ -221,7 +223,9 @@ static int __devinit sh_keysc_probe(struct platform_device *pdev) | |||
221 | iowrite16(KYCR2_IRQ_LEVEL, priv->iomem_base + KYCR2_OFFS); | 223 | iowrite16(KYCR2_IRQ_LEVEL, priv->iomem_base + KYCR2_OFFS); |
222 | 224 | ||
223 | device_init_wakeup(&pdev->dev, 1); | 225 | device_init_wakeup(&pdev->dev, 1); |
226 | |||
224 | return 0; | 227 | return 0; |
228 | |||
225 | err5: | 229 | err5: |
226 | free_irq(irq, pdev); | 230 | free_irq(irq, pdev); |
227 | err4: | 231 | err4: |
@@ -252,6 +256,7 @@ static int __devexit sh_keysc_remove(struct platform_device *pdev) | |||
252 | 256 | ||
253 | platform_set_drvdata(pdev, NULL); | 257 | platform_set_drvdata(pdev, NULL); |
254 | kfree(priv); | 258 | kfree(priv); |
259 | |||
255 | return 0; | 260 | return 0; |
256 | } | 261 | } |
257 | 262 | ||
@@ -267,11 +272,12 @@ static int sh_keysc_suspend(struct device *dev) | |||
267 | if (device_may_wakeup(dev)) { | 272 | if (device_may_wakeup(dev)) { |
268 | value |= 0x80; | 273 | value |= 0x80; |
269 | enable_irq_wake(irq); | 274 | enable_irq_wake(irq); |
270 | } | 275 | } else { |
271 | else | ||
272 | value &= ~0x80; | 276 | value &= ~0x80; |
277 | } | ||
273 | 278 | ||
274 | iowrite16(value, priv->iomem_base + KYCR1_OFFS); | 279 | iowrite16(value, priv->iomem_base + KYCR1_OFFS); |
280 | |||
275 | return 0; | 281 | return 0; |
276 | } | 282 | } |
277 | 283 | ||