Lines Matching refs:chip
32 static int read_dsp(struct echoaudio *chip, u32 *data);
33 static int set_professional_spdif(struct echoaudio *chip, char prof);
34 static int load_asic_generic(struct echoaudio *chip, u32 cmd, short asic);
35 static int check_asic_status(struct echoaudio *chip);
36 static int update_flags(struct echoaudio *chip);
39 static int init_hw(struct echoaudio *chip, u16 device_id, u16 subdevice_id)
46 if ((err = init_dsp_comm_page(chip))) {
47 dev_err(chip->card->dev,
52 chip->device_id = device_id;
53 chip->subdevice_id = subdevice_id;
54 chip->bad_board = true;
55 chip->has_midi = true;
56 chip->dsp_code_to_load = FW_LAYLA20_DSP;
57 chip->input_clock_types =
60 chip->output_clock_types =
63 if ((err = load_firmware(chip)) < 0)
65 chip->bad_board = false;
72 static int set_mixer_defaults(struct echoaudio *chip)
74 chip->professional_spdif = false;
75 return init_line_levels(chip);
80 static u32 detect_input_clocks(const struct echoaudio *chip)
85 clocks_from_dsp = le32_to_cpu(chip->comm_page->status_clocks);
111 static int check_asic_status(struct echoaudio *chip)
116 chip->asic_loaded = false;
118 send_vector(chip, DSP_VC_TEST_ASIC);
122 if (read_dsp(chip, &asic_status) < 0) {
123 dev_err(chip->card->dev,
130 chip->asic_loaded = true;
141 static int load_asic(struct echoaudio *chip)
145 if (chip->asic_loaded)
148 err = load_asic_generic(chip, DSP_FNC_LOAD_LAYLA_ASIC,
154 return check_asic_status(chip);
159 static int set_sample_rate(struct echoaudio *chip, u32 rate)
166 if (chip->input_clock != ECHO_CLOCK_INTERNAL) {
167 dev_warn(chip->card->dev,
169 chip->comm_page->sample_rate = cpu_to_le32(rate);
170 chip->sample_rate = rate;
174 if (wait_handshake(chip))
177 dev_dbg(chip->card->dev, "set_sample_rate(%d)\n", rate);
178 chip->sample_rate = rate;
179 chip->comm_page->sample_rate = cpu_to_le32(rate);
180 clear_handshake(chip);
181 return send_vector(chip, DSP_VC_SET_LAYLA_SAMPLE_RATE);
186 static int set_input_clock(struct echoaudio *chip, u16 clock_source)
194 rate = chip->sample_rate;
207 dev_err(chip->card->dev,
212 chip->input_clock = clock_source;
214 chip->comm_page->input_clock = cpu_to_le16(clock);
215 clear_handshake(chip);
216 send_vector(chip, DSP_VC_UPDATE_CLOCKS);
219 set_sample_rate(chip, rate);
226 static int set_output_clock(struct echoaudio *chip, u16 clock)
236 dev_err(chip->card->dev, "set_output_clock wrong clock\n");
240 if (wait_handshake(chip))
243 chip->comm_page->output_clock = cpu_to_le16(clock);
244 chip->output_clock = clock;
245 clear_handshake(chip);
246 return send_vector(chip, DSP_VC_UPDATE_CLOCKS);
252 static int set_input_gain(struct echoaudio *chip, u16 input, int gain)
254 if (snd_BUG_ON(input >= num_busses_in(chip)))
257 if (wait_handshake(chip))
260 chip->input_gain[input] = gain;
262 chip->comm_page->line_in_level[input] = gain;
269 static int update_flags(struct echoaudio *chip)
271 if (wait_handshake(chip))
273 clear_handshake(chip);
274 return send_vector(chip, DSP_VC_UPDATE_FLAGS);
279 static int set_professional_spdif(struct echoaudio *chip, char prof)
282 chip->comm_page->flags |=
285 chip->comm_page->flags &=
287 chip->professional_spdif = prof;
288 return update_flags(chip);