diff options
Diffstat (limited to 'drivers/media')
-rw-r--r-- | drivers/media/i2c/soc_camera/ov772x.c | 36 |
1 files changed, 7 insertions, 29 deletions
diff --git a/drivers/media/i2c/soc_camera/ov772x.c b/drivers/media/i2c/soc_camera/ov772x.c index c7bb988e295e..c02676b023f2 100644 --- a/drivers/media/i2c/soc_camera/ov772x.c +++ b/drivers/media/i2c/soc_camera/ov772x.c | |||
@@ -919,38 +919,16 @@ static int ov772x_s_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf) | |||
919 | static int ov772x_try_fmt(struct v4l2_subdev *sd, | 919 | static int ov772x_try_fmt(struct v4l2_subdev *sd, |
920 | struct v4l2_mbus_framefmt *mf) | 920 | struct v4l2_mbus_framefmt *mf) |
921 | { | 921 | { |
922 | struct ov772x_priv *priv = container_of(sd, struct ov772x_priv, subdev); | 922 | const struct ov772x_color_format *cfmt; |
923 | const struct ov772x_win_size *win; | 923 | const struct ov772x_win_size *win; |
924 | int i; | ||
925 | |||
926 | /* | ||
927 | * select suitable win | ||
928 | */ | ||
929 | win = ov772x_select_win(mf->width, mf->height); | ||
930 | 924 | ||
931 | mf->width = win->width; | 925 | ov772x_select_params(mf, &cfmt, &win); |
932 | mf->height = win->height; | ||
933 | mf->field = V4L2_FIELD_NONE; | ||
934 | |||
935 | for (i = 0; i < ARRAY_SIZE(ov772x_cfmts); i++) | ||
936 | if (mf->code == ov772x_cfmts[i].code) | ||
937 | break; | ||
938 | 926 | ||
939 | if (i == ARRAY_SIZE(ov772x_cfmts)) { | 927 | mf->code = cfmt->code; |
940 | /* Unsupported format requested. Propose either */ | 928 | mf->width = win->width; |
941 | if (priv->cfmt) { | 929 | mf->height = win->height; |
942 | /* the current one or */ | 930 | mf->field = V4L2_FIELD_NONE; |
943 | mf->colorspace = priv->cfmt->colorspace; | 931 | mf->colorspace = cfmt->colorspace; |
944 | mf->code = priv->cfmt->code; | ||
945 | } else { | ||
946 | /* the default one */ | ||
947 | mf->colorspace = ov772x_cfmts[0].colorspace; | ||
948 | mf->code = ov772x_cfmts[0].code; | ||
949 | } | ||
950 | } else { | ||
951 | /* Also return the colorspace */ | ||
952 | mf->colorspace = ov772x_cfmts[i].colorspace; | ||
953 | } | ||
954 | 932 | ||
955 | return 0; | 933 | return 0; |
956 | } | 934 | } |