Lines Matching refs:lk
348 static void lkkbd_detection_done(struct lkkbd *lk) in lkkbd_detection_done() argument
355 lk->keycode[0xb1] = KEY_COMPOSE; in lkkbd_detection_done()
360 switch (lk->id[4]) { in lkkbd_detection_done()
362 strlcpy(lk->name, "DEC LK201 keyboard", sizeof(lk->name)); in lkkbd_detection_done()
365 lk->keycode[0xb1] = KEY_LEFTALT; in lkkbd_detection_done()
369 strlcpy(lk->name, "DEC LK401 keyboard", sizeof(lk->name)); in lkkbd_detection_done()
373 strlcpy(lk->name, "Unknown DEC keyboard", sizeof(lk->name)); in lkkbd_detection_done()
376 "Jan-Benedict Glaw <jbglaw@lug-owl.de>\n", lk->phys); in lkkbd_detection_done()
379 printk(" 0x%02x", lk->id[i]); in lkkbd_detection_done()
385 lk->phys, lk->name); in lkkbd_detection_done()
390 switch (lk->id[2]) { in lkkbd_detection_done()
397 lk->phys); in lkkbd_detection_done()
403 "keyboard may not work properly\n", lk->phys); in lkkbd_detection_done()
409 lk->id[2], lk->phys); in lkkbd_detection_done()
416 if (lk->id[2] == LK_STUCK_KEY && lk->id[3] != 0) in lkkbd_detection_done()
419 lk->id[3], lk->keycode[lk->id[3]]); in lkkbd_detection_done()
429 struct lkkbd *lk = serio_get_drvdata(serio); in lkkbd_interrupt() local
430 struct input_dev *input_dev = lk->dev; in lkkbd_interrupt()
436 if (lk->ignore_bytes > 0) { in lkkbd_interrupt()
437 DBG(KERN_INFO "Ignoring a byte on %s\n", lk->name); in lkkbd_interrupt()
438 lk->id[LK_NUM_IGNORE_BYTES - lk->ignore_bytes--] = data; in lkkbd_interrupt()
440 if (lk->ignore_bytes == 0) in lkkbd_interrupt()
441 lkkbd_detection_done(lk); in lkkbd_interrupt()
449 input_report_key(input_dev, lk->keycode[i], 0); in lkkbd_interrupt()
455 lk->ignore_bytes = LK_NUM_IGNORE_BYTES; in lkkbd_interrupt()
456 lk->id[LK_NUM_IGNORE_BYTES - lk->ignore_bytes--] = data; in lkkbd_interrupt()
457 schedule_work(&lk->tq); in lkkbd_interrupt()
473 keycode = lk->keycode[data]; in lkkbd_interrupt()
481 __FILE__, data, lk->name); in lkkbd_interrupt()
488 static void lkkbd_toggle_leds(struct lkkbd *lk) in lkkbd_toggle_leds() argument
490 struct serio *serio = lk->serio; in lkkbd_toggle_leds()
494 CHECK_LED(lk, leds_on, leds_off, LED_CAPSL, LK_LED_SHIFTLOCK); in lkkbd_toggle_leds()
495 CHECK_LED(lk, leds_on, leds_off, LED_COMPOSE, LK_LED_COMPOSE); in lkkbd_toggle_leds()
496 CHECK_LED(lk, leds_on, leds_off, LED_SCROLLL, LK_LED_SCROLLLOCK); in lkkbd_toggle_leds()
497 CHECK_LED(lk, leds_on, leds_off, LED_SLEEP, LK_LED_WAIT); in lkkbd_toggle_leds()
508 static void lkkbd_toggle_keyclick(struct lkkbd *lk, bool on) in lkkbd_toggle_keyclick() argument
510 struct serio *serio = lk->serio; in lkkbd_toggle_keyclick()
515 serio_write(serio, volume_to_hw(lk->keyclick_volume)); in lkkbd_toggle_keyclick()
517 serio_write(serio, volume_to_hw(lk->ctrlclick_volume)); in lkkbd_toggle_keyclick()
532 struct lkkbd *lk = input_get_drvdata(dev); in lkkbd_event() local
536 lkkbd_toggle_leds(lk); in lkkbd_event()
542 lkkbd_toggle_keyclick(lk, value); in lkkbd_event()
547 serio_write(lk->serio, LK_CMD_SOUND_BELL); in lkkbd_event()
568 struct lkkbd *lk = container_of(work, struct lkkbd, tq); in lkkbd_reinit() local
572 serio_write(lk->serio, LK_CMD_REQUEST_ID); in lkkbd_reinit()
575 serio_write(lk->serio, LK_CMD_SET_DEFAULTS); in lkkbd_reinit()
578 lkkbd_toggle_leds(lk); in lkkbd_reinit()
585 serio_write(lk->serio, LK_CMD_ENABLE_LK401); in lkkbd_reinit()
589 serio_write(lk->serio, in lkkbd_reinit()
593 serio_write(lk->serio, LK_CMD_ENABLE_BELL); in lkkbd_reinit()
594 serio_write(lk->serio, volume_to_hw(lk->bell_volume)); in lkkbd_reinit()
597 lkkbd_toggle_keyclick(lk, test_bit(SND_CLICK, lk->dev->snd)); in lkkbd_reinit()
600 if (test_bit(SND_BELL, lk->dev->snd)) in lkkbd_reinit()
601 serio_write(lk->serio, LK_CMD_SOUND_BELL); in lkkbd_reinit()
609 struct lkkbd *lk; in lkkbd_connect() local
614 lk = kzalloc(sizeof(struct lkkbd), GFP_KERNEL); in lkkbd_connect()
616 if (!lk || !input_dev) { in lkkbd_connect()
621 lk->serio = serio; in lkkbd_connect()
622 lk->dev = input_dev; in lkkbd_connect()
623 INIT_WORK(&lk->tq, lkkbd_reinit); in lkkbd_connect()
624 lk->bell_volume = bell_volume; in lkkbd_connect()
625 lk->keyclick_volume = keyclick_volume; in lkkbd_connect()
626 lk->ctrlclick_volume = ctrlclick_volume; in lkkbd_connect()
627 memcpy(lk->keycode, lkkbd_keycode, sizeof(lk->keycode)); in lkkbd_connect()
629 strlcpy(lk->name, "DEC LK keyboard", sizeof(lk->name)); in lkkbd_connect()
630 snprintf(lk->phys, sizeof(lk->phys), "%s/input0", serio->phys); in lkkbd_connect()
632 input_dev->name = lk->name; in lkkbd_connect()
633 input_dev->phys = lk->phys; in lkkbd_connect()
641 input_set_drvdata(input_dev, lk); in lkkbd_connect()
654 input_dev->keycode = lk->keycode; in lkkbd_connect()
655 input_dev->keycodesize = sizeof(lk->keycode[0]); in lkkbd_connect()
656 input_dev->keycodemax = ARRAY_SIZE(lk->keycode); in lkkbd_connect()
659 __set_bit(lk->keycode[i], input_dev->keybit); in lkkbd_connect()
662 serio_set_drvdata(serio, lk); in lkkbd_connect()
668 err = input_register_device(lk->dev); in lkkbd_connect()
672 serio_write(lk->serio, LK_CMD_POWERCYCLE_RESET); in lkkbd_connect()
679 kfree(lk); in lkkbd_connect()
688 struct lkkbd *lk = serio_get_drvdata(serio); in lkkbd_disconnect() local
690 input_get_device(lk->dev); in lkkbd_disconnect()
691 input_unregister_device(lk->dev); in lkkbd_disconnect()
694 input_put_device(lk->dev); in lkkbd_disconnect()
695 kfree(lk); in lkkbd_disconnect()