diff options
| -rw-r--r-- | drivers/media/video/cx88/cx88-input.c | 2 | ||||
| -rw-r--r-- | drivers/media/video/soc_camera.c | 48 | ||||
| -rw-r--r-- | drivers/media/video/v4l2-device.c | 5 | ||||
| -rw-r--r-- | drivers/media/video/v4l2-subdev.c | 14 |
4 files changed, 54 insertions, 15 deletions
diff --git a/drivers/media/video/cx88/cx88-input.c b/drivers/media/video/cx88/cx88-input.c index c820e2f53527..3f442003623d 100644 --- a/drivers/media/video/cx88/cx88-input.c +++ b/drivers/media/video/cx88/cx88-input.c | |||
| @@ -524,7 +524,7 @@ void cx88_ir_irq(struct cx88_core *core) | |||
| 524 | for (todo = 32; todo > 0; todo -= bits) { | 524 | for (todo = 32; todo > 0; todo -= bits) { |
| 525 | ev.pulse = samples & 0x80000000 ? false : true; | 525 | ev.pulse = samples & 0x80000000 ? false : true; |
| 526 | bits = min(todo, 32U - fls(ev.pulse ? samples : ~samples)); | 526 | bits = min(todo, 32U - fls(ev.pulse ? samples : ~samples)); |
| 527 | ev.duration = (bits * NSEC_PER_SEC) / (1000 * ir_samplerate); | 527 | ev.duration = (bits * (NSEC_PER_SEC / 1000)) / ir_samplerate; |
| 528 | ir_raw_event_store_with_filter(ir->dev, &ev); | 528 | ir_raw_event_store_with_filter(ir->dev, &ev); |
| 529 | samples <<= bits; | 529 | samples <<= bits; |
| 530 | } | 530 | } |
diff --git a/drivers/media/video/soc_camera.c b/drivers/media/video/soc_camera.c index 3973f9a94753..ddb4c091dedc 100644 --- a/drivers/media/video/soc_camera.c +++ b/drivers/media/video/soc_camera.c | |||
| @@ -136,11 +136,50 @@ unsigned long soc_camera_apply_sensor_flags(struct soc_camera_link *icl, | |||
| 136 | } | 136 | } |
| 137 | EXPORT_SYMBOL(soc_camera_apply_sensor_flags); | 137 | EXPORT_SYMBOL(soc_camera_apply_sensor_flags); |
| 138 | 138 | ||
| 139 | #define pixfmtstr(x) (x) & 0xff, ((x) >> 8) & 0xff, ((x) >> 16) & 0xff, \ | ||
| 140 | ((x) >> 24) & 0xff | ||
| 141 | |||
| 142 | static int soc_camera_try_fmt(struct soc_camera_device *icd, | ||
| 143 | struct v4l2_format *f) | ||
| 144 | { | ||
| 145 | struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); | ||
| 146 | struct v4l2_pix_format *pix = &f->fmt.pix; | ||
| 147 | int ret; | ||
| 148 | |||
| 149 | dev_dbg(&icd->dev, "TRY_FMT(%c%c%c%c, %ux%u)\n", | ||
| 150 | pixfmtstr(pix->pixelformat), pix->width, pix->height); | ||
| 151 | |||
| 152 | pix->bytesperline = 0; | ||
| 153 | pix->sizeimage = 0; | ||
| 154 | |||
| 155 | ret = ici->ops->try_fmt(icd, f); | ||
| 156 | if (ret < 0) | ||
| 157 | return ret; | ||
| 158 | |||
| 159 | if (!pix->sizeimage) { | ||
| 160 | if (!pix->bytesperline) { | ||
| 161 | const struct soc_camera_format_xlate *xlate; | ||
| 162 | |||
| 163 | xlate = soc_camera_xlate_by_fourcc(icd, pix->pixelformat); | ||
| 164 | if (!xlate) | ||
| 165 | return -EINVAL; | ||
| 166 | |||
| 167 | ret = soc_mbus_bytes_per_line(pix->width, | ||
| 168 | xlate->host_fmt); | ||
| 169 | if (ret > 0) | ||
| 170 | pix->bytesperline = ret; | ||
| 171 | } | ||
| 172 | if (pix->bytesperline) | ||
| 173 | pix->sizeimage = pix->bytesperline * pix->height; | ||
| 174 | } | ||
| 175 | |||
| 176 | return 0; | ||
| 177 | } | ||
| 178 | |||
| 139 | static int soc_camera_try_fmt_vid_cap(struct file *file, void *priv, | 179 | static int soc_camera_try_fmt_vid_cap(struct file *file, void *priv, |
| 140 | struct v4l2_format *f) | 180 | struct v4l2_format *f) |
| 141 | { | 181 | { |
| 142 | struct soc_camera_device *icd = file->private_data; | 182 | struct soc_camera_device *icd = file->private_data; |
| 143 | struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); | ||
| 144 | 183 | ||
| 145 | WARN_ON(priv != file->private_data); | 184 | WARN_ON(priv != file->private_data); |
| 146 | 185 | ||
| @@ -149,7 +188,7 @@ static int soc_camera_try_fmt_vid_cap(struct file *file, void *priv, | |||
| 149 | return -EINVAL; | 188 | return -EINVAL; |
| 150 | 189 | ||
| 151 | /* limit format to hardware capabilities */ | 190 | /* limit format to hardware capabilities */ |
| 152 | return ici->ops->try_fmt(icd, f); | 191 | return soc_camera_try_fmt(icd, f); |
| 153 | } | 192 | } |
| 154 | 193 | ||
| 155 | static int soc_camera_enum_input(struct file *file, void *priv, | 194 | static int soc_camera_enum_input(struct file *file, void *priv, |
| @@ -362,9 +401,6 @@ static void soc_camera_free_user_formats(struct soc_camera_device *icd) | |||
| 362 | icd->user_formats = NULL; | 401 | icd->user_formats = NULL; |
| 363 | } | 402 | } |
| 364 | 403 | ||
| 365 | #define pixfmtstr(x) (x) & 0xff, ((x) >> 8) & 0xff, ((x) >> 16) & 0xff, \ | ||
| 366 | ((x) >> 24) & 0xff | ||
| 367 | |||
| 368 | /* Called with .vb_lock held, or from the first open(2), see comment there */ | 404 | /* Called with .vb_lock held, or from the first open(2), see comment there */ |
| 369 | static int soc_camera_set_fmt(struct soc_camera_device *icd, | 405 | static int soc_camera_set_fmt(struct soc_camera_device *icd, |
| 370 | struct v4l2_format *f) | 406 | struct v4l2_format *f) |
| @@ -377,7 +413,7 @@ static int soc_camera_set_fmt(struct soc_camera_device *icd, | |||
| 377 | pixfmtstr(pix->pixelformat), pix->width, pix->height); | 413 | pixfmtstr(pix->pixelformat), pix->width, pix->height); |
| 378 | 414 | ||
| 379 | /* We always call try_fmt() before set_fmt() or set_crop() */ | 415 | /* We always call try_fmt() before set_fmt() or set_crop() */ |
| 380 | ret = ici->ops->try_fmt(icd, f); | 416 | ret = soc_camera_try_fmt(icd, f); |
| 381 | if (ret < 0) | 417 | if (ret < 0) |
| 382 | return ret; | 418 | return ret; |
| 383 | 419 | ||
diff --git a/drivers/media/video/v4l2-device.c b/drivers/media/video/v4l2-device.c index 5aeaf876ba9b..4aae501f02d0 100644 --- a/drivers/media/video/v4l2-device.c +++ b/drivers/media/video/v4l2-device.c | |||
| @@ -155,8 +155,10 @@ int v4l2_device_register_subdev(struct v4l2_device *v4l2_dev, | |||
| 155 | sd->v4l2_dev = v4l2_dev; | 155 | sd->v4l2_dev = v4l2_dev; |
| 156 | if (sd->internal_ops && sd->internal_ops->registered) { | 156 | if (sd->internal_ops && sd->internal_ops->registered) { |
| 157 | err = sd->internal_ops->registered(sd); | 157 | err = sd->internal_ops->registered(sd); |
| 158 | if (err) | 158 | if (err) { |
| 159 | module_put(sd->owner); | ||
| 159 | return err; | 160 | return err; |
| 161 | } | ||
| 160 | } | 162 | } |
| 161 | 163 | ||
| 162 | /* This just returns 0 if either of the two args is NULL */ | 164 | /* This just returns 0 if either of the two args is NULL */ |
| @@ -164,6 +166,7 @@ int v4l2_device_register_subdev(struct v4l2_device *v4l2_dev, | |||
| 164 | if (err) { | 166 | if (err) { |
| 165 | if (sd->internal_ops && sd->internal_ops->unregistered) | 167 | if (sd->internal_ops && sd->internal_ops->unregistered) |
| 166 | sd->internal_ops->unregistered(sd); | 168 | sd->internal_ops->unregistered(sd); |
| 169 | module_put(sd->owner); | ||
| 167 | return err; | 170 | return err; |
| 168 | } | 171 | } |
| 169 | 172 | ||
diff --git a/drivers/media/video/v4l2-subdev.c b/drivers/media/video/v4l2-subdev.c index 0b8064490676..812729ebf09e 100644 --- a/drivers/media/video/v4l2-subdev.c +++ b/drivers/media/video/v4l2-subdev.c | |||
| @@ -155,25 +155,25 @@ static long subdev_do_ioctl(struct file *file, unsigned int cmd, void *arg) | |||
| 155 | 155 | ||
| 156 | switch (cmd) { | 156 | switch (cmd) { |
| 157 | case VIDIOC_QUERYCTRL: | 157 | case VIDIOC_QUERYCTRL: |
| 158 | return v4l2_subdev_queryctrl(sd, arg); | 158 | return v4l2_queryctrl(sd->ctrl_handler, arg); |
| 159 | 159 | ||
| 160 | case VIDIOC_QUERYMENU: | 160 | case VIDIOC_QUERYMENU: |
| 161 | return v4l2_subdev_querymenu(sd, arg); | 161 | return v4l2_querymenu(sd->ctrl_handler, arg); |
| 162 | 162 | ||
| 163 | case VIDIOC_G_CTRL: | 163 | case VIDIOC_G_CTRL: |
| 164 | return v4l2_subdev_g_ctrl(sd, arg); | 164 | return v4l2_g_ctrl(sd->ctrl_handler, arg); |
| 165 | 165 | ||
| 166 | case VIDIOC_S_CTRL: | 166 | case VIDIOC_S_CTRL: |
| 167 | return v4l2_subdev_s_ctrl(sd, arg); | 167 | return v4l2_s_ctrl(sd->ctrl_handler, arg); |
| 168 | 168 | ||
| 169 | case VIDIOC_G_EXT_CTRLS: | 169 | case VIDIOC_G_EXT_CTRLS: |
| 170 | return v4l2_subdev_g_ext_ctrls(sd, arg); | 170 | return v4l2_g_ext_ctrls(sd->ctrl_handler, arg); |
| 171 | 171 | ||
| 172 | case VIDIOC_S_EXT_CTRLS: | 172 | case VIDIOC_S_EXT_CTRLS: |
| 173 | return v4l2_subdev_s_ext_ctrls(sd, arg); | 173 | return v4l2_s_ext_ctrls(sd->ctrl_handler, arg); |
| 174 | 174 | ||
| 175 | case VIDIOC_TRY_EXT_CTRLS: | 175 | case VIDIOC_TRY_EXT_CTRLS: |
| 176 | return v4l2_subdev_try_ext_ctrls(sd, arg); | 176 | return v4l2_try_ext_ctrls(sd->ctrl_handler, arg); |
| 177 | 177 | ||
| 178 | case VIDIOC_DQEVENT: | 178 | case VIDIOC_DQEVENT: |
| 179 | if (!(sd->flags & V4L2_SUBDEV_FL_HAS_EVENTS)) | 179 | if (!(sd->flags & V4L2_SUBDEV_FL_HAS_EVENTS)) |
