diff options
-rw-r--r-- | sound/usb/usx2y/us122l.c | 68 | ||||
-rw-r--r-- | sound/usb/usx2y/us122l.h | 3 | ||||
-rw-r--r-- | sound/usb/usx2y/usX2Yhwdep.c | 6 | ||||
-rw-r--r-- | sound/usb/usx2y/usbusx2y.c | 24 | ||||
-rw-r--r-- | sound/usb/usx2y/usbusx2y.h | 5 | ||||
-rw-r--r-- | sound/usb/usx2y/usbusx2yaudio.c | 30 | ||||
-rw-r--r-- | sound/usb/usx2y/usx2yhwdeppcm.c | 8 |
7 files changed, 72 insertions, 72 deletions
diff --git a/sound/usb/usx2y/us122l.c b/sound/usb/usx2y/us122l.c index 0ad061e5728b..f71cd28eca6b 100644 --- a/sound/usb/usx2y/us122l.c +++ b/sound/usb/usx2y/us122l.c | |||
@@ -59,7 +59,7 @@ static int us122l_create_usbmidi(struct snd_card *card) | |||
59 | .type = QUIRK_MIDI_US122L, | 59 | .type = QUIRK_MIDI_US122L, |
60 | .data = &quirk_data | 60 | .data = &quirk_data |
61 | }; | 61 | }; |
62 | struct usb_device *dev = US122L(card)->chip.dev; | 62 | struct usb_device *dev = US122L(card)->dev; |
63 | struct usb_interface *iface = usb_ifnum_to_if(dev, 1); | 63 | struct usb_interface *iface = usb_ifnum_to_if(dev, 1); |
64 | 64 | ||
65 | return snd_usbmidi_create(card, iface, | 65 | return snd_usbmidi_create(card, iface, |
@@ -81,7 +81,7 @@ static int us144_create_usbmidi(struct snd_card *card) | |||
81 | .type = QUIRK_MIDI_US122L, | 81 | .type = QUIRK_MIDI_US122L, |
82 | .data = &quirk_data | 82 | .data = &quirk_data |
83 | }; | 83 | }; |
84 | struct usb_device *dev = US122L(card)->chip.dev; | 84 | struct usb_device *dev = US122L(card)->dev; |
85 | struct usb_interface *iface = usb_ifnum_to_if(dev, 0); | 85 | struct usb_interface *iface = usb_ifnum_to_if(dev, 0); |
86 | 86 | ||
87 | return snd_usbmidi_create(card, iface, | 87 | return snd_usbmidi_create(card, iface, |
@@ -194,11 +194,11 @@ static int usb_stream_hwdep_open(struct snd_hwdep *hw, struct file *file) | |||
194 | if (!us122l->first) | 194 | if (!us122l->first) |
195 | us122l->first = file; | 195 | us122l->first = file; |
196 | 196 | ||
197 | if (us122l->chip.dev->descriptor.idProduct == USB_ID_US144) { | 197 | if (us122l->dev->descriptor.idProduct == USB_ID_US144) { |
198 | iface = usb_ifnum_to_if(us122l->chip.dev, 0); | 198 | iface = usb_ifnum_to_if(us122l->dev, 0); |
199 | usb_autopm_get_interface(iface); | 199 | usb_autopm_get_interface(iface); |
200 | } | 200 | } |
201 | iface = usb_ifnum_to_if(us122l->chip.dev, 1); | 201 | iface = usb_ifnum_to_if(us122l->dev, 1); |
202 | usb_autopm_get_interface(iface); | 202 | usb_autopm_get_interface(iface); |
203 | return 0; | 203 | return 0; |
204 | } | 204 | } |
@@ -209,11 +209,11 @@ static int usb_stream_hwdep_release(struct snd_hwdep *hw, struct file *file) | |||
209 | struct usb_interface *iface; | 209 | struct usb_interface *iface; |
210 | snd_printdd(KERN_DEBUG "%p %p\n", hw, file); | 210 | snd_printdd(KERN_DEBUG "%p %p\n", hw, file); |
211 | 211 | ||
212 | if (us122l->chip.dev->descriptor.idProduct == USB_ID_US144) { | 212 | if (us122l->dev->descriptor.idProduct == USB_ID_US144) { |
213 | iface = usb_ifnum_to_if(us122l->chip.dev, 0); | 213 | iface = usb_ifnum_to_if(us122l->dev, 0); |
214 | usb_autopm_put_interface(iface); | 214 | usb_autopm_put_interface(iface); |
215 | } | 215 | } |
216 | iface = usb_ifnum_to_if(us122l->chip.dev, 1); | 216 | iface = usb_ifnum_to_if(us122l->dev, 1); |
217 | usb_autopm_put_interface(iface); | 217 | usb_autopm_put_interface(iface); |
218 | if (us122l->first == file) | 218 | if (us122l->first == file) |
219 | us122l->first = NULL; | 219 | us122l->first = NULL; |
@@ -330,7 +330,7 @@ static bool us122l_start(struct us122l *us122l, | |||
330 | unsigned use_packsize = 0; | 330 | unsigned use_packsize = 0; |
331 | bool success = false; | 331 | bool success = false; |
332 | 332 | ||
333 | if (us122l->chip.dev->speed == USB_SPEED_HIGH) { | 333 | if (us122l->dev->speed == USB_SPEED_HIGH) { |
334 | /* The us-122l's descriptor defaults to iso max_packsize 78, | 334 | /* The us-122l's descriptor defaults to iso max_packsize 78, |
335 | which isn't needed for samplerates <= 48000. | 335 | which isn't needed for samplerates <= 48000. |
336 | Lets save some memory: | 336 | Lets save some memory: |
@@ -347,11 +347,11 @@ static bool us122l_start(struct us122l *us122l, | |||
347 | break; | 347 | break; |
348 | } | 348 | } |
349 | } | 349 | } |
350 | if (!usb_stream_new(&us122l->sk, us122l->chip.dev, 1, 2, | 350 | if (!usb_stream_new(&us122l->sk, us122l->dev, 1, 2, |
351 | rate, use_packsize, period_frames, 6)) | 351 | rate, use_packsize, period_frames, 6)) |
352 | goto out; | 352 | goto out; |
353 | 353 | ||
354 | err = us122l_set_sample_rate(us122l->chip.dev, rate); | 354 | err = us122l_set_sample_rate(us122l->dev, rate); |
355 | if (err < 0) { | 355 | if (err < 0) { |
356 | us122l_stop(us122l); | 356 | us122l_stop(us122l); |
357 | snd_printk(KERN_ERR "us122l_set_sample_rate error \n"); | 357 | snd_printk(KERN_ERR "us122l_set_sample_rate error \n"); |
@@ -390,7 +390,7 @@ static int usb_stream_hwdep_ioctl(struct snd_hwdep *hw, struct file *file, | |||
390 | err = -ENXIO; | 390 | err = -ENXIO; |
391 | goto free; | 391 | goto free; |
392 | } | 392 | } |
393 | high_speed = us122l->chip.dev->speed == USB_SPEED_HIGH; | 393 | high_speed = us122l->dev->speed == USB_SPEED_HIGH; |
394 | if ((cfg->sample_rate != 44100 && cfg->sample_rate != 48000 && | 394 | if ((cfg->sample_rate != 44100 && cfg->sample_rate != 48000 && |
395 | (!high_speed || | 395 | (!high_speed || |
396 | (cfg->sample_rate != 88200 && cfg->sample_rate != 96000))) || | 396 | (cfg->sample_rate != 88200 && cfg->sample_rate != 96000))) || |
@@ -450,7 +450,7 @@ static int usb_stream_hwdep_new(struct snd_card *card) | |||
450 | { | 450 | { |
451 | int err; | 451 | int err; |
452 | struct snd_hwdep *hw; | 452 | struct snd_hwdep *hw; |
453 | struct usb_device *dev = US122L(card)->chip.dev; | 453 | struct usb_device *dev = US122L(card)->dev; |
454 | 454 | ||
455 | err = snd_hwdep_new(card, SND_USB_STREAM_ID, 0, &hw); | 455 | err = snd_hwdep_new(card, SND_USB_STREAM_ID, 0, &hw); |
456 | if (err < 0) | 456 | if (err < 0) |
@@ -476,26 +476,26 @@ static bool us122l_create_card(struct snd_card *card) | |||
476 | int err; | 476 | int err; |
477 | struct us122l *us122l = US122L(card); | 477 | struct us122l *us122l = US122L(card); |
478 | 478 | ||
479 | if (us122l->chip.dev->descriptor.idProduct == USB_ID_US144) { | 479 | if (us122l->dev->descriptor.idProduct == USB_ID_US144) { |
480 | err = usb_set_interface(us122l->chip.dev, 0, 1); | 480 | err = usb_set_interface(us122l->dev, 0, 1); |
481 | if (err) { | 481 | if (err) { |
482 | snd_printk(KERN_ERR "usb_set_interface error \n"); | 482 | snd_printk(KERN_ERR "usb_set_interface error \n"); |
483 | return false; | 483 | return false; |
484 | } | 484 | } |
485 | } | 485 | } |
486 | err = usb_set_interface(us122l->chip.dev, 1, 1); | 486 | err = usb_set_interface(us122l->dev, 1, 1); |
487 | if (err) { | 487 | if (err) { |
488 | snd_printk(KERN_ERR "usb_set_interface error \n"); | 488 | snd_printk(KERN_ERR "usb_set_interface error \n"); |
489 | return false; | 489 | return false; |
490 | } | 490 | } |
491 | 491 | ||
492 | pt_info_set(us122l->chip.dev, 0x11); | 492 | pt_info_set(us122l->dev, 0x11); |
493 | pt_info_set(us122l->chip.dev, 0x10); | 493 | pt_info_set(us122l->dev, 0x10); |
494 | 494 | ||
495 | if (!us122l_start(us122l, 44100, 256)) | 495 | if (!us122l_start(us122l, 44100, 256)) |
496 | return false; | 496 | return false; |
497 | 497 | ||
498 | if (us122l->chip.dev->descriptor.idProduct == USB_ID_US144) | 498 | if (us122l->dev->descriptor.idProduct == USB_ID_US144) |
499 | err = us144_create_usbmidi(card); | 499 | err = us144_create_usbmidi(card); |
500 | else | 500 | else |
501 | err = us122l_create_usbmidi(card); | 501 | err = us122l_create_usbmidi(card); |
@@ -520,7 +520,7 @@ static bool us122l_create_card(struct snd_card *card) | |||
520 | static void snd_us122l_free(struct snd_card *card) | 520 | static void snd_us122l_free(struct snd_card *card) |
521 | { | 521 | { |
522 | struct us122l *us122l = US122L(card); | 522 | struct us122l *us122l = US122L(card); |
523 | int index = us122l->chip.index; | 523 | int index = us122l->card_index; |
524 | if (index >= 0 && index < SNDRV_CARDS) | 524 | if (index >= 0 && index < SNDRV_CARDS) |
525 | snd_us122l_card_used[index] = 0; | 525 | snd_us122l_card_used[index] = 0; |
526 | } | 526 | } |
@@ -540,10 +540,9 @@ static int usx2y_create_card(struct usb_device *device, struct snd_card **cardp) | |||
540 | sizeof(struct us122l), &card); | 540 | sizeof(struct us122l), &card); |
541 | if (err < 0) | 541 | if (err < 0) |
542 | return err; | 542 | return err; |
543 | snd_us122l_card_used[US122L(card)->chip.index = dev] = 1; | 543 | snd_us122l_card_used[US122L(card)->card_index = dev] = 1; |
544 | card->private_free = snd_us122l_free; | 544 | card->private_free = snd_us122l_free; |
545 | US122L(card)->chip.dev = device; | 545 | US122L(card)->dev = device; |
546 | US122L(card)->chip.card = card; | ||
547 | mutex_init(&US122L(card)->mutex); | 546 | mutex_init(&US122L(card)->mutex); |
548 | init_waitqueue_head(&US122L(card)->sk.sleep); | 547 | init_waitqueue_head(&US122L(card)->sk.sleep); |
549 | INIT_LIST_HEAD(&US122L(card)->midi_list); | 548 | INIT_LIST_HEAD(&US122L(card)->midi_list); |
@@ -554,8 +553,8 @@ static int usx2y_create_card(struct usb_device *device, struct snd_card **cardp) | |||
554 | le16_to_cpu(device->descriptor.idVendor), | 553 | le16_to_cpu(device->descriptor.idVendor), |
555 | le16_to_cpu(device->descriptor.idProduct), | 554 | le16_to_cpu(device->descriptor.idProduct), |
556 | 0, | 555 | 0, |
557 | US122L(card)->chip.dev->bus->busnum, | 556 | US122L(card)->dev->bus->busnum, |
558 | US122L(card)->chip.dev->devnum | 557 | US122L(card)->dev->devnum |
559 | ); | 558 | ); |
560 | *cardp = card; | 559 | *cardp = card; |
561 | return 0; | 560 | return 0; |
@@ -635,16 +634,15 @@ static void snd_us122l_disconnect(struct usb_interface *intf) | |||
635 | mutex_lock(&us122l->mutex); | 634 | mutex_lock(&us122l->mutex); |
636 | us122l_stop(us122l); | 635 | us122l_stop(us122l); |
637 | mutex_unlock(&us122l->mutex); | 636 | mutex_unlock(&us122l->mutex); |
638 | us122l->chip.shutdown = 1; | ||
639 | 637 | ||
640 | /* release the midi resources */ | 638 | /* release the midi resources */ |
641 | list_for_each(p, &us122l->midi_list) { | 639 | list_for_each(p, &us122l->midi_list) { |
642 | snd_usbmidi_disconnect(p); | 640 | snd_usbmidi_disconnect(p); |
643 | } | 641 | } |
644 | 642 | ||
645 | usb_put_intf(usb_ifnum_to_if(us122l->chip.dev, 0)); | 643 | usb_put_intf(usb_ifnum_to_if(us122l->dev, 0)); |
646 | usb_put_intf(usb_ifnum_to_if(us122l->chip.dev, 1)); | 644 | usb_put_intf(usb_ifnum_to_if(us122l->dev, 1)); |
647 | usb_put_dev(us122l->chip.dev); | 645 | usb_put_dev(us122l->dev); |
648 | 646 | ||
649 | while (atomic_read(&us122l->mmap_count)) | 647 | while (atomic_read(&us122l->mmap_count)) |
650 | msleep(500); | 648 | msleep(500); |
@@ -694,23 +692,23 @@ static int snd_us122l_resume(struct usb_interface *intf) | |||
694 | 692 | ||
695 | mutex_lock(&us122l->mutex); | 693 | mutex_lock(&us122l->mutex); |
696 | /* needed, doesn't restart without: */ | 694 | /* needed, doesn't restart without: */ |
697 | if (us122l->chip.dev->descriptor.idProduct == USB_ID_US144) { | 695 | if (us122l->dev->descriptor.idProduct == USB_ID_US144) { |
698 | err = usb_set_interface(us122l->chip.dev, 0, 1); | 696 | err = usb_set_interface(us122l->dev, 0, 1); |
699 | if (err) { | 697 | if (err) { |
700 | snd_printk(KERN_ERR "usb_set_interface error \n"); | 698 | snd_printk(KERN_ERR "usb_set_interface error \n"); |
701 | goto unlock; | 699 | goto unlock; |
702 | } | 700 | } |
703 | } | 701 | } |
704 | err = usb_set_interface(us122l->chip.dev, 1, 1); | 702 | err = usb_set_interface(us122l->dev, 1, 1); |
705 | if (err) { | 703 | if (err) { |
706 | snd_printk(KERN_ERR "usb_set_interface error \n"); | 704 | snd_printk(KERN_ERR "usb_set_interface error \n"); |
707 | goto unlock; | 705 | goto unlock; |
708 | } | 706 | } |
709 | 707 | ||
710 | pt_info_set(us122l->chip.dev, 0x11); | 708 | pt_info_set(us122l->dev, 0x11); |
711 | pt_info_set(us122l->chip.dev, 0x10); | 709 | pt_info_set(us122l->dev, 0x10); |
712 | 710 | ||
713 | err = us122l_set_sample_rate(us122l->chip.dev, | 711 | err = us122l_set_sample_rate(us122l->dev, |
714 | us122l->sk.s->cfg.sample_rate); | 712 | us122l->sk.s->cfg.sample_rate); |
715 | if (err < 0) { | 713 | if (err < 0) { |
716 | snd_printk(KERN_ERR "us122l_set_sample_rate error \n"); | 714 | snd_printk(KERN_ERR "us122l_set_sample_rate error \n"); |
diff --git a/sound/usb/usx2y/us122l.h b/sound/usb/usx2y/us122l.h index 61ce5d7de0b9..4daf1982e821 100644 --- a/sound/usb/usx2y/us122l.h +++ b/sound/usb/usx2y/us122l.h | |||
@@ -3,7 +3,8 @@ | |||
3 | 3 | ||
4 | 4 | ||
5 | struct us122l { | 5 | struct us122l { |
6 | struct snd_usb_audio chip; | 6 | struct usb_device *dev; |
7 | int card_index; | ||
7 | int stride; | 8 | int stride; |
8 | struct usb_stream_kernel sk; | 9 | struct usb_stream_kernel sk; |
9 | 10 | ||
diff --git a/sound/usb/usx2y/usX2Yhwdep.c b/sound/usb/usx2y/usX2Yhwdep.c index f96ab86259d0..1879b72c40f8 100644 --- a/sound/usb/usx2y/usX2Yhwdep.c +++ b/sound/usb/usx2y/usX2Yhwdep.c | |||
@@ -114,7 +114,7 @@ static int snd_usX2Y_hwdep_dsp_status(struct snd_hwdep *hw, | |||
114 | struct usX2Ydev *us428 = hw->private_data; | 114 | struct usX2Ydev *us428 = hw->private_data; |
115 | int id = -1; | 115 | int id = -1; |
116 | 116 | ||
117 | switch (le16_to_cpu(us428->chip.dev->descriptor.idProduct)) { | 117 | switch (le16_to_cpu(us428->dev->descriptor.idProduct)) { |
118 | case USB_ID_US122: | 118 | case USB_ID_US122: |
119 | id = USX2Y_TYPE_122; | 119 | id = USX2Y_TYPE_122; |
120 | break; | 120 | break; |
@@ -164,7 +164,7 @@ static int usX2Y_create_usbmidi(struct snd_card *card) | |||
164 | .type = QUIRK_MIDI_FIXED_ENDPOINT, | 164 | .type = QUIRK_MIDI_FIXED_ENDPOINT, |
165 | .data = &quirk_data_2 | 165 | .data = &quirk_data_2 |
166 | }; | 166 | }; |
167 | struct usb_device *dev = usX2Y(card)->chip.dev; | 167 | struct usb_device *dev = usX2Y(card)->dev; |
168 | struct usb_interface *iface = usb_ifnum_to_if(dev, 0); | 168 | struct usb_interface *iface = usb_ifnum_to_if(dev, 0); |
169 | struct snd_usb_audio_quirk *quirk = | 169 | struct snd_usb_audio_quirk *quirk = |
170 | le16_to_cpu(dev->descriptor.idProduct) == USB_ID_US428 ? | 170 | le16_to_cpu(dev->descriptor.idProduct) == USB_ID_US428 ? |
@@ -202,7 +202,7 @@ static int snd_usX2Y_hwdep_dsp_load(struct snd_hwdep *hw, | |||
202 | snd_printdd( "dsp_load %s\n", dsp->name); | 202 | snd_printdd( "dsp_load %s\n", dsp->name); |
203 | 203 | ||
204 | if (access_ok(VERIFY_READ, dsp->image, dsp->length)) { | 204 | if (access_ok(VERIFY_READ, dsp->image, dsp->length)) { |
205 | struct usb_device* dev = priv->chip.dev; | 205 | struct usb_device* dev = priv->dev; |
206 | char *buf; | 206 | char *buf; |
207 | 207 | ||
208 | buf = memdup_user(dsp->image, dsp->length); | 208 | buf = memdup_user(dsp->image, dsp->length); |
diff --git a/sound/usb/usx2y/usbusx2y.c b/sound/usb/usx2y/usbusx2y.c index 181337090e48..c42350eed2eb 100644 --- a/sound/usb/usx2y/usbusx2y.c +++ b/sound/usb/usx2y/usbusx2y.c | |||
@@ -239,8 +239,8 @@ static void i_usX2Y_In04Int(struct urb *urb) | |||
239 | for (j = 0; j < URBS_AsyncSeq && !err; ++j) | 239 | for (j = 0; j < URBS_AsyncSeq && !err; ++j) |
240 | if (0 == usX2Y->AS04.urb[j]->status) { | 240 | if (0 == usX2Y->AS04.urb[j]->status) { |
241 | struct us428_p4out *p4out = us428ctls->p4out + send; // FIXME if more than 1 p4out is new, 1 gets lost. | 241 | struct us428_p4out *p4out = us428ctls->p4out + send; // FIXME if more than 1 p4out is new, 1 gets lost. |
242 | usb_fill_bulk_urb(usX2Y->AS04.urb[j], usX2Y->chip.dev, | 242 | usb_fill_bulk_urb(usX2Y->AS04.urb[j], usX2Y->dev, |
243 | usb_sndbulkpipe(usX2Y->chip.dev, 0x04), &p4out->val.vol, | 243 | usb_sndbulkpipe(usX2Y->dev, 0x04), &p4out->val.vol, |
244 | p4out->type == eLT_Light ? sizeof(struct us428_lights) : 5, | 244 | p4out->type == eLT_Light ? sizeof(struct us428_lights) : 5, |
245 | i_usX2Y_Out04Int, usX2Y); | 245 | i_usX2Y_Out04Int, usX2Y); |
246 | err = usb_submit_urb(usX2Y->AS04.urb[j], GFP_ATOMIC); | 246 | err = usb_submit_urb(usX2Y->AS04.urb[j], GFP_ATOMIC); |
@@ -253,7 +253,7 @@ static void i_usX2Y_In04Int(struct urb *urb) | |||
253 | if (err) | 253 | if (err) |
254 | snd_printk(KERN_ERR "In04Int() usb_submit_urb err=%i\n", err); | 254 | snd_printk(KERN_ERR "In04Int() usb_submit_urb err=%i\n", err); |
255 | 255 | ||
256 | urb->dev = usX2Y->chip.dev; | 256 | urb->dev = usX2Y->dev; |
257 | usb_submit_urb(urb, GFP_ATOMIC); | 257 | usb_submit_urb(urb, GFP_ATOMIC); |
258 | } | 258 | } |
259 | 259 | ||
@@ -273,8 +273,8 @@ int usX2Y_AsyncSeq04_init(struct usX2Ydev *usX2Y) | |||
273 | err = -ENOMEM; | 273 | err = -ENOMEM; |
274 | break; | 274 | break; |
275 | } | 275 | } |
276 | usb_fill_bulk_urb( usX2Y->AS04.urb[i], usX2Y->chip.dev, | 276 | usb_fill_bulk_urb( usX2Y->AS04.urb[i], usX2Y->dev, |
277 | usb_sndbulkpipe(usX2Y->chip.dev, 0x04), | 277 | usb_sndbulkpipe(usX2Y->dev, 0x04), |
278 | usX2Y->AS04.buffer + URB_DataLen_AsyncSeq*i, 0, | 278 | usX2Y->AS04.buffer + URB_DataLen_AsyncSeq*i, 0, |
279 | i_usX2Y_Out04Int, usX2Y | 279 | i_usX2Y_Out04Int, usX2Y |
280 | ); | 280 | ); |
@@ -293,7 +293,7 @@ int usX2Y_In04_init(struct usX2Ydev *usX2Y) | |||
293 | } | 293 | } |
294 | 294 | ||
295 | init_waitqueue_head(&usX2Y->In04WaitQueue); | 295 | init_waitqueue_head(&usX2Y->In04WaitQueue); |
296 | usb_fill_int_urb(usX2Y->In04urb, usX2Y->chip.dev, usb_rcvintpipe(usX2Y->chip.dev, 0x4), | 296 | usb_fill_int_urb(usX2Y->In04urb, usX2Y->dev, usb_rcvintpipe(usX2Y->dev, 0x4), |
297 | usX2Y->In04Buf, 21, | 297 | usX2Y->In04Buf, 21, |
298 | i_usX2Y_In04Int, usX2Y, | 298 | i_usX2Y_In04Int, usX2Y, |
299 | 10); | 299 | 10); |
@@ -348,10 +348,9 @@ static int usX2Y_create_card(struct usb_device *device, struct snd_card **cardp) | |||
348 | sizeof(struct usX2Ydev), &card); | 348 | sizeof(struct usX2Ydev), &card); |
349 | if (err < 0) | 349 | if (err < 0) |
350 | return err; | 350 | return err; |
351 | snd_usX2Y_card_used[usX2Y(card)->chip.index = dev] = 1; | 351 | snd_usX2Y_card_used[usX2Y(card)->card_index = dev] = 1; |
352 | card->private_free = snd_usX2Y_card_private_free; | 352 | card->private_free = snd_usX2Y_card_private_free; |
353 | usX2Y(card)->chip.dev = device; | 353 | usX2Y(card)->dev = device; |
354 | usX2Y(card)->chip.card = card; | ||
355 | init_waitqueue_head(&usX2Y(card)->prepare_wait_queue); | 354 | init_waitqueue_head(&usX2Y(card)->prepare_wait_queue); |
356 | mutex_init(&usX2Y(card)->prepare_mutex); | 355 | mutex_init(&usX2Y(card)->prepare_mutex); |
357 | INIT_LIST_HEAD(&usX2Y(card)->midi_list); | 356 | INIT_LIST_HEAD(&usX2Y(card)->midi_list); |
@@ -362,7 +361,7 @@ static int usX2Y_create_card(struct usb_device *device, struct snd_card **cardp) | |||
362 | le16_to_cpu(device->descriptor.idVendor), | 361 | le16_to_cpu(device->descriptor.idVendor), |
363 | le16_to_cpu(device->descriptor.idProduct), | 362 | le16_to_cpu(device->descriptor.idProduct), |
364 | 0,//us428(card)->usbmidi.ifnum, | 363 | 0,//us428(card)->usbmidi.ifnum, |
365 | usX2Y(card)->chip.dev->bus->busnum, usX2Y(card)->chip.dev->devnum | 364 | usX2Y(card)->dev->bus->busnum, usX2Y(card)->dev->devnum |
366 | ); | 365 | ); |
367 | *cardp = card; | 366 | *cardp = card; |
368 | return 0; | 367 | return 0; |
@@ -432,8 +431,8 @@ static void snd_usX2Y_card_private_free(struct snd_card *card) | |||
432 | usb_free_urb(usX2Y(card)->In04urb); | 431 | usb_free_urb(usX2Y(card)->In04urb); |
433 | if (usX2Y(card)->us428ctls_sharedmem) | 432 | if (usX2Y(card)->us428ctls_sharedmem) |
434 | snd_free_pages(usX2Y(card)->us428ctls_sharedmem, sizeof(*usX2Y(card)->us428ctls_sharedmem)); | 433 | snd_free_pages(usX2Y(card)->us428ctls_sharedmem, sizeof(*usX2Y(card)->us428ctls_sharedmem)); |
435 | if (usX2Y(card)->chip.index >= 0 && usX2Y(card)->chip.index < SNDRV_CARDS) | 434 | if (usX2Y(card)->card_index >= 0 && usX2Y(card)->card_index < SNDRV_CARDS) |
436 | snd_usX2Y_card_used[usX2Y(card)->chip.index] = 0; | 435 | snd_usX2Y_card_used[usX2Y(card)->card_index] = 0; |
437 | } | 436 | } |
438 | 437 | ||
439 | /* | 438 | /* |
@@ -445,7 +444,6 @@ static void usX2Y_usb_disconnect(struct usb_device *device, void* ptr) | |||
445 | struct snd_card *card = ptr; | 444 | struct snd_card *card = ptr; |
446 | struct usX2Ydev *usX2Y = usX2Y(card); | 445 | struct usX2Ydev *usX2Y = usX2Y(card); |
447 | struct list_head *p; | 446 | struct list_head *p; |
448 | usX2Y->chip.shutdown = 1; | ||
449 | usX2Y->chip_status = USX2Y_STAT_CHIP_HUP; | 447 | usX2Y->chip_status = USX2Y_STAT_CHIP_HUP; |
450 | usX2Y_unlinkSeq(&usX2Y->AS04); | 448 | usX2Y_unlinkSeq(&usX2Y->AS04); |
451 | usb_kill_urb(usX2Y->In04urb); | 449 | usb_kill_urb(usX2Y->In04urb); |
diff --git a/sound/usb/usx2y/usbusx2y.h b/sound/usb/usx2y/usbusx2y.h index 231866ea3491..1d174cea352b 100644 --- a/sound/usb/usx2y/usbusx2y.h +++ b/sound/usb/usx2y/usbusx2y.h | |||
@@ -22,7 +22,8 @@ struct snd_usX2Y_urbSeq { | |||
22 | #include "usx2yhwdeppcm.h" | 22 | #include "usx2yhwdeppcm.h" |
23 | 23 | ||
24 | struct usX2Ydev { | 24 | struct usX2Ydev { |
25 | struct snd_usb_audio chip; | 25 | struct usb_device *dev; |
26 | int card_index; | ||
26 | int stride; | 27 | int stride; |
27 | struct urb *In04urb; | 28 | struct urb *In04urb; |
28 | void *In04Buf; | 29 | void *In04Buf; |
@@ -43,6 +44,8 @@ struct usX2Ydev { | |||
43 | struct snd_usX2Y_substream * volatile prepare_subs; | 44 | struct snd_usX2Y_substream * volatile prepare_subs; |
44 | wait_queue_head_t prepare_wait_queue; | 45 | wait_queue_head_t prepare_wait_queue; |
45 | struct list_head midi_list; | 46 | struct list_head midi_list; |
47 | struct list_head pcm_list; | ||
48 | int pcm_devs; | ||
46 | }; | 49 | }; |
47 | 50 | ||
48 | 51 | ||
diff --git a/sound/usb/usx2y/usbusx2yaudio.c b/sound/usb/usx2y/usbusx2yaudio.c index b8e2f4691493..74a67a85aa81 100644 --- a/sound/usb/usx2y/usbusx2yaudio.c +++ b/sound/usb/usx2y/usbusx2yaudio.c | |||
@@ -199,7 +199,7 @@ static int usX2Y_urb_submit(struct snd_usX2Y_substream *subs, struct urb *urb, i | |||
199 | return -ENODEV; | 199 | return -ENODEV; |
200 | urb->start_frame = (frame + NRURBS * nr_of_packs()); // let hcd do rollover sanity checks | 200 | urb->start_frame = (frame + NRURBS * nr_of_packs()); // let hcd do rollover sanity checks |
201 | urb->hcpriv = NULL; | 201 | urb->hcpriv = NULL; |
202 | urb->dev = subs->usX2Y->chip.dev; /* we need to set this at each time */ | 202 | urb->dev = subs->usX2Y->dev; /* we need to set this at each time */ |
203 | if ((err = usb_submit_urb(urb, GFP_ATOMIC)) < 0) { | 203 | if ((err = usb_submit_urb(urb, GFP_ATOMIC)) < 0) { |
204 | snd_printk(KERN_ERR "usb_submit_urb() returned %i\n", err); | 204 | snd_printk(KERN_ERR "usb_submit_urb() returned %i\n", err); |
205 | return err; | 205 | return err; |
@@ -300,7 +300,7 @@ static void usX2Y_error_sequence(struct usX2Ydev *usX2Y, | |||
300 | "Sequence Error!(hcd_frame=%i ep=%i%s;wait=%i,frame=%i).\n" | 300 | "Sequence Error!(hcd_frame=%i ep=%i%s;wait=%i,frame=%i).\n" |
301 | "Most propably some urb of usb-frame %i is still missing.\n" | 301 | "Most propably some urb of usb-frame %i is still missing.\n" |
302 | "Cause could be too long delays in usb-hcd interrupt handling.\n", | 302 | "Cause could be too long delays in usb-hcd interrupt handling.\n", |
303 | usb_get_current_frame_number(usX2Y->chip.dev), | 303 | usb_get_current_frame_number(usX2Y->dev), |
304 | subs->endpoint, usb_pipein(urb->pipe) ? "in" : "out", | 304 | subs->endpoint, usb_pipein(urb->pipe) ? "in" : "out", |
305 | usX2Y->wait_iso_frame, urb->start_frame, usX2Y->wait_iso_frame); | 305 | usX2Y->wait_iso_frame, urb->start_frame, usX2Y->wait_iso_frame); |
306 | usX2Y_clients_stop(usX2Y); | 306 | usX2Y_clients_stop(usX2Y); |
@@ -313,7 +313,7 @@ static void i_usX2Y_urb_complete(struct urb *urb) | |||
313 | 313 | ||
314 | if (unlikely(atomic_read(&subs->state) < state_PREPARED)) { | 314 | if (unlikely(atomic_read(&subs->state) < state_PREPARED)) { |
315 | snd_printdd("hcd_frame=%i ep=%i%s status=%i start_frame=%i\n", | 315 | snd_printdd("hcd_frame=%i ep=%i%s status=%i start_frame=%i\n", |
316 | usb_get_current_frame_number(usX2Y->chip.dev), | 316 | usb_get_current_frame_number(usX2Y->dev), |
317 | subs->endpoint, usb_pipein(urb->pipe) ? "in" : "out", | 317 | subs->endpoint, usb_pipein(urb->pipe) ? "in" : "out", |
318 | urb->status, urb->start_frame); | 318 | urb->status, urb->start_frame); |
319 | return; | 319 | return; |
@@ -424,7 +424,7 @@ static int usX2Y_urbs_allocate(struct snd_usX2Y_substream *subs) | |||
424 | int i; | 424 | int i; |
425 | unsigned int pipe; | 425 | unsigned int pipe; |
426 | int is_playback = subs == subs->usX2Y->subs[SNDRV_PCM_STREAM_PLAYBACK]; | 426 | int is_playback = subs == subs->usX2Y->subs[SNDRV_PCM_STREAM_PLAYBACK]; |
427 | struct usb_device *dev = subs->usX2Y->chip.dev; | 427 | struct usb_device *dev = subs->usX2Y->dev; |
428 | 428 | ||
429 | pipe = is_playback ? usb_sndisocpipe(dev, subs->endpoint) : | 429 | pipe = is_playback ? usb_sndisocpipe(dev, subs->endpoint) : |
430 | usb_rcvisocpipe(dev, subs->endpoint); | 430 | usb_rcvisocpipe(dev, subs->endpoint); |
@@ -500,7 +500,7 @@ static int usX2Y_urbs_start(struct snd_usX2Y_substream *subs) | |||
500 | unsigned long pack; | 500 | unsigned long pack; |
501 | if (0 == i) | 501 | if (0 == i) |
502 | atomic_set(&subs->state, state_STARTING3); | 502 | atomic_set(&subs->state, state_STARTING3); |
503 | urb->dev = usX2Y->chip.dev; | 503 | urb->dev = usX2Y->dev; |
504 | urb->transfer_flags = URB_ISO_ASAP; | 504 | urb->transfer_flags = URB_ISO_ASAP; |
505 | for (pack = 0; pack < nr_of_packs(); pack++) { | 505 | for (pack = 0; pack < nr_of_packs(); pack++) { |
506 | urb->iso_frame_desc[pack].offset = subs->maxpacksize * pack; | 506 | urb->iso_frame_desc[pack].offset = subs->maxpacksize * pack; |
@@ -692,7 +692,7 @@ static int usX2Y_rate_set(struct usX2Ydev *usX2Y, int rate) | |||
692 | } | 692 | } |
693 | ((char*)(usbdata + i))[0] = ra[i].c1; | 693 | ((char*)(usbdata + i))[0] = ra[i].c1; |
694 | ((char*)(usbdata + i))[1] = ra[i].c2; | 694 | ((char*)(usbdata + i))[1] = ra[i].c2; |
695 | usb_fill_bulk_urb(us->urb[i], usX2Y->chip.dev, usb_sndbulkpipe(usX2Y->chip.dev, 4), | 695 | usb_fill_bulk_urb(us->urb[i], usX2Y->dev, usb_sndbulkpipe(usX2Y->dev, 4), |
696 | usbdata + i, 2, i_usX2Y_04Int, usX2Y); | 696 | usbdata + i, 2, i_usX2Y_04Int, usX2Y); |
697 | #ifdef OLD_USB | 697 | #ifdef OLD_USB |
698 | us->urb[i]->transfer_flags = USB_QUEUE_BULK; | 698 | us->urb[i]->transfer_flags = USB_QUEUE_BULK; |
@@ -744,11 +744,11 @@ static int usX2Y_format_set(struct usX2Ydev *usX2Y, snd_pcm_format_t format) | |||
744 | snd_usbmidi_input_stop(p); | 744 | snd_usbmidi_input_stop(p); |
745 | } | 745 | } |
746 | usb_kill_urb(usX2Y->In04urb); | 746 | usb_kill_urb(usX2Y->In04urb); |
747 | if ((err = usb_set_interface(usX2Y->chip.dev, 0, alternate))) { | 747 | if ((err = usb_set_interface(usX2Y->dev, 0, alternate))) { |
748 | snd_printk(KERN_ERR "usb_set_interface error \n"); | 748 | snd_printk(KERN_ERR "usb_set_interface error \n"); |
749 | return err; | 749 | return err; |
750 | } | 750 | } |
751 | usX2Y->In04urb->dev = usX2Y->chip.dev; | 751 | usX2Y->In04urb->dev = usX2Y->dev; |
752 | err = usb_submit_urb(usX2Y->In04urb, GFP_KERNEL); | 752 | err = usb_submit_urb(usX2Y->In04urb, GFP_KERNEL); |
753 | list_for_each(p, &usX2Y->midi_list) { | 753 | list_for_each(p, &usX2Y->midi_list) { |
754 | snd_usbmidi_input_start(p); | 754 | snd_usbmidi_input_start(p); |
@@ -955,7 +955,7 @@ static int usX2Y_audio_stream_new(struct snd_card *card, int playback_endpoint, | |||
955 | struct snd_pcm *pcm; | 955 | struct snd_pcm *pcm; |
956 | int err, i; | 956 | int err, i; |
957 | struct snd_usX2Y_substream **usX2Y_substream = | 957 | struct snd_usX2Y_substream **usX2Y_substream = |
958 | usX2Y(card)->subs + 2 * usX2Y(card)->chip.pcm_devs; | 958 | usX2Y(card)->subs + 2 * usX2Y(card)->pcm_devs; |
959 | 959 | ||
960 | for (i = playback_endpoint ? SNDRV_PCM_STREAM_PLAYBACK : SNDRV_PCM_STREAM_CAPTURE; | 960 | for (i = playback_endpoint ? SNDRV_PCM_STREAM_PLAYBACK : SNDRV_PCM_STREAM_CAPTURE; |
961 | i <= SNDRV_PCM_STREAM_CAPTURE; ++i) { | 961 | i <= SNDRV_PCM_STREAM_CAPTURE; ++i) { |
@@ -971,7 +971,7 @@ static int usX2Y_audio_stream_new(struct snd_card *card, int playback_endpoint, | |||
971 | usX2Y_substream[SNDRV_PCM_STREAM_PLAYBACK]->endpoint = playback_endpoint; | 971 | usX2Y_substream[SNDRV_PCM_STREAM_PLAYBACK]->endpoint = playback_endpoint; |
972 | usX2Y_substream[SNDRV_PCM_STREAM_CAPTURE]->endpoint = capture_endpoint; | 972 | usX2Y_substream[SNDRV_PCM_STREAM_CAPTURE]->endpoint = capture_endpoint; |
973 | 973 | ||
974 | err = snd_pcm_new(card, NAME_ALLCAPS" Audio", usX2Y(card)->chip.pcm_devs, | 974 | err = snd_pcm_new(card, NAME_ALLCAPS" Audio", usX2Y(card)->pcm_devs, |
975 | playback_endpoint ? 1 : 0, 1, | 975 | playback_endpoint ? 1 : 0, 1, |
976 | &pcm); | 976 | &pcm); |
977 | if (err < 0) { | 977 | if (err < 0) { |
@@ -987,7 +987,7 @@ static int usX2Y_audio_stream_new(struct snd_card *card, int playback_endpoint, | |||
987 | pcm->private_free = snd_usX2Y_pcm_private_free; | 987 | pcm->private_free = snd_usX2Y_pcm_private_free; |
988 | pcm->info_flags = 0; | 988 | pcm->info_flags = 0; |
989 | 989 | ||
990 | sprintf(pcm->name, NAME_ALLCAPS" Audio #%d", usX2Y(card)->chip.pcm_devs); | 990 | sprintf(pcm->name, NAME_ALLCAPS" Audio #%d", usX2Y(card)->pcm_devs); |
991 | 991 | ||
992 | if ((playback_endpoint && | 992 | if ((playback_endpoint && |
993 | 0 > (err = snd_pcm_lib_preallocate_pages(pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream, | 993 | 0 > (err = snd_pcm_lib_preallocate_pages(pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream, |
@@ -1001,7 +1001,7 @@ static int usX2Y_audio_stream_new(struct snd_card *card, int playback_endpoint, | |||
1001 | snd_usX2Y_pcm_private_free(pcm); | 1001 | snd_usX2Y_pcm_private_free(pcm); |
1002 | return err; | 1002 | return err; |
1003 | } | 1003 | } |
1004 | usX2Y(card)->chip.pcm_devs++; | 1004 | usX2Y(card)->pcm_devs++; |
1005 | 1005 | ||
1006 | return 0; | 1006 | return 0; |
1007 | } | 1007 | } |
@@ -1013,14 +1013,14 @@ int usX2Y_audio_create(struct snd_card *card) | |||
1013 | { | 1013 | { |
1014 | int err = 0; | 1014 | int err = 0; |
1015 | 1015 | ||
1016 | INIT_LIST_HEAD(&usX2Y(card)->chip.pcm_list); | 1016 | INIT_LIST_HEAD(&usX2Y(card)->pcm_list); |
1017 | 1017 | ||
1018 | if (0 > (err = usX2Y_audio_stream_new(card, 0xA, 0x8))) | 1018 | if (0 > (err = usX2Y_audio_stream_new(card, 0xA, 0x8))) |
1019 | return err; | 1019 | return err; |
1020 | if (le16_to_cpu(usX2Y(card)->chip.dev->descriptor.idProduct) == USB_ID_US428) | 1020 | if (le16_to_cpu(usX2Y(card)->dev->descriptor.idProduct) == USB_ID_US428) |
1021 | if (0 > (err = usX2Y_audio_stream_new(card, 0, 0xA))) | 1021 | if (0 > (err = usX2Y_audio_stream_new(card, 0, 0xA))) |
1022 | return err; | 1022 | return err; |
1023 | if (le16_to_cpu(usX2Y(card)->chip.dev->descriptor.idProduct) != USB_ID_US122) | 1023 | if (le16_to_cpu(usX2Y(card)->dev->descriptor.idProduct) != USB_ID_US122) |
1024 | err = usX2Y_rate_set(usX2Y(card), 44100); // Lets us428 recognize output-volume settings, disturbs us122. | 1024 | err = usX2Y_rate_set(usX2Y(card), 44100); // Lets us428 recognize output-volume settings, disturbs us122. |
1025 | return err; | 1025 | return err; |
1026 | } | 1026 | } |
diff --git a/sound/usb/usx2y/usx2yhwdeppcm.c b/sound/usb/usx2y/usx2yhwdeppcm.c index 4b2304c2e02d..9ed6c3956ca7 100644 --- a/sound/usb/usx2y/usx2yhwdeppcm.c +++ b/sound/usb/usx2y/usx2yhwdeppcm.c | |||
@@ -234,7 +234,7 @@ static void i_usX2Y_usbpcm_urb_complete(struct urb *urb) | |||
234 | 234 | ||
235 | if (unlikely(atomic_read(&subs->state) < state_PREPARED)) { | 235 | if (unlikely(atomic_read(&subs->state) < state_PREPARED)) { |
236 | snd_printdd("hcd_frame=%i ep=%i%s status=%i start_frame=%i\n", | 236 | snd_printdd("hcd_frame=%i ep=%i%s status=%i start_frame=%i\n", |
237 | usb_get_current_frame_number(usX2Y->chip.dev), | 237 | usb_get_current_frame_number(usX2Y->dev), |
238 | subs->endpoint, usb_pipein(urb->pipe) ? "in" : "out", | 238 | subs->endpoint, usb_pipein(urb->pipe) ? "in" : "out", |
239 | urb->status, urb->start_frame); | 239 | urb->status, urb->start_frame); |
240 | return; | 240 | return; |
@@ -318,7 +318,7 @@ static int usX2Y_usbpcm_urbs_allocate(struct snd_usX2Y_substream *subs) | |||
318 | int i; | 318 | int i; |
319 | unsigned int pipe; | 319 | unsigned int pipe; |
320 | int is_playback = subs == subs->usX2Y->subs[SNDRV_PCM_STREAM_PLAYBACK]; | 320 | int is_playback = subs == subs->usX2Y->subs[SNDRV_PCM_STREAM_PLAYBACK]; |
321 | struct usb_device *dev = subs->usX2Y->chip.dev; | 321 | struct usb_device *dev = subs->usX2Y->dev; |
322 | 322 | ||
323 | pipe = is_playback ? usb_sndisocpipe(dev, subs->endpoint) : | 323 | pipe = is_playback ? usb_sndisocpipe(dev, subs->endpoint) : |
324 | usb_rcvisocpipe(dev, subs->endpoint); | 324 | usb_rcvisocpipe(dev, subs->endpoint); |
@@ -441,7 +441,7 @@ static int usX2Y_usbpcm_urbs_start(struct snd_usX2Y_substream *subs) | |||
441 | unsigned long pack; | 441 | unsigned long pack; |
442 | if (0 == u) | 442 | if (0 == u) |
443 | atomic_set(&subs->state, state_STARTING3); | 443 | atomic_set(&subs->state, state_STARTING3); |
444 | urb->dev = usX2Y->chip.dev; | 444 | urb->dev = usX2Y->dev; |
445 | urb->transfer_flags = URB_ISO_ASAP; | 445 | urb->transfer_flags = URB_ISO_ASAP; |
446 | for (pack = 0; pack < nr_of_packs(); pack++) { | 446 | for (pack = 0; pack < nr_of_packs(); pack++) { |
447 | urb->iso_frame_desc[pack].offset = subs->maxpacksize * (pack + u * nr_of_packs()); | 447 | urb->iso_frame_desc[pack].offset = subs->maxpacksize * (pack + u * nr_of_packs()); |
@@ -741,7 +741,7 @@ int usX2Y_hwdep_pcm_new(struct snd_card *card) | |||
741 | int err; | 741 | int err; |
742 | struct snd_hwdep *hw; | 742 | struct snd_hwdep *hw; |
743 | struct snd_pcm *pcm; | 743 | struct snd_pcm *pcm; |
744 | struct usb_device *dev = usX2Y(card)->chip.dev; | 744 | struct usb_device *dev = usX2Y(card)->dev; |
745 | if (1 != nr_of_packs()) | 745 | if (1 != nr_of_packs()) |
746 | return 0; | 746 | return 0; |
747 | 747 | ||