diff options
author | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-05-04 21:13:17 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-05-04 21:16:12 -0400 |
commit | a3d52136ee8f7399859f9a0824470fd49b1d1a00 (patch) | |
tree | ac0fd3d1efc356029cbbc5e413f778f7231cd909 /drivers/input/keyboard | |
parent | 5b339915762d30b21995aa7263e74081f2f1110a (diff) | |
parent | 84767d00a8fd54dd97866561f6e2ee246c8e1cdc (diff) |
Merge branch 'for-linus' of master.kernel.org:/pub/scm/linux/kernel/git/dtor/input
* 'for-linus' of master.kernel.org:/pub/scm/linux/kernel/git/dtor/input: (65 commits)
Input: gpio_keys - add support for switches (EV_SW)
Input: cobalt_btns - convert to use polldev library
Input: add skeleton for simple polled devices
Input: update some documentation
Input: wistron - fix typo in keymap for Acer TM610
Input: add input_set_capability() helper
Input: i8042 - add Fujitsu touchscreen/touchpad PNP IDs
Input: i8042 - add Panasonic CF-29 to nomux list
Input: lifebook - split into 2 devices
Input: lifebook - add signature of Panasonic CF-29
Input: lifebook - activate 6-byte protocol on select models
Input: lifebook - work properly on Panasonic CF-18
Input: cobalt buttons - separate device and driver registration
Input: ati_remote - make button repeat sensitivity configurable
Input: pxa27x - do not use deprecated SA_INTERRUPT flag
Input: ucb1400 - make delays configurable
Input: misc devices - switch to using input_dev->dev.parent
Input: joysticks - switch to using input_dev->dev.parent
Input: touchscreens - switch to using input_dev->dev.parent
Input: mice - switch to using input_dev->dev.parent
...
Fixed up conflicts with core device model removal of "struct subsystem" manually.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/input/keyboard')
-rw-r--r-- | drivers/input/keyboard/Kconfig | 9 | ||||
-rw-r--r-- | drivers/input/keyboard/Makefile | 1 | ||||
-rw-r--r-- | drivers/input/keyboard/aaed2000_kbd.c | 9 | ||||
-rw-r--r-- | drivers/input/keyboard/atkbd.c | 7 | ||||
-rw-r--r-- | drivers/input/keyboard/corgikbd.c | 3 | ||||
-rw-r--r-- | drivers/input/keyboard/gpio_keys.c | 22 | ||||
-rw-r--r-- | drivers/input/keyboard/hil_kbd.c | 89 | ||||
-rw-r--r-- | drivers/input/keyboard/hilkbd.c | 6 | ||||
-rw-r--r-- | drivers/input/keyboard/lkkbd.c | 7 | ||||
-rw-r--r-- | drivers/input/keyboard/locomokbd.c | 2 | ||||
-rw-r--r-- | drivers/input/keyboard/newtonkbd.c | 3 | ||||
-rw-r--r-- | drivers/input/keyboard/omap-keypad.c | 3 | ||||
-rw-r--r-- | drivers/input/keyboard/pxa27x_keyboard.c | 258 | ||||
-rw-r--r-- | drivers/input/keyboard/spitzkbd.c | 3 | ||||
-rw-r--r-- | drivers/input/keyboard/stowaway.c | 3 | ||||
-rw-r--r-- | drivers/input/keyboard/sunkbd.c | 8 | ||||
-rw-r--r-- | drivers/input/keyboard/xtkbd.c | 3 |
17 files changed, 357 insertions, 79 deletions
diff --git a/drivers/input/keyboard/Kconfig b/drivers/input/keyboard/Kconfig index c845d5c4cbba..9f42e4d3649e 100644 --- a/drivers/input/keyboard/Kconfig +++ b/drivers/input/keyboard/Kconfig | |||
@@ -214,6 +214,15 @@ config KEYBOARD_OMAP | |||
214 | To compile this driver as a module, choose M here: the | 214 | To compile this driver as a module, choose M here: the |
215 | module will be called omap-keypad. | 215 | module will be called omap-keypad. |
216 | 216 | ||
217 | config KEYBOARD_PXA27x | ||
218 | tristate "PXA27x keyboard support" | ||
219 | depends on PXA27x | ||
220 | help | ||
221 | Enable support for PXA27x matrix keyboard controller | ||
222 | |||
223 | To compile this driver as a module, choose M here: the | ||
224 | module will be called pxa27x_keyboard. | ||
225 | |||
217 | config KEYBOARD_AAED2000 | 226 | config KEYBOARD_AAED2000 |
218 | tristate "AAED-2000 keyboard" | 227 | tristate "AAED-2000 keyboard" |
219 | depends on MACH_AAED2000 | 228 | depends on MACH_AAED2000 |
diff --git a/drivers/input/keyboard/Makefile b/drivers/input/keyboard/Makefile index 7aa59ee5a0b6..28d211b87b14 100644 --- a/drivers/input/keyboard/Makefile +++ b/drivers/input/keyboard/Makefile | |||
@@ -18,6 +18,7 @@ obj-$(CONFIG_KEYBOARD_SPITZ) += spitzkbd.o | |||
18 | obj-$(CONFIG_KEYBOARD_HIL) += hil_kbd.o | 18 | obj-$(CONFIG_KEYBOARD_HIL) += hil_kbd.o |
19 | obj-$(CONFIG_KEYBOARD_HIL_OLD) += hilkbd.o | 19 | obj-$(CONFIG_KEYBOARD_HIL_OLD) += hilkbd.o |
20 | obj-$(CONFIG_KEYBOARD_OMAP) += omap-keypad.o | 20 | obj-$(CONFIG_KEYBOARD_OMAP) += omap-keypad.o |
21 | obj-$(CONFIG_KEYBOARD_PXA27x) += pxa27x_keyboard.o | ||
21 | obj-$(CONFIG_KEYBOARD_AAED2000) += aaed2000_kbd.o | 22 | obj-$(CONFIG_KEYBOARD_AAED2000) += aaed2000_kbd.o |
22 | obj-$(CONFIG_KEYBOARD_GPIO) += gpio_keys.o | 23 | obj-$(CONFIG_KEYBOARD_GPIO) += gpio_keys.o |
23 | 24 | ||
diff --git a/drivers/input/keyboard/aaed2000_kbd.c b/drivers/input/keyboard/aaed2000_kbd.c index 65fcb6af63a8..3a37505f067c 100644 --- a/drivers/input/keyboard/aaed2000_kbd.c +++ b/drivers/input/keyboard/aaed2000_kbd.c | |||
@@ -97,7 +97,7 @@ static void aaedkbd_work(void *data) | |||
97 | 97 | ||
98 | static int aaedkbd_open(struct input_dev *indev) | 98 | static int aaedkbd_open(struct input_dev *indev) |
99 | { | 99 | { |
100 | struct aaedkbd *aaedkbd = indev->private; | 100 | struct aaedkbd *aaedkbd = input_get_drvdata(indev); |
101 | 101 | ||
102 | schedule_delayed_work(&aaedkbd->workq, msecs_to_jiffies(SCAN_INTERVAL)); | 102 | schedule_delayed_work(&aaedkbd->workq, msecs_to_jiffies(SCAN_INTERVAL)); |
103 | 103 | ||
@@ -106,7 +106,7 @@ static int aaedkbd_open(struct input_dev *indev) | |||
106 | 106 | ||
107 | static void aaedkbd_close(struct input_dev *indev) | 107 | static void aaedkbd_close(struct input_dev *indev) |
108 | { | 108 | { |
109 | struct aaedkbd *aaedkbd = indev->private; | 109 | struct aaedkbd *aaedkbd = input_get_drvdata(indev); |
110 | 110 | ||
111 | cancel_delayed_work(&aaedkbd->workq); | 111 | cancel_delayed_work(&aaedkbd->workq); |
112 | flush_scheduled_work(); | 112 | flush_scheduled_work(); |
@@ -141,8 +141,9 @@ static int __devinit aaedkbd_probe(struct platform_device *pdev) | |||
141 | input_dev->id.vendor = 0x0001; | 141 | input_dev->id.vendor = 0x0001; |
142 | input_dev->id.product = 0x0001; | 142 | input_dev->id.product = 0x0001; |
143 | input_dev->id.version = 0x0100; | 143 | input_dev->id.version = 0x0100; |
144 | input_dev->cdev.dev = &pdev->dev; | 144 | input_dev->dev.parent = &pdev->dev; |
145 | input_dev->private = aaedkbd; | 145 | |
146 | input_set_drvdata(input_dev, aaedkbd); | ||
146 | 147 | ||
147 | input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REP); | 148 | input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REP); |
148 | input_dev->keycode = aaedkbd->keycode; | 149 | input_dev->keycode = aaedkbd->keycode; |
diff --git a/drivers/input/keyboard/atkbd.c b/drivers/input/keyboard/atkbd.c index 663877076bc7..be1fe46cd308 100644 --- a/drivers/input/keyboard/atkbd.c +++ b/drivers/input/keyboard/atkbd.c | |||
@@ -586,7 +586,7 @@ static void atkbd_event_work(struct work_struct *work) | |||
586 | 586 | ||
587 | static int atkbd_event(struct input_dev *dev, unsigned int type, unsigned int code, int value) | 587 | static int atkbd_event(struct input_dev *dev, unsigned int type, unsigned int code, int value) |
588 | { | 588 | { |
589 | struct atkbd *atkbd = dev->private; | 589 | struct atkbd *atkbd = input_get_drvdata(dev); |
590 | 590 | ||
591 | if (!atkbd->write) | 591 | if (!atkbd->write) |
592 | return -1; | 592 | return -1; |
@@ -883,8 +883,9 @@ static void atkbd_set_device_attrs(struct atkbd *atkbd) | |||
883 | input_dev->id.product = atkbd->translated ? 1 : atkbd->set; | 883 | input_dev->id.product = atkbd->translated ? 1 : atkbd->set; |
884 | input_dev->id.version = atkbd->id; | 884 | input_dev->id.version = atkbd->id; |
885 | input_dev->event = atkbd_event; | 885 | input_dev->event = atkbd_event; |
886 | input_dev->private = atkbd; | 886 | input_dev->dev.parent = &atkbd->ps2dev.serio->dev; |
887 | input_dev->cdev.dev = &atkbd->ps2dev.serio->dev; | 887 | |
888 | input_set_drvdata(input_dev, atkbd); | ||
888 | 889 | ||
889 | input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REP) | BIT(EV_MSC); | 890 | input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REP) | BIT(EV_MSC); |
890 | 891 | ||
diff --git a/drivers/input/keyboard/corgikbd.c b/drivers/input/keyboard/corgikbd.c index 1016c94e65db..6578bfff644b 100644 --- a/drivers/input/keyboard/corgikbd.c +++ b/drivers/input/keyboard/corgikbd.c | |||
@@ -323,8 +323,7 @@ static int __init corgikbd_probe(struct platform_device *pdev) | |||
323 | input_dev->id.vendor = 0x0001; | 323 | input_dev->id.vendor = 0x0001; |
324 | input_dev->id.product = 0x0001; | 324 | input_dev->id.product = 0x0001; |
325 | input_dev->id.version = 0x0100; | 325 | input_dev->id.version = 0x0100; |
326 | input_dev->cdev.dev = &pdev->dev; | 326 | input_dev->dev.parent = &pdev->dev; |
327 | input_dev->private = corgikbd; | ||
328 | 327 | ||
329 | input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REP) | BIT(EV_PWR) | BIT(EV_SW); | 328 | input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REP) | BIT(EV_PWR) | BIT(EV_SW); |
330 | input_dev->keycode = corgikbd->keycode; | 329 | input_dev->keycode = corgikbd->keycode; |
diff --git a/drivers/input/keyboard/gpio_keys.c b/drivers/input/keyboard/gpio_keys.c index ccf6df387b62..739212252b09 100644 --- a/drivers/input/keyboard/gpio_keys.c +++ b/drivers/input/keyboard/gpio_keys.c | |||
@@ -35,11 +35,14 @@ static irqreturn_t gpio_keys_isr(int irq, void *dev_id) | |||
35 | struct input_dev *input = platform_get_drvdata(pdev); | 35 | struct input_dev *input = platform_get_drvdata(pdev); |
36 | 36 | ||
37 | for (i = 0; i < pdata->nbuttons; i++) { | 37 | for (i = 0; i < pdata->nbuttons; i++) { |
38 | int gpio = pdata->buttons[i].gpio; | 38 | struct gpio_keys_button *button = &pdata->buttons[i]; |
39 | int gpio = button->gpio; | ||
40 | |||
39 | if (irq == gpio_to_irq(gpio)) { | 41 | if (irq == gpio_to_irq(gpio)) { |
40 | int state = (gpio_get_value(gpio) ? 1 : 0) ^ (pdata->buttons[i].active_low); | 42 | unsigned int type = button->type ?: EV_KEY; |
43 | int state = (gpio_get_value(gpio) ? 1 : 0) ^ button->active_low; | ||
41 | 44 | ||
42 | input_report_key(input, pdata->buttons[i].keycode, state); | 45 | input_event(input, type, button->code, !!state); |
43 | input_sync(input); | 46 | input_sync(input); |
44 | } | 47 | } |
45 | } | 48 | } |
@@ -63,8 +66,7 @@ static int __devinit gpio_keys_probe(struct platform_device *pdev) | |||
63 | 66 | ||
64 | input->name = pdev->name; | 67 | input->name = pdev->name; |
65 | input->phys = "gpio-keys/input0"; | 68 | input->phys = "gpio-keys/input0"; |
66 | input->cdev.dev = &pdev->dev; | 69 | input->dev.parent = &pdev->dev; |
67 | input->private = pdata; | ||
68 | 70 | ||
69 | input->id.bustype = BUS_HOST; | 71 | input->id.bustype = BUS_HOST; |
70 | input->id.vendor = 0x0001; | 72 | input->id.vendor = 0x0001; |
@@ -72,19 +74,21 @@ static int __devinit gpio_keys_probe(struct platform_device *pdev) | |||
72 | input->id.version = 0x0100; | 74 | input->id.version = 0x0100; |
73 | 75 | ||
74 | for (i = 0; i < pdata->nbuttons; i++) { | 76 | for (i = 0; i < pdata->nbuttons; i++) { |
75 | int code = pdata->buttons[i].keycode; | 77 | struct gpio_keys_button *button = &pdata->buttons[i]; |
76 | int irq = gpio_to_irq(pdata->buttons[i].gpio); | 78 | int irq = gpio_to_irq(button->gpio); |
79 | unsigned int type = button->type ?: EV_KEY; | ||
77 | 80 | ||
78 | set_irq_type(irq, IRQ_TYPE_EDGE_BOTH); | 81 | set_irq_type(irq, IRQ_TYPE_EDGE_BOTH); |
79 | error = request_irq(irq, gpio_keys_isr, IRQF_SAMPLE_RANDOM, | 82 | error = request_irq(irq, gpio_keys_isr, IRQF_SAMPLE_RANDOM, |
80 | pdata->buttons[i].desc ? pdata->buttons[i].desc : "gpio_keys", | 83 | button->desc ? button->desc : "gpio_keys", |
81 | pdev); | 84 | pdev); |
82 | if (error) { | 85 | if (error) { |
83 | printk(KERN_ERR "gpio-keys: unable to claim irq %d; error %d\n", | 86 | printk(KERN_ERR "gpio-keys: unable to claim irq %d; error %d\n", |
84 | irq, error); | 87 | irq, error); |
85 | goto fail; | 88 | goto fail; |
86 | } | 89 | } |
87 | set_bit(code, input->keybit); | 90 | |
91 | input_set_capability(input, type, button->code); | ||
88 | } | 92 | } |
89 | 93 | ||
90 | error = input_register_device(input); | 94 | error = input_register_device(input); |
diff --git a/drivers/input/keyboard/hil_kbd.c b/drivers/input/keyboard/hil_kbd.c index 7cc9728b04df..cdd254f2e6c7 100644 --- a/drivers/input/keyboard/hil_kbd.c +++ b/drivers/input/keyboard/hil_kbd.c | |||
@@ -51,7 +51,7 @@ MODULE_LICENSE("Dual BSD/GPL"); | |||
51 | 51 | ||
52 | #define HIL_KBD_SET1_UPBIT 0x01 | 52 | #define HIL_KBD_SET1_UPBIT 0x01 |
53 | #define HIL_KBD_SET1_SHIFT 1 | 53 | #define HIL_KBD_SET1_SHIFT 1 |
54 | static unsigned int hil_kbd_set1[HIL_KEYCODES_SET1_TBLSIZE] = | 54 | static unsigned int hil_kbd_set1[HIL_KEYCODES_SET1_TBLSIZE] __read_mostly = |
55 | { HIL_KEYCODES_SET1 }; | 55 | { HIL_KEYCODES_SET1 }; |
56 | 56 | ||
57 | #define HIL_KBD_SET2_UPBIT 0x01 | 57 | #define HIL_KBD_SET2_UPBIT 0x01 |
@@ -60,10 +60,10 @@ static unsigned int hil_kbd_set1[HIL_KEYCODES_SET1_TBLSIZE] = | |||
60 | 60 | ||
61 | #define HIL_KBD_SET3_UPBIT 0x80 | 61 | #define HIL_KBD_SET3_UPBIT 0x80 |
62 | #define HIL_KBD_SET3_SHIFT 0 | 62 | #define HIL_KBD_SET3_SHIFT 0 |
63 | static unsigned int hil_kbd_set3[HIL_KEYCODES_SET3_TBLSIZE] = | 63 | static unsigned int hil_kbd_set3[HIL_KEYCODES_SET3_TBLSIZE] __read_mostly = |
64 | { HIL_KEYCODES_SET3 }; | 64 | { HIL_KEYCODES_SET3 }; |
65 | 65 | ||
66 | static char hil_language[][16] = { HIL_LOCALE_MAP }; | 66 | static const char hil_language[][16] = { HIL_LOCALE_MAP }; |
67 | 67 | ||
68 | struct hil_kbd { | 68 | struct hil_kbd { |
69 | struct input_dev *dev; | 69 | struct input_dev *dev; |
@@ -94,10 +94,12 @@ static void hil_kbd_process_record(struct hil_kbd *kbd) | |||
94 | idx = kbd->idx4/4; | 94 | idx = kbd->idx4/4; |
95 | p = data[idx - 1]; | 95 | p = data[idx - 1]; |
96 | 96 | ||
97 | if ((p & ~HIL_CMDCT_POL) == | 97 | if ((p & ~HIL_CMDCT_POL) == |
98 | (HIL_ERR_INT | HIL_PKT_CMD | HIL_CMD_POL)) goto report; | 98 | (HIL_ERR_INT | HIL_PKT_CMD | HIL_CMD_POL)) |
99 | if ((p & ~HIL_CMDCT_RPL) == | 99 | goto report; |
100 | (HIL_ERR_INT | HIL_PKT_CMD | HIL_CMD_RPL)) goto report; | 100 | if ((p & ~HIL_CMDCT_RPL) == |
101 | (HIL_ERR_INT | HIL_PKT_CMD | HIL_CMD_RPL)) | ||
102 | goto report; | ||
101 | 103 | ||
102 | /* Not a poll response. See if we are loading config records. */ | 104 | /* Not a poll response. See if we are loading config records. */ |
103 | switch (p & HIL_PKT_DATA_MASK) { | 105 | switch (p & HIL_PKT_DATA_MASK) { |
@@ -107,27 +109,32 @@ static void hil_kbd_process_record(struct hil_kbd *kbd) | |||
107 | for (; i < HIL_KBD_MAX_LENGTH; i++) | 109 | for (; i < HIL_KBD_MAX_LENGTH; i++) |
108 | kbd->idd[i] = 0; | 110 | kbd->idd[i] = 0; |
109 | break; | 111 | break; |
112 | |||
110 | case HIL_CMD_RSC: | 113 | case HIL_CMD_RSC: |
111 | for (i = 0; i < idx; i++) | 114 | for (i = 0; i < idx; i++) |
112 | kbd->rsc[i] = kbd->data[i] & HIL_PKT_DATA_MASK; | 115 | kbd->rsc[i] = kbd->data[i] & HIL_PKT_DATA_MASK; |
113 | for (; i < HIL_KBD_MAX_LENGTH; i++) | 116 | for (; i < HIL_KBD_MAX_LENGTH; i++) |
114 | kbd->rsc[i] = 0; | 117 | kbd->rsc[i] = 0; |
115 | break; | 118 | break; |
119 | |||
116 | case HIL_CMD_EXD: | 120 | case HIL_CMD_EXD: |
117 | for (i = 0; i < idx; i++) | 121 | for (i = 0; i < idx; i++) |
118 | kbd->exd[i] = kbd->data[i] & HIL_PKT_DATA_MASK; | 122 | kbd->exd[i] = kbd->data[i] & HIL_PKT_DATA_MASK; |
119 | for (; i < HIL_KBD_MAX_LENGTH; i++) | 123 | for (; i < HIL_KBD_MAX_LENGTH; i++) |
120 | kbd->exd[i] = 0; | 124 | kbd->exd[i] = 0; |
121 | break; | 125 | break; |
126 | |||
122 | case HIL_CMD_RNM: | 127 | case HIL_CMD_RNM: |
123 | for (i = 0; i < idx; i++) | 128 | for (i = 0; i < idx; i++) |
124 | kbd->rnm[i] = kbd->data[i] & HIL_PKT_DATA_MASK; | 129 | kbd->rnm[i] = kbd->data[i] & HIL_PKT_DATA_MASK; |
125 | for (; i < HIL_KBD_MAX_LENGTH + 1; i++) | 130 | for (; i < HIL_KBD_MAX_LENGTH + 1; i++) |
126 | kbd->rnm[i] = '\0'; | 131 | kbd->rnm[i] = '\0'; |
127 | break; | 132 | break; |
133 | |||
128 | default: | 134 | default: |
129 | /* These occur when device isn't present */ | 135 | /* These occur when device isn't present */ |
130 | if (p == (HIL_ERR_INT | HIL_PKT_CMD)) break; | 136 | if (p == (HIL_ERR_INT | HIL_PKT_CMD)) |
137 | break; | ||
131 | /* Anything else we'd like to know about. */ | 138 | /* Anything else we'd like to know about. */ |
132 | printk(KERN_WARNING PREFIX "Device sent unknown record %x\n", p); | 139 | printk(KERN_WARNING PREFIX "Device sent unknown record %x\n", p); |
133 | break; | 140 | break; |
@@ -139,16 +146,19 @@ static void hil_kbd_process_record(struct hil_kbd *kbd) | |||
139 | switch (kbd->data[0] & HIL_POL_CHARTYPE_MASK) { | 146 | switch (kbd->data[0] & HIL_POL_CHARTYPE_MASK) { |
140 | case HIL_POL_CHARTYPE_NONE: | 147 | case HIL_POL_CHARTYPE_NONE: |
141 | break; | 148 | break; |
149 | |||
142 | case HIL_POL_CHARTYPE_ASCII: | 150 | case HIL_POL_CHARTYPE_ASCII: |
143 | while (cnt < idx - 1) | 151 | while (cnt < idx - 1) |
144 | input_report_key(dev, kbd->data[cnt++] & 0x7f, 1); | 152 | input_report_key(dev, kbd->data[cnt++] & 0x7f, 1); |
145 | break; | 153 | break; |
154 | |||
146 | case HIL_POL_CHARTYPE_RSVD1: | 155 | case HIL_POL_CHARTYPE_RSVD1: |
147 | case HIL_POL_CHARTYPE_RSVD2: | 156 | case HIL_POL_CHARTYPE_RSVD2: |
148 | case HIL_POL_CHARTYPE_BINARY: | 157 | case HIL_POL_CHARTYPE_BINARY: |
149 | while (cnt < idx - 1) | 158 | while (cnt < idx - 1) |
150 | input_report_key(dev, kbd->data[cnt++], 1); | 159 | input_report_key(dev, kbd->data[cnt++], 1); |
151 | break; | 160 | break; |
161 | |||
152 | case HIL_POL_CHARTYPE_SET1: | 162 | case HIL_POL_CHARTYPE_SET1: |
153 | while (cnt < idx - 1) { | 163 | while (cnt < idx - 1) { |
154 | unsigned int key; | 164 | unsigned int key; |
@@ -161,6 +171,7 @@ static void hil_kbd_process_record(struct hil_kbd *kbd) | |||
161 | input_report_key(dev, key, !up); | 171 | input_report_key(dev, key, !up); |
162 | } | 172 | } |
163 | break; | 173 | break; |
174 | |||
164 | case HIL_POL_CHARTYPE_SET2: | 175 | case HIL_POL_CHARTYPE_SET2: |
165 | while (cnt < idx - 1) { | 176 | while (cnt < idx - 1) { |
166 | unsigned int key; | 177 | unsigned int key; |
@@ -173,6 +184,7 @@ static void hil_kbd_process_record(struct hil_kbd *kbd) | |||
173 | input_report_key(dev, key, !up); | 184 | input_report_key(dev, key, !up); |
174 | } | 185 | } |
175 | break; | 186 | break; |
187 | |||
176 | case HIL_POL_CHARTYPE_SET3: | 188 | case HIL_POL_CHARTYPE_SET3: |
177 | while (cnt < idx - 1) { | 189 | while (cnt < idx - 1) { |
178 | unsigned int key; | 190 | unsigned int key; |
@@ -191,42 +203,43 @@ static void hil_kbd_process_record(struct hil_kbd *kbd) | |||
191 | up(&kbd->sem); | 203 | up(&kbd->sem); |
192 | } | 204 | } |
193 | 205 | ||
194 | static void hil_kbd_process_err(struct hil_kbd *kbd) { | 206 | static void hil_kbd_process_err(struct hil_kbd *kbd) |
207 | { | ||
195 | printk(KERN_WARNING PREFIX "errored HIL packet\n"); | 208 | printk(KERN_WARNING PREFIX "errored HIL packet\n"); |
196 | kbd->idx4 = 0; | 209 | kbd->idx4 = 0; |
197 | up(&kbd->sem); | 210 | up(&kbd->sem); |
198 | } | 211 | } |
199 | 212 | ||
200 | static irqreturn_t hil_kbd_interrupt(struct serio *serio, | 213 | static irqreturn_t hil_kbd_interrupt(struct serio *serio, |
201 | unsigned char data, unsigned int flags) | 214 | unsigned char data, unsigned int flags) |
202 | { | 215 | { |
203 | struct hil_kbd *kbd; | 216 | struct hil_kbd *kbd; |
204 | hil_packet packet; | 217 | hil_packet packet; |
205 | int idx; | 218 | int idx; |
206 | 219 | ||
207 | kbd = serio_get_drvdata(serio); | 220 | kbd = serio_get_drvdata(serio); |
208 | if (kbd == NULL) { | 221 | BUG_ON(kbd == NULL); |
209 | BUG(); | ||
210 | return IRQ_HANDLED; | ||
211 | } | ||
212 | 222 | ||
213 | if (kbd->idx4 >= (HIL_KBD_MAX_LENGTH * sizeof(hil_packet))) { | 223 | if (kbd->idx4 >= (HIL_KBD_MAX_LENGTH * sizeof(hil_packet))) { |
214 | hil_kbd_process_err(kbd); | 224 | hil_kbd_process_err(kbd); |
215 | return IRQ_HANDLED; | 225 | return IRQ_HANDLED; |
216 | } | 226 | } |
217 | idx = kbd->idx4/4; | 227 | idx = kbd->idx4/4; |
218 | if (!(kbd->idx4 % 4)) kbd->data[idx] = 0; | 228 | if (!(kbd->idx4 % 4)) |
229 | kbd->data[idx] = 0; | ||
219 | packet = kbd->data[idx]; | 230 | packet = kbd->data[idx]; |
220 | packet |= ((hil_packet)data) << ((3 - (kbd->idx4 % 4)) * 8); | 231 | packet |= ((hil_packet)data) << ((3 - (kbd->idx4 % 4)) * 8); |
221 | kbd->data[idx] = packet; | 232 | kbd->data[idx] = packet; |
222 | 233 | ||
223 | /* Records of N 4-byte hil_packets must terminate with a command. */ | 234 | /* Records of N 4-byte hil_packets must terminate with a command. */ |
224 | if ((++(kbd->idx4)) % 4) return IRQ_HANDLED; | 235 | if ((++(kbd->idx4)) % 4) |
236 | return IRQ_HANDLED; | ||
225 | if ((packet & 0xffff0000) != HIL_ERR_INT) { | 237 | if ((packet & 0xffff0000) != HIL_ERR_INT) { |
226 | hil_kbd_process_err(kbd); | 238 | hil_kbd_process_err(kbd); |
227 | return IRQ_HANDLED; | 239 | return IRQ_HANDLED; |
228 | } | 240 | } |
229 | if (packet & HIL_PKT_CMD) hil_kbd_process_record(kbd); | 241 | if (packet & HIL_PKT_CMD) |
242 | hil_kbd_process_record(kbd); | ||
230 | return IRQ_HANDLED; | 243 | return IRQ_HANDLED; |
231 | } | 244 | } |
232 | 245 | ||
@@ -235,10 +248,7 @@ static void hil_kbd_disconnect(struct serio *serio) | |||
235 | struct hil_kbd *kbd; | 248 | struct hil_kbd *kbd; |
236 | 249 | ||
237 | kbd = serio_get_drvdata(serio); | 250 | kbd = serio_get_drvdata(serio); |
238 | if (kbd == NULL) { | 251 | BUG_ON(kbd == NULL); |
239 | BUG(); | ||
240 | return; | ||
241 | } | ||
242 | 252 | ||
243 | serio_close(serio); | 253 | serio_close(serio); |
244 | input_unregister_device(kbd->dev); | 254 | input_unregister_device(kbd->dev); |
@@ -259,42 +269,40 @@ static int hil_kbd_connect(struct serio *serio, struct serio_driver *drv) | |||
259 | if (!kbd->dev) | 269 | if (!kbd->dev) |
260 | goto bail0; | 270 | goto bail0; |
261 | 271 | ||
262 | kbd->dev->private = kbd; | ||
263 | |||
264 | if (serio_open(serio, drv)) | 272 | if (serio_open(serio, drv)) |
265 | goto bail1; | 273 | goto bail1; |
266 | 274 | ||
267 | serio_set_drvdata(serio, kbd); | 275 | serio_set_drvdata(serio, kbd); |
268 | kbd->serio = serio; | 276 | kbd->serio = serio; |
269 | 277 | ||
270 | init_MUTEX_LOCKED(&(kbd->sem)); | 278 | init_MUTEX_LOCKED(&kbd->sem); |
271 | 279 | ||
272 | /* Get device info. MLC driver supplies devid/status/etc. */ | 280 | /* Get device info. MLC driver supplies devid/status/etc. */ |
273 | serio->write(serio, 0); | 281 | serio->write(serio, 0); |
274 | serio->write(serio, 0); | 282 | serio->write(serio, 0); |
275 | serio->write(serio, HIL_PKT_CMD >> 8); | 283 | serio->write(serio, HIL_PKT_CMD >> 8); |
276 | serio->write(serio, HIL_CMD_IDD); | 284 | serio->write(serio, HIL_CMD_IDD); |
277 | down(&(kbd->sem)); | 285 | down(&kbd->sem); |
278 | 286 | ||
279 | serio->write(serio, 0); | 287 | serio->write(serio, 0); |
280 | serio->write(serio, 0); | 288 | serio->write(serio, 0); |
281 | serio->write(serio, HIL_PKT_CMD >> 8); | 289 | serio->write(serio, HIL_PKT_CMD >> 8); |
282 | serio->write(serio, HIL_CMD_RSC); | 290 | serio->write(serio, HIL_CMD_RSC); |
283 | down(&(kbd->sem)); | 291 | down(&kbd->sem); |
284 | 292 | ||
285 | serio->write(serio, 0); | 293 | serio->write(serio, 0); |
286 | serio->write(serio, 0); | 294 | serio->write(serio, 0); |
287 | serio->write(serio, HIL_PKT_CMD >> 8); | 295 | serio->write(serio, HIL_PKT_CMD >> 8); |
288 | serio->write(serio, HIL_CMD_RNM); | 296 | serio->write(serio, HIL_CMD_RNM); |
289 | down(&(kbd->sem)); | 297 | down(&kbd->sem); |
290 | 298 | ||
291 | serio->write(serio, 0); | 299 | serio->write(serio, 0); |
292 | serio->write(serio, 0); | 300 | serio->write(serio, 0); |
293 | serio->write(serio, HIL_PKT_CMD >> 8); | 301 | serio->write(serio, HIL_PKT_CMD >> 8); |
294 | serio->write(serio, HIL_CMD_EXD); | 302 | serio->write(serio, HIL_CMD_EXD); |
295 | down(&(kbd->sem)); | 303 | down(&kbd->sem); |
296 | 304 | ||
297 | up(&(kbd->sem)); | 305 | up(&kbd->sem); |
298 | 306 | ||
299 | did = kbd->idd[0]; | 307 | did = kbd->idd[0]; |
300 | idd = kbd->idd + 1; | 308 | idd = kbd->idd + 1; |
@@ -310,12 +318,11 @@ static int hil_kbd_connect(struct serio *serio, struct serio_driver *drv) | |||
310 | goto bail2; | 318 | goto bail2; |
311 | } | 319 | } |
312 | 320 | ||
313 | if(HIL_IDD_NUM_BUTTONS(idd) || HIL_IDD_NUM_AXES_PER_SET(*idd)) { | 321 | if (HIL_IDD_NUM_BUTTONS(idd) || HIL_IDD_NUM_AXES_PER_SET(*idd)) { |
314 | printk(KERN_INFO PREFIX "keyboards only, no combo devices supported.\n"); | 322 | printk(KERN_INFO PREFIX "keyboards only, no combo devices supported.\n"); |
315 | goto bail2; | 323 | goto bail2; |
316 | } | 324 | } |
317 | 325 | ||
318 | |||
319 | kbd->dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REP); | 326 | kbd->dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REP); |
320 | kbd->dev->ledbit[0] = BIT(LED_NUML) | BIT(LED_CAPSL) | BIT(LED_SCROLLL); | 327 | kbd->dev->ledbit[0] = BIT(LED_NUML) | BIT(LED_CAPSL) | BIT(LED_SCROLLL); |
321 | kbd->dev->keycodemax = HIL_KEYCODES_SET1_TBLSIZE; | 328 | kbd->dev->keycodemax = HIL_KEYCODES_SET1_TBLSIZE; |
@@ -328,7 +335,7 @@ static int hil_kbd_connect(struct serio *serio, struct serio_driver *drv) | |||
328 | kbd->dev->id.vendor = PCI_VENDOR_ID_HP; | 335 | kbd->dev->id.vendor = PCI_VENDOR_ID_HP; |
329 | kbd->dev->id.product = 0x0001; /* TODO: get from kbd->rsc */ | 336 | kbd->dev->id.product = 0x0001; /* TODO: get from kbd->rsc */ |
330 | kbd->dev->id.version = 0x0100; /* TODO: get from kbd->rsc */ | 337 | kbd->dev->id.version = 0x0100; /* TODO: get from kbd->rsc */ |
331 | kbd->dev->cdev.dev = &serio->dev; | 338 | kbd->dev->dev.parent = &serio->dev; |
332 | 339 | ||
333 | for (i = 0; i < 128; i++) { | 340 | for (i = 0; i < 128; i++) { |
334 | set_bit(hil_kbd_set1[i], kbd->dev->keybit); | 341 | set_bit(hil_kbd_set1[i], kbd->dev->keybit); |
@@ -344,8 +351,8 @@ static int hil_kbd_connect(struct serio *serio, struct serio_driver *drv) | |||
344 | serio->write(serio, 0); | 351 | serio->write(serio, 0); |
345 | serio->write(serio, HIL_PKT_CMD >> 8); | 352 | serio->write(serio, HIL_PKT_CMD >> 8); |
346 | serio->write(serio, HIL_CMD_EK1); /* Enable Keyswitch Autorepeat 1 */ | 353 | serio->write(serio, HIL_CMD_EK1); /* Enable Keyswitch Autorepeat 1 */ |
347 | down(&(kbd->sem)); | 354 | down(&kbd->sem); |
348 | up(&(kbd->sem)); | 355 | up(&kbd->sem); |
349 | 356 | ||
350 | return 0; | 357 | return 0; |
351 | bail2: | 358 | bail2: |
@@ -368,26 +375,26 @@ static struct serio_device_id hil_kbd_ids[] = { | |||
368 | { 0 } | 375 | { 0 } |
369 | }; | 376 | }; |
370 | 377 | ||
371 | struct serio_driver hil_kbd_serio_drv = { | 378 | static struct serio_driver hil_kbd_serio_drv = { |
372 | .driver = { | 379 | .driver = { |
373 | .name = "hil_kbd", | 380 | .name = "hil_kbd", |
374 | }, | 381 | }, |
375 | .description = "HP HIL keyboard driver", | 382 | .description = "HP HIL keyboard driver", |
376 | .id_table = hil_kbd_ids, | 383 | .id_table = hil_kbd_ids, |
377 | .connect = hil_kbd_connect, | 384 | .connect = hil_kbd_connect, |
378 | .disconnect = hil_kbd_disconnect, | 385 | .disconnect = hil_kbd_disconnect, |
379 | .interrupt = hil_kbd_interrupt | 386 | .interrupt = hil_kbd_interrupt |
380 | }; | 387 | }; |
381 | 388 | ||
382 | static int __init hil_kbd_init(void) | 389 | static int __init hil_kbd_init(void) |
383 | { | 390 | { |
384 | return serio_register_driver(&hil_kbd_serio_drv); | 391 | return serio_register_driver(&hil_kbd_serio_drv); |
385 | } | 392 | } |
386 | 393 | ||
387 | static void __exit hil_kbd_exit(void) | 394 | static void __exit hil_kbd_exit(void) |
388 | { | 395 | { |
389 | serio_unregister_driver(&hil_kbd_serio_drv); | 396 | serio_unregister_driver(&hil_kbd_serio_drv); |
390 | } | 397 | } |
391 | 398 | ||
392 | module_init(hil_kbd_init); | 399 | module_init(hil_kbd_init); |
393 | module_exit(hil_kbd_exit); | 400 | module_exit(hil_kbd_exit); |
diff --git a/drivers/input/keyboard/hilkbd.c b/drivers/input/keyboard/hilkbd.c index 56277fb291cd..499b6974457f 100644 --- a/drivers/input/keyboard/hilkbd.c +++ b/drivers/input/keyboard/hilkbd.c | |||
@@ -3,7 +3,7 @@ | |||
3 | * | 3 | * |
4 | * Copyright (C) 1998 Philip Blundell <philb@gnu.org> | 4 | * Copyright (C) 1998 Philip Blundell <philb@gnu.org> |
5 | * Copyright (C) 1999 Matthew Wilcox <willy@bofh.ai> | 5 | * Copyright (C) 1999 Matthew Wilcox <willy@bofh.ai> |
6 | * Copyright (C) 1999-2006 Helge Deller <deller@gmx.de> | 6 | * Copyright (C) 1999-2007 Helge Deller <deller@gmx.de> |
7 | * | 7 | * |
8 | * Very basic HP Human Interface Loop (HIL) driver. | 8 | * Very basic HP Human Interface Loop (HIL) driver. |
9 | * This driver handles the keyboard on HP300 (m68k) and on some | 9 | * This driver handles the keyboard on HP300 (m68k) and on some |
@@ -89,7 +89,7 @@ MODULE_LICENSE("GPL v2"); | |||
89 | #define HIL_READKBDSADR 0xF9 | 89 | #define HIL_READKBDSADR 0xF9 |
90 | #define HIL_WRITEKBDSADR 0xE9 | 90 | #define HIL_WRITEKBDSADR 0xE9 |
91 | 91 | ||
92 | static unsigned int hphilkeyb_keycode[HIL_KEYCODES_SET1_TBLSIZE] = | 92 | static unsigned int hphilkeyb_keycode[HIL_KEYCODES_SET1_TBLSIZE] __read_mostly = |
93 | { HIL_KEYCODES_SET1 }; | 93 | { HIL_KEYCODES_SET1 }; |
94 | 94 | ||
95 | /* HIL structure */ | 95 | /* HIL structure */ |
@@ -211,10 +211,10 @@ hil_keyb_init(void) | |||
211 | return -ENODEV; /* already initialized */ | 211 | return -ENODEV; /* already initialized */ |
212 | } | 212 | } |
213 | 213 | ||
214 | spin_lock_init(&hil_dev.lock); | ||
214 | hil_dev.dev = input_allocate_device(); | 215 | hil_dev.dev = input_allocate_device(); |
215 | if (!hil_dev.dev) | 216 | if (!hil_dev.dev) |
216 | return -ENOMEM; | 217 | return -ENOMEM; |
217 | hil_dev.dev->private = &hil_dev; | ||
218 | 218 | ||
219 | #if defined(CONFIG_HP300) | 219 | #if defined(CONFIG_HP300) |
220 | if (!hwreg_present((void *)(HILBASE + HIL_DATA))) { | 220 | if (!hwreg_present((void *)(HILBASE + HIL_DATA))) { |
diff --git a/drivers/input/keyboard/lkkbd.c b/drivers/input/keyboard/lkkbd.c index 3d4d0a0ede28..1b08f4e79dd2 100644 --- a/drivers/input/keyboard/lkkbd.c +++ b/drivers/input/keyboard/lkkbd.c | |||
@@ -515,7 +515,7 @@ static int | |||
515 | lkkbd_event (struct input_dev *dev, unsigned int type, unsigned int code, | 515 | lkkbd_event (struct input_dev *dev, unsigned int type, unsigned int code, |
516 | int value) | 516 | int value) |
517 | { | 517 | { |
518 | struct lkkbd *lk = dev->private; | 518 | struct lkkbd *lk = input_get_drvdata (dev); |
519 | unsigned char leds_on = 0; | 519 | unsigned char leds_on = 0; |
520 | unsigned char leds_off = 0; | 520 | unsigned char leds_off = 0; |
521 | 521 | ||
@@ -666,9 +666,10 @@ lkkbd_connect (struct serio *serio, struct serio_driver *drv) | |||
666 | input_dev->id.vendor = SERIO_LKKBD; | 666 | input_dev->id.vendor = SERIO_LKKBD; |
667 | input_dev->id.product = 0; | 667 | input_dev->id.product = 0; |
668 | input_dev->id.version = 0x0100; | 668 | input_dev->id.version = 0x0100; |
669 | input_dev->cdev.dev = &serio->dev; | 669 | input_dev->dev.parent = &serio->dev; |
670 | input_dev->event = lkkbd_event; | 670 | input_dev->event = lkkbd_event; |
671 | input_dev->private = lk; | 671 | |
672 | input_set_drvdata (input_dev, lk); | ||
672 | 673 | ||
673 | set_bit (EV_KEY, input_dev->evbit); | 674 | set_bit (EV_KEY, input_dev->evbit); |
674 | set_bit (EV_LED, input_dev->evbit); | 675 | set_bit (EV_LED, input_dev->evbit); |
diff --git a/drivers/input/keyboard/locomokbd.c b/drivers/input/keyboard/locomokbd.c index 2ade5186cc41..7a41b271f222 100644 --- a/drivers/input/keyboard/locomokbd.c +++ b/drivers/input/keyboard/locomokbd.c | |||
@@ -231,7 +231,7 @@ static int locomokbd_probe(struct locomo_dev *dev) | |||
231 | input_dev->id.vendor = 0x0001; | 231 | input_dev->id.vendor = 0x0001; |
232 | input_dev->id.product = 0x0001; | 232 | input_dev->id.product = 0x0001; |
233 | input_dev->id.version = 0x0100; | 233 | input_dev->id.version = 0x0100; |
234 | input_dev->private = locomokbd; | 234 | input_dev->dev.parent = &dev->dev; |
235 | 235 | ||
236 | input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REP); | 236 | input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REP); |
237 | input_dev->keycode = locomokbd->keycode; | 237 | input_dev->keycode = locomokbd->keycode; |
diff --git a/drivers/input/keyboard/newtonkbd.c b/drivers/input/keyboard/newtonkbd.c index aa29b50765c9..b97a41e3ee56 100644 --- a/drivers/input/keyboard/newtonkbd.c +++ b/drivers/input/keyboard/newtonkbd.c | |||
@@ -104,8 +104,7 @@ static int nkbd_connect(struct serio *serio, struct serio_driver *drv) | |||
104 | input_dev->id.vendor = SERIO_NEWTON; | 104 | input_dev->id.vendor = SERIO_NEWTON; |
105 | input_dev->id.product = 0x0001; | 105 | input_dev->id.product = 0x0001; |
106 | input_dev->id.version = 0x0100; | 106 | input_dev->id.version = 0x0100; |
107 | input_dev->cdev.dev = &serio->dev; | 107 | input_dev->dev.parent = &serio->dev; |
108 | input_dev->private = nkbd; | ||
109 | 108 | ||
110 | input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REP); | 109 | input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REP); |
111 | input_dev->keycode = nkbd->keycode; | 110 | input_dev->keycode = nkbd->keycode; |
diff --git a/drivers/input/keyboard/omap-keypad.c b/drivers/input/keyboard/omap-keypad.c index 5680a6d95b2b..3a228634f101 100644 --- a/drivers/input/keyboard/omap-keypad.c +++ b/drivers/input/keyboard/omap-keypad.c | |||
@@ -370,8 +370,7 @@ static int __init omap_kp_probe(struct platform_device *pdev) | |||
370 | set_bit(keymap[i] & KEY_MAX, input_dev->keybit); | 370 | set_bit(keymap[i] & KEY_MAX, input_dev->keybit); |
371 | input_dev->name = "omap-keypad"; | 371 | input_dev->name = "omap-keypad"; |
372 | input_dev->phys = "omap-keypad/input0"; | 372 | input_dev->phys = "omap-keypad/input0"; |
373 | input_dev->cdev.dev = &pdev->dev; | 373 | input_dev->dev.parent = &pdev->dev; |
374 | input_dev->private = omap_kp; | ||
375 | 374 | ||
376 | input_dev->id.bustype = BUS_HOST; | 375 | input_dev->id.bustype = BUS_HOST; |
377 | input_dev->id.vendor = 0x0001; | 376 | input_dev->id.vendor = 0x0001; |
diff --git a/drivers/input/keyboard/pxa27x_keyboard.c b/drivers/input/keyboard/pxa27x_keyboard.c new file mode 100644 index 000000000000..06eaf766d9d2 --- /dev/null +++ b/drivers/input/keyboard/pxa27x_keyboard.c | |||
@@ -0,0 +1,258 @@ | |||
1 | /* | ||
2 | * linux/drivers/input/keyboard/pxa27x_keyboard.c | ||
3 | * | ||
4 | * Driver for the pxa27x matrix keyboard controller. | ||
5 | * | ||
6 | * Created: Feb 22, 2007 | ||
7 | * Author: Rodolfo Giometti <giometti@linux.it> | ||
8 | * | ||
9 | * Based on a previous implementations by Kevin O'Connor | ||
10 | * <kevin_at_koconnor.net> and Alex Osborne <bobofdoom@gmail.com> and | ||
11 | * on some suggestions by Nicolas Pitre <nico@cam.org>. | ||
12 | * | ||
13 | * This program is free software; you can redistribute it and/or modify | ||
14 | * it under the terms of the GNU General Public License version 2 as | ||
15 | * published by the Free Software Foundation. | ||
16 | */ | ||
17 | |||
18 | |||
19 | #include <linux/kernel.h> | ||
20 | #include <linux/module.h> | ||
21 | #include <linux/init.h> | ||
22 | #include <linux/interrupt.h> | ||
23 | #include <linux/input.h> | ||
24 | #include <linux/device.h> | ||
25 | #include <linux/platform_device.h> | ||
26 | |||
27 | #include <asm/mach-types.h> | ||
28 | #include <asm/mach/arch.h> | ||
29 | #include <asm/mach/map.h> | ||
30 | |||
31 | #include <asm/arch/hardware.h> | ||
32 | #include <asm/arch/pxa-regs.h> | ||
33 | #include <asm/arch/irqs.h> | ||
34 | #include <asm/arch/pxa27x_keyboard.h> | ||
35 | |||
36 | #define DRIVER_NAME "pxa27x-keyboard" | ||
37 | |||
38 | #define KPASMKP(col) (col/2 == 0 ? KPASMKP0 : \ | ||
39 | col/2 == 1 ? KPASMKP1 : \ | ||
40 | col/2 == 2 ? KPASMKP2 : KPASMKP3) | ||
41 | #define KPASMKPx_MKC(row, col) (1 << (row + 16 * (col % 2))) | ||
42 | |||
43 | static irqreturn_t pxakbd_irq_handler(int irq, void *dev_id) | ||
44 | { | ||
45 | struct platform_device *pdev = dev_id; | ||
46 | struct pxa27x_keyboard_platform_data *pdata = pdev->dev.platform_data; | ||
47 | struct input_dev *input_dev = platform_get_drvdata(pdev); | ||
48 | unsigned long kpc = KPC; | ||
49 | int p, row, col, rel; | ||
50 | |||
51 | if (kpc & KPC_DI) { | ||
52 | unsigned long kpdk = KPDK; | ||
53 | |||
54 | if (!(kpdk & KPDK_DKP)) { | ||
55 | /* better luck next time */ | ||
56 | } else if (kpc & KPC_REE0) { | ||
57 | unsigned long kprec = KPREC; | ||
58 | KPREC = 0x7f; | ||
59 | |||
60 | if (kprec & KPREC_OF0) | ||
61 | rel = (kprec & 0xff) + 0x7f; | ||
62 | else if (kprec & KPREC_UF0) | ||
63 | rel = (kprec & 0xff) - 0x7f - 0xff; | ||
64 | else | ||
65 | rel = (kprec & 0xff) - 0x7f; | ||
66 | |||
67 | if (rel) { | ||
68 | input_report_rel(input_dev, REL_WHEEL, rel); | ||
69 | input_sync(input_dev); | ||
70 | } | ||
71 | } | ||
72 | } | ||
73 | |||
74 | if (kpc & KPC_MI) { | ||
75 | /* report the status of every button */ | ||
76 | for (row = 0; row < pdata->nr_rows; row++) { | ||
77 | for (col = 0; col < pdata->nr_cols; col++) { | ||
78 | p = KPASMKP(col) & KPASMKPx_MKC(row, col) ? | ||
79 | 1 : 0; | ||
80 | pr_debug("keycode %x - pressed %x\n", | ||
81 | pdata->keycodes[row][col], p); | ||
82 | input_report_key(input_dev, | ||
83 | pdata->keycodes[row][col], p); | ||
84 | } | ||
85 | } | ||
86 | input_sync(input_dev); | ||
87 | } | ||
88 | |||
89 | return IRQ_HANDLED; | ||
90 | } | ||
91 | |||
92 | static int pxakbd_open(struct input_dev *dev) | ||
93 | { | ||
94 | /* Set keypad control register */ | ||
95 | KPC |= (KPC_ASACT | | ||
96 | KPC_MS_ALL | | ||
97 | (2 << 6) | KPC_REE0 | KPC_DK_DEB_SEL | | ||
98 | KPC_ME | KPC_MIE | KPC_DE | KPC_DIE); | ||
99 | |||
100 | KPC &= ~KPC_AS; /* disable automatic scan */ | ||
101 | KPC &= ~KPC_IMKP; /* do not ignore multiple keypresses */ | ||
102 | |||
103 | /* Set rotary count to mid-point value */ | ||
104 | KPREC = 0x7F; | ||
105 | |||
106 | /* Enable unit clock */ | ||
107 | pxa_set_cken(CKEN19_KEYPAD, 1); | ||
108 | |||
109 | return 0; | ||
110 | } | ||
111 | |||
112 | static void pxakbd_close(struct input_dev *dev) | ||
113 | { | ||
114 | /* Disable clock unit */ | ||
115 | pxa_set_cken(CKEN19_KEYPAD, 0); | ||
116 | } | ||
117 | |||
118 | #ifdef CONFIG_PM | ||
119 | static int pxakbd_suspend(struct platform_device *pdev, pm_message_t state) | ||
120 | { | ||
121 | struct pxa27x_keyboard_platform_data *pdata = pdev->dev.platform_data; | ||
122 | |||
123 | /* Save controller status */ | ||
124 | pdata->reg_kpc = KPC; | ||
125 | pdata->reg_kprec = KPREC; | ||
126 | |||
127 | return 0; | ||
128 | } | ||
129 | |||
130 | static int pxakbd_resume(struct platform_device *pdev) | ||
131 | { | ||
132 | struct pxa27x_keyboard_platform_data *pdata = pdev->dev.platform_data; | ||
133 | struct input_dev *input_dev = platform_get_drvdata(pdev); | ||
134 | |||
135 | mutex_lock(&input_dev->mutex); | ||
136 | |||
137 | if (input_dev->users) { | ||
138 | /* Restore controller status */ | ||
139 | KPC = pdata->reg_kpc; | ||
140 | KPREC = pdata->reg_kprec; | ||
141 | |||
142 | /* Enable unit clock */ | ||
143 | pxa_set_cken(CKEN19_KEYPAD, 1); | ||
144 | } | ||
145 | |||
146 | mutex_unlock(&input_dev->mutex); | ||
147 | |||
148 | return 0; | ||
149 | } | ||
150 | #else | ||
151 | #define pxakbd_suspend NULL | ||
152 | #define pxakbd_resume NULL | ||
153 | #endif | ||
154 | |||
155 | static int __devinit pxakbd_probe(struct platform_device *pdev) | ||
156 | { | ||
157 | struct pxa27x_keyboard_platform_data *pdata = pdev->dev.platform_data; | ||
158 | struct input_dev *input_dev; | ||
159 | int i, row, col, error; | ||
160 | |||
161 | /* Create and register the input driver. */ | ||
162 | input_dev = input_allocate_device(); | ||
163 | if (!input_dev) { | ||
164 | printk(KERN_ERR "Cannot request keypad device\n"); | ||
165 | return -ENOMEM; | ||
166 | } | ||
167 | |||
168 | input_dev->name = DRIVER_NAME; | ||
169 | input_dev->id.bustype = BUS_HOST; | ||
170 | input_dev->open = pxakbd_open; | ||
171 | input_dev->close = pxakbd_close; | ||
172 | input_dev->dev.parent = &pdev->dev; | ||
173 | |||
174 | input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REP) | BIT(EV_REL); | ||
175 | input_dev->relbit[LONG(REL_WHEEL)] = BIT(REL_WHEEL); | ||
176 | for (row = 0; row < pdata->nr_rows; row++) { | ||
177 | for (col = 0; col < pdata->nr_cols; col++) { | ||
178 | int code = pdata->keycodes[row][col]; | ||
179 | if (code > 0) | ||
180 | set_bit(code, input_dev->keybit); | ||
181 | } | ||
182 | } | ||
183 | |||
184 | error = request_irq(IRQ_KEYPAD, pxakbd_irq_handler, IRQF_DISABLED, | ||
185 | DRIVER_NAME, pdev); | ||
186 | if (error) { | ||
187 | printk(KERN_ERR "Cannot request keypad IRQ\n"); | ||
188 | pxa_set_cken(CKEN19_KEYPAD, 0); | ||
189 | goto err_free_dev; | ||
190 | } | ||
191 | |||
192 | platform_set_drvdata(pdev, input_dev); | ||
193 | |||
194 | /* Register the input device */ | ||
195 | error = input_register_device(input_dev); | ||
196 | if (error) | ||
197 | goto err_free_irq; | ||
198 | |||
199 | /* Setup GPIOs. */ | ||
200 | for (i = 0; i < pdata->nr_rows + pdata->nr_cols; i++) | ||
201 | pxa_gpio_mode(pdata->gpio_modes[i]); | ||
202 | |||
203 | /* | ||
204 | * Store rows/cols info into keyboard registers. | ||
205 | */ | ||
206 | |||
207 | KPC |= (pdata->nr_rows - 1) << 26; | ||
208 | KPC |= (pdata->nr_cols - 1) << 23; | ||
209 | |||
210 | for (col = 0; col < pdata->nr_cols; col++) | ||
211 | KPC |= KPC_MS0 << col; | ||
212 | |||
213 | return 0; | ||
214 | |||
215 | err_free_irq: | ||
216 | platform_set_drvdata(pdev, NULL); | ||
217 | free_irq(IRQ_KEYPAD, pdev); | ||
218 | err_free_dev: | ||
219 | input_free_device(input_dev); | ||
220 | return error; | ||
221 | } | ||
222 | |||
223 | static int __devexit pxakbd_remove(struct platform_device *pdev) | ||
224 | { | ||
225 | struct input_dev *input_dev = platform_get_drvdata(pdev); | ||
226 | |||
227 | input_unregister_device(input_dev); | ||
228 | free_irq(IRQ_KEYPAD, pdev); | ||
229 | platform_set_drvdata(pdev, NULL); | ||
230 | |||
231 | return 0; | ||
232 | } | ||
233 | |||
234 | static struct platform_driver pxakbd_driver = { | ||
235 | .probe = pxakbd_probe, | ||
236 | .remove = __devexit_p(pxakbd_remove), | ||
237 | .suspend = pxakbd_suspend, | ||
238 | .resume = pxakbd_resume, | ||
239 | .driver = { | ||
240 | .name = DRIVER_NAME, | ||
241 | }, | ||
242 | }; | ||
243 | |||
244 | static int __init pxakbd_init(void) | ||
245 | { | ||
246 | return platform_driver_register(&pxakbd_driver); | ||
247 | } | ||
248 | |||
249 | static void __exit pxakbd_exit(void) | ||
250 | { | ||
251 | platform_driver_unregister(&pxakbd_driver); | ||
252 | } | ||
253 | |||
254 | module_init(pxakbd_init); | ||
255 | module_exit(pxakbd_exit); | ||
256 | |||
257 | MODULE_DESCRIPTION("PXA27x Matrix Keyboard Driver"); | ||
258 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/input/keyboard/spitzkbd.c b/drivers/input/keyboard/spitzkbd.c index 8a2166c77ff4..41b80385476c 100644 --- a/drivers/input/keyboard/spitzkbd.c +++ b/drivers/input/keyboard/spitzkbd.c | |||
@@ -372,10 +372,9 @@ static int __init spitzkbd_probe(struct platform_device *dev) | |||
372 | 372 | ||
373 | spitzkbd->input = input_dev; | 373 | spitzkbd->input = input_dev; |
374 | 374 | ||
375 | input_dev->private = spitzkbd; | ||
376 | input_dev->name = "Spitz Keyboard"; | 375 | input_dev->name = "Spitz Keyboard"; |
377 | input_dev->phys = spitzkbd->phys; | 376 | input_dev->phys = spitzkbd->phys; |
378 | input_dev->cdev.dev = &dev->dev; | 377 | input_dev->dev.parent = &dev->dev; |
379 | 378 | ||
380 | input_dev->id.bustype = BUS_HOST; | 379 | input_dev->id.bustype = BUS_HOST; |
381 | input_dev->id.vendor = 0x0001; | 380 | input_dev->id.vendor = 0x0001; |
diff --git a/drivers/input/keyboard/stowaway.c b/drivers/input/keyboard/stowaway.c index f7b5c5b81451..b44b0684d543 100644 --- a/drivers/input/keyboard/stowaway.c +++ b/drivers/input/keyboard/stowaway.c | |||
@@ -108,8 +108,7 @@ static int skbd_connect(struct serio *serio, struct serio_driver *drv) | |||
108 | input_dev->id.vendor = SERIO_STOWAWAY; | 108 | input_dev->id.vendor = SERIO_STOWAWAY; |
109 | input_dev->id.product = 0x0001; | 109 | input_dev->id.product = 0x0001; |
110 | input_dev->id.version = 0x0100; | 110 | input_dev->id.version = 0x0100; |
111 | input_dev->cdev.dev = &serio->dev; | 111 | input_dev->dev.parent = &serio->dev; |
112 | input_dev->private = skbd; | ||
113 | 112 | ||
114 | input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REP); | 113 | input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REP); |
115 | input_dev->keycode = skbd->keycode; | 114 | input_dev->keycode = skbd->keycode; |
diff --git a/drivers/input/keyboard/sunkbd.c b/drivers/input/keyboard/sunkbd.c index cc0238366414..1d4e39624cfe 100644 --- a/drivers/input/keyboard/sunkbd.c +++ b/drivers/input/keyboard/sunkbd.c | |||
@@ -146,7 +146,7 @@ out: | |||
146 | 146 | ||
147 | static int sunkbd_event(struct input_dev *dev, unsigned int type, unsigned int code, int value) | 147 | static int sunkbd_event(struct input_dev *dev, unsigned int type, unsigned int code, int value) |
148 | { | 148 | { |
149 | struct sunkbd *sunkbd = dev->private; | 149 | struct sunkbd *sunkbd = input_get_drvdata(dev); |
150 | 150 | ||
151 | switch (type) { | 151 | switch (type) { |
152 | 152 | ||
@@ -271,8 +271,10 @@ static int sunkbd_connect(struct serio *serio, struct serio_driver *drv) | |||
271 | input_dev->id.vendor = SERIO_SUNKBD; | 271 | input_dev->id.vendor = SERIO_SUNKBD; |
272 | input_dev->id.product = sunkbd->type; | 272 | input_dev->id.product = sunkbd->type; |
273 | input_dev->id.version = 0x0100; | 273 | input_dev->id.version = 0x0100; |
274 | input_dev->cdev.dev = &serio->dev; | 274 | input_dev->dev.parent = &serio->dev; |
275 | input_dev->private = sunkbd; | 275 | |
276 | input_set_drvdata(input_dev, sunkbd); | ||
277 | |||
276 | input_dev->event = sunkbd_event; | 278 | input_dev->event = sunkbd_event; |
277 | 279 | ||
278 | input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_LED) | BIT(EV_SND) | BIT(EV_REP); | 280 | input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_LED) | BIT(EV_SND) | BIT(EV_REP); |
diff --git a/drivers/input/keyboard/xtkbd.c b/drivers/input/keyboard/xtkbd.c index a82093432138..f3a56eb58ed1 100644 --- a/drivers/input/keyboard/xtkbd.c +++ b/drivers/input/keyboard/xtkbd.c | |||
@@ -108,8 +108,7 @@ static int xtkbd_connect(struct serio *serio, struct serio_driver *drv) | |||
108 | input_dev->id.vendor = 0x0001; | 108 | input_dev->id.vendor = 0x0001; |
109 | input_dev->id.product = 0x0001; | 109 | input_dev->id.product = 0x0001; |
110 | input_dev->id.version = 0x0100; | 110 | input_dev->id.version = 0x0100; |
111 | input_dev->cdev.dev = &serio->dev; | 111 | input_dev->dev.parent = &serio->dev; |
112 | input_dev->private = xtkbd; | ||
113 | 112 | ||
114 | input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REP); | 113 | input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REP); |
115 | input_dev->keycode = xtkbd->keycode; | 114 | input_dev->keycode = xtkbd->keycode; |