| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: audio.c,v 1.243 2008/06/10 22:53:08 cegger Exp $ */ | | 1 | /* $NetBSD: audio.c,v 1.243.6.1 2009/09/29 22:46:56 snj Exp $ */ |
2 | | | 2 | |
3 | /* | | 3 | /* |
4 | * Copyright (c) 1991-1993 Regents of the University of California. | | 4 | * Copyright (c) 1991-1993 Regents of the University of California. |
5 | * All rights reserved. | | 5 | * All rights reserved. |
6 | * | | 6 | * |
7 | * Redistribution and use in source and binary forms, with or without | | 7 | * Redistribution and use in source and binary forms, with or without |
8 | * modification, are permitted provided that the following conditions | | 8 | * modification, are permitted provided that the following conditions |
9 | * are met: | | 9 | * are met: |
10 | * 1. Redistributions of source code must retain the above copyright | | 10 | * 1. Redistributions of source code must retain the above copyright |
11 | * notice, this list of conditions and the following disclaimer. | | 11 | * notice, this list of conditions and the following disclaimer. |
12 | * 2. Redistributions in binary form must reproduce the above copyright | | 12 | * 2. Redistributions in binary form must reproduce the above copyright |
13 | * notice, this list of conditions and the following disclaimer in the | | 13 | * notice, this list of conditions and the following disclaimer in the |
14 | * documentation and/or other materials provided with the distribution. | | 14 | * documentation and/or other materials provided with the distribution. |
| @@ -51,27 +51,27 @@ | | | @@ -51,27 +51,27 @@ |
51 | * generated. | | 51 | * generated. |
52 | * | | 52 | * |
53 | * If you try to set both play and record mode on a half-duplex | | 53 | * If you try to set both play and record mode on a half-duplex |
54 | * device, playing takes precedence. | | 54 | * device, playing takes precedence. |
55 | */ | | 55 | */ |
56 | | | 56 | |
57 | /* | | 57 | /* |
58 | * Todo: | | 58 | * Todo: |
59 | * - Add softaudio() isr processing for wakeup, poll, signals, | | 59 | * - Add softaudio() isr processing for wakeup, poll, signals, |
60 | * and silence fill. | | 60 | * and silence fill. |
61 | */ | | 61 | */ |
62 | | | 62 | |
63 | #include <sys/cdefs.h> | | 63 | #include <sys/cdefs.h> |
64 | __KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.243 2008/06/10 22:53:08 cegger Exp $"); | | 64 | __KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.243.6.1 2009/09/29 22:46:56 snj Exp $"); |
65 | | | 65 | |
66 | #include "audio.h" | | 66 | #include "audio.h" |
67 | #if NAUDIO > 0 | | 67 | #if NAUDIO > 0 |
68 | | | 68 | |
69 | #include <sys/param.h> | | 69 | #include <sys/param.h> |
70 | #include <sys/ioctl.h> | | 70 | #include <sys/ioctl.h> |
71 | #include <sys/fcntl.h> | | 71 | #include <sys/fcntl.h> |
72 | #include <sys/vnode.h> | | 72 | #include <sys/vnode.h> |
73 | #include <sys/select.h> | | 73 | #include <sys/select.h> |
74 | #include <sys/poll.h> | | 74 | #include <sys/poll.h> |
75 | #include <sys/malloc.h> | | 75 | #include <sys/malloc.h> |
76 | #include <sys/proc.h> | | 76 | #include <sys/proc.h> |
77 | #include <sys/systm.h> | | 77 | #include <sys/systm.h> |
| @@ -1139,26 +1139,32 @@ audioioctl(dev_t dev, u_long cmd, void * | | | @@ -1139,26 +1139,32 @@ audioioctl(dev_t dev, u_long cmd, void * |
1139 | int error; | | 1139 | int error; |
1140 | | | 1140 | |
1141 | sc = device_lookup_private(&audio_cd, AUDIOUNIT(dev)); | | 1141 | sc = device_lookup_private(&audio_cd, AUDIOUNIT(dev)); |
1142 | if (sc->sc_dying) | | 1142 | if (sc->sc_dying) |
1143 | return EIO; | | 1143 | return EIO; |
1144 | | | 1144 | |
1145 | sc->sc_refcnt++; | | 1145 | sc->sc_refcnt++; |
1146 | switch (AUDIODEV(dev)) { | | 1146 | switch (AUDIODEV(dev)) { |
1147 | case SOUND_DEVICE: | | 1147 | case SOUND_DEVICE: |
1148 | case AUDIO_DEVICE: | | 1148 | case AUDIO_DEVICE: |
1149 | case AUDIOCTL_DEVICE: | | 1149 | case AUDIOCTL_DEVICE: |
1150 | device_active(sc->dev, DVA_SYSTEM); | | 1150 | device_active(sc->dev, DVA_SYSTEM); |
1151 | error = audio_ioctl(sc, cmd, addr, flag, l); | | 1151 | error = audio_ioctl(sc, cmd, addr, flag, l); |
| | | 1152 | /* |
| | | 1153 | * OSS audio allows mixer operations on sound devices |
| | | 1154 | * so pass through if command isn't a valid audio operation |
| | | 1155 | */ |
| | | 1156 | if (error == EINVAL) |
| | | 1157 | error = mixer_ioctl(sc, cmd, addr, flag, l); |
1152 | break; | | 1158 | break; |
1153 | case MIXER_DEVICE: | | 1159 | case MIXER_DEVICE: |
1154 | error = mixer_ioctl(sc, cmd, addr, flag, l); | | 1160 | error = mixer_ioctl(sc, cmd, addr, flag, l); |
1155 | break; | | 1161 | break; |
1156 | default: | | 1162 | default: |
1157 | error = ENXIO; | | 1163 | error = ENXIO; |
1158 | break; | | 1164 | break; |
1159 | } | | 1165 | } |
1160 | if (--sc->sc_refcnt < 0) | | 1166 | if (--sc->sc_refcnt < 0) |
1161 | wakeup(&sc->sc_refcnt); | | 1167 | wakeup(&sc->sc_refcnt); |
1162 | return error; | | 1168 | return error; |
1163 | } | | 1169 | } |
1164 | | | 1170 | |