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; }
static int __init psaux_init(void) { int ret; if (!request_mem_region(_MSECR, 512, "psaux")) return -EBUSY; if (!detect_auxiliary_port()) { ret = -EIO; goto out; } misc_register(&psaux_mouse); queue = (struct aux_queue *) kmalloc(sizeof(*queue), GFP_KERNEL); memset(queue, 0, sizeof(*queue)); queue->head = queue->tail = 0; init_waitqueue_head(&queue->proc_list); #ifdef CONFIG_PSMOUSE 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 ret = 0; out: if (ret) release_mem_region(_MSECR, 512); return ret; }
int __init psaux_init(void) { /* Reset the mouse state machine. */ iomd_writeb(0, IOMD_MSECTL); iomd_writeb(8, IOMD_MSECTL); queue = (struct aux_queue *) kmalloc(sizeof(*queue), GFP_KERNEL); if (queue == NULL) return -ENOMEM; if (misc_register(&psaux_mouse)) { kfree(queue); return -ENODEV; } memset(queue, 0, sizeof(*queue)); queue->head = queue->tail = 0; init_waitqueue_head(&queue->proc_list); 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 */ return 0; }
static int open_aux(struct inode *inode, struct file *file) { if (aux_count++) { return 0; } queue->head = queue->tail = 0; /* Flush input queue */ /* Don't enable the mouse controller until we've registered IRQ handler */ if (request_irq(IRQ_MSRXINT, mouse_interrupt, SA_SHIRQ, "PS/2 Mouse", AUX_DEV)) { aux_count--; return -EBUSY; } MSECLKDIV = 0; MSEPRECNT = 127; MSECR &= ~MSECR_ENA; mdelay(50); MSECR = MSECR_ENA; mdelay(50); MSEDATA = 0xf4; mdelay(50); if (MSESTAT & 0x0100) { MSESTAT = 0x0100; /* clear IRQ status */ } /* 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 */ // send_data(KBD_CMD_ENABLE); /* try to workaround toshiba4030cdt problem */ return 0; }
int psaux_init(void) { int qp_found = 0; #ifdef CONFIG_82C710_MOUSE if ((qp_found = probe_qp())) { printk(KERN_INFO "82C710 type pointing device detected -- driver installed.\n"); /* printk("82C710 address = %x (should be 0x310)\n", qp_data); */ qp_present = 1; psaux_fops.write = write_qp; psaux_fops.open = open_qp; psaux_fops.release = release_qp; } else #endif if (aux_device_present == 0xaa) { printk(KERN_INFO "PS/2 auxiliary pointing device detected -- driver installed.\n"); aux_present = 1; kbd_read_mask = AUX_OBUF_FULL; } else { return -EIO; } misc_register(&psaux_mouse); queue = (struct aux_queue *) kmalloc(sizeof(*queue), GFP_KERNEL); memset(queue, 0, sizeof(*queue)); queue->head = queue->tail = 0; queue->proc_list = NULL; if (!qp_found) { #if defined INITIALIZE_DEVICE outb_p(AUX_ENABLE,AUX_COMMAND); /* 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 */ poll_aux_status_nosleep(); #endif /* INITIALIZE_DEVICE */ outb_p(AUX_DISABLE,AUX_COMMAND); /* Disable Aux device */ poll_aux_status_nosleep(); outb_p(AUX_CMD_WRITE,AUX_COMMAND); poll_aux_status_nosleep(); /* Disable interrupts */ outb_p(AUX_INTS_OFF, AUX_OUTPUT_PORT); /* on the controller */ } return 0; }
static int open_aux(struct inode * inode, struct file * file) { if (aux_count++) return 0; queue->head = queue->tail = 0; /* Flush input queue */ aux_count = 1; aux_write_ack(AUX_ENABLE_DEV); /* Enable aux device */ return 0; }
static int release_aux(struct inode *inode, struct file *file) { fasync_aux(-1, file, 0); if (--aux_count) return 0; // kbd_write_cmd(AUX_INTS_OFF); /* Disable controller ints */ // kbd_write_command_w(KBD_CCMD_MOUSE_DISABLE); aux_write_ack(AUX_DISABLE_DEV); /* Disable aux device */ MSECR &= ~MSECR_ENA; free_irq(IRQ_MSRXINT, AUX_DEV); return 0; }
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; }
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; }
static int open_aux(struct inode * inode, struct file * file) { if (aux_count++) return 0; queue->head = queue->tail = 0; /* Flush input queue */ if (request_irq(IRQ_MOUSERX, psaux_interrupt, SA_SHIRQ, "ps/2 mouse", AUX_DEV)) { aux_count--; return -EBUSY; } aux_write_ack(AUX_ENABLE_DEV); /* Enable aux device */ return 0; }
static int open_aux(void) { int status; if (aux_count++) { return 0; } queue->head = queue->tail = 0; /* Flush input queue */ status = BSP_install_rtems_irq_handler( &ps2_isr_data ); if( !status ) { printk("Error installing ps2-mouse interrupt handler!\n" ); rtems_fatal_error_occurred( status ); } 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 */ return 0; }
static int open_aux(struct inode * inode, struct file * file) { if (aux_count++) { return 0; } queue->head = queue->tail = 0; /* Flush input queue */ if (aux_request_irq(keyboard_interrupt, AUX_DEV)) { aux_count--; return -EBUSY; } 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; }
static int __init lasi_ps2_register(struct parisc_device *dev) { unsigned long hpa = dev->hpa; char *name; int device_found = 0; u8 id; id = gsc_readb(hpa+LASI_ID) & 0x0f; switch (id) { case 0: name = "keyboard"; lasikbd_hpa = hpa; /* save "hpa" for lasikbd_leds() */ break; case 1: name = "psaux"; break; default: printk(KERN_WARNING "%s: Unknown PS/2 port (id=%d) - ignored.\n", __FUNCTION__, id ); return 0; } /* reset the PS/2 port */ lasi_ps2_reset(hpa); switch (id) { case 0: device_found = init_keyb(hpa); if (device_found) register_kbd_ops(&gsc_ps2_kbd_ops); break; case 1: #ifdef CONFIG_PSMOUSE queue = (struct aux_queue *) kmalloc(sizeof(*queue), GFP_KERNEL); if (!queue) return -ENOMEM; memset(queue, 0, sizeof(*queue)); queue->head = queue->tail = 0; init_waitqueue_head(&queue->proc_list); misc_register(&psaux_mouse); aux_write_ack(AUX_ENABLE_DEV); /* try it a second time, this will give status if the device is * available */ device_found = aux_write_ack(AUX_ENABLE_DEV); break; #else /* return without printing any unnecessary and misleading info */ return 0; #endif } /* of case */ if (device_found) { /* Here we claim only if we have a device attached */ /* allocate the irq and memory region for that device */ if (!dev->irq) return -ENODEV; if (request_irq(dev->irq, lasikbd_interrupt, 0, name, (void *)hpa)) return -ENODEV; if (!request_mem_region(hpa, LASI_STATUS + 4, name)) return -ENODEV; } printk(KERN_INFO "PS/2 %s port at 0x%08lx (irq %d) found, " "%sdevice attached.\n", name, hpa, dev->irq, device_found ? "":"no "); return 0; }