diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2008-05-19 12:24:49 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-05-19 12:24:49 -0400 |
commit | 83e0c24a38aa91f7d932bbcab257093b82435074 (patch) | |
tree | eb0516fd12599e88e85bb1e63473548cbdc85540 | |
parent | 161fb0cf5c7e94cd0490e4bd04edcf1e24d1d288 (diff) | |
parent | 42ece6c1f8162cd782b44dc4863679e888531df5 (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:
snd-pcsp: silent misleading warning
snd-pcsp: depend on CONFIG_EXPERIMENTAL
snd-pcsp: put back the compatibility code for the older alsa-libs
snd-pcsp: adjust help texts to frighten users
-rw-r--r-- | sound/Kconfig | 5 | ||||
-rw-r--r-- | sound/drivers/Kconfig | 15 | ||||
-rw-r--r-- | sound/drivers/pcsp/pcsp_lib.c | 23 |
3 files changed, 30 insertions, 13 deletions
diff --git a/sound/Kconfig b/sound/Kconfig index b2a2db47aff5..4247406160e7 100644 --- a/sound/Kconfig +++ b/sound/Kconfig | |||
@@ -28,11 +28,6 @@ config SOUND | |||
28 | and read <file:Documentation/sound/oss/README.modules>; the module | 28 | and read <file:Documentation/sound/oss/README.modules>; the module |
29 | will be called soundcore. | 29 | will be called soundcore. |
30 | 30 | ||
31 | I'm told that even without a sound card, you can make your computer | ||
32 | say more than an occasional beep, by programming the PC speaker. | ||
33 | Kernel patches and supporting utilities to do that are in the pcsp | ||
34 | package, available at <ftp://ftp.infradead.org/pub/pcsp/>. | ||
35 | |||
36 | source "sound/oss/dmasound/Kconfig" | 31 | source "sound/oss/dmasound/Kconfig" |
37 | 32 | ||
38 | if !M68K | 33 | if !M68K |
diff --git a/sound/drivers/Kconfig b/sound/drivers/Kconfig index 379bcb074463..602b58e3b55d 100644 --- a/sound/drivers/Kconfig +++ b/sound/drivers/Kconfig | |||
@@ -5,9 +5,10 @@ menu "Generic devices" | |||
5 | 5 | ||
6 | 6 | ||
7 | config SND_PCSP | 7 | config SND_PCSP |
8 | tristate "PC-Speaker support" | 8 | tristate "PC-Speaker support (READ HELP!)" |
9 | depends on PCSPKR_PLATFORM && X86_PC && HIGH_RES_TIMERS | 9 | depends on PCSPKR_PLATFORM && X86_PC && HIGH_RES_TIMERS |
10 | depends on INPUT | 10 | depends on INPUT |
11 | depends on EXPERIMENTAL | ||
11 | depends on SND | 12 | depends on SND |
12 | select SND_PCM | 13 | select SND_PCM |
13 | help | 14 | help |
@@ -18,11 +19,21 @@ config SND_PCSP | |||
18 | 19 | ||
19 | You can compile this as a module which will be called snd-pcsp. | 20 | You can compile this as a module which will be called snd-pcsp. |
20 | 21 | ||
22 | WARNING: if you already have a soundcard, enabling this | ||
23 | driver may lead to a problem. Namely, it may get loaded | ||
24 | before the other sound driver of yours, making the | ||
25 | pc-speaker a default sound device. Which is likely not | ||
26 | what you want. To make this driver play nicely with other | ||
27 | sound driver, you can add this into your /etc/modprobe.conf: | ||
28 | options snd-pcsp index=2 | ||
29 | |||
21 | You don't need this driver if you only want your pc-speaker to beep. | 30 | You don't need this driver if you only want your pc-speaker to beep. |
22 | You don't need this driver if you have a tablet piezo beeper | 31 | You don't need this driver if you have a tablet piezo beeper |
23 | in your PC instead of the real speaker. | 32 | in your PC instead of the real speaker. |
24 | 33 | ||
25 | It should not hurt to say Y or M here in all other cases. | 34 | Say N if you have a sound card. |
35 | Say M if you don't. | ||
36 | Say Y only if you really know what you do. | ||
26 | 37 | ||
27 | config SND_MPU401_UART | 38 | config SND_MPU401_UART |
28 | tristate | 39 | tristate |
diff --git a/sound/drivers/pcsp/pcsp_lib.c b/sound/drivers/pcsp/pcsp_lib.c index ac6238e93513..7ad4a1534b2b 100644 --- a/sound/drivers/pcsp/pcsp_lib.c +++ b/sound/drivers/pcsp/pcsp_lib.c | |||
@@ -18,6 +18,8 @@ module_param(nforce_wa, bool, 0444); | |||
18 | MODULE_PARM_DESC(nforce_wa, "Apply NForce chipset workaround " | 18 | MODULE_PARM_DESC(nforce_wa, "Apply NForce chipset workaround " |
19 | "(expect bad sound)"); | 19 | "(expect bad sound)"); |
20 | 20 | ||
21 | #define DMIX_WANTS_S16 1 | ||
22 | |||
21 | static void pcsp_start_timer(unsigned long dummy) | 23 | static void pcsp_start_timer(unsigned long dummy) |
22 | { | 24 | { |
23 | hrtimer_start(&pcsp_chip.timer, ktime_set(0, 0), HRTIMER_MODE_REL); | 25 | hrtimer_start(&pcsp_chip.timer, ktime_set(0, 0), HRTIMER_MODE_REL); |
@@ -47,7 +49,7 @@ enum hrtimer_restart pcsp_do_timer(struct hrtimer *handle) | |||
47 | { | 49 | { |
48 | unsigned long flags; | 50 | unsigned long flags; |
49 | unsigned char timer_cnt, val; | 51 | unsigned char timer_cnt, val; |
50 | int periods_elapsed; | 52 | int fmt_size, periods_elapsed; |
51 | u64 ns; | 53 | u64 ns; |
52 | size_t period_bytes, buffer_bytes; | 54 | size_t period_bytes, buffer_bytes; |
53 | struct snd_pcm_substream *substream; | 55 | struct snd_pcm_substream *substream; |
@@ -92,8 +94,11 @@ enum hrtimer_restart pcsp_do_timer(struct hrtimer *handle) | |||
92 | goto exit_nr_unlock2; | 94 | goto exit_nr_unlock2; |
93 | 95 | ||
94 | runtime = substream->runtime; | 96 | runtime = substream->runtime; |
95 | /* assume it is u8 mono */ | 97 | fmt_size = snd_pcm_format_physical_width(runtime->format) >> 3; |
96 | val = runtime->dma_area[chip->playback_ptr]; | 98 | /* assume it is mono! */ |
99 | val = runtime->dma_area[chip->playback_ptr + fmt_size - 1]; | ||
100 | if (snd_pcm_format_signed(runtime->format)) | ||
101 | val ^= 0x80; | ||
97 | timer_cnt = val * CUR_DIV() / 256; | 102 | timer_cnt = val * CUR_DIV() / 256; |
98 | 103 | ||
99 | if (timer_cnt && chip->enable) { | 104 | if (timer_cnt && chip->enable) { |
@@ -111,12 +116,14 @@ enum hrtimer_restart pcsp_do_timer(struct hrtimer *handle) | |||
111 | 116 | ||
112 | period_bytes = snd_pcm_lib_period_bytes(substream); | 117 | period_bytes = snd_pcm_lib_period_bytes(substream); |
113 | buffer_bytes = snd_pcm_lib_buffer_bytes(substream); | 118 | buffer_bytes = snd_pcm_lib_buffer_bytes(substream); |
114 | chip->playback_ptr += PCSP_INDEX_INC(); | 119 | chip->playback_ptr += PCSP_INDEX_INC() * fmt_size; |
115 | periods_elapsed = chip->playback_ptr - chip->period_ptr; | 120 | periods_elapsed = chip->playback_ptr - chip->period_ptr; |
116 | if (periods_elapsed < 0) { | 121 | if (periods_elapsed < 0) { |
117 | printk(KERN_WARNING "PCSP: playback_ptr inconsistent " | 122 | #if PCSP_DEBUG |
123 | printk(KERN_INFO "PCSP: buffer_bytes mod period_bytes != 0 ? " | ||
118 | "(%zi %zi %zi)\n", | 124 | "(%zi %zi %zi)\n", |
119 | chip->playback_ptr, period_bytes, buffer_bytes); | 125 | chip->playback_ptr, period_bytes, buffer_bytes); |
126 | #endif | ||
120 | periods_elapsed += buffer_bytes; | 127 | periods_elapsed += buffer_bytes; |
121 | } | 128 | } |
122 | periods_elapsed /= period_bytes; | 129 | periods_elapsed /= period_bytes; |
@@ -270,7 +277,11 @@ static struct snd_pcm_hardware snd_pcsp_playback = { | |||
270 | .info = (SNDRV_PCM_INFO_INTERLEAVED | | 277 | .info = (SNDRV_PCM_INFO_INTERLEAVED | |
271 | SNDRV_PCM_INFO_HALF_DUPLEX | | 278 | SNDRV_PCM_INFO_HALF_DUPLEX | |
272 | SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_MMAP_VALID), | 279 | SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_MMAP_VALID), |
273 | .formats = SNDRV_PCM_FMTBIT_U8, | 280 | .formats = (SNDRV_PCM_FMTBIT_U8 |
281 | #if DMIX_WANTS_S16 | ||
282 | | SNDRV_PCM_FMTBIT_S16_LE | ||
283 | #endif | ||
284 | ), | ||
274 | .rates = SNDRV_PCM_RATE_KNOT, | 285 | .rates = SNDRV_PCM_RATE_KNOT, |
275 | .rate_min = PCSP_DEFAULT_SRATE, | 286 | .rate_min = PCSP_DEFAULT_SRATE, |
276 | .rate_max = PCSP_DEFAULT_SRATE, | 287 | .rate_max = PCSP_DEFAULT_SRATE, |