0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032 static int set_vmixer_gain(struct echoaudio *chip, u16 output, u16 pipe,
0033 int gain);
0034 static int update_vmixer_level(struct echoaudio *chip);
0035
0036
0037 static int init_hw(struct echoaudio *chip, u16 device_id, u16 subdevice_id)
0038 {
0039 int err;
0040
0041 if (snd_BUG_ON((subdevice_id & 0xfff0) != INDIGO))
0042 return -ENODEV;
0043
0044 err = init_dsp_comm_page(chip);
0045 if (err) {
0046 dev_err(chip->card->dev,
0047 "init_hw - could not initialize DSP comm page\n");
0048 return err;
0049 }
0050
0051 chip->device_id = device_id;
0052 chip->subdevice_id = subdevice_id;
0053 chip->bad_board = true;
0054 chip->dsp_code_to_load = FW_INDIGO_DSP;
0055
0056
0057 chip->asic_loaded = true;
0058 chip->input_clock_types = ECHO_CLOCK_BIT_INTERNAL;
0059
0060 err = load_firmware(chip);
0061 if (err < 0)
0062 return err;
0063 chip->bad_board = false;
0064
0065 return err;
0066 }
0067
0068
0069
0070 static int set_mixer_defaults(struct echoaudio *chip)
0071 {
0072 return init_line_levels(chip);
0073 }
0074
0075
0076
0077 static u32 detect_input_clocks(const struct echoaudio *chip)
0078 {
0079 return ECHO_CLOCK_BIT_INTERNAL;
0080 }
0081
0082
0083
0084
0085 static int load_asic(struct echoaudio *chip)
0086 {
0087 return 0;
0088 }
0089
0090
0091
0092 static int set_sample_rate(struct echoaudio *chip, u32 rate)
0093 {
0094 u32 control_reg;
0095
0096 switch (rate) {
0097 case 96000:
0098 control_reg = MIA_96000;
0099 break;
0100 case 88200:
0101 control_reg = MIA_88200;
0102 break;
0103 case 48000:
0104 control_reg = MIA_48000;
0105 break;
0106 case 44100:
0107 control_reg = MIA_44100;
0108 break;
0109 case 32000:
0110 control_reg = MIA_32000;
0111 break;
0112 default:
0113 dev_err(chip->card->dev,
0114 "set_sample_rate: %d invalid!\n", rate);
0115 return -EINVAL;
0116 }
0117
0118
0119 if (control_reg != le32_to_cpu(chip->comm_page->control_register)) {
0120 if (wait_handshake(chip))
0121 return -EIO;
0122
0123 chip->comm_page->sample_rate = cpu_to_le32(rate);
0124 chip->comm_page->control_register = cpu_to_le32(control_reg);
0125 chip->sample_rate = rate;
0126
0127 clear_handshake(chip);
0128 return send_vector(chip, DSP_VC_UPDATE_CLOCKS);
0129 }
0130 return 0;
0131 }
0132
0133
0134
0135
0136 static int set_vmixer_gain(struct echoaudio *chip, u16 output, u16 pipe,
0137 int gain)
0138 {
0139 int index;
0140
0141 if (snd_BUG_ON(pipe >= num_pipes_out(chip) ||
0142 output >= num_busses_out(chip)))
0143 return -EINVAL;
0144
0145 if (wait_handshake(chip))
0146 return -EIO;
0147
0148 chip->vmixer_gain[output][pipe] = gain;
0149 index = output * num_pipes_out(chip) + pipe;
0150 chip->comm_page->vmixer[index] = gain;
0151
0152 dev_dbg(chip->card->dev,
0153 "set_vmixer_gain: pipe %d, out %d = %d\n", pipe, output, gain);
0154 return 0;
0155 }
0156
0157
0158
0159
0160 static int update_vmixer_level(struct echoaudio *chip)
0161 {
0162 if (wait_handshake(chip))
0163 return -EIO;
0164 clear_handshake(chip);
0165 return send_vector(chip, DSP_VC_SET_VMIXER_GAIN);
0166 }
0167