aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/usb
diff options
context:
space:
mode:
authorFrank Schaefer <fschaefer.oss@googlemail.com>2014-03-24 15:33:16 -0400
committerMauro Carvalho Chehab <m.chehab@samsung.com>2014-05-23 12:16:54 -0400
commit52faaf78b5059fcc927f3b821e6aa92cf50d3143 (patch)
tree158c1c18a21f493e0a2e7d9da6045bf647fb7d70 /drivers/media/usb
parent9297285e51c0f0305b660d6330a7916da18451c8 (diff)
[media] em28xx: move TV norm from struct em28xx to struct v4l2
TV norm is specific to analog TV reception. move it out of the common em28xx struct. Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Diffstat (limited to 'drivers/media/usb')
-rw-r--r--drivers/media/usb/em28xx/em28xx-video.c35
-rw-r--r--drivers/media/usb/em28xx/em28xx.h3
2 files changed, 21 insertions, 17 deletions
diff --git a/drivers/media/usb/em28xx/em28xx-video.c b/drivers/media/usb/em28xx/em28xx-video.c
index 9adecb996bf0..52eabda6fe09 100644
--- a/drivers/media/usb/em28xx/em28xx-video.c
+++ b/drivers/media/usb/em28xx/em28xx-video.c
@@ -155,13 +155,15 @@ static inline unsigned int norm_maxw(struct em28xx *dev)
155 155
156static inline unsigned int norm_maxh(struct em28xx *dev) 156static inline unsigned int norm_maxh(struct em28xx *dev)
157{ 157{
158 struct em28xx_v4l2 *v4l2 = dev->v4l2;
159
158 if (dev->board.is_webcam) 160 if (dev->board.is_webcam)
159 return dev->sensor_yres; 161 return dev->sensor_yres;
160 162
161 if (dev->board.max_range_640_480) 163 if (dev->board.max_range_640_480)
162 return 480; 164 return 480;
163 165
164 return (dev->norm & V4L2_STD_625_50) ? 576 : 480; 166 return (v4l2->norm & V4L2_STD_625_50) ? 576 : 480;
165} 167}
166 168
167static int em28xx_vbi_supported(struct em28xx *dev) 169static int em28xx_vbi_supported(struct em28xx *dev)
@@ -246,10 +248,10 @@ static int em28xx_set_outfmt(struct em28xx *dev)
246 em28xx_write_reg(dev, EM28XX_R34_VBI_START_H, 0x00); 248 em28xx_write_reg(dev, EM28XX_R34_VBI_START_H, 0x00);
247 em28xx_write_reg(dev, EM28XX_R36_VBI_WIDTH, v4l2->vbi_width/4); 249 em28xx_write_reg(dev, EM28XX_R36_VBI_WIDTH, v4l2->vbi_width/4);
248 em28xx_write_reg(dev, EM28XX_R37_VBI_HEIGHT, v4l2->vbi_height); 250 em28xx_write_reg(dev, EM28XX_R37_VBI_HEIGHT, v4l2->vbi_height);
249 if (dev->norm & V4L2_STD_525_60) { 251 if (v4l2->norm & V4L2_STD_525_60) {
250 /* NTSC */ 252 /* NTSC */
251 em28xx_write_reg(dev, EM28XX_R35_VBI_START_V, 0x09); 253 em28xx_write_reg(dev, EM28XX_R35_VBI_START_V, 0x09);
252 } else if (dev->norm & V4L2_STD_625_50) { 254 } else if (v4l2->norm & V4L2_STD_625_50) {
253 /* PAL */ 255 /* PAL */
254 em28xx_write_reg(dev, EM28XX_R35_VBI_START_V, 0x07); 256 em28xx_write_reg(dev, EM28XX_R35_VBI_START_V, 0x07);
255 } 257 }
@@ -330,7 +332,7 @@ static int em28xx_resolution_set(struct em28xx *dev)
330 332
331 /* Properly setup VBI */ 333 /* Properly setup VBI */
332 v4l2->vbi_width = 720; 334 v4l2->vbi_width = 720;
333 if (dev->norm & V4L2_STD_525_60) 335 if (v4l2->norm & V4L2_STD_525_60)
334 v4l2->vbi_height = 12; 336 v4l2->vbi_height = 12;
335 else 337 else
336 v4l2->vbi_height = 18; 338 v4l2->vbi_height = 18;
@@ -1345,7 +1347,7 @@ static int vidioc_g_std(struct file *file, void *priv, v4l2_std_id *norm)
1345 struct em28xx_fh *fh = priv; 1347 struct em28xx_fh *fh = priv;
1346 struct em28xx *dev = fh->dev; 1348 struct em28xx *dev = fh->dev;
1347 1349
1348 *norm = dev->norm; 1350 *norm = dev->v4l2->norm;
1349 1351
1350 return 0; 1352 return 0;
1351} 1353}
@@ -1367,13 +1369,13 @@ static int vidioc_s_std(struct file *file, void *priv, v4l2_std_id norm)
1367 struct em28xx_v4l2 *v4l2 = dev->v4l2; 1369 struct em28xx_v4l2 *v4l2 = dev->v4l2;
1368 struct v4l2_format f; 1370 struct v4l2_format f;
1369 1371
1370 if (norm == dev->norm) 1372 if (norm == v4l2->norm)
1371 return 0; 1373 return 0;
1372 1374
1373 if (dev->streaming_users > 0) 1375 if (dev->streaming_users > 0)
1374 return -EBUSY; 1376 return -EBUSY;
1375 1377
1376 dev->norm = norm; 1378 v4l2->norm = norm;
1377 1379
1378 /* Adjusts width/height, if needed */ 1380 /* Adjusts width/height, if needed */
1379 f.fmt.pix.width = 720; 1381 f.fmt.pix.width = 720;
@@ -1387,7 +1389,7 @@ static int vidioc_s_std(struct file *file, void *priv, v4l2_std_id norm)
1387 &v4l2->hscale, &v4l2->vscale); 1389 &v4l2->hscale, &v4l2->vscale);
1388 1390
1389 em28xx_resolution_set(dev); 1391 em28xx_resolution_set(dev);
1390 v4l2_device_call_all(&v4l2->v4l2_dev, 0, core, s_std, dev->norm); 1392 v4l2_device_call_all(&v4l2->v4l2_dev, 0, core, s_std, v4l2->norm);
1391 1393
1392 return 0; 1394 return 0;
1393} 1395}
@@ -1395,16 +1397,17 @@ static int vidioc_s_std(struct file *file, void *priv, v4l2_std_id norm)
1395static int vidioc_g_parm(struct file *file, void *priv, 1397static int vidioc_g_parm(struct file *file, void *priv,
1396 struct v4l2_streamparm *p) 1398 struct v4l2_streamparm *p)
1397{ 1399{
1398 struct em28xx_fh *fh = priv; 1400 struct em28xx_fh *fh = priv;
1399 struct em28xx *dev = fh->dev; 1401 struct em28xx *dev = fh->dev;
1402 struct em28xx_v4l2 *v4l2 = dev->v4l2;
1400 int rc = 0; 1403 int rc = 0;
1401 1404
1402 p->parm.capture.readbuffers = EM28XX_MIN_BUF; 1405 p->parm.capture.readbuffers = EM28XX_MIN_BUF;
1403 if (dev->board.is_webcam) 1406 if (dev->board.is_webcam)
1404 rc = v4l2_device_call_until_err(&dev->v4l2->v4l2_dev, 0, 1407 rc = v4l2_device_call_until_err(&v4l2->v4l2_dev, 0,
1405 video, g_parm, p); 1408 video, g_parm, p);
1406 else 1409 else
1407 v4l2_video_std_frame_period(dev->norm, 1410 v4l2_video_std_frame_period(v4l2->norm,
1408 &p->parm.capture.timeperframe); 1411 &p->parm.capture.timeperframe);
1409 1412
1410 return rc; 1413 return rc;
@@ -1805,11 +1808,11 @@ static int vidioc_g_fmt_vbi_cap(struct file *file, void *priv,
1805 memset(format->fmt.vbi.reserved, 0, sizeof(format->fmt.vbi.reserved)); 1808 memset(format->fmt.vbi.reserved, 0, sizeof(format->fmt.vbi.reserved));
1806 1809
1807 /* Varies by video standard (NTSC, PAL, etc.) */ 1810 /* Varies by video standard (NTSC, PAL, etc.) */
1808 if (dev->norm & V4L2_STD_525_60) { 1811 if (v4l2->norm & V4L2_STD_525_60) {
1809 /* NTSC */ 1812 /* NTSC */
1810 format->fmt.vbi.start[0] = 10; 1813 format->fmt.vbi.start[0] = 10;
1811 format->fmt.vbi.start[1] = 273; 1814 format->fmt.vbi.start[1] = 273;
1812 } else if (dev->norm & V4L2_STD_625_50) { 1815 } else if (v4l2->norm & V4L2_STD_625_50) {
1813 /* PAL */ 1816 /* PAL */
1814 format->fmt.vbi.start[0] = 6; 1817 format->fmt.vbi.start[0] = 6;
1815 format->fmt.vbi.start[1] = 318; 1818 format->fmt.vbi.start[1] = 318;
@@ -2421,8 +2424,8 @@ static int em28xx_v4l2_init(struct em28xx *dev)
2421 } 2424 }
2422 2425
2423 /* set default norm */ 2426 /* set default norm */
2424 dev->norm = V4L2_STD_PAL; 2427 v4l2->norm = V4L2_STD_PAL;
2425 v4l2_device_call_all(&v4l2->v4l2_dev, 0, core, s_std, dev->norm); 2428 v4l2_device_call_all(&v4l2->v4l2_dev, 0, core, s_std, v4l2->norm);
2426 dev->interlaced = EM28XX_INTERLACED_DEFAULT; 2429 dev->interlaced = EM28XX_INTERLACED_DEFAULT;
2427 2430
2428 /* Analog specific initialization */ 2431 /* Analog specific initialization */
diff --git a/drivers/media/usb/em28xx/em28xx.h b/drivers/media/usb/em28xx/em28xx.h
index ccb9cd5f8947..5cf423449896 100644
--- a/drivers/media/usb/em28xx/em28xx.h
+++ b/drivers/media/usb/em28xx/em28xx.h
@@ -519,6 +519,8 @@ struct em28xx_v4l2 {
519 u8 vinmode; 519 u8 vinmode;
520 u8 vinctl; 520 u8 vinctl;
521 521
522 v4l2_std_id norm; /* selected tv norm */
523
522 /* Frame properties */ 524 /* Frame properties */
523 int width; /* current frame width */ 525 int width; /* current frame width */
524 int height; /* current frame height */ 526 int height; /* current frame height */
@@ -633,7 +635,6 @@ struct em28xx {
633 /* video for linux */ 635 /* video for linux */
634 int users; /* user count for exclusive use */ 636 int users; /* user count for exclusive use */
635 int streaming_users; /* Number of actively streaming users */ 637 int streaming_users; /* Number of actively streaming users */
636 v4l2_std_id norm; /* selected tv norm */
637 int ctl_freq; /* selected frequency */ 638 int ctl_freq; /* selected frequency */
638 unsigned int ctl_input; /* selected input */ 639 unsigned int ctl_input; /* selected input */
639 unsigned int ctl_ainput;/* selected audio input */ 640 unsigned int ctl_ainput;/* selected audio input */