From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Cc: linux-media@vger.kernel.org
Subject: Re: [PATCH 18/24] V4L2: mt9p031: power down the sensor if no supported device has been detected
Date: Mon, 22 Apr 2013 14:19:13 +0200 [thread overview]
Message-ID: <1756723.mDdT6UkUyR@avalon> (raw)
In-Reply-To: <1366320945-21591-19-git-send-email-g.liakhovetski@gmx.de>
Hi Guennadi,
Thanks for the patch.
On Thursday 18 April 2013 23:35:39 Guennadi Liakhovetski wrote:
> The mt9p031 driver first accesses the I2C device in its .registered()
> method. While doing that it furst powers the device up, but if probing
s/furst/first/
> fails, it doesn't power the chip back down. This patch fixes that bug.
>
> Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
>
> ---
> drivers/media/i2c/mt9p031.c | 10 ++++++----
> 1 files changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/media/i2c/mt9p031.c b/drivers/media/i2c/mt9p031.c
> index eb2de22..70f4525 100644
> --- a/drivers/media/i2c/mt9p031.c
> +++ b/drivers/media/i2c/mt9p031.c
> @@ -844,7 +844,7 @@ static int mt9p031_registered(struct v4l2_subdev
> *subdev) ret = mt9p031_power_on(mt9p031);
> if (ret < 0) {
> dev_err(&client->dev, "MT9P031 power up failed\n");
> - return ret;
> + goto done;
Not here. If power on fails, there's no need to power off.
> }
>
> /* Read out the chip version register */
> @@ -852,13 +852,15 @@ static int mt9p031_registered(struct v4l2_subdev
> *subdev) if (data != MT9P031_CHIP_VERSION_VALUE) {
> dev_err(&client->dev, "MT9P031 not detected, wrong version "
> "0x%04x\n", data);
> - return -ENODEV;
> + ret = -ENODEV;
> }
>
> +done:
> mt9p031_power_off(mt9p031);
>
> - dev_info(&client->dev, "MT9P031 detected at address 0x%02x\n",
> - client->addr);
> + if (!ret)
> + dev_info(&client->dev, "MT9P031 detected at address 0x%02x\n",
> + client->addr);
>
> return ret;
> }
It would be easier to just move the power off line right after the
mt9p031_read() call and leave the rest unchanged.
diff --git a/drivers/media/i2c/mt9p031.c b/drivers/media/i2c/mt9p031.c
index 28cf95b..8de84c0 100644
--- a/drivers/media/i2c/mt9p031.c
+++ b/drivers/media/i2c/mt9p031.c
@@ -849,18 +849,18 @@ static int mt9p031_registered(struct v4l2_subdev
*subdev)
/* Read out the chip version register */
data = mt9p031_read(client, MT9P031_CHIP_VERSION);
+ mt9p031_power_off(mt9p031);
+
if (data != MT9P031_CHIP_VERSION_VALUE) {
dev_err(&client->dev, "MT9P031 not detected, wrong version "
"0x%04x\n", data);
return -ENODEV;
}
- mt9p031_power_off(mt9p031);
-
dev_info(&client->dev, "MT9P031 detected at address 0x%02x\n",
client->addr);
- return ret;
+ return 0;
}
static int mt9p031_open(struct v4l2_subdev *subdev, struct v4l2_subdev_fh
*fh)
If you're happy with that there's no need to resubmit, I'll apply the patch to
my tree for v3.11.
--
Regards,
Laurent Pinchart
next prev parent reply other threads:[~2013-04-22 12:19 UTC|newest]
Thread overview: 49+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-18 21:35 [PATCH 00/24] V4L2: subdevice pad-level API wrapper Guennadi Liakhovetski
2013-04-18 21:35 ` [PATCH 01/24] V4L2: (cosmetic) remove redundant use of unlikely() Guennadi Liakhovetski
2013-04-18 21:35 ` [PATCH 02/24] imx074: fix error handling for failed async subdevice registration Guennadi Liakhovetski
2013-04-18 21:35 ` [PATCH 03/24] mt9t031: fix NULL dereference during probe() Guennadi Liakhovetski
2013-04-18 21:35 ` [PATCH 04/24] V4L2: fix Oops on rmmod path Guennadi Liakhovetski
2013-04-18 21:35 ` [PATCH 05/24] V4L2: allow dummy file-handle initialisation by v4l2_fh_init() Guennadi Liakhovetski
2013-04-19 7:22 ` Hans Verkuil
2013-04-22 12:07 ` Laurent Pinchart
2013-04-18 21:35 ` [PATCH 06/24] V4L2: add a common V4L2 subdevice platform data type Guennadi Liakhovetski
2013-04-19 7:33 ` Hans Verkuil
2013-04-19 7:48 ` Guennadi Liakhovetski
2013-04-19 8:26 ` Hans Verkuil
2013-10-17 18:24 ` Guennadi Liakhovetski
2013-11-04 11:24 ` Hans Verkuil
2013-11-06 0:13 ` Laurent Pinchart
2013-04-18 21:35 ` [PATCH 07/24] soc-camera: switch to using the new struct v4l2_subdev_platform_data Guennadi Liakhovetski
2013-04-18 21:35 ` [PATCH 08/24] ARM: update all soc-camera users to new platform data layout Guennadi Liakhovetski
2013-04-18 21:35 ` [PATCH 09/24] SH: " Guennadi Liakhovetski
2013-04-18 21:35 ` [PATCH 10/24] soc-camera: update soc-camera-platform & its users to a " Guennadi Liakhovetski
2013-04-18 21:35 ` [PATCH 11/24] soc-camera: completely remove struct soc_camera_link Guennadi Liakhovetski
2013-04-18 21:35 ` [PATCH 12/24] V4L2: soc-camera: retrieve subdevice platform data from struct v4l2_subdev Guennadi Liakhovetski
2013-04-18 21:35 ` [PATCH 13/24] ARM: pcm037: convert custom GPIO-based power function to a regulator Guennadi Liakhovetski
2013-04-18 21:35 ` [PATCH 14/24] mx3-camera: clean up the use of platform data, add driver owner Guennadi Liakhovetski
2013-04-18 21:35 ` [PATCH 15/24] mx3-camera: support asynchronous subdevice registration Guennadi Liakhovetski
2013-04-18 21:35 ` [PATCH 16/24] V4L2: mt9p031: add support for V4L2 clock and asynchronous probing Guennadi Liakhovetski
2013-04-18 21:35 ` [PATCH 17/24] V4L2: mt9p031: add support for .g_mbus_config() video operation Guennadi Liakhovetski
2013-04-18 21:35 ` [PATCH 18/24] V4L2: mt9p031: power down the sensor if no supported device has been detected Guennadi Liakhovetski
2013-04-22 12:19 ` Laurent Pinchart [this message]
2013-04-22 12:33 ` Guennadi Liakhovetski
2013-04-18 21:35 ` [PATCH 19/24] V4L2: add struct v4l2_subdev_try_buf Guennadi Liakhovetski
2013-04-18 21:35 ` [PATCH 20/24] V4L2: add a subdev pointer to struct v4l2_subdev_fh Guennadi Liakhovetski
2013-04-18 21:35 ` [PATCH 21/24] V4L2: add a subdevice-driver pad-operation wrapper Guennadi Liakhovetski
2013-04-19 8:20 ` Hans Verkuil
2013-04-19 8:52 ` Guennadi Liakhovetski
2013-04-19 9:40 ` Hans Verkuil
2013-04-18 21:35 ` [PATCH 22/24] V4L2: soc-camera: use the " Guennadi Liakhovetski
2013-04-18 21:35 ` [PATCH 23/24] V4L2: mt9p031: add struct v4l2_subdev_platform_data to platform data Guennadi Liakhovetski
2013-04-18 21:47 ` Guennadi Liakhovetski
2013-04-22 12:31 ` Laurent Pinchart
2013-04-22 12:39 ` Guennadi Liakhovetski
2013-04-22 12:46 ` Laurent Pinchart
2013-04-26 8:30 ` Sascha Hauer
2013-04-26 8:43 ` Guennadi Liakhovetski
2013-04-26 9:15 ` Sascha Hauer
2013-04-29 9:55 ` Laurent Pinchart
2013-04-22 12:45 ` Laurent Pinchart
2013-04-18 21:35 ` [PATCH 24/24] ARM: pcm037: support mt9p031 / mt9p006 camera sensors Guennadi Liakhovetski
2013-04-18 21:45 ` Guennadi Liakhovetski
2013-04-19 10:29 ` [PATCH 00/24] V4L2: subdevice pad-level API wrapper Hans Verkuil
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=1756723.mDdT6UkUyR@avalon \
--to=laurent.pinchart@ideasonboard.com \
--cc=g.liakhovetski@gmx.de \
--cc=linux-media@vger.kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.