Linux USB
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Haowen Tu <tuhaowen@uniontech.com>
Cc: rafael@kernel.org, gregkh@linuxfoundation.org, hansg@kernel.org,
	kernel@uniontech.com, lenb@kernel.org,
	linux-kernel@vger.kernel.org, linux-media@vger.kernel.org,
	linux-pm@vger.kernel.org, linux-usb@vger.kernel.org,
	mchehab@kernel.org, oneukum@suse.com, pavel@kernel.org,
	stern@rowland.harvard.edu
Subject: Re: [PATCH v3 3/3] media: uvcvideo: skip streaming restart after hibernation snapshot
Date: Wed, 22 Jul 2026 23:06:20 +0300	[thread overview]
Message-ID: <20260722200620.GC648629@killaraus.ideasonboard.com> (raw)
In-Reply-To: <20260618013133.1047270-4-tuhaowen@uniontech.com>

On Thu, Jun 18, 2026 at 09:31:33AM +0800, Haowen Tu wrote:
> After the hibernation snapshot is created, devices are resumed with
> PMSG_THAW before the image is written and the system is powered off.
> Restarting an active UVC stream during this phase reinitializes the
> camera and visibly turns its indicator LED back on.
> 
> Skip only the UVC streaming hardware restart while the snapshot is
> available.  The driver's frozen state and clock are still updated before
> the check, and a subsequent UVC suspend can stop the stream and select
> alternate setting 0 as usual.

Why is that desired (both the decision to only block the resume of the
video interface, and the decision to not block the next suspend) ?

> uvcvideo does not provide a shutdown
> callback that requires the streaming hardware to be restarted first.
> 
> This is a device-specific use of pm_hibernation_snapshot_done().  The
> helper does not cause other drivers or USB core to skip THAW resume.

I don't think this sentence belongs to the commit message.

> Tested with hibernation image written to local storage and resumed from
> disk on a system with a USB UVC camera attached; the camera LED remains
> off during image writing and the video stream resumes correctly after
> restore.
> 
> Signed-off-by: Haowen Tu <tuhaowen@uniontech.com>
> ---
> Changes in v3:
> - Clarify that only the UVC streaming hardware restart is skipped.
> - Explain the subsequent UVC suspend and shutdown handling.
> 
> Changes in v2:
> - Use pm_hibernation_snapshot_done() after the PM helper was renamed.
> - Move the check after clearing the frozen state and resetting the clock.
> 
>  drivers/media/usb/uvc/uvc_video.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/drivers/media/usb/uvc/uvc_video.c b/drivers/media/usb/uvc/uvc_video.c
> index f6c8e3223796..1744298f4b1f 100644
> --- a/drivers/media/usb/uvc/uvc_video.c
> +++ b/drivers/media/usb/uvc/uvc_video.c
> @@ -12,6 +12,7 @@
>  #include <linux/list.h>
>  #include <linux/module.h>
>  #include <linux/slab.h>
> +#include <linux/suspend.h>
>  #include <linux/usb.h>
>  #include <linux/usb/hcd.h>
>  #include <linux/videodev2.h>
> @@ -2151,6 +2152,13 @@ int uvc_video_resume(struct uvc_streaming *stream, int reset)
>  	if (!uvc_queue_streaming(&stream->queue))
>  		return 0;
>  
> +	/*
> +	 * Avoid restarting the streaming hardware during the transient THAW
> +	 * phase after a hibernation snapshot has been created.
> +	 */
> +	if (pm_hibernation_snapshot_done())
> +		return 0;
> +
>  	ret = uvc_commit_video(stream, &stream->ctrl);
>  	if (ret < 0)
>  		return ret;

-- 
Regards,

Laurent Pinchart

  reply	other threads:[~2026-07-22 20:06 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20260428080513.1833515-1-tuhaowen@uniontech.com>
2026-05-28  8:18 ` [PATCH v2 0/2] PM: hibernate: skip UVC resume after snapshot Haowen Tu
2026-05-28  8:18   ` [PATCH v2 1/2] PM: hibernate: add pm_hibernation_snapshot_done() helper Haowen Tu
2026-06-01 18:22     ` Rafael J. Wysocki
2026-06-02  3:24       ` Haowen Tu
2026-06-18  1:31         ` [PATCH v3 0/3] PM: hibernate: skip UVC streaming restart after snapshot Haowen Tu
2026-06-18  1:31           ` [PATCH v3 1/3] PM: hibernate: clear in_suspend before freeing the snapshot Haowen Tu
2026-07-22 15:37             ` Rafael J. Wysocki (Intel)
2026-06-18  1:31           ` [PATCH v3 2/3] PM: hibernate: add pm_hibernation_snapshot_done() helper Haowen Tu
2026-07-22 15:40             ` Rafael J. Wysocki (Intel)
2026-06-18  1:31           ` [PATCH v3 3/3] media: uvcvideo: skip streaming restart after hibernation snapshot Haowen Tu
2026-07-22 20:06             ` Laurent Pinchart [this message]
2026-05-28  8:18   ` [PATCH v2 2/2] media: uvcvideo: skip resume " Haowen Tu

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=20260722200620.GC648629@killaraus.ideasonboard.com \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=hansg@kernel.org \
    --cc=kernel@uniontech.com \
    --cc=lenb@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=oneukum@suse.com \
    --cc=pavel@kernel.org \
    --cc=rafael@kernel.org \
    --cc=stern@rowland.harvard.edu \
    --cc=tuhaowen@uniontech.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