aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/saa717x.c
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil@xs4all.nl>2010-05-09 08:50:34 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2010-06-01 00:20:27 -0400
commit6c69db9de7a8934bdeb690663fab6fe046203ac4 (patch)
tree267a5d8a10e2355e80b7ba88f0ef92d875b567a5 /drivers/media/video/saa717x.c
parent96fd004fe40b8e3beff2a6e27ae0411a4d315f1e (diff)
V4L/DVB: saa717x: add support for s_mbus_fmt
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/saa717x.c')
-rw-r--r--drivers/media/video/saa717x.c47
1 files changed, 31 insertions, 16 deletions
diff --git a/drivers/media/video/saa717x.c b/drivers/media/video/saa717x.c
index d521c648e157..422a3e222afa 100644
--- a/drivers/media/video/saa717x.c
+++ b/drivers/media/video/saa717x.c
@@ -1199,28 +1199,32 @@ static int saa717x_s_register(struct v4l2_subdev *sd, struct v4l2_dbg_register *
1199} 1199}
1200#endif 1200#endif
1201 1201
1202static int saa717x_s_fmt(struct v4l2_subdev *sd, struct v4l2_format *fmt) 1202static int saa717x_s_mbus_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *fmt)
1203{ 1203{
1204 struct v4l2_pix_format *pix;
1205 int prescale, h_scale, v_scale; 1204 int prescale, h_scale, v_scale;
1206 1205
1207 pix = &fmt->fmt.pix;
1208 v4l2_dbg(1, debug, sd, "decoder set size\n"); 1206 v4l2_dbg(1, debug, sd, "decoder set size\n");
1209 1207
1208 if (fmt->code != V4L2_MBUS_FMT_FIXED)
1209 return -EINVAL;
1210
1210 /* FIXME need better bounds checking here */ 1211 /* FIXME need better bounds checking here */
1211 if (pix->width < 1 || pix->width > 1440) 1212 if (fmt->width < 1 || fmt->width > 1440)
1212 return -EINVAL; 1213 return -EINVAL;
1213 if (pix->height < 1 || pix->height > 960) 1214 if (fmt->height < 1 || fmt->height > 960)
1214 return -EINVAL; 1215 return -EINVAL;
1215 1216
1217 fmt->field = V4L2_FIELD_INTERLACED;
1218 fmt->colorspace = V4L2_COLORSPACE_SMPTE170M;
1219
1216 /* scaling setting */ 1220 /* scaling setting */
1217 /* NTSC and interlace only */ 1221 /* NTSC and interlace only */
1218 prescale = SAA717X_NTSC_WIDTH / pix->width; 1222 prescale = SAA717X_NTSC_WIDTH / fmt->width;
1219 if (prescale == 0) 1223 if (prescale == 0)
1220 prescale = 1; 1224 prescale = 1;
1221 h_scale = 1024 * SAA717X_NTSC_WIDTH / prescale / pix->width; 1225 h_scale = 1024 * SAA717X_NTSC_WIDTH / prescale / fmt->width;
1222 /* interlace */ 1226 /* interlace */
1223 v_scale = 512 * 2 * SAA717X_NTSC_HEIGHT / pix->height; 1227 v_scale = 512 * 2 * SAA717X_NTSC_HEIGHT / fmt->height;
1224 1228
1225 /* Horizontal prescaling etc */ 1229 /* Horizontal prescaling etc */
1226 set_h_prescale(sd, 0, prescale); 1230 set_h_prescale(sd, 0, prescale);
@@ -1241,22 +1245,32 @@ static int saa717x_s_fmt(struct v4l2_subdev *sd, struct v4l2_format *fmt)
1241 /* set video output size */ 1245 /* set video output size */
1242 /* video number of pixels at output */ 1246 /* video number of pixels at output */
1243 /* TASK A */ 1247 /* TASK A */
1244 saa717x_write(sd, 0x5C, (u8)(pix->width & 0xFF)); 1248 saa717x_write(sd, 0x5C, (u8)(fmt->width & 0xFF));
1245 saa717x_write(sd, 0x5D, (u8)((pix->width >> 8) & 0xFF)); 1249 saa717x_write(sd, 0x5D, (u8)((fmt->width >> 8) & 0xFF));
1246 /* TASK B */ 1250 /* TASK B */
1247 saa717x_write(sd, 0x9C, (u8)(pix->width & 0xFF)); 1251 saa717x_write(sd, 0x9C, (u8)(fmt->width & 0xFF));
1248 saa717x_write(sd, 0x9D, (u8)((pix->width >> 8) & 0xFF)); 1252 saa717x_write(sd, 0x9D, (u8)((fmt->width >> 8) & 0xFF));
1249 1253
1250 /* video number of lines at output */ 1254 /* video number of lines at output */
1251 /* TASK A */ 1255 /* TASK A */
1252 saa717x_write(sd, 0x5E, (u8)(pix->height & 0xFF)); 1256 saa717x_write(sd, 0x5E, (u8)(fmt->height & 0xFF));
1253 saa717x_write(sd, 0x5F, (u8)((pix->height >> 8) & 0xFF)); 1257 saa717x_write(sd, 0x5F, (u8)((fmt->height >> 8) & 0xFF));
1254 /* TASK B */ 1258 /* TASK B */
1255 saa717x_write(sd, 0x9E, (u8)(pix->height & 0xFF)); 1259 saa717x_write(sd, 0x9E, (u8)(fmt->height & 0xFF));
1256 saa717x_write(sd, 0x9F, (u8)((pix->height >> 8) & 0xFF)); 1260 saa717x_write(sd, 0x9F, (u8)((fmt->height >> 8) & 0xFF));
1257 return 0; 1261 return 0;
1258} 1262}
1259 1263
1264static int saa717x_s_fmt(struct v4l2_subdev *sd, struct v4l2_format *fmt)
1265{
1266 struct v4l2_mbus_framefmt mbus_fmt;
1267
1268 mbus_fmt.width = fmt->fmt.pix.width;
1269 mbus_fmt.height = fmt->fmt.pix.height;
1270 mbus_fmt.code = V4L2_MBUS_FMT_FIXED;
1271 return saa717x_s_mbus_fmt(sd, &mbus_fmt);
1272}
1273
1260static int saa717x_s_radio(struct v4l2_subdev *sd) 1274static int saa717x_s_radio(struct v4l2_subdev *sd)
1261{ 1275{
1262 struct saa717x_state *decoder = to_state(sd); 1276 struct saa717x_state *decoder = to_state(sd);
@@ -1404,6 +1418,7 @@ static const struct v4l2_subdev_tuner_ops saa717x_tuner_ops = {
1404static const struct v4l2_subdev_video_ops saa717x_video_ops = { 1418static const struct v4l2_subdev_video_ops saa717x_video_ops = {
1405 .s_routing = saa717x_s_video_routing, 1419 .s_routing = saa717x_s_video_routing,
1406 .s_fmt = saa717x_s_fmt, 1420 .s_fmt = saa717x_s_fmt,
1421 .s_mbus_fmt = saa717x_s_mbus_fmt,
1407 .s_stream = saa717x_s_stream, 1422 .s_stream = saa717x_s_stream,
1408}; 1423};
1409 1424