diff options
author | Hans Verkuil <hans.verkuil@cisco.com> | 2013-02-15 12:46:40 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2013-03-19 15:07:59 -0400 |
commit | f96067af1f2313fd0e29c131368f33364f0ad98c (patch) | |
tree | 2a9bd88b26049b88f94cd3eb8e9ab1fc2f7ca137 /drivers/media/i2c/tvp7002.c | |
parent | f0cd015e31d3818c96a9b436357b39929c2a361b (diff) |
[media] tvp7002: use dv_timings structs instead of presets
In the functions tvp7002_mbus_fmt(), tvp7002_log_status and tvp7002_probe()
we should use the dv_timings data structures instead of dv_preset data
structures and functions.
This is the second step towards removing the deprecated preset support of this
driver.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Lad, Prabhakar <prabhakar.lad@ti.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/i2c/tvp7002.c')
-rw-r--r-- | drivers/media/i2c/tvp7002.c | 54 |
1 files changed, 17 insertions, 37 deletions
diff --git a/drivers/media/i2c/tvp7002.c b/drivers/media/i2c/tvp7002.c index 7995eeb8f847..d7a08bc49622 100644 --- a/drivers/media/i2c/tvp7002.c +++ b/drivers/media/i2c/tvp7002.c | |||
@@ -677,16 +677,10 @@ static int tvp7002_s_ctrl(struct v4l2_ctrl *ctrl) | |||
677 | static int tvp7002_mbus_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *f) | 677 | static int tvp7002_mbus_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *f) |
678 | { | 678 | { |
679 | struct tvp7002 *device = to_tvp7002(sd); | 679 | struct tvp7002 *device = to_tvp7002(sd); |
680 | struct v4l2_dv_enum_preset e_preset; | 680 | const struct v4l2_bt_timings *bt = &device->current_timings->timings.bt; |
681 | int error; | ||
682 | |||
683 | /* Calculate height and width based on current standard */ | ||
684 | error = v4l_fill_dv_preset_info(device->current_timings->preset, &e_preset); | ||
685 | if (error) | ||
686 | return error; | ||
687 | 681 | ||
688 | f->width = e_preset.width; | 682 | f->width = bt->width; |
689 | f->height = e_preset.height; | 683 | f->height = bt->height; |
690 | f->code = V4L2_MBUS_FMT_YUYV10_1X20; | 684 | f->code = V4L2_MBUS_FMT_YUYV10_1X20; |
691 | f->field = device->current_timings->scanmode; | 685 | f->field = device->current_timings->scanmode; |
692 | f->colorspace = device->current_timings->color_space; | 686 | f->colorspace = device->current_timings->color_space; |
@@ -896,35 +890,21 @@ static int tvp7002_s_stream(struct v4l2_subdev *sd, int enable) | |||
896 | */ | 890 | */ |
897 | static int tvp7002_log_status(struct v4l2_subdev *sd) | 891 | static int tvp7002_log_status(struct v4l2_subdev *sd) |
898 | { | 892 | { |
899 | const struct tvp7002_timings_definition *timings = tvp7002_timings; | ||
900 | struct tvp7002 *device = to_tvp7002(sd); | 893 | struct tvp7002 *device = to_tvp7002(sd); |
901 | struct v4l2_dv_enum_preset e_preset; | 894 | const struct v4l2_bt_timings *bt; |
902 | struct v4l2_dv_preset detected; | 895 | int detected; |
903 | int i; | ||
904 | 896 | ||
905 | detected.preset = V4L2_DV_INVALID; | 897 | /* Find my current timings */ |
906 | /* Find my current standard*/ | 898 | tvp7002_query_dv(sd, &detected); |
907 | tvp7002_query_dv_preset(sd, &detected); | ||
908 | 899 | ||
909 | /* Print standard related code values */ | 900 | bt = &device->current_timings->timings.bt; |
910 | for (i = 0; i < NUM_TIMINGS; i++, timings++) | 901 | v4l2_info(sd, "Selected DV Timings: %ux%u\n", bt->width, bt->height); |
911 | if (timings->preset == detected.preset) | 902 | if (detected == NUM_TIMINGS) { |
912 | break; | 903 | v4l2_info(sd, "Detected DV Timings: None\n"); |
913 | |||
914 | if (v4l_fill_dv_preset_info(device->current_timings->preset, &e_preset)) | ||
915 | return -EINVAL; | ||
916 | |||
917 | v4l2_info(sd, "Selected DV Preset: %s\n", e_preset.name); | ||
918 | v4l2_info(sd, " Pixels per line: %u\n", e_preset.width); | ||
919 | v4l2_info(sd, " Lines per frame: %u\n\n", e_preset.height); | ||
920 | if (i == NUM_TIMINGS) { | ||
921 | v4l2_info(sd, "Detected DV Preset: None\n"); | ||
922 | } else { | 904 | } else { |
923 | if (v4l_fill_dv_preset_info(timings->preset, &e_preset)) | 905 | bt = &tvp7002_timings[detected].timings.bt; |
924 | return -EINVAL; | 906 | v4l2_info(sd, "Detected DV Timings: %ux%u\n", |
925 | v4l2_info(sd, "Detected DV Preset: %s\n", e_preset.name); | 907 | bt->width, bt->height); |
926 | v4l2_info(sd, " Pixels per line: %u\n", e_preset.width); | ||
927 | v4l2_info(sd, " Lines per frame: %u\n\n", e_preset.height); | ||
928 | } | 908 | } |
929 | v4l2_info(sd, "Streaming enabled: %s\n", | 909 | v4l2_info(sd, "Streaming enabled: %s\n", |
930 | device->streaming ? "yes" : "no"); | 910 | device->streaming ? "yes" : "no"); |
@@ -1019,7 +999,7 @@ static int tvp7002_probe(struct i2c_client *c, const struct i2c_device_id *id) | |||
1019 | { | 999 | { |
1020 | struct v4l2_subdev *sd; | 1000 | struct v4l2_subdev *sd; |
1021 | struct tvp7002 *device; | 1001 | struct tvp7002 *device; |
1022 | struct v4l2_dv_preset preset; | 1002 | struct v4l2_dv_timings timings; |
1023 | int polarity_a; | 1003 | int polarity_a; |
1024 | int polarity_b; | 1004 | int polarity_b; |
1025 | u8 revision; | 1005 | u8 revision; |
@@ -1080,8 +1060,8 @@ static int tvp7002_probe(struct i2c_client *c, const struct i2c_device_id *id) | |||
1080 | return error; | 1060 | return error; |
1081 | 1061 | ||
1082 | /* Set registers according to default video mode */ | 1062 | /* Set registers according to default video mode */ |
1083 | preset.preset = device->current_timings->preset; | 1063 | timings = device->current_timings->timings; |
1084 | error = tvp7002_s_dv_preset(sd, &preset); | 1064 | error = tvp7002_s_dv_timings(sd, &timings); |
1085 | 1065 | ||
1086 | v4l2_ctrl_handler_init(&device->hdl, 1); | 1066 | v4l2_ctrl_handler_init(&device->hdl, 1); |
1087 | v4l2_ctrl_new_std(&device->hdl, &tvp7002_ctrl_ops, | 1067 | v4l2_ctrl_new_std(&device->hdl, &tvp7002_ctrl_ops, |