Commit 4abdfed5 authored by Ricardo Cerqueira's avatar Ricardo Cerqueira Committed by Mauro Carvalho Chehab

V4L/DVB (3161): ir-kbd-gpio is now part of bttv

- Merged ir-kbd-gpio into bttv as bttv-input, for consistency with other
input modules
Signed-off-by: default avatarRicardo Cerqueira <v4l@cerqueira.org>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@brturbo.com.br>
parent e0b2d7a8
......@@ -3,7 +3,8 @@
#
bttv-objs := bttv-driver.o bttv-cards.o bttv-if.o \
bttv-risc.o bttv-vbi.o bttv-i2c.o bttv-gpio.o
bttv-risc.o bttv-vbi.o bttv-i2c.o bttv-gpio.o \
bttv-input.o
zoran-objs := zr36120.o zr36120_i2c.o zr36120_mem.o
zr36067-objs := zoran_procfs.o zoran_device.o \
zoran_driver.o zoran_card.o
......@@ -12,7 +13,7 @@ tuner-objs := tuner-core.o tuner-simple.o mt20xx.o tda8290.o tea5767.o
obj-$(CONFIG_VIDEO_DEV) += videodev.o v4l2-common.o v4l1-compat.o compat_ioctl32.o
obj-$(CONFIG_VIDEO_BT848) += bttv.o msp3400.o tvaudio.o \
tda7432.o tda9875.o ir-kbd-i2c.o ir-kbd-gpio.o
tda7432.o tda9875.o ir-kbd-i2c.o
obj-$(CONFIG_SOUND_TVMIXER) += tvmixer.o
obj-$(CONFIG_VIDEO_ZR36120) += zoran.o
......
......@@ -2139,7 +2139,6 @@ struct tvcard bttv_tvcards[] = {
.has_remote = 1,
.gpiomask = 0x1b,
.no_gpioirq = 1,
.any_irq = 1,
},
[BTTV_BOARD_PV143] = {
/* Jorge Boncompte - DTI2 <jorge@dti2.net> */
......@@ -3412,8 +3411,6 @@ void __devinit bttv_init_card2(struct bttv *btv)
btv->has_remote=1;
if (!bttv_tvcards[btv->c.type].no_gpioirq)
btv->gpioirq=1;
if (bttv_tvcards[btv->c.type].any_irq)
btv->any_irq = 1;
if (bttv_tvcards[btv->c.type].audio_hook)
btv->audio_hook=bttv_tvcards[btv->c.type].audio_hook;
......
......@@ -3702,8 +3702,8 @@ static irqreturn_t bttv_irq(int irq, void *dev_id, struct pt_regs * regs)
btv=(struct bttv *)dev_id;
if (btv->any_irq)
handled = bttv_any_irq(&btv->c);
if (btv->custom_irq)
handled = btv->custom_irq(btv);
count=0;
while (1) {
......@@ -3739,9 +3739,9 @@ static irqreturn_t bttv_irq(int irq, void *dev_id, struct pt_regs * regs)
if (astat&BT848_INT_VSYNC)
btv->field_count++;
if (astat & BT848_INT_GPINT) {
if ((astat & BT848_INT_GPINT) && btv->remote) {
wake_up(&btv->gpioq);
bttv_gpio_irq(&btv->c);
bttv_input_irq(btv);
}
if (astat & BT848_INT_I2CDONE) {
......@@ -4070,6 +4070,8 @@ static int __devinit bttv_probe(struct pci_dev *dev,
if (bttv_tvcards[btv->c.type].has_dvb)
bttv_sub_add_device(&btv->c, "dvb");
bttv_input_init(btv);
/* everything is fine */
bttv_num++;
return 0;
......@@ -4104,7 +4106,8 @@ static void __devexit bttv_remove(struct pci_dev *pci_dev)
/* tell gpio modules we are leaving ... */
btv->shutdown=1;
wake_up(&btv->gpioq);
bttv_sub_del_devices(&btv->c);
bttv_input_fini(btv);
//bttv_sub_del_devices(&btv->c);
/* unregister i2c_bus + input */
fini_bttv_i2c(btv);
......
......@@ -113,24 +113,6 @@ void bttv_gpio_irq(struct bttv_core *core)
}
}
int bttv_any_irq(struct bttv_core *core)
{
struct bttv_sub_driver *drv;
struct bttv_sub_device *dev;
struct list_head *item;
int handled = 0;
list_for_each(item,&core->subs) {
dev = list_entry(item,struct bttv_sub_device,list);
drv = to_bttv_sub_drv(dev->dev.driver);
if (drv && drv->any_irq) {
if (drv->any_irq(dev))
handled = 1;
}
}
return handled;
}
/* ----------------------------------------------------------------------- */
/* external: sub-driver register/unregister */
......
......@@ -16,6 +16,8 @@
#include <linux/videodev.h>
#include <linux/i2c.h>
#include <media/ir-common.h>
#include <media/ir-kbd-i2c.h>
/* ---------------------------------------------------------- */
/* exported by bttv-cards.c */
......@@ -211,6 +213,34 @@ struct bttv_core {
struct bttv;
struct bttv_ir {
struct input_dev *dev;
struct ir_input_state ir;
char name[32];
char phys[32];
/* Usual gpio signalling */
u32 mask_keycode;
u32 mask_keydown;
u32 mask_keyup;
u32 polling;
u32 last_gpio;
struct work_struct work;
struct timer_list timer;
/* RC5 gpio */
u32 rc5_gpio;
struct timer_list timer_end; /* timer_end for code completion */
struct timer_list timer_keyup; /* timer_end for key release */
u32 last_rc5; /* last good rc5 code */
u32 last_bit; /* last raw bit seen */
u32 code; /* raw code under construction */
struct timeval base_time; /* time of last seen code */
int active; /* building raw code */
};
struct tvcard
{
char *name;
......@@ -236,7 +266,6 @@ struct tvcard
unsigned int has_dvb:1;
unsigned int has_remote:1;
unsigned int no_gpioirq:1;
unsigned int any_irq:1;
/* other settings */
unsigned int pll;
......@@ -336,7 +365,6 @@ struct bttv_sub_driver {
struct device_driver drv;
char wanted[BUS_ID_SIZE];
void (*gpio_irq)(struct bttv_sub_device *sub);
int (*any_irq)(struct bttv_sub_device *sub);
};
#define to_bttv_sub_drv(x) container_of((x), struct bttv_sub_driver, drv)
......@@ -364,6 +392,10 @@ extern int bttv_I2CWrite(struct bttv *btv, unsigned char addr, unsigned char b1,
unsigned char b2, int both);
extern void bttv_readee(struct bttv *btv, unsigned char *eedata, int addr);
extern int bttv_input_init(struct bttv *dev);
extern void bttv_input_fini(struct bttv *dev);
extern void bttv_input_irq(struct bttv *dev);
#endif /* _BTTV_H_ */
/*
* Local variables:
......
......@@ -209,7 +209,6 @@ extern struct bus_type bttv_sub_bus_type;
int bttv_sub_add_device(struct bttv_core *core, char *name);
int bttv_sub_del_devices(struct bttv_core *core);
void bttv_gpio_irq(struct bttv_core *core);
int bttv_any_irq(struct bttv_core *core);
/* ---------------------------------------------------------- */
......@@ -275,7 +274,8 @@ struct bttv {
struct bttv_pll_info pll;
int triton1;
int gpioirq;
int any_irq;
int (*custom_irq)(struct bttv *btv);
int use_i2c_hw;
/* old gpio interface */
......@@ -300,7 +300,7 @@ struct bttv {
/* infrared remote */
int has_remote;
struct bttv_input *remote;
struct bttv_ir *remote;
/* locking */
spinlock_t s_lock;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment