aboutsummaryrefslogtreecommitdiffstats
path: root/sound/drivers/pcsp/pcsp.c
diff options
context:
space:
mode:
authorStas Sergeev <stsp@aknet.ru>2009-11-01 05:13:19 -0500
committerTakashi Iwai <tiwai@suse.de>2009-11-01 05:13:19 -0500
commitbcc2c6b7cb320d10c7fcccd87dce87f4384b4332 (patch)
tree24663a166d0f4d6901eafad9294e7e54647b5442 /sound/drivers/pcsp/pcsp.c
parente87a3dd33eab30b4db539500064a9584867e4f2c (diff)
ALSA: snd-pcsp: add nopcm mode
Currently, if the high-res timers are unavailable, snd-pcsp does not initialize. People who choose it over pcspkr, loose their console beeps in that case and get annoyed. With this patch, the console beeps remain regardless of the high-res timers. Additionally, the "nopcm" modparam is added to forcibly disable the PCM capabilities of the driver. Signed-off-by: Stas Sergeev <stsp@aknet.ru> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/drivers/pcsp/pcsp.c')
-rw-r--r--sound/drivers/pcsp/pcsp.c32
1 files changed, 20 insertions, 12 deletions
diff --git a/sound/drivers/pcsp/pcsp.c b/sound/drivers/pcsp/pcsp.c
index b60cef257b58..f165c77d6273 100644
--- a/sound/drivers/pcsp/pcsp.c
+++ b/sound/drivers/pcsp/pcsp.c
@@ -26,6 +26,7 @@ MODULE_ALIAS("platform:pcspkr");
26static int index = SNDRV_DEFAULT_IDX1; /* Index 0-MAX */ 26static int index = SNDRV_DEFAULT_IDX1; /* Index 0-MAX */
27static char *id = SNDRV_DEFAULT_STR1; /* ID for this card */ 27static char *id = SNDRV_DEFAULT_STR1; /* ID for this card */
28static int enable = SNDRV_DEFAULT_ENABLE1; /* Enable this card */ 28static int enable = SNDRV_DEFAULT_ENABLE1; /* Enable this card */
29static int nopcm; /* Disable PCM capability of the driver */
29 30
30module_param(index, int, 0444); 31module_param(index, int, 0444);
31MODULE_PARM_DESC(index, "Index value for pcsp soundcard."); 32MODULE_PARM_DESC(index, "Index value for pcsp soundcard.");
@@ -33,6 +34,8 @@ module_param(id, charp, 0444);
33MODULE_PARM_DESC(id, "ID string for pcsp soundcard."); 34MODULE_PARM_DESC(id, "ID string for pcsp soundcard.");
34module_param(enable, bool, 0444); 35module_param(enable, bool, 0444);
35MODULE_PARM_DESC(enable, "Enable PC-Speaker sound."); 36MODULE_PARM_DESC(enable, "Enable PC-Speaker sound.");
37module_param(nopcm, bool, 0444);
38MODULE_PARM_DESC(nopcm, "Disable PC-Speaker PCM sound. Only beeps remain.");
36 39
37struct snd_pcsp pcsp_chip; 40struct snd_pcsp pcsp_chip;
38 41
@@ -43,13 +46,16 @@ static int __devinit snd_pcsp_create(struct snd_card *card)
43 int err; 46 int err;
44 int div, min_div, order; 47 int div, min_div, order;
45 48
46 hrtimer_get_res(CLOCK_MONOTONIC, &tp); 49 if (!nopcm) {
47 if (tp.tv_sec || tp.tv_nsec > PCSP_MAX_PERIOD_NS) { 50 hrtimer_get_res(CLOCK_MONOTONIC, &tp);
48 printk(KERN_ERR "PCSP: Timer resolution is not sufficient " 51 if (tp.tv_sec || tp.tv_nsec > PCSP_MAX_PERIOD_NS) {
49 "(%linS)\n", tp.tv_nsec); 52 printk(KERN_ERR "PCSP: Timer resolution is not sufficient "
50 printk(KERN_ERR "PCSP: Make sure you have HPET and ACPI " 53 "(%linS)\n", tp.tv_nsec);
51 "enabled.\n"); 54 printk(KERN_ERR "PCSP: Make sure you have HPET and ACPI "
52 return -EIO; 55 "enabled.\n");
56 printk(KERN_ERR "PCSP: Turned into nopcm mode.\n");
57 nopcm = 1;
58 }
53 } 59 }
54 60
55 if (loops_per_jiffy >= PCSP_MIN_LPJ && tp.tv_nsec <= PCSP_MIN_PERIOD_NS) 61 if (loops_per_jiffy >= PCSP_MIN_LPJ && tp.tv_nsec <= PCSP_MIN_PERIOD_NS)
@@ -107,12 +113,14 @@ static int __devinit snd_card_pcsp_probe(int devnum, struct device *dev)
107 snd_card_free(card); 113 snd_card_free(card);
108 return err; 114 return err;
109 } 115 }
110 err = snd_pcsp_new_pcm(&pcsp_chip); 116 if (!nopcm) {
111 if (err < 0) { 117 err = snd_pcsp_new_pcm(&pcsp_chip);
112 snd_card_free(card); 118 if (err < 0) {
113 return err; 119 snd_card_free(card);
120 return err;
121 }
114 } 122 }
115 err = snd_pcsp_new_mixer(&pcsp_chip); 123 err = snd_pcsp_new_mixer(&pcsp_chip, nopcm);
116 if (err < 0) { 124 if (err < 0) {
117 snd_card_free(card); 125 snd_card_free(card);
118 return err; 126 return err;