コード例 #1
0
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;
}
コード例 #2
0
ファイル: kdba_io.c プロジェクト: mongmio/ivyproject_thermal
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 */
}
コード例 #3
0
static int __init psaux_init(void)
{
	int retval;

	if (!detect_auxiliary_port())
		return -EIO;

	if ((retval = misc_register(&psaux_mouse)))
		return retval;

	queue = (struct aux_queue *) kmalloc(sizeof(*queue), GFP_KERNEL);
	if (queue == NULL) {
		printk(KERN_ERR "psaux_init(): out of memory\n");
		misc_deregister(&psaux_mouse);
		return -ENOMEM;
	}
	memset(queue, 0, sizeof(*queue));
	queue->head = queue->tail = 0;
	init_waitqueue_head(&queue->proc_list);

#ifdef INITIALIZE_MOUSE
	kbd_write_command_w(KBD_CCMD_MOUSE_ENABLE); /* Enable Aux. */
	aux_write_ack(AUX_SET_SAMPLE);
	aux_write_ack(100);			/* 100 samples/sec */
	aux_write_ack(AUX_SET_RES);
	aux_write_ack(3);			/* 8 counts per mm */
	aux_write_ack(AUX_SET_SCALE21);		/* 2:1 scaling */
#endif /* INITIALIZE_MOUSE */
	kbd_write_command(KBD_CCMD_MOUSE_DISABLE); /* Disable aux device. */
	kbd_write_cmd(AUX_INTS_OFF); /* Disable controller ints. */

	return 0;
}
コード例 #4
0
ファイル: ps2_mouse.c プロジェクト: aniwang2013/leon-rtems
/*
 * 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);
}
コード例 #5
0
ファイル: ps2_mouse.c プロジェクト: aniwang2013/leon-rtems
/*
 * 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;
}
コード例 #6
0
ファイル: ps2_mouse.c プロジェクト: aniwang2013/leon-rtems
static void kbd_write_cmd(int cmd)
{
  kb_wait();
  kbd_write_command(KBD_CCMD_WRITE_MODE);
  kb_wait();
  kbd_write_output(cmd);
}
コード例 #7
0
ファイル: kbd.c プロジェクト: kisom/pmon
int psaux_init(void)
{
	int retval;

	if (!detect_auxiliary_port())
		return -1;

	kbd_write_command_w(KBD_CCMD_MOUSE_ENABLE); /* Enable Aux. */
	aux_write_ack(AUX_SET_SAMPLE);
	aux_write_ack(100);			/* 100 samples/sec */
	aux_write_ack(AUX_SET_RES);
	aux_write_ack(3);			/* 8 counts per mm */
	aux_write_ack(AUX_SET_SCALE21);		/* 2:1 scaling */
	kbd_write_command(KBD_CCMD_MOUSE_DISABLE); /* Disable aux device. */
	kbd_write_cmd(AUX_INTS_OFF); /* Disable controller ints. */

//---------------------------------------
	kbd_write_command_w(KBD_CCMD_MOUSE_ENABLE);	/* Enable the
							   auxiliary port on
							   controller. */
	aux_write_ack(AUX_ENABLE_DEV); /* Enable aux device */
	kbd_write_cmd(AUX_INTS_ON); /* Enable controller ints */
	
	mdelay(2);			/* Ensure we follow the kbc access delay rules.. */

	send_data(KBD_CMD_ENABLE);	/* try to workaround toshiba4030cdt problem */
	return 0;
}
コード例 #8
0
ファイル: pckbd.c プロジェクト: GamerSource/qemu
static void kbd_mm_writeb (void *opaque, hwaddr addr, uint32_t value)
{
    KBDState *s = opaque;

    if (addr & s->mask)
        kbd_write_command(s, 0, value & 0xff, 1);
    else
        kbd_write_data(s, 0, value & 0xff, 1);
}
コード例 #9
0
ファイル: pckbd.c プロジェクト: mithleshvrts/qemu-kvm-rhel6
static void kbd_mm_writeb (void *opaque, target_phys_addr_t addr, uint32_t value)
{
    KBDState *s = opaque;

    if (addr & s->mask)
        kbd_write_command(s, 0, value & 0xff);
    else
        kbd_write_data(s, 0, value & 0xff);
}
コード例 #10
0
ファイル: kbd.c プロジェクト: kisom/pmon
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);
}
コード例 #11
0
static void kbd_write_command_w(int data)
{
	unsigned long flags;

	spin_lock_irqsave(&kbd_controller_lock, flags);
	kb_wait();
	kbd_write_command(data);
	spin_unlock_irqrestore(&kbd_controller_lock, flags);
}
コード例 #12
0
/*
 * 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();
}
コード例 #13
0
/*
 * 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);
}
コード例 #14
0
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);
}
コード例 #15
0
/*
 * Some Alphas cannot mask some/all interrupts, so we have to
 * make sure not to allow interrupts AT ALL when polling for
 * specific return values from the keyboard.
 *
 * I think this should work on any architecture, but for now, only Alpha.
 */
static int kbd_write_command_w_and_wait(int data)
{
	unsigned long flags;
	int input;

	spin_lock_irqsave(&kbd_controller_lock, flags);
	kb_wait();
	kbd_write_command(data);
	input = kbd_wait_for_input();
	spin_unlock_irqrestore(&kbd_controller_lock, flags);
	return input;
}
コード例 #16
0
ファイル: kdba_io.c プロジェクト: daniter-cu/fuck_reuben
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 */
}
コード例 #17
0
/*
 * 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;
}
コード例 #18
0
ファイル: ps2_mouse.c プロジェクト: aniwang2013/leon-rtems
static int psaux_init( void )
{
  if( !detect_auxiliary_port() ) {
    printk( "PS/2 - mouse not found.\n" );
    return -EIO;
  }
  queue = (struct aux_queue *)malloc( sizeof(*queue) );
  memset(queue, 0, sizeof(*queue));
  queue->head = queue->tail = 0;
  queue->proc_list = NULL;

  #ifdef INITIALIZE_MOUSE
    kbd_write_command_w(KBD_CCMD_MOUSE_ENABLE); /* Enable Aux. */
    aux_write_ack(AUX_SET_SAMPLE);
    aux_write_ack(100);			      /* 100 samples/sec */
    aux_write_ack(AUX_SET_RES);
    aux_write_ack(3);			         /* 8 counts per mm */
    aux_write_ack(AUX_SET_SCALE21);	/* 2:1 scaling */
  #endif /* INITIALIZE_MOUSE */
  kbd_write_command(KBD_CCMD_MOUSE_DISABLE); /* Disable aux device. */
  kbd_write_cmd(AUX_INTS_OFF); /* Disable controller ints. */
  return 0;
}
コード例 #19
0
ファイル: pc_keyb.c プロジェクト: 8devices/Caraboot
static void kbd_write_command_w(int data)
{
	if(kb_wait())
		PRINTF("timeout in kbd_write_command_w\n");
	kbd_write_command(data);
}
コード例 #20
0
ファイル: ps2_mouse.c プロジェクト: aniwang2013/leon-rtems
static void kbd_write_command_w(int data)
{
  kb_wait();
  kbd_write_command(data);
}