Re: [PATCH] media: cedrus: Add watchdog for job completion

From: Maxime Ripard
Date: Sat Feb 05 2022 - 05:29:05 EST


On Sat, Feb 05, 2022 at 08:40:21AM +0100, Jernej Škrabec wrote:
> > > +void cedrus_watchdog(struct work_struct *work)
> > > +{
> > > + struct cedrus_dev *dev;
> > > + struct cedrus_ctx *ctx;
> > > +
> > > + dev = container_of(to_delayed_work(work),
> > > + struct cedrus_dev, watchdog_work);
> > > +
> > > + ctx = v4l2_m2m_get_curr_priv(dev->m2m_dev);
> > > + if (!ctx)
> > > + return;
> > > +
> > > + v4l2_err(&dev->v4l2_dev, "frame processing timed out!\n");
> > > + reset_control_reset(dev->rstc);
> >
> > I don't think playing with the reset is the right approach here.
> > First we don't really know if the reset is shared or not, so this might have
> > no effect.
>
> AFAIK only few reset lines are shared in all Allwinner SoC, never for Cedrus
> and even then, this is considered as HW issue. So, I'm good with using reset
> line. This principle is also taken from Hantro driver.

Also, we got the reset handle through reset_control_get_exclusive, so
we're guaranteed to be the only user.

Maxime