10 #include <linux/input.h>
14 #include <linux/kernel.h>
15 #include <linux/module.h>
17 #include <linux/slab.h>
30 struct input_dev *
input = opencores_kbd->
input;
34 input_report_key(input, c & 0x7f, c & 0x80 ? 0 : 1);
42 struct input_dev *
input;
49 dev_err(&pdev->
dev,
"missing board memory resource\n");
55 dev_err(&pdev->
dev,
"missing board IRQ resource\n");
59 opencores_kbd = kzalloc(
sizeof(*opencores_kbd),
GFP_KERNEL);
60 input = input_allocate_device();
61 if (!opencores_kbd || !input) {
62 dev_err(&pdev->
dev,
"failed to allocate device structures\n");
70 dev_err(&pdev->
dev,
"failed to request I/O memory\n");
76 if (!opencores_kbd->
addr) {
77 dev_err(&pdev->
dev,
"failed to remap I/O memory\n");
83 opencores_kbd->
irq = irq;
85 input->name = pdev->
name;
86 input->phys =
"opencores-kbd/input0";
87 input->dev.parent = &pdev->
dev;
89 input_set_drvdata(input, opencores_kbd);
92 input->id.vendor = 0x0001;
93 input->id.product = 0x0001;
94 input->id.version = 0x0100;
96 input->keycode = opencores_kbd->
keycodes;
97 input->keycodesize =
sizeof(opencores_kbd->
keycodes[0]);
115 dev_err(&pdev->
dev,
"unable to claim irq %d\n", irq);
119 error = input_register_device(input);
121 dev_err(&pdev->
dev,
"unable to register input device\n");
125 platform_set_drvdata(pdev, opencores_kbd);
136 input_free_device(input);
137 kfree(opencores_kbd);
144 struct opencores_kbd *opencores_kbd = platform_get_drvdata(pdev);
150 resource_size(opencores_kbd->
addr_res));
151 input_unregister_device(opencores_kbd->
input);
152 kfree(opencores_kbd);
154 platform_set_drvdata(pdev,
NULL);
160 .probe = opencores_kbd_probe,
163 .name =
"opencores-kbd",