static int dc_mouse_connect(struct maple_device *dev) { unsigned long data = be32_to_cpu(dev->devinfo.function_data[0]); struct input_dev *input_dev; if (!(input_dev = kmalloc(sizeof(struct input_dev), GFP_KERNEL))) return -1; dev->private_data = input_dev; memset(input_dev, 0, sizeof(struct dc_mouse)); init_input_dev(input_dev); input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REL); input_dev->keybit[LONG(BTN_MOUSE)] = BIT(BTN_LEFT) | BIT(BTN_RIGHT) | BIT(BTN_MIDDLE); input_dev->relbit[0] = BIT(REL_X) | BIT(REL_Y) | BIT(REL_WHEEL); input_dev->name = dev->product_name; input_dev->id.bustype = BUS_MAPLE; input_register_device(input_dev); maple_getcond_callback(dev, dc_mouse_callback, 1, MAPLE_FUNC_MOUSE); printk(KERN_INFO "input: mouse(0x%lx): %s\n", data, input_dev->name); return 0; }
static int __init omap_ts_probe(struct device *dev) { int i; int status = -ENODEV; memset(&ts_omap, 0, sizeof(ts_omap)); spin_lock_init(&ts_omap.lock); for (i = 0; i < ARRAY_SIZE(ts_devs); i++) { if (!ts_devs[i] || !ts_devs[i]->probe) continue; status = ts_devs[i]->probe(&ts_omap); if (status == 0) { ts_omap.dev = ts_devs[i]; break; } } if (status != 0) return status; // Init acquisition timer function init_timer(&ts_omap.ts_timer); ts_omap.ts_timer.function = omap_ts_timer; /* request irq */ if (ts_omap.irq != -1) { if (request_irq(ts_omap.irq, omap_ts_handler, 0, OMAP_TS_NAME, &ts_omap)) { printk(KERN_ERR "omap_ts.c: Could not allocate touchscreen IRQ!\n"); ts_omap.irq = -1; return -EINVAL; } ts_omap.irq_enabled = 1; } else { printk(KERN_ERR "omap_ts.c: No touchscreen IRQ assigned!\n"); return -EINVAL; } init_input_dev(&(ts_omap.inputdevice)); ts_omap.inputdevice.name = OMAP_TS_NAME; ts_omap.inputdevice.evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); ts_omap.inputdevice.keybit[LONG(BTN_TOUCH)] |= BIT(BTN_TOUCH); ts_omap.inputdevice.absbit[0] = BIT(ABS_X) | BIT(ABS_Y) | BIT(ABS_PRESSURE); input_register_device(&(ts_omap.inputdevice)); ts_omap.dev->enable(); printk("OMAP %s touchscreen driver initialized\n", ts_omap.dev->name); return 0; }
static int rmtctl_probe(struct platform_device *dev) { int i,j; printk("rmtctl_probe\n"); /* Keycode_1 32 - 63 are invalid. */ /* Register an input device. */ #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,10)) if ((idev = input_allocate_device()) == NULL) return -1; #else if ((idev = kmalloc(sizeof(struct input_dev), GFP_KERNEL)) == NULL) return -1; memset(idev, 0, sizeof(struct input_dev)); init_input_dev(idev); #endif set_bit(EV_KEY, idev->evbit); dev_tot_num = sizeof(rmt_dev_tbl) / sizeof(struct rmt_dev); for ( j = 0; j < dev_tot_num; j++) { for (i=0;i<256;i++) { if (rmt_dev_tbl[j].key_codes[i]) { set_bit(rmt_dev_tbl[j].key_codes[i], idev->keybit); } } } idev->name = "rmtctl"; idev->phys = "rmtctl"; if (!idev) { printk("Inavlid input_dev detected.\n"); return -1; } input_register_device(idev); /* Register an ISR */ i = request_irq(RC_INT, rmtctl_interrupt, IRQF_SHARED, "rmtctl", idev); /* Initial H/W */ rmtctl_hw_init(); if (RMTCTL_DEBUG) printk("WonderMedia rmtctl driver v0.98 initialized: ok\n"); return 0; }
static int __init shuttle_gpio_init(void) { init_shuttle_proc() ; init_input_dev() ; init_gpio_status() ; init_shuttle_gpio_key() ; init_shuttle_timer() ; init_interrupt() ; printk(KERN_INFO MOD_NAME "Module Init: Shuttle module\n"); return 0; }
/**************************************************************************** * Module initialisation ****************************************************************************/ static int __init register_quad (void) { printk("register_quad\n"); /* Set up GPIO pins * SHAFT0 = GPG14 (pin function = EINT22) * SHAFT1 = GPG15 (pin function = EINT23) */ rutl_regwrite(((2 << 30) | (2 << 28)), // Set ((3 << 30) | (3 << 28)), // Clear GPGCON); rutl_regwrite(((0 << 15) | (0 << 14)), // Set ((1 << 15) | (1 << 14)), // Clear GPGUP); /* Enable interrupt on both pins (both edges) * Don't need to clear bits as we're setting all that we're interested in */ rutl_regwrite(0xff000000, // Set 0, // Clear EXTINT2); /* Set the length of filter for external interrupt * Filter clock = PCLK * Filter width = 0x7f (max) */ rutl_regwrite(0x7f7f0000, // Set 0xffff0000, // Clear EINTFLT3); /* Set up the interrupts */ request_irq(IRQ_EINT22, reciva_quad_int_handler, 0, "EINT22", (void *)22); request_irq(IRQ_EINT23, reciva_quad_int_handler, 0, "EINT23", (void *)23); /* Note initial state of shaft encoder gpio pins */ shaft_old = SHAFT_PINS; /* Set up input system */ input_dev = kmalloc (sizeof (*input_dev), GFP_KERNEL); memset (input_dev, 0, sizeof (*input_dev)); #ifdef KERNEL_26 init_input_dev (input_dev); #endif input_dev->evbit[0] = BIT(EV_REL); set_bit (REL_Y, input_dev->relbit); input_dev->name = "reciva_quad"; input_register_device (input_dev); return 0; }
/**************************************************************************** * Module initialisation ****************************************************************************/ static int __init register_quad (void) { printk("RQUAD:%s module: loaded\n", acModuleName); /* Tell GPIO module which GPIO pins we are using */ rgpio_register("GPG14,15 (inputs)", acModuleName); /* Set up GPIO pins * SHAFT0 = GPG14 (pin function = EINT22) * SHAFT1 = GPG15 (pin function = EINT23) */ GPGCON &= ~((3 << 30) | (3 << 28)); GPGCON |= (2 << 30) | (2 << 28); GPGUP &= ~((1<<15) | (1<<14)); // enable pullups /* Enable interrupt on both pins (both edges) * Don't need to clear bits as we're setting all that we're interested in */ EXTINT2 |= (0xff000000); /* Set the length of filter for external interrupt * Filter clock = PCLK * Filter width = 0x7f (max) */ EINTFLT3 &= ~(0xffff0000); EINTFLT3 |= (0x7f7f0000); /* Set up the interrupts */ request_irq(IRQ_EINT22, reciva_quad_int_handler, 0, "EINT22", (void *)22); request_irq(IRQ_EINT23, reciva_quad_int_handler, 0, "EINT23", (void *)23); /* Note initial state of shaft encoder gpio pins */ shaft_old = SHAFT_PINS; /* Set up input system */ input_dev = kmalloc (sizeof (*input_dev), GFP_KERNEL); memset (input_dev, 0, sizeof (*input_dev)); #ifdef KERNEL_26 init_input_dev (input_dev); #endif input_dev->evbit[0] = BIT(EV_REL); set_bit (REL_Y, input_dev->relbit); input_dev->name = "reciva_quad"; input_register_device (input_dev); return 0; }
/***************************************************************************** * Initialise kernel module *****************************************************************************/ int init_module(void) { power_is_on_old = -1; /* Initialise proc entry */ create_proc_read_entry("driver/powerbutton", 0, NULL, read_procmem, NULL); /* Set up the input device */ input_dev = kmalloc(sizeof(*input_dev), GFP_KERNEL); memset(input_dev, 0, sizeof(*input_dev)); #ifdef KERNEL_26 init_input_dev(input_dev); #endif input_dev->evbit[0] = BIT(EV_KEY); set_bit(BTN_X, input_dev->keybit); set_bit(BTN_Y, input_dev->keybit); input_dev->name = "reciva powbut"; input_register_device(input_dev); /* The power button is connected to GPG6. Needs a pull up. */ GPGUP &= ~(1 << 6); /* Pull up enabled */ GPGCON &= ~(3 << 12); GPGCON |= (2 << 12); /* Pin function = EINT(14) */ /* Request the interrupt */ EXTINT1 |= (7 << 24); /* *Both edge triggered */ request_irq(IRQ_EINT14, reciva_power_int_handler, 0, "EINT14", (void *)14); /* Turn the LED off if the power button is off * The LED is owned by the LCD module. However we don't want to init the LCD * module as this will turn the LCD backlight on. So this will have to do for * now */ if (is_power_on() == 0) led_off(); printk("Reciva windermere power button module: loaded\n"); return 0; }
int dvb_usb_remote_init(struct dvb_usb_device *d) { int i; if (d->props.rc_key_map == NULL || d->props.rc_query == NULL || dvb_usb_disable_rc_polling) return 0; /* Initialise the remote-control structures.*/ init_input_dev(&d->rc_input_dev); d->rc_input_dev.evbit[0] = BIT(EV_KEY); d->rc_input_dev.keycodesize = sizeof(unsigned char); d->rc_input_dev.keycodemax = KEY_MAX; d->rc_input_dev.name = "IR-receiver inside an USB DVB receiver"; /* set the bits for the keys */ deb_rc("key map size: %d\n",d->props.rc_key_map_size); for (i = 0; i < d->props.rc_key_map_size; i++) { deb_rc("setting bit for event %d item %d\n",d->props.rc_key_map[i].event, i); set_bit(d->props.rc_key_map[i].event, d->rc_input_dev.keybit); } /* Start the remote-control polling. */ if (d->props.rc_interval < 40) d->props.rc_interval = 100; /* default */ /* setting these two values to non-zero, we have to manage key repeats */ d->rc_input_dev.rep[REP_PERIOD] = d->props.rc_interval; d->rc_input_dev.rep[REP_DELAY] = d->props.rc_interval + 150; input_register_device(&d->rc_input_dev); INIT_WORK(&d->rc_query_work, dvb_usb_read_remote_control, d); info("schedule remote query interval to %d msecs.",d->props.rc_interval); schedule_delayed_work(&d->rc_query_work,msecs_to_jiffies(d->props.rc_interval)); d->state |= DVB_USB_STATE_REMOTE; return 0; }
void ir_input_init(struct input_dev *dev, struct ir_input_state *ir, int ir_type, IR_KEYTAB_TYPE *ir_codes) { int i; ir->ir_type = ir_type; if (ir_codes) memcpy(ir->ir_codes, ir_codes, sizeof(ir->ir_codes)); init_input_dev(dev); dev->keycode = ir->ir_codes; dev->keycodesize = sizeof(IR_KEYTAB_TYPE); dev->keycodemax = IR_KEYTAB_SIZE; for (i = 0; i < IR_KEYTAB_SIZE; i++) set_bit(ir->ir_codes[i], dev->keybit); clear_bit(0, dev->keybit); set_bit(EV_KEY, dev->evbit); if (repeat) set_bit(EV_REP, dev->evbit); }
static int __init amikbd_init(void) { int i; if (!AMIGAHW_PRESENT(AMI_KEYBOARD)) return -EIO; if (!request_mem_region(CIAA_PHYSADDR-1+0xb00, 0x100, "amikeyb")) return -EBUSY; init_input_dev(&amikbd_dev); amikbd_dev.evbit[0] = BIT(EV_KEY) | BIT(EV_REP); amikbd_dev.keycode = amikbd_keycode; amikbd_dev.keycodesize = sizeof(unsigned char); amikbd_dev.keycodemax = ARRAY_SIZE(amikbd_keycode); for (i = 0; i < 0x78; i++) if (amikbd_keycode[i]) set_bit(amikbd_keycode[i], amikbd_dev.keybit); ciaa.cra &= ~0x41; /* serial data in, turn off TA */ request_irq(IRQ_AMIGA_CIAA_SP, amikbd_interrupt, 0, "amikbd", amikbd_interrupt); amikbd_dev.name = amikbd_name; amikbd_dev.phys = amikbd_phys; amikbd_dev.id.bustype = BUS_AMIGA; amikbd_dev.id.vendor = 0x0001; amikbd_dev.id.product = 0x0001; amikbd_dev.id.version = 0x0100; input_register_device(&amikbd_dev); printk(KERN_INFO "input: %s\n", amikbd_name); return 0; }
static inline void pnx_keypad_dev_init(struct input_dev *dev) { int i; init_input_dev(dev); dev->name = MODULE_NAME; dev->evbit[0] = BIT(EV_KEY); dev->keycode = pnx_keycode_table; dev->keycodesize = sizeof(unsigned char); dev->keycodemax = ARRAY_SIZE(pnx_keycode_table); dev->id.bustype = BUS_HOST; dev->id.vendor = 0x0001; dev->id.product = 0x0001; dev->id.version = 0x0100; /* setup scancodes for which there is a keycode */ for (i = 0; i < ARRAY_SIZE(pnx_keycode_table); i++) { if (pnx_keycode_table[i]) { set_bit(pnx_keycode_table[i], dev->keybit); } } }
static int __init hil_keyb_init(void) { unsigned char c; unsigned int i, kbid; wait_queue_head_t hil_wait; if (hil_dev.dev.id.bustype) { return -ENODEV; /* already initialized */ } #if defined(CONFIG_HP300) if (!hwreg_present((void *)(HILBASE + HIL_DATA))) return -ENODEV; request_region(HILBASE+HIL_DATA, 2, "hil"); #endif request_irq(HIL_IRQ, hil_interrupt, 0, "hil", hil_dev.dev_id); /* Turn on interrupts */ hil_do(HIL_INTON, NULL, 0); /* Look for keyboards */ hil_dev.valid = 0; /* clear any pending data */ hil_do(HIL_READKBDSADR, NULL, 0); init_waitqueue_head(&hil_wait); wait_event_interruptible_timeout(hil_wait, hil_dev.valid, 3*HZ); if (!hil_dev.valid) { printk(KERN_WARNING "HIL: timed out, assuming no keyboard present.\n"); } c = hil_dev.c; hil_dev.valid = 0; if (c == 0) { kbid = -1; printk(KERN_WARNING "HIL: no keyboard present.\n"); } else { kbid = ffz(~c); /* printk(KERN_INFO "HIL: keyboard found at id %d\n", kbid); */ } /* set it to raw mode */ c = 0; hil_do(HIL_WRITEKBDSADR, &c, 1); init_input_dev(&hil_dev.dev); for (i = 0; i < HIL_KEYCODES_SET1_TBLSIZE; i++) if (hphilkeyb_keycode[i] != KEY_RESERVED) set_bit(hphilkeyb_keycode[i], hil_dev.dev.keybit); hil_dev.dev.evbit[0] = BIT(EV_KEY) | BIT(EV_REP); hil_dev.dev.ledbit[0] = BIT(LED_NUML) | BIT(LED_CAPSL) | BIT(LED_SCROLLL); hil_dev.dev.keycodemax = HIL_KEYCODES_SET1_TBLSIZE; hil_dev.dev.keycodesize = sizeof(hphilkeyb_keycode[0]); hil_dev.dev.keycode = hphilkeyb_keycode; hil_dev.dev.name = "HIL keyboard"; hil_dev.dev.phys = "hpkbd/input0"; hil_dev.dev.id.bustype = BUS_HIL; hil_dev.dev.id.vendor = PCI_VENDOR_ID_HP; hil_dev.dev.id.product = 0x0001; hil_dev.dev.id.version = 0x0010; input_register_device(&hil_dev.dev); printk(KERN_INFO "input: %s, ID %d at 0x%08lx (irq %d) found and attached\n", hil_dev.dev.name, kbid, HILBASE, HIL_IRQ); return 0; }