| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: uaudio.c,v 1.140.2.15 2016/03/23 22:11:20 skrll Exp $ */ | | 1 | /* $NetBSD: uaudio.c,v 1.140.2.16 2016/03/23 22:18:30 skrll Exp $ */ |
2 | | | 2 | |
3 | /* | | 3 | /* |
4 | * Copyright (c) 1999, 2012 The NetBSD Foundation, Inc. | | 4 | * Copyright (c) 1999, 2012 The NetBSD Foundation, Inc. |
5 | * All rights reserved. | | 5 | * All rights reserved. |
6 | * | | 6 | * |
7 | * This code is derived from software contributed to The NetBSD Foundation | | 7 | * This code is derived from software contributed to The NetBSD Foundation |
8 | * by Lennart Augustsson (lennart@augustsson.net) at | | 8 | * by Lennart Augustsson (lennart@augustsson.net) at |
9 | * Carlstedt Research & Technology, and Matthew R. Green (mrg@eterna.com.au). | | 9 | * Carlstedt Research & Technology, and Matthew R. Green (mrg@eterna.com.au). |
10 | * | | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | | 11 | * Redistribution and use in source and binary forms, with or without |
12 | * modification, are permitted provided that the following conditions | | 12 | * modification, are permitted provided that the following conditions |
13 | * are met: | | 13 | * are met: |
14 | * 1. Redistributions of source code must retain the above copyright | | 14 | * 1. Redistributions of source code must retain the above copyright |
| @@ -27,27 +27,27 @@ | | | @@ -27,27 +27,27 @@ |
27 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | | 27 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
28 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | | 28 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
29 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | | 29 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
30 | * POSSIBILITY OF SUCH DAMAGE. | | 30 | * POSSIBILITY OF SUCH DAMAGE. |
31 | */ | | 31 | */ |
32 | | | 32 | |
33 | /* | | 33 | /* |
34 | * USB audio specs: http://www.usb.org/developers/docs/devclass_docs/audio10.pdf | | 34 | * USB audio specs: http://www.usb.org/developers/docs/devclass_docs/audio10.pdf |
35 | * http://www.usb.org/developers/docs/devclass_docs/frmts10.pdf | | 35 | * http://www.usb.org/developers/docs/devclass_docs/frmts10.pdf |
36 | * http://www.usb.org/developers/docs/devclass_docs/termt10.pdf | | 36 | * http://www.usb.org/developers/docs/devclass_docs/termt10.pdf |
37 | */ | | 37 | */ |
38 | | | 38 | |
39 | #include <sys/cdefs.h> | | 39 | #include <sys/cdefs.h> |
40 | __KERNEL_RCSID(0, "$NetBSD: uaudio.c,v 1.140.2.15 2016/03/23 22:11:20 skrll Exp $"); | | 40 | __KERNEL_RCSID(0, "$NetBSD: uaudio.c,v 1.140.2.16 2016/03/23 22:18:30 skrll Exp $"); |
41 | | | 41 | |
42 | #ifdef _KERNEL_OPT | | 42 | #ifdef _KERNEL_OPT |
43 | #include "opt_usb.h" | | 43 | #include "opt_usb.h" |
44 | #endif | | 44 | #endif |
45 | | | 45 | |
46 | #include <sys/param.h> | | 46 | #include <sys/param.h> |
47 | #include <sys/systm.h> | | 47 | #include <sys/systm.h> |
48 | #include <sys/kernel.h> | | 48 | #include <sys/kernel.h> |
49 | #include <sys/malloc.h> | | 49 | #include <sys/malloc.h> |
50 | #include <sys/device.h> | | 50 | #include <sys/device.h> |
51 | #include <sys/ioctl.h> | | 51 | #include <sys/ioctl.h> |
52 | #include <sys/file.h> | | 52 | #include <sys/file.h> |
53 | #include <sys/reboot.h> /* for bootverbose */ | | 53 | #include <sys/reboot.h> /* for bootverbose */ |
| @@ -2658,27 +2658,28 @@ uaudio_trigger_output(void *addr, void * | | | @@ -2658,27 +2658,28 @@ uaudio_trigger_output(void *addr, void * |
2658 | return EIO; | | 2658 | return EIO; |
2659 | } | | 2659 | } |
2660 | | | 2660 | |
2661 | err = uaudio_chan_alloc_buffers(sc, ch); | | 2661 | err = uaudio_chan_alloc_buffers(sc, ch); |
2662 | if (err) { | | 2662 | if (err) { |
2663 | uaudio_chan_close(sc, ch); | | 2663 | uaudio_chan_close(sc, ch); |
2664 | mutex_enter(&sc->sc_intr_lock); | | 2664 | mutex_enter(&sc->sc_intr_lock); |
2665 | return EIO; | | 2665 | return EIO; |
2666 | } | | 2666 | } |
2667 | | | 2667 | |
2668 | ch->intr = intr; | | 2668 | ch->intr = intr; |
2669 | ch->arg = arg; | | 2669 | ch->arg = arg; |
2670 | | | 2670 | |
2671 | for (i = 0; i < UAUDIO_NCHANBUFS-1; i++) /* XXX */ | | 2671 | /* XXX -1 shouldn't be needed */ |
| | | 2672 | for (i = 0; i < UAUDIO_NCHANBUFS - 1; i++) |
2672 | uaudio_chan_ptransfer(ch); | | 2673 | uaudio_chan_ptransfer(ch); |
2673 | mutex_enter(&sc->sc_intr_lock); | | 2674 | mutex_enter(&sc->sc_intr_lock); |
2674 | | | 2675 | |
2675 | return 0; | | 2676 | return 0; |
2676 | } | | 2677 | } |
2677 | | | 2678 | |
2678 | /* Set up a pipe for a channel. */ | | 2679 | /* Set up a pipe for a channel. */ |
2679 | Static usbd_status | | 2680 | Static usbd_status |
2680 | uaudio_chan_open(struct uaudio_softc *sc, struct chan *ch) | | 2681 | uaudio_chan_open(struct uaudio_softc *sc, struct chan *ch) |
2681 | { | | 2682 | { |
2682 | struct as_info *as; | | 2683 | struct as_info *as; |
2683 | usb_device_descriptor_t *ddesc; | | 2684 | usb_device_descriptor_t *ddesc; |
2684 | int endpt; | | 2685 | int endpt; |