aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/video')
-rw-r--r--drivers/media/video/au0828/au0828-cards.c7
-rw-r--r--drivers/media/video/m5mols/m5mols.h2
-rw-r--r--drivers/media/video/m5mols/m5mols_core.c22
-rw-r--r--drivers/media/video/mt9m111.c1
-rw-r--r--drivers/media/video/mt9t112.c4
-rw-r--r--drivers/media/video/omap/omap_vout.c9
-rw-r--r--drivers/media/video/omap1_camera.c1
-rw-r--r--drivers/media/video/omap24xxcam-dma.c2
-rw-r--r--drivers/media/video/omap3isp/ispccdc.c2
-rw-r--r--drivers/media/video/omap3isp/ispstat.c2
-rw-r--r--drivers/media/video/omap3isp/ispvideo.c1
-rw-r--r--drivers/media/video/ov6650.c2
-rw-r--r--drivers/media/video/s5p-fimc/fimc-capture.c14
-rw-r--r--drivers/media/video/s5p-fimc/fimc-core.c24
-rw-r--r--drivers/media/video/s5p-fimc/fimc-core.h2
-rw-r--r--drivers/media/video/s5p-fimc/fimc-mdevice.c43
-rw-r--r--drivers/media/video/s5p-fimc/fimc-reg.c15
-rw-r--r--drivers/media/video/s5p-mfc/s5p_mfc_enc.c2
-rw-r--r--drivers/media/video/s5p-tv/mixer_video.c1
-rw-r--r--drivers/media/video/sh_mobile_ceu_camera.c34
-rw-r--r--drivers/media/video/sh_mobile_csi2.c4
-rw-r--r--drivers/media/video/soc_camera.c3
22 files changed, 124 insertions, 73 deletions
diff --git a/drivers/media/video/au0828/au0828-cards.c b/drivers/media/video/au0828/au0828-cards.c
index 39fc923fc46b..1c6015a04f96 100644
--- a/drivers/media/video/au0828/au0828-cards.c
+++ b/drivers/media/video/au0828/au0828-cards.c
@@ -162,11 +162,14 @@ static void hauppauge_eeprom(struct au0828_dev *dev, u8 *eeprom_data)
162 switch (tv.model) { 162 switch (tv.model) {
163 case 72000: /* WinTV-HVR950q (Retail, IR, ATSC/QAM */ 163 case 72000: /* WinTV-HVR950q (Retail, IR, ATSC/QAM */
164 case 72001: /* WinTV-HVR950q (Retail, IR, ATSC/QAM and analog video */ 164 case 72001: /* WinTV-HVR950q (Retail, IR, ATSC/QAM and analog video */
165 case 72101: /* WinTV-HVR950q (Retail, IR, ATSC/QAM and analog video */
166 case 72201: /* WinTV-HVR950q (OEM, IR, ATSC/QAM and analog video */
165 case 72211: /* WinTV-HVR950q (OEM, IR, ATSC/QAM and analog video */ 167 case 72211: /* WinTV-HVR950q (OEM, IR, ATSC/QAM and analog video */
166 case 72221: /* WinTV-HVR950q (OEM, IR, ATSC/QAM and analog video */ 168 case 72221: /* WinTV-HVR950q (OEM, IR, ATSC/QAM and analog video */
167 case 72231: /* WinTV-HVR950q (OEM, IR, ATSC/QAM and analog video */ 169 case 72231: /* WinTV-HVR950q (OEM, IR, ATSC/QAM and analog video */
168 case 72241: /* WinTV-HVR950q (OEM, No IR, ATSC/QAM and analog video */ 170 case 72241: /* WinTV-HVR950q (OEM, No IR, ATSC/QAM and analog video */
169 case 72251: /* WinTV-HVR950q (Retail, IR, ATSC/QAM and analog video */ 171 case 72251: /* WinTV-HVR950q (Retail, IR, ATSC/QAM and analog video */
172 case 72261: /* WinTV-HVR950q (OEM, IR, ATSC/QAM and analog video */
170 case 72301: /* WinTV-HVR850 (Retail, IR, ATSC and analog video */ 173 case 72301: /* WinTV-HVR850 (Retail, IR, ATSC and analog video */
171 case 72500: /* WinTV-HVR950q (OEM, No IR, ATSC/QAM */ 174 case 72500: /* WinTV-HVR950q (OEM, No IR, ATSC/QAM */
172 break; 175 break;
@@ -324,6 +327,10 @@ struct usb_device_id au0828_usb_id_table[] = {
324 .driver_info = AU0828_BOARD_HAUPPAUGE_HVR950Q_MXL }, 327 .driver_info = AU0828_BOARD_HAUPPAUGE_HVR950Q_MXL },
325 { USB_DEVICE(0x2040, 0x8200), 328 { USB_DEVICE(0x2040, 0x8200),
326 .driver_info = AU0828_BOARD_HAUPPAUGE_WOODBURY }, 329 .driver_info = AU0828_BOARD_HAUPPAUGE_WOODBURY },
330 { USB_DEVICE(0x2040, 0x7260),
331 .driver_info = AU0828_BOARD_HAUPPAUGE_HVR950Q },
332 { USB_DEVICE(0x2040, 0x7213),
333 .driver_info = AU0828_BOARD_HAUPPAUGE_HVR950Q },
327 { }, 334 { },
328}; 335};
329 336
diff --git a/drivers/media/video/m5mols/m5mols.h b/drivers/media/video/m5mols/m5mols.h
index 89d09a8914f8..82c8817bd32d 100644
--- a/drivers/media/video/m5mols/m5mols.h
+++ b/drivers/media/video/m5mols/m5mols.h
@@ -162,7 +162,6 @@ struct m5mols_version {
162 * @pad: media pad 162 * @pad: media pad
163 * @ffmt: current fmt according to resolution type 163 * @ffmt: current fmt according to resolution type
164 * @res_type: current resolution type 164 * @res_type: current resolution type
165 * @code: current code
166 * @irq_waitq: waitqueue for the capture 165 * @irq_waitq: waitqueue for the capture
167 * @work_irq: workqueue for the IRQ 166 * @work_irq: workqueue for the IRQ
168 * @flags: state variable for the interrupt handler 167 * @flags: state variable for the interrupt handler
@@ -192,7 +191,6 @@ struct m5mols_info {
192 struct media_pad pad; 191 struct media_pad pad;
193 struct v4l2_mbus_framefmt ffmt[M5MOLS_RESTYPE_MAX]; 192 struct v4l2_mbus_framefmt ffmt[M5MOLS_RESTYPE_MAX];
194 int res_type; 193 int res_type;
195 enum v4l2_mbus_pixelcode code;
196 wait_queue_head_t irq_waitq; 194 wait_queue_head_t irq_waitq;
197 struct work_struct work_irq; 195 struct work_struct work_irq;
198 unsigned long flags; 196 unsigned long flags;
diff --git a/drivers/media/video/m5mols/m5mols_core.c b/drivers/media/video/m5mols/m5mols_core.c
index 05ab3700647e..e0f09e531800 100644
--- a/drivers/media/video/m5mols/m5mols_core.c
+++ b/drivers/media/video/m5mols/m5mols_core.c
@@ -334,7 +334,7 @@ int m5mols_mode(struct m5mols_info *info, u8 mode)
334 int ret = -EINVAL; 334 int ret = -EINVAL;
335 u8 reg; 335 u8 reg;
336 336
337 if (mode < REG_PARAMETER && mode > REG_CAPTURE) 337 if (mode < REG_PARAMETER || mode > REG_CAPTURE)
338 return ret; 338 return ret;
339 339
340 ret = m5mols_read_u8(sd, SYSTEM_SYSMODE, &reg); 340 ret = m5mols_read_u8(sd, SYSTEM_SYSMODE, &reg);
@@ -511,9 +511,6 @@ static int m5mols_get_fmt(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh,
511 struct m5mols_info *info = to_m5mols(sd); 511 struct m5mols_info *info = to_m5mols(sd);
512 struct v4l2_mbus_framefmt *format; 512 struct v4l2_mbus_framefmt *format;
513 513
514 if (fmt->pad != 0)
515 return -EINVAL;
516
517 format = __find_format(info, fh, fmt->which, info->res_type); 514 format = __find_format(info, fh, fmt->which, info->res_type);
518 if (!format) 515 if (!format)
519 return -EINVAL; 516 return -EINVAL;
@@ -532,9 +529,6 @@ static int m5mols_set_fmt(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh,
532 u32 resolution = 0; 529 u32 resolution = 0;
533 int ret; 530 int ret;
534 531
535 if (fmt->pad != 0)
536 return -EINVAL;
537
538 ret = __find_resolution(sd, format, &type, &resolution); 532 ret = __find_resolution(sd, format, &type, &resolution);
539 if (ret < 0) 533 if (ret < 0)
540 return ret; 534 return ret;
@@ -543,13 +537,14 @@ static int m5mols_set_fmt(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh,
543 if (!sfmt) 537 if (!sfmt)
544 return 0; 538 return 0;
545 539
546 *sfmt = m5mols_default_ffmt[type]; 540
547 sfmt->width = format->width; 541 format->code = m5mols_default_ffmt[type].code;
548 sfmt->height = format->height; 542 format->colorspace = V4L2_COLORSPACE_JPEG;
543 format->field = V4L2_FIELD_NONE;
549 544
550 if (fmt->which == V4L2_SUBDEV_FORMAT_ACTIVE) { 545 if (fmt->which == V4L2_SUBDEV_FORMAT_ACTIVE) {
546 *sfmt = *format;
551 info->resolution = resolution; 547 info->resolution = resolution;
552 info->code = format->code;
553 info->res_type = type; 548 info->res_type = type;
554 } 549 }
555 550
@@ -626,13 +621,14 @@ static int m5mols_start_monitor(struct m5mols_info *info)
626static int m5mols_s_stream(struct v4l2_subdev *sd, int enable) 621static int m5mols_s_stream(struct v4l2_subdev *sd, int enable)
627{ 622{
628 struct m5mols_info *info = to_m5mols(sd); 623 struct m5mols_info *info = to_m5mols(sd);
624 u32 code = info->ffmt[info->res_type].code;
629 625
630 if (enable) { 626 if (enable) {
631 int ret = -EINVAL; 627 int ret = -EINVAL;
632 628
633 if (is_code(info->code, M5MOLS_RESTYPE_MONITOR)) 629 if (is_code(code, M5MOLS_RESTYPE_MONITOR))
634 ret = m5mols_start_monitor(info); 630 ret = m5mols_start_monitor(info);
635 if (is_code(info->code, M5MOLS_RESTYPE_CAPTURE)) 631 if (is_code(code, M5MOLS_RESTYPE_CAPTURE))
636 ret = m5mols_start_capture(info); 632 ret = m5mols_start_capture(info);
637 633
638 return ret; 634 return ret;
diff --git a/drivers/media/video/mt9m111.c b/drivers/media/video/mt9m111.c
index cf2c0fb95f2f..398f96ffd35e 100644
--- a/drivers/media/video/mt9m111.c
+++ b/drivers/media/video/mt9m111.c
@@ -955,6 +955,7 @@ static int mt9m111_probe(struct i2c_client *client,
955 mt9m111->rect.height = MT9M111_MAX_HEIGHT; 955 mt9m111->rect.height = MT9M111_MAX_HEIGHT;
956 mt9m111->fmt = &mt9m111_colour_fmts[0]; 956 mt9m111->fmt = &mt9m111_colour_fmts[0];
957 mt9m111->lastpage = -1; 957 mt9m111->lastpage = -1;
958 mutex_init(&mt9m111->power_lock);
958 959
959 ret = mt9m111_video_probe(client); 960 ret = mt9m111_video_probe(client);
960 if (ret) { 961 if (ret) {
diff --git a/drivers/media/video/mt9t112.c b/drivers/media/video/mt9t112.c
index 32114a3c0ca7..7b34b11daf24 100644
--- a/drivers/media/video/mt9t112.c
+++ b/drivers/media/video/mt9t112.c
@@ -1083,8 +1083,10 @@ static int mt9t112_probe(struct i2c_client *client,
1083 v4l2_i2c_subdev_init(&priv->subdev, client, &mt9t112_subdev_ops); 1083 v4l2_i2c_subdev_init(&priv->subdev, client, &mt9t112_subdev_ops);
1084 1084
1085 ret = mt9t112_camera_probe(client); 1085 ret = mt9t112_camera_probe(client);
1086 if (ret) 1086 if (ret) {
1087 kfree(priv); 1087 kfree(priv);
1088 return ret;
1089 }
1088 1090
1089 /* Cannot fail: using the default supported pixel code */ 1091 /* Cannot fail: using the default supported pixel code */
1090 mt9t112_set_params(priv, &rect, V4L2_MBUS_FMT_UYVY8_2X8); 1092 mt9t112_set_params(priv, &rect, V4L2_MBUS_FMT_UYVY8_2X8);
diff --git a/drivers/media/video/omap/omap_vout.c b/drivers/media/video/omap/omap_vout.c
index 9c5c19f142de..ee0d0b39cd17 100644
--- a/drivers/media/video/omap/omap_vout.c
+++ b/drivers/media/video/omap/omap_vout.c
@@ -38,6 +38,7 @@
38#include <linux/irq.h> 38#include <linux/irq.h>
39#include <linux/videodev2.h> 39#include <linux/videodev2.h>
40#include <linux/dma-mapping.h> 40#include <linux/dma-mapping.h>
41#include <linux/slab.h>
41 42
42#include <media/videobuf-dma-contig.h> 43#include <media/videobuf-dma-contig.h>
43#include <media/v4l2-device.h> 44#include <media/v4l2-device.h>
@@ -2169,6 +2170,14 @@ static int __init omap_vout_probe(struct platform_device *pdev)
2169 vid_dev->num_displays = 0; 2170 vid_dev->num_displays = 0;
2170 for_each_dss_dev(dssdev) { 2171 for_each_dss_dev(dssdev) {
2171 omap_dss_get_device(dssdev); 2172 omap_dss_get_device(dssdev);
2173
2174 if (!dssdev->driver) {
2175 dev_warn(&pdev->dev, "no driver for display: %s\n",
2176 dssdev->name);
2177 omap_dss_put_device(dssdev);
2178 continue;
2179 }
2180
2172 vid_dev->displays[vid_dev->num_displays++] = dssdev; 2181 vid_dev->displays[vid_dev->num_displays++] = dssdev;
2173 } 2182 }
2174 2183
diff --git a/drivers/media/video/omap1_camera.c b/drivers/media/video/omap1_camera.c
index e87ae2f634b2..6a6cf388bae4 100644
--- a/drivers/media/video/omap1_camera.c
+++ b/drivers/media/video/omap1_camera.c
@@ -24,6 +24,7 @@
24#include <linux/clk.h> 24#include <linux/clk.h>
25#include <linux/dma-mapping.h> 25#include <linux/dma-mapping.h>
26#include <linux/interrupt.h> 26#include <linux/interrupt.h>
27#include <linux/module.h>
27#include <linux/platform_device.h> 28#include <linux/platform_device.h>
28#include <linux/slab.h> 29#include <linux/slab.h>
29 30
diff --git a/drivers/media/video/omap24xxcam-dma.c b/drivers/media/video/omap24xxcam-dma.c
index 1d54b86c936b..3ea38a8def8e 100644
--- a/drivers/media/video/omap24xxcam-dma.c
+++ b/drivers/media/video/omap24xxcam-dma.c
@@ -506,7 +506,7 @@ int omap24xxcam_sgdma_queue(struct omap24xxcam_sgdma *sgdma,
506 unsigned long flags; 506 unsigned long flags;
507 struct sgdma_state *sg_state; 507 struct sgdma_state *sg_state;
508 508
509 if ((sglen < 0) || ((sglen > 0) & !sglist)) 509 if ((sglen < 0) || ((sglen > 0) && !sglist))
510 return -EINVAL; 510 return -EINVAL;
511 511
512 spin_lock_irqsave(&sgdma->lock, flags); 512 spin_lock_irqsave(&sgdma->lock, flags);
diff --git a/drivers/media/video/omap3isp/ispccdc.c b/drivers/media/video/omap3isp/ispccdc.c
index b0b0fa5a3572..54a4a3f22e2e 100644
--- a/drivers/media/video/omap3isp/ispccdc.c
+++ b/drivers/media/video/omap3isp/ispccdc.c
@@ -1408,7 +1408,7 @@ static void ccdc_hs_vs_isr(struct isp_ccdc_device *ccdc)
1408{ 1408{
1409 struct isp_pipeline *pipe = 1409 struct isp_pipeline *pipe =
1410 to_isp_pipeline(&ccdc->video_out.video.entity); 1410 to_isp_pipeline(&ccdc->video_out.video.entity);
1411 struct video_device *vdev = &ccdc->subdev.devnode; 1411 struct video_device *vdev = ccdc->subdev.devnode;
1412 struct v4l2_event event; 1412 struct v4l2_event event;
1413 1413
1414 memset(&event, 0, sizeof(event)); 1414 memset(&event, 0, sizeof(event));
diff --git a/drivers/media/video/omap3isp/ispstat.c b/drivers/media/video/omap3isp/ispstat.c
index 68d539456c55..bc0b2c7349b9 100644
--- a/drivers/media/video/omap3isp/ispstat.c
+++ b/drivers/media/video/omap3isp/ispstat.c
@@ -496,7 +496,7 @@ static int isp_stat_bufs_alloc(struct ispstat *stat, u32 size)
496 496
497static void isp_stat_queue_event(struct ispstat *stat, int err) 497static void isp_stat_queue_event(struct ispstat *stat, int err)
498{ 498{
499 struct video_device *vdev = &stat->subdev.devnode; 499 struct video_device *vdev = stat->subdev.devnode;
500 struct v4l2_event event; 500 struct v4l2_event event;
501 struct omap3isp_stat_event_status *status = (void *)event.u.data; 501 struct omap3isp_stat_event_status *status = (void *)event.u.data;
502 502
diff --git a/drivers/media/video/omap3isp/ispvideo.c b/drivers/media/video/omap3isp/ispvideo.c
index d1000723c5ae..f2290578448c 100644
--- a/drivers/media/video/omap3isp/ispvideo.c
+++ b/drivers/media/video/omap3isp/ispvideo.c
@@ -26,6 +26,7 @@
26#include <asm/cacheflush.h> 26#include <asm/cacheflush.h>
27#include <linux/clk.h> 27#include <linux/clk.h>
28#include <linux/mm.h> 28#include <linux/mm.h>
29#include <linux/module.h>
29#include <linux/pagemap.h> 30#include <linux/pagemap.h>
30#include <linux/scatterlist.h> 31#include <linux/scatterlist.h>
31#include <linux/sched.h> 32#include <linux/sched.h>
diff --git a/drivers/media/video/ov6650.c b/drivers/media/video/ov6650.c
index 9f2d26b1d4cb..6806345ec2f0 100644
--- a/drivers/media/video/ov6650.c
+++ b/drivers/media/video/ov6650.c
@@ -540,7 +540,7 @@ static u8 to_clkrc(struct v4l2_fract *timeperframe,
540static int ov6650_s_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf) 540static int ov6650_s_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf)
541{ 541{
542 struct i2c_client *client = v4l2_get_subdevdata(sd); 542 struct i2c_client *client = v4l2_get_subdevdata(sd);
543 struct soc_camera_device *icd = (struct soc_camera_device *)sd->grp_id; 543 struct soc_camera_device *icd = v4l2_get_subdev_hostdata(sd);
544 struct soc_camera_sense *sense = icd->sense; 544 struct soc_camera_sense *sense = icd->sense;
545 struct ov6650 *priv = to_ov6650(client); 545 struct ov6650 *priv = to_ov6650(client);
546 bool half_scale = !is_unscaled_ok(mf->width, mf->height, &priv->rect); 546 bool half_scale = !is_unscaled_ok(mf->width, mf->height, &priv->rect);
diff --git a/drivers/media/video/s5p-fimc/fimc-capture.c b/drivers/media/video/s5p-fimc/fimc-capture.c
index c8d91b0cd9bd..2cc3b9166724 100644
--- a/drivers/media/video/s5p-fimc/fimc-capture.c
+++ b/drivers/media/video/s5p-fimc/fimc-capture.c
@@ -98,6 +98,10 @@ static int fimc_capture_state_cleanup(struct fimc_dev *fimc, bool suspend)
98 vb2_buffer_done(&buf->vb, VB2_BUF_STATE_ERROR); 98 vb2_buffer_done(&buf->vb, VB2_BUF_STATE_ERROR);
99 } 99 }
100 set_bit(ST_CAPT_SUSPENDED, &fimc->state); 100 set_bit(ST_CAPT_SUSPENDED, &fimc->state);
101
102 fimc_hw_reset(fimc);
103 cap->buf_index = 0;
104
101 spin_unlock_irqrestore(&fimc->slock, flags); 105 spin_unlock_irqrestore(&fimc->slock, flags);
102 106
103 if (streaming) 107 if (streaming)
@@ -137,7 +141,7 @@ int fimc_capture_config_update(struct fimc_ctx *ctx)
137 struct fimc_dev *fimc = ctx->fimc_dev; 141 struct fimc_dev *fimc = ctx->fimc_dev;
138 int ret; 142 int ret;
139 143
140 if (test_bit(ST_CAPT_APPLY_CFG, &fimc->state)) 144 if (!test_bit(ST_CAPT_APPLY_CFG, &fimc->state))
141 return 0; 145 return 0;
142 146
143 spin_lock(&ctx->slock); 147 spin_lock(&ctx->slock);
@@ -150,7 +154,7 @@ int fimc_capture_config_update(struct fimc_ctx *ctx)
150 fimc_hw_set_rotation(ctx); 154 fimc_hw_set_rotation(ctx);
151 fimc_prepare_dma_offset(ctx, &ctx->d_frame); 155 fimc_prepare_dma_offset(ctx, &ctx->d_frame);
152 fimc_hw_set_out_dma(ctx); 156 fimc_hw_set_out_dma(ctx);
153 set_bit(ST_CAPT_APPLY_CFG, &fimc->state); 157 clear_bit(ST_CAPT_APPLY_CFG, &fimc->state);
154 } 158 }
155 spin_unlock(&ctx->slock); 159 spin_unlock(&ctx->slock);
156 return ret; 160 return ret;
@@ -164,7 +168,6 @@ static int start_streaming(struct vb2_queue *q, unsigned int count)
164 int min_bufs; 168 int min_bufs;
165 int ret; 169 int ret;
166 170
167 fimc_hw_reset(fimc);
168 vid_cap->frame_count = 0; 171 vid_cap->frame_count = 0;
169 172
170 ret = fimc_init_capture(fimc); 173 ret = fimc_init_capture(fimc);
@@ -523,7 +526,7 @@ static struct fimc_fmt *fimc_capture_try_format(struct fimc_ctx *ctx,
523 max_w = rotation ? pl->out_rot_en_w : pl->out_rot_dis_w; 526 max_w = rotation ? pl->out_rot_en_w : pl->out_rot_dis_w;
524 min_w = ctx->state & FIMC_DST_CROP ? dst->width : var->min_out_pixsize; 527 min_w = ctx->state & FIMC_DST_CROP ? dst->width : var->min_out_pixsize;
525 min_h = ctx->state & FIMC_DST_CROP ? dst->height : var->min_out_pixsize; 528 min_h = ctx->state & FIMC_DST_CROP ? dst->height : var->min_out_pixsize;
526 if (fimc->id == 1 && var->pix_hoff) 529 if (var->min_vsize_align == 1 && !rotation)
527 align_h = fimc_fmt_is_rgb(ffmt->color) ? 0 : 1; 530 align_h = fimc_fmt_is_rgb(ffmt->color) ? 0 : 1;
528 531
529 depth = fimc_get_format_depth(ffmt); 532 depth = fimc_get_format_depth(ffmt);
@@ -1239,6 +1242,7 @@ static int fimc_subdev_set_fmt(struct v4l2_subdev *sd,
1239 1242
1240 mutex_lock(&fimc->lock); 1243 mutex_lock(&fimc->lock);
1241 set_frame_bounds(ff, mf->width, mf->height); 1244 set_frame_bounds(ff, mf->width, mf->height);
1245 fimc->vid_cap.mf = *mf;
1242 ff->fmt = ffmt; 1246 ff->fmt = ffmt;
1243 1247
1244 /* Reset the crop rectangle if required. */ 1248 /* Reset the crop rectangle if required. */
@@ -1375,7 +1379,7 @@ static void fimc_destroy_capture_subdev(struct fimc_dev *fimc)
1375 media_entity_cleanup(&sd->entity); 1379 media_entity_cleanup(&sd->entity);
1376 v4l2_device_unregister_subdev(sd); 1380 v4l2_device_unregister_subdev(sd);
1377 kfree(sd); 1381 kfree(sd);
1378 sd = NULL; 1382 fimc->vid_cap.subdev = NULL;
1379} 1383}
1380 1384
1381/* Set default format at the sensor and host interface */ 1385/* Set default format at the sensor and host interface */
diff --git a/drivers/media/video/s5p-fimc/fimc-core.c b/drivers/media/video/s5p-fimc/fimc-core.c
index 19ca6db38b2f..07c6254faee3 100644
--- a/drivers/media/video/s5p-fimc/fimc-core.c
+++ b/drivers/media/video/s5p-fimc/fimc-core.c
@@ -37,7 +37,7 @@ static char *fimc_clocks[MAX_FIMC_CLOCKS] = {
37static struct fimc_fmt fimc_formats[] = { 37static struct fimc_fmt fimc_formats[] = {
38 { 38 {
39 .name = "RGB565", 39 .name = "RGB565",
40 .fourcc = V4L2_PIX_FMT_RGB565X, 40 .fourcc = V4L2_PIX_FMT_RGB565,
41 .depth = { 16 }, 41 .depth = { 16 },
42 .color = S5P_FIMC_RGB565, 42 .color = S5P_FIMC_RGB565,
43 .memplanes = 1, 43 .memplanes = 1,
@@ -1038,12 +1038,11 @@ static int fimc_try_fmt_mplane(struct fimc_ctx *ctx, struct v4l2_format *f)
1038 mod_x = 6; /* 64 x 32 pixels tile */ 1038 mod_x = 6; /* 64 x 32 pixels tile */
1039 mod_y = 5; 1039 mod_y = 5;
1040 } else { 1040 } else {
1041 if (fimc->id == 1 && variant->pix_hoff) 1041 if (variant->min_vsize_align == 1)
1042 mod_y = fimc_fmt_is_rgb(fmt->color) ? 0 : 1; 1042 mod_y = fimc_fmt_is_rgb(fmt->color) ? 0 : 1;
1043 else 1043 else
1044 mod_y = mod_x; 1044 mod_y = ffs(variant->min_vsize_align) - 1;
1045 } 1045 }
1046 dbg("mod_x: %d, mod_y: %d, max_w: %d", mod_x, mod_y, max_w);
1047 1046
1048 v4l_bound_align_image(&pix->width, 16, max_w, mod_x, 1047 v4l_bound_align_image(&pix->width, 16, max_w, mod_x,
1049 &pix->height, 8, variant->pix_limit->scaler_dis_w, mod_y, 0); 1048 &pix->height, 8, variant->pix_limit->scaler_dis_w, mod_y, 0);
@@ -1226,10 +1225,10 @@ static int fimc_m2m_try_crop(struct fimc_ctx *ctx, struct v4l2_crop *cr)
1226 fimc->variant->min_inp_pixsize : fimc->variant->min_out_pixsize; 1225 fimc->variant->min_inp_pixsize : fimc->variant->min_out_pixsize;
1227 1226
1228 /* Get pixel alignment constraints. */ 1227 /* Get pixel alignment constraints. */
1229 if (fimc->id == 1 && fimc->variant->pix_hoff) 1228 if (fimc->variant->min_vsize_align == 1)
1230 halign = fimc_fmt_is_rgb(f->fmt->color) ? 0 : 1; 1229 halign = fimc_fmt_is_rgb(f->fmt->color) ? 0 : 1;
1231 else 1230 else
1232 halign = ffs(min_size) - 1; 1231 halign = ffs(fimc->variant->min_vsize_align) - 1;
1233 1232
1234 for (i = 0; i < f->fmt->colplanes; i++) 1233 for (i = 0; i < f->fmt->colplanes; i++)
1235 depth += f->fmt->depth[i]; 1234 depth += f->fmt->depth[i];
@@ -1615,7 +1614,6 @@ static int fimc_probe(struct platform_device *pdev)
1615 pdata = pdev->dev.platform_data; 1614 pdata = pdev->dev.platform_data;
1616 fimc->pdata = pdata; 1615 fimc->pdata = pdata;
1617 1616
1618 set_bit(ST_LPM, &fimc->state);
1619 1617
1620 init_waitqueue_head(&fimc->irq_queue); 1618 init_waitqueue_head(&fimc->irq_queue);
1621 spin_lock_init(&fimc->slock); 1619 spin_lock_init(&fimc->slock);
@@ -1707,8 +1705,6 @@ static int fimc_runtime_resume(struct device *dev)
1707 /* Enable clocks and perform basic initalization */ 1705 /* Enable clocks and perform basic initalization */
1708 clk_enable(fimc->clock[CLK_GATE]); 1706 clk_enable(fimc->clock[CLK_GATE]);
1709 fimc_hw_reset(fimc); 1707 fimc_hw_reset(fimc);
1710 if (fimc->variant->out_buf_count > 4)
1711 fimc_hw_set_dma_seq(fimc, 0xF);
1712 1708
1713 /* Resume the capture or mem-to-mem device */ 1709 /* Resume the capture or mem-to-mem device */
1714 if (fimc_capture_busy(fimc)) 1710 if (fimc_capture_busy(fimc))
@@ -1750,8 +1746,6 @@ static int fimc_resume(struct device *dev)
1750 return 0; 1746 return 0;
1751 } 1747 }
1752 fimc_hw_reset(fimc); 1748 fimc_hw_reset(fimc);
1753 if (fimc->variant->out_buf_count > 4)
1754 fimc_hw_set_dma_seq(fimc, 0xF);
1755 spin_unlock_irqrestore(&fimc->slock, flags); 1749 spin_unlock_irqrestore(&fimc->slock, flags);
1756 1750
1757 if (fimc_capture_busy(fimc)) 1751 if (fimc_capture_busy(fimc))
@@ -1780,7 +1774,6 @@ static int __devexit fimc_remove(struct platform_device *pdev)
1780 struct fimc_dev *fimc = platform_get_drvdata(pdev); 1774 struct fimc_dev *fimc = platform_get_drvdata(pdev);
1781 1775
1782 pm_runtime_disable(&pdev->dev); 1776 pm_runtime_disable(&pdev->dev);
1783 fimc_runtime_suspend(&pdev->dev);
1784 pm_runtime_set_suspended(&pdev->dev); 1777 pm_runtime_set_suspended(&pdev->dev);
1785 1778
1786 vb2_dma_contig_cleanup_ctx(fimc->alloc_ctx); 1779 vb2_dma_contig_cleanup_ctx(fimc->alloc_ctx);
@@ -1840,6 +1833,7 @@ static struct samsung_fimc_variant fimc0_variant_s5p = {
1840 .min_inp_pixsize = 16, 1833 .min_inp_pixsize = 16,
1841 .min_out_pixsize = 16, 1834 .min_out_pixsize = 16,
1842 .hor_offs_align = 8, 1835 .hor_offs_align = 8,
1836 .min_vsize_align = 16,
1843 .out_buf_count = 4, 1837 .out_buf_count = 4,
1844 .pix_limit = &s5p_pix_limit[0], 1838 .pix_limit = &s5p_pix_limit[0],
1845}; 1839};
@@ -1849,6 +1843,7 @@ static struct samsung_fimc_variant fimc2_variant_s5p = {
1849 .min_inp_pixsize = 16, 1843 .min_inp_pixsize = 16,
1850 .min_out_pixsize = 16, 1844 .min_out_pixsize = 16,
1851 .hor_offs_align = 8, 1845 .hor_offs_align = 8,
1846 .min_vsize_align = 16,
1852 .out_buf_count = 4, 1847 .out_buf_count = 4,
1853 .pix_limit = &s5p_pix_limit[1], 1848 .pix_limit = &s5p_pix_limit[1],
1854}; 1849};
@@ -1861,6 +1856,7 @@ static struct samsung_fimc_variant fimc0_variant_s5pv210 = {
1861 .min_inp_pixsize = 16, 1856 .min_inp_pixsize = 16,
1862 .min_out_pixsize = 16, 1857 .min_out_pixsize = 16,
1863 .hor_offs_align = 8, 1858 .hor_offs_align = 8,
1859 .min_vsize_align = 16,
1864 .out_buf_count = 4, 1860 .out_buf_count = 4,
1865 .pix_limit = &s5p_pix_limit[1], 1861 .pix_limit = &s5p_pix_limit[1],
1866}; 1862};
@@ -1874,6 +1870,7 @@ static struct samsung_fimc_variant fimc1_variant_s5pv210 = {
1874 .min_inp_pixsize = 16, 1870 .min_inp_pixsize = 16,
1875 .min_out_pixsize = 16, 1871 .min_out_pixsize = 16,
1876 .hor_offs_align = 1, 1872 .hor_offs_align = 1,
1873 .min_vsize_align = 1,
1877 .out_buf_count = 4, 1874 .out_buf_count = 4,
1878 .pix_limit = &s5p_pix_limit[2], 1875 .pix_limit = &s5p_pix_limit[2],
1879}; 1876};
@@ -1884,6 +1881,7 @@ static struct samsung_fimc_variant fimc2_variant_s5pv210 = {
1884 .min_inp_pixsize = 16, 1881 .min_inp_pixsize = 16,
1885 .min_out_pixsize = 16, 1882 .min_out_pixsize = 16,
1886 .hor_offs_align = 8, 1883 .hor_offs_align = 8,
1884 .min_vsize_align = 16,
1887 .out_buf_count = 4, 1885 .out_buf_count = 4,
1888 .pix_limit = &s5p_pix_limit[2], 1886 .pix_limit = &s5p_pix_limit[2],
1889}; 1887};
@@ -1898,6 +1896,7 @@ static struct samsung_fimc_variant fimc0_variant_exynos4 = {
1898 .min_inp_pixsize = 16, 1896 .min_inp_pixsize = 16,
1899 .min_out_pixsize = 16, 1897 .min_out_pixsize = 16,
1900 .hor_offs_align = 2, 1898 .hor_offs_align = 2,
1899 .min_vsize_align = 1,
1901 .out_buf_count = 32, 1900 .out_buf_count = 32,
1902 .pix_limit = &s5p_pix_limit[1], 1901 .pix_limit = &s5p_pix_limit[1],
1903}; 1902};
@@ -1910,6 +1909,7 @@ static struct samsung_fimc_variant fimc3_variant_exynos4 = {
1910 .min_inp_pixsize = 16, 1909 .min_inp_pixsize = 16,
1911 .min_out_pixsize = 16, 1910 .min_out_pixsize = 16,
1912 .hor_offs_align = 2, 1911 .hor_offs_align = 2,
1912 .min_vsize_align = 1,
1913 .out_buf_count = 32, 1913 .out_buf_count = 32,
1914 .pix_limit = &s5p_pix_limit[3], 1914 .pix_limit = &s5p_pix_limit[3],
1915}; 1915};
diff --git a/drivers/media/video/s5p-fimc/fimc-core.h b/drivers/media/video/s5p-fimc/fimc-core.h
index a6936dad5b10..c7f01c47b20f 100644
--- a/drivers/media/video/s5p-fimc/fimc-core.h
+++ b/drivers/media/video/s5p-fimc/fimc-core.h
@@ -377,6 +377,7 @@ struct fimc_pix_limit {
377 * @min_inp_pixsize: minimum input pixel size 377 * @min_inp_pixsize: minimum input pixel size
378 * @min_out_pixsize: minimum output pixel size 378 * @min_out_pixsize: minimum output pixel size
379 * @hor_offs_align: horizontal pixel offset aligment 379 * @hor_offs_align: horizontal pixel offset aligment
380 * @min_vsize_align: minimum vertical pixel size alignment
380 * @out_buf_count: the number of buffers in output DMA sequence 381 * @out_buf_count: the number of buffers in output DMA sequence
381 */ 382 */
382struct samsung_fimc_variant { 383struct samsung_fimc_variant {
@@ -390,6 +391,7 @@ struct samsung_fimc_variant {
390 u16 min_inp_pixsize; 391 u16 min_inp_pixsize;
391 u16 min_out_pixsize; 392 u16 min_out_pixsize;
392 u16 hor_offs_align; 393 u16 hor_offs_align;
394 u16 min_vsize_align;
393 u16 out_buf_count; 395 u16 out_buf_count;
394}; 396};
395 397
diff --git a/drivers/media/video/s5p-fimc/fimc-mdevice.c b/drivers/media/video/s5p-fimc/fimc-mdevice.c
index cc337b1de913..615c862f0360 100644
--- a/drivers/media/video/s5p-fimc/fimc-mdevice.c
+++ b/drivers/media/video/s5p-fimc/fimc-mdevice.c
@@ -220,6 +220,7 @@ static struct v4l2_subdev *fimc_md_register_sensor(struct fimc_md *fmd,
220 sd = v4l2_i2c_new_subdev_board(&fmd->v4l2_dev, adapter, 220 sd = v4l2_i2c_new_subdev_board(&fmd->v4l2_dev, adapter,
221 s_info->pdata->board_info, NULL); 221 s_info->pdata->board_info, NULL);
222 if (IS_ERR_OR_NULL(sd)) { 222 if (IS_ERR_OR_NULL(sd)) {
223 i2c_put_adapter(adapter);
223 v4l2_err(&fmd->v4l2_dev, "Failed to acquire subdev\n"); 224 v4l2_err(&fmd->v4l2_dev, "Failed to acquire subdev\n");
224 return NULL; 225 return NULL;
225 } 226 }
@@ -234,12 +235,15 @@ static struct v4l2_subdev *fimc_md_register_sensor(struct fimc_md *fmd,
234static void fimc_md_unregister_sensor(struct v4l2_subdev *sd) 235static void fimc_md_unregister_sensor(struct v4l2_subdev *sd)
235{ 236{
236 struct i2c_client *client = v4l2_get_subdevdata(sd); 237 struct i2c_client *client = v4l2_get_subdevdata(sd);
238 struct i2c_adapter *adapter;
237 239
238 if (!client) 240 if (!client)
239 return; 241 return;
240 v4l2_device_unregister_subdev(sd); 242 v4l2_device_unregister_subdev(sd);
243 adapter = client->adapter;
241 i2c_unregister_device(client); 244 i2c_unregister_device(client);
242 i2c_put_adapter(client->adapter); 245 if (adapter)
246 i2c_put_adapter(adapter);
243} 247}
244 248
245static int fimc_md_register_sensor_entities(struct fimc_md *fmd) 249static int fimc_md_register_sensor_entities(struct fimc_md *fmd)
@@ -381,20 +385,28 @@ static void fimc_md_unregister_entities(struct fimc_md *fmd)
381 385
382static int fimc_md_register_video_nodes(struct fimc_md *fmd) 386static int fimc_md_register_video_nodes(struct fimc_md *fmd)
383{ 387{
388 struct video_device *vdev;
384 int i, ret = 0; 389 int i, ret = 0;
385 390
386 for (i = 0; i < FIMC_MAX_DEVS && !ret; i++) { 391 for (i = 0; i < FIMC_MAX_DEVS && !ret; i++) {
387 if (!fmd->fimc[i]) 392 if (!fmd->fimc[i])
388 continue; 393 continue;
389 394
390 if (fmd->fimc[i]->m2m.vfd) 395 vdev = fmd->fimc[i]->m2m.vfd;
391 ret = video_register_device(fmd->fimc[i]->m2m.vfd, 396 if (vdev) {
392 VFL_TYPE_GRABBER, -1); 397 ret = video_register_device(vdev, VFL_TYPE_GRABBER, -1);
393 if (ret) 398 if (ret)
394 break; 399 break;
395 if (fmd->fimc[i]->vid_cap.vfd) 400 v4l2_info(&fmd->v4l2_dev, "Registered %s as /dev/%s\n",
396 ret = video_register_device(fmd->fimc[i]->vid_cap.vfd, 401 vdev->name, video_device_node_name(vdev));
397 VFL_TYPE_GRABBER, -1); 402 }
403
404 vdev = fmd->fimc[i]->vid_cap.vfd;
405 if (vdev == NULL)
406 continue;
407 ret = video_register_device(vdev, VFL_TYPE_GRABBER, -1);
408 v4l2_info(&fmd->v4l2_dev, "Registered %s as /dev/%s\n",
409 vdev->name, video_device_node_name(vdev));
398 } 410 }
399 411
400 return ret; 412 return ret;
@@ -502,7 +514,7 @@ static int fimc_md_create_links(struct fimc_md *fmd)
502 if (WARN(csis == NULL, 514 if (WARN(csis == NULL,
503 "MIPI-CSI interface specified " 515 "MIPI-CSI interface specified "
504 "but s5p-csis module is not loaded!\n")) 516 "but s5p-csis module is not loaded!\n"))
505 continue; 517 return -EINVAL;
506 518
507 ret = media_entity_create_link(&sensor->entity, 0, 519 ret = media_entity_create_link(&sensor->entity, 0,
508 &csis->entity, CSIS_PAD_SINK, 520 &csis->entity, CSIS_PAD_SINK,
@@ -742,9 +754,6 @@ static int __devinit fimc_md_probe(struct platform_device *pdev)
742 struct fimc_md *fmd; 754 struct fimc_md *fmd;
743 int ret; 755 int ret;
744 756
745 if (WARN(!pdev->dev.platform_data, "Platform data not specified!\n"))
746 return -EINVAL;
747
748 fmd = kzalloc(sizeof(struct fimc_md), GFP_KERNEL); 757 fmd = kzalloc(sizeof(struct fimc_md), GFP_KERNEL);
749 if (!fmd) 758 if (!fmd)
750 return -ENOMEM; 759 return -ENOMEM;
@@ -782,9 +791,11 @@ static int __devinit fimc_md_probe(struct platform_device *pdev)
782 if (ret) 791 if (ret)
783 goto err3; 792 goto err3;
784 793
785 ret = fimc_md_register_sensor_entities(fmd); 794 if (pdev->dev.platform_data) {
786 if (ret) 795 ret = fimc_md_register_sensor_entities(fmd);
787 goto err3; 796 if (ret)
797 goto err3;
798 }
788 ret = fimc_md_create_links(fmd); 799 ret = fimc_md_create_links(fmd);
789 if (ret) 800 if (ret)
790 goto err3; 801 goto err3;
diff --git a/drivers/media/video/s5p-fimc/fimc-reg.c b/drivers/media/video/s5p-fimc/fimc-reg.c
index 20e664e34163..44f5c2d1920b 100644
--- a/drivers/media/video/s5p-fimc/fimc-reg.c
+++ b/drivers/media/video/s5p-fimc/fimc-reg.c
@@ -35,6 +35,9 @@ void fimc_hw_reset(struct fimc_dev *dev)
35 cfg = readl(dev->regs + S5P_CIGCTRL); 35 cfg = readl(dev->regs + S5P_CIGCTRL);
36 cfg &= ~S5P_CIGCTRL_SWRST; 36 cfg &= ~S5P_CIGCTRL_SWRST;
37 writel(cfg, dev->regs + S5P_CIGCTRL); 37 writel(cfg, dev->regs + S5P_CIGCTRL);
38
39 if (dev->variant->out_buf_count > 4)
40 fimc_hw_set_dma_seq(dev, 0xF);
38} 41}
39 42
40static u32 fimc_hw_get_in_flip(struct fimc_ctx *ctx) 43static u32 fimc_hw_get_in_flip(struct fimc_ctx *ctx)
@@ -251,7 +254,14 @@ static void fimc_hw_set_scaler(struct fimc_ctx *ctx)
251 struct fimc_scaler *sc = &ctx->scaler; 254 struct fimc_scaler *sc = &ctx->scaler;
252 struct fimc_frame *src_frame = &ctx->s_frame; 255 struct fimc_frame *src_frame = &ctx->s_frame;
253 struct fimc_frame *dst_frame = &ctx->d_frame; 256 struct fimc_frame *dst_frame = &ctx->d_frame;
254 u32 cfg = 0; 257
258 u32 cfg = readl(dev->regs + S5P_CISCCTRL);
259
260 cfg &= ~(S5P_CISCCTRL_CSCR2Y_WIDE | S5P_CISCCTRL_CSCY2R_WIDE |
261 S5P_CISCCTRL_SCALEUP_H | S5P_CISCCTRL_SCALEUP_V |
262 S5P_CISCCTRL_SCALERBYPASS | S5P_CISCCTRL_ONE2ONE |
263 S5P_CISCCTRL_INRGB_FMT_MASK | S5P_CISCCTRL_OUTRGB_FMT_MASK |
264 S5P_CISCCTRL_INTERLACE | S5P_CISCCTRL_RGB_EXT);
255 265
256 if (!(ctx->flags & FIMC_COLOR_RANGE_NARROW)) 266 if (!(ctx->flags & FIMC_COLOR_RANGE_NARROW))
257 cfg |= (S5P_CISCCTRL_CSCR2Y_WIDE | S5P_CISCCTRL_CSCY2R_WIDE); 267 cfg |= (S5P_CISCCTRL_CSCR2Y_WIDE | S5P_CISCCTRL_CSCY2R_WIDE);
@@ -308,9 +318,9 @@ void fimc_hw_set_mainscaler(struct fimc_ctx *ctx)
308 fimc_hw_set_scaler(ctx); 318 fimc_hw_set_scaler(ctx);
309 319
310 cfg = readl(dev->regs + S5P_CISCCTRL); 320 cfg = readl(dev->regs + S5P_CISCCTRL);
321 cfg &= ~(S5P_CISCCTRL_MHRATIO_MASK | S5P_CISCCTRL_MVRATIO_MASK);
311 322
312 if (variant->has_mainscaler_ext) { 323 if (variant->has_mainscaler_ext) {
313 cfg &= ~(S5P_CISCCTRL_MHRATIO_MASK | S5P_CISCCTRL_MVRATIO_MASK);
314 cfg |= S5P_CISCCTRL_MHRATIO_EXT(sc->main_hratio); 324 cfg |= S5P_CISCCTRL_MHRATIO_EXT(sc->main_hratio);
315 cfg |= S5P_CISCCTRL_MVRATIO_EXT(sc->main_vratio); 325 cfg |= S5P_CISCCTRL_MVRATIO_EXT(sc->main_vratio);
316 writel(cfg, dev->regs + S5P_CISCCTRL); 326 writel(cfg, dev->regs + S5P_CISCCTRL);
@@ -323,7 +333,6 @@ void fimc_hw_set_mainscaler(struct fimc_ctx *ctx)
323 cfg |= S5P_CIEXTEN_MVRATIO_EXT(sc->main_vratio); 333 cfg |= S5P_CIEXTEN_MVRATIO_EXT(sc->main_vratio);
324 writel(cfg, dev->regs + S5P_CIEXTEN); 334 writel(cfg, dev->regs + S5P_CIEXTEN);
325 } else { 335 } else {
326 cfg &= ~(S5P_CISCCTRL_MHRATIO_MASK | S5P_CISCCTRL_MVRATIO_MASK);
327 cfg |= S5P_CISCCTRL_MHRATIO(sc->main_hratio); 336 cfg |= S5P_CISCCTRL_MHRATIO(sc->main_hratio);
328 cfg |= S5P_CISCCTRL_MVRATIO(sc->main_vratio); 337 cfg |= S5P_CISCCTRL_MVRATIO(sc->main_vratio);
329 writel(cfg, dev->regs + S5P_CISCCTRL); 338 writel(cfg, dev->regs + S5P_CISCCTRL);
diff --git a/drivers/media/video/s5p-mfc/s5p_mfc_enc.c b/drivers/media/video/s5p-mfc/s5p_mfc_enc.c
index 1e8cdb77d4b8..dff9dc798795 100644
--- a/drivers/media/video/s5p-mfc/s5p_mfc_enc.c
+++ b/drivers/media/video/s5p-mfc/s5p_mfc_enc.c
@@ -61,7 +61,7 @@ static struct s5p_mfc_fmt formats[] = {
61 .num_planes = 1, 61 .num_planes = 1,
62 }, 62 },
63 { 63 {
64 .name = "H264 Encoded Stream", 64 .name = "H263 Encoded Stream",
65 .fourcc = V4L2_PIX_FMT_H263, 65 .fourcc = V4L2_PIX_FMT_H263,
66 .codec_mode = S5P_FIMV_CODEC_H263_ENC, 66 .codec_mode = S5P_FIMV_CODEC_H263_ENC,
67 .type = MFC_FMT_ENC, 67 .type = MFC_FMT_ENC,
diff --git a/drivers/media/video/s5p-tv/mixer_video.c b/drivers/media/video/s5p-tv/mixer_video.c
index e16d3a4bc1dc..b47d0c06ecf5 100644
--- a/drivers/media/video/s5p-tv/mixer_video.c
+++ b/drivers/media/video/s5p-tv/mixer_video.c
@@ -16,6 +16,7 @@
16#include <media/v4l2-ioctl.h> 16#include <media/v4l2-ioctl.h>
17#include <linux/videodev2.h> 17#include <linux/videodev2.h>
18#include <linux/mm.h> 18#include <linux/mm.h>
19#include <linux/module.h>
19#include <linux/version.h> 20#include <linux/version.h>
20#include <linux/timer.h> 21#include <linux/timer.h>
21#include <media/videobuf2-dma-contig.h> 22#include <media/videobuf2-dma-contig.h>
diff --git a/drivers/media/video/sh_mobile_ceu_camera.c b/drivers/media/video/sh_mobile_ceu_camera.c
index f390682629cf..c51decfcae19 100644
--- a/drivers/media/video/sh_mobile_ceu_camera.c
+++ b/drivers/media/video/sh_mobile_ceu_camera.c
@@ -566,8 +566,10 @@ static int sh_mobile_ceu_add_device(struct soc_camera_device *icd)
566 ret = sh_mobile_ceu_soft_reset(pcdev); 566 ret = sh_mobile_ceu_soft_reset(pcdev);
567 567
568 csi2_sd = find_csi2(pcdev); 568 csi2_sd = find_csi2(pcdev);
569 if (csi2_sd) 569 if (csi2_sd) {
570 csi2_sd->grp_id = (long)icd; 570 csi2_sd->grp_id = soc_camera_grp_id(icd);
571 v4l2_set_subdev_hostdata(csi2_sd, icd);
572 }
571 573
572 ret = v4l2_subdev_call(csi2_sd, core, s_power, 1); 574 ret = v4l2_subdev_call(csi2_sd, core, s_power, 1);
573 if (ret < 0 && ret != -ENOIOCTLCMD && ret != -ENODEV) { 575 if (ret < 0 && ret != -ENOIOCTLCMD && ret != -ENODEV) {
@@ -768,7 +770,7 @@ static struct v4l2_subdev *find_bus_subdev(struct sh_mobile_ceu_dev *pcdev,
768{ 770{
769 if (pcdev->csi2_pdev) { 771 if (pcdev->csi2_pdev) {
770 struct v4l2_subdev *csi2_sd = find_csi2(pcdev); 772 struct v4l2_subdev *csi2_sd = find_csi2(pcdev);
771 if (csi2_sd && csi2_sd->grp_id == (u32)icd) 773 if (csi2_sd && csi2_sd->grp_id == soc_camera_grp_id(icd))
772 return csi2_sd; 774 return csi2_sd;
773 } 775 }
774 776
@@ -1089,8 +1091,9 @@ static int sh_mobile_ceu_get_formats(struct soc_camera_device *icd, unsigned int
1089 /* Try 2560x1920, 1280x960, 640x480, 320x240 */ 1091 /* Try 2560x1920, 1280x960, 640x480, 320x240 */
1090 mf.width = 2560 >> shift; 1092 mf.width = 2560 >> shift;
1091 mf.height = 1920 >> shift; 1093 mf.height = 1920 >> shift;
1092 ret = v4l2_device_call_until_err(sd->v4l2_dev, (long)icd, video, 1094 ret = v4l2_device_call_until_err(sd->v4l2_dev,
1093 s_mbus_fmt, &mf); 1095 soc_camera_grp_id(icd), video,
1096 s_mbus_fmt, &mf);
1094 if (ret < 0) 1097 if (ret < 0)
1095 return ret; 1098 return ret;
1096 shift++; 1099 shift++;
@@ -1389,7 +1392,8 @@ static int client_s_fmt(struct soc_camera_device *icd,
1389 bool ceu_1to1; 1392 bool ceu_1to1;
1390 int ret; 1393 int ret;
1391 1394
1392 ret = v4l2_device_call_until_err(sd->v4l2_dev, (long)icd, video, 1395 ret = v4l2_device_call_until_err(sd->v4l2_dev,
1396 soc_camera_grp_id(icd), video,
1393 s_mbus_fmt, mf); 1397 s_mbus_fmt, mf);
1394 if (ret < 0) 1398 if (ret < 0)
1395 return ret; 1399 return ret;
@@ -1426,8 +1430,9 @@ static int client_s_fmt(struct soc_camera_device *icd,
1426 tmp_h = min(2 * tmp_h, max_height); 1430 tmp_h = min(2 * tmp_h, max_height);
1427 mf->width = tmp_w; 1431 mf->width = tmp_w;
1428 mf->height = tmp_h; 1432 mf->height = tmp_h;
1429 ret = v4l2_device_call_until_err(sd->v4l2_dev, (long)icd, video, 1433 ret = v4l2_device_call_until_err(sd->v4l2_dev,
1430 s_mbus_fmt, mf); 1434 soc_camera_grp_id(icd), video,
1435 s_mbus_fmt, mf);
1431 dev_geo(dev, "Camera scaled to %ux%u\n", 1436 dev_geo(dev, "Camera scaled to %ux%u\n",
1432 mf->width, mf->height); 1437 mf->width, mf->height);
1433 if (ret < 0) { 1438 if (ret < 0) {
@@ -1580,8 +1585,9 @@ static int sh_mobile_ceu_set_crop(struct soc_camera_device *icd,
1580 } 1585 }
1581 1586
1582 if (interm_width < icd->user_width || interm_height < icd->user_height) { 1587 if (interm_width < icd->user_width || interm_height < icd->user_height) {
1583 ret = v4l2_device_call_until_err(sd->v4l2_dev, (int)icd, video, 1588 ret = v4l2_device_call_until_err(sd->v4l2_dev,
1584 s_mbus_fmt, &mf); 1589 soc_camera_grp_id(icd), video,
1590 s_mbus_fmt, &mf);
1585 if (ret < 0) 1591 if (ret < 0)
1586 return ret; 1592 return ret;
1587 1593
@@ -1867,7 +1873,8 @@ static int sh_mobile_ceu_try_fmt(struct soc_camera_device *icd,
1867 mf.code = xlate->code; 1873 mf.code = xlate->code;
1868 mf.colorspace = pix->colorspace; 1874 mf.colorspace = pix->colorspace;
1869 1875
1870 ret = v4l2_device_call_until_err(sd->v4l2_dev, (long)icd, video, try_mbus_fmt, &mf); 1876 ret = v4l2_device_call_until_err(sd->v4l2_dev, soc_camera_grp_id(icd),
1877 video, try_mbus_fmt, &mf);
1871 if (ret < 0) 1878 if (ret < 0)
1872 return ret; 1879 return ret;
1873 1880
@@ -1891,8 +1898,9 @@ static int sh_mobile_ceu_try_fmt(struct soc_camera_device *icd,
1891 */ 1898 */
1892 mf.width = 2560; 1899 mf.width = 2560;
1893 mf.height = 1920; 1900 mf.height = 1920;
1894 ret = v4l2_device_call_until_err(sd->v4l2_dev, (long)icd, video, 1901 ret = v4l2_device_call_until_err(sd->v4l2_dev,
1895 try_mbus_fmt, &mf); 1902 soc_camera_grp_id(icd), video,
1903 try_mbus_fmt, &mf);
1896 if (ret < 0) { 1904 if (ret < 0) {
1897 /* Shouldn't actually happen... */ 1905 /* Shouldn't actually happen... */
1898 dev_err(icd->parent, 1906 dev_err(icd->parent,
diff --git a/drivers/media/video/sh_mobile_csi2.c b/drivers/media/video/sh_mobile_csi2.c
index ea4f0473ed3b..8a652b53ff7e 100644
--- a/drivers/media/video/sh_mobile_csi2.c
+++ b/drivers/media/video/sh_mobile_csi2.c
@@ -143,7 +143,7 @@ static int sh_csi2_s_mbus_config(struct v4l2_subdev *sd,
143 const struct v4l2_mbus_config *cfg) 143 const struct v4l2_mbus_config *cfg)
144{ 144{
145 struct sh_csi2 *priv = container_of(sd, struct sh_csi2, subdev); 145 struct sh_csi2 *priv = container_of(sd, struct sh_csi2, subdev);
146 struct soc_camera_device *icd = (struct soc_camera_device *)sd->grp_id; 146 struct soc_camera_device *icd = v4l2_get_subdev_hostdata(sd);
147 struct v4l2_subdev *client_sd = soc_camera_to_subdev(icd); 147 struct v4l2_subdev *client_sd = soc_camera_to_subdev(icd);
148 struct v4l2_mbus_config client_cfg = {.type = V4L2_MBUS_CSI2, 148 struct v4l2_mbus_config client_cfg = {.type = V4L2_MBUS_CSI2,
149 .flags = priv->mipi_flags}; 149 .flags = priv->mipi_flags};
@@ -202,7 +202,7 @@ static void sh_csi2_hwinit(struct sh_csi2 *priv)
202static int sh_csi2_client_connect(struct sh_csi2 *priv) 202static int sh_csi2_client_connect(struct sh_csi2 *priv)
203{ 203{
204 struct sh_csi2_pdata *pdata = priv->pdev->dev.platform_data; 204 struct sh_csi2_pdata *pdata = priv->pdev->dev.platform_data;
205 struct soc_camera_device *icd = (struct soc_camera_device *)priv->subdev.grp_id; 205 struct soc_camera_device *icd = v4l2_get_subdev_hostdata(&priv->subdev);
206 struct v4l2_subdev *client_sd = soc_camera_to_subdev(icd); 206 struct v4l2_subdev *client_sd = soc_camera_to_subdev(icd);
207 struct device *dev = v4l2_get_subdevdata(&priv->subdev); 207 struct device *dev = v4l2_get_subdevdata(&priv->subdev);
208 struct v4l2_mbus_config cfg; 208 struct v4l2_mbus_config cfg;
diff --git a/drivers/media/video/soc_camera.c b/drivers/media/video/soc_camera.c
index b72580c38957..62e4312515cb 100644
--- a/drivers/media/video/soc_camera.c
+++ b/drivers/media/video/soc_camera.c
@@ -1103,7 +1103,8 @@ static int soc_camera_probe(struct soc_camera_device *icd)
1103 } 1103 }
1104 1104
1105 sd = soc_camera_to_subdev(icd); 1105 sd = soc_camera_to_subdev(icd);
1106 sd->grp_id = (long)icd; 1106 sd->grp_id = soc_camera_grp_id(icd);
1107 v4l2_set_subdev_hostdata(sd, icd);
1107 1108
1108 if (v4l2_ctrl_add_handler(&icd->ctrl_handler, sd->ctrl_handler)) 1109 if (v4l2_ctrl_add_handler(&icd->ctrl_handler, sd->ctrl_handler))
1109 goto ectrl; 1110 goto ectrl;