From: Hugues Fruchet <hugues.fruchet@st.com>
To: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>,
Jacopo Mondi <jacopo@jmondi.org>,
Steve Longerbeam <slongerbeam@gmail.com>,
Sakari Ailus <sakari.ailus@linux.intel.com>,
Hans Verkuil <hverkuil@xs4all.nl>,
Mauro Carvalho Chehab <mchehab@kernel.org>
Cc: <linux-media@vger.kernel.org>,
<linux-stm32@st-md-mailman.stormreply.com>,
Hugues Fruchet <hugues.fruchet@st.com>,
Alain Volmat <alain.volmat@st.com>
Subject: [PATCH] media: ov5640: fix MIPI power sequence
Date: Wed, 7 Oct 2020 16:43:18 +0200 [thread overview]
Message-ID: <1602081798-17548-2-git-send-email-hugues.fruchet@st.com> (raw)
In-Reply-To: <1602081798-17548-1-git-send-email-hugues.fruchet@st.com>
fixes: b1751ae652fb ("media: i2c: ov5640: Separate out mipi configuration from s_power")
Fix ov5640_write_reg()return value unchecked at power off.
Reformat code to keep register access below the register description.
Signed-off-by: Hugues Fruchet <hugues.fruchet@st.com>
Change-Id: I12db67c416c3d63eadee400a3c89aaf48c5b1469
---
drivers/media/i2c/ov5640.c | 17 ++++++-----------
1 file changed, 6 insertions(+), 11 deletions(-)
diff --git a/drivers/media/i2c/ov5640.c b/drivers/media/i2c/ov5640.c
index 8d0254d..f34e62e 100644
--- a/drivers/media/i2c/ov5640.c
+++ b/drivers/media/i2c/ov5640.c
@@ -1940,14 +1940,6 @@ static int ov5640_set_power_mipi(struct ov5640_dev *sensor, bool on)
{
int ret;
- if (!on) {
- /* Reset MIPI bus settings to their default values. */
- ov5640_write_reg(sensor, OV5640_REG_IO_MIPI_CTRL00, 0x58);
- ov5640_write_reg(sensor, OV5640_REG_MIPI_CTRL00, 0x04);
- ov5640_write_reg(sensor, OV5640_REG_PAD_OUTPUT00, 0x00);
- return 0;
- }
-
/*
* Power up MIPI HS Tx and LS Rx; 2 data lanes mode
*
@@ -1958,7 +1950,8 @@ static int ov5640_set_power_mipi(struct ov5640_dev *sensor, bool on)
* [3] = 0 : Power up MIPI LS Rx
* [2] = 0 : MIPI interface disabled
*/
- ret = ov5640_write_reg(sensor, OV5640_REG_IO_MIPI_CTRL00, 0x40);
+ ret = ov5640_write_reg(sensor, OV5640_REG_IO_MIPI_CTRL00,
+ on ? 0x40 : 0x58);
if (ret)
return ret;
@@ -1969,7 +1962,8 @@ static int ov5640_set_power_mipi(struct ov5640_dev *sensor, bool on)
* [5] = 1 : Gate clock when 'no packets'
* [2] = 1 : MIPI bus in LP11 when 'no packets'
*/
- ret = ov5640_write_reg(sensor, OV5640_REG_MIPI_CTRL00, 0x24);
+ ret = ov5640_write_reg(sensor, OV5640_REG_MIPI_CTRL00,
+ on ? 0x24 : 0x04);
if (ret)
return ret;
@@ -1981,7 +1975,8 @@ static int ov5640_set_power_mipi(struct ov5640_dev *sensor, bool on)
* [5] = 1 : MIPI data lane 1 in LP11 when 'sleeping'
* [4] = 1 : MIPI clock lane in LP11 when 'sleeping'
*/
- ret = ov5640_write_reg(sensor, OV5640_REG_PAD_OUTPUT00, 0x70);
+ ret = ov5640_write_reg(sensor, OV5640_REG_PAD_OUTPUT00,
+ on ? 0x70 : 0x00);
if (ret)
return ret;
--
2.7.4
next prev parent reply other threads:[~2020-10-07 14:46 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-07 14:43 [PATCH] media: ov5640: fix MIPI power sequence Hugues Fruchet
2020-10-07 14:43 ` Hugues Fruchet [this message]
2020-10-07 15:01 ` Sakari Ailus
2020-10-07 15:09 ` Jacopo Mondi
2020-10-08 8:58 ` Hugues FRUCHET
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1602081798-17548-2-git-send-email-hugues.fruchet@st.com \
--to=hugues.fruchet@st.com \
--cc=alain.volmat@st.com \
--cc=hverkuil@xs4all.nl \
--cc=jacopo@jmondi.org \
--cc=linux-media@vger.kernel.org \
--cc=linux-stm32@st-md-mailman.stormreply.com \
--cc=mchehab@kernel.org \
--cc=prabhakar.mahadev-lad.rj@bp.renesas.com \
--cc=sakari.ailus@linux.intel.com \
--cc=slongerbeam@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).