static void pcxhr_init_audio_levels(struct snd_pcxhr *chip) { int i; for (i = 0; i < 2; i++) { if (chip->nb_streams_play) { int j; for (j = 0; j < PCXHR_PLAYBACK_STREAMS; j++) { chip->digital_playback_active[j][i] = 1; chip->digital_playback_volume[j][i] = PCXHR_DIGITAL_ZERO_LEVEL; } chip->aes_bits[0] = (IEC958_AES0_PROFESSIONAL | IEC958_AES0_PRO_FS_48000); #ifdef CONFIG_SND_DEBUG chip->analog_playback_active[i] = 1; if (chip->mgr->is_hr_stereo) chip->analog_playback_volume[i] = HR222_LINE_PLAYBACK_ZERO_LEVEL; else { chip->analog_playback_volume[i] = PCXHR_LINE_PLAYBACK_ZERO_LEVEL; pcxhr_update_analog_audio_level(chip, 0, i); } #endif if (chip->mgr->is_hr_stereo) hr222_update_analog_audio_level(chip, 0, i); } if (chip->nb_streams_capt) { chip->digital_capture_volume[i] = PCXHR_DIGITAL_ZERO_LEVEL; chip->analog_capture_active = 1; #ifdef CONFIG_SND_DEBUG if (chip->mgr->is_hr_stereo) chip->analog_capture_volume[i] = HR222_LINE_CAPTURE_ZERO_LEVEL; else { chip->analog_capture_volume[i] = PCXHR_LINE_CAPTURE_ZERO_LEVEL; pcxhr_update_analog_audio_level(chip, 1, i); } #endif if (chip->mgr->is_hr_stereo) hr222_update_analog_audio_level(chip, 1, i); } } return; }
static int pcxhr_analog_vol_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { struct snd_pcxhr *chip = snd_kcontrol_chip(kcontrol); int changed = 0; int is_capture, i; mutex_lock(&chip->mgr->mixer_mutex); is_capture = (kcontrol->private_value != 0); for (i = 0; i < 2; i++) { int new_volume = ucontrol->value.integer.value[i]; int *stored_volume = is_capture ? &chip->analog_capture_volume[i] : &chip->analog_playback_volume[i]; if (is_capture) { if (new_volume < PCXHR_ANALOG_CAPTURE_LEVEL_MIN || new_volume > PCXHR_ANALOG_CAPTURE_LEVEL_MAX) continue; } else { if (new_volume < PCXHR_ANALOG_PLAYBACK_LEVEL_MIN || new_volume > PCXHR_ANALOG_PLAYBACK_LEVEL_MAX) continue; } if (*stored_volume != new_volume) { *stored_volume = new_volume; changed = 1; pcxhr_update_analog_audio_level(chip, is_capture, i); } } mutex_unlock(&chip->mgr->mixer_mutex); return changed; }
static void pcxhr_init_audio_levels(struct snd_pcxhr *chip) { int i; for (i = 0; i < 2; i++) { if (chip->nb_streams_play) { int j; /* at boot time the digital volumes are unmuted 0dB */ for (j = 0; j < PCXHR_PLAYBACK_STREAMS; j++) { chip->digital_playback_active[j][i] = 1; chip->digital_playback_volume[j][i] = PCXHR_DIGITAL_ZERO_LEVEL; } /* after boot, only two bits are set on the uer interface */ chip->aes_bits[0] = IEC958_AES0_PROFESSIONAL | IEC958_AES0_PRO_FS_48000; /* only for test purpose, remove later */ #ifdef CONFIG_SND_DEBUG /* analog volumes for playback (is LEVEL_MIN after boot) */ chip->analog_playback_active[i] = 1; chip->analog_playback_volume[i] = PCXHR_ANALOG_PLAYBACK_ZERO_LEVEL; pcxhr_update_analog_audio_level(chip, 0, i); #endif /* test end */ } if (chip->nb_streams_capt) { /* at boot time the digital volumes are unmuted 0dB */ chip->digital_capture_volume[i] = PCXHR_DIGITAL_ZERO_LEVEL; /* only for test purpose, remove later */ #ifdef CONFIG_SND_DEBUG /* analog volumes for playback (is LEVEL_MIN after boot) */ chip->analog_capture_volume[i] = PCXHR_ANALOG_CAPTURE_ZERO_LEVEL; pcxhr_update_analog_audio_level(chip, 1, i); #endif /* test end */ } } return; }
static int pcxhr_audio_sw_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { struct snd_pcxhr *chip = snd_kcontrol_chip(kcontrol); int i, changed = 0; down(&chip->mgr->mixer_mutex); for(i = 0; i < 2; i++) { if (chip->analog_playback_active[i] != ucontrol->value.integer.value[i]) { chip->analog_playback_active[i] = ucontrol->value.integer.value[i]; changed = 1; pcxhr_update_analog_audio_level(chip, 0, i); /* update playback levels */ } } up(&chip->mgr->mixer_mutex); return changed; }
static int pcxhr_audio_sw_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { struct snd_pcxhr *chip = snd_kcontrol_chip(kcontrol); int i, changed = 0; mutex_lock(&chip->mgr->mixer_mutex); for(i = 0; i < 2; i++) { if (chip->analog_playback_active[i] != ucontrol->value.integer.value[i]) { chip->analog_playback_active[i] = !!ucontrol->value.integer.value[i]; changed = 1; if (chip->mgr->is_hr_stereo) hr222_update_analog_audio_level(chip, 0, i); else pcxhr_update_analog_audio_level(chip, 0, i); } } mutex_unlock(&chip->mgr->mixer_mutex); return changed; }
static int pcxhr_analog_vol_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { struct snd_pcxhr *chip = snd_kcontrol_chip(kcontrol); int changed = 0; int is_capture, i; down(&chip->mgr->mixer_mutex); is_capture = (kcontrol->private_value != 0); for (i = 0; i < 2; i++) { int new_volume = ucontrol->value.integer.value[i]; int* stored_volume = is_capture ? &chip->analog_capture_volume[i] : &chip->analog_playback_volume[i]; if (*stored_volume != new_volume) { *stored_volume = new_volume; changed = 1; pcxhr_update_analog_audio_level(chip, is_capture, i); } } up(&chip->mgr->mixer_mutex); return changed; }
static void pcxhr_init_audio_levels(struct snd_pcxhr *chip) { int i; for (i = 0; i < 2; i++) { if (chip->nb_streams_play) { int j; /* at boot time the digital volumes are unmuted 0dB */ for (j = 0; j < PCXHR_PLAYBACK_STREAMS; j++) { chip->digital_playback_active[j][i] = 1; chip->digital_playback_volume[j][i] = PCXHR_DIGITAL_ZERO_LEVEL; } /* after boot, only two bits are set on the uer * interface */ chip->aes_bits[0] = (IEC958_AES0_PROFESSIONAL | IEC958_AES0_PRO_FS_48000); #ifdef CONFIG_SND_DEBUG /* analog volumes for playback * (is LEVEL_MIN after boot) */ chip->analog_playback_active[i] = 1; if (chip->mgr->is_hr_stereo) chip->analog_playback_volume[i] = HR222_LINE_PLAYBACK_ZERO_LEVEL; else { chip->analog_playback_volume[i] = PCXHR_LINE_PLAYBACK_ZERO_LEVEL; pcxhr_update_analog_audio_level(chip, 0, i); } #endif /* stereo cards need to be initialised after boot */ if (chip->mgr->is_hr_stereo) hr222_update_analog_audio_level(chip, 0, i); } if (chip->nb_streams_capt) { /* at boot time the digital volumes are unmuted 0dB */ chip->digital_capture_volume[i] = PCXHR_DIGITAL_ZERO_LEVEL; chip->analog_capture_active = 1; #ifdef CONFIG_SND_DEBUG /* analog volumes for playback * (is LEVEL_MIN after boot) */ if (chip->mgr->is_hr_stereo) chip->analog_capture_volume[i] = HR222_LINE_CAPTURE_ZERO_LEVEL; else { chip->analog_capture_volume[i] = PCXHR_LINE_CAPTURE_ZERO_LEVEL; pcxhr_update_analog_audio_level(chip, 1, i); } #endif /* stereo cards need to be initialised after boot */ if (chip->mgr->is_hr_stereo) hr222_update_analog_audio_level(chip, 1, i); } } return; }