diff options
Diffstat (limited to 'linux/drivers/media/video')
-rw-r--r-- | linux/drivers/media/video/bttvp.h | 4 | ||||
-rw-r--r-- | linux/drivers/media/video/cx88/cx88-input.c | 64 | ||||
-rw-r--r-- | linux/drivers/media/video/ir-kbd-gpio.c | 68 | ||||
-rw-r--r-- | linux/drivers/media/video/ir-kbd-i2c.c | 29 | ||||
-rw-r--r-- | linux/drivers/media/video/saa7134/saa7134-input.c | 47 | ||||
-rw-r--r-- | linux/drivers/media/video/saa7134/saa7134.h | 4 |
6 files changed, 125 insertions, 91 deletions
diff --git a/linux/drivers/media/video/bttvp.h b/linux/drivers/media/video/bttvp.h index 055ba4879..55dc72aeb 100644 --- a/linux/drivers/media/video/bttvp.h +++ b/linux/drivers/media/video/bttvp.h @@ -1,5 +1,5 @@ /* - $Id: bttvp.h,v 1.25 2005/11/08 18:02:29 nsh Exp $ + $Id: bttvp.h,v 1.26 2005/12/04 01:12:43 rmcc Exp $ bttv - Bt848 frame grabber driver @@ -252,7 +252,7 @@ struct bttv_pll_info { /* for gpio-connected remote control */ struct bttv_input { - struct input_dev dev; + struct input_dev *dev; struct ir_input_state ir; char name[32]; char phys[32]; diff --git a/linux/drivers/media/video/cx88/cx88-input.c b/linux/drivers/media/video/cx88/cx88-input.c index caa7f7451..9422736e6 100644 --- a/linux/drivers/media/video/cx88/cx88-input.c +++ b/linux/drivers/media/video/cx88/cx88-input.c @@ -1,5 +1,5 @@ /* - * $Id: cx88-input.c,v 1.24 2005/12/02 04:16:47 mkrufky Exp $ + * $Id: cx88-input.c,v 1.25 2005/12/04 01:12:43 rmcc Exp $ * * Device driver for GPIO attached remote control interfaces * on Conexant 2388x based TV/DVB cards. @@ -261,7 +261,7 @@ static IR_KEYTAB_TYPE ir_codes_cinergy_1400[IR_KEYTAB_SIZE] = { struct cx88_IR { struct cx88_core *core; - struct input_dev input; + struct input_dev *input; struct ir_input_state ir; char name[32]; char phys[32]; @@ -316,23 +316,23 @@ static void cx88_ir_handle_key(struct cx88_IR *ir) if (ir->mask_keydown) { /* bit set on keydown */ if (gpio & ir->mask_keydown) { - ir_input_keydown(&ir->input, &ir->ir, data, data); + ir_input_keydown(ir->input, &ir->ir, data, data); } else { - ir_input_nokey(&ir->input, &ir->ir); + ir_input_nokey(ir->input, &ir->ir); } } else if (ir->mask_keyup) { /* bit cleared on keydown */ if (0 == (gpio & ir->mask_keyup)) { - ir_input_keydown(&ir->input, &ir->ir, data, data); + ir_input_keydown(ir->input, &ir->ir, data, data); } else { - ir_input_nokey(&ir->input, &ir->ir); + ir_input_nokey(ir->input, &ir->ir); } } else { /* can't distinguish keydown/up :-/ */ - ir_input_keydown(&ir->input, &ir->ir, data, data); - ir_input_nokey(&ir->input, &ir->ir); + ir_input_keydown(ir->input, &ir->ir, data, data); + ir_input_nokey(ir->input, &ir->ir); } } @@ -358,13 +358,19 @@ static void cx88_ir_work(void *data) int cx88_ir_init(struct cx88_core *core, struct pci_dev *pci) { struct cx88_IR *ir; + struct input_dev *input_dev; IR_KEYTAB_TYPE *ir_codes = NULL; int ir_type = IR_TYPE_OTHER; - ir = kmalloc(sizeof(*ir), GFP_KERNEL); - if (NULL == ir) + ir = kzalloc(sizeof(*ir), GFP_KERNEL); + input_dev = input_allocate_device(); + if (!ir || !input_dev) { + kfree(ir); + input_free_device(input_dev); return -ENOMEM; - memset(ir, 0, sizeof(*ir)); + } + + ir->input = input_dev; /* detect & configure */ switch (core->board) { @@ -429,6 +435,7 @@ int cx88_ir_init(struct cx88_core *core, struct pci_dev *pci) if (NULL == ir_codes) { kfree(ir); + input_free_device(input_dev); return -ENODEV; } @@ -437,20 +444,24 @@ int cx88_ir_init(struct cx88_core *core, struct pci_dev *pci) cx88_boards[core->board].name); snprintf(ir->phys, sizeof(ir->phys), "pci-%s/ir0", pci_name(pci)); - ir_input_init(&ir->input, &ir->ir, ir_type, ir_codes); - ir->input.name = ir->name; + ir_input_init(input_dev, &ir->ir, ir_type, ir_codes); + input_dev->name = ir->name; #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0) - ir->input.phys = ir->phys; - ir->input.id.bustype = BUS_PCI; - ir->input.id.version = 1; + input_dev->phys = ir->phys; + input_dev->id.bustype = BUS_PCI; + input_dev->id.version = 1; if (pci->subsystem_vendor) { - ir->input.id.vendor = pci->subsystem_vendor; - ir->input.id.product = pci->subsystem_device; + input_dev->id.vendor = pci->subsystem_vendor; + input_dev->id.product = pci->subsystem_device; } else { - ir->input.id.vendor = pci->vendor; - ir->input.id.product = pci->device; + input_dev->id.vendor = pci->vendor; + input_dev->id.product = pci->device; } - ir->input.dev = &pci->dev; +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,15) + input_dev->cdev.dev = &pci->dev; +#else + input_dev->dev = &pci->dev; +#endif #endif /* record handles to ourself */ ir->core = core; @@ -470,8 +481,7 @@ int cx88_ir_init(struct cx88_core *core, struct pci_dev *pci) } /* all done */ - input_register_device(&ir->input); - printk("%s: registered IR remote control\n", core->name); + input_register_device(ir->input); return 0; } @@ -489,7 +499,7 @@ int cx88_ir_fini(struct cx88_core *core) flush_scheduled_work(); } - input_unregister_device(&ir->input); + input_unregister_device(ir->input); kfree(ir); /* done */ @@ -520,7 +530,7 @@ void cx88_ir_irq(struct cx88_core *core) if (!ir->scount) { /* nothing to sample */ if (ir->ir.keypressed && time_after(jiffies, ir->release)) - ir_input_nokey(&ir->input, &ir->ir); + ir_input_nokey(ir->input, &ir->ir); return; } @@ -562,7 +572,7 @@ void cx88_ir_irq(struct cx88_core *core) ir_dprintk("Key Code: %x\n", (ircode >> 16) & 0x7f); - ir_input_keydown(&ir->input, &ir->ir, (ircode >> 16) & 0x7f, (ircode >> 16) & 0xff); + ir_input_keydown(ir->input, &ir->ir, (ircode >> 16) & 0x7f, (ircode >> 16) & 0xff); ir->release = jiffies + msecs_to_jiffies(120); break; case CX88_BOARD_HAUPPAUGE: @@ -573,7 +583,7 @@ void cx88_ir_irq(struct cx88_core *core) ir_dprintk("biphase decoded: %x\n", ircode); if ((ircode & 0xfffff000) != 0x3000) break; - ir_input_keydown(&ir->input, &ir->ir, ircode & 0x3f, ircode); + ir_input_keydown(ir->input, &ir->ir, ircode & 0x3f, ircode); ir->release = jiffies + msecs_to_jiffies(120); break; } diff --git a/linux/drivers/media/video/ir-kbd-gpio.c b/linux/drivers/media/video/ir-kbd-gpio.c index d61faa436..01bdb0def 100644 --- a/linux/drivers/media/video/ir-kbd-gpio.c +++ b/linux/drivers/media/video/ir-kbd-gpio.c @@ -1,5 +1,5 @@ /* - * $Id: ir-kbd-gpio.c,v 1.22 2005/11/08 18:02:29 nsh Exp $ + * $Id: ir-kbd-gpio.c,v 1.23 2005/12/04 01:12:43 rmcc Exp $ * * Copyright (c) 2003 Gerd Knorr * Copyright (c) 2003 Pavel Machek @@ -281,7 +281,7 @@ static IR_KEYTAB_TYPE ir_codes_nebula[IR_KEYTAB_SIZE] = { struct IR { struct bttv_sub_device *sub; - struct input_dev input; + struct input_dev *input; struct ir_input_state ir; char name[32]; char phys[32]; @@ -356,23 +356,23 @@ static void ir_handle_key(struct IR *ir) if (ir->mask_keydown) { /* bit set on keydown */ if (gpio & ir->mask_keydown) { - ir_input_keydown(&ir->input,&ir->ir,data,data); + ir_input_keydown(ir->input, &ir->ir, data, data); } else { - ir_input_nokey(&ir->input,&ir->ir); + ir_input_nokey(ir->input, &ir->ir); } } else if (ir->mask_keyup) { /* bit cleared on keydown */ if (0 == (gpio & ir->mask_keyup)) { - ir_input_keydown(&ir->input,&ir->ir,data,data); + ir_input_keydown(ir->input, &ir->ir, data, data); } else { - ir_input_nokey(&ir->input,&ir->ir); + ir_input_nokey(ir->input, &ir->ir); } } else { /* can't disturgissh keydown/up :-/ */ - ir_input_keydown(&ir->input,&ir->ir,data,data); - ir_input_nokey(&ir->input,&ir->ir); + ir_input_keydown(ir->input, &ir->ir, data, data); + ir_input_nokey(ir->input, &ir->ir); } } @@ -544,8 +544,8 @@ static void ir_rc5_timer_end(unsigned long data) instr != RC5_INSTR(ir->last_rc5)) { dprintk("instruction %x, toggle %x\n", instr, toggle); - ir_input_nokey(&ir->input, &ir->ir); - ir_input_keydown(&ir->input, &ir->ir, instr, + ir_input_nokey(ir->input, &ir->ir); + ir_input_keydown(ir->input, &ir->ir, instr, instr); } @@ -565,7 +565,7 @@ static void ir_rc5_timer_keyup(unsigned long data) struct IR *ir = (struct IR *)data; dprintk("key released\n"); - ir_input_nokey(&ir->input, &ir->ir); + ir_input_nokey(ir->input, &ir->ir); } /* ---------------------------------------------------------------------- */ @@ -574,13 +574,17 @@ static int ir_probe(struct device *dev) { struct bttv_sub_device *sub = to_bttv_sub_dev(dev); struct IR *ir; + struct input_dev *input_dev; IR_KEYTAB_TYPE *ir_codes = NULL; int ir_type = IR_TYPE_OTHER; - ir = kmalloc(sizeof(*ir),GFP_KERNEL); - if (NULL == ir) + ir = kzalloc(sizeof(*ir), GFP_KERNEL); + input_dev = input_allocate_device(); + if (!ir || !input_dev) { + kfree(ir); + input_free_device(input_dev); return -ENOMEM; - memset(ir,0,sizeof(*ir)); + } /* detect & configure */ switch (sub->core->type) { @@ -646,6 +650,7 @@ static int ir_probe(struct device *dev) } if (NULL == ir_codes) { kfree(ir); + input_free_device(input_dev); return -ENODEV; } @@ -668,20 +673,24 @@ static int ir_probe(struct device *dev) pci_name(sub->core->pci)); ir->sub = sub; - ir_input_init(&ir->input, &ir->ir, ir_type, ir_codes); - ir->input.name = ir->name; + ir_input_init(input_dev, &ir->ir, ir_type, ir_codes); + input_dev->name = ir->name; #if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) - ir->input.phys = ir->phys; - ir->input.id.bustype = BUS_PCI; - ir->input.id.version = 1; + input_dev->phys = ir->phys; + input_dev->id.bustype = BUS_PCI; + input_dev->id.version = 1; if (sub->core->pci->subsystem_vendor) { - ir->input.id.vendor = sub->core->pci->subsystem_vendor; - ir->input.id.product = sub->core->pci->subsystem_device; + input_dev->id.vendor = sub->core->pci->subsystem_vendor; + input_dev->id.product = sub->core->pci->subsystem_device; } else { - ir->input.id.vendor = sub->core->pci->vendor; - ir->input.id.product = sub->core->pci->device; + input_dev->id.vendor = sub->core->pci->vendor; + input_dev->id.product = sub->core->pci->device; } - ir->input.dev = &sub->core->pci->dev; +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,15) + input_dev->cdev.dev = &sub->core->pci->dev; +#else + input_dev->dev = &sub->core->pci->dev; +#endif #endif if (ir->polling) { @@ -702,13 +711,12 @@ static int ir_probe(struct device *dev) } /* all done */ - dev_set_drvdata(dev,ir); - input_register_device(&ir->input); - printk(DEVNAME ": %s detected at %s\n",ir->input.name,ir->input.phys); + dev_set_drvdata(dev, ir); + input_register_device(ir->input); /* the remote isn't as bouncy as a keyboard */ - ir->input.rep[REP_DELAY] = repeat_delay; - ir->input.rep[REP_PERIOD] = repeat_period; + ir->input->rep[REP_DELAY] = repeat_delay; + ir->input->rep[REP_PERIOD] = repeat_period; return 0; } @@ -732,7 +740,7 @@ static int ir_remove(struct device *dev) bttv_gpio_write(ir->sub->core, gpio & ~(1 << 4)); } - input_unregister_device(&ir->input); + input_unregister_device(ir->input); kfree(ir); return 0; } diff --git a/linux/drivers/media/video/ir-kbd-i2c.c b/linux/drivers/media/video/ir-kbd-i2c.c index ce7655dc0..a1673ca59 100644 --- a/linux/drivers/media/video/ir-kbd-i2c.c +++ b/linux/drivers/media/video/ir-kbd-i2c.c @@ -1,5 +1,5 @@ /* - * $Id: ir-kbd-i2c.c,v 1.28 2005/11/20 02:13:48 mchehab Exp $ + * $Id: ir-kbd-i2c.c,v 1.29 2005/12/04 01:12:43 rmcc Exp $ * * keyboard input driver for i2c IR remote controls * @@ -253,9 +253,9 @@ static void ir_key_poll(struct IR_i2c *ir) } if (0 == rc) { - ir_input_nokey(&ir->input,&ir->ir); + ir_input_nokey(ir->input, &ir->ir); } else { - ir_input_keydown(&ir->input,&ir->ir, ir_key, ir_raw); + ir_input_keydown(ir->input, &ir->ir, ir_key, ir_raw); } } @@ -300,12 +300,19 @@ static int ir_attach(struct i2c_adapter *adap, int addr, char *name; int ir_type; struct IR_i2c *ir; + struct input_dev *input_dev; - if (NULL == (ir = kmalloc(sizeof(struct IR_i2c),GFP_KERNEL))) + ir = kzalloc(sizeof(struct IR_i2c),GFP_KERNEL); + input_dev = input_allocate_device(); + if (!ir || !input_dev) { + input_free_device(input_dev); + kfree(ir); return -ENOMEM; + } memset(ir,0,sizeof(*ir)); ir->c = client_template; + ir->input = input_dev; ir->c.adapter = adap; ir->c.addr = addr; @@ -374,15 +381,15 @@ static int ir_attach(struct i2c_adapter *adap, int addr, ir->c.dev.bus_id); /* init + register input device */ - ir_input_init(&ir->input,&ir->ir,ir_type,ir->ir_codes); - ir->input.id.bustype = BUS_I2C; - ir->input.name = ir->c.name; - ir->input.phys = ir->phys; + ir_input_init(input_dev,&ir->ir,ir_type,ir->ir_codes); + input_dev->id.bustype = BUS_I2C; + input_dev->name = ir->c.name; + input_dev->phys = ir->phys; /* register event device */ - input_register_device(&ir->input); + input_register_device(ir->input); printk(DEVNAME ": %s detected at %s [%s]\n", - ir->input.name,ir->input.phys,adap->name); + ir->input->name,ir->input->phys,adap->name); /* start polling via eventd */ INIT_WORK(&ir->work, ir_work, ir); @@ -403,7 +410,7 @@ static int ir_detach(struct i2c_client *client) flush_scheduled_work(); /* unregister devices */ - input_unregister_device(&ir->input); + input_unregister_device(ir->input); i2c_detach_client(&ir->c); /* free memory */ diff --git a/linux/drivers/media/video/saa7134/saa7134-input.c b/linux/drivers/media/video/saa7134/saa7134-input.c index fbb3d24b4..d4f547fe9 100644 --- a/linux/drivers/media/video/saa7134/saa7134-input.c +++ b/linux/drivers/media/video/saa7134/saa7134-input.c @@ -1,5 +1,5 @@ /* - * $Id: saa7134-input.c,v 1.44 2005/11/27 23:27:25 mkrufky Exp $ + * $Id: saa7134-input.c,v 1.45 2005/12/04 01:12:43 rmcc Exp $ * * handle saa7134 IR remotes via linux kernel input layer. * @@ -558,9 +558,9 @@ static int build_key(struct saa7134_dev *dev) if ((ir->mask_keydown && (0 != (gpio & ir->mask_keydown))) || (ir->mask_keyup && (0 == (gpio & ir->mask_keyup)))) { - ir_input_keydown(&ir->dev,&ir->ir,data,data); + ir_input_keydown(ir->dev, &ir->ir, data, data); } else { - ir_input_nokey(&ir->dev,&ir->ir); + ir_input_nokey(ir->dev, &ir->ir); } return 0; } @@ -612,6 +612,7 @@ static void saa7134_input_timer(unsigned long data) int saa7134_input_init1(struct saa7134_dev *dev) { struct saa7134_ir *ir; + struct input_dev *input_dev; IR_KEYTAB_TYPE *ir_codes = NULL; u32 mask_keycode = 0; u32 mask_keydown = 0; @@ -717,10 +718,13 @@ int saa7134_input_init1(struct saa7134_dev *dev) return -ENODEV; } - ir = kmalloc(sizeof(*ir),GFP_KERNEL); - if (NULL == ir) + ir = kzalloc(sizeof(*ir), GFP_KERNEL); + input_dev = input_allocate_device(); + if (!ir || !input_dev) { + kfree(ir); + input_free_device(input_dev); return -ENOMEM; - memset(ir,0,sizeof(*ir)); + } /* init hardware-specific stuff */ ir->mask_keycode = mask_keycode; @@ -728,26 +732,32 @@ int saa7134_input_init1(struct saa7134_dev *dev) ir->mask_keyup = mask_keyup; ir->polling = polling; + ir->dev = input_dev; + /* init input device */ snprintf(ir->name, sizeof(ir->name), "saa7134 IR (%s)", saa7134_boards[dev->board].name); snprintf(ir->phys, sizeof(ir->phys), "pci-%s/ir0", pci_name(dev->pci)); - ir_input_init(&ir->dev, &ir->ir, ir_type, ir_codes); - ir->dev.name = ir->name; + ir_input_init(input_dev, &ir->ir, ir_type, ir_codes); + input_dev->name = ir->name; #if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) - ir->dev.phys = ir->phys; - ir->dev.id.bustype = BUS_PCI; - ir->dev.id.version = 1; + input_dev->phys = ir->phys; + input_dev->id.bustype = BUS_PCI; + input_dev->id.version = 1; if (dev->pci->subsystem_vendor) { - ir->dev.id.vendor = dev->pci->subsystem_vendor; - ir->dev.id.product = dev->pci->subsystem_device; + input_dev->id.vendor = dev->pci->subsystem_vendor; + input_dev->id.product = dev->pci->subsystem_device; } else { - ir->dev.id.vendor = dev->pci->vendor; - ir->dev.id.product = dev->pci->device; + input_dev->id.vendor = dev->pci->vendor; + input_dev->id.product = dev->pci->device; } - ir->dev.dev = &dev->pci->dev; +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,15) + input_dev->cdev.dev = &dev->pci->dev; +#else + input_dev->dev = &dev->pci->dev; +#endif #endif /* all done */ @@ -760,8 +770,7 @@ int saa7134_input_init1(struct saa7134_dev *dev) add_timer(&ir->timer); } - input_register_device(&dev->remote->dev); - printk("%s: registered input device for IR\n",dev->name); + input_register_device(ir->dev); return 0; } @@ -770,9 +779,9 @@ void saa7134_input_fini(struct saa7134_dev *dev) if (NULL == dev->remote) return; - input_unregister_device(&dev->remote->dev); if (dev->remote->polling) del_timer_sync(&dev->remote->timer); + input_unregister_device(dev->remote->dev); kfree(dev->remote); dev->remote = NULL; } diff --git a/linux/drivers/media/video/saa7134/saa7134.h b/linux/drivers/media/video/saa7134/saa7134.h index ac9025697..87372b160 100644 --- a/linux/drivers/media/video/saa7134/saa7134.h +++ b/linux/drivers/media/video/saa7134/saa7134.h @@ -1,5 +1,5 @@ /* - * $Id: saa7134.h,v 1.83 2005/11/25 10:50:14 mchehab Exp $ + * $Id: saa7134.h,v 1.84 2005/12/04 01:12:43 rmcc Exp $ * * v4l2 device driver for philips saa7134 based TV cards * @@ -400,7 +400,7 @@ struct saa7134_dmasound { /* IR input */ struct saa7134_ir { - struct input_dev dev; + struct input_dev *dev; struct ir_input_state ir; char name[32]; char phys[32]; |