From: Sakari Ailus <sakari.ailus@linux.intel.com>
To: Eugen Hristev <eugen.hristev@microchip.com>
Cc: leonl@leopardimaging.com, linux-media@vger.kernel.org,
skomatineni@nvidia.com, luca@lucaceresoli.net,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] media: i2c: imx274: fix s_frame_interval runtime resume not requested
Date: Wed, 17 Nov 2021 18:11:33 +0200 [thread overview]
Message-ID: <YZUptcn1isWQuCdq@paasikivi.fi.intel.com> (raw)
In-Reply-To: <20211117154009.261787-1-eugen.hristev@microchip.com>
Hi Eugen,
On Wed, Nov 17, 2021 at 05:40:09PM +0200, Eugen Hristev wrote:
> pm_runtime_resume_and_get should be called when the s_frame_interval
> is called.
>
> The driver will try to access device registers to configure VMAX, coarse
> time and exposure.
>
> Currently if the runtime is not resumed, this fails:
> # media-ctl -d /dev/media0 --set-v4l2 '"IMX274 1-001a":0[fmt:SRGGB10_1X10/3840x2
> 160@1/10]'
>
> IMX274 1-001a: imx274_binning_goodness: ask 3840x2160, size 3840x2160, goodness 0
> IMX274 1-001a: imx274_binning_goodness: ask 3840x2160, size 1920x1080, goodness -3000
> IMX274 1-001a: imx274_binning_goodness: ask 3840x2160, size 1280x720, goodness -4000
> IMX274 1-001a: imx274_binning_goodness: ask 3840x2160, size 1280x540, goodness -4180
> IMX274 1-001a: __imx274_change_compose: selected 1x1 binning
> IMX274 1-001a: imx274_set_frame_interval: input frame interval = 1 / 10
> IMX274 1-001a: imx274_read_mbreg : addr 0x300e, val=0x1 (2 bytes)
> IMX274 1-001a: imx274_set_frame_interval : register SVR = 1
> IMX274 1-001a: imx274_read_mbreg : addr 0x30f6, val=0x6a8 (2 bytes)
> IMX274 1-001a: imx274_set_frame_interval : register HMAX = 1704
> IMX274 1-001a: imx274_set_frame_length : input length = 2112
> IMX274 1-001a: imx274_write_mbreg : i2c bulk write failed, 30f8 = 884 (3 bytes)
> IMX274 1-001a: imx274_set_frame_length error = -121
> IMX274 1-001a: imx274_set_frame_interval error = -121
> Unable to setup formats: Remote I/O error (121)
>
> The device is not resumed thus the remote I/O error.
>
> Setting the frame interval works at streaming time, because
> pm_runtime_resume_and_get is called at s_stream time before sensor setup.
> The failure happens when only the s_frame_interval is called separately
> independently on streaming time.
>
> Fixes: ad97bc37426c ("media: i2c: imx274: Add IMX274 power on and off sequence"
> Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
> ---
> drivers/media/i2c/imx274.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/drivers/media/i2c/imx274.c b/drivers/media/i2c/imx274.c
> index e89ef35a71c5..6e63fdcc5e46 100644
> --- a/drivers/media/i2c/imx274.c
> +++ b/drivers/media/i2c/imx274.c
> @@ -1420,6 +1420,10 @@ static int imx274_s_frame_interval(struct v4l2_subdev *sd,
> int min, max, def;
> int ret;
>
> + ret = pm_runtime_resume_and_get(&imx274->client->dev);
> + if (ret < 0)
> + return ret;
> +
> mutex_lock(&imx274->lock);
> ret = imx274_set_frame_interval(imx274, fi->interval);
>
> @@ -1451,6 +1455,7 @@ static int imx274_s_frame_interval(struct v4l2_subdev *sd,
>
> unlock:
> mutex_unlock(&imx274->lock);
> + pm_runtime_put(&imx274->client->dev);
>
> return ret;
> }
If the device is powered off in the end, could you instead not power it on
in the first place? I.e. see how this works for the s_ctrl() callback.
--
Kind regards,
Sakari Ailus
next prev parent reply other threads:[~2021-11-17 16:11 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-17 15:40 Eugen Hristev
2021-11-17 16:11 ` Sakari Ailus [this message]
2021-11-17 16:52 ` Eugen.Hristev
2021-11-17 21:03 ` Sakari Ailus
2021-11-18 7:16 ` Eugen.Hristev
2021-11-18 9:02 ` Sakari Ailus
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=YZUptcn1isWQuCdq@paasikivi.fi.intel.com \
--to=sakari.ailus@linux.intel.com \
--cc=eugen.hristev@microchip.com \
--cc=leonl@leopardimaging.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=luca@lucaceresoli.net \
--cc=skomatineni@nvidia.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
all inboxes | Powered by JetHome®