mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: "Lad, Prabhakar" <prabhakar.csengg@gmail.com>
Cc: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>,
	Dave Stevenson <dave.stevenson@raspberrypi.com>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	Pavel Machek <pavel@denx.de>,
	Andrey Konovalov <andrey.konovalov@linaro.org>,
	Sakari Ailus <sakari.ailus@linux.intel.com>,
	Jacopo Mondi <jacopo@jmondi.org>,
	Hans Verkuil <hverkuil-cisco@xs4all.nl>,
	linux-media <linux-media@vger.kernel.org>,
	LKML <linux-kernel@vger.kernel.org>,
	Linux-Renesas <linux-renesas-soc@vger.kernel.org>,
	Biju Das <biju.das.jz@bp.renesas.com>
Subject: Re: [PATCH 2/3] media: i2c: imx219: Serialize during stream start/stop
Date: Wed, 10 Mar 2021 14:54:11 +0200	[thread overview]
Message-ID: <YEjBc0rdAoaw+8lo@pendragon.ideasonboard.com> (raw)
In-Reply-To: <CA+V-a8vPm7EM=MoxRt1nXnvpVVL5vQvSupd79GRNaGULpxS-kQ@mail.gmail.com>

Hi Prabhakar,

On Wed, Mar 10, 2021 at 12:46:39PM +0000, Lad, Prabhakar wrote:
> On Wed, Mar 10, 2021 at 12:40 PM Laurent Pinchart wrote:
> > On Wed, Mar 10, 2021 at 12:20:13PM +0000, Lad Prabhakar wrote:
> > > Serialize during stream start/stop in suspend/resume callbacks.
> >
> > Could you please explain why this is needed ?
> >
> The streaming variable in this driver has serialized access, but this
> wasn't taken care during suspend/resume callbacks.

But nothing that touches the streaming variable can run concurrently to
suspend/resume, isn't it ?

I'm actually even quite dubious about the need to start and stop
streaming during resume and suspend, the driver using the subdev should
start/stop the whole video pipeline at suspend/resume time.

> > > Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> > > ---
> > >  drivers/media/i2c/imx219.c | 5 +++++
> > >  1 file changed, 5 insertions(+)
> > >
> > > diff --git a/drivers/media/i2c/imx219.c b/drivers/media/i2c/imx219.c
> > > index f0cf1985a4dc..87c021de1460 100644
> > > --- a/drivers/media/i2c/imx219.c
> > > +++ b/drivers/media/i2c/imx219.c
> > > @@ -1172,8 +1172,10 @@ static int __maybe_unused imx219_suspend(struct device *dev)
> > >       struct v4l2_subdev *sd = dev_get_drvdata(dev);
> > >       struct imx219 *imx219 = to_imx219(sd);
> > >
> > > +     mutex_lock(&imx219->mutex);
> > >       if (imx219->streaming)
> > >               imx219_stop_streaming(imx219);
> > > +     mutex_unlock(&imx219->mutex);
> > >
> > >       return 0;
> > >  }
> > > @@ -1184,11 +1186,13 @@ static int __maybe_unused imx219_resume(struct device *dev)
> > >       struct imx219 *imx219 = to_imx219(sd);
> > >       int ret;
> > >
> > > +     mutex_lock(&imx219->mutex);
> > >       if (imx219->streaming) {
> > >               ret = imx219_start_streaming(imx219);
> > >               if (ret)
> > >                       goto error;
> > >       }
> > > +     mutex_unlock(&imx219->mutex);
> > >
> > >       return 0;
> > >
> > > @@ -1197,6 +1201,7 @@ static int __maybe_unused imx219_resume(struct device *dev)
> > >       imx219->streaming = false;
> > >       __v4l2_ctrl_grab(imx219->vflip, false);
> > >       __v4l2_ctrl_grab(imx219->hflip, false);
> > > +     mutex_unlock(&imx219->mutex);
> > >
> > >       return ret;
> > >  }

-- 
Regards,

Laurent Pinchart

  reply	other threads:[~2021-03-10 12:55 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-10 12:20 [PATCH 0/3] media: i2c: imx219: Trivial Fixes Lad Prabhakar
2021-03-10 12:20 ` [PATCH 1/3] media: i2c: imx219: Enable vflip and hflip controls on stream stop Lad Prabhakar
2021-03-10 12:44   ` Laurent Pinchart
2021-03-10 14:03     ` Lad, Prabhakar
2021-03-10 12:20 ` [PATCH 2/3] media: i2c: imx219: Serialize during stream start/stop Lad Prabhakar
2021-03-10 12:39   ` Laurent Pinchart
2021-03-10 12:46     ` Lad, Prabhakar
2021-03-10 12:54       ` Laurent Pinchart [this message]
2021-03-10 13:08         ` Lad, Prabhakar
2021-03-10 12:20 ` [PATCH 3/3] media: i2c: imx219: Balance runtime PM use-count in resume callback Lad Prabhakar
2021-03-10 12:48   ` Laurent Pinchart
2021-03-10 14:01     ` Lad, Prabhakar

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=YEjBc0rdAoaw+8lo@pendragon.ideasonboard.com \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=andrey.konovalov@linaro.org \
    --cc=biju.das.jz@bp.renesas.com \
    --cc=dave.stevenson@raspberrypi.com \
    --cc=hverkuil-cisco@xs4all.nl \
    --cc=jacopo@jmondi.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=pavel@denx.de \
    --cc=prabhakar.csengg@gmail.com \
    --cc=prabhakar.mahadev-lad.rj@bp.renesas.com \
    --cc=sakari.ailus@linux.intel.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®