[alsa-devel] [PATCH] usb: add USB_QUIRK_RESET_RESUME for M-Audio 49

Takashi Iwai tiwai at suse.de
Mon Nov 26 14:58:33 CET 2012


At Mon, 26 Nov 2012 14:43:13 +0100,
Clemens Ladisch wrote:
> 
> Takashi Iwai wrote:
> > Clemens Ladisch wrote:
> >> Takashi Iwai wrote:
> >>> Clemens Ladisch wrote:
> >>>> I'm working on a fix that adds proper power management for input ports,
> >>>> but this requires the driver to be reorganized a little ...
> >>>
> >>> Doesn't a simple patch like below work?
> >>
> >>> +static int substream_open(struct snd_rawmidi_substream *substream, int open)
> >>>  {
> >>> +	if (open && umidi->opened++ == 0) {
> >>> +		err = usb_autopm_get_interface(umidi->iface);
> >>>
> >>>  static int snd_usbmidi_input_open(struct snd_rawmidi_substream *substream)
> >>>  {
> >>> +	return substream_open(substream, 1);
> >>
> >> No, because the input URBs are submitted before the userspace device is
> >> opened.
> >
> > Ah, right.  What's the reason of submitting input urbs for the all
> > time from the beginning?  For loopback?
> 
> For not needing to count open input ports.

So we've spun urbs for all the time just for reducing refcount?
That's bad.

> > If it has to be running, the easiest fix would be the patch like
> > below.  This will turn off the autopm essentially, but better than
> > breakage.
> >
> > @@ -2074,6 +2077,8 @@ static void snd_usbmidi_input_start_ep(struct snd_usb_midi_in_endpoint* ep)
> >
> > +	ep->autopm_reference =
> > +		usb_autopm_get_interface(ep->umidi->iface) >= 0;
> 
> usb_autopm_get_interface() cannot be called from the USB probe callback.

OK, it can call no_resume version by passing an argument.

But judging from your comment above, we should fix the free wheel MIDI
input urbs at first indeed, not only for autopm but in general.


Takashi


More information about the Alsa-devel mailing list