aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/sound/pcm_oss.h2
-rw-r--r--sound/core/Kconfig18
-rw-r--r--sound/core/oss/copy.c5
-rw-r--r--sound/core/oss/io.c5
-rw-r--r--sound/core/oss/linear.c5
-rw-r--r--sound/core/oss/mulaw.c5
-rw-r--r--sound/core/oss/pcm_oss.c20
-rw-r--r--sound/core/oss/pcm_plugin.c5
-rw-r--r--sound/core/oss/pcm_plugin.h10
-rw-r--r--sound/core/oss/rate.c5
-rw-r--r--sound/core/oss/route.c5
-rw-r--r--sound/core/pcm.c4
-rw-r--r--sound/usb/usbaudio.c13
13 files changed, 97 insertions, 5 deletions
diff --git a/include/sound/pcm_oss.h b/include/sound/pcm_oss.h
index fddaddde47b4..d6ec886637db 100644
--- a/include/sound/pcm_oss.h
+++ b/include/sound/pcm_oss.h
@@ -56,8 +56,10 @@ struct snd_pcm_oss_runtime {
56 size_t mmap_bytes; 56 size_t mmap_bytes;
57 char *buffer; /* vmallocated period */ 57 char *buffer; /* vmallocated period */
58 size_t buffer_used; /* used length from period buffer */ 58 size_t buffer_used; /* used length from period buffer */
59#ifdef CONFIG_SND_PCM_OSS_PLUGINS
59 struct snd_pcm_plugin *plugin_first; 60 struct snd_pcm_plugin *plugin_first;
60 struct snd_pcm_plugin *plugin_last; 61 struct snd_pcm_plugin *plugin_last;
62#endif
61 unsigned int prev_hw_ptr_interrupt; 63 unsigned int prev_hw_ptr_interrupt;
62}; 64};
63 65
diff --git a/sound/core/Kconfig b/sound/core/Kconfig
index f79755f77a81..9dd121bb5638 100644
--- a/sound/core/Kconfig
+++ b/sound/core/Kconfig
@@ -73,6 +73,15 @@ config SND_PCM_OSS
73 To compile this driver as a module, choose M here: the module 73 To compile this driver as a module, choose M here: the module
74 will be called snd-pcm-oss. 74 will be called snd-pcm-oss.
75 75
76config SND_PCM_OSS_PLUGINS
77 bool "OSS PCM (digital audio) API - Include plugin system"
78 depends on SND_PCM_OSS
79 default y
80 help
81 If you disable this option, the ALSA's OSS PCM API will not
82 support conversion of channels, formats and rates. It will
83 behave like most of new OSS/Free drivers in 2.4/2.6 kernels.
84
76config SND_SEQUENCER_OSS 85config SND_SEQUENCER_OSS
77 bool "OSS Sequencer API" 86 bool "OSS Sequencer API"
78 depends on SND && SND_SEQUENCER 87 depends on SND && SND_SEQUENCER
@@ -130,6 +139,15 @@ config SND_SUPPORT_OLD_API
130 Say Y here to support the obsolete ALSA PCM API (ver.0.9.0 rc3 139 Say Y here to support the obsolete ALSA PCM API (ver.0.9.0 rc3
131 or older). 140 or older).
132 141
142config SND_VERBOSE_PROCFS
143 bool "Verbose procfs contents"
144 depends on SND
145 default y
146 help
147 Say Y here to include code for verbose procfs contents (provides
148 usefull information to developers when a problem occurs). On the
149 other side, it makes the ALSA subsystem larger.
150
133config SND_VERBOSE_PRINTK 151config SND_VERBOSE_PRINTK
134 bool "Verbose printk" 152 bool "Verbose printk"
135 depends on SND 153 depends on SND
diff --git a/sound/core/oss/copy.c b/sound/core/oss/copy.c
index d6a04c2d5a75..7c008c4c0dd1 100644
--- a/sound/core/oss/copy.c
+++ b/sound/core/oss/copy.c
@@ -20,6 +20,9 @@
20 */ 20 */
21 21
22#include <sound/driver.h> 22#include <sound/driver.h>
23
24#ifdef SND_PCM_OSS_PLUGINS
25
23#include <linux/time.h> 26#include <linux/time.h>
24#include <sound/core.h> 27#include <sound/core.h>
25#include <sound/pcm.h> 28#include <sound/pcm.h>
@@ -85,3 +88,5 @@ int snd_pcm_plugin_build_copy(struct snd_pcm_substream *plug,
85 *r_plugin = plugin; 88 *r_plugin = plugin;
86 return 0; 89 return 0;
87} 90}
91
92#endif
diff --git a/sound/core/oss/io.c b/sound/core/oss/io.c
index 322702e05f3e..b6e7ce30e5a3 100644
--- a/sound/core/oss/io.c
+++ b/sound/core/oss/io.c
@@ -20,6 +20,9 @@
20 */ 20 */
21 21
22#include <sound/driver.h> 22#include <sound/driver.h>
23
24#ifdef CONFIG_SND_PCM_OSS_PLUGINS
25
23#include <linux/time.h> 26#include <linux/time.h>
24#include <sound/core.h> 27#include <sound/core.h>
25#include <sound/pcm.h> 28#include <sound/pcm.h>
@@ -132,3 +135,5 @@ int snd_pcm_plugin_build_io(struct snd_pcm_substream *plug,
132 *r_plugin = plugin; 135 *r_plugin = plugin;
133 return 0; 136 return 0;
134} 137}
138
139#endif
diff --git a/sound/core/oss/linear.c b/sound/core/oss/linear.c
index 8cbfa415ce40..ef331230b3a6 100644
--- a/sound/core/oss/linear.c
+++ b/sound/core/oss/linear.c
@@ -21,6 +21,9 @@
21 */ 21 */
22 22
23#include <sound/driver.h> 23#include <sound/driver.h>
24
25#ifdef CONFIG_SND_PCM_OSS_PLUGINS
26
24#include <linux/time.h> 27#include <linux/time.h>
25#include <sound/core.h> 28#include <sound/core.h>
26#include <sound/pcm.h> 29#include <sound/pcm.h>
@@ -156,3 +159,5 @@ int snd_pcm_plugin_build_linear(struct snd_pcm_substream *plug,
156 *r_plugin = plugin; 159 *r_plugin = plugin;
157 return 0; 160 return 0;
158} 161}
162
163#endif
diff --git a/sound/core/oss/mulaw.c b/sound/core/oss/mulaw.c
index 14f5578ec7a7..ed12c81fcf1b 100644
--- a/sound/core/oss/mulaw.c
+++ b/sound/core/oss/mulaw.c
@@ -22,6 +22,9 @@
22 */ 22 */
23 23
24#include <sound/driver.h> 24#include <sound/driver.h>
25
26#ifdef CONFIG_SND_PCM_OSS_PLUGINS
27
25#include <linux/time.h> 28#include <linux/time.h>
26#include <sound/core.h> 29#include <sound/core.h>
27#include <sound/pcm.h> 30#include <sound/pcm.h>
@@ -306,3 +309,5 @@ int snd_pcm_plugin_build_mulaw(struct snd_pcm_substream *plug,
306 *r_plugin = plugin; 309 *r_plugin = plugin;
307 return 0; 310 return 0;
308} 311}
312
313#endif
diff --git a/sound/core/oss/pcm_oss.c b/sound/core/oss/pcm_oss.c
index 7fd072392c7e..bc24d028f518 100644
--- a/sound/core/oss/pcm_oss.c
+++ b/sound/core/oss/pcm_oss.c
@@ -78,6 +78,7 @@ static inline void snd_leave_user(mm_segment_t fs)
78 set_fs(fs); 78 set_fs(fs);
79} 79}
80 80
81#ifdef CONFIG_SND_PCM_OSS_PLUGINS
81static int snd_pcm_oss_plugin_clear(struct snd_pcm_substream *substream) 82static int snd_pcm_oss_plugin_clear(struct snd_pcm_substream *substream)
82{ 83{
83 struct snd_pcm_runtime *runtime = substream->runtime; 84 struct snd_pcm_runtime *runtime = substream->runtime;
@@ -122,6 +123,7 @@ int snd_pcm_plugin_append(struct snd_pcm_plugin *plugin)
122 } 123 }
123 return 0; 124 return 0;
124} 125}
126#endif /* CONFIG_SND_PCM_OSS_PLUGINS */
125 127
126static long snd_pcm_oss_bytes(struct snd_pcm_substream *substream, long frames) 128static long snd_pcm_oss_bytes(struct snd_pcm_substream *substream, long frames)
127{ 129{
@@ -412,6 +414,7 @@ static int snd_pcm_oss_change_params(struct snd_pcm_substream *substream)
412 oss_frame_size = snd_pcm_format_physical_width(params_format(params)) * 414 oss_frame_size = snd_pcm_format_physical_width(params_format(params)) *
413 params_channels(params) / 8; 415 params_channels(params) / 8;
414 416
417#ifdef CONFIG_SND_PCM_OSS_PLUGINS
415 snd_pcm_oss_plugin_clear(substream); 418 snd_pcm_oss_plugin_clear(substream);
416 if (!direct) { 419 if (!direct) {
417 /* add necessary plugins */ 420 /* add necessary plugins */
@@ -441,6 +444,7 @@ static int snd_pcm_oss_change_params(struct snd_pcm_substream *substream)
441 } 444 }
442 } 445 }
443 } 446 }
447#endif
444 448
445 err = snd_pcm_oss_period_size(substream, params, sparams); 449 err = snd_pcm_oss_period_size(substream, params, sparams);
446 if (err < 0) 450 if (err < 0)
@@ -498,11 +502,13 @@ static int snd_pcm_oss_change_params(struct snd_pcm_substream *substream)
498 runtime->oss.periods = params_periods(sparams); 502 runtime->oss.periods = params_periods(sparams);
499 oss_period_size = snd_pcm_plug_client_size(substream, params_period_size(sparams)); 503 oss_period_size = snd_pcm_plug_client_size(substream, params_period_size(sparams));
500 snd_assert(oss_period_size >= 0, err = -EINVAL; goto failure); 504 snd_assert(oss_period_size >= 0, err = -EINVAL; goto failure);
505#ifdef CONFIG_SND_PCM_OSS_PLUGINS
501 if (runtime->oss.plugin_first) { 506 if (runtime->oss.plugin_first) {
502 err = snd_pcm_plug_alloc(substream, oss_period_size); 507 err = snd_pcm_plug_alloc(substream, oss_period_size);
503 if (err < 0) 508 if (err < 0)
504 goto failure; 509 goto failure;
505 } 510 }
511#endif
506 oss_period_size *= oss_frame_size; 512 oss_period_size *= oss_frame_size;
507 513
508 oss_buffer_size = oss_period_size * runtime->oss.periods; 514 oss_buffer_size = oss_period_size * runtime->oss.periods;
@@ -784,6 +790,7 @@ static ssize_t snd_pcm_oss_write2(struct snd_pcm_substream *substream, const cha
784{ 790{
785 struct snd_pcm_runtime *runtime = substream->runtime; 791 struct snd_pcm_runtime *runtime = substream->runtime;
786 snd_pcm_sframes_t frames, frames1; 792 snd_pcm_sframes_t frames, frames1;
793#ifdef CONFIG_SND_PCM_OSS_PLUGINS
787 if (runtime->oss.plugin_first) { 794 if (runtime->oss.plugin_first) {
788 struct snd_pcm_plugin_channel *channels; 795 struct snd_pcm_plugin_channel *channels;
789 size_t oss_frame_bytes = (runtime->oss.plugin_first->src_width * runtime->oss.plugin_first->src_format.channels) / 8; 796 size_t oss_frame_bytes = (runtime->oss.plugin_first->src_width * runtime->oss.plugin_first->src_format.channels) / 8;
@@ -800,7 +807,9 @@ static ssize_t snd_pcm_oss_write2(struct snd_pcm_substream *substream, const cha
800 if (frames1 <= 0) 807 if (frames1 <= 0)
801 return frames1; 808 return frames1;
802 bytes = frames1 * oss_frame_bytes; 809 bytes = frames1 * oss_frame_bytes;
803 } else { 810 } else
811#endif
812 {
804 frames = bytes_to_frames(runtime, bytes); 813 frames = bytes_to_frames(runtime, bytes);
805 frames1 = snd_pcm_oss_write3(substream, buf, frames, in_kernel); 814 frames1 = snd_pcm_oss_write3(substream, buf, frames, in_kernel);
806 if (frames1 <= 0) 815 if (frames1 <= 0)
@@ -871,6 +880,7 @@ static ssize_t snd_pcm_oss_read2(struct snd_pcm_substream *substream, char *buf,
871{ 880{
872 struct snd_pcm_runtime *runtime = substream->runtime; 881 struct snd_pcm_runtime *runtime = substream->runtime;
873 snd_pcm_sframes_t frames, frames1; 882 snd_pcm_sframes_t frames, frames1;
883#ifdef CONFIG_SND_PCM_OSS_PLUGINS
874 char __user *final_dst = (char __user *)buf; 884 char __user *final_dst = (char __user *)buf;
875 if (runtime->oss.plugin_first) { 885 if (runtime->oss.plugin_first) {
876 struct snd_pcm_plugin_channel *channels; 886 struct snd_pcm_plugin_channel *channels;
@@ -887,7 +897,9 @@ static ssize_t snd_pcm_oss_read2(struct snd_pcm_substream *substream, char *buf,
887 bytes = frames1 * oss_frame_bytes; 897 bytes = frames1 * oss_frame_bytes;
888 if (!in_kernel && copy_to_user(final_dst, buf, bytes)) 898 if (!in_kernel && copy_to_user(final_dst, buf, bytes))
889 return -EFAULT; 899 return -EFAULT;
890 } else { 900 } else
901#endif
902 {
891 frames = bytes_to_frames(runtime, bytes); 903 frames = bytes_to_frames(runtime, bytes);
892 frames1 = snd_pcm_oss_read3(substream, buf, frames, in_kernel); 904 frames1 = snd_pcm_oss_read3(substream, buf, frames, in_kernel);
893 if (frames1 <= 0) 905 if (frames1 <= 0)
@@ -1692,7 +1704,9 @@ static void snd_pcm_oss_release_substream(struct snd_pcm_substream *substream)
1692 struct snd_pcm_runtime *runtime; 1704 struct snd_pcm_runtime *runtime;
1693 runtime = substream->runtime; 1705 runtime = substream->runtime;
1694 vfree(runtime->oss.buffer); 1706 vfree(runtime->oss.buffer);
1707#ifdef CONFIG_SND_PCM_OSS_PLUGINS
1695 snd_pcm_oss_plugin_clear(substream); 1708 snd_pcm_oss_plugin_clear(substream);
1709#endif
1696 substream->oss.file = NULL; 1710 substream->oss.file = NULL;
1697 substream->oss.oss = 0; 1711 substream->oss.oss = 0;
1698} 1712}
@@ -2246,8 +2260,10 @@ static int snd_pcm_oss_mmap(struct file *file, struct vm_area_struct *area)
2246 if ((err = snd_pcm_oss_change_params(substream)) < 0) 2260 if ((err = snd_pcm_oss_change_params(substream)) < 0)
2247 return err; 2261 return err;
2248 } 2262 }
2263#ifdef CONFIG_SND_PCM_OSS_PLUGINS
2249 if (runtime->oss.plugin_first != NULL) 2264 if (runtime->oss.plugin_first != NULL)
2250 return -EIO; 2265 return -EIO;
2266#endif
2251 2267
2252 if (area->vm_pgoff != 0) 2268 if (area->vm_pgoff != 0)
2253 return -EINVAL; 2269 return -EINVAL;
diff --git a/sound/core/oss/pcm_plugin.c b/sound/core/oss/pcm_plugin.c
index 7e8676880dde..89bc8f965043 100644
--- a/sound/core/oss/pcm_plugin.c
+++ b/sound/core/oss/pcm_plugin.c
@@ -25,6 +25,9 @@
25#endif 25#endif
26 26
27#include <sound/driver.h> 27#include <sound/driver.h>
28
29#ifdef CONFIG_SND_PCM_OSS_PLUGINS
30
28#include <linux/slab.h> 31#include <linux/slab.h>
29#include <linux/time.h> 32#include <linux/time.h>
30#include <linux/vmalloc.h> 33#include <linux/vmalloc.h>
@@ -916,3 +919,5 @@ int snd_pcm_area_copy(const struct snd_pcm_channel_area *src_area, size_t src_of
916 } 919 }
917 return 0; 920 return 0;
918} 921}
922
923#endif
diff --git a/sound/core/oss/pcm_plugin.h b/sound/core/oss/pcm_plugin.h
index 29198da615cd..a8a4f9580435 100644
--- a/sound/core/oss/pcm_plugin.h
+++ b/sound/core/oss/pcm_plugin.h
@@ -22,6 +22,8 @@
22 * 22 *
23 */ 23 */
24 24
25#ifdef CONFIG_SND_PCM_OSS_PLUGINS
26
25#include <linux/bitmap.h> 27#include <linux/bitmap.h>
26 28
27static inline unsigned long *bitmap_alloc(unsigned int nbits) 29static inline unsigned long *bitmap_alloc(unsigned int nbits)
@@ -191,6 +193,14 @@ void zero_channel(struct snd_pcm_plugin *plugin,
191 const struct snd_pcm_plugin_channel *dst_channel, 193 const struct snd_pcm_plugin_channel *dst_channel,
192 size_t samples); 194 size_t samples);
193 195
196#else
197
198static inline snd_pcm_sframes_t snd_pcm_plug_client_size(struct snd_pcm_substream *handle, snd_pcm_uframes_t drv_size) { return drv_size; }
199static inline snd_pcm_sframes_t snd_pcm_plug_slave_size(struct snd_pcm_substream *handle, snd_pcm_uframes_t clt_size) { return clt_size; }
200static inline int snd_pcm_plug_slave_format(int format, struct snd_mask *format_mask) { return format; }
201
202#endif
203
194#ifdef PLUGIN_DEBUG 204#ifdef PLUGIN_DEBUG
195#define pdprintf( fmt, args... ) printk( "plugin: " fmt, ##args) 205#define pdprintf( fmt, args... ) printk( "plugin: " fmt, ##args)
196#else 206#else
diff --git a/sound/core/oss/rate.c b/sound/core/oss/rate.c
index 4854cef6fb4f..c4b75bff0ee5 100644
--- a/sound/core/oss/rate.c
+++ b/sound/core/oss/rate.c
@@ -20,6 +20,9 @@
20 */ 20 */
21 21
22#include <sound/driver.h> 22#include <sound/driver.h>
23
24#ifdef CONFIG_SND_PCM_OSS_PLUGINS
25
23#include <linux/time.h> 26#include <linux/time.h>
24#include <sound/core.h> 27#include <sound/core.h>
25#include <sound/pcm.h> 28#include <sound/pcm.h>
@@ -377,3 +380,5 @@ int snd_pcm_plugin_build_rate(struct snd_pcm_substream *plug,
377 *r_plugin = plugin; 380 *r_plugin = plugin;
378 return 0; 381 return 0;
379} 382}
383
384#endif
diff --git a/sound/core/oss/route.c b/sound/core/oss/route.c
index 726c5caa3fdb..f99a54e6551a 100644
--- a/sound/core/oss/route.c
+++ b/sound/core/oss/route.c
@@ -20,6 +20,9 @@
20 */ 20 */
21 21
22#include <sound/driver.h> 22#include <sound/driver.h>
23
24#ifdef CONFIG_SND_PCM_OSS_PLUGINS
25
23#include <linux/slab.h> 26#include <linux/slab.h>
24#include <linux/time.h> 27#include <linux/time.h>
25#include <sound/core.h> 28#include <sound/core.h>
@@ -519,3 +522,5 @@ int snd_pcm_plugin_build_route(struct snd_pcm_substream *plug,
519 *r_plugin = plugin; 522 *r_plugin = plugin;
520 return 0; 523 return 0;
521} 524}
525
526#endif
diff --git a/sound/core/pcm.c b/sound/core/pcm.c
index 28ca61eb0b0d..d92c3ce4a4c9 100644
--- a/sound/core/pcm.c
+++ b/sound/core/pcm.c
@@ -140,6 +140,9 @@ static int snd_pcm_control_ioctl(struct snd_card *card,
140 } 140 }
141 return -ENOIOCTLCMD; 141 return -ENOIOCTLCMD;
142} 142}
143
144#if defined(CONFIG_PROC_FS) && defined(CONFIG_SND_VERBOSE_PROCFS)
145
143#define STATE(v) [SNDRV_PCM_STATE_##v] = #v 146#define STATE(v) [SNDRV_PCM_STATE_##v] = #v
144#define STREAM(v) [SNDRV_PCM_STREAM_##v] = #v 147#define STREAM(v) [SNDRV_PCM_STREAM_##v] = #v
145#define READY(v) [SNDRV_PCM_READY_##v] = #v 148#define READY(v) [SNDRV_PCM_READY_##v] = #v
@@ -197,7 +200,6 @@ const char *snd_pcm_format_name(snd_pcm_format_t format)
197 return snd_pcm_format_names[format]; 200 return snd_pcm_format_names[format];
198} 201}
199 202
200#ifdef CONFIG_PROC_FS
201static char *snd_pcm_stream_names[] = { 203static char *snd_pcm_stream_names[] = {
202 STREAM(PLAYBACK), 204 STREAM(PLAYBACK),
203 STREAM(CAPTURE), 205 STREAM(CAPTURE),
diff --git a/sound/usb/usbaudio.c b/sound/usb/usbaudio.c
index f5aadb001986..c9476c237c42 100644
--- a/sound/usb/usbaudio.c
+++ b/sound/usb/usbaudio.c
@@ -1384,8 +1384,8 @@ static int snd_usb_hw_params(struct snd_pcm_substream *substream,
1384 channels = params_channels(hw_params); 1384 channels = params_channels(hw_params);
1385 fmt = find_format(subs, format, rate, channels); 1385 fmt = find_format(subs, format, rate, channels);
1386 if (! fmt) { 1386 if (! fmt) {
1387 snd_printd(KERN_DEBUG "cannot set format: format = %s, rate = %d, channels = %d\n", 1387 snd_printd(KERN_DEBUG "cannot set format: format = 0x%x, rate = %d, channels = %d\n",
1388 snd_pcm_format_name(format), rate, channels); 1388 format, rate, channels);
1389 return -EINVAL; 1389 return -EINVAL;
1390 } 1390 }
1391 1391
@@ -2011,6 +2011,8 @@ static struct usb_driver usb_audio_driver = {
2011}; 2011};
2012 2012
2013 2013
2014#if defined(CONFIG_PROCFS) && defined(CONFIG_SND_VERBOSE_PROCFS)
2015
2014/* 2016/*
2015 * proc interface for list the supported pcm formats 2017 * proc interface for list the supported pcm formats
2016 */ 2018 */
@@ -2101,6 +2103,13 @@ static void proc_pcm_format_add(struct snd_usb_stream *stream)
2101 snd_info_set_text_ops(entry, stream, 1024, proc_pcm_format_read); 2103 snd_info_set_text_ops(entry, stream, 1024, proc_pcm_format_read);
2102} 2104}
2103 2105
2106#else
2107
2108static inline void proc_pcm_format_add(struct snd_usb_stream *stream)
2109{
2110}
2111
2112#endif
2104 2113
2105/* 2114/*
2106 * initialize the substream instance. 2115 * initialize the substream instance.