Lines Matching +full:row +full:- +full:delay

1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * LoCoMo keyboard driver for Linux-based ARM PDAs:
4 * - SHARP Zaurus Collie (SL-5500)
5 * - SHARP Zaurus Poodle (SL-5600)
15 #include <linux/delay.h>
35 0, KEY_ESC, KEY_ACTIVITY, 0, 0, 0, 0, 0, 0, 0, /* 0 - 9 */
36 0, 0, 0, 0, 0, 0, 0, KEY_MENU, KEY_HOME, KEY_CONTACT, /* 10 - 19 */
37 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 20 - 29 */
38 0, 0, 0, KEY_CENTER, 0, KEY_MAIL, 0, 0, 0, 0, /* 30 - 39 */
39 0, 0, 0, 0, 0, 0, 0, 0, 0, KEY_RIGHT, /* 40 - 49 */
40 KEY_UP, KEY_LEFT, 0, 0, KEY_P, 0, KEY_O, KEY_I, KEY_Y, KEY_T, /* 50 - 59 */
41 KEY_E, KEY_W, 0, 0, 0, 0, KEY_DOWN, KEY_ENTER, 0, 0, /* 60 - 69 */
42 KEY_BACKSPACE, 0, KEY_L, KEY_U, KEY_H, KEY_R, KEY_D, KEY_Q, 0, 0, /* 70 - 79 */
43 0, 0, 0, 0, 0, 0, KEY_ENTER, KEY_RIGHTSHIFT, KEY_K, KEY_J, /* 80 - 89 */
44 KEY_G, KEY_F, KEY_X, KEY_S, 0, 0, 0, 0, 0, 0, /* 90 - 99 */
45 0, 0, KEY_DOT, 0, KEY_COMMA, KEY_N, KEY_B, KEY_C, KEY_Z, KEY_A, /* 100 - 109 */
46 KEY_LEFTSHIFT, KEY_TAB, KEY_LEFTCTRL, 0, 0, 0, 0, 0, 0, 0, /* 110 - 119 */
47 KEY_M, KEY_SPACE, KEY_V, KEY_APOSTROPHE, KEY_SLASH, 0, 0, 0 /* 120 - 128 */
114 unsigned int row, col, rowd; in locomokbd_scankeyboard() local
117 unsigned long membase = locomokbd->base; in locomokbd_scankeyboard()
119 spin_lock_irqsave(&locomokbd->lock, flags); in locomokbd_scankeyboard()
130 for (row = 0; row < KB_ROWS; row++) { in locomokbd_scankeyboard()
133 scancode = SCANCODE(col, row); in locomokbd_scankeyboard()
134 pressed = rowd & KB_ROWMASK(row); in locomokbd_scankeyboard()
135 key = locomokbd->keycode[scancode]; in locomokbd_scankeyboard()
137 input_report_key(locomokbd->input, key, pressed); in locomokbd_scankeyboard()
148 locomokbd->suspend_jiffies + HZ)) in locomokbd_scankeyboard()
150 if (locomokbd->count_cancel++ in locomokbd_scankeyboard()
153 input_event(locomokbd->input, EV_PWR, in locomokbd_scankeyboard()
155 locomokbd->suspend_jiffies = jiffies; in locomokbd_scankeyboard()
157 locomokbd->count_cancel = 0; in locomokbd_scankeyboard()
163 input_sync(locomokbd->input); in locomokbd_scankeyboard()
167 mod_timer(&locomokbd->timer, jiffies + SCAN_INTERVAL); in locomokbd_scankeyboard()
169 locomokbd->count_cancel = 0; in locomokbd_scankeyboard()
171 spin_unlock_irqrestore(&locomokbd->lock, flags); in locomokbd_scankeyboard()
182 r = locomo_readl(locomokbd->base + LOCOMO_KIC); in locomokbd_interrupt()
186 locomo_writel(r & ~0x0100, locomokbd->base + LOCOMO_KIC); /* Ack */ in locomokbd_interrupt()
188 /** wait chattering delay **/ in locomokbd_interrupt()
210 r = locomo_readl(locomokbd->base + LOCOMO_KIC) | 0x0010; in locomokbd_open()
211 locomo_writel(r, locomokbd->base + LOCOMO_KIC); in locomokbd_open()
220 r = locomo_readl(locomokbd->base + LOCOMO_KIC) & ~0x0010; in locomokbd_close()
221 locomo_writel(r, locomokbd->base + LOCOMO_KIC); in locomokbd_close()
233 err = -ENOMEM; in locomokbd_probe()
238 if (!request_mem_region((unsigned long) dev->mapbase, in locomokbd_probe()
239 dev->length, in locomokbd_probe()
241 err = -EBUSY; in locomokbd_probe()
248 locomokbd->base = (unsigned long) dev->mapbase; in locomokbd_probe()
250 spin_lock_init(&locomokbd->lock); in locomokbd_probe()
252 timer_setup(&locomokbd->timer, locomokbd_timer_callback, 0); in locomokbd_probe()
254 locomokbd->suspend_jiffies = jiffies; in locomokbd_probe()
256 locomokbd->input = input_dev; in locomokbd_probe()
257 strcpy(locomokbd->phys, "locomokbd/input0"); in locomokbd_probe()
259 input_dev->name = "LoCoMo keyboard"; in locomokbd_probe()
260 input_dev->phys = locomokbd->phys; in locomokbd_probe()
261 input_dev->id.bustype = BUS_HOST; in locomokbd_probe()
262 input_dev->id.vendor = 0x0001; in locomokbd_probe()
263 input_dev->id.product = 0x0001; in locomokbd_probe()
264 input_dev->id.version = 0x0100; in locomokbd_probe()
265 input_dev->open = locomokbd_open; in locomokbd_probe()
266 input_dev->close = locomokbd_close; in locomokbd_probe()
267 input_dev->dev.parent = &dev->dev; in locomokbd_probe()
269 input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REP) | in locomokbd_probe()
271 input_dev->keycode = locomokbd->keycode; in locomokbd_probe()
272 input_dev->keycodesize = sizeof(locomokbd_keycode[0]); in locomokbd_probe()
273 input_dev->keycodemax = ARRAY_SIZE(locomokbd_keycode); in locomokbd_probe()
277 memcpy(locomokbd->keycode, locomokbd_keycode, sizeof(locomokbd->keycode)); in locomokbd_probe()
279 set_bit(locomokbd->keycode[i], input_dev->keybit); in locomokbd_probe()
280 clear_bit(0, input_dev->keybit); in locomokbd_probe()
283 err = request_irq(dev->irq[0], locomokbd_interrupt, 0, "locomokbd", locomokbd); in locomokbd_probe()
289 err = input_register_device(locomokbd->input); in locomokbd_probe()
296 free_irq(dev->irq[0], locomokbd); in locomokbd_probe()
298 release_mem_region((unsigned long) dev->mapbase, dev->length); in locomokbd_probe()
311 free_irq(dev->irq[0], locomokbd); in locomokbd_remove()
313 timer_shutdown_sync(&locomokbd->timer); in locomokbd_remove()
315 input_unregister_device(locomokbd->input); in locomokbd_remove()
318 release_mem_region((unsigned long) dev->mapbase, dev->length); in locomokbd_remove()