All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Niklas Söderlund" <niklas.soderlund+renesas@ragnatech.se>
To: Hans Verkuil <hverkuil@xs4all.nl>
Cc: linux-media@vger.kernel.org, linux-renesas-soc@vger.kernel.org
Subject: Re: [PATCH v2 4/4] rcar-csi2: Do not try to recover after transfer error
Date: Wed, 10 Mar 2021 17:45:09 +0100	[thread overview]
Message-ID: <YEj3lTAZ7kYQ6X+s@oden.dyn.berto.se> (raw)
In-Reply-To: <3f40c6eb-ba13-ac99-bd08-3cea11563e9a@xs4all.nl>

Hi Hans,

Thanks for your feedback.

On 2021-01-25 10:44:48 +0100, Hans Verkuil wrote:
> On 15/01/2021 01:21, Niklas Söderlund wrote:
> > Instead of restarting the R-Car CSI-2 receiver if a transmission error
> > is detected inform the R-Car VIN driver of the error so it can stop the
> > whole pipeline and inform user-space. This is done to reflect a updated
> > usage recommendation in later versions of the datasheet.
> > 
> > Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
> > ---
> >  drivers/media/platform/rcar-vin/rcar-csi2.c | 14 ++++++--------
> >  1 file changed, 6 insertions(+), 8 deletions(-)
> > 
> > diff --git a/drivers/media/platform/rcar-vin/rcar-csi2.c b/drivers/media/platform/rcar-vin/rcar-csi2.c
> > index 945d2eb8723367f0..a7212ecc46572a3b 100644
> > --- a/drivers/media/platform/rcar-vin/rcar-csi2.c
> > +++ b/drivers/media/platform/rcar-vin/rcar-csi2.c
> > @@ -773,21 +773,19 @@ static irqreturn_t rcsi2_irq(int irq, void *data)
> >  
> >  	rcsi2_write(priv, INTERRSTATE_REG, err_status);
> >  
> > -	dev_info(priv->dev, "Transfer error, restarting CSI-2 receiver\n");
> > -
> >  	return IRQ_WAKE_THREAD;
> >  }
> >  
> >  static irqreturn_t rcsi2_irq_thread(int irq, void *data)
> >  {
> >  	struct rcar_csi2 *priv = data;
> > +	struct v4l2_event event = {
> > +		.type = V4L2_EVENT_EOS,
> > +	};
> >  
> > -	mutex_lock(&priv->lock);
> > -	rcsi2_stop(priv);
> > -	usleep_range(1000, 2000);
> > -	if (rcsi2_start(priv))
> > -		dev_warn(priv->dev, "Failed to restart CSI-2 receiver\n");
> > -	mutex_unlock(&priv->lock);
> > +	dev_err(priv->dev, "Transfer error detected.\n");
> 
> You probably want to call vb2_queue_error() here. Typically once
> something like this happens you have to restart everything and marking
> the queue as 'error' will ensure that VIDIOC_QBUF will return an error
> until the queue is reset (STREAMOFF).

The CSI-2 driver is a bridge driver and does not deal with buffers.  
Instead the idea here is to signal EOS so that the VIN driver (and 
user-space) can detect it and indeed as you point out deal with 
signaling vb2 error.

I will respin this series as it needs to be rebased anyhow.

> 
> It doesn't hurt to also raise the EOS event, I'm fine with that.
> 
> Regards,
> 
> 	Hans
> 
> > +
> > +	v4l2_subdev_notify_event(&priv->subdev, &event);
> >  
> >  	return IRQ_HANDLED;
> >  }
> > 
> 

-- 
Regards,
Niklas Söderlund

      reply	other threads:[~2021-03-10 16:46 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-15  0:21 [PATCH v2 0/4] rcar-csi2: Update handling of transfer error Niklas Söderlund
2021-01-15  0:21 ` [PATCH v2 1/4] rcar-vin: Do not try to stop stream if not running Niklas Söderlund
2021-01-15 11:14   ` Jacopo Mondi
2021-01-15  0:21 ` [PATCH v2 2/4] rcar-vin: Route events to correct video device Niklas Söderlund
2021-01-15  0:21 ` [PATCH v2 3/4] rcar-vin: Stop stream when subdevice signal EOS Niklas Söderlund
2021-01-25  9:37   ` Hans Verkuil
2021-01-15  0:21 ` [PATCH v2 4/4] rcar-csi2: Do not try to recover after transfer error Niklas Söderlund
2021-01-15  8:58   ` Sergei Shtylyov
2021-01-15 11:17   ` Jacopo Mondi
2021-01-25  9:44   ` Hans Verkuil
2021-03-10 16:45     ` Niklas Söderlund [this message]

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=YEj3lTAZ7kYQ6X+s@oden.dyn.berto.se \
    --to=niklas.soderlund+renesas@ragnatech.se \
    --cc=hverkuil@xs4all.nl \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-renesas-soc@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.