diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2010-10-25 11:32:05 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-10-25 11:32:05 -0400 |
commit | 33081adf8b89d5a716d7e1c60171768d39795b39 (patch) | |
tree | 275de58bbbb5f7ddffcdc087844cfc7fbe4315be /sound/oss | |
parent | c55960499f810357a29659b32d6ea594abee9237 (diff) | |
parent | 506ecbca71d07fa327dd986be1682e90885678ee (diff) |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6: (365 commits)
ALSA: hda - Disable sticky PCM stream assignment for AD codecs
ALSA: usb - Creative USB X-Fi volume knob support
ALSA: ca0106: Use card specific dac id for mute controls.
ALSA: ca0106: Allow different sound cards to use different SPI channel mappings.
ALSA: ca0106: Create a nice spot for mapping channels to dacs.
ALSA: ca0106: Move enabling of front dac out of hardcoded setup sequence.
ALSA: ca0106: Pull out dac powering routine into separate function.
ALSA: ca0106 - add Sound Blaster 5.1vx info.
ASoC: tlv320dac33: Use usleep_range for delays
ALSA: usb-audio: add Novation Launchpad support
ALSA: hda - Add workarounds for CT-IBG controllers
ALSA: hda - Fix wrong TLV mute bit for STAC/IDT codecs
ASoC: tpa6130a2: Error handling for broken chip
ASoC: max98088: Staticise m98088_eq_band
ASoC: soc-core: Fix codec->name memory leak
ALSA: hda - Apply ideapad quirk to Acer laptops with Cxt5066
ALSA: hda - Add some workarounds for Creative IBG
ALSA: hda - Fix wrong SPDIF NID assignment for CA0110
ALSA: hda - Fix codec rename rules for ALC662-compatible codecs
ALSA: hda - Add alc_init_jacks() call to other codecs
...
Diffstat (limited to 'sound/oss')
-rw-r--r-- | sound/oss/Kconfig | 8 | ||||
-rw-r--r-- | sound/oss/Makefile | 1 | ||||
-rw-r--r-- | sound/oss/au1550_ac97.c | 48 | ||||
-rw-r--r-- | sound/oss/dmasound/dmasound_core.c | 41 | ||||
-rw-r--r-- | sound/oss/msnd_pinnacle.c | 15 | ||||
-rw-r--r-- | sound/oss/sh_dac_audio.c | 325 | ||||
-rw-r--r-- | sound/oss/soundcard.c | 43 | ||||
-rw-r--r-- | sound/oss/swarm_cs4297a.c | 20 | ||||
-rw-r--r-- | sound/oss/vwsnd.c | 30 |
9 files changed, 100 insertions, 431 deletions
diff --git a/sound/oss/Kconfig b/sound/oss/Kconfig index a513651fa14..76c09021807 100644 --- a/sound/oss/Kconfig +++ b/sound/oss/Kconfig | |||
@@ -545,11 +545,3 @@ config SOUND_KAHLUA | |||
545 | 545 | ||
546 | endif # SOUND_OSS | 546 | endif # SOUND_OSS |
547 | 547 | ||
548 | config SOUND_SH_DAC_AUDIO | ||
549 | tristate "SuperH DAC audio support" | ||
550 | depends on CPU_SH3 && HIGH_RES_TIMERS | ||
551 | |||
552 | config SOUND_SH_DAC_AUDIO_CHANNEL | ||
553 | int "DAC channel" | ||
554 | default "1" | ||
555 | depends on SOUND_SH_DAC_AUDIO | ||
diff --git a/sound/oss/Makefile b/sound/oss/Makefile index 567b8a74178..96f14dcd0cd 100644 --- a/sound/oss/Makefile +++ b/sound/oss/Makefile | |||
@@ -9,7 +9,6 @@ obj-$(CONFIG_SOUND_OSS) += sound.o | |||
9 | 9 | ||
10 | # Please leave it as is, cause the link order is significant ! | 10 | # Please leave it as is, cause the link order is significant ! |
11 | 11 | ||
12 | obj-$(CONFIG_SOUND_SH_DAC_AUDIO) += sh_dac_audio.o | ||
13 | obj-$(CONFIG_SOUND_AEDSP16) += aedsp16.o | 12 | obj-$(CONFIG_SOUND_AEDSP16) += aedsp16.o |
14 | obj-$(CONFIG_SOUND_PSS) += pss.o ad1848.o mpu401.o | 13 | obj-$(CONFIG_SOUND_PSS) += pss.o ad1848.o mpu401.o |
15 | obj-$(CONFIG_SOUND_TRIX) += trix.o ad1848.o sb_lib.o uart401.o | 14 | obj-$(CONFIG_SOUND_TRIX) += trix.o ad1848.o sb_lib.o uart401.o |
diff --git a/sound/oss/au1550_ac97.c b/sound/oss/au1550_ac97.c index c6f2621221b..a8f626d99c5 100644 --- a/sound/oss/au1550_ac97.c +++ b/sound/oss/au1550_ac97.c | |||
@@ -43,7 +43,6 @@ | |||
43 | #include <linux/sound.h> | 43 | #include <linux/sound.h> |
44 | #include <linux/slab.h> | 44 | #include <linux/slab.h> |
45 | #include <linux/soundcard.h> | 45 | #include <linux/soundcard.h> |
46 | #include <linux/smp_lock.h> | ||
47 | #include <linux/init.h> | 46 | #include <linux/init.h> |
48 | #include <linux/interrupt.h> | 47 | #include <linux/interrupt.h> |
49 | #include <linux/kernel.h> | 48 | #include <linux/kernel.h> |
@@ -77,6 +76,7 @@ | |||
77 | /* Boot options | 76 | /* Boot options |
78 | * 0 = no VRA, 1 = use VRA if codec supports it | 77 | * 0 = no VRA, 1 = use VRA if codec supports it |
79 | */ | 78 | */ |
79 | static DEFINE_MUTEX(au1550_ac97_mutex); | ||
80 | static int vra = 1; | 80 | static int vra = 1; |
81 | module_param(vra, bool, 0); | 81 | module_param(vra, bool, 0); |
82 | MODULE_PARM_DESC(vra, "if 1 use VRA if codec supports it"); | 82 | MODULE_PARM_DESC(vra, "if 1 use VRA if codec supports it"); |
@@ -171,7 +171,7 @@ au1550_delay(int msec) | |||
171 | static u16 | 171 | static u16 |
172 | rdcodec(struct ac97_codec *codec, u8 addr) | 172 | rdcodec(struct ac97_codec *codec, u8 addr) |
173 | { | 173 | { |
174 | struct au1550_state *s = (struct au1550_state *)codec->private_data; | 174 | struct au1550_state *s = codec->private_data; |
175 | unsigned long flags; | 175 | unsigned long flags; |
176 | u32 cmd, val; | 176 | u32 cmd, val; |
177 | u16 data; | 177 | u16 data; |
@@ -239,7 +239,7 @@ rdcodec(struct ac97_codec *codec, u8 addr) | |||
239 | static void | 239 | static void |
240 | wrcodec(struct ac97_codec *codec, u8 addr, u16 data) | 240 | wrcodec(struct ac97_codec *codec, u8 addr, u16 data) |
241 | { | 241 | { |
242 | struct au1550_state *s = (struct au1550_state *)codec->private_data; | 242 | struct au1550_state *s = codec->private_data; |
243 | unsigned long flags; | 243 | unsigned long flags; |
244 | u32 cmd, val; | 244 | u32 cmd, val; |
245 | int i; | 245 | int i; |
@@ -798,9 +798,9 @@ au1550_llseek(struct file *file, loff_t offset, int origin) | |||
798 | static int | 798 | static int |
799 | au1550_open_mixdev(struct inode *inode, struct file *file) | 799 | au1550_open_mixdev(struct inode *inode, struct file *file) |
800 | { | 800 | { |
801 | lock_kernel(); | 801 | mutex_lock(&au1550_ac97_mutex); |
802 | file->private_data = &au1550_state; | 802 | file->private_data = &au1550_state; |
803 | unlock_kernel(); | 803 | mutex_unlock(&au1550_ac97_mutex); |
804 | return 0; | 804 | return 0; |
805 | } | 805 | } |
806 | 806 | ||
@@ -820,13 +820,13 @@ mixdev_ioctl(struct ac97_codec *codec, unsigned int cmd, | |||
820 | static long | 820 | static long |
821 | au1550_ioctl_mixdev(struct file *file, unsigned int cmd, unsigned long arg) | 821 | au1550_ioctl_mixdev(struct file *file, unsigned int cmd, unsigned long arg) |
822 | { | 822 | { |
823 | struct au1550_state *s = (struct au1550_state *)file->private_data; | 823 | struct au1550_state *s = file->private_data; |
824 | struct ac97_codec *codec = s->codec; | 824 | struct ac97_codec *codec = s->codec; |
825 | int ret; | 825 | int ret; |
826 | 826 | ||
827 | lock_kernel(); | 827 | mutex_lock(&au1550_ac97_mutex); |
828 | ret = mixdev_ioctl(codec, cmd, arg); | 828 | ret = mixdev_ioctl(codec, cmd, arg); |
829 | unlock_kernel(); | 829 | mutex_unlock(&au1550_ac97_mutex); |
830 | 830 | ||
831 | return ret; | 831 | return ret; |
832 | } | 832 | } |
@@ -1031,7 +1031,7 @@ copy_dmabuf_user(struct dmabuf *db, char* userbuf, int count, int to_user) | |||
1031 | static ssize_t | 1031 | static ssize_t |
1032 | au1550_read(struct file *file, char *buffer, size_t count, loff_t *ppos) | 1032 | au1550_read(struct file *file, char *buffer, size_t count, loff_t *ppos) |
1033 | { | 1033 | { |
1034 | struct au1550_state *s = (struct au1550_state *)file->private_data; | 1034 | struct au1550_state *s = file->private_data; |
1035 | struct dmabuf *db = &s->dma_adc; | 1035 | struct dmabuf *db = &s->dma_adc; |
1036 | DECLARE_WAITQUEUE(wait, current); | 1036 | DECLARE_WAITQUEUE(wait, current); |
1037 | ssize_t ret; | 1037 | ssize_t ret; |
@@ -1111,7 +1111,7 @@ out2: | |||
1111 | static ssize_t | 1111 | static ssize_t |
1112 | au1550_write(struct file *file, const char *buffer, size_t count, loff_t * ppos) | 1112 | au1550_write(struct file *file, const char *buffer, size_t count, loff_t * ppos) |
1113 | { | 1113 | { |
1114 | struct au1550_state *s = (struct au1550_state *)file->private_data; | 1114 | struct au1550_state *s = file->private_data; |
1115 | struct dmabuf *db = &s->dma_dac; | 1115 | struct dmabuf *db = &s->dma_dac; |
1116 | DECLARE_WAITQUEUE(wait, current); | 1116 | DECLARE_WAITQUEUE(wait, current); |
1117 | ssize_t ret = 0; | 1117 | ssize_t ret = 0; |
@@ -1211,7 +1211,7 @@ out2: | |||
1211 | static unsigned int | 1211 | static unsigned int |
1212 | au1550_poll(struct file *file, struct poll_table_struct *wait) | 1212 | au1550_poll(struct file *file, struct poll_table_struct *wait) |
1213 | { | 1213 | { |
1214 | struct au1550_state *s = (struct au1550_state *)file->private_data; | 1214 | struct au1550_state *s = file->private_data; |
1215 | unsigned long flags; | 1215 | unsigned long flags; |
1216 | unsigned int mask = 0; | 1216 | unsigned int mask = 0; |
1217 | 1217 | ||
@@ -1250,12 +1250,12 @@ au1550_poll(struct file *file, struct poll_table_struct *wait) | |||
1250 | static int | 1250 | static int |
1251 | au1550_mmap(struct file *file, struct vm_area_struct *vma) | 1251 | au1550_mmap(struct file *file, struct vm_area_struct *vma) |
1252 | { | 1252 | { |
1253 | struct au1550_state *s = (struct au1550_state *)file->private_data; | 1253 | struct au1550_state *s = file->private_data; |
1254 | struct dmabuf *db; | 1254 | struct dmabuf *db; |
1255 | unsigned long size; | 1255 | unsigned long size; |
1256 | int ret = 0; | 1256 | int ret = 0; |
1257 | 1257 | ||
1258 | lock_kernel(); | 1258 | mutex_lock(&au1550_ac97_mutex); |
1259 | mutex_lock(&s->sem); | 1259 | mutex_lock(&s->sem); |
1260 | if (vma->vm_flags & VM_WRITE) | 1260 | if (vma->vm_flags & VM_WRITE) |
1261 | db = &s->dma_dac; | 1261 | db = &s->dma_dac; |
@@ -1283,7 +1283,7 @@ au1550_mmap(struct file *file, struct vm_area_struct *vma) | |||
1283 | db->mapped = 1; | 1283 | db->mapped = 1; |
1284 | out: | 1284 | out: |
1285 | mutex_unlock(&s->sem); | 1285 | mutex_unlock(&s->sem); |
1286 | unlock_kernel(); | 1286 | mutex_unlock(&au1550_ac97_mutex); |
1287 | return ret; | 1287 | return ret; |
1288 | } | 1288 | } |
1289 | 1289 | ||
@@ -1342,7 +1342,7 @@ dma_count_done(struct dmabuf *db) | |||
1342 | static int | 1342 | static int |
1343 | au1550_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | 1343 | au1550_ioctl(struct file *file, unsigned int cmd, unsigned long arg) |
1344 | { | 1344 | { |
1345 | struct au1550_state *s = (struct au1550_state *)file->private_data; | 1345 | struct au1550_state *s = file->private_data; |
1346 | unsigned long flags; | 1346 | unsigned long flags; |
1347 | audio_buf_info abinfo; | 1347 | audio_buf_info abinfo; |
1348 | count_info cinfo; | 1348 | count_info cinfo; |
@@ -1781,9 +1781,9 @@ au1550_unlocked_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | |||
1781 | { | 1781 | { |
1782 | int ret; | 1782 | int ret; |
1783 | 1783 | ||
1784 | lock_kernel(); | 1784 | mutex_lock(&au1550_ac97_mutex); |
1785 | ret = au1550_ioctl(file, cmd, arg); | 1785 | ret = au1550_ioctl(file, cmd, arg); |
1786 | unlock_kernel(); | 1786 | mutex_unlock(&au1550_ac97_mutex); |
1787 | 1787 | ||
1788 | return ret; | 1788 | return ret; |
1789 | } | 1789 | } |
@@ -1804,7 +1804,7 @@ au1550_open(struct inode *inode, struct file *file) | |||
1804 | #endif | 1804 | #endif |
1805 | 1805 | ||
1806 | file->private_data = s; | 1806 | file->private_data = s; |
1807 | lock_kernel(); | 1807 | mutex_lock(&au1550_ac97_mutex); |
1808 | /* wait for device to become free */ | 1808 | /* wait for device to become free */ |
1809 | mutex_lock(&s->open_mutex); | 1809 | mutex_lock(&s->open_mutex); |
1810 | while (s->open_mode & file->f_mode) { | 1810 | while (s->open_mode & file->f_mode) { |
@@ -1861,21 +1861,21 @@ au1550_open(struct inode *inode, struct file *file) | |||
1861 | out: | 1861 | out: |
1862 | mutex_unlock(&s->open_mutex); | 1862 | mutex_unlock(&s->open_mutex); |
1863 | out2: | 1863 | out2: |
1864 | unlock_kernel(); | 1864 | mutex_unlock(&au1550_ac97_mutex); |
1865 | return ret; | 1865 | return ret; |
1866 | } | 1866 | } |
1867 | 1867 | ||
1868 | static int | 1868 | static int |
1869 | au1550_release(struct inode *inode, struct file *file) | 1869 | au1550_release(struct inode *inode, struct file *file) |
1870 | { | 1870 | { |
1871 | struct au1550_state *s = (struct au1550_state *)file->private_data; | 1871 | struct au1550_state *s = file->private_data; |
1872 | 1872 | ||
1873 | lock_kernel(); | 1873 | mutex_lock(&au1550_ac97_mutex); |
1874 | 1874 | ||
1875 | if (file->f_mode & FMODE_WRITE) { | 1875 | if (file->f_mode & FMODE_WRITE) { |
1876 | unlock_kernel(); | 1876 | mutex_unlock(&au1550_ac97_mutex); |
1877 | drain_dac(s, file->f_flags & O_NONBLOCK); | 1877 | drain_dac(s, file->f_flags & O_NONBLOCK); |
1878 | lock_kernel(); | 1878 | mutex_lock(&au1550_ac97_mutex); |
1879 | } | 1879 | } |
1880 | 1880 | ||
1881 | mutex_lock(&s->open_mutex); | 1881 | mutex_lock(&s->open_mutex); |
@@ -1892,7 +1892,7 @@ au1550_release(struct inode *inode, struct file *file) | |||
1892 | s->open_mode &= ((~file->f_mode) & (FMODE_READ|FMODE_WRITE)); | 1892 | s->open_mode &= ((~file->f_mode) & (FMODE_READ|FMODE_WRITE)); |
1893 | mutex_unlock(&s->open_mutex); | 1893 | mutex_unlock(&s->open_mutex); |
1894 | wake_up(&s->open_wait); | 1894 | wake_up(&s->open_wait); |
1895 | unlock_kernel(); | 1895 | mutex_unlock(&au1550_ac97_mutex); |
1896 | return 0; | 1896 | return 0; |
1897 | } | 1897 | } |
1898 | 1898 | ||
diff --git a/sound/oss/dmasound/dmasound_core.c b/sound/oss/dmasound/dmasound_core.c index 6ecd41abb06..87e2c72651f 100644 --- a/sound/oss/dmasound/dmasound_core.c +++ b/sound/oss/dmasound/dmasound_core.c | |||
@@ -181,7 +181,7 @@ | |||
181 | #include <linux/init.h> | 181 | #include <linux/init.h> |
182 | #include <linux/soundcard.h> | 182 | #include <linux/soundcard.h> |
183 | #include <linux/poll.h> | 183 | #include <linux/poll.h> |
184 | #include <linux/smp_lock.h> | 184 | #include <linux/mutex.h> |
185 | 185 | ||
186 | #include <asm/uaccess.h> | 186 | #include <asm/uaccess.h> |
187 | 187 | ||
@@ -194,6 +194,7 @@ | |||
194 | * Declarations | 194 | * Declarations |
195 | */ | 195 | */ |
196 | 196 | ||
197 | static DEFINE_MUTEX(dmasound_core_mutex); | ||
197 | int dmasound_catchRadius = 0; | 198 | int dmasound_catchRadius = 0; |
198 | module_param(dmasound_catchRadius, int, 0); | 199 | module_param(dmasound_catchRadius, int, 0); |
199 | 200 | ||
@@ -323,22 +324,22 @@ static struct { | |||
323 | 324 | ||
324 | static int mixer_open(struct inode *inode, struct file *file) | 325 | static int mixer_open(struct inode *inode, struct file *file) |
325 | { | 326 | { |
326 | lock_kernel(); | 327 | mutex_lock(&dmasound_core_mutex); |
327 | if (!try_module_get(dmasound.mach.owner)) { | 328 | if (!try_module_get(dmasound.mach.owner)) { |
328 | unlock_kernel(); | 329 | mutex_unlock(&dmasound_core_mutex); |
329 | return -ENODEV; | 330 | return -ENODEV; |
330 | } | 331 | } |
331 | mixer.busy = 1; | 332 | mixer.busy = 1; |
332 | unlock_kernel(); | 333 | mutex_unlock(&dmasound_core_mutex); |
333 | return 0; | 334 | return 0; |
334 | } | 335 | } |
335 | 336 | ||
336 | static int mixer_release(struct inode *inode, struct file *file) | 337 | static int mixer_release(struct inode *inode, struct file *file) |
337 | { | 338 | { |
338 | lock_kernel(); | 339 | mutex_lock(&dmasound_core_mutex); |
339 | mixer.busy = 0; | 340 | mixer.busy = 0; |
340 | module_put(dmasound.mach.owner); | 341 | module_put(dmasound.mach.owner); |
341 | unlock_kernel(); | 342 | mutex_unlock(&dmasound_core_mutex); |
342 | return 0; | 343 | return 0; |
343 | } | 344 | } |
344 | 345 | ||
@@ -370,9 +371,9 @@ static long mixer_unlocked_ioctl(struct file *file, u_int cmd, u_long arg) | |||
370 | { | 371 | { |
371 | int ret; | 372 | int ret; |
372 | 373 | ||
373 | lock_kernel(); | 374 | mutex_lock(&dmasound_core_mutex); |
374 | ret = mixer_ioctl(file, cmd, arg); | 375 | ret = mixer_ioctl(file, cmd, arg); |
375 | unlock_kernel(); | 376 | mutex_unlock(&dmasound_core_mutex); |
376 | 377 | ||
377 | return ret; | 378 | return ret; |
378 | } | 379 | } |
@@ -752,9 +753,9 @@ static int sq_open(struct inode *inode, struct file *file) | |||
752 | { | 753 | { |
753 | int rc; | 754 | int rc; |
754 | 755 | ||
755 | lock_kernel(); | 756 | mutex_lock(&dmasound_core_mutex); |
756 | if (!try_module_get(dmasound.mach.owner)) { | 757 | if (!try_module_get(dmasound.mach.owner)) { |
757 | unlock_kernel(); | 758 | mutex_unlock(&dmasound_core_mutex); |
758 | return -ENODEV; | 759 | return -ENODEV; |
759 | } | 760 | } |
760 | 761 | ||
@@ -799,11 +800,11 @@ static int sq_open(struct inode *inode, struct file *file) | |||
799 | sound_set_format(AFMT_MU_LAW); | 800 | sound_set_format(AFMT_MU_LAW); |
800 | } | 801 | } |
801 | #endif | 802 | #endif |
802 | unlock_kernel(); | 803 | mutex_unlock(&dmasound_core_mutex); |
803 | return 0; | 804 | return 0; |
804 | out: | 805 | out: |
805 | module_put(dmasound.mach.owner); | 806 | module_put(dmasound.mach.owner); |
806 | unlock_kernel(); | 807 | mutex_unlock(&dmasound_core_mutex); |
807 | return rc; | 808 | return rc; |
808 | } | 809 | } |
809 | 810 | ||
@@ -869,7 +870,7 @@ static int sq_release(struct inode *inode, struct file *file) | |||
869 | { | 870 | { |
870 | int rc = 0; | 871 | int rc = 0; |
871 | 872 | ||
872 | lock_kernel(); | 873 | mutex_lock(&dmasound_core_mutex); |
873 | 874 | ||
874 | if (file->f_mode & FMODE_WRITE) { | 875 | if (file->f_mode & FMODE_WRITE) { |
875 | if (write_sq.busy) | 876 | if (write_sq.busy) |
@@ -900,7 +901,7 @@ static int sq_release(struct inode *inode, struct file *file) | |||
900 | write_sq_wake_up(file); /* checks f_mode */ | 901 | write_sq_wake_up(file); /* checks f_mode */ |
901 | #endif /* blocking open() */ | 902 | #endif /* blocking open() */ |
902 | 903 | ||
903 | unlock_kernel(); | 904 | mutex_unlock(&dmasound_core_mutex); |
904 | 905 | ||
905 | return rc; | 906 | return rc; |
906 | } | 907 | } |
@@ -1141,9 +1142,9 @@ static long sq_unlocked_ioctl(struct file *file, u_int cmd, u_long arg) | |||
1141 | { | 1142 | { |
1142 | int ret; | 1143 | int ret; |
1143 | 1144 | ||
1144 | lock_kernel(); | 1145 | mutex_lock(&dmasound_core_mutex); |
1145 | ret = sq_ioctl(file, cmd, arg); | 1146 | ret = sq_ioctl(file, cmd, arg); |
1146 | unlock_kernel(); | 1147 | mutex_unlock(&dmasound_core_mutex); |
1147 | 1148 | ||
1148 | return ret; | 1149 | return ret; |
1149 | } | 1150 | } |
@@ -1257,7 +1258,7 @@ static int state_open(struct inode *inode, struct file *file) | |||
1257 | int len = 0; | 1258 | int len = 0; |
1258 | int ret; | 1259 | int ret; |
1259 | 1260 | ||
1260 | lock_kernel(); | 1261 | mutex_lock(&dmasound_core_mutex); |
1261 | ret = -EBUSY; | 1262 | ret = -EBUSY; |
1262 | if (state.busy) | 1263 | if (state.busy) |
1263 | goto out; | 1264 | goto out; |
@@ -1329,16 +1330,16 @@ printk("dmasound: stat buffer used %d bytes\n", len) ; | |||
1329 | state.len = len; | 1330 | state.len = len; |
1330 | ret = 0; | 1331 | ret = 0; |
1331 | out: | 1332 | out: |
1332 | unlock_kernel(); | 1333 | mutex_unlock(&dmasound_core_mutex); |
1333 | return ret; | 1334 | return ret; |
1334 | } | 1335 | } |
1335 | 1336 | ||
1336 | static int state_release(struct inode *inode, struct file *file) | 1337 | static int state_release(struct inode *inode, struct file *file) |
1337 | { | 1338 | { |
1338 | lock_kernel(); | 1339 | mutex_lock(&dmasound_core_mutex); |
1339 | state.busy = 0; | 1340 | state.busy = 0; |
1340 | module_put(dmasound.mach.owner); | 1341 | module_put(dmasound.mach.owner); |
1341 | unlock_kernel(); | 1342 | mutex_unlock(&dmasound_core_mutex); |
1342 | return 0; | 1343 | return 0; |
1343 | } | 1344 | } |
1344 | 1345 | ||
diff --git a/sound/oss/msnd_pinnacle.c b/sound/oss/msnd_pinnacle.c index ca942f7cd23..7b5c77b32a9 100644 --- a/sound/oss/msnd_pinnacle.c +++ b/sound/oss/msnd_pinnacle.c | |||
@@ -39,7 +39,7 @@ | |||
39 | #include <linux/delay.h> | 39 | #include <linux/delay.h> |
40 | #include <linux/init.h> | 40 | #include <linux/init.h> |
41 | #include <linux/interrupt.h> | 41 | #include <linux/interrupt.h> |
42 | #include <linux/smp_lock.h> | 42 | #include <linux/mutex.h> |
43 | #include <linux/gfp.h> | 43 | #include <linux/gfp.h> |
44 | #include <asm/irq.h> | 44 | #include <asm/irq.h> |
45 | #include <asm/io.h> | 45 | #include <asm/io.h> |
@@ -79,6 +79,7 @@ | |||
79 | dev.rec_sample_rate / \ | 79 | dev.rec_sample_rate / \ |
80 | dev.rec_channels) | 80 | dev.rec_channels) |
81 | 81 | ||
82 | static DEFINE_MUTEX(msnd_pinnacle_mutex); | ||
82 | static multisound_dev_t dev; | 83 | static multisound_dev_t dev; |
83 | 84 | ||
84 | #ifndef HAVE_DSPCODEH | 85 | #ifndef HAVE_DSPCODEH |
@@ -651,12 +652,12 @@ static long dev_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | |||
651 | 652 | ||
652 | ret = -EINVAL; | 653 | ret = -EINVAL; |
653 | 654 | ||
654 | lock_kernel(); | 655 | mutex_lock(&msnd_pinnacle_mutex); |
655 | if (minor == dev.dsp_minor) | 656 | if (minor == dev.dsp_minor) |
656 | ret = dsp_ioctl(file, cmd, arg); | 657 | ret = dsp_ioctl(file, cmd, arg); |
657 | else if (minor == dev.mixer_minor) | 658 | else if (minor == dev.mixer_minor) |
658 | ret = mixer_ioctl(cmd, arg); | 659 | ret = mixer_ioctl(cmd, arg); |
659 | unlock_kernel(); | 660 | mutex_unlock(&msnd_pinnacle_mutex); |
660 | 661 | ||
661 | return ret; | 662 | return ret; |
662 | } | 663 | } |
@@ -761,7 +762,7 @@ static int dev_open(struct inode *inode, struct file *file) | |||
761 | int minor = iminor(inode); | 762 | int minor = iminor(inode); |
762 | int err = 0; | 763 | int err = 0; |
763 | 764 | ||
764 | lock_kernel(); | 765 | mutex_lock(&msnd_pinnacle_mutex); |
765 | if (minor == dev.dsp_minor) { | 766 | if (minor == dev.dsp_minor) { |
766 | if ((file->f_mode & FMODE_WRITE && | 767 | if ((file->f_mode & FMODE_WRITE && |
767 | test_bit(F_AUDIO_WRITE_INUSE, &dev.flags)) || | 768 | test_bit(F_AUDIO_WRITE_INUSE, &dev.flags)) || |
@@ -791,7 +792,7 @@ static int dev_open(struct inode *inode, struct file *file) | |||
791 | } else | 792 | } else |
792 | err = -EINVAL; | 793 | err = -EINVAL; |
793 | out: | 794 | out: |
794 | unlock_kernel(); | 795 | mutex_unlock(&msnd_pinnacle_mutex); |
795 | return err; | 796 | return err; |
796 | } | 797 | } |
797 | 798 | ||
@@ -800,14 +801,14 @@ static int dev_release(struct inode *inode, struct file *file) | |||
800 | int minor = iminor(inode); | 801 | int minor = iminor(inode); |
801 | int err = 0; | 802 | int err = 0; |
802 | 803 | ||
803 | lock_kernel(); | 804 | mutex_lock(&msnd_pinnacle_mutex); |
804 | if (minor == dev.dsp_minor) | 805 | if (minor == dev.dsp_minor) |
805 | err = dsp_release(file); | 806 | err = dsp_release(file); |
806 | else if (minor == dev.mixer_minor) { | 807 | else if (minor == dev.mixer_minor) { |
807 | /* nothing */ | 808 | /* nothing */ |
808 | } else | 809 | } else |
809 | err = -EINVAL; | 810 | err = -EINVAL; |
810 | unlock_kernel(); | 811 | mutex_unlock(&msnd_pinnacle_mutex); |
811 | return err; | 812 | return err; |
812 | } | 813 | } |
813 | 814 | ||
diff --git a/sound/oss/sh_dac_audio.c b/sound/oss/sh_dac_audio.c deleted file mode 100644 index 479e3025a8a..00000000000 --- a/sound/oss/sh_dac_audio.c +++ /dev/null | |||
@@ -1,325 +0,0 @@ | |||
1 | /* | ||
2 | * sound/oss/sh_dac_audio.c | ||
3 | * | ||
4 | * SH DAC based sound :( | ||
5 | * | ||
6 | * Copyright (C) 2004,2005 Andriy Skulysh | ||
7 | * | ||
8 | * This file is subject to the terms and conditions of the GNU General Public | ||
9 | * License. See the file "COPYING" in the main directory of this archive | ||
10 | * for more details. | ||
11 | */ | ||
12 | #include <linux/module.h> | ||
13 | #include <linux/init.h> | ||
14 | #include <linux/sched.h> | ||
15 | #include <linux/linkage.h> | ||
16 | #include <linux/slab.h> | ||
17 | #include <linux/fs.h> | ||
18 | #include <linux/sound.h> | ||
19 | #include <linux/smp_lock.h> | ||
20 | #include <linux/soundcard.h> | ||
21 | #include <linux/interrupt.h> | ||
22 | #include <linux/hrtimer.h> | ||
23 | #include <asm/io.h> | ||
24 | #include <asm/uaccess.h> | ||
25 | #include <asm/irq.h> | ||
26 | #include <asm/delay.h> | ||
27 | #include <asm/clock.h> | ||
28 | #include <cpu/dac.h> | ||
29 | #include <asm/machvec.h> | ||
30 | #include <mach/hp6xx.h> | ||
31 | #include <asm/hd64461.h> | ||
32 | |||
33 | #define MODNAME "sh_dac_audio" | ||
34 | |||
35 | #define BUFFER_SIZE 48000 | ||
36 | |||
37 | static int rate; | ||
38 | static int empty; | ||
39 | static char *data_buffer, *buffer_begin, *buffer_end; | ||
40 | static int in_use, device_major; | ||
41 | static struct hrtimer hrtimer; | ||
42 | static ktime_t wakeups_per_second; | ||
43 | |||
44 | static void dac_audio_start_timer(void) | ||
45 | { | ||
46 | hrtimer_start(&hrtimer, wakeups_per_second, HRTIMER_MODE_REL); | ||
47 | } | ||
48 | |||
49 | static void dac_audio_stop_timer(void) | ||
50 | { | ||
51 | hrtimer_cancel(&hrtimer); | ||
52 | } | ||
53 | |||
54 | static void dac_audio_reset(void) | ||
55 | { | ||
56 | dac_audio_stop_timer(); | ||
57 | buffer_begin = buffer_end = data_buffer; | ||
58 | empty = 1; | ||
59 | } | ||
60 | |||
61 | static void dac_audio_sync(void) | ||
62 | { | ||
63 | while (!empty) | ||
64 | schedule(); | ||
65 | } | ||
66 | |||
67 | static void dac_audio_start(void) | ||
68 | { | ||
69 | if (mach_is_hp6xx()) { | ||
70 | u16 v = __raw_readw(HD64461_GPADR); | ||
71 | v &= ~HD64461_GPADR_SPEAKER; | ||
72 | __raw_writew(v, HD64461_GPADR); | ||
73 | } | ||
74 | |||
75 | sh_dac_enable(CONFIG_SOUND_SH_DAC_AUDIO_CHANNEL); | ||
76 | } | ||
77 | static void dac_audio_stop(void) | ||
78 | { | ||
79 | dac_audio_stop_timer(); | ||
80 | |||
81 | if (mach_is_hp6xx()) { | ||
82 | u16 v = __raw_readw(HD64461_GPADR); | ||
83 | v |= HD64461_GPADR_SPEAKER; | ||
84 | __raw_writew(v, HD64461_GPADR); | ||
85 | } | ||
86 | |||
87 | sh_dac_output(0, CONFIG_SOUND_SH_DAC_AUDIO_CHANNEL); | ||
88 | sh_dac_disable(CONFIG_SOUND_SH_DAC_AUDIO_CHANNEL); | ||
89 | } | ||
90 | |||
91 | static void dac_audio_set_rate(void) | ||
92 | { | ||
93 | wakeups_per_second = ktime_set(0, 1000000000 / rate); | ||
94 | } | ||
95 | |||
96 | static int dac_audio_ioctl(struct file *file, | ||
97 | unsigned int cmd, unsigned long arg) | ||
98 | { | ||
99 | int val; | ||
100 | |||
101 | switch (cmd) { | ||
102 | case OSS_GETVERSION: | ||
103 | return put_user(SOUND_VERSION, (int *)arg); | ||
104 | |||
105 | case SNDCTL_DSP_SYNC: | ||
106 | dac_audio_sync(); | ||
107 | return 0; | ||
108 | |||
109 | case SNDCTL_DSP_RESET: | ||
110 | dac_audio_reset(); | ||
111 | return 0; | ||
112 | |||
113 | case SNDCTL_DSP_GETFMTS: | ||
114 | return put_user(AFMT_U8, (int *)arg); | ||
115 | |||
116 | case SNDCTL_DSP_SETFMT: | ||
117 | return put_user(AFMT_U8, (int *)arg); | ||
118 | |||
119 | case SNDCTL_DSP_NONBLOCK: | ||
120 | spin_lock(&file->f_lock); | ||
121 | file->f_flags |= O_NONBLOCK; | ||
122 | spin_unlock(&file->f_lock); | ||
123 | return 0; | ||
124 | |||
125 | case SNDCTL_DSP_GETCAPS: | ||
126 | return 0; | ||
127 | |||
128 | case SOUND_PCM_WRITE_RATE: | ||
129 | val = *(int *)arg; | ||
130 | if (val > 0) { | ||
131 | rate = val; | ||
132 | dac_audio_set_rate(); | ||
133 | } | ||
134 | return put_user(rate, (int *)arg); | ||
135 | |||
136 | case SNDCTL_DSP_STEREO: | ||
137 | return put_user(0, (int *)arg); | ||
138 | |||
139 | case SOUND_PCM_WRITE_CHANNELS: | ||
140 | return put_user(1, (int *)arg); | ||
141 | |||
142 | case SNDCTL_DSP_SETDUPLEX: | ||
143 | return -EINVAL; | ||
144 | |||
145 | case SNDCTL_DSP_PROFILE: | ||
146 | return -EINVAL; | ||
147 | |||
148 | case SNDCTL_DSP_GETBLKSIZE: | ||
149 | return put_user(BUFFER_SIZE, (int *)arg); | ||
150 | |||
151 | case SNDCTL_DSP_SETFRAGMENT: | ||
152 | return 0; | ||
153 | |||
154 | default: | ||
155 | printk(KERN_ERR "sh_dac_audio: unimplemented ioctl=0x%x\n", | ||
156 | cmd); | ||
157 | return -EINVAL; | ||
158 | } | ||
159 | return -EINVAL; | ||
160 | } | ||
161 | |||
162 | static long dac_audio_unlocked_ioctl(struct file *file, u_int cmd, u_long arg) | ||
163 | { | ||
164 | int ret; | ||
165 | |||
166 | lock_kernel(); | ||
167 | ret = dac_audio_ioctl(file, cmd, arg); | ||
168 | unlock_kernel(); | ||
169 | |||
170 | return ret; | ||
171 | } | ||
172 | |||
173 | static ssize_t dac_audio_write(struct file *file, const char *buf, size_t count, | ||
174 | loff_t * ppos) | ||
175 | { | ||
176 | int free; | ||
177 | int nbytes; | ||
178 | |||
179 | if (!count) { | ||
180 | dac_audio_sync(); | ||
181 | return 0; | ||
182 | } | ||
183 | |||
184 | free = buffer_begin - buffer_end; | ||
185 | |||
186 | if (free < 0) | ||
187 | free += BUFFER_SIZE; | ||
188 | if ((free == 0) && (empty)) | ||
189 | free = BUFFER_SIZE; | ||
190 | if (count > free) | ||
191 | count = free; | ||
192 | if (buffer_begin > buffer_end) { | ||
193 | if (copy_from_user((void *)buffer_end, buf, count)) | ||
194 | return -EFAULT; | ||
195 | |||
196 | buffer_end += count; | ||
197 | } else { | ||
198 | nbytes = data_buffer + BUFFER_SIZE - buffer_end; | ||
199 | if (nbytes > count) { | ||
200 | if (copy_from_user((void *)buffer_end, buf, count)) | ||
201 | return -EFAULT; | ||
202 | buffer_end += count; | ||
203 | } else { | ||
204 | if (copy_from_user((void *)buffer_end, buf, nbytes)) | ||
205 | return -EFAULT; | ||
206 | if (copy_from_user | ||
207 | ((void *)data_buffer, buf + nbytes, count - nbytes)) | ||
208 | return -EFAULT; | ||
209 | buffer_end = data_buffer + count - nbytes; | ||
210 | } | ||
211 | } | ||
212 | |||
213 | if (empty) { | ||
214 | empty = 0; | ||
215 | dac_audio_start_timer(); | ||
216 | } | ||
217 | |||
218 | return count; | ||
219 | } | ||
220 | |||
221 | static ssize_t dac_audio_read(struct file *file, char *buf, size_t count, | ||
222 | loff_t * ppos) | ||
223 | { | ||
224 | return -EINVAL; | ||
225 | } | ||
226 | |||
227 | static int dac_audio_open(struct inode *inode, struct file *file) | ||
228 | { | ||
229 | if (file->f_mode & FMODE_READ) | ||
230 | return -ENODEV; | ||
231 | |||
232 | lock_kernel(); | ||
233 | if (in_use) { | ||
234 | unlock_kernel(); | ||
235 | return -EBUSY; | ||
236 | } | ||
237 | |||
238 | in_use = 1; | ||
239 | |||
240 | dac_audio_start(); | ||
241 | unlock_kernel(); | ||
242 | return 0; | ||
243 | } | ||
244 | |||
245 | static int dac_audio_release(struct inode *inode, struct file *file) | ||
246 | { | ||
247 | dac_audio_sync(); | ||
248 | dac_audio_stop(); | ||
249 | in_use = 0; | ||
250 | |||
251 | return 0; | ||
252 | } | ||
253 | |||
254 | const struct file_operations dac_audio_fops = { | ||
255 | .read = dac_audio_read, | ||
256 | .write = dac_audio_write, | ||
257 | .unlocked_ioctl = dac_audio_unlocked_ioctl, | ||
258 | .open = dac_audio_open, | ||
259 | .release = dac_audio_release, | ||
260 | }; | ||
261 | |||
262 | static enum hrtimer_restart sh_dac_audio_timer(struct hrtimer *handle) | ||
263 | { | ||
264 | if (!empty) { | ||
265 | sh_dac_output(*buffer_begin, CONFIG_SOUND_SH_DAC_AUDIO_CHANNEL); | ||
266 | buffer_begin++; | ||
267 | |||
268 | if (buffer_begin == data_buffer + BUFFER_SIZE) | ||
269 | buffer_begin = data_buffer; | ||
270 | if (buffer_begin == buffer_end) | ||
271 | empty = 1; | ||
272 | } | ||
273 | |||
274 | if (!empty) | ||
275 | hrtimer_start(&hrtimer, wakeups_per_second, HRTIMER_MODE_REL); | ||
276 | |||
277 | return HRTIMER_NORESTART; | ||
278 | } | ||
279 | |||
280 | static int __init dac_audio_init(void) | ||
281 | { | ||
282 | if ((device_major = register_sound_dsp(&dac_audio_fops, -1)) < 0) { | ||
283 | printk(KERN_ERR "Cannot register dsp device"); | ||
284 | return device_major; | ||
285 | } | ||
286 | |||
287 | in_use = 0; | ||
288 | |||
289 | data_buffer = kmalloc(BUFFER_SIZE, GFP_KERNEL); | ||
290 | if (data_buffer == NULL) | ||
291 | return -ENOMEM; | ||
292 | |||
293 | dac_audio_reset(); | ||
294 | rate = 8000; | ||
295 | dac_audio_set_rate(); | ||
296 | |||
297 | /* Today: High Resolution Timer driven DAC playback. | ||
298 | * The timer callback gets called once per sample. Ouch. | ||
299 | * | ||
300 | * Future: A much better approach would be to use the | ||
301 | * SH7720 CMT+DMAC+DAC hardware combination like this: | ||
302 | * - Program sample rate using CMT0 or CMT1 | ||
303 | * - Program DMAC to use CMT for timing and output to DAC | ||
304 | * - Play sound using DMAC, let CPU sleep. | ||
305 | * - While at it, rewrite this driver to use ALSA. | ||
306 | */ | ||
307 | |||
308 | hrtimer_init(&hrtimer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); | ||
309 | hrtimer.function = sh_dac_audio_timer; | ||
310 | |||
311 | return 0; | ||
312 | } | ||
313 | |||
314 | static void __exit dac_audio_exit(void) | ||
315 | { | ||
316 | unregister_sound_dsp(device_major); | ||
317 | kfree((void *)data_buffer); | ||
318 | } | ||
319 | |||
320 | module_init(dac_audio_init); | ||
321 | module_exit(dac_audio_exit); | ||
322 | |||
323 | MODULE_AUTHOR("Andriy Skulysh, askulysh@image.kiev.ua"); | ||
324 | MODULE_DESCRIPTION("SH DAC sound driver"); | ||
325 | MODULE_LICENSE("GPL"); | ||
diff --git a/sound/oss/soundcard.c b/sound/oss/soundcard.c index 07f803e6d20..46c0d03dbec 100644 --- a/sound/oss/soundcard.c +++ b/sound/oss/soundcard.c | |||
@@ -40,7 +40,7 @@ | |||
40 | #include <linux/major.h> | 40 | #include <linux/major.h> |
41 | #include <linux/delay.h> | 41 | #include <linux/delay.h> |
42 | #include <linux/proc_fs.h> | 42 | #include <linux/proc_fs.h> |
43 | #include <linux/smp_lock.h> | 43 | #include <linux/mutex.h> |
44 | #include <linux/module.h> | 44 | #include <linux/module.h> |
45 | #include <linux/mm.h> | 45 | #include <linux/mm.h> |
46 | #include <linux/device.h> | 46 | #include <linux/device.h> |
@@ -56,6 +56,7 @@ | |||
56 | * Table for permanently allocated memory (used when unloading the module) | 56 | * Table for permanently allocated memory (used when unloading the module) |
57 | */ | 57 | */ |
58 | void * sound_mem_blocks[MAX_MEM_BLOCKS]; | 58 | void * sound_mem_blocks[MAX_MEM_BLOCKS]; |
59 | static DEFINE_MUTEX(soundcard_mutex); | ||
59 | int sound_nblocks = 0; | 60 | int sound_nblocks = 0; |
60 | 61 | ||
61 | /* Persistent DMA buffers */ | 62 | /* Persistent DMA buffers */ |
@@ -151,7 +152,7 @@ static ssize_t sound_read(struct file *file, char __user *buf, size_t count, lof | |||
151 | * big one anyway, we might as well bandage here.. | 152 | * big one anyway, we might as well bandage here.. |
152 | */ | 153 | */ |
153 | 154 | ||
154 | lock_kernel(); | 155 | mutex_lock(&soundcard_mutex); |
155 | 156 | ||
156 | DEB(printk("sound_read(dev=%d, count=%d)\n", dev, count)); | 157 | DEB(printk("sound_read(dev=%d, count=%d)\n", dev, count)); |
157 | switch (dev & 0x0f) { | 158 | switch (dev & 0x0f) { |
@@ -169,7 +170,7 @@ static ssize_t sound_read(struct file *file, char __user *buf, size_t count, lof | |||
169 | case SND_DEV_MIDIN: | 170 | case SND_DEV_MIDIN: |
170 | ret = MIDIbuf_read(dev, file, buf, count); | 171 | ret = MIDIbuf_read(dev, file, buf, count); |
171 | } | 172 | } |
172 | unlock_kernel(); | 173 | mutex_unlock(&soundcard_mutex); |
173 | return ret; | 174 | return ret; |
174 | } | 175 | } |
175 | 176 | ||
@@ -178,7 +179,7 @@ static ssize_t sound_write(struct file *file, const char __user *buf, size_t cou | |||
178 | int dev = iminor(file->f_path.dentry->d_inode); | 179 | int dev = iminor(file->f_path.dentry->d_inode); |
179 | int ret = -EINVAL; | 180 | int ret = -EINVAL; |
180 | 181 | ||
181 | lock_kernel(); | 182 | mutex_lock(&soundcard_mutex); |
182 | DEB(printk("sound_write(dev=%d, count=%d)\n", dev, count)); | 183 | DEB(printk("sound_write(dev=%d, count=%d)\n", dev, count)); |
183 | switch (dev & 0x0f) { | 184 | switch (dev & 0x0f) { |
184 | case SND_DEV_SEQ: | 185 | case SND_DEV_SEQ: |
@@ -196,7 +197,7 @@ static ssize_t sound_write(struct file *file, const char __user *buf, size_t cou | |||
196 | ret = MIDIbuf_write(dev, file, buf, count); | 197 | ret = MIDIbuf_write(dev, file, buf, count); |
197 | break; | 198 | break; |
198 | } | 199 | } |
199 | unlock_kernel(); | 200 | mutex_unlock(&soundcard_mutex); |
200 | return ret; | 201 | return ret; |
201 | } | 202 | } |
202 | 203 | ||
@@ -210,7 +211,7 @@ static int sound_open(struct inode *inode, struct file *file) | |||
210 | printk(KERN_ERR "Invalid minor device %d\n", dev); | 211 | printk(KERN_ERR "Invalid minor device %d\n", dev); |
211 | return -ENXIO; | 212 | return -ENXIO; |
212 | } | 213 | } |
213 | lock_kernel(); | 214 | mutex_lock(&soundcard_mutex); |
214 | switch (dev & 0x0f) { | 215 | switch (dev & 0x0f) { |
215 | case SND_DEV_CTL: | 216 | case SND_DEV_CTL: |
216 | dev >>= 4; | 217 | dev >>= 4; |
@@ -247,15 +248,15 @@ static int sound_open(struct inode *inode, struct file *file) | |||
247 | retval = -ENXIO; | 248 | retval = -ENXIO; |
248 | } | 249 | } |
249 | 250 | ||
250 | unlock_kernel(); | 251 | mutex_unlock(&soundcard_mutex); |
251 | return 0; | 252 | return retval; |
252 | } | 253 | } |
253 | 254 | ||
254 | static int sound_release(struct inode *inode, struct file *file) | 255 | static int sound_release(struct inode *inode, struct file *file) |
255 | { | 256 | { |
256 | int dev = iminor(inode); | 257 | int dev = iminor(inode); |
257 | 258 | ||
258 | lock_kernel(); | 259 | mutex_lock(&soundcard_mutex); |
259 | DEB(printk("sound_release(dev=%d)\n", dev)); | 260 | DEB(printk("sound_release(dev=%d)\n", dev)); |
260 | switch (dev & 0x0f) { | 261 | switch (dev & 0x0f) { |
261 | case SND_DEV_CTL: | 262 | case SND_DEV_CTL: |
@@ -280,7 +281,7 @@ static int sound_release(struct inode *inode, struct file *file) | |||
280 | default: | 281 | default: |
281 | printk(KERN_ERR "Sound error: Releasing unknown device 0x%02x\n", dev); | 282 | printk(KERN_ERR "Sound error: Releasing unknown device 0x%02x\n", dev); |
282 | } | 283 | } |
283 | unlock_kernel(); | 284 | mutex_unlock(&soundcard_mutex); |
284 | 285 | ||
285 | return 0; | 286 | return 0; |
286 | } | 287 | } |
@@ -354,7 +355,7 @@ static long sound_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | |||
354 | if (cmd == OSS_GETVERSION) | 355 | if (cmd == OSS_GETVERSION) |
355 | return __put_user(SOUND_VERSION, (int __user *)p); | 356 | return __put_user(SOUND_VERSION, (int __user *)p); |
356 | 357 | ||
357 | lock_kernel(); | 358 | mutex_lock(&soundcard_mutex); |
358 | if (_IOC_TYPE(cmd) == 'M' && num_mixers > 0 && /* Mixer ioctl */ | 359 | if (_IOC_TYPE(cmd) == 'M' && num_mixers > 0 && /* Mixer ioctl */ |
359 | (dev & 0x0f) != SND_DEV_CTL) { | 360 | (dev & 0x0f) != SND_DEV_CTL) { |
360 | dtype = dev & 0x0f; | 361 | dtype = dev & 0x0f; |
@@ -369,7 +370,7 @@ static long sound_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | |||
369 | ret = sound_mixer_ioctl(dev >> 4, cmd, p); | 370 | ret = sound_mixer_ioctl(dev >> 4, cmd, p); |
370 | break; | 371 | break; |
371 | } | 372 | } |
372 | unlock_kernel(); | 373 | mutex_unlock(&soundcard_mutex); |
373 | return ret; | 374 | return ret; |
374 | } | 375 | } |
375 | 376 | ||
@@ -399,7 +400,7 @@ static long sound_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | |||
399 | break; | 400 | break; |
400 | 401 | ||
401 | } | 402 | } |
402 | unlock_kernel(); | 403 | mutex_unlock(&soundcard_mutex); |
403 | return ret; | 404 | return ret; |
404 | } | 405 | } |
405 | 406 | ||
@@ -439,35 +440,35 @@ static int sound_mmap(struct file *file, struct vm_area_struct *vma) | |||
439 | printk(KERN_ERR "Sound: mmap() not supported for other than audio devices\n"); | 440 | printk(KERN_ERR "Sound: mmap() not supported for other than audio devices\n"); |
440 | return -EINVAL; | 441 | return -EINVAL; |
441 | } | 442 | } |
442 | lock_kernel(); | 443 | mutex_lock(&soundcard_mutex); |
443 | if (vma->vm_flags & VM_WRITE) /* Map write and read/write to the output buf */ | 444 | if (vma->vm_flags & VM_WRITE) /* Map write and read/write to the output buf */ |
444 | dmap = audio_devs[dev]->dmap_out; | 445 | dmap = audio_devs[dev]->dmap_out; |
445 | else if (vma->vm_flags & VM_READ) | 446 | else if (vma->vm_flags & VM_READ) |
446 | dmap = audio_devs[dev]->dmap_in; | 447 | dmap = audio_devs[dev]->dmap_in; |
447 | else { | 448 | else { |
448 | printk(KERN_ERR "Sound: Undefined mmap() access\n"); | 449 | printk(KERN_ERR "Sound: Undefined mmap() access\n"); |
449 | unlock_kernel(); | 450 | mutex_unlock(&soundcard_mutex); |
450 | return -EINVAL; | 451 | return -EINVAL; |
451 | } | 452 | } |
452 | 453 | ||
453 | if (dmap == NULL) { | 454 | if (dmap == NULL) { |
454 | printk(KERN_ERR "Sound: mmap() error. dmap == NULL\n"); | 455 | printk(KERN_ERR "Sound: mmap() error. dmap == NULL\n"); |
455 | unlock_kernel(); | 456 | mutex_unlock(&soundcard_mutex); |
456 | return -EIO; | 457 | return -EIO; |
457 | } | 458 | } |
458 | if (dmap->raw_buf == NULL) { | 459 | if (dmap->raw_buf == NULL) { |
459 | printk(KERN_ERR "Sound: mmap() called when raw_buf == NULL\n"); | 460 | printk(KERN_ERR "Sound: mmap() called when raw_buf == NULL\n"); |
460 | unlock_kernel(); | 461 | mutex_unlock(&soundcard_mutex); |
461 | return -EIO; | 462 | return -EIO; |
462 | } | 463 | } |
463 | if (dmap->mapping_flags) { | 464 | if (dmap->mapping_flags) { |
464 | printk(KERN_ERR "Sound: mmap() called twice for the same DMA buffer\n"); | 465 | printk(KERN_ERR "Sound: mmap() called twice for the same DMA buffer\n"); |
465 | unlock_kernel(); | 466 | mutex_unlock(&soundcard_mutex); |
466 | return -EIO; | 467 | return -EIO; |
467 | } | 468 | } |
468 | if (vma->vm_pgoff != 0) { | 469 | if (vma->vm_pgoff != 0) { |
469 | printk(KERN_ERR "Sound: mmap() offset must be 0.\n"); | 470 | printk(KERN_ERR "Sound: mmap() offset must be 0.\n"); |
470 | unlock_kernel(); | 471 | mutex_unlock(&soundcard_mutex); |
471 | return -EINVAL; | 472 | return -EINVAL; |
472 | } | 473 | } |
473 | size = vma->vm_end - vma->vm_start; | 474 | size = vma->vm_end - vma->vm_start; |
@@ -478,7 +479,7 @@ static int sound_mmap(struct file *file, struct vm_area_struct *vma) | |||
478 | if (remap_pfn_range(vma, vma->vm_start, | 479 | if (remap_pfn_range(vma, vma->vm_start, |
479 | virt_to_phys(dmap->raw_buf) >> PAGE_SHIFT, | 480 | virt_to_phys(dmap->raw_buf) >> PAGE_SHIFT, |
480 | vma->vm_end - vma->vm_start, vma->vm_page_prot)) { | 481 | vma->vm_end - vma->vm_start, vma->vm_page_prot)) { |
481 | unlock_kernel(); | 482 | mutex_unlock(&soundcard_mutex); |
482 | return -EAGAIN; | 483 | return -EAGAIN; |
483 | } | 484 | } |
484 | 485 | ||
@@ -490,7 +491,7 @@ static int sound_mmap(struct file *file, struct vm_area_struct *vma) | |||
490 | memset(dmap->raw_buf, | 491 | memset(dmap->raw_buf, |
491 | dmap->neutral_byte, | 492 | dmap->neutral_byte, |
492 | dmap->bytes_in_use); | 493 | dmap->bytes_in_use); |
493 | unlock_kernel(); | 494 | mutex_unlock(&soundcard_mutex); |
494 | return 0; | 495 | return 0; |
495 | } | 496 | } |
496 | 497 | ||
diff --git a/sound/oss/swarm_cs4297a.c b/sound/oss/swarm_cs4297a.c index b15840ad252..44357d877a2 100644 --- a/sound/oss/swarm_cs4297a.c +++ b/sound/oss/swarm_cs4297a.c | |||
@@ -68,7 +68,6 @@ | |||
68 | #include <linux/delay.h> | 68 | #include <linux/delay.h> |
69 | #include <linux/sound.h> | 69 | #include <linux/sound.h> |
70 | #include <linux/slab.h> | 70 | #include <linux/slab.h> |
71 | #include <linux/smp_lock.h> | ||
72 | #include <linux/soundcard.h> | 71 | #include <linux/soundcard.h> |
73 | #include <linux/ac97_codec.h> | 72 | #include <linux/ac97_codec.h> |
74 | #include <linux/pci.h> | 73 | #include <linux/pci.h> |
@@ -94,6 +93,7 @@ | |||
94 | 93 | ||
95 | struct cs4297a_state; | 94 | struct cs4297a_state; |
96 | 95 | ||
96 | static DEFINE_MUTEX(swarm_cs4297a_mutex); | ||
97 | static void stop_dac(struct cs4297a_state *s); | 97 | static void stop_dac(struct cs4297a_state *s); |
98 | static void stop_adc(struct cs4297a_state *s); | 98 | static void stop_adc(struct cs4297a_state *s); |
99 | static void start_dac(struct cs4297a_state *s); | 99 | static void start_dac(struct cs4297a_state *s); |
@@ -1535,7 +1535,7 @@ static int cs4297a_open_mixdev(struct inode *inode, struct file *file) | |||
1535 | CS_DBGOUT(CS_FUNCTION | CS_OPEN, 4, | 1535 | CS_DBGOUT(CS_FUNCTION | CS_OPEN, 4, |
1536 | printk(KERN_INFO "cs4297a: cs4297a_open_mixdev()+\n")); | 1536 | printk(KERN_INFO "cs4297a: cs4297a_open_mixdev()+\n")); |
1537 | 1537 | ||
1538 | lock_kernel(); | 1538 | mutex_lock(&swarm_cs4297a_mutex); |
1539 | list_for_each(entry, &cs4297a_devs) | 1539 | list_for_each(entry, &cs4297a_devs) |
1540 | { | 1540 | { |
1541 | s = list_entry(entry, struct cs4297a_state, list); | 1541 | s = list_entry(entry, struct cs4297a_state, list); |
@@ -1547,7 +1547,7 @@ static int cs4297a_open_mixdev(struct inode *inode, struct file *file) | |||
1547 | CS_DBGOUT(CS_FUNCTION | CS_OPEN | CS_ERROR, 2, | 1547 | CS_DBGOUT(CS_FUNCTION | CS_OPEN | CS_ERROR, 2, |
1548 | printk(KERN_INFO "cs4297a: cs4297a_open_mixdev()- -ENODEV\n")); | 1548 | printk(KERN_INFO "cs4297a: cs4297a_open_mixdev()- -ENODEV\n")); |
1549 | 1549 | ||
1550 | unlock_kernel(); | 1550 | mutex_unlock(&swarm_cs4297a_mutex); |
1551 | return -ENODEV; | 1551 | return -ENODEV; |
1552 | } | 1552 | } |
1553 | VALIDATE_STATE(s); | 1553 | VALIDATE_STATE(s); |
@@ -1555,7 +1555,7 @@ static int cs4297a_open_mixdev(struct inode *inode, struct file *file) | |||
1555 | 1555 | ||
1556 | CS_DBGOUT(CS_FUNCTION | CS_OPEN, 4, | 1556 | CS_DBGOUT(CS_FUNCTION | CS_OPEN, 4, |
1557 | printk(KERN_INFO "cs4297a: cs4297a_open_mixdev()- 0\n")); | 1557 | printk(KERN_INFO "cs4297a: cs4297a_open_mixdev()- 0\n")); |
1558 | unlock_kernel(); | 1558 | mutex_unlock(&swarm_cs4297a_mutex); |
1559 | 1559 | ||
1560 | return nonseekable_open(inode, file); | 1560 | return nonseekable_open(inode, file); |
1561 | } | 1561 | } |
@@ -1575,10 +1575,10 @@ static int cs4297a_ioctl_mixdev(struct file *file, | |||
1575 | unsigned int cmd, unsigned long arg) | 1575 | unsigned int cmd, unsigned long arg) |
1576 | { | 1576 | { |
1577 | int ret; | 1577 | int ret; |
1578 | lock_kernel(); | 1578 | mutex_lock(&swarm_cs4297a_mutex); |
1579 | ret = mixer_ioctl((struct cs4297a_state *) file->private_data, cmd, | 1579 | ret = mixer_ioctl((struct cs4297a_state *) file->private_data, cmd, |
1580 | arg); | 1580 | arg); |
1581 | unlock_kernel(); | 1581 | mutex_unlock(&swarm_cs4297a_mutex); |
1582 | return ret; | 1582 | return ret; |
1583 | } | 1583 | } |
1584 | 1584 | ||
@@ -2350,9 +2350,9 @@ static long cs4297a_unlocked_ioctl(struct file *file, u_int cmd, u_long arg) | |||
2350 | { | 2350 | { |
2351 | int ret; | 2351 | int ret; |
2352 | 2352 | ||
2353 | lock_kernel(); | 2353 | mutex_lock(&swarm_cs4297a_mutex); |
2354 | ret = cs4297a_ioctl(file, cmd, arg); | 2354 | ret = cs4297a_ioctl(file, cmd, arg); |
2355 | unlock_kernel(); | 2355 | mutex_unlock(&swarm_cs4297a_mutex); |
2356 | 2356 | ||
2357 | return ret; | 2357 | return ret; |
2358 | } | 2358 | } |
@@ -2509,9 +2509,9 @@ static int cs4297a_open(struct inode *inode, struct file *file) | |||
2509 | { | 2509 | { |
2510 | int ret; | 2510 | int ret; |
2511 | 2511 | ||
2512 | lock_kernel(); | 2512 | mutex_lock(&swarm_cs4297a_mutex); |
2513 | ret = cs4297a_open(inode, file); | 2513 | ret = cs4297a_open(inode, file); |
2514 | unlock_kernel(); | 2514 | mutex_unlock(&swarm_cs4297a_mutex); |
2515 | 2515 | ||
2516 | return ret; | 2516 | return ret; |
2517 | } | 2517 | } |
diff --git a/sound/oss/vwsnd.c b/sound/oss/vwsnd.c index 8cd73cdd88a..643f1113b1d 100644 --- a/sound/oss/vwsnd.c +++ b/sound/oss/vwsnd.c | |||
@@ -145,7 +145,6 @@ | |||
145 | #include <linux/init.h> | 145 | #include <linux/init.h> |
146 | 146 | ||
147 | #include <linux/spinlock.h> | 147 | #include <linux/spinlock.h> |
148 | #include <linux/smp_lock.h> | ||
149 | #include <linux/wait.h> | 148 | #include <linux/wait.h> |
150 | #include <linux/interrupt.h> | 149 | #include <linux/interrupt.h> |
151 | #include <linux/mutex.h> | 150 | #include <linux/mutex.h> |
@@ -160,6 +159,7 @@ | |||
160 | 159 | ||
161 | #ifdef VWSND_DEBUG | 160 | #ifdef VWSND_DEBUG |
162 | 161 | ||
162 | static DEFINE_MUTEX(vwsnd_mutex); | ||
163 | static int shut_up = 1; | 163 | static int shut_up = 1; |
164 | 164 | ||
165 | /* | 165 | /* |
@@ -2891,11 +2891,11 @@ static long vwsnd_audio_ioctl(struct file *file, | |||
2891 | vwsnd_dev_t *devc = (vwsnd_dev_t *) file->private_data; | 2891 | vwsnd_dev_t *devc = (vwsnd_dev_t *) file->private_data; |
2892 | int ret; | 2892 | int ret; |
2893 | 2893 | ||
2894 | lock_kernel(); | 2894 | mutex_lock(&vwsnd_mutex); |
2895 | mutex_lock(&devc->io_mutex); | 2895 | mutex_lock(&devc->io_mutex); |
2896 | ret = vwsnd_audio_do_ioctl(file, cmd, arg); | 2896 | ret = vwsnd_audio_do_ioctl(file, cmd, arg); |
2897 | mutex_unlock(&devc->io_mutex); | 2897 | mutex_unlock(&devc->io_mutex); |
2898 | unlock_kernel(); | 2898 | mutex_unlock(&vwsnd_mutex); |
2899 | 2899 | ||
2900 | return ret; | 2900 | return ret; |
2901 | } | 2901 | } |
@@ -2922,7 +2922,7 @@ static int vwsnd_audio_open(struct inode *inode, struct file *file) | |||
2922 | 2922 | ||
2923 | DBGE("(inode=0x%p, file=0x%p)\n", inode, file); | 2923 | DBGE("(inode=0x%p, file=0x%p)\n", inode, file); |
2924 | 2924 | ||
2925 | lock_kernel(); | 2925 | mutex_lock(&vwsnd_mutex); |
2926 | INC_USE_COUNT; | 2926 | INC_USE_COUNT; |
2927 | for (devc = vwsnd_dev_list; devc; devc = devc->next_dev) | 2927 | for (devc = vwsnd_dev_list; devc; devc = devc->next_dev) |
2928 | if ((devc->audio_minor & ~0x0F) == (minor & ~0x0F)) | 2928 | if ((devc->audio_minor & ~0x0F) == (minor & ~0x0F)) |
@@ -2930,7 +2930,7 @@ static int vwsnd_audio_open(struct inode *inode, struct file *file) | |||
2930 | 2930 | ||
2931 | if (devc == NULL) { | 2931 | if (devc == NULL) { |
2932 | DEC_USE_COUNT; | 2932 | DEC_USE_COUNT; |
2933 | unlock_kernel(); | 2933 | mutex_unlock(&vwsnd_mutex); |
2934 | return -ENODEV; | 2934 | return -ENODEV; |
2935 | } | 2935 | } |
2936 | 2936 | ||
@@ -2939,13 +2939,13 @@ static int vwsnd_audio_open(struct inode *inode, struct file *file) | |||
2939 | mutex_unlock(&devc->open_mutex); | 2939 | mutex_unlock(&devc->open_mutex); |
2940 | if (file->f_flags & O_NONBLOCK) { | 2940 | if (file->f_flags & O_NONBLOCK) { |
2941 | DEC_USE_COUNT; | 2941 | DEC_USE_COUNT; |
2942 | unlock_kernel(); | 2942 | mutex_unlock(&vwsnd_mutex); |
2943 | return -EBUSY; | 2943 | return -EBUSY; |
2944 | } | 2944 | } |
2945 | interruptible_sleep_on(&devc->open_wait); | 2945 | interruptible_sleep_on(&devc->open_wait); |
2946 | if (signal_pending(current)) { | 2946 | if (signal_pending(current)) { |
2947 | DEC_USE_COUNT; | 2947 | DEC_USE_COUNT; |
2948 | unlock_kernel(); | 2948 | mutex_unlock(&vwsnd_mutex); |
2949 | return -ERESTARTSYS; | 2949 | return -ERESTARTSYS; |
2950 | } | 2950 | } |
2951 | mutex_lock(&devc->open_mutex); | 2951 | mutex_lock(&devc->open_mutex); |
@@ -2998,7 +2998,7 @@ static int vwsnd_audio_open(struct inode *inode, struct file *file) | |||
2998 | 2998 | ||
2999 | file->private_data = devc; | 2999 | file->private_data = devc; |
3000 | DBGRV(); | 3000 | DBGRV(); |
3001 | unlock_kernel(); | 3001 | mutex_unlock(&vwsnd_mutex); |
3002 | return 0; | 3002 | return 0; |
3003 | } | 3003 | } |
3004 | 3004 | ||
@@ -3012,7 +3012,7 @@ static int vwsnd_audio_release(struct inode *inode, struct file *file) | |||
3012 | vwsnd_port_t *wport = NULL, *rport = NULL; | 3012 | vwsnd_port_t *wport = NULL, *rport = NULL; |
3013 | int err = 0; | 3013 | int err = 0; |
3014 | 3014 | ||
3015 | lock_kernel(); | 3015 | mutex_lock(&vwsnd_mutex); |
3016 | mutex_lock(&devc->io_mutex); | 3016 | mutex_lock(&devc->io_mutex); |
3017 | { | 3017 | { |
3018 | DBGEV("(inode=0x%p, file=0x%p)\n", inode, file); | 3018 | DBGEV("(inode=0x%p, file=0x%p)\n", inode, file); |
@@ -3040,7 +3040,7 @@ static int vwsnd_audio_release(struct inode *inode, struct file *file) | |||
3040 | wake_up(&devc->open_wait); | 3040 | wake_up(&devc->open_wait); |
3041 | DEC_USE_COUNT; | 3041 | DEC_USE_COUNT; |
3042 | DBGR(); | 3042 | DBGR(); |
3043 | unlock_kernel(); | 3043 | mutex_unlock(&vwsnd_mutex); |
3044 | return err; | 3044 | return err; |
3045 | } | 3045 | } |
3046 | 3046 | ||
@@ -3068,18 +3068,18 @@ static int vwsnd_mixer_open(struct inode *inode, struct file *file) | |||
3068 | DBGEV("(inode=0x%p, file=0x%p)\n", inode, file); | 3068 | DBGEV("(inode=0x%p, file=0x%p)\n", inode, file); |
3069 | 3069 | ||
3070 | INC_USE_COUNT; | 3070 | INC_USE_COUNT; |
3071 | lock_kernel(); | 3071 | mutex_lock(&vwsnd_mutex); |
3072 | for (devc = vwsnd_dev_list; devc; devc = devc->next_dev) | 3072 | for (devc = vwsnd_dev_list; devc; devc = devc->next_dev) |
3073 | if (devc->mixer_minor == iminor(inode)) | 3073 | if (devc->mixer_minor == iminor(inode)) |
3074 | break; | 3074 | break; |
3075 | 3075 | ||
3076 | if (devc == NULL) { | 3076 | if (devc == NULL) { |
3077 | DEC_USE_COUNT; | 3077 | DEC_USE_COUNT; |
3078 | unlock_kernel(); | 3078 | mutex_unlock(&vwsnd_mutex); |
3079 | return -ENODEV; | 3079 | return -ENODEV; |
3080 | } | 3080 | } |
3081 | file->private_data = devc; | 3081 | file->private_data = devc; |
3082 | unlock_kernel(); | 3082 | mutex_unlock(&vwsnd_mutex); |
3083 | return 0; | 3083 | return 0; |
3084 | } | 3084 | } |
3085 | 3085 | ||
@@ -3223,7 +3223,7 @@ static long vwsnd_mixer_ioctl(struct file *file, | |||
3223 | 3223 | ||
3224 | DBGEV("(devc=0x%p, cmd=0x%x, arg=0x%lx)\n", devc, cmd, arg); | 3224 | DBGEV("(devc=0x%p, cmd=0x%x, arg=0x%lx)\n", devc, cmd, arg); |
3225 | 3225 | ||
3226 | lock_kernel(); | 3226 | mutex_lock(&vwsnd_mutex); |
3227 | mutex_lock(&devc->mix_mutex); | 3227 | mutex_lock(&devc->mix_mutex); |
3228 | { | 3228 | { |
3229 | if ((cmd & ~nrmask) == MIXER_READ(0)) | 3229 | if ((cmd & ~nrmask) == MIXER_READ(0)) |
@@ -3234,7 +3234,7 @@ static long vwsnd_mixer_ioctl(struct file *file, | |||
3234 | retval = -EINVAL; | 3234 | retval = -EINVAL; |
3235 | } | 3235 | } |
3236 | mutex_unlock(&devc->mix_mutex); | 3236 | mutex_unlock(&devc->mix_mutex); |
3237 | unlock_kernel(); | 3237 | mutex_unlock(&vwsnd_mutex); |
3238 | return retval; | 3238 | return retval; |
3239 | } | 3239 | } |
3240 | 3240 | ||