aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/s2255drv.c
diff options
context:
space:
mode:
authorDean Anderson <dean@sensoray.com>2009-05-15 13:32:04 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2009-06-16 17:21:12 -0400
commit7d8535329c4e620c155895a33e1bcc47239858b8 (patch)
tree41f6ec10be0ddff14429cdce4deda093ae5e5ca0 /drivers/media/video/s2255drv.c
parent849a3aba2d9830dc2a78a66078023e7e5ac26e15 (diff)
V4L/DVB (11851): patch: s2255drv: adding V4L2_MODE_HIGHQUALITY
Adding V4L2_MODE_HIGHQUALITY feature. Signed-off-by: Dean Anderson <dean@sensoray.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/s2255drv.c')
-rw-r--r--drivers/media/video/s2255drv.c48
1 files changed, 45 insertions, 3 deletions
diff --git a/drivers/media/video/s2255drv.c b/drivers/media/video/s2255drv.c
index 90e1dbc1aa89..f08939c1f164 100644
--- a/drivers/media/video/s2255drv.c
+++ b/drivers/media/video/s2255drv.c
@@ -109,6 +109,8 @@
109#define SCALE_4CIFS 1 /* 640x480(NTSC) or 704x576(PAL) */ 109#define SCALE_4CIFS 1 /* 640x480(NTSC) or 704x576(PAL) */
110#define SCALE_2CIFS 2 /* 640x240(NTSC) or 704x288(PAL) */ 110#define SCALE_2CIFS 2 /* 640x240(NTSC) or 704x288(PAL) */
111#define SCALE_1CIFS 3 /* 320x240(NTSC) or 352x288(PAL) */ 111#define SCALE_1CIFS 3 /* 320x240(NTSC) or 352x288(PAL) */
112/* SCALE_4CIFSI is the 2 fields interpolated into one */
113#define SCALE_4CIFSI 4 /* 640x480(NTSC) or 704x576(PAL) high quality */
112 114
113#define COLOR_YUVPL 1 /* YUV planar */ 115#define COLOR_YUVPL 1 /* YUV planar */
114#define COLOR_YUVPK 2 /* YUV packed */ 116#define COLOR_YUVPK 2 /* YUV packed */
@@ -238,6 +240,8 @@ struct s2255_dev {
238 struct s2255_mode mode[MAX_CHANNELS]; 240 struct s2255_mode mode[MAX_CHANNELS];
239 /* jpeg compression */ 241 /* jpeg compression */
240 struct v4l2_jpegcompression jc[MAX_CHANNELS]; 242 struct v4l2_jpegcompression jc[MAX_CHANNELS];
243 /* capture parameters (for high quality mode full size) */
244 struct v4l2_captureparm cap_parm[MAX_CHANNELS];
241 const struct s2255_fmt *cur_fmt[MAX_CHANNELS]; 245 const struct s2255_fmt *cur_fmt[MAX_CHANNELS];
242 int cur_frame[MAX_CHANNELS]; 246 int cur_frame[MAX_CHANNELS];
243 int last_frame[MAX_CHANNELS]; 247 int last_frame[MAX_CHANNELS];
@@ -1020,9 +1024,16 @@ static int vidioc_s_fmt_vid_cap(struct file *file, void *priv,
1020 fh->type = f->type; 1024 fh->type = f->type;
1021 norm = norm_minw(fh->dev->vdev[fh->channel]); 1025 norm = norm_minw(fh->dev->vdev[fh->channel]);
1022 if (fh->width > norm_minw(fh->dev->vdev[fh->channel])) { 1026 if (fh->width > norm_minw(fh->dev->vdev[fh->channel])) {
1023 if (fh->height > norm_minh(fh->dev->vdev[fh->channel])) 1027 if (fh->height > norm_minh(fh->dev->vdev[fh->channel])) {
1024 fh->mode.scale = SCALE_4CIFS; 1028 if (fh->dev->cap_parm[fh->channel].capturemode &
1025 else 1029 V4L2_MODE_HIGHQUALITY) {
1030 fh->mode.scale = SCALE_4CIFSI;
1031 dprintk(2, "scale 4CIFSI\n");
1032 } else {
1033 fh->mode.scale = SCALE_4CIFS;
1034 dprintk(2, "scale 4CIFS\n");
1035 }
1036 } else
1026 fh->mode.scale = SCALE_2CIFS; 1037 fh->mode.scale = SCALE_2CIFS;
1027 1038
1028 } else { 1039 } else {
@@ -1123,6 +1134,7 @@ static u32 get_transfer_size(struct s2255_mode *mode)
1123 if (mode->format == FORMAT_NTSC) { 1134 if (mode->format == FORMAT_NTSC) {
1124 switch (mode->scale) { 1135 switch (mode->scale) {
1125 case SCALE_4CIFS: 1136 case SCALE_4CIFS:
1137 case SCALE_4CIFSI:
1126 linesPerFrame = NUM_LINES_4CIFS_NTSC * 2; 1138 linesPerFrame = NUM_LINES_4CIFS_NTSC * 2;
1127 pixelsPerLine = LINE_SZ_4CIFS_NTSC; 1139 pixelsPerLine = LINE_SZ_4CIFS_NTSC;
1128 break; 1140 break;
@@ -1140,6 +1152,7 @@ static u32 get_transfer_size(struct s2255_mode *mode)
1140 } else if (mode->format == FORMAT_PAL) { 1152 } else if (mode->format == FORMAT_PAL) {
1141 switch (mode->scale) { 1153 switch (mode->scale) {
1142 case SCALE_4CIFS: 1154 case SCALE_4CIFS:
1155 case SCALE_4CIFSI:
1143 linesPerFrame = NUM_LINES_4CIFS_PAL * 2; 1156 linesPerFrame = NUM_LINES_4CIFS_PAL * 2;
1144 pixelsPerLine = LINE_SZ_4CIFS_PAL; 1157 pixelsPerLine = LINE_SZ_4CIFS_PAL;
1145 break; 1158 break;
@@ -1495,6 +1508,33 @@ static int vidioc_s_jpegcomp(struct file *file, void *priv,
1495 dprintk(2, "setting jpeg quality %d\n", jc->quality); 1508 dprintk(2, "setting jpeg quality %d\n", jc->quality);
1496 return 0; 1509 return 0;
1497} 1510}
1511
1512static int vidioc_g_parm(struct file *file, void *priv,
1513 struct v4l2_streamparm *sp)
1514{
1515 struct s2255_fh *fh = priv;
1516 struct s2255_dev *dev = fh->dev;
1517 if (sp->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
1518 return -EINVAL;
1519 sp->parm.capture.capturemode = dev->cap_parm[fh->channel].capturemode;
1520 dprintk(2, "getting parm %d\n", sp->parm.capture.capturemode);
1521 return 0;
1522}
1523
1524static int vidioc_s_parm(struct file *file, void *priv,
1525 struct v4l2_streamparm *sp)
1526{
1527 struct s2255_fh *fh = priv;
1528 struct s2255_dev *dev = fh->dev;
1529
1530 if (sp->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
1531 return -EINVAL;
1532
1533 dev->cap_parm[fh->channel].capturemode = sp->parm.capture.capturemode;
1534 dprintk(2, "setting param capture mode %d\n",
1535 sp->parm.capture.capturemode);
1536 return 0;
1537}
1498static int s2255_open(struct file *file) 1538static int s2255_open(struct file *file)
1499{ 1539{
1500 int minor = video_devdata(file)->minor; 1540 int minor = video_devdata(file)->minor;
@@ -1786,6 +1826,8 @@ static const struct v4l2_ioctl_ops s2255_ioctl_ops = {
1786#endif 1826#endif
1787 .vidioc_s_jpegcomp = vidioc_s_jpegcomp, 1827 .vidioc_s_jpegcomp = vidioc_s_jpegcomp,
1788 .vidioc_g_jpegcomp = vidioc_g_jpegcomp, 1828 .vidioc_g_jpegcomp = vidioc_g_jpegcomp,
1829 .vidioc_s_parm = vidioc_s_parm,
1830 .vidioc_g_parm = vidioc_g_parm,
1789}; 1831};
1790 1832
1791static struct video_device template = { 1833static struct video_device template = {