diff options
Diffstat (limited to 'drivers/staging')
37 files changed, 463 insertions, 475 deletions
diff --git a/drivers/staging/media/as102/as102_usb_drv.c b/drivers/staging/media/as102/as102_usb_drv.c index e4a69454ebeb..e6f6278e97d6 100644 --- a/drivers/staging/media/as102/as102_usb_drv.c +++ b/drivers/staging/media/as102/as102_usb_drv.c @@ -249,7 +249,7 @@ static void as102_free_usb_stream_buffer(struct as102_dev_t *dev) static int as102_alloc_usb_stream_buffer(struct as102_dev_t *dev) { - int i, ret = 0; + int i; dev->stream = usb_alloc_coherent(dev->bus_adap.usb_dev, MAX_STREAM_URB * AS102_USB_BUF_SIZE, @@ -280,7 +280,7 @@ static int as102_alloc_usb_stream_buffer(struct as102_dev_t *dev) dev->stream_urb[i] = urb; } - return ret; + return 0; } static void as102_usb_stop_stream(struct as102_dev_t *dev) @@ -458,7 +458,6 @@ exit: static int as102_release(struct inode *inode, struct file *file) { - int ret = 0; struct as102_dev_t *dev = NULL; dev = file->private_data; @@ -467,7 +466,7 @@ static int as102_release(struct inode *inode, struct file *file) kref_put(&dev->kref, as102_usb_release); } - return ret; + return 0; } MODULE_DEVICE_TABLE(usb, as102_usb_id_table); diff --git a/drivers/staging/media/davinci_vpfe/vpfe_mc_capture.h b/drivers/staging/media/davinci_vpfe/vpfe_mc_capture.h index 68f6fe43a5b5..2632a806c4a8 100644 --- a/drivers/staging/media/davinci_vpfe/vpfe_mc_capture.h +++ b/drivers/staging/media/davinci_vpfe/vpfe_mc_capture.h @@ -87,8 +87,6 @@ struct vpfe_fh { struct vpfe_video_device *video; /* Indicates whether this file handle is doing IO */ u8 io_allowed; - /* Used to keep track priority of this instance */ - enum v4l2_priority prio; }; void mbus_to_pix(const struct v4l2_mbus_framefmt *mbus, diff --git a/drivers/staging/media/davinci_vpfe/vpfe_video.c b/drivers/staging/media/davinci_vpfe/vpfe_video.c index acc8184c46cd..d95c427043d4 100644 --- a/drivers/staging/media/davinci_vpfe/vpfe_video.c +++ b/drivers/staging/media/davinci_vpfe/vpfe_video.c @@ -415,7 +415,6 @@ static int vpfe_open(struct file *file) video->usrs++; /* Set io_allowed member to false */ handle->io_allowed = 0; - v4l2_prio_open(&video->prio, &handle->prio); handle->video = video; file->private_data = &handle->vfh; mutex_unlock(&video->lock); @@ -532,8 +531,8 @@ static int vpfe_release(struct file *file) } /* Decrement device users counter */ video->usrs--; - /* Close the priority */ - v4l2_prio_close(&video->prio, fh->prio); + v4l2_fh_del(&fh->vfh); + v4l2_fh_exit(&fh->vfh); /* If this is the last file handle */ if (!video->usrs) video->initialized = 0; @@ -945,7 +944,7 @@ static int vpfe_s_std(struct file *file, void *priv, v4l2_std_id std_id) goto unlock_out; } ret = v4l2_device_call_until_err(&vpfe_dev->v4l2_dev, sdinfo->grp_id, - core, s_std, std_id); + video, s_std, std_id); if (ret < 0) { v4l2_err(&vpfe_dev->v4l2_dev, "Failed to set standard\n"); video->stdid = V4L2_STD_UNKNOWN; @@ -987,8 +986,10 @@ vpfe_enum_dv_timings(struct file *file, void *fh, struct vpfe_device *vpfe_dev = video->vpfe_dev; struct v4l2_subdev *subdev = video->current_ext_subdev->subdev; + timings->pad = 0; + v4l2_dbg(1, debug, &vpfe_dev->v4l2_dev, "vpfe_enum_dv_timings\n"); - return v4l2_subdev_call(subdev, video, enum_dv_timings, timings); + return v4l2_subdev_call(subdev, pad, enum_dv_timings, timings); } /* @@ -1219,8 +1220,16 @@ static int vpfe_start_streaming(struct vb2_queue *vq, unsigned int count) video->state = VPFE_VIDEO_BUFFER_QUEUED; ret = vpfe_start_capture(video); - if (ret) + if (ret) { + struct vpfe_cap_buffer *buf, *tmp; + + vb2_buffer_done(&video->cur_frm->vb, VB2_BUF_STATE_QUEUED); + list_for_each_entry_safe(buf, tmp, &video->dma_queue, list) { + list_del(&buf->list); + vb2_buffer_done(&buf->vb, VB2_BUF_STATE_QUEUED); + } goto unlock_out; + } mutex_unlock(&video->lock); @@ -1242,7 +1251,7 @@ static int vpfe_buffer_init(struct vb2_buffer *vb) } /* abort streaming and wait for last buffer */ -static int vpfe_stop_streaming(struct vb2_queue *vq) +static void vpfe_stop_streaming(struct vb2_queue *vq) { struct vpfe_fh *fh = vb2_get_drv_priv(vq); struct vpfe_video_device *video = fh->video; @@ -1265,7 +1274,6 @@ static int vpfe_stop_streaming(struct vb2_queue *vq) list_del(&video->next_frm->list); vb2_buffer_done(&video->next_frm->vb, VB2_BUF_STATE_ERROR); } - return 0; } static void vpfe_buf_cleanup(struct vb2_buffer *vb) @@ -1590,8 +1598,6 @@ int vpfe_video_init(struct vpfe_video_device *video, const char *name) snprintf(video->video_dev.name, sizeof(video->video_dev.name), "DAVINCI VIDEO %s %s", name, direction); - /* Initialize prio member of device object */ - v4l2_prio_init(&video->prio); spin_lock_init(&video->irqlock); spin_lock_init(&video->dma_queue_lock); mutex_init(&video->lock); @@ -1600,6 +1606,7 @@ int vpfe_video_init(struct vpfe_video_device *video, const char *name) if (ret < 0) return ret; + set_bit(V4L2_FL_USE_FH_PRIO, &video->video_dev.flags); video_set_drvdata(&video->video_dev, video); return 0; diff --git a/drivers/staging/media/davinci_vpfe/vpfe_video.h b/drivers/staging/media/davinci_vpfe/vpfe_video.h index ca9a70245233..1b1b6c4a56b7 100644 --- a/drivers/staging/media/davinci_vpfe/vpfe_video.h +++ b/drivers/staging/media/davinci_vpfe/vpfe_video.h @@ -102,8 +102,6 @@ struct vpfe_video_device { * user has selected */ enum v4l2_memory memory; - /* Used to keep track of state of the priority */ - struct v4l2_prio_state prio; /* number of open instances of the channel */ u32 usrs; /* flag to indicate whether decoder is initialized */ diff --git a/drivers/staging/media/dt3155v4l/dt3155v4l.c b/drivers/staging/media/dt3155v4l/dt3155v4l.c index afbc2e519606..40580228a6c7 100644 --- a/drivers/staging/media/dt3155v4l/dt3155v4l.c +++ b/drivers/staging/media/dt3155v4l/dt3155v4l.c @@ -262,7 +262,7 @@ dt3155_buf_prepare(struct vb2_buffer *vb) return 0; } -static int +static void dt3155_stop_streaming(struct vb2_queue *q) { struct dt3155_priv *pd = vb2_get_drv_priv(q); @@ -276,7 +276,6 @@ dt3155_stop_streaming(struct vb2_queue *q) } spin_unlock_irq(&pd->lock); msleep(45); /* irq hendler will stop the hardware */ - return 0; } static void @@ -907,8 +906,10 @@ dt3155_probe(struct pci_dev *pdev, const struct pci_device_id *id) if (!pd) return -ENOMEM; pd->vdev = video_device_alloc(); - if (!pd->vdev) + if (!pd->vdev) { + err = -ENOMEM; goto err_video_device_alloc; + } *pd->vdev = dt3155_vdev; pci_set_drvdata(pdev, pd); /* for use in dt3155_remove() */ video_set_drvdata(pd->vdev, pd); /* for use in video_fops */ diff --git a/drivers/staging/media/go7007/go7007-v4l2.c b/drivers/staging/media/go7007/go7007-v4l2.c index b397aa3c0f44..da7b5493e13e 100644 --- a/drivers/staging/media/go7007/go7007-v4l2.c +++ b/drivers/staging/media/go7007/go7007-v4l2.c @@ -516,7 +516,7 @@ static int go7007_start_streaming(struct vb2_queue *q, unsigned int count) return ret; } -static int go7007_stop_streaming(struct vb2_queue *q) +static void go7007_stop_streaming(struct vb2_queue *q) { struct go7007 *go = vb2_get_drv_priv(q); unsigned long flags; @@ -538,7 +538,6 @@ static int go7007_stop_streaming(struct vb2_queue *q) /* Turn on Capture LED */ if (go->board_id == GO7007_BOARDID_ADS_USBAV_709) go7007_write_addr(go, 0x3c82, 0x000d); - return 0; } static struct vb2_ops go7007_video_qops = { @@ -666,7 +665,7 @@ static int go7007_s_std(struct go7007 *go) go->sensor_framerate = 30000; } - call_all(&go->v4l2_dev, core, s_std, go->std); + call_all(&go->v4l2_dev, video, s_std, go->std); set_capture_size(go, NULL, 0); return 0; } diff --git a/drivers/staging/media/go7007/s2250-board.c b/drivers/staging/media/go7007/s2250-board.c index 696a80756691..eaa2b0990a1b 100644 --- a/drivers/staging/media/go7007/s2250-board.c +++ b/drivers/staging/media/go7007/s2250-board.c @@ -474,7 +474,6 @@ static const struct v4l2_ctrl_ops s2250_ctrl_ops = { static const struct v4l2_subdev_core_ops s2250_core_ops = { .log_status = s2250_log_status, - .s_std = s2250_s_std, }; static const struct v4l2_subdev_audio_ops s2250_audio_ops = { @@ -482,6 +481,7 @@ static const struct v4l2_subdev_audio_ops s2250_audio_ops = { }; static const struct v4l2_subdev_video_ops s2250_video_ops = { + .s_std = s2250_s_std, .s_routing = s2250_s_video_routing, .s_mbus_fmt = s2250_s_mbus_fmt, }; diff --git a/drivers/staging/media/go7007/saa7134-go7007.c b/drivers/staging/media/go7007/saa7134-go7007.c index 6e2ca338cdd9..e40f7fbfc0a5 100644 --- a/drivers/staging/media/go7007/saa7134-go7007.c +++ b/drivers/staging/media/go7007/saa7134-go7007.c @@ -434,11 +434,15 @@ static const struct v4l2_subdev_core_ops saa7134_go7007_core_ops = { .g_ctrl = saa7134_go7007_g_ctrl, .s_ctrl = saa7134_go7007_s_ctrl, .queryctrl = saa7134_go7007_queryctrl, +}; + +static const struct v4l2_subdev_video_ops saa7134_go7007_video_ops = { .s_std = saa7134_go7007_s_std, }; static const struct v4l2_subdev_ops saa7134_go7007_sd_ops = { .core = &saa7134_go7007_core_ops, + .video = &saa7134_go7007_video_ops, }; /* --------------------------------------------------------------------------*/ diff --git a/drivers/staging/media/msi3101/sdr-msi3101.c b/drivers/staging/media/msi3101/sdr-msi3101.c index 65d351f99da2..08d0d096b881 100644 --- a/drivers/staging/media/msi3101/sdr-msi3101.c +++ b/drivers/staging/media/msi3101/sdr-msi3101.c @@ -1074,14 +1074,13 @@ static int msi3101_start_streaming(struct vb2_queue *vq, unsigned int count) return ret; } -static int msi3101_stop_streaming(struct vb2_queue *vq) +static void msi3101_stop_streaming(struct vb2_queue *vq) { struct msi3101_state *s = vb2_get_drv_priv(vq); - int ret; + dev_dbg(&s->udev->dev, "%s:\n", __func__); - if (mutex_lock_interruptible(&s->v4l2_lock)) - return -ERESTARTSYS; + mutex_lock(&s->v4l2_lock); if (s->udev) msi3101_isoc_cleanup(s); @@ -1090,22 +1089,15 @@ static int msi3101_stop_streaming(struct vb2_queue *vq) /* according to tests, at least 700us delay is required */ msleep(20); - ret = msi3101_ctrl_msg(s, CMD_STOP_STREAMING, 0); - if (ret) - goto err_sleep_tuner; - - /* sleep USB IF / ADC */ - ret = msi3101_ctrl_msg(s, CMD_WREG, 0x01000003); - if (ret) - goto err_sleep_tuner; + if (!msi3101_ctrl_msg(s, CMD_STOP_STREAMING, 0)) { + /* sleep USB IF / ADC */ + msi3101_ctrl_msg(s, CMD_WREG, 0x01000003); + } -err_sleep_tuner: /* sleep tuner */ - ret = v4l2_subdev_call(s->v4l2_subdev, core, s_power, 0); + v4l2_subdev_call(s->v4l2_subdev, core, s_power, 0); mutex_unlock(&s->v4l2_lock); - - return ret; } static struct vb2_ops msi3101_vb2_ops = { diff --git a/drivers/staging/media/omap24xx/tcm825x.c b/drivers/staging/media/omap24xx/tcm825x.c index f4dd32df2353..3367ccd1d1e8 100644 --- a/drivers/staging/media/omap24xx/tcm825x.c +++ b/drivers/staging/media/omap24xx/tcm825x.c @@ -89,10 +89,10 @@ static const struct tcm825x_reg rgb565 = { 0x02, TCM825X_PICFMT }; /* Our own specific controls */ #define V4L2_CID_ALC V4L2_CID_PRIVATE_BASE -#define V4L2_CID_H_EDGE_EN V4L2_CID_PRIVATE_BASE + 1 -#define V4L2_CID_V_EDGE_EN V4L2_CID_PRIVATE_BASE + 2 -#define V4L2_CID_LENS V4L2_CID_PRIVATE_BASE + 3 -#define V4L2_CID_MAX_EXPOSURE_TIME V4L2_CID_PRIVATE_BASE + 4 +#define V4L2_CID_H_EDGE_EN (V4L2_CID_PRIVATE_BASE + 1) +#define V4L2_CID_V_EDGE_EN (V4L2_CID_PRIVATE_BASE + 2) +#define V4L2_CID_LENS (V4L2_CID_PRIVATE_BASE + 3) +#define V4L2_CID_MAX_EXPOSURE_TIME (V4L2_CID_PRIVATE_BASE + 4) #define V4L2_CID_LAST_PRIV V4L2_CID_MAX_EXPOSURE_TIME /* Video controls */ @@ -914,8 +914,8 @@ static int __init tcm825x_init(void) rval = i2c_add_driver(&tcm825x_i2c_driver); if (rval) - printk(KERN_INFO "%s: failed registering " TCM825X_NAME "\n", - __func__); + pr_info("%s: failed registering " TCM825X_NAME "\n", + __func__); return rval; } diff --git a/drivers/staging/media/omap24xx/tcm825x.h b/drivers/staging/media/omap24xx/tcm825x.h index 9970fb1c596a..8a29636d1ad4 100644 --- a/drivers/staging/media/omap24xx/tcm825x.h +++ b/drivers/staging/media/omap24xx/tcm825x.h @@ -21,8 +21,8 @@ #define TCM825X_NAME "tcm825x" -#define TCM825X_MASK(x) x & 0x00ff -#define TCM825X_ADDR(x) (x & 0xff00) >> 8 +#define TCM825X_MASK(x) (x & 0x00ff) +#define TCM825X_ADDR(x) ((x & 0xff00) >> 8) /* The TCM825X I2C sensor chip has a fixed slave address of 0x3d. */ #define TCM825X_I2C_ADDR 0x3d diff --git a/drivers/staging/media/omap4iss/Kconfig b/drivers/staging/media/omap4iss/Kconfig index b9fe753969bd..78b0fba7047e 100644 --- a/drivers/staging/media/omap4iss/Kconfig +++ b/drivers/staging/media/omap4iss/Kconfig @@ -4,9 +4,3 @@ config VIDEO_OMAP4 select VIDEOBUF2_DMA_CONTIG ---help--- Driver for an OMAP 4 ISS controller. - -config VIDEO_OMAP4_DEBUG - bool "OMAP 4 Camera debug messages" - depends on VIDEO_OMAP4 - ---help--- - Enable debug messages on OMAP 4 ISS controller driver. diff --git a/drivers/staging/media/omap4iss/iss.c b/drivers/staging/media/omap4iss/iss.c index 61fbfcd13582..2e422dde074e 100644 --- a/drivers/staging/media/omap4iss/iss.c +++ b/drivers/staging/media/omap4iss/iss.c @@ -204,7 +204,7 @@ void omap4iss_configure_bridge(struct iss_device *iss, iss_reg_write(iss, OMAP4_ISS_MEM_ISP_SYS1, ISP5_CTRL, isp5ctrl_val); } -#if defined(DEBUG) && defined(ISS_ISR_DEBUG) +#ifdef ISS_ISR_DEBUG static void iss_isr_dbg(struct iss_device *iss, u32 irqstatus) { static const char * const name[] = { @@ -347,14 +347,14 @@ static irqreturn_t iss_isr(int irq, void *_iss) omap4iss_resizer_isr(&iss->resizer, isp_irqstatus & resizer_events); -#if defined(DEBUG) && defined(ISS_ISR_DEBUG) +#ifdef ISS_ISR_DEBUG iss_isp_isr_dbg(iss, isp_irqstatus); #endif } omap4iss_flush(iss); -#if defined(DEBUG) && defined(ISS_ISR_DEBUG) +#ifdef ISS_ISR_DEBUG iss_isr_dbg(iss, irqstatus); #endif @@ -734,18 +734,17 @@ static int iss_pipeline_is_last(struct media_entity *me) static int iss_reset(struct iss_device *iss) { - unsigned long timeout = 0; + unsigned int timeout; iss_reg_set(iss, OMAP4_ISS_MEM_TOP, ISS_HL_SYSCONFIG, ISS_HL_SYSCONFIG_SOFTRESET); - while (iss_reg_read(iss, OMAP4_ISS_MEM_TOP, ISS_HL_SYSCONFIG) & - ISS_HL_SYSCONFIG_SOFTRESET) { - if (timeout++ > 100) { - dev_alert(iss->dev, "cannot reset ISS\n"); - return -ETIMEDOUT; - } - usleep_range(10, 10); + timeout = iss_poll_condition_timeout( + !(iss_reg_read(iss, OMAP4_ISS_MEM_TOP, ISS_HL_SYSCONFIG) & + ISS_HL_SYSCONFIG_SOFTRESET), 1000, 10, 100); + if (timeout) { + dev_err(iss->dev, "ISS reset timeout\n"); + return -ETIMEDOUT; } iss->crashed = 0; @@ -754,7 +753,7 @@ static int iss_reset(struct iss_device *iss) static int iss_isp_reset(struct iss_device *iss) { - unsigned long timeout = 0; + unsigned int timeout; /* Fist, ensure that the ISP is IDLE (no transactions happening) */ iss_reg_update(iss, OMAP4_ISS_MEM_ISP_SYS1, ISP5_SYSCONFIG, @@ -763,29 +762,24 @@ static int iss_isp_reset(struct iss_device *iss) iss_reg_set(iss, OMAP4_ISS_MEM_ISP_SYS1, ISP5_CTRL, ISP5_CTRL_MSTANDBY); - for (;;) { - if (iss_reg_read(iss, OMAP4_ISS_MEM_ISP_SYS1, ISP5_CTRL) & - ISP5_CTRL_MSTANDBY_WAIT) - break; - if (timeout++ > 1000) { - dev_alert(iss->dev, "cannot set ISP5 to standby\n"); - return -ETIMEDOUT; - } - usleep_range(1000, 1500); + timeout = iss_poll_condition_timeout( + iss_reg_read(iss, OMAP4_ISS_MEM_ISP_SYS1, ISP5_CTRL) & + ISP5_CTRL_MSTANDBY_WAIT, 1000000, 1000, 1500); + if (timeout) { + dev_err(iss->dev, "ISP5 standby timeout\n"); + return -ETIMEDOUT; } /* Now finally, do the reset */ iss_reg_set(iss, OMAP4_ISS_MEM_ISP_SYS1, ISP5_SYSCONFIG, ISP5_SYSCONFIG_SOFTRESET); - timeout = 0; - while (iss_reg_read(iss, OMAP4_ISS_MEM_ISP_SYS1, ISP5_SYSCONFIG) & - ISP5_SYSCONFIG_SOFTRESET) { - if (timeout++ > 1000) { - dev_alert(iss->dev, "cannot reset ISP5\n"); - return -ETIMEDOUT; - } - usleep_range(1000, 1500); + timeout = iss_poll_condition_timeout( + !(iss_reg_read(iss, OMAP4_ISS_MEM_ISP_SYS1, ISP5_SYSCONFIG) & + ISP5_SYSCONFIG_SOFTRESET), 1000000, 1000, 1500); + if (timeout) { + dev_err(iss->dev, "ISP5 reset timeout\n"); + return -ETIMEDOUT; } return 0; diff --git a/drivers/staging/media/omap4iss/iss.h b/drivers/staging/media/omap4iss/iss.h index 346db9233171..05cd9bf3b41f 100644 --- a/drivers/staging/media/omap4iss/iss.h +++ b/drivers/staging/media/omap4iss/iss.h @@ -233,4 +233,18 @@ void iss_reg_update(struct iss_device *iss, enum iss_mem_resources res, iss_reg_write(iss, res, offset, (v & ~clr) | set); } +#define iss_poll_condition_timeout(cond, timeout, min_ival, max_ival) \ +({ \ + unsigned long __timeout = jiffies + usecs_to_jiffies(timeout); \ + unsigned int __min_ival = (min_ival); \ + unsigned int __max_ival = (max_ival); \ + bool __cond; \ + while (!(__cond = (cond))) { \ + if (time_after(jiffies, __timeout)) \ + break; \ + usleep_range(__min_ival, __max_ival); \ + } \ + !__cond; \ +}) + #endif /* _OMAP4_ISS_H_ */ diff --git a/drivers/staging/media/omap4iss/iss_csi2.c b/drivers/staging/media/omap4iss/iss_csi2.c index 61fc350eb251..bf8a65726107 100644 --- a/drivers/staging/media/omap4iss/iss_csi2.c +++ b/drivers/staging/media/omap4iss/iss_csi2.c @@ -487,9 +487,7 @@ static void csi2_irq_status_set(struct iss_csi2_device *csi2, int enable) */ int omap4iss_csi2_reset(struct iss_csi2_device *csi2) { - u8 soft_reset_retries = 0; - u32 reg; - int i; + unsigned int timeout; if (!csi2->available) return -ENODEV; @@ -500,37 +498,22 @@ int omap4iss_csi2_reset(struct iss_csi2_device *csi2) iss_reg_set(csi2->iss, csi2->regs1, CSI2_SYSCONFIG, CSI2_SYSCONFIG_SOFT_RESET); - do { - reg = iss_reg_read(csi2->iss, csi2->regs1, CSI2_SYSSTATUS) - & CSI2_SYSSTATUS_RESET_DONE; - if (reg == CSI2_SYSSTATUS_RESET_DONE) - break; - soft_reset_retries++; - if (soft_reset_retries < 5) - usleep_range(100, 100); - } while (soft_reset_retries < 5); - - if (soft_reset_retries == 5) { - dev_err(csi2->iss->dev, - "CSI2: Soft reset try count exceeded!\n"); + timeout = iss_poll_condition_timeout( + iss_reg_read(csi2->iss, csi2->regs1, CSI2_SYSSTATUS) & + CSI2_SYSSTATUS_RESET_DONE, 500, 100, 200); + if (timeout) { + dev_err(csi2->iss->dev, "CSI2: Soft reset timeout!\n"); return -EBUSY; } iss_reg_set(csi2->iss, csi2->regs1, CSI2_COMPLEXIO_CFG, CSI2_COMPLEXIO_CFG_RESET_CTRL); - i = 100; - do { - reg = iss_reg_read(csi2->iss, csi2->phy->phy_regs, REGISTER1) - & REGISTER1_RESET_DONE_CTRLCLK; - if (reg == REGISTER1_RESET_DONE_CTRLCLK) - break; - usleep_range(100, 100); - } while (--i > 0); - - if (i == 0) { - dev_err(csi2->iss->dev, - "CSI2: Reset for CSI2_96M_FCLK domain Failed!\n"); + timeout = iss_poll_condition_timeout( + iss_reg_read(csi2->iss, csi2->phy->phy_regs, REGISTER1) & + REGISTER1_RESET_DONE_CTRLCLK, 10000, 100, 500); + if (timeout) { + dev_err(csi2->iss->dev, "CSI2: CSI2_96M_FCLK reset timeout!\n"); return -EBUSY; } diff --git a/drivers/staging/media/omap4iss/iss_video.h b/drivers/staging/media/omap4iss/iss_video.h index 878e4a3082e7..9dccdb154e1a 100644 --- a/drivers/staging/media/omap4iss/iss_video.h +++ b/drivers/staging/media/omap4iss/iss_video.h @@ -140,7 +140,7 @@ enum iss_video_dmaqueue_flags { * if there was no buffer previously queued. */ struct iss_video_operations { - int(*queue)(struct iss_video *video, struct iss_buffer *buffer); + int (*queue)(struct iss_video *video, struct iss_buffer *buffer); }; struct iss_video { diff --git a/drivers/staging/media/rtl2832u_sdr/rtl2832_sdr.c b/drivers/staging/media/rtl2832u_sdr/rtl2832_sdr.c index 104ee8af79af..093df6b6ae35 100644 --- a/drivers/staging/media/rtl2832u_sdr/rtl2832_sdr.c +++ b/drivers/staging/media/rtl2832u_sdr/rtl2832_sdr.c @@ -1032,13 +1032,12 @@ err: return ret; } -static int rtl2832_sdr_stop_streaming(struct vb2_queue *vq) +static void rtl2832_sdr_stop_streaming(struct vb2_queue *vq) { struct rtl2832_sdr_state *s = vb2_get_drv_priv(vq); dev_dbg(&s->udev->dev, "%s:\n", __func__); - if (mutex_lock_interruptible(&s->v4l2_lock)) - return -ERESTARTSYS; + mutex_lock(&s->v4l2_lock); rtl2832_sdr_kill_urbs(s); rtl2832_sdr_free_urbs(s); @@ -1053,8 +1052,6 @@ static int rtl2832_sdr_stop_streaming(struct vb2_queue *vq) s->d->props->power_ctrl(s->d, 0); mutex_unlock(&s->v4l2_lock); - - return 0; } static struct vb2_ops rtl2832_sdr_vb2_ops = { diff --git a/drivers/staging/media/sn9c102/sn9c102.h b/drivers/staging/media/sn9c102/sn9c102.h index 8a917f060503..37ca7225fcf7 100644 --- a/drivers/staging/media/sn9c102/sn9c102.h +++ b/drivers/staging/media/sn9c102/sn9c102.h @@ -53,7 +53,7 @@ enum sn9c102_frame_state { }; struct sn9c102_frame_t { - void* bufmem; + void *bufmem; struct v4l2_buffer buf; enum sn9c102_frame_state state; struct list_head frame; @@ -99,17 +99,17 @@ static DEFINE_MUTEX(sn9c102_sysfs_lock); static DECLARE_RWSEM(sn9c102_dev_lock); struct sn9c102_device { - struct video_device* v4ldev; + struct video_device *v4ldev; struct v4l2_device v4l2_dev; enum sn9c102_bridge bridge; struct sn9c102_sensor sensor; - struct usb_device* usbdev; - struct urb* urb[SN9C102_URBS]; - void* transfer_buffer[SN9C102_URBS]; - u8* control_buffer; + struct usb_device *usbdev; + struct urb *urb[SN9C102_URBS]; + void *transfer_buffer[SN9C102_URBS]; + u8 *control_buffer; struct sn9c102_frame_t *frame_current, frame[SN9C102_MAX_FRAMES]; struct list_head inqueue, outqueue; @@ -139,28 +139,28 @@ struct sn9c102_device { /*****************************************************************************/ struct sn9c102_device* -sn9c102_match_id(struct sn9c102_device* cam, const struct usb_device_id *id) +sn9c102_match_id(struct sn9c102_device *cam, const struct usb_device_id *id) { return usb_match_id(usb_ifnum_to_if(cam->usbdev, 0), id) ? cam : NULL; } void -sn9c102_attach_sensor(struct sn9c102_device* cam, - const struct sn9c102_sensor* sensor) +sn9c102_attach_sensor(struct sn9c102_device *cam, + const struct sn9c102_sensor *sensor) { memcpy(&cam->sensor, sensor, sizeof(struct sn9c102_sensor)); } enum sn9c102_bridge -sn9c102_get_bridge(struct sn9c102_device* cam) +sn9c102_get_bridge(struct sn9c102_device *cam) { return cam->bridge; } -struct sn9c102_sensor* sn9c102_get_sensor(struct sn9c102_device* cam) +struct sn9c102_sensor *sn9c102_get_sensor(struct sn9c102_device *cam) { return &cam->sensor; } @@ -198,9 +198,9 @@ do { \ } \ } while (0) #else -# define DBG(level, fmt, args...) do {;} while(0) -# define V4LDBG(level, name, cmd) do {;} while(0) -# define KDBG(level, fmt, args...) do {;} while(0) +# define DBG(level, fmt, args...) do { ; } while (0) +# define V4LDBG(level, name, cmd) do { ; } while (0) +# define KDBG(level, fmt, args...) do { ; } while (0) #endif #undef PDBG @@ -209,6 +209,6 @@ dev_info(&cam->usbdev->dev, "[%s:%s:%d] " fmt "\n", __FILE__, __func__, \ __LINE__ , ## args) #undef PDBGG -#define PDBGG(fmt, args...) do {;} while(0) /* placeholder */ +#define PDBGG(fmt, args...) do { ; } while (0) /* placeholder */ #endif /* _SN9C102_H_ */ diff --git a/drivers/staging/media/sn9c102/sn9c102_core.c b/drivers/staging/media/sn9c102/sn9c102_core.c index 71f594f5aa71..98b30579b0ac 100644 --- a/drivers/staging/media/sn9c102/sn9c102_core.c +++ b/drivers/staging/media/sn9c102/sn9c102_core.c @@ -139,15 +139,15 @@ static int (*sn9c102_sensor_table[])(struct sn9c102_device *) = { /*****************************************************************************/ static u32 -sn9c102_request_buffers(struct sn9c102_device* cam, u32 count, +sn9c102_request_buffers(struct sn9c102_device *cam, u32 count, enum sn9c102_io_method io) { - struct v4l2_pix_format* p = &(cam->sensor.pix_format); - struct v4l2_rect* r = &(cam->sensor.cropcap.bounds); + struct v4l2_pix_format *p = &(cam->sensor.pix_format); + struct v4l2_rect *r = &(cam->sensor.cropcap.bounds); size_t imagesize = cam->module_param.force_munmap || io == IO_READ ? (p->width * p->height * p->priv) / 8 : (r->width * r->height * p->priv) / 8; - void* buff = NULL; + void *buff = NULL; u32 i; if (count > SN9C102_MAX_FRAMES) @@ -180,7 +180,7 @@ sn9c102_request_buffers(struct sn9c102_device* cam, u32 count, } -static void sn9c102_release_buffers(struct sn9c102_device* cam) +static void sn9c102_release_buffers(struct sn9c102_device *cam) { if (cam->nbuffers) { vfree(cam->frame[0].bufmem); @@ -190,7 +190,7 @@ static void sn9c102_release_buffers(struct sn9c102_device* cam) } -static void sn9c102_empty_framequeues(struct sn9c102_device* cam) +static void sn9c102_empty_framequeues(struct sn9c102_device *cam) { u32 i; @@ -204,7 +204,7 @@ static void sn9c102_empty_framequeues(struct sn9c102_device* cam) } -static void sn9c102_requeue_outqueue(struct sn9c102_device* cam) +static void sn9c102_requeue_outqueue(struct sn9c102_device *cam) { struct sn9c102_frame_t *i; @@ -217,7 +217,7 @@ static void sn9c102_requeue_outqueue(struct sn9c102_device* cam) } -static void sn9c102_queue_unusedframes(struct sn9c102_device* cam) +static void sn9c102_queue_unusedframes(struct sn9c102_device *cam) { unsigned long lock_flags; u32 i; @@ -237,11 +237,11 @@ static void sn9c102_queue_unusedframes(struct sn9c102_device* cam) Write a sequence of count value/register pairs. Returns -1 after the first failed write, or 0 for no errors. */ -int sn9c102_write_regs(struct sn9c102_device* cam, const u8 valreg[][2], +int sn9c102_write_regs(struct sn9c102_device *cam, const u8 valreg[][2], int count) { - struct usb_device* udev = cam->usbdev; - u8* buff = cam->control_buffer; + struct usb_device *udev = cam->usbdev; + u8 *buff = cam->control_buffer; int i, res; for (i = 0; i < count; i++) { @@ -273,10 +273,10 @@ int sn9c102_write_regs(struct sn9c102_device* cam, const u8 valreg[][2], } -int sn9c102_write_reg(struct sn9c102_device* cam, u8 value, u16 index) +int sn9c102_write_reg(struct sn9c102_device *cam, u8 value, u16 index) { - struct usb_device* udev = cam->usbdev; - u8* buff = cam->control_buffer; + struct usb_device *udev = cam->usbdev; + u8 *buff = cam->control_buffer; int res; if (index >= ARRAY_SIZE(cam->reg)) @@ -299,10 +299,10 @@ int sn9c102_write_reg(struct sn9c102_device* cam, u8 value, u16 index) /* NOTE: with the SN9C10[123] reading some registers always returns 0 */ -int sn9c102_read_reg(struct sn9c102_device* cam, u16 index) +int sn9c102_read_reg(struct sn9c102_device *cam, u16 index) { - struct usb_device* udev = cam->usbdev; - u8* buff = cam->control_buffer; + struct usb_device *udev = cam->usbdev; + u8 *buff = cam->control_buffer; int res; res = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), 0x00, 0xc1, @@ -315,7 +315,7 @@ int sn9c102_read_reg(struct sn9c102_device* cam, u16 index) } -int sn9c102_pread_reg(struct sn9c102_device* cam, u16 index) +int sn9c102_pread_reg(struct sn9c102_device *cam, u16 index) { if (index >= ARRAY_SIZE(cam->reg)) return -1; @@ -325,8 +325,8 @@ int sn9c102_pread_reg(struct sn9c102_device* cam, u16 index) static int -sn9c102_i2c_wait(struct sn9c102_device* cam, - const struct sn9c102_sensor* sensor) +sn9c102_i2c_wait(struct sn9c102_device *cam, + const struct sn9c102_sensor *sensor) { int i, r; @@ -346,8 +346,8 @@ sn9c102_i2c_wait(struct sn9c102_device* cam, static int -sn9c102_i2c_detect_read_error(struct sn9c102_device* cam, - const struct sn9c102_sensor* sensor) +sn9c102_i2c_detect_read_error(struct sn9c102_device *cam, + const struct sn9c102_sensor *sensor) { int r , err = 0; @@ -368,22 +368,23 @@ sn9c102_i2c_detect_read_error(struct sn9c102_device* cam, static int -sn9c102_i2c_detect_write_error(struct sn9c102_device* cam, - const struct sn9c102_sensor* sensor) +sn9c102_i2c_detect_write_error(struct sn9c102_device *cam, + const struct sn9c102_sensor *sensor) { int r; + r = sn9c102_read_reg(cam, 0x08); return (r < 0 || (r >= 0 && (r & 0x08))) ? -EIO : 0; } int -sn9c102_i2c_try_raw_read(struct sn9c102_device* cam, - const struct sn9c102_sensor* sensor, u8 data0, +sn9c102_i2c_try_raw_read(struct sn9c102_device *cam, + const struct sn9c102_sensor *sensor, u8 data0, u8 data1, u8 n, u8 buffer[]) { - struct usb_device* udev = cam->usbdev; - u8* data = cam->control_buffer; + struct usb_device *udev = cam->usbdev; + u8 *data = cam->control_buffer; int i = 0, err = 0, res; /* Write cycle */ @@ -437,12 +438,12 @@ sn9c102_i2c_try_raw_read(struct sn9c102_device* cam, int -sn9c102_i2c_try_raw_write(struct sn9c102_device* cam, - const struct sn9c102_sensor* sensor, u8 n, u8 data0, +sn9c102_i2c_try_raw_write(struct sn9c102_device *cam, + const struct sn9c102_sensor *sensor, u8 n, u8 data0, u8 data1, u8 data2, u8 data3, u8 data4, u8 data5) { - struct usb_device* udev = cam->usbdev; - u8* data = cam->control_buffer; + struct usb_device *udev = cam->usbdev; + u8 *data = cam->control_buffer; int err = 0, res; /* Write cycle. It usually is address + value */ @@ -476,16 +477,16 @@ sn9c102_i2c_try_raw_write(struct sn9c102_device* cam, int -sn9c102_i2c_try_read(struct sn9c102_device* cam, - const struct sn9c102_sensor* sensor, u8 address) +sn9c102_i2c_try_read(struct sn9c102_device *cam, + const struct sn9c102_sensor *sensor, u8 address) { return sn9c102_i2c_try_raw_read(cam, sensor, sensor->i2c_slave_id, address, 1, NULL); } -static int sn9c102_i2c_try_write(struct sn9c102_device* cam, - const struct sn9c102_sensor* sensor, +static int sn9c102_i2c_try_write(struct sn9c102_device *cam, + const struct sn9c102_sensor *sensor, u8 address, u8 value) { return sn9c102_i2c_try_raw_write(cam, sensor, 3, @@ -494,20 +495,20 @@ static int sn9c102_i2c_try_write(struct sn9c102_device* cam, } -int sn9c102_i2c_read(struct sn9c102_device* cam, u8 address) +int sn9c102_i2c_read(struct sn9c102_device *cam, u8 address) { return sn9c102_i2c_try_read(cam, &cam->sensor, address); } -int sn9c102_i2c_write(struct sn9c102_device* cam, u8 address, u8 value) +int sn9c102_i2c_write(struct sn9c102_device *cam, u8 address, u8 value) { return sn9c102_i2c_try_write(cam, &cam->sensor, address, value); } /*****************************************************************************/ -static size_t sn9c102_sof_length(struct sn9c102_device* cam) +static size_t sn9c102_sof_length(struct sn9c102_device *cam) { switch (cam->bridge) { case BRIDGE_SN9C101: @@ -525,7 +526,7 @@ static size_t sn9c102_sof_length(struct sn9c102_device* cam) static void* -sn9c102_find_sof_header(struct sn9c102_device* cam, void* mem, size_t len) +sn9c102_find_sof_header(struct sn9c102_device *cam, void *mem, size_t len) { static const char marker[6] = {0xff, 0xff, 0x00, 0xc4, 0xc4, 0x96}; const char *m = mem; @@ -547,7 +548,7 @@ sn9c102_find_sof_header(struct sn9c102_device* cam, void* mem, size_t len) } /* Search for the SOF marker (fixed part) in the header */ - for (j = 0, b=cam->sof.bytesread; j+b < sizeof(marker); j++) { + for (j = 0, b = cam->sof.bytesread; j+b < sizeof(marker); j++) { if (unlikely(i+j == len)) return NULL; if (*(m+i+j) == marker[cam->sof.bytesread]) { @@ -570,7 +571,7 @@ sn9c102_find_sof_header(struct sn9c102_device* cam, void* mem, size_t len) static void* -sn9c102_find_eof_header(struct sn9c102_device* cam, void* mem, size_t len) +sn9c102_find_eof_header(struct sn9c102_device *cam, void *mem, size_t len) { static const u8 eof_header[4][4] = { {0x00, 0x00, 0x00, 0x00}, @@ -600,7 +601,7 @@ sn9c102_find_eof_header(struct sn9c102_device* cam, void* mem, size_t len) static void -sn9c102_write_jpegheader(struct sn9c102_device* cam, struct sn9c102_frame_t* f) +sn9c102_write_jpegheader(struct sn9c102_device *cam, struct sn9c102_frame_t *f) { static const u8 jpeg_header[589] = { 0xff, 0xd8, 0xff, 0xdb, 0x00, 0x84, 0x00, 0x06, 0x04, 0x05, @@ -687,8 +688,8 @@ sn9c102_write_jpegheader(struct sn9c102_device* cam, struct sn9c102_frame_t* f) static void sn9c102_urb_complete(struct urb *urb) { - struct sn9c102_device* cam = urb->context; - struct sn9c102_frame_t** f; + struct sn9c102_device *cam = urb->context; + struct sn9c102_frame_t **f; size_t imagesize, soflen; u8 i; int err = 0; @@ -787,7 +788,7 @@ end_of_frame: b = (*f)->buf.bytesused; (*f)->state = F_DONE; - (*f)->buf.sequence= ++cam->frame_count; + (*f)->buf.sequence = ++cam->frame_count; spin_lock(&cam->queue_lock); list_move_tail(&(*f)->frame, @@ -796,7 +797,7 @@ end_of_frame: (*f) = list_entry( cam->inqueue.next, struct sn9c102_frame_t, - frame ); + frame); else (*f) = NULL; spin_unlock(&cam->queue_lock); @@ -883,11 +884,11 @@ resubmit_urb: } -static int sn9c102_start_transfer(struct sn9c102_device* cam) +static int sn9c102_start_transfer(struct sn9c102_device *cam) { struct usb_device *udev = cam->usbdev; - struct urb* urb; - struct usb_host_interface* altsetting = usb_altnum_to_altsetting( + struct urb *urb; + struct usb_host_interface *altsetting = usb_altnum_to_altsetting( usb_ifnum_to_if(udev, 0), SN9C102_ALTERNATE_SETTING); const unsigned int psz = le16_to_cpu(altsetting-> @@ -971,7 +972,7 @@ free_buffers: } -static int sn9c102_stop_transfer(struct sn9c102_device* cam) +static int sn9c102_stop_transfer(struct sn9c102_device *cam) { struct usb_device *udev = cam->usbdev; s8 i; @@ -994,7 +995,7 @@ static int sn9c102_stop_transfer(struct sn9c102_device* cam) } -static int sn9c102_stream_interrupt(struct sn9c102_device* cam) +static int sn9c102_stream_interrupt(struct sn9c102_device *cam) { cam->stream = STREAM_INTERRUPT; wait_event_timeout(cam->wait_stream, @@ -1017,10 +1018,10 @@ static int sn9c102_stream_interrupt(struct sn9c102_device* cam) /*****************************************************************************/ #ifdef CONFIG_VIDEO_ADV_DEBUG -static u16 sn9c102_strtou16(const char* buff, size_t len, ssize_t* count) +static u16 sn9c102_strtou16(const char *buff, size_t len, ssize_t *count) { char str[7]; - char* endp; + char *endp; unsigned long val; if (len < 6) { @@ -1048,10 +1049,10 @@ static u16 sn9c102_strtou16(const char* buff, size_t len, ssize_t* count) NOTE 2: buffers are PAGE_SIZE long */ -static ssize_t sn9c102_show_reg(struct device* cd, - struct device_attribute *attr, char* buf) +static ssize_t sn9c102_show_reg(struct device *cd, + struct device_attribute *attr, char *buf) { - struct sn9c102_device* cam; + struct sn9c102_device *cam; ssize_t count; if (mutex_lock_interruptible(&sn9c102_sysfs_lock)) @@ -1072,10 +1073,10 @@ static ssize_t sn9c102_show_reg(struct device* cd, static ssize_t -sn9c102_store_reg(struct device* cd, struct device_attribute *attr, - const char* buf, size_t len) +sn9c102_store_reg(struct device *cd, struct device_attribute *attr, + const char *buf, size_t len) { - struct sn9c102_device* cam; + struct sn9c102_device *cam; u16 index; ssize_t count; @@ -1105,10 +1106,10 @@ sn9c102_store_reg(struct device* cd, struct device_attribute *attr, } -static ssize_t sn9c102_show_val(struct device* cd, - struct device_attribute *attr, char* buf) +static ssize_t sn9c102_show_val(struct device *cd, + struct device_attribute *attr, char *buf) { - struct sn9c102_device* cam; + struct sn9c102_device *cam; ssize_t count; int val; @@ -1138,10 +1139,10 @@ static ssize_t sn9c102_show_val(struct device* cd, static ssize_t -sn9c102_store_val(struct device* cd, struct device_attribute *attr, - const char* buf, size_t len) +sn9c102_store_val(struct device *cd, struct device_attribute *attr, + const char *buf, size_t len) { - struct sn9c102_device* cam; + struct sn9c102_device *cam; u16 value; ssize_t count; int err; @@ -1177,10 +1178,10 @@ sn9c102_store_val(struct device* cd, struct device_attribute *attr, } -static ssize_t sn9c102_show_i2c_reg(struct device* cd, - struct device_attribute *attr, char* buf) +static ssize_t sn9c102_show_i2c_reg(struct device *cd, + struct device_attribute *attr, char *buf) { - struct sn9c102_device* cam; + struct sn9c102_device *cam; ssize_t count; if (mutex_lock_interruptible(&sn9c102_sysfs_lock)) @@ -1203,10 +1204,10 @@ static ssize_t sn9c102_show_i2c_reg(struct device* cd, static ssize_t -sn9c102_store_i2c_reg(struct device* cd, struct device_attribute *attr, - const char* buf, size_t len) +sn9c102_store_i2c_reg(struct device *cd, struct device_attribute *attr, + const char *buf, size_t len) { - struct sn9c102_device* cam; + struct sn9c102_device *cam; u16 index; ssize_t count; @@ -1236,10 +1237,10 @@ sn9c102_store_i2c_reg(struct device* cd, struct device_attribute *attr, } -static ssize_t sn9c102_show_i2c_val(struct device* cd, - struct device_attribute *attr, char* buf) +static ssize_t sn9c102_show_i2c_val(struct device *cd, + struct device_attribute *attr, char *buf) { - struct sn9c102_device* cam; + struct sn9c102_device *cam; ssize_t count; int val; @@ -1274,10 +1275,10 @@ static ssize_t sn9c102_show_i2c_val(struct device* cd, static ssize_t -sn9c102_store_i2c_val(struct device* cd, struct device_attribute *attr, - const char* buf, size_t len) +sn9c102_store_i2c_val(struct device *cd, struct device_attribute *attr, + const char *buf, size_t len) { - struct sn9c102_device* cam; + struct sn9c102_device *cam; u16 value; ssize_t count; int err; @@ -1319,10 +1320,10 @@ sn9c102_store_i2c_val(struct device* cd, struct device_attribute *attr, static ssize_t -sn9c102_store_green(struct device* cd, struct device_attribute *attr, - const char* buf, size_t len) +sn9c102_store_green(struct device *cd, struct device_attribute *attr, + const char *buf, size_t len) { - struct sn9c102_device* cam; + struct sn9c102_device *cam; enum sn9c102_bridge bridge; ssize_t res = 0; u16 value; @@ -1350,7 +1351,8 @@ sn9c102_store_green(struct device* cd, struct device_attribute *attr, case BRIDGE_SN9C102: if (value > 0x0f) return -EINVAL; - if ((res = sn9c102_store_reg(cd, attr, "0x11", 4)) >= 0) + res = sn9c102_store_reg(cd, attr, "0x11", 4); + if (res >= 0) res = sn9c102_store_val(cd, attr, buf, len); break; case BRIDGE_SN9C103: @@ -1358,7 +1360,8 @@ sn9c102_store_green(struct device* cd, struct device_attribute *attr, case BRIDGE_SN9C120: if (value > 0x7f) return -EINVAL; - if ((res = sn9c102_store_reg(cd, attr, "0x07", 4)) >= 0) + res = sn9c102_store_reg(cd, attr, "0x07", 4); + if (res >= 0) res = sn9c102_store_val(cd, attr, buf, len); break; } @@ -1368,8 +1371,8 @@ sn9c102_store_green(struct device* cd, struct device_attribute *attr, static ssize_t -sn9c102_store_blue(struct device* cd, struct device_attribute *attr, - const char* buf, size_t len) +sn9c102_store_blue(struct device *cd, struct device_attribute *attr, + const char *buf, size_t len) { ssize_t res = 0; u16 value; @@ -1379,7 +1382,8 @@ sn9c102_store_blue(struct device* cd, struct device_attribute *attr, if (!count || value > 0x7f) return -EINVAL; - if ((res = sn9c102_store_reg(cd, attr, "0x06", 4)) >= 0) + res = sn9c102_store_reg(cd, attr, "0x06", 4); + if (res >= 0) res = sn9c102_store_val(cd, attr, buf, len); return res; @@ -1387,8 +1391,8 @@ sn9c102_store_blue(struct device* cd, struct device_attribute *attr, static ssize_t -sn9c102_store_red(struct device* cd, struct device_attribute *attr, - const char* buf, size_t len) +sn9c102_store_red(struct device *cd, struct device_attribute *attr, + const char *buf, size_t len) { ssize_t res = 0; u16 value; @@ -1397,19 +1401,19 @@ sn9c102_store_red(struct device* cd, struct device_attribute *attr, value = sn9c102_strtou16(buf, len, &count); if (!count || value > 0x7f) return -EINVAL; - - if ((res = sn9c102_store_reg(cd, attr, "0x05", 4)) >= 0) + res = sn9c102_store_reg(cd, attr, "0x05", 4); + if (res >= 0) res = sn9c102_store_val(cd, attr, buf, len); return res; } -static ssize_t sn9c102_show_frame_header(struct device* cd, +static ssize_t sn9c102_show_frame_header(struct device *cd, struct device_attribute *attr, - char* buf) + char *buf) { - struct sn9c102_device* cam; + struct sn9c102_device *cam; ssize_t count; cam = video_get_drvdata(container_of(cd, struct video_device, dev)); @@ -1437,7 +1441,7 @@ static DEVICE_ATTR(red, S_IWUSR, NULL, sn9c102_store_red); static DEVICE_ATTR(frame_header, S_IRUGO, sn9c102_show_frame_header, NULL); -static int sn9c102_create_sysfs(struct sn9c102_device* cam) +static int sn9c102_create_sysfs(struct sn9c102_device *cam) { struct device *dev = &(cam->v4ldev->dev); int err = 0; @@ -1498,7 +1502,7 @@ err_out: /*****************************************************************************/ static int -sn9c102_set_pix_format(struct sn9c102_device* cam, struct v4l2_pix_format* pix) +sn9c102_set_pix_format(struct sn9c102_device *cam, struct v4l2_pix_format *pix) { int err = 0; @@ -1538,8 +1542,8 @@ sn9c102_set_pix_format(struct sn9c102_device* cam, struct v4l2_pix_format* pix) static int -sn9c102_set_compression(struct sn9c102_device* cam, - struct v4l2_jpegcompression* compression) +sn9c102_set_compression(struct sn9c102_device *cam, + struct v4l2_jpegcompression *compression) { int i, err = 0; @@ -1586,7 +1590,7 @@ sn9c102_set_compression(struct sn9c102_device* cam, } -static int sn9c102_set_scale(struct sn9c102_device* cam, u8 scale) +static int sn9c102_set_scale(struct sn9c102_device *cam, u8 scale) { u8 r = 0; int err = 0; @@ -1609,9 +1613,9 @@ static int sn9c102_set_scale(struct sn9c102_device* cam, u8 scale) } -static int sn9c102_set_crop(struct sn9c102_device* cam, struct v4l2_rect* rect) +static int sn9c102_set_crop(struct sn9c102_device *cam, struct v4l2_rect *rect) { - struct sn9c102_sensor* s = &cam->sensor; + struct sn9c102_sensor *s = &cam->sensor; u8 h_start = (u8)(rect->left - s->cropcap.bounds.left), v_start = (u8)(rect->top - s->cropcap.bounds.top), h_size = (u8)(rect->width / 16), @@ -1632,12 +1636,12 @@ static int sn9c102_set_crop(struct sn9c102_device* cam, struct v4l2_rect* rect) } -static int sn9c102_init(struct sn9c102_device* cam) +static int sn9c102_init(struct sn9c102_device *cam) { - struct sn9c102_sensor* s = &cam->sensor; + struct sn9c102_sensor *s = &cam->sensor; struct v4l2_control ctrl; struct v4l2_queryctrl *qctrl; - struct v4l2_rect* rect; + struct v4l2_rect *rect; u8 i = 0; int err = 0; @@ -1669,7 +1673,7 @@ static int sn9c102_init(struct sn9c102_device* cam) cam->bridge == BRIDGE_SN9C102 || cam->bridge == BRIDGE_SN9C103) { if (s->pix_format.pixelformat == V4L2_PIX_FMT_JPEG) - s->pix_format.pixelformat= V4L2_PIX_FMT_SBGGR8; + s->pix_format.pixelformat = V4L2_PIX_FMT_SBGGR8; cam->compression.quality = cam->reg[0x17] & 0x01 ? 0 : 1; } else { @@ -1761,7 +1765,7 @@ static void sn9c102_release_resources(struct kref *kref) static int sn9c102_open(struct file *filp) { - struct sn9c102_device* cam; + struct sn9c102_device *cam; int err = 0; /* @@ -1873,7 +1877,7 @@ out: static int sn9c102_release(struct file *filp) { - struct sn9c102_device* cam; + struct sn9c102_device *cam; down_write(&sn9c102_dev_lock); @@ -1895,10 +1899,10 @@ static int sn9c102_release(struct file *filp) static ssize_t -sn9c102_read(struct file* filp, char __user * buf, size_t count, loff_t* f_pos) +sn9c102_read(struct file *filp, char __user *buf, size_t count, loff_t *f_pos) { struct sn9c102_device *cam = video_drvdata(filp); - struct sn9c102_frame_t* f, * i; + struct sn9c102_frame_t *f, *i; unsigned long lock_flags; long timeout; int err = 0; @@ -1927,7 +1931,7 @@ sn9c102_read(struct file* filp, char __user * buf, size_t count, loff_t* f_pos) } if (cam->io == IO_NONE) { - if (!sn9c102_request_buffers(cam,cam->nreadbuffers, IO_READ)) { + if (!sn9c102_request_buffers(cam, cam->nreadbuffers, IO_READ)) { DBG(1, "read() failed, not enough memory"); mutex_unlock(&cam->fileop_mutex); return -ENOMEM; @@ -1954,17 +1958,17 @@ sn9c102_read(struct file* filp, char __user * buf, size_t count, loff_t* f_pos) } if (!cam->module_param.frame_timeout) { err = wait_event_interruptible - ( cam->wait_frame, + (cam->wait_frame, (!list_empty(&cam->outqueue)) || (cam->state & DEV_DISCONNECTED) || - (cam->state & DEV_MISCONFIGURED) ); + (cam->state & DEV_MISCONFIGURED)); if (err) { mutex_unlock(&cam->fileop_mutex); return err; } } else { timeout = wait_event_interruptible_timeout - ( cam->wait_frame, + (cam->wait_frame, (!list_empty(&cam->outqueue)) || (cam->state & DEV_DISCONNECTED) || (cam->state & DEV_MISCONFIGURED), @@ -2024,7 +2028,7 @@ exit: static unsigned int sn9c102_poll(struct file *filp, poll_table *wait) { struct sn9c102_device *cam = video_drvdata(filp); - struct sn9c102_frame_t* f; + struct sn9c102_frame_t *f; unsigned long lock_flags; unsigned int mask = 0; @@ -2076,17 +2080,17 @@ error: } -static void sn9c102_vm_open(struct vm_area_struct* vma) +static void sn9c102_vm_open(struct vm_area_struct *vma) { - struct sn9c102_frame_t* f = vma->vm_private_data; + struct sn9c102_frame_t *f = vma->vm_private_data; f->vma_use_count++; } -static void sn9c102_vm_close(struct vm_area_struct* vma) +static void sn9c102_vm_close(struct vm_area_struct *vma) { /* NOTE: buffers are not freed here */ - struct sn9c102_frame_t* f = vma->vm_private_data; + struct sn9c102_frame_t *f = vma->vm_private_data; f->vma_use_count--; } @@ -2097,7 +2101,7 @@ static const struct vm_operations_struct sn9c102_vm_ops = { }; -static int sn9c102_mmap(struct file* filp, struct vm_area_struct *vma) +static int sn9c102_mmap(struct file *filp, struct vm_area_struct *vma) { struct sn9c102_device *cam = video_drvdata(filp); unsigned long size = vma->vm_end - vma->vm_start, @@ -2166,7 +2170,7 @@ static int sn9c102_mmap(struct file* filp, struct vm_area_struct *vma) /*****************************************************************************/ static int -sn9c102_vidioc_querycap(struct sn9c102_device* cam, void __user * arg) +sn9c102_vidioc_querycap(struct sn9c102_device *cam, void __user *arg) { struct v4l2_capability cap = { .driver = "sn9c102", @@ -2188,7 +2192,7 @@ sn9c102_vidioc_querycap(struct sn9c102_device* cam, void __user * arg) static int -sn9c102_vidioc_enuminput(struct sn9c102_device* cam, void __user * arg) +sn9c102_vidioc_enuminput(struct sn9c102_device *cam, void __user *arg) { struct v4l2_input i; @@ -2211,7 +2215,7 @@ sn9c102_vidioc_enuminput(struct sn9c102_device* cam, void __user * arg) static int -sn9c102_vidioc_g_input(struct sn9c102_device* cam, void __user * arg) +sn9c102_vidioc_g_input(struct sn9c102_device *cam, void __user *arg) { int index = 0; @@ -2223,7 +2227,7 @@ sn9c102_vidioc_g_input(struct sn9c102_device* cam, void __user * arg) static int -sn9c102_vidioc_s_input(struct sn9c102_device* cam, void __user * arg) +sn9c102_vidioc_s_input(struct sn9c102_device *cam, void __user *arg) { int index; @@ -2238,9 +2242,9 @@ sn9c102_vidioc_s_input(struct sn9c102_device* cam, void __user * arg) static int -sn9c102_vidioc_query_ctrl(struct sn9c102_device* cam, void __user * arg) +sn9c102_vidioc_query_ctrl(struct sn9c102_device *cam, void __user *arg) { - struct sn9c102_sensor* s = &cam->sensor; + struct sn9c102_sensor *s = &cam->sensor; struct v4l2_queryctrl qc; u8 i; @@ -2260,9 +2264,9 @@ sn9c102_vidioc_query_ctrl(struct sn9c102_device* cam, void __user * arg) static int -sn9c102_vidioc_g_ctrl(struct sn9c102_device* cam, void __user * arg) +sn9c102_vidioc_g_ctrl(struct sn9c102_device *cam, void __user *arg) { - struct sn9c102_sensor* s = &cam->sensor; + struct sn9c102_sensor *s = &cam->sensor; struct v4l2_control ctrl; int err = 0; u8 i; @@ -2295,9 +2299,9 @@ exit: static int -sn9c102_vidioc_s_ctrl(struct sn9c102_device* cam, void __user * arg) +sn9c102_vidioc_s_ctrl(struct sn9c102_device *cam, void __user *arg) { - struct sn9c102_sensor* s = &cam->sensor; + struct sn9c102_sensor *s = &cam->sensor; struct v4l2_control ctrl; u8 i; int err = 0; @@ -2335,9 +2339,9 @@ sn9c102_vidioc_s_ctrl(struct sn9c102_device* cam, void __user * arg) static int -sn9c102_vidioc_cropcap(struct sn9c102_device* cam, void __user * arg) +sn9c102_vidioc_cropcap(struct sn9c102_device *cam, void __user *arg) { - struct v4l2_cropcap* cc = &(cam->sensor.cropcap); + struct v4l2_cropcap *cc = &(cam->sensor.cropcap); cc->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; cc->pixelaspect.numerator = 1; @@ -2351,9 +2355,9 @@ sn9c102_vidioc_cropcap(struct sn9c102_device* cam, void __user * arg) static int -sn9c102_vidioc_g_crop(struct sn9c102_device* cam, void __user * arg) +sn9c102_vidioc_g_crop(struct sn9c102_device *cam, void __user *arg) { - struct sn9c102_sensor* s = &cam->sensor; + struct sn9c102_sensor *s = &cam->sensor; struct v4l2_crop crop = { .type = V4L2_BUF_TYPE_VIDEO_CAPTURE, }; @@ -2368,13 +2372,13 @@ sn9c102_vidioc_g_crop(struct sn9c102_device* cam, void __user * arg) static int -sn9c102_vidioc_s_crop(struct sn9c102_device* cam, void __user * arg) +sn9c102_vidioc_s_crop(struct sn9c102_device *cam, void __user *arg) { - struct sn9c102_sensor* s = &cam->sensor; + struct sn9c102_sensor *s = &cam->sensor; struct v4l2_crop crop; - struct v4l2_rect* rect; - struct v4l2_rect* bounds = &(s->cropcap.bounds); - struct v4l2_pix_format* pix_format = &(s->pix_format); + struct v4l2_rect *rect; + struct v4l2_rect *bounds = &(s->cropcap.bounds); + struct v4l2_pix_format *pix_format = &(s->pix_format); u8 scale; const enum sn9c102_stream_state stream = cam->stream; const u32 nbuffers = cam->nbuffers; @@ -2482,7 +2486,7 @@ sn9c102_vidioc_s_crop(struct sn9c102_device* cam, void __user * arg) static int -sn9c102_vidioc_enum_framesizes(struct sn9c102_device* cam, void __user * arg) +sn9c102_vidioc_enum_framesizes(struct sn9c102_device *cam, void __user *arg) { struct v4l2_frmsizeenum frmsize; @@ -2523,7 +2527,7 @@ sn9c102_vidioc_enum_framesizes(struct sn9c102_device* cam, void __user * arg) static int -sn9c102_vidioc_enum_fmt(struct sn9c102_device* cam, void __user * arg) +sn9c102_vidioc_enum_fmt(struct sn9c102_device *cam, void __user *arg) { struct v4l2_fmtdesc fmtd; @@ -2565,10 +2569,10 @@ sn9c102_vidioc_enum_fmt(struct sn9c102_device* cam, void __user * arg) static int -sn9c102_vidioc_g_fmt(struct sn9c102_device* cam, void __user * arg) +sn9c102_vidioc_g_fmt(struct sn9c102_device *cam, void __user *arg) { struct v4l2_format format; - struct v4l2_pix_format* pfmt = &(cam->sensor.pix_format); + struct v4l2_pix_format *pfmt = &(cam->sensor.pix_format); if (copy_from_user(&format, arg, sizeof(format))) return -EFAULT; @@ -2593,14 +2597,14 @@ sn9c102_vidioc_g_fmt(struct sn9c102_device* cam, void __user * arg) static int -sn9c102_vidioc_try_s_fmt(struct sn9c102_device* cam, unsigned int cmd, - void __user * arg) +sn9c102_vidioc_try_s_fmt(struct sn9c102_device *cam, unsigned int cmd, + void __user *arg) { - struct sn9c102_sensor* s = &cam->sensor; + struct sn9c102_sensor *s = &cam->sensor; struct v4l2_format format; - struct v4l2_pix_format* pix; - struct v4l2_pix_format* pfmt = &(s->pix_format); - struct v4l2_rect* bounds = &(s->cropcap.bounds); + struct v4l2_pix_format *pix; + struct v4l2_pix_format *pfmt = &(s->pix_format); + struct v4l2_rect *bounds = &(s->cropcap.bounds); struct v4l2_rect rect; u8 scale; const enum sn9c102_stream_state stream = cam->stream; @@ -2742,7 +2746,7 @@ sn9c102_vidioc_try_s_fmt(struct sn9c102_device* cam, unsigned int cmd, static int -sn9c102_vidioc_g_jpegcomp(struct sn9c102_device* cam, void __user * arg) +sn9c102_vidioc_g_jpegcomp(struct sn9c102_device *cam, void __user *arg) { if (copy_to_user(arg, &cam->compression, sizeof(cam->compression))) return -EFAULT; @@ -2752,7 +2756,7 @@ sn9c102_vidioc_g_jpegcomp(struct sn9c102_device* cam, void __user * arg) static int -sn9c102_vidioc_s_jpegcomp(struct sn9c102_device* cam, void __user * arg) +sn9c102_vidioc_s_jpegcomp(struct sn9c102_device *cam, void __user *arg) { struct v4l2_jpegcompression jc; const enum sn9c102_stream_state stream = cam->stream; @@ -2788,7 +2792,7 @@ sn9c102_vidioc_s_jpegcomp(struct sn9c102_device* cam, void __user * arg) static int -sn9c102_vidioc_reqbufs(struct sn9c102_device* cam, void __user * arg) +sn9c102_vidioc_reqbufs(struct sn9c102_device *cam, void __user *arg) { struct v4l2_requestbuffers rb; u32 i; @@ -2839,7 +2843,7 @@ sn9c102_vidioc_reqbufs(struct sn9c102_device* cam, void __user * arg) static int -sn9c102_vidioc_querybuf(struct sn9c102_device* cam, void __user * arg) +sn9c102_vidioc_querybuf(struct sn9c102_device *cam, void __user *arg) { struct v4l2_buffer b; @@ -2868,7 +2872,7 @@ sn9c102_vidioc_querybuf(struct sn9c102_device* cam, void __user * arg) static int -sn9c102_vidioc_qbuf(struct sn9c102_device* cam, void __user * arg) +sn9c102_vidioc_qbuf(struct sn9c102_device *cam, void __user *arg) { struct v4l2_buffer b; unsigned long lock_flags; @@ -2896,8 +2900,8 @@ sn9c102_vidioc_qbuf(struct sn9c102_device* cam, void __user * arg) static int -sn9c102_vidioc_dqbuf(struct sn9c102_device* cam, struct file* filp, - void __user * arg) +sn9c102_vidioc_dqbuf(struct sn9c102_device *cam, struct file *filp, + void __user *arg) { struct v4l2_buffer b; struct sn9c102_frame_t *f; @@ -2918,20 +2922,20 @@ sn9c102_vidioc_dqbuf(struct sn9c102_device* cam, struct file* filp, return -EAGAIN; if (!cam->module_param.frame_timeout) { err = wait_event_interruptible - ( cam->wait_frame, + (cam->wait_frame, (!list_empty(&cam->outqueue)) || (cam->state & DEV_DISCONNECTED) || - (cam->state & DEV_MISCONFIGURED) ); + (cam->state & DEV_MISCONFIGURED)); if (err) return err; } else { timeout = wait_event_interruptible_timeout - ( cam->wait_frame, + (cam->wait_frame, (!list_empty(&cam->outqueue)) || (cam->state & DEV_DISCONNECTED) || (cam->state & DEV_MISCONFIGURED), cam->module_param.frame_timeout * - 1000 * msecs_to_jiffies(1) ); + 1000 * msecs_to_jiffies(1)); if (timeout < 0) return timeout; else if (timeout == 0 && @@ -2967,7 +2971,7 @@ sn9c102_vidioc_dqbuf(struct sn9c102_device* cam, struct file* filp, static int -sn9c102_vidioc_streamon(struct sn9c102_device* cam, void __user * arg) +sn9c102_vidioc_streamon(struct sn9c102_device *cam, void __user *arg) { int type; @@ -2986,7 +2990,7 @@ sn9c102_vidioc_streamon(struct sn9c102_device* cam, void __user * arg) static int -sn9c102_vidioc_streamoff(struct sn9c102_device* cam, void __user * arg) +sn9c102_vidioc_streamoff(struct sn9c102_device *cam, void __user *arg) { int type, err; @@ -3011,7 +3015,7 @@ sn9c102_vidioc_streamoff(struct sn9c102_device* cam, void __user * arg) static int -sn9c102_vidioc_g_parm(struct sn9c102_device* cam, void __user * arg) +sn9c102_vidioc_g_parm(struct sn9c102_device *cam, void __user *arg) { struct v4l2_streamparm sp; @@ -3032,7 +3036,7 @@ sn9c102_vidioc_g_parm(struct sn9c102_device* cam, void __user * arg) static int -sn9c102_vidioc_s_parm(struct sn9c102_device* cam, void __user * arg) +sn9c102_vidioc_s_parm(struct sn9c102_device *cam, void __user *arg) { struct v4l2_streamparm sp; @@ -3060,7 +3064,7 @@ sn9c102_vidioc_s_parm(struct sn9c102_device* cam, void __user * arg) static int -sn9c102_vidioc_enumaudio(struct sn9c102_device* cam, void __user * arg) +sn9c102_vidioc_enumaudio(struct sn9c102_device *cam, void __user *arg) { struct v4l2_audio audio; @@ -3085,7 +3089,7 @@ sn9c102_vidioc_enumaudio(struct sn9c102_device* cam, void __user * arg) static int -sn9c102_vidioc_g_audio(struct sn9c102_device* cam, void __user * arg) +sn9c102_vidioc_g_audio(struct sn9c102_device *cam, void __user *arg) { struct v4l2_audio audio; @@ -3106,7 +3110,7 @@ sn9c102_vidioc_g_audio(struct sn9c102_device* cam, void __user * arg) static int -sn9c102_vidioc_s_audio(struct sn9c102_device* cam, void __user * arg) +sn9c102_vidioc_s_audio(struct sn9c102_device *cam, void __user *arg) { struct v4l2_audio audio; @@ -3266,10 +3270,10 @@ static const struct v4l2_file_operations sn9c102_fops = { /* It exists a single interface only. We do not need to validate anything. */ static int -sn9c102_usb_probe(struct usb_interface* intf, const struct usb_device_id* id) +sn9c102_usb_probe(struct usb_interface *intf, const struct usb_device_id *id) { struct usb_device *udev = interface_to_usbdev(intf); - struct sn9c102_device* cam; + struct sn9c102_device *cam; static unsigned int dev_nr; unsigned int i; int err = 0, r; @@ -3419,9 +3423,9 @@ fail: } -static void sn9c102_usb_disconnect(struct usb_interface* intf) +static void sn9c102_usb_disconnect(struct usb_interface *intf) { - struct sn9c102_device* cam; + struct sn9c102_device *cam; down_write(&sn9c102_dev_lock); diff --git a/drivers/staging/media/sn9c102/sn9c102_devtable.h b/drivers/staging/media/sn9c102/sn9c102_devtable.h index 4ba569258498..b187a8a304eb 100644 --- a/drivers/staging/media/sn9c102/sn9c102_devtable.h +++ b/drivers/staging/media/sn9c102/sn9c102_devtable.h @@ -129,17 +129,17 @@ static const struct usb_device_id sn9c102_id_table[] = { initialization of the SN9C1XX chip. Functions must return 0 on success, the appropriate error otherwise. */ -extern int sn9c102_probe_hv7131d(struct sn9c102_device* cam); -extern int sn9c102_probe_hv7131r(struct sn9c102_device* cam); -extern int sn9c102_probe_mi0343(struct sn9c102_device* cam); -extern int sn9c102_probe_mi0360(struct sn9c102_device* cam); +extern int sn9c102_probe_hv7131d(struct sn9c102_device *cam); +extern int sn9c102_probe_hv7131r(struct sn9c102_device *cam); +extern int sn9c102_probe_mi0343(struct sn9c102_device *cam); +extern int sn9c102_probe_mi0360(struct sn9c102_device *cam); extern int sn9c102_probe_mt9v111(struct sn9c102_device *cam); -extern int sn9c102_probe_ov7630(struct sn9c102_device* cam); -extern int sn9c102_probe_ov7660(struct sn9c102_device* cam); -extern int sn9c102_probe_pas106b(struct sn9c102_device* cam); -extern int sn9c102_probe_pas202bcb(struct sn9c102_device* cam); -extern int sn9c102_probe_tas5110c1b(struct sn9c102_device* cam); -extern int sn9c102_probe_tas5110d(struct sn9c102_device* cam); -extern int sn9c102_probe_tas5130d1b(struct sn9c102_device* cam); +extern int sn9c102_probe_ov7630(struct sn9c102_device *cam); +extern int sn9c102_probe_ov7660(struct sn9c102_device *cam); +extern int sn9c102_probe_pas106b(struct sn9c102_device *cam); +extern int sn9c102_probe_pas202bcb(struct sn9c102_device *cam); +extern int sn9c102_probe_tas5110c1b(struct sn9c102_device *cam); +extern int sn9c102_probe_tas5110d(struct sn9c102_device *cam); +extern int sn9c102_probe_tas5130d1b(struct sn9c102_device *cam); #endif /* _SN9C102_DEVTABLE_H_ */ diff --git a/drivers/staging/media/sn9c102/sn9c102_hv7131d.c b/drivers/staging/media/sn9c102/sn9c102_hv7131d.c index 468072176527..f1d94f0190c6 100644 --- a/drivers/staging/media/sn9c102/sn9c102_hv7131d.c +++ b/drivers/staging/media/sn9c102/sn9c102_hv7131d.c @@ -23,7 +23,7 @@ #include "sn9c102_devtable.h" -static int hv7131d_init(struct sn9c102_device* cam) +static int hv7131d_init(struct sn9c102_device *cam) { int err; @@ -39,8 +39,8 @@ static int hv7131d_init(struct sn9c102_device* cam) } -static int hv7131d_get_ctrl(struct sn9c102_device* cam, - struct v4l2_control* ctrl) +static int hv7131d_get_ctrl(struct sn9c102_device *cam, + struct v4l2_control *ctrl) { switch (ctrl->id) { case V4L2_CID_EXPOSURE: @@ -88,8 +88,8 @@ static int hv7131d_get_ctrl(struct sn9c102_device* cam, } -static int hv7131d_set_ctrl(struct sn9c102_device* cam, - const struct v4l2_control* ctrl) +static int hv7131d_set_ctrl(struct sn9c102_device *cam, + const struct v4l2_control *ctrl) { int err = 0; @@ -121,10 +121,10 @@ static int hv7131d_set_ctrl(struct sn9c102_device* cam, } -static int hv7131d_set_crop(struct sn9c102_device* cam, - const struct v4l2_rect* rect) +static int hv7131d_set_crop(struct sn9c102_device *cam, + const struct v4l2_rect *rect) { - struct sn9c102_sensor* s = sn9c102_get_sensor(cam); + struct sn9c102_sensor *s = sn9c102_get_sensor(cam); int err = 0; u8 h_start = (u8)(rect->left - s->cropcap.bounds.left) + 2, v_start = (u8)(rect->top - s->cropcap.bounds.top) + 2; @@ -136,8 +136,8 @@ static int hv7131d_set_crop(struct sn9c102_device* cam, } -static int hv7131d_set_pix_format(struct sn9c102_device* cam, - const struct v4l2_pix_format* pix) +static int hv7131d_set_pix_format(struct sn9c102_device *cam, + const struct v4l2_pix_format *pix) { int err = 0; @@ -248,7 +248,7 @@ static const struct sn9c102_sensor hv7131d = { }; -int sn9c102_probe_hv7131d(struct sn9c102_device* cam) +int sn9c102_probe_hv7131d(struct sn9c102_device *cam) { int r0 = 0, r1 = 0, err; diff --git a/drivers/staging/media/sn9c102/sn9c102_hv7131r.c b/drivers/staging/media/sn9c102/sn9c102_hv7131r.c index 26a91115b831..51b24e000e88 100644 --- a/drivers/staging/media/sn9c102/sn9c102_hv7131r.c +++ b/drivers/staging/media/sn9c102/sn9c102_hv7131r.c @@ -23,7 +23,7 @@ #include "sn9c102_devtable.h" -static int hv7131r_init(struct sn9c102_device* cam) +static int hv7131r_init(struct sn9c102_device *cam) { int err = 0; @@ -137,8 +137,8 @@ static int hv7131r_init(struct sn9c102_device* cam) } -static int hv7131r_get_ctrl(struct sn9c102_device* cam, - struct v4l2_control* ctrl) +static int hv7131r_get_ctrl(struct sn9c102_device *cam, + struct v4l2_control *ctrl) { switch (ctrl->id) { case V4L2_CID_GAIN: @@ -176,8 +176,8 @@ static int hv7131r_get_ctrl(struct sn9c102_device* cam, } -static int hv7131r_set_ctrl(struct sn9c102_device* cam, - const struct v4l2_control* ctrl) +static int hv7131r_set_ctrl(struct sn9c102_device *cam, + const struct v4l2_control *ctrl) { int err = 0; @@ -197,6 +197,7 @@ static int hv7131r_set_ctrl(struct sn9c102_device* cam, case V4L2_CID_BLACK_LEVEL: { int r = sn9c102_i2c_read(cam, 0x01); + if (r < 0) return -EIO; err += sn9c102_i2c_write(cam, 0x01, @@ -211,10 +212,10 @@ static int hv7131r_set_ctrl(struct sn9c102_device* cam, } -static int hv7131r_set_crop(struct sn9c102_device* cam, - const struct v4l2_rect* rect) +static int hv7131r_set_crop(struct sn9c102_device *cam, + const struct v4l2_rect *rect) { - struct sn9c102_sensor* s = sn9c102_get_sensor(cam); + struct sn9c102_sensor *s = sn9c102_get_sensor(cam); int err = 0; u8 h_start = (u8)(rect->left - s->cropcap.bounds.left) + 1, v_start = (u8)(rect->top - s->cropcap.bounds.top) + 1; @@ -226,8 +227,8 @@ static int hv7131r_set_crop(struct sn9c102_device* cam, } -static int hv7131r_set_pix_format(struct sn9c102_device* cam, - const struct v4l2_pix_format* pix) +static int hv7131r_set_pix_format(struct sn9c102_device *cam, + const struct v4l2_pix_format *pix) { int err = 0; @@ -347,7 +348,7 @@ static const struct sn9c102_sensor hv7131r = { }; -int sn9c102_probe_hv7131r(struct sn9c102_device* cam) +int sn9c102_probe_hv7131r(struct sn9c102_device *cam) { int devid, err; diff --git a/drivers/staging/media/sn9c102/sn9c102_mi0343.c b/drivers/staging/media/sn9c102/sn9c102_mi0343.c index 1f5b09bec89c..b20fdb6541d3 100644 --- a/drivers/staging/media/sn9c102/sn9c102_mi0343.c +++ b/drivers/staging/media/sn9c102/sn9c102_mi0343.c @@ -23,9 +23,9 @@ #include "sn9c102_devtable.h" -static int mi0343_init(struct sn9c102_device* cam) +static int mi0343_init(struct sn9c102_device *cam) { - struct sn9c102_sensor* s = sn9c102_get_sensor(cam); + struct sn9c102_sensor *s = sn9c102_get_sensor(cam); int err = 0; err = sn9c102_write_const_regs(cam, {0x00, 0x10}, {0x00, 0x11}, @@ -52,10 +52,10 @@ static int mi0343_init(struct sn9c102_device* cam) } -static int mi0343_get_ctrl(struct sn9c102_device* cam, - struct v4l2_control* ctrl) +static int mi0343_get_ctrl(struct sn9c102_device *cam, + struct v4l2_control *ctrl) { - struct sn9c102_sensor* s = sn9c102_get_sensor(cam); + struct sn9c102_sensor *s = sn9c102_get_sensor(cam); u8 data[2]; switch (ctrl->id) { @@ -119,10 +119,10 @@ static int mi0343_get_ctrl(struct sn9c102_device* cam, } -static int mi0343_set_ctrl(struct sn9c102_device* cam, - const struct v4l2_control* ctrl) +static int mi0343_set_ctrl(struct sn9c102_device *cam, + const struct v4l2_control *ctrl) { - struct sn9c102_sensor* s = sn9c102_get_sensor(cam); + struct sn9c102_sensor *s = sn9c102_get_sensor(cam); u16 reg = 0; int err = 0; @@ -189,10 +189,10 @@ static int mi0343_set_ctrl(struct sn9c102_device* cam, } -static int mi0343_set_crop(struct sn9c102_device* cam, - const struct v4l2_rect* rect) +static int mi0343_set_crop(struct sn9c102_device *cam, + const struct v4l2_rect *rect) { - struct sn9c102_sensor* s = sn9c102_get_sensor(cam); + struct sn9c102_sensor *s = sn9c102_get_sensor(cam); int err = 0; u8 h_start = (u8)(rect->left - s->cropcap.bounds.left) + 0, v_start = (u8)(rect->top - s->cropcap.bounds.top) + 2; @@ -204,10 +204,10 @@ static int mi0343_set_crop(struct sn9c102_device* cam, } -static int mi0343_set_pix_format(struct sn9c102_device* cam, - const struct v4l2_pix_format* pix) +static int mi0343_set_pix_format(struct sn9c102_device *cam, + const struct v4l2_pix_format *pix) { - struct sn9c102_sensor* s = sn9c102_get_sensor(cam); + struct sn9c102_sensor *s = sn9c102_get_sensor(cam); int err = 0; if (pix->pixelformat == V4L2_PIX_FMT_SN9C10X) { @@ -331,7 +331,7 @@ static const struct sn9c102_sensor mi0343 = { }; -int sn9c102_probe_mi0343(struct sn9c102_device* cam) +int sn9c102_probe_mi0343(struct sn9c102_device *cam) { u8 data[2]; diff --git a/drivers/staging/media/sn9c102/sn9c102_mi0360.c b/drivers/staging/media/sn9c102/sn9c102_mi0360.c index d973fc1973d9..5f21d1b43e32 100644 --- a/drivers/staging/media/sn9c102/sn9c102_mi0360.c +++ b/drivers/staging/media/sn9c102/sn9c102_mi0360.c @@ -23,9 +23,9 @@ #include "sn9c102_devtable.h" -static int mi0360_init(struct sn9c102_device* cam) +static int mi0360_init(struct sn9c102_device *cam) { - struct sn9c102_sensor* s = sn9c102_get_sensor(cam); + struct sn9c102_sensor *s = sn9c102_get_sensor(cam); int err = 0; switch (sn9c102_get_bridge(cam)) { @@ -147,10 +147,10 @@ static int mi0360_init(struct sn9c102_device* cam) } -static int mi0360_get_ctrl(struct sn9c102_device* cam, - struct v4l2_control* ctrl) +static int mi0360_get_ctrl(struct sn9c102_device *cam, + struct v4l2_control *ctrl) { - struct sn9c102_sensor* s = sn9c102_get_sensor(cam); + struct sn9c102_sensor *s = sn9c102_get_sensor(cam); u8 data[2]; switch (ctrl->id) { @@ -204,10 +204,10 @@ static int mi0360_get_ctrl(struct sn9c102_device* cam, } -static int mi0360_set_ctrl(struct sn9c102_device* cam, - const struct v4l2_control* ctrl) +static int mi0360_set_ctrl(struct sn9c102_device *cam, + const struct v4l2_control *ctrl) { - struct sn9c102_sensor* s = sn9c102_get_sensor(cam); + struct sn9c102_sensor *s = sn9c102_get_sensor(cam); int err = 0; switch (ctrl->id) { @@ -259,10 +259,10 @@ static int mi0360_set_ctrl(struct sn9c102_device* cam, } -static int mi0360_set_crop(struct sn9c102_device* cam, - const struct v4l2_rect* rect) +static int mi0360_set_crop(struct sn9c102_device *cam, + const struct v4l2_rect *rect) { - struct sn9c102_sensor* s = sn9c102_get_sensor(cam); + struct sn9c102_sensor *s = sn9c102_get_sensor(cam); int err = 0; u8 h_start = 0, v_start = (u8)(rect->top - s->cropcap.bounds.top) + 1; @@ -285,10 +285,10 @@ static int mi0360_set_crop(struct sn9c102_device* cam, } -static int mi0360_set_pix_format(struct sn9c102_device* cam, - const struct v4l2_pix_format* pix) +static int mi0360_set_pix_format(struct sn9c102_device *cam, + const struct v4l2_pix_format *pix) { - struct sn9c102_sensor* s = sn9c102_get_sensor(cam); + struct sn9c102_sensor *s = sn9c102_get_sensor(cam); int err = 0; if (pix->pixelformat == V4L2_PIX_FMT_SBGGR8) { @@ -418,7 +418,7 @@ static const struct sn9c102_sensor mi0360 = { }; -int sn9c102_probe_mi0360(struct sn9c102_device* cam) +int sn9c102_probe_mi0360(struct sn9c102_device *cam) { u8 data[2]; diff --git a/drivers/staging/media/sn9c102/sn9c102_ov7630.c b/drivers/staging/media/sn9c102/sn9c102_ov7630.c index d3a1bd8d5648..9ec304dc4705 100644 --- a/drivers/staging/media/sn9c102/sn9c102_ov7630.c +++ b/drivers/staging/media/sn9c102/sn9c102_ov7630.c @@ -23,7 +23,7 @@ #include "sn9c102_devtable.h" -static int ov7630_init(struct sn9c102_device* cam) +static int ov7630_init(struct sn9c102_device *cam) { int err = 0; @@ -252,8 +252,8 @@ static int ov7630_init(struct sn9c102_device* cam) } -static int ov7630_get_ctrl(struct sn9c102_device* cam, - struct v4l2_control* ctrl) +static int ov7630_get_ctrl(struct sn9c102_device *cam, + struct v4l2_control *ctrl) { enum sn9c102_bridge bridge = sn9c102_get_bridge(cam); int err = 0; @@ -330,8 +330,8 @@ static int ov7630_get_ctrl(struct sn9c102_device* cam, } -static int ov7630_set_ctrl(struct sn9c102_device* cam, - const struct v4l2_control* ctrl) +static int ov7630_set_ctrl(struct sn9c102_device *cam, + const struct v4l2_control *ctrl) { enum sn9c102_bridge bridge = sn9c102_get_bridge(cam); int err = 0; @@ -385,10 +385,10 @@ static int ov7630_set_ctrl(struct sn9c102_device* cam, } -static int ov7630_set_crop(struct sn9c102_device* cam, - const struct v4l2_rect* rect) +static int ov7630_set_crop(struct sn9c102_device *cam, + const struct v4l2_rect *rect) { - struct sn9c102_sensor* s = sn9c102_get_sensor(cam); + struct sn9c102_sensor *s = sn9c102_get_sensor(cam); int err = 0; u8 h_start = 0, v_start = (u8)(rect->top - s->cropcap.bounds.top) + 1; @@ -413,8 +413,8 @@ static int ov7630_set_crop(struct sn9c102_device* cam, } -static int ov7630_set_pix_format(struct sn9c102_device* cam, - const struct v4l2_pix_format* pix) +static int ov7630_set_pix_format(struct sn9c102_device *cam, + const struct v4l2_pix_format *pix) { int err = 0; @@ -594,7 +594,7 @@ static const struct sn9c102_sensor ov7630 = { }; -int sn9c102_probe_ov7630(struct sn9c102_device* cam) +int sn9c102_probe_ov7630(struct sn9c102_device *cam) { int pid, ver, err = 0; diff --git a/drivers/staging/media/sn9c102/sn9c102_ov7660.c b/drivers/staging/media/sn9c102/sn9c102_ov7660.c index 530157a234e6..ac07805d122e 100644 --- a/drivers/staging/media/sn9c102/sn9c102_ov7660.c +++ b/drivers/staging/media/sn9c102/sn9c102_ov7660.c @@ -23,7 +23,7 @@ #include "sn9c102_devtable.h" -static int ov7660_init(struct sn9c102_device* cam) +static int ov7660_init(struct sn9c102_device *cam) { int err = 0; @@ -271,8 +271,8 @@ static int ov7660_init(struct sn9c102_device* cam) } -static int ov7660_get_ctrl(struct sn9c102_device* cam, - struct v4l2_control* ctrl) +static int ov7660_get_ctrl(struct sn9c102_device *cam, + struct v4l2_control *ctrl) { int err = 0; @@ -332,8 +332,8 @@ static int ov7660_get_ctrl(struct sn9c102_device* cam, } -static int ov7660_set_ctrl(struct sn9c102_device* cam, - const struct v4l2_control* ctrl) +static int ov7660_set_ctrl(struct sn9c102_device *cam, + const struct v4l2_control *ctrl) { int err = 0; @@ -371,10 +371,10 @@ static int ov7660_set_ctrl(struct sn9c102_device* cam, } -static int ov7660_set_crop(struct sn9c102_device* cam, - const struct v4l2_rect* rect) +static int ov7660_set_crop(struct sn9c102_device *cam, + const struct v4l2_rect *rect) { - struct sn9c102_sensor* s = sn9c102_get_sensor(cam); + struct sn9c102_sensor *s = sn9c102_get_sensor(cam); int err = 0; u8 h_start = (u8)(rect->left - s->cropcap.bounds.left) + 1, v_start = (u8)(rect->top - s->cropcap.bounds.top) + 1; @@ -386,8 +386,8 @@ static int ov7660_set_crop(struct sn9c102_device* cam, } -static int ov7660_set_pix_format(struct sn9c102_device* cam, - const struct v4l2_pix_format* pix) +static int ov7660_set_pix_format(struct sn9c102_device *cam, + const struct v4l2_pix_format *pix) { int r0, err = 0; @@ -525,7 +525,7 @@ static const struct sn9c102_sensor ov7660 = { }; -int sn9c102_probe_ov7660(struct sn9c102_device* cam) +int sn9c102_probe_ov7660(struct sn9c102_device *cam) { int pid, ver, err; diff --git a/drivers/staging/media/sn9c102/sn9c102_pas106b.c b/drivers/staging/media/sn9c102/sn9c102_pas106b.c index 47bd82de80f9..895931ecac48 100644 --- a/drivers/staging/media/sn9c102/sn9c102_pas106b.c +++ b/drivers/staging/media/sn9c102/sn9c102_pas106b.c @@ -24,7 +24,7 @@ #include "sn9c102_devtable.h" -static int pas106b_init(struct sn9c102_device* cam) +static int pas106b_init(struct sn9c102_device *cam) { int err = 0; @@ -48,8 +48,8 @@ static int pas106b_init(struct sn9c102_device* cam) } -static int pas106b_get_ctrl(struct sn9c102_device* cam, - struct v4l2_control* ctrl) +static int pas106b_get_ctrl(struct sn9c102_device *cam, + struct v4l2_control *ctrl) { switch (ctrl->id) { case V4L2_CID_EXPOSURE: @@ -103,8 +103,8 @@ static int pas106b_get_ctrl(struct sn9c102_device* cam, } -static int pas106b_set_ctrl(struct sn9c102_device* cam, - const struct v4l2_control* ctrl) +static int pas106b_set_ctrl(struct sn9c102_device *cam, + const struct v4l2_control *ctrl) { int err = 0; @@ -141,10 +141,10 @@ static int pas106b_set_ctrl(struct sn9c102_device* cam, } -static int pas106b_set_crop(struct sn9c102_device* cam, - const struct v4l2_rect* rect) +static int pas106b_set_crop(struct sn9c102_device *cam, + const struct v4l2_rect *rect) { - struct sn9c102_sensor* s = sn9c102_get_sensor(cam); + struct sn9c102_sensor *s = sn9c102_get_sensor(cam); int err = 0; u8 h_start = (u8)(rect->left - s->cropcap.bounds.left) + 4, v_start = (u8)(rect->top - s->cropcap.bounds.top) + 3; @@ -156,8 +156,8 @@ static int pas106b_set_crop(struct sn9c102_device* cam, } -static int pas106b_set_pix_format(struct sn9c102_device* cam, - const struct v4l2_pix_format* pix) +static int pas106b_set_pix_format(struct sn9c102_device *cam, + const struct v4l2_pix_format *pix) { int err = 0; @@ -278,7 +278,7 @@ static const struct sn9c102_sensor pas106b = { }; -int sn9c102_probe_pas106b(struct sn9c102_device* cam) +int sn9c102_probe_pas106b(struct sn9c102_device *cam) { int r0 = 0, r1 = 0; unsigned int pid = 0; diff --git a/drivers/staging/media/sn9c102/sn9c102_pas202bcb.c b/drivers/staging/media/sn9c102/sn9c102_pas202bcb.c index cbfacc2dad84..f9e31ae2ad9f 100644 --- a/drivers/staging/media/sn9c102/sn9c102_pas202bcb.c +++ b/drivers/staging/media/sn9c102/sn9c102_pas202bcb.c @@ -28,7 +28,7 @@ #include "sn9c102_devtable.h" -static int pas202bcb_init(struct sn9c102_device* cam) +static int pas202bcb_init(struct sn9c102_device *cam) { int err = 0; @@ -78,8 +78,8 @@ static int pas202bcb_init(struct sn9c102_device* cam) } -static int pas202bcb_get_ctrl(struct sn9c102_device* cam, - struct v4l2_control* ctrl) +static int pas202bcb_get_ctrl(struct sn9c102_device *cam, + struct v4l2_control *ctrl) { switch (ctrl->id) { case V4L2_CID_EXPOSURE: @@ -126,8 +126,8 @@ static int pas202bcb_get_ctrl(struct sn9c102_device* cam, } -static int pas202bcb_set_pix_format(struct sn9c102_device* cam, - const struct v4l2_pix_format* pix) +static int pas202bcb_set_pix_format(struct sn9c102_device *cam, + const struct v4l2_pix_format *pix) { int err = 0; @@ -140,8 +140,8 @@ static int pas202bcb_set_pix_format(struct sn9c102_device* cam, } -static int pas202bcb_set_ctrl(struct sn9c102_device* cam, - const struct v4l2_control* ctrl) +static int pas202bcb_set_ctrl(struct sn9c102_device *cam, + const struct v4l2_control *ctrl) { int err = 0; @@ -174,10 +174,10 @@ static int pas202bcb_set_ctrl(struct sn9c102_device* cam, } -static int pas202bcb_set_crop(struct sn9c102_device* cam, - const struct v4l2_rect* rect) +static int pas202bcb_set_crop(struct sn9c102_device *cam, + const struct v4l2_rect *rect) { - struct sn9c102_sensor* s = sn9c102_get_sensor(cam); + struct sn9c102_sensor *s = sn9c102_get_sensor(cam); int err = 0; u8 h_start = 0, v_start = (u8)(rect->top - s->cropcap.bounds.top) + 3; @@ -299,7 +299,7 @@ static const struct sn9c102_sensor pas202bcb = { }; -int sn9c102_probe_pas202bcb(struct sn9c102_device* cam) +int sn9c102_probe_pas202bcb(struct sn9c102_device *cam) { int r0 = 0, r1 = 0, err = 0; unsigned int pid = 0; diff --git a/drivers/staging/media/sn9c102/sn9c102_sensor.h b/drivers/staging/media/sn9c102/sn9c102_sensor.h index 3679970dba2c..9f59c815d48b 100644 --- a/drivers/staging/media/sn9c102/sn9c102_sensor.h +++ b/drivers/staging/media/sn9c102/sn9c102_sensor.h @@ -62,19 +62,19 @@ enum sn9c102_bridge { }; /* Return the bridge name */ -enum sn9c102_bridge sn9c102_get_bridge(struct sn9c102_device* cam); +enum sn9c102_bridge sn9c102_get_bridge(struct sn9c102_device *cam); /* Return a pointer the sensor struct attached to the camera */ -struct sn9c102_sensor* sn9c102_get_sensor(struct sn9c102_device* cam); +struct sn9c102_sensor *sn9c102_get_sensor(struct sn9c102_device *cam); /* Identify a device */ extern struct sn9c102_device* -sn9c102_match_id(struct sn9c102_device* cam, const struct usb_device_id *id); +sn9c102_match_id(struct sn9c102_device *cam, const struct usb_device_id *id); /* Attach a probed sensor to the camera. */ extern void -sn9c102_attach_sensor(struct sn9c102_device* cam, - const struct sn9c102_sensor* sensor); +sn9c102_attach_sensor(struct sn9c102_device *cam, + const struct sn9c102_sensor *sensor); /* Read/write routines: they always return -1 on error, 0 or the read value @@ -99,12 +99,12 @@ extern int sn9c102_i2c_try_read(struct sn9c102_device*, version returns 0 on success, while the read version returns the first read byte. */ -extern int sn9c102_i2c_try_raw_write(struct sn9c102_device* cam, - const struct sn9c102_sensor* sensor, u8 n, +extern int sn9c102_i2c_try_raw_write(struct sn9c102_device *cam, + const struct sn9c102_sensor *sensor, u8 n, u8 data0, u8 data1, u8 data2, u8 data3, u8 data4, u8 data5); -extern int sn9c102_i2c_try_raw_read(struct sn9c102_device* cam, - const struct sn9c102_sensor* sensor, +extern int sn9c102_i2c_try_raw_read(struct sn9c102_device *cam, + const struct sn9c102_sensor *sensor, u8 data0, u8 data1, u8 n, u8 buffer[]); /* To be used after the sensor struct has been attached to the camera struct */ @@ -174,7 +174,7 @@ struct sn9c102_sensor { they must return 0 on success, the proper error otherwise. */ - int (*init)(struct sn9c102_device* cam); + int (*init)(struct sn9c102_device *cam); /* This function will be called after the sensor has been attached. It should be used to initialize the sensor only, but may also @@ -195,9 +195,9 @@ struct sn9c102_sensor { V4L2 API. Menu type controls are not handled by this interface. */ - int (*get_ctrl)(struct sn9c102_device* cam, struct v4l2_control* ctrl); - int (*set_ctrl)(struct sn9c102_device* cam, - const struct v4l2_control* ctrl); + int (*get_ctrl)(struct sn9c102_device *cam, struct v4l2_control *ctrl); + int (*set_ctrl)(struct sn9c102_device *cam, + const struct v4l2_control *ctrl); /* You must implement at least the set_ctrl method if you have defined the list above. The returned value must follow the V4L2 @@ -240,8 +240,8 @@ struct sn9c102_sensor { will be ignored. */ - int (*set_crop)(struct sn9c102_device* cam, - const struct v4l2_rect* rect); + int (*set_crop)(struct sn9c102_device *cam, + const struct v4l2_rect *rect); /* To be called on VIDIOC_C_SETCROP. The core module always calls a default routine which configures the appropriate SN9C1XX regs (also @@ -276,8 +276,8 @@ struct sn9c102_sensor { matches the RGB bayer sequence (i.e. BGBGBG...GRGRGR). */ - int (*set_pix_format)(struct sn9c102_device* cam, - const struct v4l2_pix_format* pix); + int (*set_pix_format)(struct sn9c102_device *cam, + const struct v4l2_pix_format *pix); /* To be called on VIDIOC_S_FMT, when switching from the SBGGR8 to SN9C10X pixel format or viceversa. On error return the corresponding diff --git a/drivers/staging/media/sn9c102/sn9c102_tas5110c1b.c b/drivers/staging/media/sn9c102/sn9c102_tas5110c1b.c index 04cdfdde8564..6a00b626d347 100644 --- a/drivers/staging/media/sn9c102/sn9c102_tas5110c1b.c +++ b/drivers/staging/media/sn9c102/sn9c102_tas5110c1b.c @@ -23,7 +23,7 @@ #include "sn9c102_devtable.h" -static int tas5110c1b_init(struct sn9c102_device* cam) +static int tas5110c1b_init(struct sn9c102_device *cam) { int err = 0; @@ -38,8 +38,8 @@ static int tas5110c1b_init(struct sn9c102_device* cam) } -static int tas5110c1b_set_ctrl(struct sn9c102_device* cam, - const struct v4l2_control* ctrl) +static int tas5110c1b_set_ctrl(struct sn9c102_device *cam, + const struct v4l2_control *ctrl) { int err = 0; @@ -55,10 +55,10 @@ static int tas5110c1b_set_ctrl(struct sn9c102_device* cam, } -static int tas5110c1b_set_crop(struct sn9c102_device* cam, - const struct v4l2_rect* rect) +static int tas5110c1b_set_crop(struct sn9c102_device *cam, + const struct v4l2_rect *rect) { - struct sn9c102_sensor* s = sn9c102_get_sensor(cam); + struct sn9c102_sensor *s = sn9c102_get_sensor(cam); int err = 0; u8 h_start = (u8)(rect->left - s->cropcap.bounds.left) + 69, v_start = (u8)(rect->top - s->cropcap.bounds.top) + 9; @@ -75,8 +75,8 @@ static int tas5110c1b_set_crop(struct sn9c102_device* cam, } -static int tas5110c1b_set_pix_format(struct sn9c102_device* cam, - const struct v4l2_pix_format* pix) +static int tas5110c1b_set_pix_format(struct sn9c102_device *cam, + const struct v4l2_pix_format *pix) { int err = 0; @@ -135,7 +135,7 @@ static const struct sn9c102_sensor tas5110c1b = { }; -int sn9c102_probe_tas5110c1b(struct sn9c102_device* cam) +int sn9c102_probe_tas5110c1b(struct sn9c102_device *cam) { const struct usb_device_id tas5110c1b_id_table[] = { { USB_DEVICE(0x0c45, 0x6001), }, diff --git a/drivers/staging/media/sn9c102/sn9c102_tas5110d.c b/drivers/staging/media/sn9c102/sn9c102_tas5110d.c index 9372e6f9fcff..eefbf8670c3e 100644 --- a/drivers/staging/media/sn9c102/sn9c102_tas5110d.c +++ b/drivers/staging/media/sn9c102/sn9c102_tas5110d.c @@ -23,7 +23,7 @@ #include "sn9c102_devtable.h" -static int tas5110d_init(struct sn9c102_device* cam) +static int tas5110d_init(struct sn9c102_device *cam) { int err; @@ -37,10 +37,10 @@ static int tas5110d_init(struct sn9c102_device* cam) } -static int tas5110d_set_crop(struct sn9c102_device* cam, - const struct v4l2_rect* rect) +static int tas5110d_set_crop(struct sn9c102_device *cam, + const struct v4l2_rect *rect) { - struct sn9c102_sensor* s = sn9c102_get_sensor(cam); + struct sn9c102_sensor *s = sn9c102_get_sensor(cam); int err = 0; u8 h_start = (u8)(rect->left - s->cropcap.bounds.left) + 69, v_start = (u8)(rect->top - s->cropcap.bounds.top) + 9; @@ -55,8 +55,8 @@ static int tas5110d_set_crop(struct sn9c102_device* cam, } -static int tas5110d_set_pix_format(struct sn9c102_device* cam, - const struct v4l2_pix_format* pix) +static int tas5110d_set_pix_format(struct sn9c102_device *cam, + const struct v4l2_pix_format *pix) { int err = 0; @@ -103,7 +103,7 @@ static const struct sn9c102_sensor tas5110d = { }; -int sn9c102_probe_tas5110d(struct sn9c102_device* cam) +int sn9c102_probe_tas5110d(struct sn9c102_device *cam) { const struct usb_device_id tas5110d_id_table[] = { { USB_DEVICE(0x0c45, 0x6007), }, diff --git a/drivers/staging/media/sn9c102/sn9c102_tas5130d1b.c b/drivers/staging/media/sn9c102/sn9c102_tas5130d1b.c index a30bbc4389f5..725de857de45 100644 --- a/drivers/staging/media/sn9c102/sn9c102_tas5130d1b.c +++ b/drivers/staging/media/sn9c102/sn9c102_tas5130d1b.c @@ -23,7 +23,7 @@ #include "sn9c102_devtable.h" -static int tas5130d1b_init(struct sn9c102_device* cam) +static int tas5130d1b_init(struct sn9c102_device *cam) { int err; @@ -36,8 +36,8 @@ static int tas5130d1b_init(struct sn9c102_device* cam) } -static int tas5130d1b_set_ctrl(struct sn9c102_device* cam, - const struct v4l2_control* ctrl) +static int tas5130d1b_set_ctrl(struct sn9c102_device *cam, + const struct v4l2_control *ctrl) { int err = 0; @@ -56,10 +56,10 @@ static int tas5130d1b_set_ctrl(struct sn9c102_device* cam, } -static int tas5130d1b_set_crop(struct sn9c102_device* cam, - const struct v4l2_rect* rect) +static int tas5130d1b_set_crop(struct sn9c102_device *cam, + const struct v4l2_rect *rect) { - struct sn9c102_sensor* s = sn9c102_get_sensor(cam); + struct sn9c102_sensor *s = sn9c102_get_sensor(cam); u8 h_start = (u8)(rect->left - s->cropcap.bounds.left) + 104, v_start = (u8)(rect->top - s->cropcap.bounds.top) + 12; int err = 0; @@ -76,8 +76,8 @@ static int tas5130d1b_set_crop(struct sn9c102_device* cam, } -static int tas5130d1b_set_pix_format(struct sn9c102_device* cam, - const struct v4l2_pix_format* pix) +static int tas5130d1b_set_pix_format(struct sn9c102_device *cam, + const struct v4l2_pix_format *pix) { int err = 0; @@ -146,7 +146,7 @@ static const struct sn9c102_sensor tas5130d1b = { }; -int sn9c102_probe_tas5130d1b(struct sn9c102_device* cam) +int sn9c102_probe_tas5130d1b(struct sn9c102_device *cam) { const struct usb_device_id tas5130d1b_id_table[] = { { USB_DEVICE(0x0c45, 0x6024), }, diff --git a/drivers/staging/media/solo6x10/Kconfig b/drivers/staging/media/solo6x10/Kconfig index 9a4296c2e3ab..6a1906fa1117 100644 --- a/drivers/staging/media/solo6x10/Kconfig +++ b/drivers/staging/media/solo6x10/Kconfig @@ -1,5 +1,5 @@ config SOLO6X10 - tristate "Softlogic 6x10 MPEG codec cards" + tristate "Bluecherry / Softlogic 6x10 capture cards (MPEG-4/H.264)" depends on PCI && VIDEO_DEV && SND && I2C select FONT_SUPPORT select FONT_8x16 @@ -8,5 +8,11 @@ config SOLO6X10 select SND_PCM select FONT_8x16 ---help--- - This driver supports the Softlogic based MPEG-4 and h.264 codec - cards. + This driver supports the Bluecherry H.264 and MPEG-4 hardware + compression capture cards and other Softlogic-based ones. + + Following cards have been tested: + * Bluecherry BC-H16480A (PCIe, 16 port, H.264) + * Bluecherry BC-H04120A (PCIe, 4 port, H.264) + * Bluecherry BC-H04120A-MPCI (Mini-PCI, 4 port, H.264) + * Bluecherry BC-04120A (PCIe, 4 port, MPEG-4) diff --git a/drivers/staging/media/solo6x10/solo6x10-enc.c b/drivers/staging/media/solo6x10/solo6x10-enc.c index 94d5735abf85..2db53b68c62f 100644 --- a/drivers/staging/media/solo6x10/solo6x10-enc.c +++ b/drivers/staging/media/solo6x10/solo6x10-enc.c @@ -134,51 +134,48 @@ static void solo_capture_config(struct solo_dev *solo_dev) kfree(buf); } +#define SOLO_OSD_WRITE_SIZE (16 * OSD_TEXT_MAX) + /* Should be called with enable_lock held */ int solo_osd_print(struct solo_enc_dev *solo_enc) { struct solo_dev *solo_dev = solo_enc->solo_dev; unsigned char *str = solo_enc->osd_text; u8 *buf = solo_enc->osd_buf; - u32 reg = solo_reg_read(solo_dev, SOLO_VE_OSD_CH); + u32 reg; const struct font_desc *vga = find_font("VGA8x16"); const unsigned char *vga_data; - int len; int i, j; if (WARN_ON_ONCE(!vga)) return -ENODEV; - len = strlen(str); - - if (len == 0) { + reg = solo_reg_read(solo_dev, SOLO_VE_OSD_CH); + if (!*str) { /* Disable OSD on this channel */ reg &= ~(1 << solo_enc->ch); - solo_reg_write(solo_dev, SOLO_VE_OSD_CH, reg); - return 0; + goto out; } - memset(buf, 0, SOLO_EOSD_EXT_SIZE_MAX); + memset(buf, 0, SOLO_OSD_WRITE_SIZE); vga_data = (const unsigned char *)vga->data; - for (i = 0; i < len; i++) { - unsigned char c = str[i]; - + for (i = 0; *str; i++, str++) { for (j = 0; j < 16; j++) { - buf[(j * 2) + (i % 2) + (i / 2 * 32)] = - bitrev8(vga_data[(c * 16) + j]); + buf[(j << 1) | (i & 1) | ((i & ~1) << 4)] = + bitrev8(vga_data[(*str << 4) | j]); } } solo_p2m_dma(solo_dev, 1, buf, - SOLO_EOSD_EXT_ADDR + - (solo_enc->ch * SOLO_EOSD_EXT_SIZE(solo_dev)), - SOLO_EOSD_EXT_SIZE(solo_dev), 0, 0); + SOLO_EOSD_EXT_ADDR_CHAN(solo_dev, solo_enc->ch), + SOLO_OSD_WRITE_SIZE, 0, 0); /* Enable OSD on this channel */ reg |= (1 << solo_enc->ch); - solo_reg_write(solo_dev, SOLO_VE_OSD_CH, reg); +out: + solo_reg_write(solo_dev, SOLO_VE_OSD_CH, reg); return 0; } diff --git a/drivers/staging/media/solo6x10/solo6x10-offsets.h b/drivers/staging/media/solo6x10/solo6x10-offsets.h index f005dca501f1..13eeb4470dcf 100644 --- a/drivers/staging/media/solo6x10/solo6x10-offsets.h +++ b/drivers/staging/media/solo6x10/solo6x10-offsets.h @@ -35,6 +35,8 @@ #define SOLO_EOSD_EXT_SIZE_MAX 0x20000 #define SOLO_EOSD_EXT_AREA(__solo) \ (SOLO_EOSD_EXT_SIZE(__solo) * 32) +#define SOLO_EOSD_EXT_ADDR_CHAN(__solo, ch) \ + (SOLO_EOSD_EXT_ADDR + SOLO_EOSD_EXT_SIZE(__solo) * (ch)) #define SOLO_MOTION_EXT_ADDR(__solo) \ (SOLO_EOSD_EXT_ADDR + SOLO_EOSD_EXT_AREA(__solo)) diff --git a/drivers/staging/media/solo6x10/solo6x10-v4l2-enc.c b/drivers/staging/media/solo6x10/solo6x10-v4l2-enc.c index 2cbe088f1697..b8ff113c20f4 100644 --- a/drivers/staging/media/solo6x10/solo6x10-v4l2-enc.c +++ b/drivers/staging/media/solo6x10/solo6x10-v4l2-enc.c @@ -745,14 +745,13 @@ static int solo_enc_start_streaming(struct vb2_queue *q, unsigned int count) return solo_ring_start(solo_enc->solo_dev); } -static int solo_enc_stop_streaming(struct vb2_queue *q) +static void solo_enc_stop_streaming(struct vb2_queue *q) { struct solo_enc_dev *solo_enc = vb2_get_drv_priv(q); solo_enc_off(solo_enc); INIT_LIST_HEAD(&solo_enc->vidq_active); solo_ring_stop(solo_enc->solo_dev); - return 0; } static struct vb2_ops solo_enc_video_qops = { diff --git a/drivers/staging/media/solo6x10/solo6x10-v4l2.c b/drivers/staging/media/solo6x10/solo6x10-v4l2.c index 1815f765d033..5d0100eb38e6 100644 --- a/drivers/staging/media/solo6x10/solo6x10-v4l2.c +++ b/drivers/staging/media/solo6x10/solo6x10-v4l2.c @@ -336,13 +336,12 @@ static int solo_start_streaming(struct vb2_queue *q, unsigned int count) return solo_start_thread(solo_dev); } -static int solo_stop_streaming(struct vb2_queue *q) +static void solo_stop_streaming(struct vb2_queue *q) { struct solo_dev *solo_dev = vb2_get_drv_priv(q); solo_stop_thread(solo_dev); INIT_LIST_HEAD(&solo_dev->vidq_active); - return 0; } static void solo_buf_queue(struct vb2_buffer *vb) |