diff options
Diffstat (limited to 'drivers/media/video/saa717x.c')
-rw-r--r-- | drivers/media/video/saa717x.c | 38 |
1 files changed, 21 insertions, 17 deletions
diff --git a/drivers/media/video/saa717x.c b/drivers/media/video/saa717x.c index d521c648e157..78d69950c00a 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 | ||
1202 | static int saa717x_s_fmt(struct v4l2_subdev *sd, struct v4l2_format *fmt) | 1202 | static 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,19 +1245,19 @@ 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 | ||
@@ -1403,7 +1407,7 @@ static const struct v4l2_subdev_tuner_ops saa717x_tuner_ops = { | |||
1403 | 1407 | ||
1404 | static const struct v4l2_subdev_video_ops saa717x_video_ops = { | 1408 | static const struct v4l2_subdev_video_ops saa717x_video_ops = { |
1405 | .s_routing = saa717x_s_video_routing, | 1409 | .s_routing = saa717x_s_video_routing, |
1406 | .s_fmt = saa717x_s_fmt, | 1410 | .s_mbus_fmt = saa717x_s_mbus_fmt, |
1407 | .s_stream = saa717x_s_stream, | 1411 | .s_stream = saa717x_s_stream, |
1408 | }; | 1412 | }; |
1409 | 1413 | ||