Skip to content

Commit b9ccea5

Browse files
prabhakarladgregkh
authored andcommitted
media: i2c: ov5640: Remain in power down for DVP mode unless streaming
[ Upstream commit 3b987d7 ] Keep the sensor in software power down mode and wake up only in ov5640_set_stream_dvp() callback. Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com> Tested-by: Jacopo Mondi <jacopo@jmondi.org> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 8409370 commit b9ccea5

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

drivers/media/i2c/ov5640.c

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@
3434
#define OV5640_REG_SYS_RESET02 0x3002
3535
#define OV5640_REG_SYS_CLOCK_ENABLE02 0x3006
3636
#define OV5640_REG_SYS_CTRL0 0x3008
37+
#define OV5640_REG_SYS_CTRL0_SW_PWDN 0x42
38+
#define OV5640_REG_SYS_CTRL0_SW_PWUP 0x02
3739
#define OV5640_REG_CHIP_ID 0x300a
3840
#define OV5640_REG_IO_MIPI_CTRL00 0x300e
3941
#define OV5640_REG_PAD_OUTPUT_ENABLE01 0x3017
@@ -1109,6 +1111,12 @@ static int ov5640_load_regs(struct ov5640_dev *sensor,
11091111
val = regs->val;
11101112
mask = regs->mask;
11111113

1114+
/* remain in power down mode for DVP */
1115+
if (regs->reg_addr == OV5640_REG_SYS_CTRL0 &&
1116+
val == OV5640_REG_SYS_CTRL0_SW_PWUP &&
1117+
sensor->ep.bus_type != V4L2_MBUS_CSI2_DPHY)
1118+
continue;
1119+
11121120
if (mask)
11131121
ret = ov5640_mod_reg(sensor, reg_addr, mask, val);
11141122
else
@@ -1286,9 +1294,14 @@ static int ov5640_set_stream_dvp(struct ov5640_dev *sensor, bool on)
12861294
* PAD OUTPUT ENABLE 02
12871295
* - [7:2]: D[5:0] output enable
12881296
*/
1289-
return ov5640_write_reg(sensor,
1290-
OV5640_REG_PAD_OUTPUT_ENABLE02,
1291-
on ? 0xfc : 0);
1297+
ret = ov5640_write_reg(sensor, OV5640_REG_PAD_OUTPUT_ENABLE02,
1298+
on ? 0xfc : 0);
1299+
if (ret)
1300+
return ret;
1301+
1302+
return ov5640_write_reg(sensor, OV5640_REG_SYS_CTRL0, on ?
1303+
OV5640_REG_SYS_CTRL0_SW_PWUP :
1304+
OV5640_REG_SYS_CTRL0_SW_PWDN);
12921305
}
12931306

12941307
static int ov5640_set_stream_mipi(struct ov5640_dev *sensor, bool on)

0 commit comments

Comments
 (0)