diff options
Diffstat (limited to 'drivers/media/pci/saa7134')
-rw-r--r-- | drivers/media/pci/saa7134/saa7134-core.c | 8 | ||||
-rw-r--r-- | drivers/media/pci/saa7134/saa7134-input.c | 115 | ||||
-rw-r--r-- | drivers/media/pci/saa7134/saa7134-video.c | 21 | ||||
-rw-r--r-- | drivers/media/pci/saa7134/saa7134.h | 10 |
4 files changed, 33 insertions, 121 deletions
diff --git a/drivers/media/pci/saa7134/saa7134-core.c b/drivers/media/pci/saa7134/saa7134-core.c index 8984b1bf57a5..aa98ea49558c 100644 --- a/drivers/media/pci/saa7134/saa7134-core.c +++ b/drivers/media/pci/saa7134/saa7134-core.c @@ -1419,8 +1419,8 @@ static int saa7134_suspend(struct pci_dev *pci_dev , pm_message_t state) del_timer(&dev->vbi_q.timeout); del_timer(&dev->ts_q.timeout); - if (dev->remote) - saa7134_ir_stop(dev); + if (dev->remote && dev->remote->dev->users) + saa7134_ir_close(dev->remote->dev); pci_save_state(pci_dev); pci_set_power_state(pci_dev, pci_choose_state(pci_dev, state)); @@ -1447,8 +1447,8 @@ static int saa7134_resume(struct pci_dev *pci_dev) saa7134_videoport_init(dev); if (card_has_mpeg(dev)) saa7134_ts_init_hw(dev); - if (dev->remote) - saa7134_ir_start(dev); + if (dev->remote && dev->remote->dev->users) + saa7134_ir_open(dev->remote->dev); saa7134_hw_enable1(dev); msleep(100); diff --git a/drivers/media/pci/saa7134/saa7134-input.c b/drivers/media/pci/saa7134/saa7134-input.c index 999b2774b220..35884d5b8337 100644 --- a/drivers/media/pci/saa7134/saa7134-input.c +++ b/drivers/media/pci/saa7134/saa7134-input.c @@ -299,43 +299,6 @@ static int get_key_purpletv(struct IR_i2c *ir, enum rc_proto *protocol, return 1; } -static int get_key_hvr1110(struct IR_i2c *ir, enum rc_proto *protocol, - u32 *scancode, u8 *toggle) -{ - int rc; - unsigned char buf[5]; - - /* poll IR chip */ - rc = i2c_master_recv(ir->c, buf, 5); - if (rc != 5) { - ir_dbg(ir, "read error\n"); - if (rc < 0) - return rc; - return -EIO; - } - - /* Check if some key were pressed */ - if (!(buf[0] & 0x80)) - return 0; - - /* - * buf[3] & 0x80 is always high. - * buf[3] & 0x40 is a parity bit. A repeat event is marked - * by preserving it into two separate readings - * buf[4] bits 0 and 1, and buf[1] and buf[2] are always - * zero. - * - * Note that the keymap which the hvr1110 uses is RC5. - * - * FIXME: start bits could maybe be used...? - */ - *protocol = RC_PROTO_RC5; - *scancode = RC_SCANCODE_RC5(buf[3] & 0x1f, buf[4] >> 2); - *toggle = !!(buf[3] & 0x40); - return 1; -} - - static int get_key_beholdm6xx(struct IR_i2c *ir, enum rc_proto *protocol, u32 *scancode, u8 *toggle) { @@ -485,17 +448,10 @@ static void saa7134_input_timer(struct timer_list *t) mod_timer(&ir->timer, jiffies + msecs_to_jiffies(ir->polling)); } -static int __saa7134_ir_start(void *priv) +int saa7134_ir_open(struct rc_dev *rc) { - struct saa7134_dev *dev = priv; - struct saa7134_card_ir *ir; - - if (!dev || !dev->remote) - return -EINVAL; - - ir = dev->remote; - if (ir->running) - return 0; + struct saa7134_dev *dev = rc->priv; + struct saa7134_card_ir *ir = dev->remote; /* Moved here from saa7134_input_init1() because the latter * is not called on device resume */ @@ -544,55 +500,15 @@ static int __saa7134_ir_start(void *priv) return 0; } -static void __saa7134_ir_stop(void *priv) +void saa7134_ir_close(struct rc_dev *rc) { - struct saa7134_dev *dev = priv; - struct saa7134_card_ir *ir; - - if (!dev || !dev->remote) - return; - - ir = dev->remote; - if (!ir->running) - return; + struct saa7134_dev *dev = rc->priv; + struct saa7134_card_ir *ir = dev->remote; if (ir->polling) del_timer_sync(&ir->timer); ir->running = false; - - return; -} - -int saa7134_ir_start(struct saa7134_dev *dev) -{ - if (dev->remote->users) - return __saa7134_ir_start(dev); - - return 0; -} - -void saa7134_ir_stop(struct saa7134_dev *dev) -{ - if (dev->remote->users) - __saa7134_ir_stop(dev); -} - -static int saa7134_ir_open(struct rc_dev *rc) -{ - struct saa7134_dev *dev = rc->priv; - - dev->remote->users++; - return __saa7134_ir_start(dev); -} - -static void saa7134_ir_close(struct rc_dev *rc) -{ - struct saa7134_dev *dev = rc->priv; - - dev->remote->users--; - if (!dev->remote->users) - __saa7134_ir_stop(dev); } int saa7134_input_init1(struct saa7134_dev *dev) @@ -661,7 +577,7 @@ int saa7134_input_init1(struct saa7134_dev *dev) mask_keycode = 0x0007C8; mask_keydown = 0x000010; polling = 50; // ms - /* GPIO stuff moved to __saa7134_ir_start() */ + /* GPIO stuff moved to saa7134_ir_open() */ break; case SAA7134_BOARD_AVERMEDIA_M135A: ir_codes = RC_MAP_AVERMEDIA_M135A; @@ -683,14 +599,14 @@ int saa7134_input_init1(struct saa7134_dev *dev) mask_keycode = 0x02F200; mask_keydown = 0x000400; polling = 50; // ms - /* GPIO stuff moved to __saa7134_ir_start() */ + /* GPIO stuff moved to saa7134_ir_open() */ break; case SAA7134_BOARD_AVERMEDIA_A16D: ir_codes = RC_MAP_AVERMEDIA_A16D; mask_keycode = 0x02F200; mask_keydown = 0x000400; polling = 50; /* ms */ - /* GPIO stuff moved to __saa7134_ir_start() */ + /* GPIO stuff moved to saa7134_ir_open() */ break; case SAA7134_BOARD_KWORLD_TERMINATOR: ir_codes = RC_MAP_PIXELVIEW; @@ -742,7 +658,7 @@ int saa7134_input_init1(struct saa7134_dev *dev) mask_keycode = 0x0003CC; mask_keydown = 0x000010; polling = 5; /* ms */ - /* GPIO stuff moved to __saa7134_ir_start() */ + /* GPIO stuff moved to saa7134_ir_open() */ break; case SAA7134_BOARD_VIDEOMATE_TV_PVR: case SAA7134_BOARD_VIDEOMATE_GOLD_PLUS: @@ -880,8 +796,6 @@ int saa7134_input_init1(struct saa7134_dev *dev) ir->raw_decode = raw_decode; /* 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)); @@ -893,7 +807,7 @@ int saa7134_input_init1(struct saa7134_dev *dev) rc->allowed_protocols = RC_PROTO_BIT_ALL_IR_DECODER; } - rc->device_name = ir->name; + rc->device_name = saa7134_boards[dev->board].name; rc->input_phys = ir->phys; rc->input_id.bustype = BUS_PCI; rc->input_id.version = 1; @@ -929,7 +843,6 @@ void saa7134_input_fini(struct saa7134_dev *dev) if (NULL == dev->remote) return; - saa7134_ir_stop(dev); rc_unregister_device(dev->remote->dev); kfree(dev->remote); dev->remote = NULL; @@ -1031,9 +944,11 @@ void saa7134_probe_i2c_ir(struct saa7134_dev *dev) (1 == rc) ? "yes" : "no"); break; case SAA7134_BOARD_HAUPPAUGE_HVR1110: - dev->init_data.name = "HVR 1110"; - dev->init_data.get_key = get_key_hvr1110; + dev->init_data.name = saa7134_boards[dev->board].name; dev->init_data.ir_codes = RC_MAP_HAUPPAUGE; + dev->init_data.type = RC_PROTO_BIT_RC5 | + RC_PROTO_BIT_RC6_MCE | RC_PROTO_BIT_RC6_6A_32; + dev->init_data.internal_get_key_func = IR_KBD_GET_KEY_HAUP_XVR; info.addr = 0x71; break; case SAA7134_BOARD_BEHOLD_607FM_MK3: diff --git a/drivers/media/pci/saa7134/saa7134-video.c b/drivers/media/pci/saa7134/saa7134-video.c index 8f28741ebb35..5bc4b8fc8ebf 100644 --- a/drivers/media/pci/saa7134/saa7134-video.c +++ b/drivers/media/pci/saa7134/saa7134-video.c @@ -1650,23 +1650,22 @@ int saa7134_querystd(struct file *file, void *priv, v4l2_std_id *std) } EXPORT_SYMBOL_GPL(saa7134_querystd); -static int saa7134_cropcap(struct file *file, void *priv, - struct v4l2_cropcap *cap) +static int saa7134_g_pixelaspect(struct file *file, void *priv, + int type, struct v4l2_fract *f) { struct saa7134_dev *dev = video_drvdata(file); - if (cap->type != V4L2_BUF_TYPE_VIDEO_CAPTURE && - cap->type != V4L2_BUF_TYPE_VIDEO_OVERLAY) + if (type != V4L2_BUF_TYPE_VIDEO_CAPTURE && + type != V4L2_BUF_TYPE_VIDEO_OVERLAY) return -EINVAL; - cap->pixelaspect.numerator = 1; - cap->pixelaspect.denominator = 1; + if (dev->tvnorm->id & V4L2_STD_525_60) { - cap->pixelaspect.numerator = 11; - cap->pixelaspect.denominator = 10; + f->numerator = 11; + f->denominator = 10; } if (dev->tvnorm->id & V4L2_STD_625_50) { - cap->pixelaspect.numerator = 54; - cap->pixelaspect.denominator = 59; + f->numerator = 54; + f->denominator = 59; } return 0; } @@ -1987,7 +1986,7 @@ static const struct v4l2_ioctl_ops video_ioctl_ops = { .vidioc_g_fmt_vbi_cap = saa7134_try_get_set_fmt_vbi_cap, .vidioc_try_fmt_vbi_cap = saa7134_try_get_set_fmt_vbi_cap, .vidioc_s_fmt_vbi_cap = saa7134_try_get_set_fmt_vbi_cap, - .vidioc_cropcap = saa7134_cropcap, + .vidioc_g_pixelaspect = saa7134_g_pixelaspect, .vidioc_reqbufs = vb2_ioctl_reqbufs, .vidioc_querybuf = vb2_ioctl_querybuf, .vidioc_qbuf = vb2_ioctl_qbuf, diff --git a/drivers/media/pci/saa7134/saa7134.h b/drivers/media/pci/saa7134/saa7134.h index 480228456014..50b1d07d2ac1 100644 --- a/drivers/media/pci/saa7134/saa7134.h +++ b/drivers/media/pci/saa7134/saa7134.h @@ -123,9 +123,7 @@ struct saa7134_format { struct saa7134_card_ir { struct rc_dev *dev; - char name[32]; char phys[32]; - unsigned users; u32 polling; u32 last_gpio; @@ -923,13 +921,13 @@ int saa7134_input_init1(struct saa7134_dev *dev); void saa7134_input_fini(struct saa7134_dev *dev); void saa7134_input_irq(struct saa7134_dev *dev); void saa7134_probe_i2c_ir(struct saa7134_dev *dev); -int saa7134_ir_start(struct saa7134_dev *dev); -void saa7134_ir_stop(struct saa7134_dev *dev); +int saa7134_ir_open(struct rc_dev *dev); +void saa7134_ir_close(struct rc_dev *dev); #else #define saa7134_input_init1(dev) ((void)0) #define saa7134_input_fini(dev) ((void)0) #define saa7134_input_irq(dev) ((void)0) #define saa7134_probe_i2c_ir(dev) ((void)0) -#define saa7134_ir_start(dev) ((void)0) -#define saa7134_ir_stop(dev) ((void)0) +#define saa7134_ir_open(dev) ((void)0) +#define saa7134_ir_close(dev) ((void)0) #endif |