Re: [PATCH 5/5] rcar-vin: Add support for suspend and resume

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Niklas,

On Fri, Oct 16, 2020 at 4:01 AM Niklas Söderlund
<niklas.soderlund+renesas@xxxxxxxxxxxx> wrote:
> Add support for suspend and resume by stopping and starting the video
> pipeline while still retaining all buffers given to the driver by
> user-space and internally allocated ones, this gives the application a
> seamless experience.
>
> Buffers are never returned to user-space unprocessed so user-space don't
> notice when suspending. When resuming the driver restarts the capture
> session using the internal scratch buffer, this happens before
> user-space is unfrozen, this leads to speedy response times once the
> application resumes its execution.
>
> As the entire pipeline is stopped on suspend all subdevices in use are
> also stopped, and if they enter a shutdown state when not streaming
> (such as the R-Car CSI-2 driver) they too will be suspended and resumed
> in sync with the VIN driver.
>
> To be able to do keep track of which VINs should be resumed a new
> internal state SUSPENDED is added to recode this.
>
> Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@xxxxxxxxxxxx>

Thanks for your patch!

> --- a/drivers/media/platform/rcar-vin/rcar-core.c
> +++ b/drivers/media/platform/rcar-vin/rcar-core.c

> +static int __maybe_unused rvin_resume(struct device *dev)
> +{
> +       struct rvin_dev *vin = dev_get_drvdata(dev);
> +
> +       if (vin->state != SUSPENDED)
> +               return 0;
> +
> +       /*
> +        * Restore group master CHSEL setting.
> +        *
> +        * This needs to be by every VIN resuming not only the master

to be done?

> +        * as we don't know if and in which order the master VINs will
> +        * be resumed.
> +        */
> +       if (vin->info->use_mc) {
> +               unsigned int master_id = rvin_group_id_to_master(vin->id);
> +               struct rvin_dev *master = vin->group->vin[master_id];
> +               int ret;
> +
> +               if (WARN_ON(!master))
> +                       return -ENODEV;
> +
> +               ret = rvin_set_channel_routing(master, master->chsel);
> +               if (ret)
> +                       return ret;
> +       }
> +
> +       return rvin_start_streaming(vin);
> +}
> +

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds



[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux