diff options
Diffstat (limited to 'sound/drivers/pcsp/pcsp.c')
-rw-r--r-- | sound/drivers/pcsp/pcsp.c | 32 |
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"); | |||
26 | static int index = SNDRV_DEFAULT_IDX1; /* Index 0-MAX */ | 26 | static int index = SNDRV_DEFAULT_IDX1; /* Index 0-MAX */ |
27 | static char *id = SNDRV_DEFAULT_STR1; /* ID for this card */ | 27 | static char *id = SNDRV_DEFAULT_STR1; /* ID for this card */ |
28 | static int enable = SNDRV_DEFAULT_ENABLE1; /* Enable this card */ | 28 | static int enable = SNDRV_DEFAULT_ENABLE1; /* Enable this card */ |
29 | static int nopcm; /* Disable PCM capability of the driver */ | ||
29 | 30 | ||
30 | module_param(index, int, 0444); | 31 | module_param(index, int, 0444); |
31 | MODULE_PARM_DESC(index, "Index value for pcsp soundcard."); | 32 | MODULE_PARM_DESC(index, "Index value for pcsp soundcard."); |
@@ -33,6 +34,8 @@ module_param(id, charp, 0444); | |||
33 | MODULE_PARM_DESC(id, "ID string for pcsp soundcard."); | 34 | MODULE_PARM_DESC(id, "ID string for pcsp soundcard."); |
34 | module_param(enable, bool, 0444); | 35 | module_param(enable, bool, 0444); |
35 | MODULE_PARM_DESC(enable, "Enable PC-Speaker sound."); | 36 | MODULE_PARM_DESC(enable, "Enable PC-Speaker sound."); |
37 | module_param(nopcm, bool, 0444); | ||
38 | MODULE_PARM_DESC(nopcm, "Disable PC-Speaker PCM sound. Only beeps remain."); | ||
36 | 39 | ||
37 | struct snd_pcsp pcsp_chip; | 40 | struct 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; |