aboutsummaryrefslogtreecommitdiffstats
path: root/sound/core
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2011-01-13 02:37:14 -0500
committerTakashi Iwai <tiwai@suse.de>2011-01-13 02:37:14 -0500
commite38302f78284e3e80ffc2eef54001fce7d183bd4 (patch)
tree0cb61d52ca9d11d446e3fc1bc97d8fd92ab1e934 /sound/core
parent3c0eee3fe6a3a1c745379547c7e7c904aa64f6d5 (diff)
parentc386735264da97e6b6d15aa56361e9ef188b26ab (diff)
Merge branch 'topic/misc' into for-linus
Diffstat (limited to 'sound/core')
-rw-r--r--sound/core/control.c28
-rw-r--r--sound/core/oss/pcm_oss.c4
-rw-r--r--sound/core/pcm_lib.c22
-rw-r--r--sound/core/pcm_native.c3
-rw-r--r--sound/core/seq/seq.c4
-rw-r--r--sound/core/sound.c18
-rw-r--r--sound/core/timer.c7
7 files changed, 77 insertions, 9 deletions
diff --git a/sound/core/control.c b/sound/core/control.c
index 45a818002d99..9ce00ed20fba 100644
--- a/sound/core/control.c
+++ b/sound/core/control.c
@@ -1488,7 +1488,7 @@ int snd_ctl_create(struct snd_card *card)
1488} 1488}
1489 1489
1490/* 1490/*
1491 * Frequently used control callbacks 1491 * Frequently used control callbacks/helpers
1492 */ 1492 */
1493int snd_ctl_boolean_mono_info(struct snd_kcontrol *kcontrol, 1493int snd_ctl_boolean_mono_info(struct snd_kcontrol *kcontrol,
1494 struct snd_ctl_elem_info *uinfo) 1494 struct snd_ctl_elem_info *uinfo)
@@ -1513,3 +1513,29 @@ int snd_ctl_boolean_stereo_info(struct snd_kcontrol *kcontrol,
1513} 1513}
1514 1514
1515EXPORT_SYMBOL(snd_ctl_boolean_stereo_info); 1515EXPORT_SYMBOL(snd_ctl_boolean_stereo_info);
1516
1517/**
1518 * snd_ctl_enum_info - fills the info structure for an enumerated control
1519 * @info: the structure to be filled
1520 * @channels: the number of the control's channels; often one
1521 * @items: the number of control values; also the size of @names
1522 * @names: an array containing the names of all control values
1523 *
1524 * Sets all required fields in @info to their appropriate values.
1525 * If the control's accessibility is not the default (readable and writable),
1526 * the caller has to fill @info->access.
1527 */
1528int snd_ctl_enum_info(struct snd_ctl_elem_info *info, unsigned int channels,
1529 unsigned int items, const char *const names[])
1530{
1531 info->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
1532 info->count = channels;
1533 info->value.enumerated.items = items;
1534 if (info->value.enumerated.item >= items)
1535 info->value.enumerated.item = items - 1;
1536 strlcpy(info->value.enumerated.name,
1537 names[info->value.enumerated.item],
1538 sizeof(info->value.enumerated.name));
1539 return 0;
1540}
1541EXPORT_SYMBOL(snd_ctl_enum_info);
diff --git a/sound/core/oss/pcm_oss.c b/sound/core/oss/pcm_oss.c
index b753ec661fcf..a2e4eb324699 100644
--- a/sound/core/oss/pcm_oss.c
+++ b/sound/core/oss/pcm_oss.c
@@ -453,8 +453,10 @@ static int snd_pcm_hw_param_near(struct snd_pcm_substream *pcm,
453 } else { 453 } else {
454 *params = *save; 454 *params = *save;
455 max = snd_pcm_hw_param_max(pcm, params, var, max, &maxdir); 455 max = snd_pcm_hw_param_max(pcm, params, var, max, &maxdir);
456 if (max < 0) 456 if (max < 0) {
457 kfree(save);
457 return max; 458 return max;
459 }
458 last = 1; 460 last = 1;
459 } 461 }
460 _end: 462 _end:
diff --git a/sound/core/pcm_lib.c b/sound/core/pcm_lib.c
index 11446a1506da..a82e3756a72d 100644
--- a/sound/core/pcm_lib.c
+++ b/sound/core/pcm_lib.c
@@ -373,6 +373,27 @@ static int snd_pcm_update_hw_ptr0(struct snd_pcm_substream *substream,
373 (unsigned long)new_hw_ptr, 373 (unsigned long)new_hw_ptr,
374 (unsigned long)runtime->hw_ptr_base); 374 (unsigned long)runtime->hw_ptr_base);
375 } 375 }
376
377 if (runtime->no_period_wakeup) {
378 /*
379 * Without regular period interrupts, we have to check
380 * the elapsed time to detect xruns.
381 */
382 jdelta = jiffies - runtime->hw_ptr_jiffies;
383 if (jdelta < runtime->hw_ptr_buffer_jiffies / 2)
384 goto no_delta_check;
385 hdelta = jdelta - delta * HZ / runtime->rate;
386 while (hdelta > runtime->hw_ptr_buffer_jiffies / 2 + 1) {
387 delta += runtime->buffer_size;
388 hw_base += runtime->buffer_size;
389 if (hw_base >= runtime->boundary)
390 hw_base = 0;
391 new_hw_ptr = hw_base + pos;
392 hdelta -= runtime->hw_ptr_buffer_jiffies;
393 }
394 goto no_delta_check;
395 }
396
376 /* something must be really wrong */ 397 /* something must be really wrong */
377 if (delta >= runtime->buffer_size + runtime->period_size) { 398 if (delta >= runtime->buffer_size + runtime->period_size) {
378 hw_ptr_error(substream, 399 hw_ptr_error(substream,
@@ -442,6 +463,7 @@ static int snd_pcm_update_hw_ptr0(struct snd_pcm_substream *substream,
442 (long)old_hw_ptr); 463 (long)old_hw_ptr);
443 } 464 }
444 465
466 no_delta_check:
445 if (runtime->status->hw_ptr == new_hw_ptr) 467 if (runtime->status->hw_ptr == new_hw_ptr)
446 return 0; 468 return 0;
447 469
diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c
index e82c1f97d99e..0db714e87a80 100644
--- a/sound/core/pcm_native.c
+++ b/sound/core/pcm_native.c
@@ -422,6 +422,9 @@ static int snd_pcm_hw_params(struct snd_pcm_substream *substream,
422 runtime->info = params->info; 422 runtime->info = params->info;
423 runtime->rate_num = params->rate_num; 423 runtime->rate_num = params->rate_num;
424 runtime->rate_den = params->rate_den; 424 runtime->rate_den = params->rate_den;
425 runtime->no_period_wakeup =
426 (params->info & SNDRV_PCM_INFO_NO_PERIOD_WAKEUP) &&
427 (params->flags & SNDRV_PCM_HW_PARAMS_NO_PERIOD_WAKEUP);
425 428
426 bits = snd_pcm_format_physical_width(runtime->format); 429 bits = snd_pcm_format_physical_width(runtime->format);
427 runtime->sample_bits = bits; 430 runtime->sample_bits = bits;
diff --git a/sound/core/seq/seq.c b/sound/core/seq/seq.c
index bf09a5ad1865..119fddb6fc99 100644
--- a/sound/core/seq/seq.c
+++ b/sound/core/seq/seq.c
@@ -32,6 +32,7 @@
32#include "seq_timer.h" 32#include "seq_timer.h"
33#include "seq_system.h" 33#include "seq_system.h"
34#include "seq_info.h" 34#include "seq_info.h"
35#include <sound/minors.h>
35#include <sound/seq_device.h> 36#include <sound/seq_device.h>
36 37
37#if defined(CONFIG_SND_SEQ_DUMMY_MODULE) 38#if defined(CONFIG_SND_SEQ_DUMMY_MODULE)
@@ -73,6 +74,9 @@ MODULE_PARM_DESC(seq_default_timer_subdevice, "The default timer subdevice numbe
73module_param(seq_default_timer_resolution, int, 0644); 74module_param(seq_default_timer_resolution, int, 0644);
74MODULE_PARM_DESC(seq_default_timer_resolution, "The default timer resolution in Hz."); 75MODULE_PARM_DESC(seq_default_timer_resolution, "The default timer resolution in Hz.");
75 76
77MODULE_ALIAS_CHARDEV(CONFIG_SND_MAJOR, SNDRV_MINOR_SEQUENCER);
78MODULE_ALIAS("devname:snd/seq");
79
76/* 80/*
77 * INIT PART 81 * INIT PART
78 */ 82 */
diff --git a/sound/core/sound.c b/sound/core/sound.c
index 66691fe437e6..1c7a3efe1778 100644
--- a/sound/core/sound.c
+++ b/sound/core/sound.c
@@ -188,14 +188,22 @@ static const struct file_operations snd_fops =
188}; 188};
189 189
190#ifdef CONFIG_SND_DYNAMIC_MINORS 190#ifdef CONFIG_SND_DYNAMIC_MINORS
191static int snd_find_free_minor(void) 191static int snd_find_free_minor(int type)
192{ 192{
193 int minor; 193 int minor;
194 194
195 /* static minors for module auto loading */
196 if (type == SNDRV_DEVICE_TYPE_SEQUENCER)
197 return SNDRV_MINOR_SEQUENCER;
198 if (type == SNDRV_DEVICE_TYPE_TIMER)
199 return SNDRV_MINOR_TIMER;
200
195 for (minor = 0; minor < ARRAY_SIZE(snd_minors); ++minor) { 201 for (minor = 0; minor < ARRAY_SIZE(snd_minors); ++minor) {
196 /* skip minors still used statically for autoloading devices */ 202 /* skip static minors still used for module auto loading */
197 if (SNDRV_MINOR_DEVICE(minor) == SNDRV_MINOR_CONTROL || 203 if (SNDRV_MINOR_DEVICE(minor) == SNDRV_MINOR_CONTROL)
198 minor == SNDRV_MINOR_SEQUENCER) 204 continue;
205 if (minor == SNDRV_MINOR_SEQUENCER ||
206 minor == SNDRV_MINOR_TIMER)
199 continue; 207 continue;
200 if (!snd_minors[minor]) 208 if (!snd_minors[minor])
201 return minor; 209 return minor;
@@ -269,7 +277,7 @@ int snd_register_device_for_dev(int type, struct snd_card *card, int dev,
269 preg->private_data = private_data; 277 preg->private_data = private_data;
270 mutex_lock(&sound_mutex); 278 mutex_lock(&sound_mutex);
271#ifdef CONFIG_SND_DYNAMIC_MINORS 279#ifdef CONFIG_SND_DYNAMIC_MINORS
272 minor = snd_find_free_minor(); 280 minor = snd_find_free_minor(type);
273#else 281#else
274 minor = snd_kernel_minor(type, card, dev); 282 minor = snd_kernel_minor(type, card, dev);
275 if (minor >= 0 && snd_minors[minor]) 283 if (minor >= 0 && snd_minors[minor])
diff --git a/sound/core/timer.c b/sound/core/timer.c
index 13afb60999b9..ed016329e911 100644
--- a/sound/core/timer.c
+++ b/sound/core/timer.c
@@ -34,8 +34,8 @@
34#include <sound/initval.h> 34#include <sound/initval.h>
35#include <linux/kmod.h> 35#include <linux/kmod.h>
36 36
37#if defined(CONFIG_SND_HPET) || defined(CONFIG_SND_HPET_MODULE) 37#if defined(CONFIG_SND_HRTIMER) || defined(CONFIG_SND_HRTIMER_MODULE)
38#define DEFAULT_TIMER_LIMIT 3 38#define DEFAULT_TIMER_LIMIT 4
39#elif defined(CONFIG_SND_RTCTIMER) || defined(CONFIG_SND_RTCTIMER_MODULE) 39#elif defined(CONFIG_SND_RTCTIMER) || defined(CONFIG_SND_RTCTIMER_MODULE)
40#define DEFAULT_TIMER_LIMIT 2 40#define DEFAULT_TIMER_LIMIT 2
41#else 41#else
@@ -52,6 +52,9 @@ MODULE_PARM_DESC(timer_limit, "Maximum global timers in system.");
52module_param(timer_tstamp_monotonic, int, 0444); 52module_param(timer_tstamp_monotonic, int, 0444);
53MODULE_PARM_DESC(timer_tstamp_monotonic, "Use posix monotonic clock source for timestamps (default)."); 53MODULE_PARM_DESC(timer_tstamp_monotonic, "Use posix monotonic clock source for timestamps (default).");
54 54
55MODULE_ALIAS_CHARDEV(CONFIG_SND_MAJOR, SNDRV_MINOR_TIMER);
56MODULE_ALIAS("devname:snd/timer");
57
55struct snd_timer_user { 58struct snd_timer_user {
56 struct snd_timer_instance *timeri; 59 struct snd_timer_instance *timeri;
57 int tread; /* enhanced read with timestamps and events */ 60 int tread; /* enhanced read with timestamps and events */