44 chip->
ops->write_codec(chip, codec, data);
45 spin_unlock_irqrestore(&chip->
lock, flags);
53 #ifdef SNDRV_BIG_ENDIAN
78 #define SET_CDC_DATA_SEL(di,s) ((di).b.mh = (u8) (s))
79 #define SET_CDC_DATA_REG(di,r) ((di).b.ml = (u8) (r))
80 #define SET_CDC_DATA_VAL(di,d) ((di).b.ll = (u8) (d))
81 #define SET_CDC_DATA_INIT(di) ((di).l = 0L, SET_CDC_DATA_SEL(di,XX_CODEC_SELECTOR))
89 static void vx_set_codec_reg(
struct vx_core *chip,
int codec,
int reg,
int val)
96 vx_write_codec_reg(chip, codec, data.
l);
106 static void vx_set_analog_output_level(
struct vx_core *chip,
int codec,
int left,
int right)
108 left = chip->
hw->output_level_max -
left;
109 right = chip->
hw->output_level_max -
right;
111 if (chip->
ops->akm_write) {
127 #define DAC_ATTEN_MIN 0x08
128 #define DAC_ATTEN_MAX 0x38
133 for (i = 0; i < chip->
hw->num_codecs; i++) {
134 if (chip->
ops->akm_write)
150 chip->
ops->reset_codec(chip);
153 if (! chip->
ops->akm_write) {
155 for (i = 0; i < chip->
hw->num_codecs; i++) {
168 for (i = 0; i < chip->
hw->num_codecs; i++) {
171 vx_set_analog_output_level(chip, i, 0, 0);
179 static void vx_change_audio_source(
struct vx_core *chip,
int src)
187 chip->
ops->change_audio_source(chip, src);
188 spin_unlock_irqrestore(&chip->
lock, flags);
221 static int vx_adjust_audio_level(
struct vx_core *chip,
int audio,
int capture,
260 static int vx_read_audio_level(
struct vx_core *chip,
int audio,
int capture,
266 memset(info, 0,
sizeof(*info));
291 memset(&info, 0,
sizeof(info));
298 return vx_adjust_audio_level(chip, audio, 0, &info);
305 static int vx_set_audio_switch(
struct vx_core *chip,
int audio,
int active)
309 memset(&info, 0,
sizeof(info));
313 return vx_adjust_audio_level(chip, audio, 0, &info);
319 static int vx_set_audio_gain(
struct vx_core *chip,
int audio,
int capture,
int level)
323 memset(&info, 0,
sizeof(info));
327 return vx_adjust_audio_level(chip, audio, capture, &info);
333 static void vx_reset_audio_levels(
struct vx_core *chip)
343 for (c = 0; c < 2; c++) {
344 for (i = 0; i < chip->
hw->num_ins * 2; i++) {
345 memset(&info, 0,
sizeof(info));
353 vx_adjust_audio_level(chip, i, c, &info);
365 #define VU_METER_CHANNELS 2
379 static int vx_get_audio_vu_meter(
struct vx_core *chip,
int audio,
int capture,
struct vx_vu_meter *info)
395 rmh.
Cmd[1] |= 1 << (audio + i);
430 int codec = kcontrol->
id.index;
441 int codec = kcontrol->
id.index;
442 unsigned int val[2], vmax;
444 vmax = chip->
hw->output_level_max;
445 val[0] = ucontrol->
value.integer.value[0];
446 val[1] = ucontrol->
value.integer.value[1];
447 if (val[0] > vmax || val[1] > vmax)
452 vx_set_analog_output_level(chip, codec, val[0], val[1]);
466 .
name =
"Master Playback Volume",
467 .info = vx_output_level_info,
468 .
get = vx_output_level_get,
469 .
put = vx_output_level_put,
478 static char *texts_mic[3] = {
479 "Digital",
"Line",
"Mic"
481 static char *texts_vx2[2] = {
516 if (ucontrol->
value.enumerated.item[0] > 2)
519 if (ucontrol->
value.enumerated.item[0] > 1)
535 .name =
"Capture Source",
536 .info = vx_audio_src_info,
537 .get = vx_audio_src_get,
538 .put = vx_audio_src_put,
546 static char *texts[3] = {
547 "Auto",
"Internal",
"External"
571 if (ucontrol->
value.enumerated.item[0] > 2)
586 .name =
"Clock Mode",
587 .info = vx_clock_mode_info,
588 .get = vx_clock_mode_get,
589 .put = vx_clock_mode_put,
624 val[0] = ucontrol->
value.integer.value[0];
625 val[1] = ucontrol->
value.integer.value[1];
629 if (val[0] != chip->
audio_gain[capture][audio] ||
630 val[1] != chip->
audio_gain[capture][audio+1]) {
631 vx_set_audio_gain(chip, audio, capture, val[0]);
632 vx_set_audio_gain(chip, audio+1, capture, val[1]);
658 val[0] = ucontrol->
value.integer.value[0];
659 val[1] = ucontrol->
value.integer.value[1];
677 #define vx_audio_sw_info snd_ctl_boolean_stereo_info
699 vx_set_audio_switch(chip, audio,
700 !!ucontrol->
value.integer.value[0]);
701 vx_set_audio_switch(chip, audio+1,
702 !!ucontrol->
value.integer.value[1]);
731 !!ucontrol->
value.integer.value[0]);
733 !!ucontrol->
value.integer.value[1]);
748 .info = vx_audio_gain_info,
749 .
get = vx_audio_gain_get,
750 .
put = vx_audio_gain_put,
751 .
tlv = { .p = db_scale_audio_gain },
755 .name =
"PCM Playback Switch",
757 .get = vx_audio_sw_get,
758 .put = vx_audio_sw_put
762 .name =
"Monitoring Volume",
765 .info = vx_audio_gain_info,
766 .
get = vx_audio_monitor_get,
767 .
put = vx_audio_monitor_put,
768 .
tlv = { .p = db_scale_audio_gain },
772 .name =
"Monitoring Switch",
774 .get = vx_monitor_sw_get,
775 .put = vx_monitor_sw_put
794 ucontrol->
value.iec958.status[0] = (chip->
uer_bits >> 0) & 0xff;
795 ucontrol->
value.iec958.status[1] = (chip->
uer_bits >> 8) & 0xff;
796 ucontrol->
value.iec958.status[2] = (chip->
uer_bits >> 16) & 0xff;
797 ucontrol->
value.iec958.status[3] = (chip->
uer_bits >> 24) & 0xff;
804 ucontrol->
value.iec958.status[0] = 0xff;
805 ucontrol->
value.iec958.status[1] = 0xff;
806 ucontrol->
value.iec958.status[2] = 0xff;
807 ucontrol->
value.iec958.status[3] = 0xff;
816 val = (ucontrol->
value.iec958.status[0] << 0) |
817 (ucontrol->
value.iec958.status[1] << 8) |
818 (ucontrol->
value.iec958.status[2] << 16) |
819 (ucontrol->
value.iec958.status[3] << 24);
835 .info = vx_iec958_info,
836 .get = vx_iec958_mask_get,
842 .info = vx_iec958_info,
843 .get = vx_iec958_get,
852 #define METER_MAX 0xff
853 #define METER_SHIFT 16
871 vx_get_audio_vu_meter(chip, audio, capture, meter);
884 vx_get_audio_vu_meter(chip, audio, capture, meter);
890 #define vx_saturation_info snd_ctl_boolean_stereo_info
898 vx_get_audio_vu_meter(chip, audio, 1, meter);
908 .info = vx_vu_meter_info,
909 .get = vx_vu_meter_get,
916 .info = vx_vu_meter_info,
917 .get = vx_peak_meter_get,
922 .name =
"Input Saturation",
925 .get = vx_saturation_get,
945 for (i = 0; i < chip->
hw->num_outs; i++) {
946 temp = vx_control_output_level;
948 temp.
tlv.
p = chip->
hw->output_level_db_scale;
954 for (i = 0; i < chip->
hw->num_outs; i++) {
956 temp = vx_control_audio_gain;
958 temp.
name =
"PCM Playback Volume";
962 temp = vx_control_output_switch;
967 temp = vx_control_monitor_gain;
972 temp = vx_control_monitor_switch;
978 for (i = 0; i < chip->
hw->num_outs; i++) {
979 temp = vx_control_audio_gain;
981 temp.
name =
"PCM Capture Volume";
999 for (c = 0; c < 2; c++) {
1000 static char *
dir[2] = {
"Output",
"Input" };
1001 for (i = 0; i < chip->
hw->num_ins; i++) {
1002 int val = (i * 2) | (c << 8);
1004 temp = vx_control_saturation;
1010 sprintf(name,
"%s VU Meter", dir[c]);
1011 temp = vx_control_vu_meter;
1017 sprintf(name,
"%s Peak Meter", dir[c]);
1018 temp = vx_control_peak_meter;
1026 vx_reset_audio_levels(chip);