Skip to content

Commit 00869da

Browse files
trunghieulenxpngphibang
authored andcommitted
drivers: video: ov5640: Fix constrast value sign
Fix sign's register for constrast value. Signed-off-by: Trung Hieu Le <trunghieu.le@nxp.com> Signed-off-by: Phi Bang Nguyen <phibang.nguyen@nxp.com>
1 parent 61eb9ab commit 00869da

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

drivers/video/ov5640.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -988,8 +988,9 @@ static int ov5640_set_ctrl_brightness(const struct device *dev, int value)
988988
static int ov5640_set_ctrl_contrast(const struct device *dev, int value)
989989
{
990990
const struct ov5640_config *cfg = dev->config;
991+
const struct ov5640_data *data = dev->data;
991992

992-
if (!IN_RANGE(value, 0, UINT8_MAX)) {
993+
if (!IN_RANGE(value, -UINT8_MAX, UINT8_MAX)) {
993994
return -EINVAL;
994995
}
995996

@@ -999,6 +1000,11 @@ static int ov5640_set_ctrl_contrast(const struct device *dev, int value)
9991000
return ret;
10001001
}
10011002

1003+
ret = ov5640_modify_reg(&cfg->i2c, SDE_CTRL6_REG, BIT(2), value >= 0 ? 0 : BIT(2));
1004+
if (ret) {
1005+
return ret;
1006+
}
1007+
10021008
return ov5640_write_reg(&cfg->i2c, SDE_CTRL6_REG, value & 0xff);
10031009
}
10041010

0 commit comments

Comments
 (0)