diff options
author | Stas Sergeev <stsp@aknet.ru> | 2009-11-01 05:13:19 -0500 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2009-11-01 05:13:19 -0500 |
commit | bcc2c6b7cb320d10c7fcccd87dce87f4384b4332 (patch) | |
tree | 24663a166d0f4d6901eafad9294e7e54647b5442 /sound/drivers/pcsp/pcsp_mixer.c | |
parent | e87a3dd33eab30b4db539500064a9584867e4f2c (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_mixer.c')
-rw-r--r-- | sound/drivers/pcsp/pcsp_mixer.c | 33 |
1 files changed, 26 insertions, 7 deletions
diff --git a/sound/drivers/pcsp/pcsp_mixer.c b/sound/drivers/pcsp/pcsp_mixer.c index 903bc846763f..02e05552632b 100644 --- a/sound/drivers/pcsp/pcsp_mixer.c +++ b/sound/drivers/pcsp/pcsp_mixer.c | |||
@@ -119,24 +119,43 @@ static int pcsp_pcspkr_put(struct snd_kcontrol *kcontrol, | |||
119 | .put = pcsp_##ctl_type##_put, \ | 119 | .put = pcsp_##ctl_type##_put, \ |
120 | } | 120 | } |
121 | 121 | ||
122 | static struct snd_kcontrol_new __devinitdata snd_pcsp_controls[] = { | 122 | static struct snd_kcontrol_new __devinitdata snd_pcsp_controls_pcm[] = { |
123 | PCSP_MIXER_CONTROL(enable, "Master Playback Switch"), | 123 | PCSP_MIXER_CONTROL(enable, "Master Playback Switch"), |
124 | PCSP_MIXER_CONTROL(treble, "BaseFRQ Playback Volume"), | 124 | PCSP_MIXER_CONTROL(treble, "BaseFRQ Playback Volume"), |
125 | }; | ||
126 | |||
127 | static struct snd_kcontrol_new __devinitdata snd_pcsp_controls_spkr[] = { | ||
125 | PCSP_MIXER_CONTROL(pcspkr, "PC Speaker Playback Switch"), | 128 | PCSP_MIXER_CONTROL(pcspkr, "PC Speaker Playback Switch"), |
126 | }; | 129 | }; |
127 | 130 | ||
128 | int __devinit snd_pcsp_new_mixer(struct snd_pcsp *chip) | 131 | static int __devinit snd_pcsp_ctls_add(struct snd_pcsp *chip, |
132 | struct snd_kcontrol_new *ctls, int num) | ||
129 | { | 133 | { |
130 | struct snd_card *card = chip->card; | ||
131 | int i, err; | 134 | int i, err; |
135 | struct snd_card *card = chip->card; | ||
136 | for (i = 0; i < num; i++) { | ||
137 | err = snd_ctl_add(card, snd_ctl_new1(ctls + i, chip)); | ||
138 | if (err < 0) | ||
139 | return err; | ||
140 | } | ||
141 | return 0; | ||
142 | } | ||
143 | |||
144 | int __devinit snd_pcsp_new_mixer(struct snd_pcsp *chip, int nopcm) | ||
145 | { | ||
146 | int err; | ||
147 | struct snd_card *card = chip->card; | ||
132 | 148 | ||
133 | for (i = 0; i < ARRAY_SIZE(snd_pcsp_controls); i++) { | 149 | if (!nopcm) { |
134 | err = snd_ctl_add(card, | 150 | err = snd_pcsp_ctls_add(chip, snd_pcsp_controls_pcm, |
135 | snd_ctl_new1(snd_pcsp_controls + i, | 151 | ARRAY_SIZE(snd_pcsp_controls_pcm)); |
136 | chip)); | ||
137 | if (err < 0) | 152 | if (err < 0) |
138 | return err; | 153 | return err; |
139 | } | 154 | } |
155 | err = snd_pcsp_ctls_add(chip, snd_pcsp_controls_spkr, | ||
156 | ARRAY_SIZE(snd_pcsp_controls_spkr)); | ||
157 | if (err < 0) | ||
158 | return err; | ||
140 | 159 | ||
141 | strcpy(card->mixername, "PC-Speaker"); | 160 | strcpy(card->mixername, "PC-Speaker"); |
142 | 161 | ||