diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2008-01-31 18:16:28 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-01-31 18:16:28 -0500 |
commit | e1a9c9872dd004617555dff079b357a6ffd945e9 (patch) | |
tree | c34779e59712ff345f8e4ee97e74086a85b34974 /sound/pci/pcxhr/pcxhr_mixer.c | |
parent | fcc3ff4f9d695a80dc6e6058e0d631a3026ed4c3 (diff) | |
parent | 2ecba4ffbbc6c85fce8c3878514be415edace413 (diff) |
Merge branch 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/perex/alsa
* 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/perex/alsa: (299 commits)
[ALSA] version 1.0.16rc2
[ALSA] hda: fix Mic in as output
[ALSA] emu10k1 - Another EMU0404 Board ID
[ALSA] emu10k1 - Fix kthread handling at resume
[ALSA] emu10k1: General cleanup, add new locks, fix alsa bug#3501, kernel bug#9304.
[ALSA] emu10k1 - Use enum for emu_model types
[ALSA] emu10k1 - Don't create emu1010 controls for non-emu boards
[ALSA] emu10k1 - 1616(M) cardbus improvements
[ALSA] snd:emu10k1: E-Mu updates. Fixes to firmware loading and support for 0404.
[ALSA] emu10k1: Add comments regarding E-Mu ins and outs.
[ALSA] oxygen: revert SPI clock frequency change for AK4396/WM8785
[ALSA] es1938 - improve capture hw pointer reads
[ALSA] HDA-Intel - Add support for Intel SCH
[ALSA] hda: Add GPIO mute support to STAC9205
[ALSA] hda-codec - Add Dell T3400 support
[ALSA] hda-codec - Add model for HP DV9553EG laptop
[ALSA] hda-codec - Control SPDIF as slave
[ALSA] hda_intel: ALSA HD Audio patch for Intel ICH10 DeviceID's
[ALSA] Fix Oops with PCM OSS sync
[ALSA] hda-codec - Add speaker automute to ALC262 HP models
...
Diffstat (limited to 'sound/pci/pcxhr/pcxhr_mixer.c')
-rw-r--r-- | sound/pci/pcxhr/pcxhr_mixer.c | 72 |
1 files changed, 50 insertions, 22 deletions
diff --git a/sound/pci/pcxhr/pcxhr_mixer.c b/sound/pci/pcxhr/pcxhr_mixer.c index 5f8d42633b04..aabc7bc5321e 100644 --- a/sound/pci/pcxhr/pcxhr_mixer.c +++ b/sound/pci/pcxhr/pcxhr_mixer.c | |||
@@ -21,7 +21,6 @@ | |||
21 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 21 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #include <sound/driver.h> | ||
25 | #include <linux/time.h> | 24 | #include <linux/time.h> |
26 | #include <linux/interrupt.h> | 25 | #include <linux/interrupt.h> |
27 | #include <linux/init.h> | 26 | #include <linux/init.h> |
@@ -120,8 +119,18 @@ static int pcxhr_analog_vol_put(struct snd_kcontrol *kcontrol, | |||
120 | is_capture = (kcontrol->private_value != 0); | 119 | is_capture = (kcontrol->private_value != 0); |
121 | for (i = 0; i < 2; i++) { | 120 | for (i = 0; i < 2; i++) { |
122 | int new_volume = ucontrol->value.integer.value[i]; | 121 | int new_volume = ucontrol->value.integer.value[i]; |
123 | int* stored_volume = is_capture ? &chip->analog_capture_volume[i] : | 122 | int *stored_volume = is_capture ? |
123 | &chip->analog_capture_volume[i] : | ||
124 | &chip->analog_playback_volume[i]; | 124 | &chip->analog_playback_volume[i]; |
125 | if (is_capture) { | ||
126 | if (new_volume < PCXHR_ANALOG_CAPTURE_LEVEL_MIN || | ||
127 | new_volume > PCXHR_ANALOG_CAPTURE_LEVEL_MAX) | ||
128 | continue; | ||
129 | } else { | ||
130 | if (new_volume < PCXHR_ANALOG_PLAYBACK_LEVEL_MIN || | ||
131 | new_volume > PCXHR_ANALOG_PLAYBACK_LEVEL_MAX) | ||
132 | continue; | ||
133 | } | ||
125 | if (*stored_volume != new_volume) { | 134 | if (*stored_volume != new_volume) { |
126 | *stored_volume = new_volume; | 135 | *stored_volume = new_volume; |
127 | changed = 1; | 136 | changed = 1; |
@@ -165,10 +174,13 @@ static int pcxhr_audio_sw_put(struct snd_kcontrol *kcontrol, | |||
165 | int i, changed = 0; | 174 | int i, changed = 0; |
166 | mutex_lock(&chip->mgr->mixer_mutex); | 175 | mutex_lock(&chip->mgr->mixer_mutex); |
167 | for(i = 0; i < 2; i++) { | 176 | for(i = 0; i < 2; i++) { |
168 | if (chip->analog_playback_active[i] != ucontrol->value.integer.value[i]) { | 177 | if (chip->analog_playback_active[i] != |
169 | chip->analog_playback_active[i] = ucontrol->value.integer.value[i]; | 178 | ucontrol->value.integer.value[i]) { |
179 | chip->analog_playback_active[i] = | ||
180 | !!ucontrol->value.integer.value[i]; | ||
170 | changed = 1; | 181 | changed = 1; |
171 | pcxhr_update_analog_audio_level(chip, 0, i); /* update playback levels */ | 182 | /* update playback levels */ |
183 | pcxhr_update_analog_audio_level(chip, 0, i); | ||
172 | } | 184 | } |
173 | } | 185 | } |
174 | mutex_unlock(&chip->mgr->mixer_mutex); | 186 | mutex_unlock(&chip->mgr->mixer_mutex); |
@@ -323,20 +335,24 @@ static int pcxhr_pcm_vol_put(struct snd_kcontrol *kcontrol, | |||
323 | int i; | 335 | int i; |
324 | 336 | ||
325 | mutex_lock(&chip->mgr->mixer_mutex); | 337 | mutex_lock(&chip->mgr->mixer_mutex); |
326 | if (is_capture) | 338 | if (is_capture) /* digital capture */ |
327 | stored_volume = chip->digital_capture_volume; /* digital capture */ | 339 | stored_volume = chip->digital_capture_volume; |
328 | else | 340 | else /* digital playback */ |
329 | stored_volume = chip->digital_playback_volume[idx]; /* digital playback */ | 341 | stored_volume = chip->digital_playback_volume[idx]; |
330 | for (i = 0; i < 2; i++) { | 342 | for (i = 0; i < 2; i++) { |
331 | if (stored_volume[i] != ucontrol->value.integer.value[i]) { | 343 | int vol = ucontrol->value.integer.value[i]; |
332 | stored_volume[i] = ucontrol->value.integer.value[i]; | 344 | if (vol < PCXHR_DIGITAL_LEVEL_MIN || |
345 | vol > PCXHR_DIGITAL_LEVEL_MAX) | ||
346 | continue; | ||
347 | if (stored_volume[i] != vol) { | ||
348 | stored_volume[i] = vol; | ||
333 | changed = 1; | 349 | changed = 1; |
334 | if (is_capture) /* update capture volume */ | 350 | if (is_capture) /* update capture volume */ |
335 | pcxhr_update_audio_pipe_level(chip, 1, i); | 351 | pcxhr_update_audio_pipe_level(chip, 1, i); |
336 | } | 352 | } |
337 | } | 353 | } |
338 | if (! is_capture && changed) | 354 | if (!is_capture && changed) /* update playback volume */ |
339 | pcxhr_update_playback_stream_level(chip, idx); /* update playback volume */ | 355 | pcxhr_update_playback_stream_level(chip, idx); |
340 | mutex_unlock(&chip->mgr->mixer_mutex); | 356 | mutex_unlock(&chip->mgr->mixer_mutex); |
341 | return changed; | 357 | return changed; |
342 | } | 358 | } |
@@ -378,8 +394,10 @@ static int pcxhr_pcm_sw_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_v | |||
378 | mutex_lock(&chip->mgr->mixer_mutex); | 394 | mutex_lock(&chip->mgr->mixer_mutex); |
379 | j = idx; | 395 | j = idx; |
380 | for (i = 0; i < 2; i++) { | 396 | for (i = 0; i < 2; i++) { |
381 | if (chip->digital_playback_active[j][i] != ucontrol->value.integer.value[i]) { | 397 | if (chip->digital_playback_active[j][i] != |
382 | chip->digital_playback_active[j][i] = ucontrol->value.integer.value[i]; | 398 | ucontrol->value.integer.value[i]) { |
399 | chip->digital_playback_active[j][i] = | ||
400 | !!ucontrol->value.integer.value[i]; | ||
383 | changed = 1; | 401 | changed = 1; |
384 | } | 402 | } |
385 | } | 403 | } |
@@ -423,10 +441,13 @@ static int pcxhr_monitor_vol_put(struct snd_kcontrol *kcontrol, | |||
423 | 441 | ||
424 | mutex_lock(&chip->mgr->mixer_mutex); | 442 | mutex_lock(&chip->mgr->mixer_mutex); |
425 | for (i = 0; i < 2; i++) { | 443 | for (i = 0; i < 2; i++) { |
426 | if (chip->monitoring_volume[i] != ucontrol->value.integer.value[i]) { | 444 | if (chip->monitoring_volume[i] != |
427 | chip->monitoring_volume[i] = ucontrol->value.integer.value[i]; | 445 | ucontrol->value.integer.value[i]) { |
428 | if(chip->monitoring_active[i]) /* do only when monitoring is unmuted */ | 446 | chip->monitoring_volume[i] = |
447 | !!ucontrol->value.integer.value[i]; | ||
448 | if(chip->monitoring_active[i]) | ||
429 | /* update monitoring volume and mute */ | 449 | /* update monitoring volume and mute */ |
450 | /* do only when monitoring is unmuted */ | ||
430 | pcxhr_update_audio_pipe_level(chip, 0, i); | 451 | pcxhr_update_audio_pipe_level(chip, 0, i); |
431 | changed = 1; | 452 | changed = 1; |
432 | } | 453 | } |
@@ -470,15 +491,17 @@ static int pcxhr_monitor_sw_put(struct snd_kcontrol *kcontrol, | |||
470 | 491 | ||
471 | mutex_lock(&chip->mgr->mixer_mutex); | 492 | mutex_lock(&chip->mgr->mixer_mutex); |
472 | for (i = 0; i < 2; i++) { | 493 | for (i = 0; i < 2; i++) { |
473 | if (chip->monitoring_active[i] != ucontrol->value.integer.value[i]) { | 494 | if (chip->monitoring_active[i] != |
474 | chip->monitoring_active[i] = ucontrol->value.integer.value[i]; | 495 | ucontrol->value.integer.value[i]) { |
496 | chip->monitoring_active[i] = | ||
497 | !!ucontrol->value.integer.value[i]; | ||
475 | changed |= (1<<i); /* mask 0x01 and 0x02 */ | 498 | changed |= (1<<i); /* mask 0x01 and 0x02 */ |
476 | } | 499 | } |
477 | } | 500 | } |
478 | if(changed & 0x01) | 501 | if (changed & 0x01) |
479 | /* update left monitoring volume and mute */ | 502 | /* update left monitoring volume and mute */ |
480 | pcxhr_update_audio_pipe_level(chip, 0, 0); | 503 | pcxhr_update_audio_pipe_level(chip, 0, 0); |
481 | if(changed & 0x02) | 504 | if (changed & 0x02) |
482 | /* update right monitoring volume and mute */ | 505 | /* update right monitoring volume and mute */ |
483 | pcxhr_update_audio_pipe_level(chip, 0, 1); | 506 | pcxhr_update_audio_pipe_level(chip, 0, 1); |
484 | 507 | ||
@@ -579,6 +602,8 @@ static int pcxhr_audio_src_put(struct snd_kcontrol *kcontrol, | |||
579 | struct snd_pcxhr *chip = snd_kcontrol_chip(kcontrol); | 602 | struct snd_pcxhr *chip = snd_kcontrol_chip(kcontrol); |
580 | int ret = 0; | 603 | int ret = 0; |
581 | 604 | ||
605 | if (ucontrol->value.enumerated.item[0] >= 3) | ||
606 | return -EINVAL; | ||
582 | mutex_lock(&chip->mgr->mixer_mutex); | 607 | mutex_lock(&chip->mgr->mixer_mutex); |
583 | if (chip->audio_capture_source != ucontrol->value.enumerated.item[0]) { | 608 | if (chip->audio_capture_source != ucontrol->value.enumerated.item[0]) { |
584 | chip->audio_capture_source = ucontrol->value.enumerated.item[0]; | 609 | chip->audio_capture_source = ucontrol->value.enumerated.item[0]; |
@@ -642,8 +667,11 @@ static int pcxhr_clock_type_put(struct snd_kcontrol *kcontrol, | |||
642 | struct snd_ctl_elem_value *ucontrol) | 667 | struct snd_ctl_elem_value *ucontrol) |
643 | { | 668 | { |
644 | struct pcxhr_mgr *mgr = snd_kcontrol_chip(kcontrol); | 669 | struct pcxhr_mgr *mgr = snd_kcontrol_chip(kcontrol); |
670 | unsigned int clock_items = 3 + mgr->capture_chips; | ||
645 | int rate, ret = 0; | 671 | int rate, ret = 0; |
646 | 672 | ||
673 | if (ucontrol->value.enumerated.item[0] >= clock_items) | ||
674 | return -EINVAL; | ||
647 | mutex_lock(&mgr->mixer_mutex); | 675 | mutex_lock(&mgr->mixer_mutex); |
648 | if (mgr->use_clock_type != ucontrol->value.enumerated.item[0]) { | 676 | if (mgr->use_clock_type != ucontrol->value.enumerated.item[0]) { |
649 | mutex_lock(&mgr->setup_mutex); | 677 | mutex_lock(&mgr->setup_mutex); |