void pckbd_blink (char led) { led = led ? (0x01 | 0x04) : 0x00; while (kbd_read_status() & KBD_STAT_IBF) mdelay(1); kbd_write_output(KBD_CMD_SET_LEDS); mdelay(1); while (kbd_read_status() & KBD_STAT_IBF) mdelay(1); mdelay(1); kbd_write_output(led); }
int pckbd_pm_resume(struct pm_dev *dev, pm_request_t rqst, void *data) { #if defined CONFIG_PSMOUSE unsigned long flags; if (rqst == PM_RESUME) { if (queue) { /* Aux port detected */ if (aux_count == 0) { /* Mouse not in use */ spin_lock_irqsave(&kbd_controller_lock, flags); /* * Dell Lat. C600 A06 enables mouse after resume. * When user touches the pad, it posts IRQ 12 * (which we do not process), thus holding keyboard. */ kbd_write_command(KBD_CCMD_MOUSE_DISABLE); /* kbd_write_cmd(AUX_INTS_OFF); */ /* Config & lock */ kb_wait(); kbd_write_command(KBD_CCMD_WRITE_MODE); kb_wait(); kbd_write_output(AUX_INTS_OFF); spin_unlock_irqrestore(&kbd_controller_lock, flags); } } } #endif return 0; }
/* * Send a byte to the mouse. */ static void aux_write_dev(int val) { kb_wait(); kbd_write_command(KBD_CCMD_WRITE_MOUSE); kb_wait(); kbd_write_output(val); }
/* * Check if this is a dual port controller. */ static int detect_auxiliary_port(void) { int loops = 10; int retval = 0; /* Put the value 0x5A in the output buffer using the "Write * Auxiliary Device Output Buffer" command (0xD3). Poll the * Status Register for a while to see if the value really * turns up in the Data Register. If the KBD_STAT_MOUSE_OBF * bit is also set to 1 in the Status Register, we assume this * controller has an Auxiliary Port (a.k.a. Mouse Port). */ kb_wait(); kbd_write_command(KBD_CCMD_WRITE_AUX_OBUF); kb_wait(); kbd_write_output(0x5a); /* 0x5a is a random dummy value. */ do { unsigned char status = kbd_read_status(); if (status & KBD_STAT_OBF) { kbd_read_input(); if (status & KBD_STAT_MOUSE_OBF) { printk( "Detected PS/2 Mouse Port.\n"); retval = 1; } break; } mdelay(1); } while (--loops); return retval; }
static void kbd_write_cmd(int cmd) { kb_wait(); kbd_write_command(KBD_CCMD_WRITE_MODE); kb_wait(); kbd_write_output(cmd); }
void kdba_local_arch_cleanup(void) { #ifdef CONFIG_VT_CONSOLE int timeout; unsigned char c; if (!kdb_check_kbd_exists()) return; while (kbd_read_status() & KBD_STAT_IBF); kbd_write_command(KBD_CCMD_READ_MODE); mdelay(1); while (kbd_read_status() & KBD_STAT_IBF); for (timeout = 200 * 1000; timeout && (!(kbd_read_status() & KBD_STAT_OBF)); timeout--); c = kbd_read_input(); c |= KBD_MODE_KBD_INT; while (kbd_read_status() & KBD_STAT_IBF); kbd_write_command(KBD_CCMD_WRITE_MODE); mdelay(1); while (kbd_read_status() & KBD_STAT_IBF); kbd_write_output(c); mdelay(1); while (kbd_read_status() & KBD_STAT_IBF); mdelay(1); #endif /* CONFIG_VT_CONSOLE */ }
static void kbd_write_output_w(int data) { unsigned long flags; spin_lock_irqsave(&kbd_controller_lock, flags); kb_wait(); kbd_write_output(data); spin_unlock_irqrestore(&kbd_controller_lock, flags); }
static void kbd_write_cmd(int cmd) { unsigned long flags; kb_wait(); kbd_write_command(KBD_CCMD_WRITE_MODE); kb_wait(); kbd_write_output(cmd); }
/* Tell the user who may be running in X and not see the console that we have panic'ed. This is to distingush panics from "real" lockups. Could in theory send the panic message as morse, but that is left as an exercise for the reader. */ void panic_blink(void) { static unsigned long last_jiffie; static char led; /* Roughly 1/2s frequency. KDB uses about 1s. Make sure it is different. */ if (!blink_frequency) return; if (jiffies - last_jiffie > blink_frequency) { led ^= 0x01 | 0x04; while (kbd_read_status() & KBD_STAT_IBF) mdelay(1); kbd_write_output(KBD_CMD_SET_LEDS); mdelay(1); while (kbd_read_status() & KBD_STAT_IBF) mdelay(1); mdelay(1); kbd_write_output(led); last_jiffie = jiffies; } }
/* * Send a byte to the mouse & handle returned ack */ static void __aux_write_ack(int val) { kb_wait(); kbd_write_command(KBD_CCMD_WRITE_MOUSE); kb_wait(); kbd_write_output(val); /* we expect an ACK in response. */ mouse_reply_expected++; kb_wait(); }
static void kbd_write_cmd(int cmd) { unsigned long flags; spin_lock_irqsave(&kbd_controller_lock, flags); kb_wait(); kbd_write_command(KBD_CCMD_WRITE_MODE); kb_wait(); kbd_write_output(cmd); spin_unlock_irqrestore(&kbd_controller_lock, flags); }
/* * Send a byte to the mouse. */ static void aux_write_dev(int val) { unsigned long flags; spin_lock_irqsave(&kbd_controller_lock, flags); kb_wait(); kbd_write_command(KBD_CCMD_WRITE_MOUSE); kb_wait(); kbd_write_output(val); spin_unlock_irqrestore(&kbd_controller_lock, flags); }
static int kbd_write_output_w_and_wait(int data) { unsigned long flags; int input; spin_lock_irqsave(&kbd_controller_lock, flags); kb_wait(); kbd_write_output(data); input = kbd_wait_for_input(); spin_unlock_irqrestore(&kbd_controller_lock, flags); return input; }
/* * Check if this is a dual port controller. */ static int __init detect_auxiliary_port(void) { unsigned long flags; int loops = 10; int retval = 0; /* Check if the BIOS detected a device on the auxiliary port. */ if (aux_device_present == 0xaa) return 1; spin_lock_irqsave(&kbd_controller_lock, flags); /* Put the value 0x5A in the output buffer using the "Write * Auxiliary Device Output Buffer" command (0xD3). Poll the * Status Register for a while to see if the value really * turns up in the Data Register. If the KBD_STAT_MOUSE_OBF * bit is also set to 1 in the Status Register, we assume this * controller has an Auxiliary Port (a.k.a. Mouse Port). */ kb_wait(); kbd_write_command(KBD_CCMD_WRITE_AUX_OBUF); kb_wait(); kbd_write_output(0x5a); /* 0x5a is a random dummy value. */ do { unsigned char status = kbd_read_status(); if (status & KBD_STAT_OBF) { (void) kbd_read_input(); if (status & KBD_STAT_MOUSE_OBF) { printk(KERN_INFO "Detected PS/2 Mouse Port.\n"); retval = 1; } break; } mdelay(1); } while (--loops); spin_unlock_irqrestore(&kbd_controller_lock, flags); return retval; }
void kdba_local_arch_cleanup(void) { #ifdef CONFIG_VT_CONSOLE unsigned char c; while (kbd_read_status() & KBD_STAT_IBF); kbd_write_command(KBD_CCMD_READ_MODE); mdelay(1); while (kbd_read_status() & KBD_STAT_IBF); while ( !(kbd_read_status() & KBD_STAT_OBF) ); c = kbd_read_input(); c |= KBD_MODE_KBD_INT; while (kbd_read_status() & KBD_STAT_IBF); kbd_write_command(KBD_CCMD_WRITE_MODE); mdelay(1); while (kbd_read_status() & KBD_STAT_IBF); kbd_write_output(c); mdelay(1); while (kbd_read_status() & KBD_STAT_IBF); mdelay(1); #endif /* CONFIG_VT_CONSOLE */ }
static void kbd_write_output_w(int data) { if(kb_wait()) PRINTF("timeout in kbd_write_output_w\n"); kbd_write_output(data); }
static void kbd_write_output_w(int data) { kbd_wait(); kbd_write_output(data); }