40 if (wait_handshake(chip))
45 clear_handshake(chip);
48 if (wait_handshake(chip)) {
54 DE_INIT((
"box_status=%x\n", box_status));
76 if (wait_handshake(chip))
79 DE_ACT((
"WriteControlReg: Setting 0x%x, 0x%x\n", ctl, frq));
84 if (ctl != chip->
comm_page->control_register ||
85 frq != chip->
comm_page->e3g_frq_register || force) {
88 clear_handshake(chip);
92 DE_ACT((
"WriteControlReg: not written, no change\n"));
112 err = dsp_set_digital_mode(chip, mode);
117 if (err >= 0 && previous_mode != mode &&
119 spin_lock_irq(&chip->
lock);
120 for (o = 0; o < num_busses_out(chip); o++)
121 for (i = 0; i < num_busses_in(chip); i++)
122 set_monitor_gain(chip, o, i,
125 #ifdef ECHOCARD_HAS_INPUT_GAIN
126 for (i = 0; i < num_busses_in(chip); i++)
128 update_input_line_level(chip);
131 for (o = 0; o < num_busses_out(chip); o++)
133 update_output_line_level(chip);
134 spin_unlock_irq(&chip->
lock);
174 static int set_professional_spdif(
struct echoaudio *chip,
char prof)
180 control_reg = set_spdif_bits(chip, control_reg, chip->
sample_rate);
181 return write_control_reg(chip, control_reg, get_frq_reg(chip), 0);
190 static u32 detect_input_clocks(
const struct echoaudio *chip)
192 u32 clocks_from_dsp, clock_bits;
220 static int load_asic(
struct echoaudio *chip)
239 box_type = check_asic_status(chip);
255 static int set_sample_rate(
struct echoaudio *chip,
u32 rate)
257 u32 control_reg,
clock, base_rate, frq_reg;
261 DE_ACT((
"set_sample_rate: Cannot set sample rate - "
262 "clock not set to CLK_CLOCKININTERNAL\n"));
301 control_reg |=
clock;
302 control_reg = set_spdif_bits(chip, control_reg, rate);
305 if (base_rate > 50000)
307 if (base_rate < 32000)
316 DE_ACT((
"SetSampleRate: %d clock %x\n", rate, control_reg));
319 return write_control_reg(chip, control_reg, frq_reg, 0);
325 static int set_input_clock(
struct echoaudio *chip,
u16 clock)
327 u32 control_reg, clocks_from_dsp;
329 DE_ACT((
"set_input_clock:\n"));
338 DE_ACT((
"Set Echo3G clock to INTERNAL\n"));
344 DE_ACT((
"Set Echo3G clock to SPDIF\n"));
354 DE_ACT((
"Set Echo3G clock to ADAT\n"));
359 DE_ACT((
"Set Echo3G clock to WORD\n"));
367 DE_ACT((
"Input clock 0x%x not supported for Echo3G\n", clock));
372 return write_control_reg(chip, control_reg, get_frq_reg(chip), 1);
377 static int dsp_set_digital_mode(
struct echoaudio *chip,
u8 mode)
380 int err, incompatible_clock;
383 incompatible_clock =
FALSE;
388 incompatible_clock =
TRUE;
392 incompatible_clock =
TRUE;
395 DE_ACT((
"Digital mode not supported: %d\n", mode));
399 spin_lock_irq(&chip->
lock);
401 if (incompatible_clock) {
424 err = write_control_reg(chip, control_reg, get_frq_reg(chip), 1);
425 spin_unlock_irq(&chip->
lock);
431 return incompatible_clock;