Linux Media Controller development
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Ricardo Ribalda <ribalda@chromium.org>
Cc: Parmjot Singh <parmjotsinghrobot@gmail.com>,
	linux-media@vger.kernel.org, hansg@kernel.org,
	mchehab@kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] media: uvcvideo: delay HP True Vision 5MP isochronous start
Date: Mon, 23 Nov 2026 12:39:40 +0200	[thread overview]
Message-ID: <20261123103940.GA3010398@killaraus.ideasonboard.com> (raw)
In-Reply-To: <CANiDSCuE=WOpDFqVtM2wXue5TDqvQgg6OeHZXfv_Bvzf2QmCDw@mail.gmail.com>

On Mon, Nov 23, 2026 at 11:30:28AM +0100, Ricardo Ribalda wrote:
> Hi Parmjot
> 
> Could you provide the whole USB descriptor of the device
> lsusb -v -d 04f2:b767
> 
> Is it a internal camera (it looks so based on the name) if it is not,
> could you try connecting it to USB2 hub?
> 
> On Sun, 22 Nov 2026 at 07:05, Parmjot Singh <parmjotsinghrobot@gmail.com> wrote:
> >
> > The HP True Vision 5MP Camera (04f2:b767, revision 0.05) accepts
> > COMMIT and SET_INTERFACE, then may disconnect shortly after starting
> > isochronous transfers. A 350 ms pause between SET_INTERFACE and the
> > first video URB allowed color streaming in MJPEG and YUYV modes.
> >
> > Add a per-device isochronous startup delay and apply it to the color
> > interface.
> >
> > On Arch Linux 7.2.14, FFmpeg decoded 90 frames each in 720p MJPEG,
> > 640x480 YUYV and 2592x1944 MJPEG, plus 300 frames after a 720p
> > restart. The infrared stream still disconnected during the delay
> > experiment, before the first video URB was submitted.
> >
> > OpenAI Codex (GPT-6.2 Sol) helped design and analyze the USB timing
> > experiment and write the driver change.
> >
> > Signed-off-by: Parmjot Singh <parmjotsinghrobot@gmail.com>
> >
> > ---
> >  drivers/media/usb/uvc/uvc_driver.c | 14 ++++++++++++++
> >  drivers/media/usb/uvc/uvc_video.c  |  4 ++++
> >  drivers/media/usb/uvc/uvcvideo.h   |  1 +
> >  3 files changed, 19 insertions(+)
> >
> > diff --git a/drivers/media/usb/uvc/uvc_driver.c b/drivers/media/usb/uvc/uvc_driver.c
> > index 99c28991b..cfc626a15 100644
> > --- a/drivers/media/usb/uvc/uvc_driver.c
> > +++ b/drivers/media/usb/uvc/uvc_driver.c
> > @@ -2754,6 +2754,20 @@ static const struct usb_device_id uvc_ids[] = {
> >           .bInterfaceSubClass   = 1,
> >           .bInterfaceProtocol   = 0,
> >           .driver_info          = UVC_INFO_QUIRK(UVC_QUIRK_RESTRICT_FRAME_RATE) },
> > +       /* HP True Vision 5MP Camera (color) */
> > +       { .match_flags          = USB_DEVICE_ID_MATCH_DEVICE
> > +                               | USB_DEVICE_ID_MATCH_INT_INFO
> > +                               | USB_DEVICE_ID_MATCH_INT_NUMBER,
> 
> Why dont you add this to the previous quirk instead of adding a new fied?
> 
> We usually do not need to match int number.
> 
> > +         .idVendor             = 0x04f2,
> > +         .idProduct            = 0xb767,
> > +         .bInterfaceClass      = USB_CLASS_VIDEO,
> > +         .bInterfaceSubClass   = 1,
> > +         .bInterfaceProtocol   = UVC_PC_PROTOCOL_15,
> > +         .bInterfaceNumber     = 0,
> > +         .driver_info          = (kernel_ulong_t)&(const struct uvc_device_info){
> > +               .quirks = UVC_QUIRK_PROBE_DEF,
> > +               .isoc_start_delay_ms = 350,
> > +         } },
> >         /* HP True Vision 5MP Camera */
> >         { .match_flags          = USB_DEVICE_ID_MATCH_DEVICE
> >                                 | USB_DEVICE_ID_MATCH_INT_INFO,
> > diff --git a/drivers/media/usb/uvc/uvc_video.c b/drivers/media/usb/uvc/uvc_video.c
> > index a92a986ab..e20330998 100644
> > --- a/drivers/media/usb/uvc/uvc_video.c
> > +++ b/drivers/media/usb/uvc/uvc_video.c
> > @@ -6,6 +6,7 @@
> >   *          Laurent Pinchart (laurent.pinchart@ideasonboard.com)
> >   */
> >
> > +#include <linux/delay.h>
> >  #include <linux/dma-mapping.h>
> >  #include <linux/highmem.h>
> >  #include <linux/kernel.h>
> > @@ -2103,6 +2104,9 @@ static int uvc_video_start_transfer(struct uvc_streaming *stream,
> >                 if (ret < 0)
> >                         return ret;
> >
> > +               if (stream->dev->info->isoc_start_delay_ms)
> > +                       msleep(stream->dev->info->isoc_start_delay_ms);
> > +
> >                 ret = uvc_init_video_isoc(stream, best_ep, gfp_flags);
> >         } else {
> >                 /* Bulk endpoint, proceed to URB initialization. */
> > diff --git a/drivers/media/usb/uvc/uvcvideo.h b/drivers/media/usb/uvc/uvcvideo.h
> > index af8cef94f..eb949c6d8 100644
> > --- a/drivers/media/usb/uvc/uvcvideo.h
> > +++ b/drivers/media/usb/uvc/uvcvideo.h
> > @@ -545,6 +545,7 @@ struct uvc_device_info {
> >         u32     quirks;
> >         u32     meta_format;
> >         u16     uvc_version;
> > +       u16     isoc_start_delay_ms;

Adding a new type of quirk requires a root cause analysis.

> >  };
> >
> >  struct uvc_rect {

-- 
Regards,

Laurent Pinchart

      reply	other threads:[~2026-11-23 10:39 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-22  6:03 [PATCH 0/2] media: uvcvideo: fix HP True Vision 5MP color streaming Parmjot Singh
2026-11-22  6:03 ` [PATCH 1/2] media: uvcvideo: skip GET_DEF(PROBE) for HP True Vision 5MP Parmjot Singh
2026-11-22  6:03 ` [PATCH 2/2] media: uvcvideo: delay HP True Vision 5MP isochronous start Parmjot Singh
2026-11-23 10:30   ` Ricardo Ribalda
2026-11-23 10:39     ` Laurent Pinchart [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=20261123103940.GA3010398@killaraus.ideasonboard.com \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=hansg@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=parmjotsinghrobot@gmail.com \
    --cc=ribalda@chromium.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox