All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ming Lei <tom.leiming@gmail.com>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	Ming Lei <ming.lei@canonical.com>,
	linux-media@vger.kernel.org, linux-usb@vger.kernel.org,
	Jeremy Kerr <jeremy.kerr@canonical.com>,
	Mauro Carvalho Chehab <mchehab@redhat.com>
Subject: Re: [PATCH] uvcvideo: add fix suspend/resume quirk for Microdia camera
Date: Fri, 15 Jul 2011 10:08:36 +0800	[thread overview]
Message-ID: <CACVXFVNMLewOae=77+hTCqNPtR4yKdjrYKLxC7LiH2FN13thMQ@mail.gmail.com> (raw)
In-Reply-To: <Pine.LNX.4.44L0.1107141055270.1983-100000@iolanthe.rowland.org>

Hi,

On Thu, Jul 14, 2011 at 11:03 PM, Alan Stern <stern@rowland.harvard.edu> wrote:

> All right; this tends to confirm your guess that the BIOS messes up the
> device by resetting it during system resume.

Yes.  BIOS messes the device first, then usbcore has to reset the device
at the end of resume, so the device behaves badly: ISO transfer oddly

>> This also indicates the usb reset during resume does make the uvc device
>> broken.
>
> Resetting the device doesn't actually _break_ it -- if it did then the
> device would _never_ work because the first thing that usbcore does to
> initialize a new device is reset it!

I means the reset in resume breaks the device, not the reset in enumeration, :-)
(the only extra reset in rpm resume will make the device not work)

>
> More likely, the reset erases some device setting that uvcvideo
> installed while binding.  Evidently uvcvideo does not re-install the
> setting during reset-resume; this is probably a bug in the driver.

Yes, maybe some settings inside device have changed after the
reset signal, I don't know if it is a normal behaviour.

I have tried to add some code in .probe path to .resume path,
but still not make it work. Anyway, it is not easy thing, because we
have not the internal knowledge of uvc device implementation, and
have to try it by guess.

>> The below quirk  fixes the issue now.
>>
>> diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c
>> index 81ce6a8..93c6fa2 100644
>> --- a/drivers/usb/core/quirks.c
>> +++ b/drivers/usb/core/quirks.c
>> @@ -82,6 +82,9 @@ static const struct usb_device_id usb_quirk_list[] = {
>>       /* Broadcom BCM92035DGROM BT dongle */
>>       { USB_DEVICE(0x0a5c, 0x2021), .driver_info = USB_QUIRK_RESET_RESUME },
>>
>> +     /* Microdia uvc camera */
>> +     { USB_DEVICE(0x0c45, 0x6437), .driver_info = USB_QUIRK_RESET_MORPHS },
>> +
>>       /* Action Semiconductor flash disk */
>>       { USB_DEVICE(0x10d6, 0x2200), .driver_info =
>>                       USB_QUIRK_STRING_FETCH_255 },
>
> It would be better to fix uvcvideo, if you could figure out what it
> needs to do differently.  This quirk is only a workaround, because the
> device doesn't really morph.

In fact we can understand the quirk is used to avoid reset in system resume,
which is one of its original purpose too.

I will do some tests to figure out solution in uvc driver, but I am
not sure I can
find it quickly because I debug it remotely and network is very
slowly. If I can't
find out the solution in uvc driver, could you accept the workaround of
USB_QUIRK_RESET_MORPHS first?

thanks,
-- 
Ming Lei

  reply	other threads:[~2011-07-15  2:08 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-11  9:48 [PATCH] uvcvideo: add fix suspend/resume quirk for Microdia camera Ming Lei
2011-07-11 10:44 ` Laurent Pinchart
2011-07-12  1:21   ` Ming Lei
2011-07-12 10:52     ` Ming Lei
2011-07-12 15:44       ` Alan Stern
2011-07-13  7:43         ` Ming Lei
2011-07-13 15:20           ` Alan Stern
2011-07-13 15:30             ` Ming Lei
2011-07-13 15:59               ` Alan Stern
2011-07-14  9:16                 ` Ming Lei
2011-07-14 15:03                   ` Alan Stern
2011-07-15  2:08                     ` Ming Lei [this message]
2011-07-15 13:53                     ` Ming Lei
2011-07-15 14:27                       ` Alan Stern
2011-07-15 14:44                         ` Ming Lei
2011-07-15 15:25                           ` Alan Stern
2011-07-16  3:51                             ` [PATCH] uvcvideo: add SetInterface(0) in .reset_resume handler Ming Lei
2011-07-31 15:38                               ` Laurent Pinchart
2011-08-01  0:56                                 ` Ming Lei
2011-08-01 11:26                                   ` Laurent Pinchart
2011-08-01 17:39                                     ` Mauro Carvalho Chehab
2011-08-01 22:19                                       ` [GIT PATCH FOR v3.1] uvcvideo: Set alternate setting 0 on resume if the bus has been reset Laurent Pinchart
2011-07-13  8:35         ` [PATCH] uvcvideo: add fix suspend/resume quirk for Microdia camera Ming Lei
2011-07-13  8:38     ` Laurent Pinchart
2011-07-13  8:51       ` Ming Lei
2011-07-13  8:55         ` Oliver Neukum
2011-07-13  8:59         ` Laurent Pinchart
2011-07-13  9:07           ` Ming Lei
2011-07-11 10:51 ` Sergei Shtylyov

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='CACVXFVNMLewOae=77+hTCqNPtR4yKdjrYKLxC7LiH2FN13thMQ@mail.gmail.com' \
    --to=tom.leiming@gmail.com \
    --cc=jeremy.kerr@canonical.com \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=mchehab@redhat.com \
    --cc=ming.lei@canonical.com \
    --cc=stern@rowland.harvard.edu \
    /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.