static int kbd_reset(void) { if (kbd_input_empty() == 0) return -1; out8(I8042_DATA_REG, 0xff); udelay(250000); if (kbd_input_empty() == 0) return -1; #ifdef CONFIG_USE_CPCIDVI out8(I8042_COMMAND_REG, 0x60); #else out8(I8042_DATA_REG, 0x60); #endif if (kbd_input_empty() == 0) return -1; out8(I8042_DATA_REG, 0x45); if (kbd_input_empty() == 0) return -1; out8(I8042_COMMAND_REG, 0xae); if (kbd_input_empty() == 0) return -1; return 0; }
static void kbd_led_set(void) { kbd_input_empty(); out8(I8042_DATA_REG, 0xed); /* SET LED command */ kbd_input_empty(); out8(I8042_DATA_REG, (kbd_flags & 0x7)); /* LED bits only */ }
/** * check_leds() - Check the keyboard LEDs and update them it needed * * @ret: Value to return * @return value of @ret */ static int i8042_kbd_update_leds(struct udevice *dev, int leds) { kbd_input_empty(); out8(I8042_DATA_REG, CMD_SET_KBD_LED); kbd_input_empty(); out8(I8042_DATA_REG, leds & 0x7); return 0; }
int i8042_disable(void) { if (kbd_input_empty() == 0) return -1; /* Disable keyboard */ out8(I8042_COMMAND_REG, 0xad); if (kbd_input_empty() == 0) return -1; return 0; }
int i8042_disable(void) { if (kbd_input_empty() == 0) return -1; /* Disable keyboard */ out8(I8042_CMD_REG, CMD_KBD_DIS); if (kbd_input_empty() == 0) return -1; return 0; }
static int kbd_write(int reg, int value) { if (!kbd_input_empty()) return -1; out8(reg, value); return 0; }
static int kbd_reset(void) { /* KB Reset */ if (kbd_input_empty() == 0) return -1; out8(I8042_DATA_REG, 0xff); if (wait_until_kbd_output_full() == 0) return -1; if (in8(I8042_DATA_REG) != 0xfa) /* ACK */ return -1; if (wait_until_kbd_output_full() == 0) return -1; if (in8(I8042_DATA_REG) != 0xaa) /* Test Pass*/ return -1; if (kbd_input_empty() == 0) return -1; /* Set KBC mode */ out8(I8042_COMMAND_REG, 0x60); if (kbd_input_empty() == 0) return -1; out8(I8042_DATA_REG, 0x45); if (kbd_input_empty() == 0) return -1; /* Enable Keyboard */ out8(I8042_COMMAND_REG, 0xae); if (kbd_input_empty() == 0) return -1; return 0; }
static int kbd_reset(int quirk) { int config; /* controller self test */ if (kbd_cmd_read(CMD_SELF_TEST) != KBC_TEST_OK) goto err; /* keyboard reset */ if (kbd_write(I8042_DATA_REG, CMD_RESET_KBD) || kbd_read(I8042_DATA_REG) != KBD_ACK || kbd_read(I8042_DATA_REG) != KBD_POR) goto err; if (kbd_write(I8042_DATA_REG, CMD_DRAIN_OUTPUT) || kbd_read(I8042_DATA_REG) != KBD_ACK) goto err; /* set AT translation and disable irq */ config = kbd_cmd_read(CMD_RD_CONFIG); if (config == -1) goto err; /* Sometimes get a second byte */ else if ((quirk & QUIRK_DUP_POR) && config == KBD_POR) config = kbd_cmd_read(CMD_RD_CONFIG); config |= CONFIG_AT_TRANS; config &= ~(CONFIG_KIRQ_EN | CONFIG_MIRQ_EN); if (kbd_cmd_write(CMD_WR_CONFIG, config)) goto err; /* enable keyboard */ if (kbd_write(I8042_CMD_REG, CMD_KBD_EN) || !kbd_input_empty()) goto err; return 0; err: debug("%s: Keyboard failure\n", __func__); return -1; }