diff options
Diffstat (limited to 'drivers/media/video/saa7134/saa6752hs.c')
-rw-r--r-- | drivers/media/video/saa7134/saa6752hs.c | 46 |
1 files changed, 26 insertions, 20 deletions
diff --git a/drivers/media/video/saa7134/saa6752hs.c b/drivers/media/video/saa7134/saa6752hs.c index 1eabff6b2456..40fd31ca7716 100644 --- a/drivers/media/video/saa7134/saa6752hs.c +++ b/drivers/media/video/saa7134/saa6752hs.c | |||
@@ -846,24 +846,28 @@ static int saa6752hs_g_ext_ctrls(struct v4l2_subdev *sd, struct v4l2_ext_control | |||
846 | return 0; | 846 | return 0; |
847 | } | 847 | } |
848 | 848 | ||
849 | static int saa6752hs_g_fmt(struct v4l2_subdev *sd, struct v4l2_format *f) | 849 | static int saa6752hs_g_mbus_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *f) |
850 | { | 850 | { |
851 | struct saa6752hs_state *h = to_state(sd); | 851 | struct saa6752hs_state *h = to_state(sd); |
852 | 852 | ||
853 | if (h->video_format == SAA6752HS_VF_UNKNOWN) | 853 | if (h->video_format == SAA6752HS_VF_UNKNOWN) |
854 | h->video_format = SAA6752HS_VF_D1; | 854 | h->video_format = SAA6752HS_VF_D1; |
855 | f->fmt.pix.width = | 855 | f->width = v4l2_format_table[h->video_format].fmt.pix.width; |
856 | v4l2_format_table[h->video_format].fmt.pix.width; | 856 | f->height = v4l2_format_table[h->video_format].fmt.pix.height; |
857 | f->fmt.pix.height = | 857 | f->code = V4L2_MBUS_FMT_FIXED; |
858 | v4l2_format_table[h->video_format].fmt.pix.height; | 858 | f->field = V4L2_FIELD_INTERLACED; |
859 | f->colorspace = V4L2_COLORSPACE_SMPTE170M; | ||
859 | return 0; | 860 | return 0; |
860 | } | 861 | } |
861 | 862 | ||
862 | static int saa6752hs_s_fmt(struct v4l2_subdev *sd, struct v4l2_format *f) | 863 | static int saa6752hs_s_mbus_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *f) |
863 | { | 864 | { |
864 | struct saa6752hs_state *h = to_state(sd); | 865 | struct saa6752hs_state *h = to_state(sd); |
865 | int dist_352, dist_480, dist_720; | 866 | int dist_352, dist_480, dist_720; |
866 | 867 | ||
868 | if (f->code != V4L2_MBUS_FMT_FIXED) | ||
869 | return -EINVAL; | ||
870 | |||
867 | /* | 871 | /* |
868 | FIXME: translate and round width/height into EMPRESS | 872 | FIXME: translate and round width/height into EMPRESS |
869 | subsample type: | 873 | subsample type: |
@@ -876,28 +880,30 @@ static int saa6752hs_s_fmt(struct v4l2_subdev *sd, struct v4l2_format *f) | |||
876 | D1 | 720x576 | 720x480 | 880 | D1 | 720x576 | 720x480 |
877 | */ | 881 | */ |
878 | 882 | ||
879 | dist_352 = abs(f->fmt.pix.width - 352); | 883 | dist_352 = abs(f->width - 352); |
880 | dist_480 = abs(f->fmt.pix.width - 480); | 884 | dist_480 = abs(f->width - 480); |
881 | dist_720 = abs(f->fmt.pix.width - 720); | 885 | dist_720 = abs(f->width - 720); |
882 | if (dist_720 < dist_480) { | 886 | if (dist_720 < dist_480) { |
883 | f->fmt.pix.width = 720; | 887 | f->width = 720; |
884 | f->fmt.pix.height = 576; | 888 | f->height = 576; |
885 | h->video_format = SAA6752HS_VF_D1; | 889 | h->video_format = SAA6752HS_VF_D1; |
886 | } else if (dist_480 < dist_352) { | 890 | } else if (dist_480 < dist_352) { |
887 | f->fmt.pix.width = 480; | 891 | f->width = 480; |
888 | f->fmt.pix.height = 576; | 892 | f->height = 576; |
889 | h->video_format = SAA6752HS_VF_2_3_D1; | 893 | h->video_format = SAA6752HS_VF_2_3_D1; |
890 | } else { | 894 | } else { |
891 | f->fmt.pix.width = 352; | 895 | f->width = 352; |
892 | if (abs(f->fmt.pix.height - 576) < | 896 | if (abs(f->height - 576) < |
893 | abs(f->fmt.pix.height - 288)) { | 897 | abs(f->height - 288)) { |
894 | f->fmt.pix.height = 576; | 898 | f->height = 576; |
895 | h->video_format = SAA6752HS_VF_1_2_D1; | 899 | h->video_format = SAA6752HS_VF_1_2_D1; |
896 | } else { | 900 | } else { |
897 | f->fmt.pix.height = 288; | 901 | f->height = 288; |
898 | h->video_format = SAA6752HS_VF_SIF; | 902 | h->video_format = SAA6752HS_VF_SIF; |
899 | } | 903 | } |
900 | } | 904 | } |
905 | f->field = V4L2_FIELD_INTERLACED; | ||
906 | f->colorspace = V4L2_COLORSPACE_SMPTE170M; | ||
901 | return 0; | 907 | return 0; |
902 | } | 908 | } |
903 | 909 | ||
@@ -932,8 +938,8 @@ static const struct v4l2_subdev_core_ops saa6752hs_core_ops = { | |||
932 | }; | 938 | }; |
933 | 939 | ||
934 | static const struct v4l2_subdev_video_ops saa6752hs_video_ops = { | 940 | static const struct v4l2_subdev_video_ops saa6752hs_video_ops = { |
935 | .s_fmt = saa6752hs_s_fmt, | 941 | .s_mbus_fmt = saa6752hs_s_mbus_fmt, |
936 | .g_fmt = saa6752hs_g_fmt, | 942 | .g_mbus_fmt = saa6752hs_g_mbus_fmt, |
937 | }; | 943 | }; |
938 | 944 | ||
939 | static const struct v4l2_subdev_ops saa6752hs_ops = { | 945 | static const struct v4l2_subdev_ops saa6752hs_ops = { |