diff options
author | Hans Verkuil <hans.verkuil@cisco.com> | 2015-03-21 08:39:09 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@osg.samsung.com> | 2015-05-01 07:52:34 -0400 |
commit | 6e80c4738aa12701a5714cb3e4a685f95c1ffe5f (patch) | |
tree | 51afb520ab85c708d1b2dbfb2093d76dffea5e43 /drivers/media/i2c | |
parent | 717fd5b4907ada90ceb069d484068aaa01c58bb0 (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>
Diffstat (limited to 'drivers/media/i2c')
-rw-r--r-- | drivers/media/i2c/adv7170.c | 16 | ||||
-rw-r--r-- | drivers/media/i2c/adv7175.c | 16 | ||||
-rw-r--r-- | drivers/media/i2c/cx25840/cx25840-core.c | 15 | ||||
-rw-r--r-- | drivers/media/i2c/saa7115.c | 16 | ||||
-rw-r--r-- | drivers/media/i2c/saa717x.c | 16 |
5 files changed, 60 insertions, 19 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 | ||
299 | static int adv7170_s_fmt(struct v4l2_subdev *sd, | 299 | static 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, | |||
327 | static const struct v4l2_subdev_video_ops adv7170_video_ops = { | 333 | static 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 | ||
333 | static const struct v4l2_subdev_pad_ops adv7170_pad_ops = { | 338 | static 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 | ||
338 | static const struct v4l2_subdev_ops adv7170_ops = { | 344 | static 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 | ||
337 | static int adv7175_s_fmt(struct v4l2_subdev *sd, | 337 | static 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 = { | |||
380 | static const struct v4l2_subdev_video_ops adv7175_video_ops = { | 386 | static 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 | ||
386 | static const struct v4l2_subdev_pad_ops adv7175_pad_ops = { | 391 | static 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 | ||
391 | static const struct v4l2_subdev_ops adv7175_ops = { | 397 | static 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 | ||
1369 | static int cx25840_s_mbus_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *fmt) | 1369 | static 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 | ||
5087 | static const struct v4l2_subdev_pad_ops cx25840_pad_ops = { | ||
5088 | .set_fmt = cx25840_set_fmt, | ||
5089 | }; | ||
5090 | |||
5083 | static const struct v4l2_subdev_ops cx25840_ops = { | 5091 | static 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 | ||
1173 | static int saa711x_s_mbus_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *fmt) | 1173 | static 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 | ||
1625 | static const struct v4l2_subdev_pad_ops saa711x_pad_ops = { | ||
1626 | .set_fmt = saa711x_set_fmt, | ||
1627 | }; | ||
1628 | |||
1620 | static const struct v4l2_subdev_ops saa711x_ops = { | 1629 | static 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 | ||
995 | static int saa717x_s_mbus_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *fmt) | 995 | static 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 = { | |||
1217 | static const struct v4l2_subdev_video_ops saa717x_video_ops = { | 1223 | static 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 | ||
1233 | static const struct v4l2_subdev_pad_ops saa717x_pad_ops = { | ||
1234 | .set_fmt = saa717x_set_fmt, | ||
1235 | }; | ||
1236 | |||
1228 | static const struct v4l2_subdev_ops saa717x_ops = { | 1237 | static 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 | /* ----------------------------------------------------------------------- */ |