Skip to content

Commit 3d804a8

Browse files
committed
media: i2c: imx283: Simplify VFLIP control setting
The VFLIP control is configured through the MDVREV bit of the HTRIMMING register. Simplify the conditional branch from 5 lines to 3 by determining the trim value which must always include setting the HTRIMMING_EN bit, and conditionally set the MDVREV before applying it to the hardware. Signed-off-by: Kieran Bingham <[email protected]>
1 parent 19479ab commit 3d804a8

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

drivers/media/i2c/imx283.c

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -948,13 +948,11 @@ static int imx283_set_ctrl(struct v4l2_ctrl *ctrl)
948948
* VFLIP is managed by BIT(0) of IMX283_REG_HTRIMMING address, hence
949949
* both need to be set simultaneously.
950950
*/
951-
if (ctrl->val) {
952-
cci_write(imx283->cci, IMX283_REG_HTRIMMING,
953-
IMX283_HTRIMMING_EN | IMX283_MDVREV, &ret);
954-
} else {
955-
cci_write(imx283->cci, IMX283_REG_HTRIMMING,
956-
IMX283_HTRIMMING_EN, &ret);
957-
}
951+
u8 trim = IMX283_HTRIMMING_EN;
952+
953+
trim |= ctrl->val ? IMX283_MDVREV : 0;
954+
cci_write(imx283->cci, IMX283_REG_HTRIMMING, trim, &ret);
955+
958956
break;
959957

960958
case V4L2_CID_TEST_PATTERN:

0 commit comments

Comments
 (0)