[02/20] mt9m111: init chip after read CHIP_VERSION
Commit Message
Moved mt9m111_init after the chip version detection passage: I
don't like the idea of writing on a device we haven't identified
yet.
Signed-off-by: Philipp Wiesner <p.wiesner@phytec.de>
Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
---
drivers/media/video/mt9m111.c | 6 ++----
1 files changed, 2 insertions(+), 4 deletions(-)
Comments
On Fri, 30 Jul 2010, Michael Grzeschik wrote:
> Moved mt9m111_init after the chip version detection passage: I
> don't like the idea of writing on a device we haven't identified
> yet.
In principle it's correct, but what do you do, if a chip cannot be probed,
before it is initialised / enabled? Actually, this shouldn't be the case,
devices should be available for probing without any initialisation. So, we
have to ask the original author, whether this really was necessary,
Robert?
Thanks
Guennadi
>
> Signed-off-by: Philipp Wiesner <p.wiesner@phytec.de>
> Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
> ---
> drivers/media/video/mt9m111.c | 6 ++----
> 1 files changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/media/video/mt9m111.c b/drivers/media/video/mt9m111.c
> index e934559..39dff7c 100644
> --- a/drivers/media/video/mt9m111.c
> +++ b/drivers/media/video/mt9m111.c
> @@ -969,10 +969,6 @@ static int mt9m111_video_probe(struct soc_camera_device *icd,
> mt9m111->swap_rgb_even_odd = 1;
> mt9m111->swap_rgb_red_blue = 1;
>
> - ret = mt9m111_init(client);
> - if (ret)
> - goto ei2c;
> -
> data = reg_read(CHIP_VERSION);
>
> switch (data) {
> @@ -994,6 +990,8 @@ static int mt9m111_video_probe(struct soc_camera_device *icd,
> goto ei2c;
> }
>
> + ret = mt9m111_init(client);
> +
> ei2c:
> return ret;
> }
> --
> 1.7.1
>
>
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Guennadi Liakhovetski <g.liakhovetski@gmx.de> writes:
> On Fri, 30 Jul 2010, Michael Grzeschik wrote:
>
>> Moved mt9m111_init after the chip version detection passage: I
>> don't like the idea of writing on a device we haven't identified
>> yet.
>
> In principle it's correct, but what do you do, if a chip cannot be probed,
> before it is initialised / enabled? Actually, this shouldn't be the case,
> devices should be available for probing without any initialisation. So, we
> have to ask the original author, whether this really was necessary,
> Robert?
Michael is right I think.
According to the specification, even before the reset, the control registers can
be read, and they'll return their current values, which can be weird before
reset, excepting the CHIP_VERSION which is hard coded.
Therefore I think Michael is right by reading chip version before doing the
reset, and I ack this patch.
Cheers.
@@ -969,10 +969,6 @@ static int mt9m111_video_probe(struct soc_camera_device *icd,
mt9m111->swap_rgb_even_odd = 1;
mt9m111->swap_rgb_red_blue = 1;
- ret = mt9m111_init(client);
- if (ret)
- goto ei2c;
-
data = reg_read(CHIP_VERSION);
switch (data) {
@@ -994,6 +990,8 @@ static int mt9m111_video_probe(struct soc_camera_device *icd,
goto ei2c;
}
+ ret = mt9m111_init(client);
+
ei2c:
return ret;
}