diff options
Diffstat (limited to 'drivers/staging/media')
-rw-r--r-- | drivers/staging/media/dt3155v4l/dt3155v4l.c | 5 | ||||
-rw-r--r-- | drivers/staging/media/go7007/go7007-usb.c | 111 | ||||
-rw-r--r-- | drivers/staging/media/lirc/TODO | 5 | ||||
-rw-r--r-- | drivers/staging/media/lirc/lirc_bt829.c | 37 | ||||
-rw-r--r-- | drivers/staging/media/lirc/lirc_imon.c | 2 | ||||
-rw-r--r-- | drivers/staging/media/lirc/lirc_serial.c | 25 | ||||
-rw-r--r-- | drivers/staging/media/lirc/lirc_zilog.c | 12 | ||||
-rw-r--r-- | drivers/staging/media/msi3101/Kconfig | 3 | ||||
-rw-r--r-- | drivers/staging/media/solo6x10/solo6x10-disp.c | 25 | ||||
-rw-r--r-- | drivers/staging/media/solo6x10/solo6x10-p2m.c | 2 | ||||
-rw-r--r-- | drivers/staging/media/solo6x10/solo6x10-v4l2-enc.c | 170 | ||||
-rw-r--r-- | drivers/staging/media/solo6x10/solo6x10.h | 1 |
12 files changed, 170 insertions, 228 deletions
diff --git a/drivers/staging/media/dt3155v4l/dt3155v4l.c b/drivers/staging/media/dt3155v4l/dt3155v4l.c index 081407b..90d6ac4 100644 --- a/drivers/staging/media/dt3155v4l/dt3155v4l.c +++ b/drivers/staging/media/dt3155v4l/dt3155v4l.c @@ -901,7 +901,10 @@ dt3155_probe(struct pci_dev *pdev, const struct pci_device_id *id) int err; struct dt3155_priv *pd; - err = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32)); + err = dma_set_mask(&pdev->dev, DMA_BIT_MASK(32)); + if (err) + return -ENODEV; + err = dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32)); if (err) return -ENODEV; pd = kzalloc(sizeof(*pd), GFP_KERNEL); diff --git a/drivers/staging/media/go7007/go7007-usb.c b/drivers/staging/media/go7007/go7007-usb.c index b658c23..46ed832 100644 --- a/drivers/staging/media/go7007/go7007-usb.c +++ b/drivers/staging/media/go7007/go7007-usb.c @@ -15,8 +15,6 @@ * Inc., 59 Temple Place - Suite 330, Boston MA 02111-1307, USA. */ -#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt - #include <linux/module.h> #include <linux/kernel.h> #include <linux/init.h> @@ -36,9 +34,10 @@ static unsigned int assume_endura; module_param(assume_endura, int, 0644); -MODULE_PARM_DESC(assume_endura, - "when probing fails, hardware is a Pelco Endura"); +MODULE_PARM_DESC(assume_endura, "when probing fails, " + "hardware is a Pelco Endura"); +/* #define GO7007_USB_DEBUG */ /* #define GO7007_I2C_DEBUG */ /* for debugging the EZ-USB I2C adapter */ #define HPI_STATUS_ADDR 0xFFF4 @@ -663,7 +662,9 @@ static int go7007_usb_interface_reset(struct go7007 *go) if (usb->board->flags & GO7007_USB_EZUSB) { /* Reset buffer in EZ-USB */ - pr_debug("resetting EZ-USB buffers\n"); +#ifdef GO7007_USB_DEBUG + printk(KERN_DEBUG "go7007-usb: resetting EZ-USB buffers\n"); +#endif if (go7007_usb_vendor_request(go, 0x10, 0, 0, NULL, 0, 0) < 0 || go7007_usb_vendor_request(go, 0x10, 0, 0, NULL, 0, 0) < 0) return -1; @@ -677,7 +678,8 @@ static int go7007_usb_interface_reset(struct go7007 *go) /* Wait for an interrupt to indicate successful hardware reset */ if (go7007_read_interrupt(go, &intr_val, &intr_data) < 0 || (intr_val & ~0x1) != 0x55aa) { - dev_err(go->dev, "unable to reset the USB interface\n"); + printk(KERN_ERR + "go7007-usb: unable to reset the USB interface\n"); return -1; } return 0; @@ -691,7 +693,10 @@ static int go7007_usb_ezusb_write_interrupt(struct go7007 *go, u16 status_reg = 0; int timeout = 500; - pr_debug("WriteInterrupt: %04x %04x\n", addr, data); +#ifdef GO7007_USB_DEBUG + printk(KERN_DEBUG + "go7007-usb: WriteInterrupt: %04x %04x\n", addr, data); +#endif for (i = 0; i < 100; ++i) { r = usb_control_msg(usb->usbdev, @@ -709,7 +714,9 @@ static int go7007_usb_ezusb_write_interrupt(struct go7007 *go, if (r < 0) goto write_int_error; if (i == 100) { - dev_err(go->dev, "device is hung, status reg = 0x%04x\n", status_reg); + printk(KERN_ERR + "go7007-usb: device is hung, status reg = 0x%04x\n", + status_reg); return -1; } r = usb_control_msg(usb->usbdev, usb_sndctrlpipe(usb->usbdev, 0), 0x12, @@ -725,7 +732,7 @@ static int go7007_usb_ezusb_write_interrupt(struct go7007 *go, return 0; write_int_error: - dev_err(go->dev, "error in WriteInterrupt: %d\n", r); + printk(KERN_ERR "go7007-usb: error in WriteInterrupt: %d\n", r); return r; } @@ -736,7 +743,10 @@ static int go7007_usb_onboard_write_interrupt(struct go7007 *go, int r; int timeout = 500; - pr_debug("WriteInterrupt: %04x %04x\n", addr, data); +#ifdef GO7007_USB_DEBUG + printk(KERN_DEBUG + "go7007-usb: WriteInterrupt: %04x %04x\n", addr, data); +#endif go->usb_buf[0] = data & 0xff; go->usb_buf[1] = data >> 8; @@ -747,7 +757,7 @@ static int go7007_usb_onboard_write_interrupt(struct go7007 *go, USB_TYPE_VENDOR | USB_RECIP_ENDPOINT, 0x55aa, 0xf0f0, go->usb_buf, 8, timeout); if (r < 0) { - dev_err(go->dev, "error in WriteInterrupt: %d\n", r); + printk(KERN_ERR "go7007-usb: error in WriteInterrupt: %d\n", r); return r; } return 0; @@ -762,19 +772,23 @@ static void go7007_usb_readinterrupt_complete(struct urb *urb) if (status) { if (status != -ESHUTDOWN && go->status != STATUS_SHUTDOWN) { - dev_err(go->dev, "error in read interrupt: %d\n", urb->status); + printk(KERN_ERR + "go7007-usb: error in read interrupt: %d\n", + urb->status); } else { wake_up(&go->interrupt_waitq); return; } } else if (urb->actual_length != urb->transfer_buffer_length) { - dev_err(go->dev, "short read in interrupt pipe!\n"); + printk(KERN_ERR "go7007-usb: short read in interrupt pipe!\n"); } else { go->interrupt_available = 1; go->interrupt_data = __le16_to_cpu(regs[0]); go->interrupt_value = __le16_to_cpu(regs[1]); - pr_debug("ReadInterrupt: %04x %04x\n", +#ifdef GO7007_USB_DEBUG + printk(KERN_DEBUG "go7007-usb: ReadInterrupt: %04x %04x\n", go->interrupt_value, go->interrupt_data); +#endif } wake_up(&go->interrupt_waitq); @@ -787,7 +801,8 @@ static int go7007_usb_read_interrupt(struct go7007 *go) r = usb_submit_urb(usb->intr_urb, GFP_KERNEL); if (r < 0) { - dev_err(go->dev, "unable to submit interrupt urb: %d\n", r); + printk(KERN_ERR + "go7007-usb: unable to submit interrupt urb: %d\n", r); return r; } return 0; @@ -803,17 +818,18 @@ static void go7007_usb_read_video_pipe_complete(struct urb *urb) return; } if (status) { - dev_err(go->dev, "error in video pipe: %d\n", status); + printk(KERN_ERR "go7007-usb: error in video pipe: %d\n", + status); return; } if (urb->actual_length != urb->transfer_buffer_length) { - dev_err(go->dev, "short read in video pipe!\n"); + printk(KERN_ERR "go7007-usb: short read in video pipe!\n"); return; } go7007_parse_video_stream(go, urb->transfer_buffer, urb->actual_length); r = usb_submit_urb(urb, GFP_ATOMIC); if (r < 0) - dev_err(go->dev, "error in video pipe: %d\n", r); + printk(KERN_ERR "go7007-usb: error in video pipe: %d\n", r); } static void go7007_usb_read_audio_pipe_complete(struct urb *urb) @@ -824,19 +840,19 @@ static void go7007_usb_read_audio_pipe_complete(struct urb *urb) if (!vb2_is_streaming(&go->vidq)) return; if (status) { - dev_err(go->dev, "error in audio pipe: %d\n", + printk(KERN_ERR "go7007-usb: error in audio pipe: %d\n", status); return; } if (urb->actual_length != urb->transfer_buffer_length) { - dev_err(go->dev, "short read in audio pipe!\n"); + printk(KERN_ERR "go7007-usb: short read in audio pipe!\n"); return; } if (go->audio_deliver != NULL) go->audio_deliver(go, urb->transfer_buffer, urb->actual_length); r = usb_submit_urb(urb, GFP_ATOMIC); if (r < 0) - dev_err(go->dev, "error in audio pipe: %d\n", r); + printk(KERN_ERR "go7007-usb: error in audio pipe: %d\n", r); } static int go7007_usb_stream_start(struct go7007 *go) @@ -847,7 +863,8 @@ static int go7007_usb_stream_start(struct go7007 *go) for (i = 0; i < 8; ++i) { r = usb_submit_urb(usb->video_urbs[i], GFP_KERNEL); if (r < 0) { - dev_err(go->dev, "error submitting video urb %d: %d\n", i, r); + printk(KERN_ERR "go7007-usb: error submitting video " + "urb %d: %d\n", i, r); goto video_submit_failed; } } @@ -857,7 +874,8 @@ static int go7007_usb_stream_start(struct go7007 *go) for (i = 0; i < 8; ++i) { r = usb_submit_urb(usb->audio_urbs[i], GFP_KERNEL); if (r < 0) { - dev_err(go->dev, "error submitting audio urb %d: %d\n", i, r); + printk(KERN_ERR "go7007-usb: error submitting audio " + "urb %d: %d\n", i, r); goto audio_submit_failed; } } @@ -893,7 +911,9 @@ static int go7007_usb_send_firmware(struct go7007 *go, u8 *data, int len) int transferred, pipe; int timeout = 500; - pr_debug("DownloadBuffer sending %d bytes\n", len); +#ifdef GO7007_USB_DEBUG + printk(KERN_DEBUG "go7007-usb: DownloadBuffer sending %d bytes\n", len); +#endif if (usb->board->flags & GO7007_USB_EZUSB) pipe = usb_sndbulkpipe(usb->usbdev, 2); @@ -979,8 +999,9 @@ static int go7007_usb_i2c_master_xfer(struct i2c_adapter *adapter, !(msgs[i].flags & I2C_M_RD) && (msgs[i + 1].flags & I2C_M_RD)) { #ifdef GO7007_I2C_DEBUG - pr_debug("i2c write/read %d/%d bytes on %02x\n", - msgs[i].len, msgs[i + 1].len, msgs[i].addr); + printk(KERN_DEBUG "go7007-usb: i2c write/read %d/%d " + "bytes on %02x\n", msgs[i].len, + msgs[i + 1].len, msgs[i].addr); #endif buf[0] = 0x01; buf[1] = msgs[i].len + 1; @@ -990,8 +1011,9 @@ static int go7007_usb_i2c_master_xfer(struct i2c_adapter *adapter, buf[buf_len++] = msgs[++i].len; } else if (msgs[i].flags & I2C_M_RD) { #ifdef GO7007_I2C_DEBUG - pr_debug("i2c read %d bytes on %02x\n", - msgs[i].len, msgs[i].addr); + printk(KERN_DEBUG "go7007-usb: i2c read %d " + "bytes on %02x\n", msgs[i].len, + msgs[i].addr); #endif buf[0] = 0x01; buf[1] = 1; @@ -1000,8 +1022,9 @@ static int go7007_usb_i2c_master_xfer(struct i2c_adapter *adapter, buf_len = 4; } else { #ifdef GO7007_I2C_DEBUG - pr_debug("i2c write %d bytes on %02x\n", - msgs[i].len, msgs[i].addr); + printk(KERN_DEBUG "go7007-usb: i2c write %d " + "bytes on %02x\n", msgs[i].len, + msgs[i].addr); #endif buf[0] = 0x00; buf[1] = msgs[i].len + 1; @@ -1059,7 +1082,7 @@ static int go7007_usb_probe(struct usb_interface *intf, char *name; int video_pipe, i, v_urb_len; - pr_debug("probing new GO7007 USB board\n"); + printk(KERN_DEBUG "go7007-usb: probing new GO7007 USB board\n"); switch (id->driver_info) { case GO7007_BOARDID_MATRIX_II: @@ -1099,13 +1122,14 @@ static int go7007_usb_probe(struct usb_interface *intf, board = &board_px_tv402u; break; case GO7007_BOARDID_LIFEVIEW_LR192: - dev_err(&intf->dev, "The Lifeview TV Walker Ultra is not supported. Sorry!\n"); + printk(KERN_ERR "go7007-usb: The Lifeview TV Walker Ultra " + "is not supported. Sorry!\n"); return -ENODEV; name = "Lifeview TV Walker Ultra"; board = &board_lifeview_lr192; break; case GO7007_BOARDID_SENSORAY_2250: - dev_info(&intf->dev, "Sensoray 2250 found\n"); + printk(KERN_INFO "Sensoray 2250 found\n"); name = "Sensoray 2250/2251"; board = &board_sensoray_2250; break; @@ -1114,7 +1138,7 @@ static int go7007_usb_probe(struct usb_interface *intf, board = &board_ads_usbav_709; break; default: - dev_err(&intf->dev, "unknown board ID %d!\n", + printk(KERN_ERR "go7007-usb: unknown board ID %d!\n", (unsigned int)id->driver_info); return -ENODEV; } @@ -1173,7 +1197,8 @@ static int go7007_usb_probe(struct usb_interface *intf, go->i2c_adapter.dev.parent = go->dev; i2c_set_adapdata(&go->i2c_adapter, go); if (i2c_add_adapter(&go->i2c_adapter) < 0) { - dev_err(go->dev, "error: i2c_add_adapter failed\n"); + printk(KERN_ERR + "go7007-usb: error: i2c_add_adapter failed\n"); goto allocfail; } go->i2c_adapter_online = 1; @@ -1223,9 +1248,8 @@ static int go7007_usb_probe(struct usb_interface *intf, /* Probe the tuner model on the TV402U */ if (go->board_id == GO7007_BOARDID_PX_TV402U) { /* Board strapping indicates tuner model */ - if (go7007_usb_vendor_request(go, 0x41, 0, 0, go->usb_buf, 3, - 1) < 0) { - dev_err(go->dev, "GPIO read failed!\n"); + if (go7007_usb_vendor_request(go, 0x41, 0, 0, go->usb_buf, 3, 1) < 0) { + printk(KERN_ERR "go7007-usb: GPIO read failed!\n"); goto allocfail; } switch (go->usb_buf[0] >> 6) { @@ -1249,14 +1273,15 @@ static int go7007_usb_probe(struct usb_interface *intf, sizeof(go->name)); break; default: - pr_debug("unable to detect tuner type!\n"); + printk(KERN_DEBUG "go7007-usb: unable to detect " + "tuner type!\n"); break; } /* Configure tuner mode selection inputs connected * to the EZ-USB GPIO output pins */ if (go7007_usb_vendor_request(go, 0x40, 0x7f02, 0, NULL, 0, 0) < 0) { - dev_err(go->dev, "GPIO write failed!\n"); + printk(KERN_ERR "go7007-usb: GPIO write failed!\n"); goto allocfail; } } @@ -1265,7 +1290,11 @@ static int go7007_usb_probe(struct usb_interface *intf, * a USB1.1 port. There will be silent corruption of the stream. */ if ((board->flags & GO7007_USB_EZUSB) && usbdev->speed != USB_SPEED_HIGH) - dev_err(go->dev, "*** WARNING *** This device must be connected to a USB 2.0 port! Attempting to capture video through a USB 1.1 port will result in stream corruption, even at low bitrates!\n"); + printk(KERN_ERR "go7007-usb: *** WARNING *** This device " + "must be connected to a USB 2.0 port! " + "Attempting to capture video through a USB 1.1 " + "port will result in stream corruption, even " + "at low bitrates!\n"); /* Allocate the URBs and buffers for receiving the video stream */ if (board->flags & GO7007_USB_EZUSB) { diff --git a/drivers/staging/media/lirc/TODO b/drivers/staging/media/lirc/TODO index cbea5d8..b6cb593 100644 --- a/drivers/staging/media/lirc/TODO +++ b/drivers/staging/media/lirc/TODO @@ -2,11 +2,6 @@ (see drivers/media/IR/mceusb.c vs. lirc_mceusb.c in lirc cvs for an example of a previously completed port). -- lirc_bt829 uses registers on a Mach64 VT, which has a separate kernel - framebuffer driver (atyfb) and userland X driver (mach64). It can't - simply be converted to a normal PCI driver, but ideally it should be - coordinated with the other drivers. - Please send patches to: Jarod Wilson <jarod@wilsonet.com> Greg Kroah-Hartman <greg@kroah.com> diff --git a/drivers/staging/media/lirc/lirc_bt829.c b/drivers/staging/media/lirc/lirc_bt829.c index 30edc74..fa31ee7 100644 --- a/drivers/staging/media/lirc/lirc_bt829.c +++ b/drivers/staging/media/lirc/lirc_bt829.c @@ -63,7 +63,7 @@ static bool debug; } while (0) static int atir_minor; -static phys_addr_t pci_addr_phys; +static unsigned long pci_addr_phys; static unsigned char *pci_addr_lin; static struct lirc_driver atir_driver; @@ -78,11 +78,11 @@ static struct pci_dev *do_pci_probe(void) pci_addr_phys = 0; if (my_dev->resource[0].flags & IORESOURCE_MEM) { pci_addr_phys = my_dev->resource[0].start; - pr_info("memory at %pa\n", &pci_addr_phys); + pr_info("memory at 0x%08X\n", + (unsigned int)pci_addr_phys); } if (pci_addr_phys == 0) { pr_err("no memory resource ?\n"); - pci_dev_put(my_dev); return NULL; } } else { @@ -120,26 +120,19 @@ static void atir_set_use_dec(void *data) int init_module(void) { struct pci_dev *pdev; - int rc; pdev = do_pci_probe(); if (pdev == NULL) return -ENODEV; - rc = pci_enable_device(pdev); - if (rc) - goto err_put_dev; - - if (!atir_init_start()) { - rc = -ENODEV; - goto err_disable; - } + if (!atir_init_start()) + return -ENODEV; strcpy(atir_driver.name, "ATIR"); atir_driver.minor = -1; atir_driver.code_length = 8; atir_driver.sample_rate = 10; - atir_driver.data = NULL; + atir_driver.data = 0; atir_driver.add_to_buf = atir_add_to_buf; atir_driver.set_use_inc = atir_set_use_inc; atir_driver.set_use_dec = atir_set_use_dec; @@ -149,38 +142,24 @@ int init_module(void) atir_minor = lirc_register_driver(&atir_driver); if (atir_minor < 0) { pr_err("failed to register driver!\n"); - rc = atir_minor; - goto err_unmap; + return atir_minor; } dprintk("driver is registered on minor %d\n", atir_minor); return 0; - -err_unmap: - iounmap(pci_addr_lin); -err_disable: - pci_disable_device(pdev); -err_put_dev: - pci_dev_put(pdev); - return rc; } void cleanup_module(void) { - struct pci_dev *pdev = to_pci_dev(atir_driver.dev); - lirc_unregister_driver(atir_minor); - iounmap(pci_addr_lin); - pci_disable_device(pdev); - pci_dev_put(pdev); } static int atir_init_start(void) { pci_addr_lin = ioremap(pci_addr_phys + DATA_PCI_OFF, 0x400); - if (!pci_addr_lin) { + if (pci_addr_lin == 0) { pr_info("pci mem must be mapped\n"); return 0; } diff --git a/drivers/staging/media/lirc/lirc_imon.c b/drivers/staging/media/lirc/lirc_imon.c index ab2ae11..4afa7da 100644 --- a/drivers/staging/media/lirc/lirc_imon.c +++ b/drivers/staging/media/lirc/lirc_imon.c @@ -625,7 +625,7 @@ static void imon_incoming_packet(struct imon_context *context, } if (debug) { - dev_info(dev, "raw packet: "); + printk(KERN_INFO "raw packet: "); for (i = 0; i < len; ++i) printk("%02x ", buf[i]); printk("\n"); diff --git a/drivers/staging/media/lirc/lirc_serial.c b/drivers/staging/media/lirc/lirc_serial.c index 2e3a985..af08e67 100644 --- a/drivers/staging/media/lirc/lirc_serial.c +++ b/drivers/staging/media/lirc/lirc_serial.c @@ -67,7 +67,7 @@ #include <linux/delay.h> #include <linux/poll.h> #include <linux/platform_device.h> -#include <linux/gpio.h> + #include <linux/io.h> #include <linux/irq.h> #include <linux/fcntl.h> @@ -321,7 +321,7 @@ static void on(void) * status LED and ground */ if (type == LIRC_NSLU2) { - gpio_set_value(NSLU2_LED_GRN, 0); + gpio_line_set(NSLU2_LED_GRN, IXP4XX_GPIO_LOW); return; } #endif @@ -335,7 +335,7 @@ static void off(void) { #ifdef CONFIG_LIRC_SERIAL_NSLU2 if (type == LIRC_NSLU2) { - gpio_set_value(NSLU2_LED_GRN, 1); + gpio_line_set(NSLU2_LED_GRN, IXP4XX_GPIO_HIGH); return; } #endif @@ -707,8 +707,7 @@ static irqreturn_t irq_handler(int i, void *blah) pr_warn("ignoring spike: %d %d %lx %lx %lx %lx\n", dcd, sense, tv.tv_sec, lasttv.tv_sec, - (unsigned long)tv.tv_usec, - (unsigned long)lasttv.tv_usec); + tv.tv_usec, lasttv.tv_usec); continue; } @@ -720,8 +719,7 @@ static irqreturn_t irq_handler(int i, void *blah) pr_warn("%d %d %lx %lx %lx %lx\n", dcd, sense, tv.tv_sec, lasttv.tv_sec, - (unsigned long)tv.tv_usec, - (unsigned long)lasttv.tv_usec); + tv.tv_usec, lasttv.tv_usec); data = PULSE_MASK; } else if (deltv > 15) { data = PULSE_MASK; /* really long time */ @@ -730,8 +728,7 @@ static irqreturn_t irq_handler(int i, void *blah) pr_warn("AIEEEE: %d %d %lx %lx %lx %lx\n", dcd, sense, tv.tv_sec, lasttv.tv_sec, - (unsigned long)tv.tv_usec, - (unsigned long)lasttv.tv_usec); + tv.tv_usec, lasttv.tv_usec); /* * detecting pulse while this * MUST be a space! @@ -842,16 +839,6 @@ static int lirc_serial_probe(struct platform_device *dev) { int i, nlow, nhigh, result; -#ifdef CONFIG_LIRC_SERIAL_NSLU2 - /* This GPIO is used for a LED on the NSLU2 */ - result = devm_gpio_request(dev, NSLU2_LED_GRN, "lirc-serial"); - if (result) - return result; - result = gpio_direction_output(NSLU2_LED_GRN, 0); - if (result) - return result; -#endif - result = request_irq(irq, irq_handler, (share_irq ? IRQF_SHARED : 0), LIRC_DRIVER_NAME, (void *)&hardware); diff --git a/drivers/staging/media/lirc/lirc_zilog.c b/drivers/staging/media/lirc/lirc_zilog.c index 0feeaad..11d5338 100644 --- a/drivers/staging/media/lirc/lirc_zilog.c +++ b/drivers/staging/media/lirc/lirc_zilog.c @@ -61,9 +61,6 @@ #include <media/lirc_dev.h> #include <media/lirc.h> -/* Max transfer size done by I2C transfer functions */ -#define MAX_XFER_SIZE 64 - struct IR; struct IR_rx { @@ -944,14 +941,7 @@ static ssize_t read(struct file *filep, char *outbuf, size_t n, loff_t *ppos) schedule(); set_current_state(TASK_INTERRUPTIBLE); } else { - unsigned char buf[MAX_XFER_SIZE]; - - if (rbuf->chunk_size > sizeof(buf)) { - zilog_error("chunk_size is too big (%d)!\n", - rbuf->chunk_size); - ret = -EINVAL; - break; - } + unsigned char buf[rbuf->chunk_size]; m = lirc_buffer_read(rbuf, buf); if (m == rbuf->chunk_size) { ret = copy_to_user((void *)outbuf+written, buf, diff --git a/drivers/staging/media/msi3101/Kconfig b/drivers/staging/media/msi3101/Kconfig index 0c349c8..76d5bbd 100644 --- a/drivers/staging/media/msi3101/Kconfig +++ b/drivers/staging/media/msi3101/Kconfig @@ -1,5 +1,4 @@ config USB_MSI3101 tristate "Mirics MSi3101 SDR Dongle" depends on USB && VIDEO_DEV && VIDEO_V4L2 - select VIDEOBUF2_CORE - select VIDEOBUF2_VMALLOC + select VIDEOBUF2_VMALLOC diff --git a/drivers/staging/media/solo6x10/solo6x10-disp.c b/drivers/staging/media/solo6x10/solo6x10-disp.c index 145295a..32d9953 100644 --- a/drivers/staging/media/solo6x10/solo6x10-disp.c +++ b/drivers/staging/media/solo6x10/solo6x10-disp.c @@ -176,27 +176,18 @@ static void solo_vout_config(struct solo_dev *solo_dev) static int solo_dma_vin_region(struct solo_dev *solo_dev, u32 off, u16 val, int reg_size) { - u16 *buf; - const int n = 64, size = n * sizeof(*buf); - int i, ret = 0; - - buf = kmalloc(size, GFP_KERNEL); - if (!buf) - return -ENOMEM; + u16 buf[64]; + int i; + int ret = 0; - for (i = 0; i < n; i++) + for (i = 0; i < sizeof(buf) >> 1; i++) buf[i] = cpu_to_le16(val); - for (i = 0; i < reg_size; i += size) { - ret = solo_p2m_dma(solo_dev, 1, buf, - SOLO_MOTION_EXT_ADDR(solo_dev) + off + i, - size, 0, 0); - - if (ret) - break; - } + for (i = 0; i < reg_size; i += sizeof(buf)) + ret |= solo_p2m_dma(solo_dev, 1, buf, + SOLO_MOTION_EXT_ADDR(solo_dev) + off + i, + sizeof(buf), 0, 0); - kfree(buf); return ret; } diff --git a/drivers/staging/media/solo6x10/solo6x10-p2m.c b/drivers/staging/media/solo6x10/solo6x10-p2m.c index 7f2f247..3335941 100644 --- a/drivers/staging/media/solo6x10/solo6x10-p2m.c +++ b/drivers/staging/media/solo6x10/solo6x10-p2m.c @@ -87,7 +87,7 @@ int solo_p2m_dma_desc(struct solo_dev *solo_dev, if (mutex_lock_interruptible(&p2m_dev->mutex)) return -EINTR; - reinit_completion(&p2m_dev->completion); + INIT_COMPLETION(p2m_dev->completion); p2m_dev->error = 0; if (desc_cnt > 1 && solo_dev->type != SOLO_DEV_6110 && desc_mode) { diff --git a/drivers/staging/media/solo6x10/solo6x10-v4l2-enc.c b/drivers/staging/media/solo6x10/solo6x10-v4l2-enc.c index d582c5b..a4c5896 100644 --- a/drivers/staging/media/solo6x10/solo6x10-v4l2-enc.c +++ b/drivers/staging/media/solo6x10/solo6x10-v4l2-enc.c @@ -95,11 +95,38 @@ static unsigned char vop_6110_pal_cif[] = { 0x01, 0x68, 0xce, 0x32, 0x28, 0x00, 0x00, 0x00, }; -typedef __le32 vop_header[16]; +struct vop_header { + /* VE_STATUS0 */ + u32 mpeg_size:20, sad_motion_flag:1, video_motion_flag:1, vop_type:2, + channel:5, source_fl:1, interlace:1, progressive:1; + + /* VE_STATUS1 */ + u32 vsize:8, hsize:8, last_queue:4, nop0:8, scale:4; + + /* VE_STATUS2 */ + u32 mpeg_off; + + /* VE_STATUS3 */ + u32 jpeg_off; + + /* VE_STATUS4 */ + u32 jpeg_size:20, interval:10, nop1:2; + + /* VE_STATUS5/6 */ + u32 sec, usec; + + /* VE_STATUS7/8/9 */ + u32 nop2[3]; + + /* VE_STATUS10 */ + u32 mpeg_size_alt:20, nop3:12; + + u32 end_nops[5]; +} __packed; struct solo_enc_buf { enum solo_enc_types type; - const vop_header *vh; + struct vop_header *vh; int motion; }; @@ -319,7 +346,7 @@ static int enc_get_mpeg_dma(struct solo_dev *solo_dev, dma_addr_t dma, /* Build a descriptor queue out of an SG list and send it to the P2M for * processing. */ static int solo_send_desc(struct solo_enc_dev *solo_enc, int skip, - struct sg_table *vbuf, int off, int size, + struct vb2_dma_sg_desc *vbuf, int off, int size, unsigned int base, unsigned int base_size) { struct solo_dev *solo_dev = solo_enc->solo_dev; @@ -332,7 +359,7 @@ static int solo_send_desc(struct solo_enc_dev *solo_enc, int skip, solo_enc->desc_count = 1; - for_each_sg(vbuf->sgl, sg, vbuf->nents, i) { + for_each_sg(vbuf->sglist, sg, vbuf->num_pages, i) { struct solo_p2m_desc *desc; dma_addr_t dma; int len; @@ -403,145 +430,84 @@ static int solo_send_desc(struct solo_enc_dev *solo_enc, int skip, solo_enc->desc_count - 1); } -/* Extract values from VOP header - VE_STATUSxx */ -static inline int vop_interlaced(const vop_header *vh) -{ - return (__le32_to_cpu((*vh)[0]) >> 30) & 1; -} - -static inline u8 vop_channel(const vop_header *vh) -{ - return (__le32_to_cpu((*vh)[0]) >> 24) & 0x1F; -} - -static inline u8 vop_type(const vop_header *vh) -{ - return (__le32_to_cpu((*vh)[0]) >> 22) & 3; -} - -static inline u32 vop_mpeg_size(const vop_header *vh) -{ - return __le32_to_cpu((*vh)[0]) & 0xFFFFF; -} - -static inline u8 vop_hsize(const vop_header *vh) -{ - return (__le32_to_cpu((*vh)[1]) >> 8) & 0xFF; -} - -static inline u8 vop_vsize(const vop_header *vh) -{ - return __le32_to_cpu((*vh)[1]) & 0xFF; -} - -static inline u32 vop_mpeg_offset(const vop_header *vh) -{ - return __le32_to_cpu((*vh)[2]); -} - -static inline u32 vop_jpeg_offset(const vop_header *vh) -{ - return __le32_to_cpu((*vh)[3]); -} - -static inline u32 vop_jpeg_size(const vop_header *vh) -{ - return __le32_to_cpu((*vh)[4]) & 0xFFFFF; -} - -static inline u32 vop_sec(const vop_header *vh) -{ - return __le32_to_cpu((*vh)[5]); -} - -static inline u32 vop_usec(const vop_header *vh) -{ - return __le32_to_cpu((*vh)[6]); -} - static int solo_fill_jpeg(struct solo_enc_dev *solo_enc, - struct vb2_buffer *vb, const vop_header *vh) + struct vb2_buffer *vb, struct vop_header *vh) { struct solo_dev *solo_dev = solo_enc->solo_dev; - struct sg_table *vbuf = vb2_dma_sg_plane_desc(vb, 0); + struct vb2_dma_sg_desc *vbuf = vb2_dma_sg_plane_desc(vb, 0); int frame_size; int ret; vb->v4l2_buf.flags |= V4L2_BUF_FLAG_KEYFRAME; - if (vb2_plane_size(vb, 0) < vop_jpeg_size(vh) + solo_enc->jpeg_len) + if (vb2_plane_size(vb, 0) < vh->jpeg_size + solo_enc->jpeg_len) return -EIO; - frame_size = (vop_jpeg_size(vh) + solo_enc->jpeg_len + (DMA_ALIGN - 1)) + sg_copy_from_buffer(vbuf->sglist, vbuf->num_pages, + solo_enc->jpeg_header, + solo_enc->jpeg_len); + + frame_size = (vh->jpeg_size + solo_enc->jpeg_len + (DMA_ALIGN - 1)) & ~(DMA_ALIGN - 1); - vb2_set_plane_payload(vb, 0, vop_jpeg_size(vh) + solo_enc->jpeg_len); + vb2_set_plane_payload(vb, 0, vh->jpeg_size + solo_enc->jpeg_len); - /* may discard all previous data in vbuf->sgl */ - dma_map_sg(&solo_dev->pdev->dev, vbuf->sgl, vbuf->nents, + dma_map_sg(&solo_dev->pdev->dev, vbuf->sglist, vbuf->num_pages, DMA_FROM_DEVICE); - ret = solo_send_desc(solo_enc, solo_enc->jpeg_len, vbuf, - vop_jpeg_offset(vh) - SOLO_JPEG_EXT_ADDR(solo_dev), - frame_size, SOLO_JPEG_EXT_ADDR(solo_dev), - SOLO_JPEG_EXT_SIZE(solo_dev)); - dma_unmap_sg(&solo_dev->pdev->dev, vbuf->sgl, vbuf->nents, + ret = solo_send_desc(solo_enc, solo_enc->jpeg_len, vbuf, vh->jpeg_off, + frame_size, SOLO_JPEG_EXT_ADDR(solo_dev), + SOLO_JPEG_EXT_SIZE(solo_dev)); + dma_unmap_sg(&solo_dev->pdev->dev, vbuf->sglist, vbuf->num_pages, DMA_FROM_DEVICE); - - /* add the header only after dma_unmap_sg() */ - sg_copy_from_buffer(vbuf->sgl, vbuf->nents, - solo_enc->jpeg_header, solo_enc->jpeg_len); - return ret; } static int solo_fill_mpeg(struct solo_enc_dev *solo_enc, - struct vb2_buffer *vb, const vop_header *vh) + struct vb2_buffer *vb, struct vop_header *vh) { struct solo_dev *solo_dev = solo_enc->solo_dev; - struct sg_table *vbuf = vb2_dma_sg_plane_desc(vb, 0); + struct vb2_dma_sg_desc *vbuf = vb2_dma_sg_plane_desc(vb, 0); int frame_off, frame_size; int skip = 0; int ret; - if (vb2_plane_size(vb, 0) < vop_mpeg_size(vh)) + if (vb2_plane_size(vb, 0) < vh->mpeg_size) return -EIO; /* If this is a key frame, add extra header */ - vb->v4l2_buf.flags &= ~(V4L2_BUF_FLAG_KEYFRAME | V4L2_BUF_FLAG_PFRAME | V4L2_BUF_FLAG_BFRAME); - if (!vop_type(vh)) { + if (!vh->vop_type) { + sg_copy_from_buffer(vbuf->sglist, vbuf->num_pages, + solo_enc->vop, + solo_enc->vop_len); + skip = solo_enc->vop_len; + vb->v4l2_buf.flags |= V4L2_BUF_FLAG_KEYFRAME; - vb2_set_plane_payload(vb, 0, vop_mpeg_size(vh) + solo_enc->vop_len); + vb2_set_plane_payload(vb, 0, vh->mpeg_size + solo_enc->vop_len); } else { vb->v4l2_buf.flags |= V4L2_BUF_FLAG_PFRAME; - vb2_set_plane_payload(vb, 0, vop_mpeg_size(vh)); + vb2_set_plane_payload(vb, 0, vh->mpeg_size); } /* Now get the actual mpeg payload */ - frame_off = (vop_mpeg_offset(vh) - SOLO_MP4E_EXT_ADDR(solo_dev) + sizeof(*vh)) + frame_off = (vh->mpeg_off + sizeof(*vh)) % SOLO_MP4E_EXT_SIZE(solo_dev); - frame_size = (vop_mpeg_size(vh) + skip + (DMA_ALIGN - 1)) + frame_size = (vh->mpeg_size + skip + (DMA_ALIGN - 1)) & ~(DMA_ALIGN - 1); - /* may discard all previous data in vbuf->sgl */ - dma_map_sg(&solo_dev->pdev->dev, vbuf->sgl, vbuf->nents, + dma_map_sg(&solo_dev->pdev->dev, vbuf->sglist, vbuf->num_pages, DMA_FROM_DEVICE); ret = solo_send_desc(solo_enc, skip, vbuf, frame_off, frame_size, SOLO_MP4E_EXT_ADDR(solo_dev), SOLO_MP4E_EXT_SIZE(solo_dev)); - dma_unmap_sg(&solo_dev->pdev->dev, vbuf->sgl, vbuf->nents, + dma_unmap_sg(&solo_dev->pdev->dev, vbuf->sglist, vbuf->num_pages, DMA_FROM_DEVICE); - - /* add the header only after dma_unmap_sg() */ - if (!vop_type(vh)) - sg_copy_from_buffer(vbuf->sgl, vbuf->nents, - solo_enc->vop, solo_enc->vop_len); return ret; } static int solo_enc_fillbuf(struct solo_enc_dev *solo_enc, struct vb2_buffer *vb, struct solo_enc_buf *enc_buf) { - const vop_header *vh = enc_buf->vh; + struct vop_header *vh = enc_buf->vh; int ret; /* Check for motion flags */ @@ -565,8 +531,8 @@ static int solo_enc_fillbuf(struct solo_enc_dev *solo_enc, if (!ret) { vb->v4l2_buf.sequence = solo_enc->sequence++; - vb->v4l2_buf.timestamp.tv_sec = vop_sec(vh); - vb->v4l2_buf.timestamp.tv_usec = vop_usec(vh); + vb->v4l2_buf.timestamp.tv_sec = vh->sec; + vb->v4l2_buf.timestamp.tv_usec = vh->usec; } vb2_buffer_done(vb, ret ? VB2_BUF_STATE_ERROR : VB2_BUF_STATE_DONE); @@ -639,13 +605,15 @@ static void solo_handle_ring(struct solo_dev *solo_dev) /* FAIL... */ if (enc_get_mpeg_dma(solo_dev, solo_dev->vh_dma, off, - sizeof(vop_header))) + sizeof(struct vop_header))) continue; - enc_buf.vh = solo_dev->vh_buf; + enc_buf.vh = (struct vop_header *)solo_dev->vh_buf; + enc_buf.vh->mpeg_off -= SOLO_MP4E_EXT_ADDR(solo_dev); + enc_buf.vh->jpeg_off -= SOLO_JPEG_EXT_ADDR(solo_dev); /* Sanity check */ - if (vop_mpeg_offset(enc_buf.vh) != SOLO_MP4E_EXT_ADDR(solo_dev) + off) + if (enc_buf.vh->mpeg_off != off) continue; if (solo_motion_detected(solo_enc)) @@ -1361,7 +1329,7 @@ int solo_enc_v4l2_init(struct solo_dev *solo_dev, unsigned nr) init_waitqueue_head(&solo_dev->ring_thread_wait); - solo_dev->vh_size = sizeof(vop_header); + solo_dev->vh_size = sizeof(struct vop_header); solo_dev->vh_buf = pci_alloc_consistent(solo_dev->pdev, solo_dev->vh_size, &solo_dev->vh_dma); diff --git a/drivers/staging/media/solo6x10/solo6x10.h b/drivers/staging/media/solo6x10/solo6x10.h index f1bbb8c..6f91d2e 100644 --- a/drivers/staging/media/solo6x10/solo6x10.h +++ b/drivers/staging/media/solo6x10/solo6x10.h @@ -94,6 +94,7 @@ #define SOLO_ENC_MODE_HD1 1 #define SOLO_ENC_MODE_D1 9 +#define SOLO_DEFAULT_GOP 30 #define SOLO_DEFAULT_QP 3 #ifndef V4L2_BUF_FLAG_MOTION_ON |