aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHans Verkuil <hans.verkuil@cisco.com>2015-03-21 08:39:09 -0400
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>2015-05-01 07:52:34 -0400
commit6e80c4738aa12701a5714cb3e4a685f95c1ffe5f (patch)
tree51afb520ab85c708d1b2dbfb2093d76dffea5e43
parent717fd5b4907ada90ceb069d484068aaa01c58bb0 (diff)
[media] v4l2: replace s_mbus_fmt by set_fmt
The s_mbus_fmt video op is a duplicate of the pad op. Replace all uses in sub-devices by the set_fmt() pad op. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
-rw-r--r--drivers/media/i2c/adv7170.c16
-rw-r--r--drivers/media/i2c/adv7175.c16
-rw-r--r--drivers/media/i2c/cx25840/cx25840-core.c15
-rw-r--r--drivers/media/i2c/saa7115.c16
-rw-r--r--drivers/media/i2c/saa717x.c16
-rw-r--r--drivers/media/pci/cx18/cx18-av-core.c16
-rw-r--r--drivers/media/usb/go7007/s2250-board.c18
7 files changed, 88 insertions, 25 deletions
diff --git a/drivers/media/i2c/adv7170.c b/drivers/media/i2c/adv7170.c
index 58d0a3cc0759..f0d3f5a2da46 100644
--- a/drivers/media/i2c/adv7170.c
+++ b/drivers/media/i2c/adv7170.c
@@ -296,11 +296,16 @@ static int adv7170_get_fmt(struct v4l2_subdev *sd,
296 return 0; 296 return 0;
297} 297}
298 298
299static int adv7170_s_fmt(struct v4l2_subdev *sd, 299static int adv7170_set_fmt(struct v4l2_subdev *sd,
300 struct v4l2_mbus_framefmt *mf) 300 struct v4l2_subdev_pad_config *cfg,
301 struct v4l2_subdev_format *format)
301{ 302{
303 struct v4l2_mbus_framefmt *mf = &format->format;
302 u8 val = adv7170_read(sd, 0x7); 304 u8 val = adv7170_read(sd, 0x7);
303 int ret; 305 int ret = 0;
306
307 if (format->pad)
308 return -EINVAL;
304 309
305 switch (mf->code) { 310 switch (mf->code) {
306 case MEDIA_BUS_FMT_UYVY8_2X8: 311 case MEDIA_BUS_FMT_UYVY8_2X8:
@@ -317,7 +322,8 @@ static int adv7170_s_fmt(struct v4l2_subdev *sd,
317 return -EINVAL; 322 return -EINVAL;
318 } 323 }
319 324
320 ret = adv7170_write(sd, 0x7, val); 325 if (format->which == V4L2_SUBDEV_FORMAT_ACTIVE)
326 ret = adv7170_write(sd, 0x7, val);
321 327
322 return ret; 328 return ret;
323} 329}
@@ -327,12 +333,12 @@ static int adv7170_s_fmt(struct v4l2_subdev *sd,
327static const struct v4l2_subdev_video_ops adv7170_video_ops = { 333static const struct v4l2_subdev_video_ops adv7170_video_ops = {
328 .s_std_output = adv7170_s_std_output, 334 .s_std_output = adv7170_s_std_output,
329 .s_routing = adv7170_s_routing, 335 .s_routing = adv7170_s_routing,
330 .s_mbus_fmt = adv7170_s_fmt,
331}; 336};
332 337
333static const struct v4l2_subdev_pad_ops adv7170_pad_ops = { 338static const struct v4l2_subdev_pad_ops adv7170_pad_ops = {
334 .enum_mbus_code = adv7170_enum_mbus_code, 339 .enum_mbus_code = adv7170_enum_mbus_code,
335 .get_fmt = adv7170_get_fmt, 340 .get_fmt = adv7170_get_fmt,
341 .set_fmt = adv7170_set_fmt,
336}; 342};
337 343
338static const struct v4l2_subdev_ops adv7170_ops = { 344static const struct v4l2_subdev_ops adv7170_ops = {
diff --git a/drivers/media/i2c/adv7175.c b/drivers/media/i2c/adv7175.c
index f7443454f682..321834ba8f57 100644
--- a/drivers/media/i2c/adv7175.c
+++ b/drivers/media/i2c/adv7175.c
@@ -334,11 +334,16 @@ static int adv7175_get_fmt(struct v4l2_subdev *sd,
334 return 0; 334 return 0;
335} 335}
336 336
337static int adv7175_s_fmt(struct v4l2_subdev *sd, 337static int adv7175_set_fmt(struct v4l2_subdev *sd,
338 struct v4l2_mbus_framefmt *mf) 338 struct v4l2_subdev_pad_config *cfg,
339 struct v4l2_subdev_format *format)
339{ 340{
341 struct v4l2_mbus_framefmt *mf = &format->format;
340 u8 val = adv7175_read(sd, 0x7); 342 u8 val = adv7175_read(sd, 0x7);
341 int ret; 343 int ret = 0;
344
345 if (format->pad)
346 return -EINVAL;
342 347
343 switch (mf->code) { 348 switch (mf->code) {
344 case MEDIA_BUS_FMT_UYVY8_2X8: 349 case MEDIA_BUS_FMT_UYVY8_2X8:
@@ -355,7 +360,8 @@ static int adv7175_s_fmt(struct v4l2_subdev *sd,
355 return -EINVAL; 360 return -EINVAL;
356 } 361 }
357 362
358 ret = adv7175_write(sd, 0x7, val); 363 if (format->which == V4L2_SUBDEV_FORMAT_ACTIVE)
364 ret = adv7175_write(sd, 0x7, val);
359 365
360 return ret; 366 return ret;
361} 367}
@@ -380,12 +386,12 @@ static const struct v4l2_subdev_core_ops adv7175_core_ops = {
380static const struct v4l2_subdev_video_ops adv7175_video_ops = { 386static const struct v4l2_subdev_video_ops adv7175_video_ops = {
381 .s_std_output = adv7175_s_std_output, 387 .s_std_output = adv7175_s_std_output,
382 .s_routing = adv7175_s_routing, 388 .s_routing = adv7175_s_routing,
383 .s_mbus_fmt = adv7175_s_fmt,
384}; 389};
385 390
386static const struct v4l2_subdev_pad_ops adv7175_pad_ops = { 391static const struct v4l2_subdev_pad_ops adv7175_pad_ops = {
387 .enum_mbus_code = adv7175_enum_mbus_code, 392 .enum_mbus_code = adv7175_enum_mbus_code,
388 .get_fmt = adv7175_get_fmt, 393 .get_fmt = adv7175_get_fmt,
394 .set_fmt = adv7175_set_fmt,
389}; 395};
390 396
391static const struct v4l2_subdev_ops adv7175_ops = { 397static const struct v4l2_subdev_ops adv7175_ops = {
diff --git a/drivers/media/i2c/cx25840/cx25840-core.c b/drivers/media/i2c/cx25840/cx25840-core.c
index 18e3615737f2..e15a789ad596 100644
--- a/drivers/media/i2c/cx25840/cx25840-core.c
+++ b/drivers/media/i2c/cx25840/cx25840-core.c
@@ -1366,14 +1366,17 @@ static int cx25840_s_ctrl(struct v4l2_ctrl *ctrl)
1366 1366
1367/* ----------------------------------------------------------------------- */ 1367/* ----------------------------------------------------------------------- */
1368 1368
1369static int cx25840_s_mbus_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *fmt) 1369static int cx25840_set_fmt(struct v4l2_subdev *sd,
1370 struct v4l2_subdev_pad_config *cfg,
1371 struct v4l2_subdev_format *format)
1370{ 1372{
1373 struct v4l2_mbus_framefmt *fmt = &format->format;
1371 struct cx25840_state *state = to_state(sd); 1374 struct cx25840_state *state = to_state(sd);
1372 struct i2c_client *client = v4l2_get_subdevdata(sd); 1375 struct i2c_client *client = v4l2_get_subdevdata(sd);
1373 int HSC, VSC, Vsrc, Hsrc, filter, Vlines; 1376 int HSC, VSC, Vsrc, Hsrc, filter, Vlines;
1374 int is_50Hz = !(state->std & V4L2_STD_525_60); 1377 int is_50Hz = !(state->std & V4L2_STD_525_60);
1375 1378
1376 if (fmt->code != MEDIA_BUS_FMT_FIXED) 1379 if (format->pad || fmt->code != MEDIA_BUS_FMT_FIXED)
1377 return -EINVAL; 1380 return -EINVAL;
1378 1381
1379 fmt->field = V4L2_FIELD_INTERLACED; 1382 fmt->field = V4L2_FIELD_INTERLACED;
@@ -1403,6 +1406,8 @@ static int cx25840_s_mbus_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt
1403 fmt->width, fmt->height); 1406 fmt->width, fmt->height);
1404 return -ERANGE; 1407 return -ERANGE;
1405 } 1408 }
1409 if (format->which == V4L2_SUBDEV_FORMAT_TRY)
1410 return 0;
1406 1411
1407 HSC = (Hsrc * (1 << 20)) / fmt->width - (1 << 20); 1412 HSC = (Hsrc * (1 << 20)) / fmt->width - (1 << 20);
1408 VSC = (1 << 16) - (Vsrc * (1 << 9) / Vlines - (1 << 9)); 1413 VSC = (1 << 16) - (Vsrc * (1 << 9) / Vlines - (1 << 9));
@@ -5068,7 +5073,6 @@ static const struct v4l2_subdev_video_ops cx25840_video_ops = {
5068 .s_std = cx25840_s_std, 5073 .s_std = cx25840_s_std,
5069 .g_std = cx25840_g_std, 5074 .g_std = cx25840_g_std,
5070 .s_routing = cx25840_s_video_routing, 5075 .s_routing = cx25840_s_video_routing,
5071 .s_mbus_fmt = cx25840_s_mbus_fmt,
5072 .s_stream = cx25840_s_stream, 5076 .s_stream = cx25840_s_stream,
5073 .g_input_status = cx25840_g_input_status, 5077 .g_input_status = cx25840_g_input_status,
5074}; 5078};
@@ -5080,12 +5084,17 @@ static const struct v4l2_subdev_vbi_ops cx25840_vbi_ops = {
5080 .g_sliced_fmt = cx25840_g_sliced_fmt, 5084 .g_sliced_fmt = cx25840_g_sliced_fmt,
5081}; 5085};
5082 5086
5087static const struct v4l2_subdev_pad_ops cx25840_pad_ops = {
5088 .set_fmt = cx25840_set_fmt,
5089};
5090
5083static const struct v4l2_subdev_ops cx25840_ops = { 5091static const struct v4l2_subdev_ops cx25840_ops = {
5084 .core = &cx25840_core_ops, 5092 .core = &cx25840_core_ops,
5085 .tuner = &cx25840_tuner_ops, 5093 .tuner = &cx25840_tuner_ops,
5086 .audio = &cx25840_audio_ops, 5094 .audio = &cx25840_audio_ops,
5087 .video = &cx25840_video_ops, 5095 .video = &cx25840_video_ops,
5088 .vbi = &cx25840_vbi_ops, 5096 .vbi = &cx25840_vbi_ops,
5097 .pad = &cx25840_pad_ops,
5089 .ir = &cx25840_ir_ops, 5098 .ir = &cx25840_ir_ops,
5090}; 5099};
5091 5100
diff --git a/drivers/media/i2c/saa7115.c b/drivers/media/i2c/saa7115.c
index 7147c8b68fac..0eae5f4471e2 100644
--- a/drivers/media/i2c/saa7115.c
+++ b/drivers/media/i2c/saa7115.c
@@ -1170,12 +1170,18 @@ static int saa711x_s_sliced_fmt(struct v4l2_subdev *sd, struct v4l2_sliced_vbi_f
1170 return 0; 1170 return 0;
1171} 1171}
1172 1172
1173static int saa711x_s_mbus_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *fmt) 1173static int saa711x_set_fmt(struct v4l2_subdev *sd,
1174 struct v4l2_subdev_pad_config *cfg,
1175 struct v4l2_subdev_format *format)
1174{ 1176{
1175 if (fmt->code != MEDIA_BUS_FMT_FIXED) 1177 struct v4l2_mbus_framefmt *fmt = &format->format;
1178
1179 if (format->pad || fmt->code != MEDIA_BUS_FMT_FIXED)
1176 return -EINVAL; 1180 return -EINVAL;
1177 fmt->field = V4L2_FIELD_INTERLACED; 1181 fmt->field = V4L2_FIELD_INTERLACED;
1178 fmt->colorspace = V4L2_COLORSPACE_SMPTE170M; 1182 fmt->colorspace = V4L2_COLORSPACE_SMPTE170M;
1183 if (format->which == V4L2_SUBDEV_FORMAT_TRY)
1184 return 0;
1179 return saa711x_set_size(sd, fmt->width, fmt->height); 1185 return saa711x_set_size(sd, fmt->width, fmt->height);
1180} 1186}
1181 1187
@@ -1603,7 +1609,6 @@ static const struct v4l2_subdev_video_ops saa711x_video_ops = {
1603 .s_std = saa711x_s_std, 1609 .s_std = saa711x_s_std,
1604 .s_routing = saa711x_s_routing, 1610 .s_routing = saa711x_s_routing,
1605 .s_crystal_freq = saa711x_s_crystal_freq, 1611 .s_crystal_freq = saa711x_s_crystal_freq,
1606 .s_mbus_fmt = saa711x_s_mbus_fmt,
1607 .s_stream = saa711x_s_stream, 1612 .s_stream = saa711x_s_stream,
1608 .querystd = saa711x_querystd, 1613 .querystd = saa711x_querystd,
1609 .g_input_status = saa711x_g_input_status, 1614 .g_input_status = saa711x_g_input_status,
@@ -1617,12 +1622,17 @@ static const struct v4l2_subdev_vbi_ops saa711x_vbi_ops = {
1617 .s_raw_fmt = saa711x_s_raw_fmt, 1622 .s_raw_fmt = saa711x_s_raw_fmt,
1618}; 1623};
1619 1624
1625static const struct v4l2_subdev_pad_ops saa711x_pad_ops = {
1626 .set_fmt = saa711x_set_fmt,
1627};
1628
1620static const struct v4l2_subdev_ops saa711x_ops = { 1629static const struct v4l2_subdev_ops saa711x_ops = {
1621 .core = &saa711x_core_ops, 1630 .core = &saa711x_core_ops,
1622 .tuner = &saa711x_tuner_ops, 1631 .tuner = &saa711x_tuner_ops,
1623 .audio = &saa711x_audio_ops, 1632 .audio = &saa711x_audio_ops,
1624 .video = &saa711x_video_ops, 1633 .video = &saa711x_video_ops,
1625 .vbi = &saa711x_vbi_ops, 1634 .vbi = &saa711x_vbi_ops,
1635 .pad = &saa711x_pad_ops,
1626}; 1636};
1627 1637
1628#define CHIP_VER_SIZE 16 1638#define CHIP_VER_SIZE 16
diff --git a/drivers/media/i2c/saa717x.c b/drivers/media/i2c/saa717x.c
index 17557b2f1b09..7d517361e419 100644
--- a/drivers/media/i2c/saa717x.c
+++ b/drivers/media/i2c/saa717x.c
@@ -992,13 +992,16 @@ static int saa717x_s_register(struct v4l2_subdev *sd, const struct v4l2_dbg_regi
992} 992}
993#endif 993#endif
994 994
995static int saa717x_s_mbus_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *fmt) 995static int saa717x_set_fmt(struct v4l2_subdev *sd,
996 struct v4l2_subdev_pad_config *cfg,
997 struct v4l2_subdev_format *format)
996{ 998{
999 struct v4l2_mbus_framefmt *fmt = &format->format;
997 int prescale, h_scale, v_scale; 1000 int prescale, h_scale, v_scale;
998 1001
999 v4l2_dbg(1, debug, sd, "decoder set size\n"); 1002 v4l2_dbg(1, debug, sd, "decoder set size\n");
1000 1003
1001 if (fmt->code != MEDIA_BUS_FMT_FIXED) 1004 if (format->pad || fmt->code != MEDIA_BUS_FMT_FIXED)
1002 return -EINVAL; 1005 return -EINVAL;
1003 1006
1004 /* FIXME need better bounds checking here */ 1007 /* FIXME need better bounds checking here */
@@ -1010,6 +1013,9 @@ static int saa717x_s_mbus_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt
1010 fmt->field = V4L2_FIELD_INTERLACED; 1013 fmt->field = V4L2_FIELD_INTERLACED;
1011 fmt->colorspace = V4L2_COLORSPACE_SMPTE170M; 1014 fmt->colorspace = V4L2_COLORSPACE_SMPTE170M;
1012 1015
1016 if (format->which == V4L2_SUBDEV_FORMAT_TRY)
1017 return 0;
1018
1013 /* scaling setting */ 1019 /* scaling setting */
1014 /* NTSC and interlace only */ 1020 /* NTSC and interlace only */
1015 prescale = SAA717X_NTSC_WIDTH / fmt->width; 1021 prescale = SAA717X_NTSC_WIDTH / fmt->width;
@@ -1217,7 +1223,6 @@ static const struct v4l2_subdev_tuner_ops saa717x_tuner_ops = {
1217static const struct v4l2_subdev_video_ops saa717x_video_ops = { 1223static const struct v4l2_subdev_video_ops saa717x_video_ops = {
1218 .s_std = saa717x_s_std, 1224 .s_std = saa717x_s_std,
1219 .s_routing = saa717x_s_video_routing, 1225 .s_routing = saa717x_s_video_routing,
1220 .s_mbus_fmt = saa717x_s_mbus_fmt,
1221 .s_stream = saa717x_s_stream, 1226 .s_stream = saa717x_s_stream,
1222}; 1227};
1223 1228
@@ -1225,11 +1230,16 @@ static const struct v4l2_subdev_audio_ops saa717x_audio_ops = {
1225 .s_routing = saa717x_s_audio_routing, 1230 .s_routing = saa717x_s_audio_routing,
1226}; 1231};
1227 1232
1233static const struct v4l2_subdev_pad_ops saa717x_pad_ops = {
1234 .set_fmt = saa717x_set_fmt,
1235};
1236
1228static const struct v4l2_subdev_ops saa717x_ops = { 1237static const struct v4l2_subdev_ops saa717x_ops = {
1229 .core = &saa717x_core_ops, 1238 .core = &saa717x_core_ops,
1230 .tuner = &saa717x_tuner_ops, 1239 .tuner = &saa717x_tuner_ops,
1231 .audio = &saa717x_audio_ops, 1240 .audio = &saa717x_audio_ops,
1232 .video = &saa717x_video_ops, 1241 .video = &saa717x_video_ops,
1242 .pad = &saa717x_pad_ops,
1233}; 1243};
1234 1244
1235/* ----------------------------------------------------------------------- */ 1245/* ----------------------------------------------------------------------- */
diff --git a/drivers/media/pci/cx18/cx18-av-core.c b/drivers/media/pci/cx18/cx18-av-core.c
index 5a55630d09db..30bbe8d1ea55 100644
--- a/drivers/media/pci/cx18/cx18-av-core.c
+++ b/drivers/media/pci/cx18/cx18-av-core.c
@@ -945,14 +945,17 @@ static int cx18_av_s_ctrl(struct v4l2_ctrl *ctrl)
945 return 0; 945 return 0;
946} 946}
947 947
948static int cx18_av_s_mbus_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *fmt) 948static int cx18_av_set_fmt(struct v4l2_subdev *sd,
949 struct v4l2_subdev_pad_config *cfg,
950 struct v4l2_subdev_format *format)
949{ 951{
952 struct v4l2_mbus_framefmt *fmt = &format->format;
950 struct cx18_av_state *state = to_cx18_av_state(sd); 953 struct cx18_av_state *state = to_cx18_av_state(sd);
951 struct cx18 *cx = v4l2_get_subdevdata(sd); 954 struct cx18 *cx = v4l2_get_subdevdata(sd);
952 int HSC, VSC, Vsrc, Hsrc, filter, Vlines; 955 int HSC, VSC, Vsrc, Hsrc, filter, Vlines;
953 int is_50Hz = !(state->std & V4L2_STD_525_60); 956 int is_50Hz = !(state->std & V4L2_STD_525_60);
954 957
955 if (fmt->code != MEDIA_BUS_FMT_FIXED) 958 if (format->pad || fmt->code != MEDIA_BUS_FMT_FIXED)
956 return -EINVAL; 959 return -EINVAL;
957 960
958 fmt->field = V4L2_FIELD_INTERLACED; 961 fmt->field = V4L2_FIELD_INTERLACED;
@@ -987,6 +990,9 @@ static int cx18_av_s_mbus_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt
987 return -ERANGE; 990 return -ERANGE;
988 } 991 }
989 992
993 if (format->which == V4L2_SUBDEV_FORMAT_TRY)
994 return 0;
995
990 HSC = (Hsrc * (1 << 20)) / fmt->width - (1 << 20); 996 HSC = (Hsrc * (1 << 20)) / fmt->width - (1 << 20);
991 VSC = (1 << 16) - (Vsrc * (1 << 9) / Vlines - (1 << 9)); 997 VSC = (1 << 16) - (Vsrc * (1 << 9) / Vlines - (1 << 9));
992 VSC &= 0x1fff; 998 VSC &= 0x1fff;
@@ -1285,7 +1291,6 @@ static const struct v4l2_subdev_video_ops cx18_av_video_ops = {
1285 .s_std = cx18_av_s_std, 1291 .s_std = cx18_av_s_std,
1286 .s_routing = cx18_av_s_video_routing, 1292 .s_routing = cx18_av_s_video_routing,
1287 .s_stream = cx18_av_s_stream, 1293 .s_stream = cx18_av_s_stream,
1288 .s_mbus_fmt = cx18_av_s_mbus_fmt,
1289}; 1294};
1290 1295
1291static const struct v4l2_subdev_vbi_ops cx18_av_vbi_ops = { 1296static const struct v4l2_subdev_vbi_ops cx18_av_vbi_ops = {
@@ -1295,12 +1300,17 @@ static const struct v4l2_subdev_vbi_ops cx18_av_vbi_ops = {
1295 .s_raw_fmt = cx18_av_s_raw_fmt, 1300 .s_raw_fmt = cx18_av_s_raw_fmt,
1296}; 1301};
1297 1302
1303static const struct v4l2_subdev_pad_ops cx18_av_pad_ops = {
1304 .set_fmt = cx18_av_set_fmt,
1305};
1306
1298static const struct v4l2_subdev_ops cx18_av_ops = { 1307static const struct v4l2_subdev_ops cx18_av_ops = {
1299 .core = &cx18_av_general_ops, 1308 .core = &cx18_av_general_ops,
1300 .tuner = &cx18_av_tuner_ops, 1309 .tuner = &cx18_av_tuner_ops,
1301 .audio = &cx18_av_audio_ops, 1310 .audio = &cx18_av_audio_ops,
1302 .video = &cx18_av_video_ops, 1311 .video = &cx18_av_video_ops,
1303 .vbi = &cx18_av_vbi_ops, 1312 .vbi = &cx18_av_vbi_ops,
1313 .pad = &cx18_av_pad_ops,
1304}; 1314};
1305 1315
1306int cx18_av_probe(struct cx18 *cx) 1316int cx18_av_probe(struct cx18 *cx)
diff --git a/drivers/media/usb/go7007/s2250-board.c b/drivers/media/usb/go7007/s2250-board.c
index bb846680bcd4..5c2a49534d2b 100644
--- a/drivers/media/usb/go7007/s2250-board.c
+++ b/drivers/media/usb/go7007/s2250-board.c
@@ -405,12 +405,20 @@ static int s2250_s_ctrl(struct v4l2_ctrl *ctrl)
405 return 0; 405 return 0;
406} 406}
407 407
408static int s2250_s_mbus_fmt(struct v4l2_subdev *sd, 408static int s2250_set_fmt(struct v4l2_subdev *sd,
409 struct v4l2_mbus_framefmt *fmt) 409 struct v4l2_subdev_pad_config *cfg,
410 struct v4l2_subdev_format *format)
410{ 411{
412 struct v4l2_mbus_framefmt *fmt = &format->format;
411 struct s2250 *state = to_state(sd); 413 struct s2250 *state = to_state(sd);
412 struct i2c_client *client = v4l2_get_subdevdata(sd); 414 struct i2c_client *client = v4l2_get_subdevdata(sd);
413 415
416 if (format->pad)
417 return -EINVAL;
418
419 if (format->which == V4L2_SUBDEV_FORMAT_TRY)
420 return 0;
421
414 if (fmt->height < 640) { 422 if (fmt->height < 640) {
415 write_reg_fp(client, 0x12b, state->reg12b_val | 0x400); 423 write_reg_fp(client, 0x12b, state->reg12b_val | 0x400);
416 write_reg_fp(client, 0x140, 0x060); 424 write_reg_fp(client, 0x140, 0x060);
@@ -479,13 +487,17 @@ static const struct v4l2_subdev_audio_ops s2250_audio_ops = {
479static const struct v4l2_subdev_video_ops s2250_video_ops = { 487static const struct v4l2_subdev_video_ops s2250_video_ops = {
480 .s_std = s2250_s_std, 488 .s_std = s2250_s_std,
481 .s_routing = s2250_s_video_routing, 489 .s_routing = s2250_s_video_routing,
482 .s_mbus_fmt = s2250_s_mbus_fmt, 490};
491
492static const struct v4l2_subdev_pad_ops s2250_pad_ops = {
493 .set_fmt = s2250_set_fmt,
483}; 494};
484 495
485static const struct v4l2_subdev_ops s2250_ops = { 496static const struct v4l2_subdev_ops s2250_ops = {
486 .core = &s2250_core_ops, 497 .core = &s2250_core_ops,
487 .audio = &s2250_audio_ops, 498 .audio = &s2250_audio_ops,
488 .video = &s2250_video_ops, 499 .video = &s2250_video_ops,
500 .pad = &s2250_pad_ops,
489}; 501};
490 502
491/* --------------------------------------------------------------------------*/ 503/* --------------------------------------------------------------------------*/