Commit b3752d2b authored by Jaroslav Kysela's avatar Jaroslav Kysela

ALSA CVS update - Clemens Ladisch <clemens@ladisch.de>

USB generic driver
add usb_device->speed wrapper for compiling with 2.2.x kernels
parent 7dcf8717
...@@ -938,7 +938,7 @@ static int init_substream_urbs(snd_usb_substream_t *subs, unsigned int period_by ...@@ -938,7 +938,7 @@ static int init_substream_urbs(snd_usb_substream_t *subs, unsigned int period_by
unsigned int npacks[MAX_URBS], urb_packs, total_packs; unsigned int npacks[MAX_URBS], urb_packs, total_packs;
/* calculate the frequency in 16.16 format */ /* calculate the frequency in 16.16 format */
if (subs->dev->speed == USB_SPEED_FULL) if (snd_usb_get_speed(subs->dev) == USB_SPEED_FULL)
subs->freqn = get_usb_full_speed_rate(rate); subs->freqn = get_usb_full_speed_rate(rate);
else else
subs->freqn = get_usb_high_speed_rate(rate); subs->freqn = get_usb_high_speed_rate(rate);
...@@ -959,7 +959,7 @@ static int init_substream_urbs(snd_usb_substream_t *subs, unsigned int period_by ...@@ -959,7 +959,7 @@ static int init_substream_urbs(snd_usb_substream_t *subs, unsigned int period_by
else else
subs->curpacksize = maxsize; subs->curpacksize = maxsize;
if (subs->dev->speed == USB_SPEED_FULL) if (snd_usb_get_speed(subs->dev) == USB_SPEED_FULL)
urb_packs = nrpacks; urb_packs = nrpacks;
else else
urb_packs = nrpacks * 8; urb_packs = nrpacks * 8;
...@@ -1058,7 +1058,10 @@ static int init_substream_urbs(snd_usb_substream_t *subs, unsigned int period_by ...@@ -1058,7 +1058,10 @@ static int init_substream_urbs(snd_usb_substream_t *subs, unsigned int period_by
u->urb->pipe = subs->syncpipe; u->urb->pipe = subs->syncpipe;
u->urb->transfer_flags = URB_ISO_ASAP; u->urb->transfer_flags = URB_ISO_ASAP;
u->urb->number_of_packets = u->packets; u->urb->number_of_packets = u->packets;
u->urb->interval = subs->dev->speed == USB_SPEED_HIGH ? 8 : 1; if (snd_usb_get_speed(subs->dev) == USB_SPEED_HIGH)
u->urb->interval = 8;
else
u->urb->interval = 1;
u->urb->context = u; u->urb->context = u;
u->urb->complete = snd_usb_complete_callback(snd_complete_sync_urb); u->urb->complete = snd_usb_complete_callback(snd_complete_sync_urb);
} }
...@@ -1961,7 +1964,7 @@ static void proc_dump_substream_status(snd_usb_substream_t *subs, snd_info_buffe ...@@ -1961,7 +1964,7 @@ static void proc_dump_substream_status(snd_usb_substream_t *subs, snd_info_buffe
snd_iprintf(buffer, "]\n"); snd_iprintf(buffer, "]\n");
snd_iprintf(buffer, " Packet Size = %d\n", subs->curpacksize); snd_iprintf(buffer, " Packet Size = %d\n", subs->curpacksize);
snd_iprintf(buffer, " Momentary freq = %u Hz\n", snd_iprintf(buffer, " Momentary freq = %u Hz\n",
subs->dev->speed == USB_SPEED_FULL snd_usb_get_speed(subs->dev) == USB_SPEED_FULL
? get_full_speed_hz(subs->freqm) ? get_full_speed_hz(subs->freqm)
: get_high_speed_hz(subs->freqm)); : get_high_speed_hz(subs->freqm));
} else { } else {
...@@ -2013,7 +2016,7 @@ static void init_substream(snd_usb_stream_t *as, int stream, struct audioformat ...@@ -2013,7 +2016,7 @@ static void init_substream(snd_usb_stream_t *as, int stream, struct audioformat
subs->stream = as; subs->stream = as;
subs->direction = stream; subs->direction = stream;
subs->dev = as->chip->dev; subs->dev = as->chip->dev;
if (subs->dev->speed == USB_SPEED_FULL) if (snd_usb_get_speed(subs->dev) == USB_SPEED_FULL)
subs->ops = audio_urb_ops[stream]; subs->ops = audio_urb_ops[stream];
else else
subs->ops = audio_urb_ops_high_speed[stream]; subs->ops = audio_urb_ops_high_speed[stream];
...@@ -2854,9 +2857,9 @@ static int snd_usb_audio_create(struct usb_device *dev, int idx, ...@@ -2854,9 +2857,9 @@ static int snd_usb_audio_create(struct usb_device *dev, int idx,
*rchip = NULL; *rchip = NULL;
if (dev->speed != USB_SPEED_FULL && if (snd_usb_get_speed(dev) != USB_SPEED_FULL &&
dev->speed != USB_SPEED_HIGH) { snd_usb_get_speed(dev) != USB_SPEED_HIGH) {
snd_printk(KERN_ERR "unknown device speed %d\n", dev->speed); snd_printk(KERN_ERR "unknown device speed %d\n", snd_usb_get_speed(dev));
return -ENXIO; return -ENXIO;
} }
...@@ -2924,7 +2927,7 @@ static int snd_usb_audio_create(struct usb_device *dev, int idx, ...@@ -2924,7 +2927,7 @@ static int snd_usb_audio_create(struct usb_device *dev, int idx,
usb_make_path(dev, card->longname + len, sizeof(card->longname) - len); usb_make_path(dev, card->longname + len, sizeof(card->longname) - len);
strlcat(card->longname, strlcat(card->longname,
dev->speed == USB_SPEED_FULL ? ", full speed" : ", high speed", snd_usb_get_speed(dev) == USB_SPEED_FULL ? ", full speed" : ", high speed",
sizeof(card->longname)); sizeof(card->longname));
snd_usb_audio_create_proc(chip); snd_usb_audio_create_proc(chip);
......
...@@ -221,4 +221,8 @@ void snd_usbmidi_disconnect(struct list_head *p, struct usb_driver *driver); ...@@ -221,4 +221,8 @@ void snd_usbmidi_disconnect(struct list_head *p, struct usb_driver *driver);
#define snd_usb_complete_callback(x) (x) #define snd_usb_complete_callback(x) (x)
#endif #endif
#ifndef snd_usb_get_speed
#define snd_usb_get_speed(dev) ((dev)->speed)
#endif
#endif /* __USBAUDIO_H */ #endif /* __USBAUDIO_H */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment