From: Michael Riesch <michael.riesch@wolfvision.net>
To: Sakari Ailus <sakari.ailus@linux.intel.com>
Cc: linux-media@vger.kernel.org, devicetree@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org,
"Gerald Loacker" <gerald.loacker@wolfvision.net>,
"Mauro Carvalho Chehab" <mchehab@kernel.org>,
"Rob Herring" <robh+dt@kernel.org>,
"Krzysztof Kozlowski" <krzysztof.kozlowski+dt@linaro.org>,
"Shawn Guo" <shawnguo@kernel.org>,
"Sascha Hauer" <s.hauer@pengutronix.de>,
"Pengutronix Kernel Team" <kernel@pengutronix.de>,
"Fabio Estevam" <festevam@gmail.com>,
"NXP Linux Team" <linux-imx@nxp.com>,
"Laurent Pinchart" <laurent.pinchart+renesas@ideasonboard.com>,
"Hans Verkuil" <hverkuil@xs4all.nl>,
"Marco Felsch" <m.felsch@pengutronix.de>,
"Mikhail Rudenko" <mike.rudenko@gmail.com>,
"Krzysztof Hałasa" <khalasa@piap.pl>,
"Marek Vasut" <marex@denx.de>
Subject: Re: [PATCH v2 2/2] media: i2c: add imx415 cmos image sensor driver
Date: Fri, 27 Jan 2023 11:43:33 +0100 [thread overview]
Message-ID: <395807d3-e242-5779-5c6d-06d750357b8c@wolfvision.net> (raw)
In-Reply-To: <Y9EKqwfDSsF31dLZ@kekkonen.localdomain>
Hi Sakari,
Thanks for your review. The majority of your comments are clear, I'll
spin a v3 next week. Just a few things:
On 1/25/23 11:55, Sakari Ailus wrote:
> [...]
>> +++ b/drivers/media/i2c/imx415.c
>> @@ -0,0 +1,1296 @@
>> +// SPDX-License-Identifier: GPL-2.0-only
>> +/*
>> + * Driver for the Sony IMX415 CMOS Image Sensor.
>> + *
>> + * Copyright (C) 2022 WolfVision GmbH.
>
> You can use 2023 now.
Time flies, doesn't it... :-)
> [...]
>> +static int imx415_stream_on(struct imx415 *sensor)
>> +{
>> + int ret;
>> +
>> + ret = imx415_write(sensor, IMX415_MODE, IMX415_MODE_OPERATING);
>> + if (ret)
>> + return ret;
>> +
>> + /* wait at least 24 ms for internal regulator stabilization */
>> + msleep(30);
>
> This is a very, very long time to wait for a regulator. Most probably
> either the time is too long or we're waiting for something else.
I just realized that both msleep calls are after setting the mode to
operating, i.e., after getting the sensor out of standby. The other
instance of this code (see below) documents that clearly, but this
"regulator stabilization" comment here is seems wrong indeed.
>> +
>> + return imx415_write(sensor, IMX415_XMSTA, IMX415_XMSTA_START);
>> +}
>> [...]>> +static int imx415_subdev_init(struct imx415 *sensor)
>> +{
>> + struct i2c_client *client = to_i2c_client(sensor->dev);
>> + int ret;
>> +
>> + v4l2_i2c_subdev_init(&sensor->subdev, client, &imx415_subdev_ops);
>> +
>> + ret = imx415_ctrls_init(sensor);
>> + if (ret < 0)
>> + return ret;
>> +
>> + sensor->subdev.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
>
> Add V4L2_SUBDEV_FL_HAS_EVENTS.
Just for my understanding: why is this required/a good idea?
>> [...]
>> +static int imx415_identify_model(struct imx415 *sensor)
>> +{
>> + int model, ret;
>> +
>> + /*
>> + * While most registers can be read when the sensor is in standby, this
>> + * is not the case of the sensor info register :-(
>> + */
>> + ret = imx415_write(sensor, IMX415_MODE, IMX415_MODE_OPERATING);
>> + if (ret < 0)
>> + return dev_err_probe(sensor->dev, ret,
>> + "failed to get sensor out of standby\n");
>> +
>> + /*
>> + * According to the datasheet we have to wait at least 63 us after
>> + * leaving standby mode. But this doesn't work even after 30 ms.
>> + * So probably this should be 63 ms and therefore we wait for 80 ms.
>> + */
>> + msleep(80);
>
> Wow.
This is the other occurrence of this long sleep. We could refactor this
code into a imx415_wakeup() method if desired. Otherwise, we need to
align the sleep period and the explanation at least.
Best regards,
Michael
> [...]
next prev parent reply other threads:[~2023-01-27 10:44 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-24 6:01 [PATCH v2 0/2] media: i2c: add imx415 cmos image sensor driver Michael Riesch
2023-01-24 6:01 ` [PATCH v2 1/2] dt-bindings: media: i2c: add imx415 cmos image sensor Michael Riesch
2023-01-25 11:21 ` Marco Felsch
2023-01-25 12:25 ` Sakari Ailus
2023-01-25 20:03 ` Rob Herring
2023-01-24 6:01 ` [PATCH v2 2/2] media: i2c: add imx415 cmos image sensor driver Michael Riesch
2023-01-25 10:55 ` Sakari Ailus
2023-01-27 10:43 ` Michael Riesch [this message]
2023-02-02 9:01 ` Sakari Ailus
2023-02-02 10:47 ` Michael Riesch
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=395807d3-e242-5779-5c6d-06d750357b8c@wolfvision.net \
--to=michael.riesch@wolfvision.net \
--cc=devicetree@vger.kernel.org \
--cc=festevam@gmail.com \
--cc=gerald.loacker@wolfvision.net \
--cc=hverkuil@xs4all.nl \
--cc=kernel@pengutronix.de \
--cc=khalasa@piap.pl \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=laurent.pinchart+renesas@ideasonboard.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-imx@nxp.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=m.felsch@pengutronix.de \
--cc=marex@denx.de \
--cc=mchehab@kernel.org \
--cc=mike.rudenko@gmail.com \
--cc=robh+dt@kernel.org \
--cc=s.hauer@pengutronix.de \
--cc=sakari.ailus@linux.intel.com \
--cc=shawnguo@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox