Lines Matching refs:atkbd

202 struct atkbd {  struct
245 static void (*atkbd_platform_fixup)(struct atkbd *, const void *data); argument
247 static unsigned int (*atkbd_platform_scancode_fixup)(struct atkbd *, unsigned int);
256 ssize_t (*handler)(struct atkbd *, char *));
258 ssize_t (*handler)(struct atkbd *, const char *, size_t));
260 static ssize_t atkbd_show_##_name(struct atkbd *, char *); \
261 static ssize_t atkbd_set_##_name(struct atkbd *, const char *, size_t); \
283 static ssize_t atkbd_show_##_name(struct atkbd *, char *); \
307 static ssize_t atkbd_show_function_row_physmap(struct atkbd *atkbd, char *buf) in atkbd_show_function_row_physmap() argument
309 return vivaldi_function_row_physmap_show(&atkbd->vdata, buf); in atkbd_show_function_row_physmap()
312 static struct atkbd *atkbd_from_serio(struct serio *serio) in atkbd_from_serio()
316 return container_of(ps2dev, struct atkbd, ps2dev); in atkbd_from_serio()
324 struct atkbd *atkbd = atkbd_from_serio(serio); in atkbd_attr_is_visible() local
327 !atkbd->vdata.num_function_row_keys) in atkbd_attr_is_visible()
368 static void atkbd_calculate_xl_bit(struct atkbd *atkbd, unsigned char code) in atkbd_calculate_xl_bit() argument
375 __clear_bit(i, &atkbd->xl_bit); in atkbd_calculate_xl_bit()
377 __set_bit(i, &atkbd->xl_bit); in atkbd_calculate_xl_bit()
387 static unsigned int atkbd_compat_scancode(struct atkbd *atkbd, unsigned int code) in atkbd_compat_scancode() argument
389 if (atkbd->set == 3) { in atkbd_compat_scancode()
390 if (atkbd->emul == 1) in atkbd_compat_scancode()
394 if (atkbd->emul == 1) in atkbd_compat_scancode()
409 struct atkbd *atkbd = container_of(ps2dev, struct atkbd, ps2dev); in atkbd_handle_frame_error() local
414 !atkbd->resend && atkbd->write) { in atkbd_handle_frame_error()
417 atkbd->resend = true; in atkbd_handle_frame_error()
422 atkbd->resend = false; in atkbd_handle_frame_error()
445 struct atkbd *atkbd = container_of(ps2dev, struct atkbd, ps2dev); in atkbd_receive_byte() local
446 struct input_dev *dev = atkbd->dev; in atkbd_receive_byte()
454 if (!atkbd->enabled) in atkbd_receive_byte()
460 code = atkbd_platform_scancode_fixup(atkbd, code); in atkbd_receive_byte()
462 if (atkbd->translated) { in atkbd_receive_byte()
464 if (atkbd->emul || atkbd_need_xlate(atkbd->xl_bit, code)) { in atkbd_receive_byte()
465 atkbd->release = code >> 7; in atkbd_receive_byte()
469 if (!atkbd->emul) in atkbd_receive_byte()
470 atkbd_calculate_xl_bit(atkbd, data); in atkbd_receive_byte()
475 atkbd->enabled = false; in atkbd_receive_byte()
476 serio_reconnect(atkbd->ps2dev.serio); in atkbd_receive_byte()
479 atkbd->emul = 1; in atkbd_receive_byte()
482 atkbd->emul = 2; in atkbd_receive_byte()
485 atkbd->release = true; in atkbd_receive_byte()
496 atkbd->err_count++; in atkbd_receive_byte()
502 code = atkbd_compat_scancode(atkbd, code); in atkbd_receive_byte()
504 if (atkbd->emul && --atkbd->emul) in atkbd_receive_byte()
507 keycode = atkbd->keycode[code]; in atkbd_receive_byte()
509 if (!(atkbd->release && test_bit(code, atkbd->force_release_mask))) in atkbd_receive_byte()
519 atkbd->release ? "released" : "pressed", in atkbd_receive_byte()
520 atkbd->translated ? "translated" : "raw", in atkbd_receive_byte()
521 atkbd->set, code, serio->phys); in atkbd_receive_byte()
540 click = !atkbd->release; in atkbd_receive_byte()
549 if (atkbd->release) { in atkbd_receive_byte()
551 atkbd->last = 0; in atkbd_receive_byte()
552 } else if (!atkbd->softrepeat && test_bit(keycode, dev->key)) { in atkbd_receive_byte()
554 value = time_before(jiffies, atkbd->time) && atkbd->last == code ? 1 : 2; in atkbd_receive_byte()
557 atkbd->last = code; in atkbd_receive_byte()
558 atkbd->time = jiffies + msecs_to_jiffies(dev->rep[REP_DELAY]) / 2; in atkbd_receive_byte()
564 if (value && test_bit(code, atkbd->force_release_mask)) { in atkbd_receive_byte()
571 if (atkbd->scroll) { in atkbd_receive_byte()
575 atkbd->release ? -scroll : scroll); in atkbd_receive_byte()
580 atkbd->release = false; in atkbd_receive_byte()
583 static int atkbd_set_repeat_rate(struct atkbd *atkbd) in atkbd_set_repeat_rate() argument
591 struct input_dev *dev = atkbd->dev; in atkbd_set_repeat_rate()
604 return ps2_command(&atkbd->ps2dev, &param, ATKBD_CMD_SETREP); in atkbd_set_repeat_rate()
607 static int atkbd_set_leds(struct atkbd *atkbd) in atkbd_set_leds() argument
609 struct input_dev *dev = atkbd->dev; in atkbd_set_leds()
615 if (ps2_command(&atkbd->ps2dev, param, ATKBD_CMD_SETLEDS)) in atkbd_set_leds()
618 if (atkbd->extra) { in atkbd_set_leds()
625 if (ps2_command(&atkbd->ps2dev, param, ATKBD_CMD_EX_SETLEDS)) in atkbd_set_leds()
640 struct atkbd *atkbd = container_of(work, struct atkbd, event_work.work); in atkbd_event_work() local
642 mutex_lock(&atkbd->mutex); in atkbd_event_work()
644 if (!atkbd->enabled) { in atkbd_event_work()
651 schedule_delayed_work(&atkbd->event_work, in atkbd_event_work()
654 if (test_and_clear_bit(ATKBD_LED_EVENT_BIT, &atkbd->event_mask)) in atkbd_event_work()
655 atkbd_set_leds(atkbd); in atkbd_event_work()
657 if (test_and_clear_bit(ATKBD_REP_EVENT_BIT, &atkbd->event_mask)) in atkbd_event_work()
658 atkbd_set_repeat_rate(atkbd); in atkbd_event_work()
661 mutex_unlock(&atkbd->mutex); in atkbd_event_work()
668 static void atkbd_schedule_event_work(struct atkbd *atkbd, int event_bit) in atkbd_schedule_event_work() argument
672 if (time_after(jiffies, atkbd->event_jiffies + delay)) in atkbd_schedule_event_work()
675 atkbd->event_jiffies = jiffies; in atkbd_schedule_event_work()
676 set_bit(event_bit, &atkbd->event_mask); in atkbd_schedule_event_work()
678 schedule_delayed_work(&atkbd->event_work, delay); in atkbd_schedule_event_work()
690 struct atkbd *atkbd = input_get_drvdata(dev); in atkbd_event() local
692 if (!atkbd->write) in atkbd_event()
698 atkbd_schedule_event_work(atkbd, ATKBD_LED_EVENT_BIT); in atkbd_event()
702 if (!atkbd->softrepeat) in atkbd_event()
703 atkbd_schedule_event_work(atkbd, ATKBD_REP_EVENT_BIT); in atkbd_event()
716 static inline void atkbd_enable(struct atkbd *atkbd) in atkbd_enable() argument
718 serio_pause_rx(atkbd->ps2dev.serio); in atkbd_enable()
719 atkbd->enabled = true; in atkbd_enable()
720 serio_continue_rx(atkbd->ps2dev.serio); in atkbd_enable()
728 static inline void atkbd_disable(struct atkbd *atkbd) in atkbd_disable() argument
730 serio_pause_rx(atkbd->ps2dev.serio); in atkbd_disable()
731 atkbd->enabled = false; in atkbd_disable()
732 serio_continue_rx(atkbd->ps2dev.serio); in atkbd_disable()
735 static int atkbd_activate(struct atkbd *atkbd) in atkbd_activate() argument
737 struct ps2dev *ps2dev = &atkbd->ps2dev; in atkbd_activate()
758 static void atkbd_deactivate(struct atkbd *atkbd) in atkbd_deactivate() argument
760 struct ps2dev *ps2dev = &atkbd->ps2dev; in atkbd_deactivate()
798 static bool atkbd_skip_getid(struct atkbd *atkbd) in atkbd_skip_getid() argument
800 return atkbd->translated && atkbd_is_portable_device(); in atkbd_skip_getid()
803 static inline bool atkbd_skip_getid(struct atkbd *atkbd) { return false; } in atkbd_skip_getid() argument
810 static int atkbd_probe(struct atkbd *atkbd) in atkbd_probe() argument
812 struct ps2dev *ps2dev = &atkbd->ps2dev; in atkbd_probe()
827 if (atkbd_skip_getid(atkbd)) { in atkbd_probe()
828 atkbd->id = 0xab83; in atkbd_probe()
850 atkbd->id = 0xabba; in atkbd_probe()
857 atkbd->id = (param[0] << 8) | param[1]; in atkbd_probe()
859 if (atkbd->id == 0xaca1 && atkbd->translated) { in atkbd_probe()
871 atkbd_deactivate(atkbd); in atkbd_probe()
882 static int atkbd_select_set(struct atkbd *atkbd, int target_set, int allow_extra) in atkbd_select_set() argument
884 struct ps2dev *ps2dev = &atkbd->ps2dev; in atkbd_select_set()
887 atkbd->extra = false; in atkbd_select_set()
894 if (atkbd->translated) in atkbd_select_set()
897 if (atkbd->id == 0xaca1) { in atkbd_select_set()
906 atkbd->extra = true; in atkbd_select_set()
920 atkbd->id = param[0] << 8 | param[1]; in atkbd_select_set()
943 static int atkbd_reset_state(struct atkbd *atkbd) in atkbd_reset_state() argument
945 struct ps2dev *ps2dev = &atkbd->ps2dev; in atkbd_reset_state()
974 struct atkbd *atkbd = atkbd_from_serio(serio); in atkbd_cleanup() local
976 atkbd_disable(atkbd); in atkbd_cleanup()
977 ps2_command(&atkbd->ps2dev, NULL, ATKBD_CMD_RESET_DEF); in atkbd_cleanup()
987 struct atkbd *atkbd = atkbd_from_serio(serio); in atkbd_disconnect() local
989 atkbd_disable(atkbd); in atkbd_disconnect()
991 input_unregister_device(atkbd->dev); in atkbd_disconnect()
999 cancel_delayed_work_sync(&atkbd->event_work); in atkbd_disconnect()
1003 kfree(atkbd); in atkbd_disconnect()
1009 static void atkbd_apply_forced_release_keylist(struct atkbd* atkbd, in atkbd_apply_forced_release_keylist() argument
1015 if (atkbd->set == 2) in atkbd_apply_forced_release_keylist()
1017 __set_bit(keys[i], atkbd->force_release_mask); in atkbd_apply_forced_release_keylist()
1076 static unsigned int atkbd_oqo_01plus_scancode_fixup(struct atkbd *atkbd, in atkbd_oqo_01plus_scancode_fixup() argument
1079 if (atkbd->translated && atkbd->emul == 1 && in atkbd_oqo_01plus_scancode_fixup()
1081 atkbd->emul = 0; in atkbd_oqo_01plus_scancode_fixup()
1088 static int atkbd_get_keymap_from_fwnode(struct atkbd *atkbd) in atkbd_get_keymap_from_fwnode() argument
1090 struct device *dev = &atkbd->ps2dev.serio->dev; in atkbd_get_keymap_from_fwnode()
1110 memset(atkbd->keycode, 0, sizeof(atkbd->keycode)); in atkbd_get_keymap_from_fwnode()
1114 atkbd->keycode[scancode] = keycode; in atkbd_get_keymap_from_fwnode()
1126 static void atkbd_set_keycode_table(struct atkbd *atkbd) in atkbd_set_keycode_table() argument
1128 struct device *dev = &atkbd->ps2dev.serio->dev; in atkbd_set_keycode_table()
1132 memset(atkbd->keycode, 0, sizeof(atkbd->keycode)); in atkbd_set_keycode_table()
1133 bitmap_zero(atkbd->force_release_mask, ATKBD_KEYMAP_SIZE); in atkbd_set_keycode_table()
1135 if (!atkbd_get_keymap_from_fwnode(atkbd)) { in atkbd_set_keycode_table()
1137 } else if (atkbd->translated) { in atkbd_set_keycode_table()
1140 atkbd->keycode[i] = atkbd_set2_keycode[scancode]; in atkbd_set_keycode_table()
1141 atkbd->keycode[i | 0x80] = atkbd_set2_keycode[scancode | 0x80]; in atkbd_set_keycode_table()
1142 if (atkbd->scroll) in atkbd_set_keycode_table()
1145 atkbd->keycode[i | 0x80] = atkbd_scroll_keys[j].keycode; in atkbd_set_keycode_table()
1147 } else if (atkbd->set == 3) { in atkbd_set_keycode_table()
1148 memcpy(atkbd->keycode, atkbd_set3_keycode, sizeof(atkbd->keycode)); in atkbd_set_keycode_table()
1150 memcpy(atkbd->keycode, atkbd_set2_keycode, sizeof(atkbd->keycode)); in atkbd_set_keycode_table()
1152 if (atkbd->scroll) in atkbd_set_keycode_table()
1155 atkbd->keycode[scancode] = atkbd_scroll_keys[i].keycode; in atkbd_set_keycode_table()
1163 scancode = atkbd_compat_scancode(atkbd, ATKBD_RET_HANGEUL); in atkbd_set_keycode_table()
1164 atkbd->keycode[scancode] = KEY_HANGEUL; in atkbd_set_keycode_table()
1165 __set_bit(scancode, atkbd->force_release_mask); in atkbd_set_keycode_table()
1167 scancode = atkbd_compat_scancode(atkbd, ATKBD_RET_HANJA); in atkbd_set_keycode_table()
1168 atkbd->keycode[scancode] = KEY_HANJA; in atkbd_set_keycode_table()
1169 __set_bit(scancode, atkbd->force_release_mask); in atkbd_set_keycode_table()
1175 atkbd_platform_fixup(atkbd, atkbd_platform_fixup_data); in atkbd_set_keycode_table()
1182 static void atkbd_set_device_attrs(struct atkbd *atkbd) in atkbd_set_device_attrs() argument
1184 struct input_dev *input_dev = atkbd->dev; in atkbd_set_device_attrs()
1187 if (atkbd->extra) in atkbd_set_device_attrs()
1188 snprintf(atkbd->name, sizeof(atkbd->name), in atkbd_set_device_attrs()
1191 snprintf(atkbd->name, sizeof(atkbd->name), in atkbd_set_device_attrs()
1193 atkbd->translated ? "Translated" : "Raw", atkbd->set); in atkbd_set_device_attrs()
1195 snprintf(atkbd->phys, sizeof(atkbd->phys), in atkbd_set_device_attrs()
1196 "%s/input0", atkbd->ps2dev.serio->phys); in atkbd_set_device_attrs()
1198 input_dev->name = atkbd->name; in atkbd_set_device_attrs()
1199 input_dev->phys = atkbd->phys; in atkbd_set_device_attrs()
1202 input_dev->id.product = atkbd->translated ? 1 : atkbd->set; in atkbd_set_device_attrs()
1203 input_dev->id.version = atkbd->id; in atkbd_set_device_attrs()
1205 input_dev->dev.parent = &atkbd->ps2dev.serio->dev; in atkbd_set_device_attrs()
1207 input_set_drvdata(input_dev, atkbd); in atkbd_set_device_attrs()
1212 if (atkbd->write) { in atkbd_set_device_attrs()
1218 if (atkbd->extra) in atkbd_set_device_attrs()
1223 if (!atkbd->softrepeat) { in atkbd_set_device_attrs()
1228 input_dev->mscbit[0] = atkbd->softraw ? BIT_MASK(MSC_SCAN) : in atkbd_set_device_attrs()
1231 if (atkbd->scroll) { in atkbd_set_device_attrs()
1238 input_dev->keycode = atkbd->keycode; in atkbd_set_device_attrs()
1243 if (atkbd->keycode[i] != KEY_RESERVED && in atkbd_set_device_attrs()
1244 atkbd->keycode[i] != ATKBD_KEY_NULL && in atkbd_set_device_attrs()
1245 atkbd->keycode[i] < ATKBD_SPECIAL) { in atkbd_set_device_attrs()
1246 __set_bit(atkbd->keycode[i], input_dev->keybit); in atkbd_set_device_attrs()
1253 struct atkbd *atkbd = atkbd_from_serio(serio); in atkbd_parse_fwnode_data() local
1261 atkbd->vdata.function_row_physmap, in atkbd_parse_fwnode_data()
1263 atkbd->vdata.num_function_row_keys = n; in atkbd_parse_fwnode_data()
1277 struct atkbd *atkbd; in atkbd_connect() local
1281 atkbd = kzalloc(sizeof(struct atkbd), GFP_KERNEL); in atkbd_connect()
1283 if (!atkbd || !dev) in atkbd_connect()
1286 atkbd->dev = dev; in atkbd_connect()
1287 ps2_init(&atkbd->ps2dev, serio, in atkbd_connect()
1289 INIT_DELAYED_WORK(&atkbd->event_work, atkbd_event_work); in atkbd_connect()
1290 mutex_init(&atkbd->mutex); in atkbd_connect()
1295 atkbd->translated = true; in atkbd_connect()
1300 atkbd->write = true; in atkbd_connect()
1304 atkbd->softraw = atkbd_softraw; in atkbd_connect()
1305 atkbd->softrepeat = atkbd_softrepeat; in atkbd_connect()
1306 atkbd->scroll = atkbd_scroll; in atkbd_connect()
1308 if (atkbd->softrepeat) in atkbd_connect()
1309 atkbd->softraw = true; in atkbd_connect()
1311 serio_set_drvdata(serio, atkbd); in atkbd_connect()
1317 if (atkbd->write) { in atkbd_connect()
1319 if (atkbd_probe(atkbd)) { in atkbd_connect()
1324 atkbd->set = atkbd_select_set(atkbd, atkbd_set, atkbd_extra); in atkbd_connect()
1325 atkbd_reset_state(atkbd); in atkbd_connect()
1328 atkbd->set = 2; in atkbd_connect()
1329 atkbd->id = 0xab00; in atkbd_connect()
1334 atkbd_set_keycode_table(atkbd); in atkbd_connect()
1335 atkbd_set_device_attrs(atkbd); in atkbd_connect()
1337 atkbd_enable(atkbd); in atkbd_connect()
1339 atkbd_activate(atkbd); in atkbd_connect()
1341 err = input_register_device(atkbd->dev); in atkbd_connect()
1350 kfree(atkbd); in atkbd_connect()
1361 struct atkbd *atkbd = atkbd_from_serio(serio); in atkbd_reconnect() local
1365 if (!atkbd || !drv) { in atkbd_reconnect()
1371 mutex_lock(&atkbd->mutex); in atkbd_reconnect()
1373 atkbd_disable(atkbd); in atkbd_reconnect()
1375 if (atkbd->write) { in atkbd_reconnect()
1376 if (atkbd_probe(atkbd)) in atkbd_reconnect()
1379 if (atkbd->set != atkbd_select_set(atkbd, atkbd->set, atkbd->extra)) in atkbd_reconnect()
1389 atkbd_set_leds(atkbd); in atkbd_reconnect()
1390 if (!atkbd->softrepeat) in atkbd_reconnect()
1391 atkbd_set_repeat_rate(atkbd); in atkbd_reconnect()
1399 atkbd->xl_bit = 0; in atkbd_reconnect()
1400 atkbd->emul = 0; in atkbd_reconnect()
1402 atkbd_enable(atkbd); in atkbd_reconnect()
1403 if (atkbd->write) in atkbd_reconnect()
1404 atkbd_activate(atkbd); in atkbd_reconnect()
1409 mutex_unlock(&atkbd->mutex); in atkbd_reconnect()
1452 ssize_t (*handler)(struct atkbd *, char *)) in atkbd_attr_show_helper() argument
1455 struct atkbd *atkbd = atkbd_from_serio(serio); in atkbd_attr_show_helper() local
1457 return handler(atkbd, buf); in atkbd_attr_show_helper()
1461 ssize_t (*handler)(struct atkbd *, const char *, size_t)) in atkbd_attr_set_helper() argument
1464 struct atkbd *atkbd = atkbd_from_serio(serio); in atkbd_attr_set_helper() local
1467 retval = mutex_lock_interruptible(&atkbd->mutex); in atkbd_attr_set_helper()
1471 atkbd_disable(atkbd); in atkbd_attr_set_helper()
1472 retval = handler(atkbd, buf, count); in atkbd_attr_set_helper()
1473 atkbd_enable(atkbd); in atkbd_attr_set_helper()
1475 mutex_unlock(&atkbd->mutex); in atkbd_attr_set_helper()
1480 static ssize_t atkbd_show_extra(struct atkbd *atkbd, char *buf) in atkbd_show_extra() argument
1482 return sprintf(buf, "%d\n", atkbd->extra ? 1 : 0); in atkbd_show_extra()
1485 static ssize_t atkbd_set_extra(struct atkbd *atkbd, const char *buf, size_t count) in atkbd_set_extra() argument
1493 if (!atkbd->write) in atkbd_set_extra()
1503 if (atkbd->extra != value) { in atkbd_set_extra()
1509 old_dev = atkbd->dev; in atkbd_set_extra()
1510 old_extra = atkbd->extra; in atkbd_set_extra()
1511 old_set = atkbd->set; in atkbd_set_extra()
1517 atkbd->dev = new_dev; in atkbd_set_extra()
1518 atkbd->set = atkbd_select_set(atkbd, atkbd->set, value); in atkbd_set_extra()
1519 atkbd_reset_state(atkbd); in atkbd_set_extra()
1520 atkbd_activate(atkbd); in atkbd_set_extra()
1521 atkbd_set_keycode_table(atkbd); in atkbd_set_extra()
1522 atkbd_set_device_attrs(atkbd); in atkbd_set_extra()
1524 err = input_register_device(atkbd->dev); in atkbd_set_extra()
1528 atkbd->dev = old_dev; in atkbd_set_extra()
1529 atkbd->set = atkbd_select_set(atkbd, old_set, old_extra); in atkbd_set_extra()
1530 atkbd_set_keycode_table(atkbd); in atkbd_set_extra()
1531 atkbd_set_device_attrs(atkbd); in atkbd_set_extra()
1541 static ssize_t atkbd_show_force_release(struct atkbd *atkbd, char *buf) in atkbd_show_force_release() argument
1544 ATKBD_KEYMAP_SIZE, atkbd->force_release_mask); in atkbd_show_force_release()
1552 static ssize_t atkbd_set_force_release(struct atkbd *atkbd, in atkbd_set_force_release() argument
1563 memcpy(atkbd->force_release_mask, new_mask, sizeof(atkbd->force_release_mask)); in atkbd_set_force_release()
1568 static ssize_t atkbd_show_scroll(struct atkbd *atkbd, char *buf) in atkbd_show_scroll() argument
1570 return sprintf(buf, "%d\n", atkbd->scroll ? 1 : 0); in atkbd_show_scroll()
1573 static ssize_t atkbd_set_scroll(struct atkbd *atkbd, const char *buf, size_t count) in atkbd_set_scroll() argument
1587 if (atkbd->scroll != value) { in atkbd_set_scroll()
1588 old_dev = atkbd->dev; in atkbd_set_scroll()
1589 old_scroll = atkbd->scroll; in atkbd_set_scroll()
1595 atkbd->dev = new_dev; in atkbd_set_scroll()
1596 atkbd->scroll = value; in atkbd_set_scroll()
1597 atkbd_set_keycode_table(atkbd); in atkbd_set_scroll()
1598 atkbd_set_device_attrs(atkbd); in atkbd_set_scroll()
1600 err = input_register_device(atkbd->dev); in atkbd_set_scroll()
1604 atkbd->scroll = old_scroll; in atkbd_set_scroll()
1605 atkbd->dev = old_dev; in atkbd_set_scroll()
1606 atkbd_set_keycode_table(atkbd); in atkbd_set_scroll()
1607 atkbd_set_device_attrs(atkbd); in atkbd_set_scroll()
1616 static ssize_t atkbd_show_set(struct atkbd *atkbd, char *buf) in atkbd_show_set() argument
1618 return sprintf(buf, "%d\n", atkbd->set); in atkbd_show_set()
1621 static ssize_t atkbd_set_set(struct atkbd *atkbd, const char *buf, size_t count) in atkbd_set_set() argument
1629 if (!atkbd->write) in atkbd_set_set()
1639 if (atkbd->set != value) { in atkbd_set_set()
1640 old_dev = atkbd->dev; in atkbd_set_set()
1641 old_extra = atkbd->extra; in atkbd_set_set()
1642 old_set = atkbd->set; in atkbd_set_set()
1648 atkbd->dev = new_dev; in atkbd_set_set()
1649 atkbd->set = atkbd_select_set(atkbd, value, atkbd->extra); in atkbd_set_set()
1650 atkbd_reset_state(atkbd); in atkbd_set_set()
1651 atkbd_activate(atkbd); in atkbd_set_set()
1652 atkbd_set_keycode_table(atkbd); in atkbd_set_set()
1653 atkbd_set_device_attrs(atkbd); in atkbd_set_set()
1655 err = input_register_device(atkbd->dev); in atkbd_set_set()
1659 atkbd->dev = old_dev; in atkbd_set_set()
1660 atkbd->set = atkbd_select_set(atkbd, old_set, old_extra); in atkbd_set_set()
1661 atkbd_set_keycode_table(atkbd); in atkbd_set_set()
1662 atkbd_set_device_attrs(atkbd); in atkbd_set_set()
1671 static ssize_t atkbd_show_softrepeat(struct atkbd *atkbd, char *buf) in atkbd_show_softrepeat() argument
1673 return sprintf(buf, "%d\n", atkbd->softrepeat ? 1 : 0); in atkbd_show_softrepeat()
1676 static ssize_t atkbd_set_softrepeat(struct atkbd *atkbd, const char *buf, size_t count) in atkbd_set_softrepeat() argument
1683 if (!atkbd->write) in atkbd_set_softrepeat()
1693 if (atkbd->softrepeat != value) { in atkbd_set_softrepeat()
1694 old_dev = atkbd->dev; in atkbd_set_softrepeat()
1695 old_softrepeat = atkbd->softrepeat; in atkbd_set_softrepeat()
1696 old_softraw = atkbd->softraw; in atkbd_set_softrepeat()
1702 atkbd->dev = new_dev; in atkbd_set_softrepeat()
1703 atkbd->softrepeat = value; in atkbd_set_softrepeat()
1704 if (atkbd->softrepeat) in atkbd_set_softrepeat()
1705 atkbd->softraw = true; in atkbd_set_softrepeat()
1706 atkbd_set_device_attrs(atkbd); in atkbd_set_softrepeat()
1708 err = input_register_device(atkbd->dev); in atkbd_set_softrepeat()
1712 atkbd->dev = old_dev; in atkbd_set_softrepeat()
1713 atkbd->softrepeat = old_softrepeat; in atkbd_set_softrepeat()
1714 atkbd->softraw = old_softraw; in atkbd_set_softrepeat()
1715 atkbd_set_device_attrs(atkbd); in atkbd_set_softrepeat()
1725 static ssize_t atkbd_show_softraw(struct atkbd *atkbd, char *buf) in atkbd_show_softraw() argument
1727 return sprintf(buf, "%d\n", atkbd->softraw ? 1 : 0); in atkbd_show_softraw()
1730 static ssize_t atkbd_set_softraw(struct atkbd *atkbd, const char *buf, size_t count) in atkbd_set_softraw() argument
1744 if (atkbd->softraw != value) { in atkbd_set_softraw()
1745 old_dev = atkbd->dev; in atkbd_set_softraw()
1746 old_softraw = atkbd->softraw; in atkbd_set_softraw()
1752 atkbd->dev = new_dev; in atkbd_set_softraw()
1753 atkbd->softraw = value; in atkbd_set_softraw()
1754 atkbd_set_device_attrs(atkbd); in atkbd_set_softraw()
1756 err = input_register_device(atkbd->dev); in atkbd_set_softraw()
1760 atkbd->dev = old_dev; in atkbd_set_softraw()
1761 atkbd->softraw = old_softraw; in atkbd_set_softraw()
1762 atkbd_set_device_attrs(atkbd); in atkbd_set_softraw()
1771 static ssize_t atkbd_show_err_count(struct atkbd *atkbd, char *buf) in atkbd_show_err_count() argument
1773 return sprintf(buf, "%lu\n", atkbd->err_count); in atkbd_show_err_count()