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_IO))
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_IO_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 if (wait_handshake(chip))
0095 return -EIO;
0096
0097 chip->sample_rate = rate;
0098 chip->comm_page->sample_rate = cpu_to_le32(rate);
0099 clear_handshake(chip);
0100 return send_vector(chip, DSP_VC_UPDATE_CLOCKS);
0101 }
0102
0103
0104
0105
0106 static int set_vmixer_gain(struct echoaudio *chip, u16 output, u16 pipe,
0107 int gain)
0108 {
0109 int index;
0110
0111 if (snd_BUG_ON(pipe >= num_pipes_out(chip) ||
0112 output >= num_busses_out(chip)))
0113 return -EINVAL;
0114
0115 if (wait_handshake(chip))
0116 return -EIO;
0117
0118 chip->vmixer_gain[output][pipe] = gain;
0119 index = output * num_pipes_out(chip) + pipe;
0120 chip->comm_page->vmixer[index] = gain;
0121
0122 dev_dbg(chip->card->dev,
0123 "set_vmixer_gain: pipe %d, out %d = %d\n", pipe, output, gain);
0124 return 0;
0125 }
0126
0127
0128
0129
0130 static int update_vmixer_level(struct echoaudio *chip)
0131 {
0132 if (wait_handshake(chip))
0133 return -EIO;
0134 clear_handshake(chip);
0135 return send_vector(chip, DSP_VC_SET_VMIXER_GAIN);
0136 }
0137