diff options
Diffstat (limited to 'drivers/media/pci')
-rw-r--r-- | drivers/media/pci/b2c2/flexcop-dma.c | 70 | ||||
-rw-r--r-- | drivers/media/pci/bt8xx/bttv-driver.c | 12 | ||||
-rw-r--r-- | drivers/media/pci/cobalt/cobalt-v4l2.c | 48 | ||||
-rw-r--r-- | drivers/media/pci/cx18/cx18-ioctl.c | 13 | ||||
-rw-r--r-- | drivers/media/pci/cx23885/cx23885-core.c | 55 | ||||
-rw-r--r-- | drivers/media/pci/cx23885/cx23885-i2c.c | 1 | ||||
-rw-r--r-- | drivers/media/pci/cx23885/cx23885-video.c | 40 | ||||
-rw-r--r-- | drivers/media/pci/cx23885/cx23885.h | 2 | ||||
-rw-r--r-- | drivers/media/pci/ddbridge/ddbridge.h | 48 | ||||
-rw-r--r-- | drivers/media/pci/intel/ipu3/ipu3-cio2.c | 6 | ||||
-rw-r--r-- | drivers/media/pci/intel/ipu3/ipu3-cio2.h | 2 | ||||
-rw-r--r-- | drivers/media/pci/ivtv/ivtv-ioctl.c | 17 | ||||
-rw-r--r-- | drivers/media/pci/mantis/mantis_cards.c | 1 | ||||
-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 |
17 files changed, 239 insertions, 230 deletions
diff --git a/drivers/media/pci/b2c2/flexcop-dma.c b/drivers/media/pci/b2c2/flexcop-dma.c index f07610a1646d..ba45b378d739 100644 --- a/drivers/media/pci/b2c2/flexcop-dma.c +++ b/drivers/media/pci/b2c2/flexcop-dma.c @@ -17,7 +17,8 @@ int flexcop_dma_allocate(struct pci_dev *pdev, return -EINVAL; } - if ((tcpu = pci_alloc_consistent(pdev, size, &tdma)) != NULL) { + tcpu = pci_alloc_consistent(pdev, size, &tdma); + if (tcpu != NULL) { dma->pdev = pdev; dma->cpu_addr0 = tcpu; dma->dma_addr0 = tdma; @@ -34,7 +35,7 @@ void flexcop_dma_free(struct flexcop_dma *dma) { pci_free_consistent(dma->pdev, dma->size*2, dma->cpu_addr0, dma->dma_addr0); - memset(dma,0,sizeof(struct flexcop_dma)); + memset(dma, 0, sizeof(struct flexcop_dma)); } EXPORT_SYMBOL(flexcop_dma_free); @@ -42,23 +43,24 @@ int flexcop_dma_config(struct flexcop_device *fc, struct flexcop_dma *dma, flexcop_dma_index_t dma_idx) { - flexcop_ibi_value v0x0,v0x4,v0xc; - v0x0.raw = v0x4.raw = v0xc.raw = 0; + flexcop_ibi_value v0x0, v0x4, v0xc; + v0x0.raw = v0x4.raw = v0xc.raw = 0; v0x0.dma_0x0.dma_address0 = dma->dma_addr0 >> 2; v0xc.dma_0xc.dma_address1 = dma->dma_addr1 >> 2; v0x4.dma_0x4_write.dma_addr_size = dma->size / 4; if ((dma_idx & FC_DMA_1) == dma_idx) { - fc->write_ibi_reg(fc,dma1_000,v0x0); - fc->write_ibi_reg(fc,dma1_004,v0x4); - fc->write_ibi_reg(fc,dma1_00c,v0xc); + fc->write_ibi_reg(fc, dma1_000, v0x0); + fc->write_ibi_reg(fc, dma1_004, v0x4); + fc->write_ibi_reg(fc, dma1_00c, v0xc); } else if ((dma_idx & FC_DMA_2) == dma_idx) { - fc->write_ibi_reg(fc,dma2_010,v0x0); - fc->write_ibi_reg(fc,dma2_014,v0x4); - fc->write_ibi_reg(fc,dma2_01c,v0xc); + fc->write_ibi_reg(fc, dma2_010, v0x0); + fc->write_ibi_reg(fc, dma2_014, v0x4); + fc->write_ibi_reg(fc, dma2_01c, v0xc); } else { - err("either DMA1 or DMA2 can be configured within one flexcop_dma_config call."); + err("either DMA1 or DMA2 can be configured within one %s call.", + __func__); return -EINVAL; } @@ -72,8 +74,8 @@ int flexcop_dma_xfer_control(struct flexcop_device *fc, flexcop_dma_addr_index_t index, int onoff) { - flexcop_ibi_value v0x0,v0xc; - flexcop_ibi_register r0x0,r0xc; + flexcop_ibi_value v0x0, v0xc; + flexcop_ibi_register r0x0, r0xc; if ((dma_idx & FC_DMA_1) == dma_idx) { r0x0 = dma1_000; @@ -82,15 +84,16 @@ int flexcop_dma_xfer_control(struct flexcop_device *fc, r0x0 = dma2_010; r0xc = dma2_01c; } else { - err("either transfer DMA1 or DMA2 can be started within one flexcop_dma_xfer_control call."); + err("transfer DMA1 or DMA2 can be started within one %s call.", + __func__); return -EINVAL; } - v0x0 = fc->read_ibi_reg(fc,r0x0); - v0xc = fc->read_ibi_reg(fc,r0xc); + v0x0 = fc->read_ibi_reg(fc, r0x0); + v0xc = fc->read_ibi_reg(fc, r0xc); - deb_rdump("reg: %03x: %x\n",r0x0,v0x0.raw); - deb_rdump("reg: %03x: %x\n",r0xc,v0xc.raw); + deb_rdump("reg: %03x: %x\n", r0x0, v0x0.raw); + deb_rdump("reg: %03x: %x\n", r0xc, v0xc.raw); if (index & FC_DMA_SUBADDR_0) v0x0.dma_0x0.dma_0start = onoff; @@ -98,11 +101,11 @@ int flexcop_dma_xfer_control(struct flexcop_device *fc, if (index & FC_DMA_SUBADDR_1) v0xc.dma_0xc.dma_1start = onoff; - fc->write_ibi_reg(fc,r0x0,v0x0); - fc->write_ibi_reg(fc,r0xc,v0xc); + fc->write_ibi_reg(fc, r0x0, v0x0); + fc->write_ibi_reg(fc, r0xc, v0xc); - deb_rdump("reg: %03x: %x\n",r0x0,v0x0.raw); - deb_rdump("reg: %03x: %x\n",r0xc,v0xc.raw); + deb_rdump("reg: %03x: %x\n", r0x0, v0x0.raw); + deb_rdump("reg: %03x: %x\n", r0xc, v0xc.raw); return 0; } EXPORT_SYMBOL(flexcop_dma_xfer_control); @@ -112,10 +115,11 @@ static int flexcop_dma_remap(struct flexcop_device *fc, int onoff) { flexcop_ibi_register r = (dma_idx & FC_DMA_1) ? dma1_00c : dma2_01c; - flexcop_ibi_value v = fc->read_ibi_reg(fc,r); - deb_info("%s\n",__func__); + flexcop_ibi_value v = fc->read_ibi_reg(fc, r); + + deb_info("%s\n", __func__); v.dma_0xc.remap_enable = onoff; - fc->write_ibi_reg(fc,r,v); + fc->write_ibi_reg(fc, r, v); return 0; } @@ -123,7 +127,7 @@ int flexcop_dma_control_size_irq(struct flexcop_device *fc, flexcop_dma_index_t no, int onoff) { - flexcop_ibi_value v = fc->read_ibi_reg(fc,ctrl_208); + flexcop_ibi_value v = fc->read_ibi_reg(fc, ctrl_208); if (no & FC_DMA_1) v.ctrl_208.DMA1_IRQ_Enable_sig = onoff; @@ -131,7 +135,7 @@ int flexcop_dma_control_size_irq(struct flexcop_device *fc, if (no & FC_DMA_2) v.ctrl_208.DMA2_IRQ_Enable_sig = onoff; - fc->write_ibi_reg(fc,ctrl_208,v); + fc->write_ibi_reg(fc, ctrl_208, v); return 0; } EXPORT_SYMBOL(flexcop_dma_control_size_irq); @@ -140,7 +144,7 @@ int flexcop_dma_control_timer_irq(struct flexcop_device *fc, flexcop_dma_index_t no, int onoff) { - flexcop_ibi_value v = fc->read_ibi_reg(fc,ctrl_208); + flexcop_ibi_value v = fc->read_ibi_reg(fc, ctrl_208); if (no & FC_DMA_1) v.ctrl_208.DMA1_Timer_Enable_sig = onoff; @@ -148,7 +152,7 @@ int flexcop_dma_control_timer_irq(struct flexcop_device *fc, if (no & FC_DMA_2) v.ctrl_208.DMA2_Timer_Enable_sig = onoff; - fc->write_ibi_reg(fc,ctrl_208,v); + fc->write_ibi_reg(fc, ctrl_208, v); return 0; } EXPORT_SYMBOL(flexcop_dma_control_timer_irq); @@ -158,13 +162,13 @@ int flexcop_dma_config_timer(struct flexcop_device *fc, flexcop_dma_index_t dma_idx, u8 cycles) { flexcop_ibi_register r = (dma_idx & FC_DMA_1) ? dma1_004 : dma2_014; - flexcop_ibi_value v = fc->read_ibi_reg(fc,r); + flexcop_ibi_value v = fc->read_ibi_reg(fc, r); - flexcop_dma_remap(fc,dma_idx,0); + flexcop_dma_remap(fc, dma_idx, 0); - deb_info("%s\n",__func__); + deb_info("%s\n", __func__); v.dma_0x4_write.dmatimer = cycles; - fc->write_ibi_reg(fc,r,v); + fc->write_ibi_reg(fc, r, v); return 0; } EXPORT_SYMBOL(flexcop_dma_config_timer); diff --git a/drivers/media/pci/bt8xx/bttv-driver.c b/drivers/media/pci/bt8xx/bttv-driver.c index d4906c04dc6e..d09785fd37a8 100644 --- a/drivers/media/pci/bt8xx/bttv-driver.c +++ b/drivers/media/pci/bt8xx/bttv-driver.c @@ -2792,19 +2792,17 @@ static int bttv_g_tuner(struct file *file, void *priv, return 0; } -static int bttv_cropcap(struct file *file, void *priv, - struct v4l2_cropcap *cap) +static int bttv_g_pixelaspect(struct file *file, void *priv, + int type, struct v4l2_fract *f) { struct bttv_fh *fh = priv; struct bttv *btv = fh->btv; - if (cap->type != V4L2_BUF_TYPE_VIDEO_CAPTURE && - cap->type != V4L2_BUF_TYPE_VIDEO_OVERLAY) + if (type != V4L2_BUF_TYPE_VIDEO_CAPTURE) return -EINVAL; /* defrect and bounds are set via g_selection */ - cap->pixelaspect = bttv_tvnorms[btv->tvnorm].cropcap.pixelaspect; - + *f = bttv_tvnorms[btv->tvnorm].cropcap.pixelaspect; return 0; } @@ -3162,7 +3160,7 @@ static const struct v4l2_ioctl_ops bttv_ioctl_ops = { .vidioc_g_fmt_vbi_cap = bttv_g_fmt_vbi_cap, .vidioc_try_fmt_vbi_cap = bttv_try_fmt_vbi_cap, .vidioc_s_fmt_vbi_cap = bttv_s_fmt_vbi_cap, - .vidioc_cropcap = bttv_cropcap, + .vidioc_g_pixelaspect = bttv_g_pixelaspect, .vidioc_reqbufs = bttv_reqbufs, .vidioc_querybuf = bttv_querybuf, .vidioc_qbuf = bttv_qbuf, diff --git a/drivers/media/pci/cobalt/cobalt-v4l2.c b/drivers/media/pci/cobalt/cobalt-v4l2.c index 0525f5e1565b..c088de551081 100644 --- a/drivers/media/pci/cobalt/cobalt-v4l2.c +++ b/drivers/media/pci/cobalt/cobalt-v4l2.c @@ -1077,33 +1077,65 @@ static int cobalt_g_parm(struct file *file, void *fh, struct v4l2_streamparm *a) return 0; } -static int cobalt_cropcap(struct file *file, void *fh, struct v4l2_cropcap *cc) +static int cobalt_g_pixelaspect(struct file *file, void *fh, + int type, struct v4l2_fract *f) { struct cobalt_stream *s = video_drvdata(file); struct v4l2_dv_timings timings; int err = 0; - if (cc->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) + if (type != V4L2_BUF_TYPE_VIDEO_CAPTURE) return -EINVAL; + if (s->input == 1) timings = cea1080p60; else err = v4l2_subdev_call(s->sd, video, g_dv_timings, &timings); - if (!err) { - cc->bounds.width = cc->defrect.width = timings.bt.width; - cc->bounds.height = cc->defrect.height = timings.bt.height; - cc->pixelaspect = v4l2_dv_timings_aspect_ratio(&timings); - } + if (!err) + *f = v4l2_dv_timings_aspect_ratio(&timings); return err; } +static int cobalt_g_selection(struct file *file, void *fh, + struct v4l2_selection *sel) +{ + struct cobalt_stream *s = video_drvdata(file); + struct v4l2_dv_timings timings; + int err = 0; + + if (sel->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) + return -EINVAL; + + if (s->input == 1) + timings = cea1080p60; + else + err = v4l2_subdev_call(s->sd, video, g_dv_timings, &timings); + + if (err) + return err; + + switch (sel->target) { + case V4L2_SEL_TGT_CROP_BOUNDS: + case V4L2_SEL_TGT_CROP_DEFAULT: + sel->r.top = 0; + sel->r.left = 0; + sel->r.width = timings.bt.width; + sel->r.height = timings.bt.height; + break; + default: + return -EINVAL; + } + return 0; +} + static const struct v4l2_ioctl_ops cobalt_ioctl_ops = { .vidioc_querycap = cobalt_querycap, .vidioc_g_parm = cobalt_g_parm, .vidioc_log_status = cobalt_log_status, .vidioc_streamon = vb2_ioctl_streamon, .vidioc_streamoff = vb2_ioctl_streamoff, - .vidioc_cropcap = cobalt_cropcap, + .vidioc_g_pixelaspect = cobalt_g_pixelaspect, + .vidioc_g_selection = cobalt_g_selection, .vidioc_enum_input = cobalt_enum_input, .vidioc_g_input = cobalt_g_input, .vidioc_s_input = cobalt_s_input, diff --git a/drivers/media/pci/cx18/cx18-ioctl.c b/drivers/media/pci/cx18/cx18-ioctl.c index 854116375a7c..8c54b17f382a 100644 --- a/drivers/media/pci/cx18/cx18-ioctl.c +++ b/drivers/media/pci/cx18/cx18-ioctl.c @@ -441,15 +441,16 @@ static int cx18_enum_input(struct file *file, void *fh, struct v4l2_input *vin) return cx18_get_input(cx, vin->index, vin); } -static int cx18_cropcap(struct file *file, void *fh, - struct v4l2_cropcap *cropcap) +static int cx18_g_pixelaspect(struct file *file, void *fh, + int type, struct v4l2_fract *f) { struct cx18 *cx = fh2id(fh)->cx; - if (cropcap->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) + if (type != V4L2_BUF_TYPE_VIDEO_CAPTURE) return -EINVAL; - cropcap->pixelaspect.numerator = cx->is_50hz ? 54 : 11; - cropcap->pixelaspect.denominator = cx->is_50hz ? 59 : 10; + + f->numerator = cx->is_50hz ? 54 : 11; + f->denominator = cx->is_50hz ? 59 : 10; return 0; } @@ -1079,7 +1080,7 @@ static const struct v4l2_ioctl_ops cx18_ioctl_ops = { .vidioc_g_audio = cx18_g_audio, .vidioc_enumaudio = cx18_enumaudio, .vidioc_enum_input = cx18_enum_input, - .vidioc_cropcap = cx18_cropcap, + .vidioc_g_pixelaspect = cx18_g_pixelaspect, .vidioc_g_selection = cx18_g_selection, .vidioc_g_input = cx18_g_input, .vidioc_s_input = cx18_s_input, diff --git a/drivers/media/pci/cx23885/cx23885-core.c b/drivers/media/pci/cx23885/cx23885-core.c index 39804d830305..fd5c52b21436 100644 --- a/drivers/media/pci/cx23885/cx23885-core.c +++ b/drivers/media/pci/cx23885/cx23885-core.c @@ -23,6 +23,7 @@ #include <linux/moduleparam.h> #include <linux/kmod.h> #include <linux/kernel.h> +#include <linux/pci.h> #include <linux/slab.h> #include <linux/interrupt.h> #include <linux/delay.h> @@ -41,6 +42,18 @@ MODULE_AUTHOR("Steven Toth <stoth@linuxtv.org>"); MODULE_LICENSE("GPL"); MODULE_VERSION(CX23885_VERSION); +/* + * Some platforms have been found to require periodic resetting of the DMA + * engine. Ryzen and XEON platforms are known to be affected. The symptom + * encountered is "mpeg risc op code error". Only Ryzen platforms employ + * this workaround if the option equals 1. The workaround can be explicitly + * disabled for all platforms by setting to 0, the workaround can be forced + * on for any platform by setting to 2. + */ +static unsigned int dma_reset_workaround = 1; +module_param(dma_reset_workaround, int, 0644); +MODULE_PARM_DESC(dma_reset_workaround, "periodic RiSC dma engine reset; 0-force disable, 1-driver detect (default), 2-force enable"); + static unsigned int debug; module_param(debug, int, 0644); MODULE_PARM_DESC(debug, "enable debug messages"); @@ -603,8 +616,13 @@ static void cx23885_risc_disasm(struct cx23885_tsport *port, static void cx23885_clear_bridge_error(struct cx23885_dev *dev) { - uint32_t reg1_val = cx_read(TC_REQ); /* read-only */ - uint32_t reg2_val = cx_read(TC_REQ_SET); + uint32_t reg1_val, reg2_val; + + if (!dev->need_dma_reset) + return; + + reg1_val = cx_read(TC_REQ); /* read-only */ + reg2_val = cx_read(TC_REQ_SET); if (reg1_val && reg2_val) { cx_write(TC_REQ, reg1_val); @@ -2058,6 +2076,37 @@ void cx23885_gpio_enable(struct cx23885_dev *dev, u32 mask, int asoutput) /* TODO: 23-19 */ } +static struct { + int vendor, dev; +} const broken_dev_id[] = { + /* According with + * https://openbenchmarking.org/system/1703021-RI-AMDZEN08075/Ryzen%207%201800X/lspci, + * 0x1451 is PCI ID for the IOMMU found on Ryzen + */ + { PCI_VENDOR_ID_AMD, 0x1451 }, +}; + +static bool cx23885_does_need_dma_reset(void) +{ + int i; + struct pci_dev *pdev = NULL; + + if (dma_reset_workaround == 0) + return false; + else if (dma_reset_workaround == 2) + return true; + + for (i = 0; i < ARRAY_SIZE(broken_dev_id); i++) { + pdev = pci_get_device(broken_dev_id[i].vendor, + broken_dev_id[i].dev, NULL); + if (pdev) { + pci_dev_put(pdev); + return true; + } + } + return false; +} + static int cx23885_initdev(struct pci_dev *pci_dev, const struct pci_device_id *pci_id) { @@ -2069,6 +2118,8 @@ static int cx23885_initdev(struct pci_dev *pci_dev, if (NULL == dev) return -ENOMEM; + dev->need_dma_reset = cx23885_does_need_dma_reset(); + err = v4l2_device_register(&pci_dev->dev, &dev->v4l2_dev); if (err < 0) goto fail_free; diff --git a/drivers/media/pci/cx23885/cx23885-i2c.c b/drivers/media/pci/cx23885/cx23885-i2c.c index d0df3dfff694..de6809b950ce 100644 --- a/drivers/media/pci/cx23885/cx23885-i2c.c +++ b/drivers/media/pci/cx23885/cx23885-i2c.c @@ -18,7 +18,6 @@ #include "cx23885.h" #include <linux/module.h> -#include <linux/moduleparam.h> #include <linux/init.h> #include <linux/delay.h> #include <asm/io.h> diff --git a/drivers/media/pci/cx23885/cx23885-video.c b/drivers/media/pci/cx23885/cx23885-video.c index 92d32a733f1b..168178c1e574 100644 --- a/drivers/media/pci/cx23885/cx23885-video.c +++ b/drivers/media/pci/cx23885/cx23885-video.c @@ -668,26 +668,43 @@ static int vidioc_enum_fmt_vid_cap(struct file *file, void *priv, return 0; } -static int vidioc_cropcap(struct file *file, void *priv, - struct v4l2_cropcap *cc) +static int vidioc_g_pixelaspect(struct file *file, void *priv, + int type, struct v4l2_fract *f) { struct cx23885_dev *dev = video_drvdata(file); bool is_50hz = dev->tvnorm & V4L2_STD_625_50; - if (cc->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) + if (type != V4L2_BUF_TYPE_VIDEO_CAPTURE) return -EINVAL; - cc->bounds.left = 0; - cc->bounds.top = 0; - cc->bounds.width = 720; - cc->bounds.height = norm_maxh(dev->tvnorm); - cc->defrect = cc->bounds; - cc->pixelaspect.numerator = is_50hz ? 54 : 11; - cc->pixelaspect.denominator = is_50hz ? 59 : 10; + f->numerator = is_50hz ? 54 : 11; + f->denominator = is_50hz ? 59 : 10; return 0; } +static int vidioc_g_selection(struct file *file, void *fh, + struct v4l2_selection *sel) +{ + struct cx23885_dev *dev = video_drvdata(file); + + if (sel->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) + return -EINVAL; + + switch (sel->target) { + case V4L2_SEL_TGT_CROP_BOUNDS: + case V4L2_SEL_TGT_CROP_DEFAULT: + sel->r.top = 0; + sel->r.left = 0; + sel->r.width = 720; + sel->r.height = norm_maxh(dev->tvnorm); + break; + default: + return -EINVAL; + } + return 0; +} + static int vidioc_g_std(struct file *file, void *priv, v4l2_std_id *id) { struct cx23885_dev *dev = video_drvdata(file); @@ -1122,7 +1139,8 @@ static const struct v4l2_ioctl_ops video_ioctl_ops = { .vidioc_dqbuf = vb2_ioctl_dqbuf, .vidioc_streamon = vb2_ioctl_streamon, .vidioc_streamoff = vb2_ioctl_streamoff, - .vidioc_cropcap = vidioc_cropcap, + .vidioc_g_pixelaspect = vidioc_g_pixelaspect, + .vidioc_g_selection = vidioc_g_selection, .vidioc_s_std = vidioc_s_std, .vidioc_g_std = vidioc_g_std, .vidioc_enum_input = vidioc_enum_input, diff --git a/drivers/media/pci/cx23885/cx23885.h b/drivers/media/pci/cx23885/cx23885.h index d54c7ee1ab21..cf965efabe66 100644 --- a/drivers/media/pci/cx23885/cx23885.h +++ b/drivers/media/pci/cx23885/cx23885.h @@ -451,6 +451,8 @@ struct cx23885_dev { /* Analog raw audio */ struct cx23885_audio_dev *audio_dev; + /* Does the system require periodic DMA resets? */ + unsigned int need_dma_reset:1; }; static inline struct cx23885_dev *to_cx23885(struct v4l2_device *v4l2_dev) diff --git a/drivers/media/pci/ddbridge/ddbridge.h b/drivers/media/pci/ddbridge/ddbridge.h index f137155bf79e..b834449e78f8 100644 --- a/drivers/media/pci/ddbridge/ddbridge.h +++ b/drivers/media/pci/ddbridge/ddbridge.h @@ -18,47 +18,43 @@ #ifndef _DDBRIDGE_H_ #define _DDBRIDGE_H_ -#include <linux/module.h> +#include <linux/clk.h> +#include <linux/completion.h> +#include <linux/delay.h> +#include <linux/device.h> +#include <linux/dvb/ca.h> +#include <linux/gpio.h> +#include <linux/i2c.h> #include <linux/init.h> #include <linux/interrupt.h> -#include <linux/delay.h> -#include <linux/slab.h> -#include <linux/poll.h> #include <linux/io.h> +#include <linux/kthread.h> +#include <linux/module.h> +#include <linux/mutex.h> #include <linux/pci.h> -#include <linux/timer.h> -#include <linux/i2c.h> +#include <linux/platform_device.h> +#include <linux/poll.h> +#include <linux/sched.h> +#include <linux/slab.h> +#include <linux/socket.h> +#include <linux/spi/spi.h> #include <linux/swab.h> +#include <linux/timer.h> +#include <linux/types.h> +#include <linux/uaccess.h> #include <linux/vmalloc.h> #include <linux/workqueue.h> -#include <linux/kthread.h> -#include <linux/platform_device.h> -#include <linux/clk.h> -#include <linux/spi/spi.h> -#include <linux/gpio.h> -#include <linux/completion.h> -#include <linux/types.h> -#include <linux/sched.h> -#include <linux/interrupt.h> -#include <linux/mutex.h> #include <asm/dma.h> #include <asm/irq.h> -#include <linux/io.h> -#include <linux/uaccess.h> - -#include <linux/dvb/ca.h> -#include <linux/socket.h> -#include <linux/device.h> -#include <linux/io.h> #include <media/dmxdev.h> -#include <media/dvbdev.h> +#include <media/dvb_ca_en50221.h> #include <media/dvb_demux.h> +#include <media/dvbdev.h> #include <media/dvb_frontend.h> -#include <media/dvb_ringbuffer.h> -#include <media/dvb_ca_en50221.h> #include <media/dvb_net.h> +#include <media/dvb_ringbuffer.h> #define DDBRIDGE_VERSION "0.9.33-integrated" diff --git a/drivers/media/pci/intel/ipu3/ipu3-cio2.c b/drivers/media/pci/intel/ipu3/ipu3-cio2.c index 452eb9b42140..447baaebca44 100644 --- a/drivers/media/pci/intel/ipu3/ipu3-cio2.c +++ b/drivers/media/pci/intel/ipu3/ipu3-cio2.c @@ -1844,14 +1844,12 @@ fail_mutex_destroy: static void cio2_pci_remove(struct pci_dev *pci_dev) { struct cio2_device *cio2 = pci_get_drvdata(pci_dev); - unsigned int i; + media_device_unregister(&cio2->media_dev); cio2_notifier_exit(cio2); + cio2_queues_exit(cio2); cio2_fbpt_exit_dummy(cio2); - for (i = 0; i < CIO2_QUEUES; i++) - cio2_queue_exit(cio2, &cio2->queue[i]); v4l2_device_unregister(&cio2->v4l2_dev); - media_device_unregister(&cio2->media_dev); media_device_cleanup(&cio2->media_dev); mutex_destroy(&cio2->lock); } diff --git a/drivers/media/pci/intel/ipu3/ipu3-cio2.h b/drivers/media/pci/intel/ipu3/ipu3-cio2.h index 240635be7a31..7caab9b8c2b9 100644 --- a/drivers/media/pci/intel/ipu3/ipu3-cio2.h +++ b/drivers/media/pci/intel/ipu3/ipu3-cio2.h @@ -10,8 +10,6 @@ #define CIO2_PCI_ID 0x9d32 #define CIO2_PCI_BAR 0 #define CIO2_DMA_MASK DMA_BIT_MASK(39) -#define CIO2_IMAGE_MAX_WIDTH 4224 -#define CIO2_IMAGE_MAX_LENGTH 3136 #define CIO2_IMAGE_MAX_WIDTH 4224 #define CIO2_IMAGE_MAX_LENGTH 3136 diff --git a/drivers/media/pci/ivtv/ivtv-ioctl.c b/drivers/media/pci/ivtv/ivtv-ioctl.c index a66f8b872520..6c269ecd8d05 100644 --- a/drivers/media/pci/ivtv/ivtv-ioctl.c +++ b/drivers/media/pci/ivtv/ivtv-ioctl.c @@ -829,17 +829,18 @@ static int ivtv_enum_output(struct file *file, void *fh, struct v4l2_output *vou return ivtv_get_output(itv, vout->index, vout); } -static int ivtv_cropcap(struct file *file, void *fh, struct v4l2_cropcap *cropcap) +static int ivtv_g_pixelaspect(struct file *file, void *fh, + int type, struct v4l2_fract *f) { struct ivtv_open_id *id = fh2id(fh); struct ivtv *itv = id->itv; - if (cropcap->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) { - cropcap->pixelaspect.numerator = itv->is_50hz ? 54 : 11; - cropcap->pixelaspect.denominator = itv->is_50hz ? 59 : 10; - } else if (cropcap->type == V4L2_BUF_TYPE_VIDEO_OUTPUT) { - cropcap->pixelaspect.numerator = itv->is_out_50hz ? 54 : 11; - cropcap->pixelaspect.denominator = itv->is_out_50hz ? 59 : 10; + if (type == V4L2_BUF_TYPE_VIDEO_CAPTURE) { + f->numerator = itv->is_50hz ? 54 : 11; + f->denominator = itv->is_50hz ? 59 : 10; + } else if (type == V4L2_BUF_TYPE_VIDEO_OUTPUT) { + f->numerator = itv->is_out_50hz ? 54 : 11; + f->denominator = itv->is_out_50hz ? 59 : 10; } else { return -EINVAL; } @@ -1923,7 +1924,7 @@ static const struct v4l2_ioctl_ops ivtv_ioctl_ops = { .vidioc_enum_input = ivtv_enum_input, .vidioc_enum_output = ivtv_enum_output, .vidioc_enumaudout = ivtv_enumaudout, - .vidioc_cropcap = ivtv_cropcap, + .vidioc_g_pixelaspect = ivtv_g_pixelaspect, .vidioc_s_selection = ivtv_s_selection, .vidioc_g_selection = ivtv_g_selection, .vidioc_g_input = ivtv_g_input, diff --git a/drivers/media/pci/mantis/mantis_cards.c b/drivers/media/pci/mantis/mantis_cards.c index 7eb75cb7d75a..e544bb9bab90 100644 --- a/drivers/media/pci/mantis/mantis_cards.c +++ b/drivers/media/pci/mantis/mantis_cards.c @@ -19,7 +19,6 @@ */ #include <linux/module.h> -#include <linux/moduleparam.h> #include <linux/kernel.h> #include <linux/pci.h> #include <linux/slab.h> 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 |