aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHans Verkuil <hans.verkuil@cisco.com>2015-05-04 06:25:55 -0400
committerMauro Carvalho Chehab <mchehab@s-opensource.com>2017-04-14 21:32:26 -0400
commit34b92def75da204c1cb75d43f55bc99ac371531a (patch)
treea7d5ee4a3750053935f4f080e85943d84b9af311
parent137526904b1afae67c94150c214a0530c87e3d14 (diff)
[media] ov9740: avoid calling ov9740_res_roundup() twice
Simplify ov9740_s_fmt. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Reported-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
-rw-r--r--drivers/media/i2c/soc_camera/ov9740.c18
1 files changed, 1 insertions, 17 deletions
diff --git a/drivers/media/i2c/soc_camera/ov9740.c b/drivers/media/i2c/soc_camera/ov9740.c
index 2436ed54f63f..cc07b7ae5407 100644
--- a/drivers/media/i2c/soc_camera/ov9740.c
+++ b/drivers/media/i2c/soc_camera/ov9740.c
@@ -673,20 +673,8 @@ static int ov9740_s_fmt(struct v4l2_subdev *sd,
673{ 673{
674 struct i2c_client *client = v4l2_get_subdevdata(sd); 674 struct i2c_client *client = v4l2_get_subdevdata(sd);
675 struct ov9740_priv *priv = to_ov9740(sd); 675 struct ov9740_priv *priv = to_ov9740(sd);
676 enum v4l2_colorspace cspace;
677 u32 code = mf->code;
678 int ret; 676 int ret;
679 677
680 ov9740_res_roundup(&mf->width, &mf->height);
681
682 switch (code) {
683 case MEDIA_BUS_FMT_YUYV8_2X8:
684 cspace = V4L2_COLORSPACE_SRGB;
685 break;
686 default:
687 return -EINVAL;
688 }
689
690 ret = ov9740_reg_write_array(client, ov9740_defaults, 678 ret = ov9740_reg_write_array(client, ov9740_defaults,
691 ARRAY_SIZE(ov9740_defaults)); 679 ARRAY_SIZE(ov9740_defaults));
692 if (ret < 0) 680 if (ret < 0)
@@ -696,11 +684,7 @@ static int ov9740_s_fmt(struct v4l2_subdev *sd,
696 if (ret < 0) 684 if (ret < 0)
697 return ret; 685 return ret;
698 686
699 mf->code = code; 687 priv->current_mf = *mf;
700 mf->colorspace = cspace;
701
702 memcpy(&priv->current_mf, mf, sizeof(struct v4l2_mbus_framefmt));
703
704 return ret; 688 return ret;
705} 689}
706 690