Commit 3b987d70 authored by Lad Prabhakar's avatar Lad Prabhakar Committed by Mauro Carvalho Chehab

media: i2c: ov5640: Remain in power down for DVP mode unless streaming

Keep the sensor in software power down mode and wake up only in
ov5640_set_stream_dvp() callback.
Signed-off-by: default avatarLad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Reviewed-by: default avatarBiju Das <biju.das.jz@bp.renesas.com>
Tested-by: default avatarJacopo Mondi <jacopo@jmondi.org>
Signed-off-by: default avatarSakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
parent 32b6e400
...@@ -34,6 +34,8 @@ ...@@ -34,6 +34,8 @@
#define OV5640_REG_SYS_RESET02 0x3002 #define OV5640_REG_SYS_RESET02 0x3002
#define OV5640_REG_SYS_CLOCK_ENABLE02 0x3006 #define OV5640_REG_SYS_CLOCK_ENABLE02 0x3006
#define OV5640_REG_SYS_CTRL0 0x3008 #define OV5640_REG_SYS_CTRL0 0x3008
#define OV5640_REG_SYS_CTRL0_SW_PWDN 0x42
#define OV5640_REG_SYS_CTRL0_SW_PWUP 0x02
#define OV5640_REG_CHIP_ID 0x300a #define OV5640_REG_CHIP_ID 0x300a
#define OV5640_REG_IO_MIPI_CTRL00 0x300e #define OV5640_REG_IO_MIPI_CTRL00 0x300e
#define OV5640_REG_PAD_OUTPUT_ENABLE01 0x3017 #define OV5640_REG_PAD_OUTPUT_ENABLE01 0x3017
...@@ -1120,6 +1122,12 @@ static int ov5640_load_regs(struct ov5640_dev *sensor, ...@@ -1120,6 +1122,12 @@ static int ov5640_load_regs(struct ov5640_dev *sensor,
val = regs->val; val = regs->val;
mask = regs->mask; mask = regs->mask;
/* remain in power down mode for DVP */
if (regs->reg_addr == OV5640_REG_SYS_CTRL0 &&
val == OV5640_REG_SYS_CTRL0_SW_PWUP &&
sensor->ep.bus_type != V4L2_MBUS_CSI2_DPHY)
continue;
if (mask) if (mask)
ret = ov5640_mod_reg(sensor, reg_addr, mask, val); ret = ov5640_mod_reg(sensor, reg_addr, mask, val);
else else
...@@ -1297,9 +1305,14 @@ static int ov5640_set_stream_dvp(struct ov5640_dev *sensor, bool on) ...@@ -1297,9 +1305,14 @@ static int ov5640_set_stream_dvp(struct ov5640_dev *sensor, bool on)
* PAD OUTPUT ENABLE 02 * PAD OUTPUT ENABLE 02
* - [7:2]: D[5:0] output enable * - [7:2]: D[5:0] output enable
*/ */
return ov5640_write_reg(sensor, ret = ov5640_write_reg(sensor, OV5640_REG_PAD_OUTPUT_ENABLE02,
OV5640_REG_PAD_OUTPUT_ENABLE02, on ? 0xfc : 0);
on ? 0xfc : 0); if (ret)
return ret;
return ov5640_write_reg(sensor, OV5640_REG_SYS_CTRL0, on ?
OV5640_REG_SYS_CTRL0_SW_PWUP :
OV5640_REG_SYS_CTRL0_SW_PWDN);
} }
static int ov5640_set_stream_mipi(struct ov5640_dev *sensor, bool on) static int ov5640_set_stream_mipi(struct ov5640_dev *sensor, bool on)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment