1 /************************************************************************
3 This file is part of Echo Digital Audio's generic driver library.
4 Copyright Echo Digital Audio Corporation (c) 1998 - 2005
8 This library is free software; you can redistribute it and/or
9 modify it under the terms of the GNU Lesser General Public
10 License as published by the Free Software Foundation; either
11 version 2.1 of the License, or (at your option) any later version.
13 This library is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 Lesser General Public License for more details.
18 You should have received a copy of the GNU Lesser General Public
19 License along with this library; if not, write to the Free Software
20 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 *************************************************************************
24 Translation from C++ and adaptation for use in ALSA-Driver
25 were made by Giuliano Pochini <pochini@shiny.it>
27 *************************************************************************/
29 static int set_sample_rate(struct echoaudio
*chip
, u32 rate
)
31 u32 clock
, control_reg
, old_control_reg
;
33 if (wait_handshake(chip
))
36 old_control_reg
= le32_to_cpu(chip
->comm_page
->control_register
);
37 control_reg
= old_control_reg
& ~INDIGO_EXPRESS_CLOCK_MASK
;
41 clock
= INDIGO_EXPRESS_32000
;
44 clock
= INDIGO_EXPRESS_44100
;
47 clock
= INDIGO_EXPRESS_48000
;
50 clock
= INDIGO_EXPRESS_32000
|INDIGO_EXPRESS_DOUBLE_SPEED
;
53 clock
= INDIGO_EXPRESS_44100
|INDIGO_EXPRESS_DOUBLE_SPEED
;
56 clock
= INDIGO_EXPRESS_48000
|INDIGO_EXPRESS_DOUBLE_SPEED
;
63 if (control_reg
!= old_control_reg
) {
64 chip
->comm_page
->control_register
= cpu_to_le32(control_reg
);
65 chip
->sample_rate
= rate
;
66 clear_handshake(chip
);
67 return send_vector(chip
, DSP_VC_UPDATE_CLOCKS
);
74 /* This function routes the sound from a virtual channel to a real output */
75 static int set_vmixer_gain(struct echoaudio
*chip
, u16 output
, u16 pipe
,
80 if (snd_BUG_ON(pipe
>= num_pipes_out(chip
) ||
81 output
>= num_busses_out(chip
)))
84 if (wait_handshake(chip
))
87 chip
->vmixer_gain
[output
][pipe
] = gain
;
88 index
= output
* num_pipes_out(chip
) + pipe
;
89 chip
->comm_page
->vmixer
[index
] = gain
;
91 DE_ACT(("set_vmixer_gain: pipe %d, out %d = %d\n", pipe
, output
, gain
));
97 /* Tell the DSP to read and update virtual mixer levels in comm page. */
98 static int update_vmixer_level(struct echoaudio
*chip
)
100 if (wait_handshake(chip
))
102 clear_handshake(chip
);
103 return send_vector(chip
, DSP_VC_SET_VMIXER_GAIN
);
108 static u32
detect_input_clocks(const struct echoaudio
*chip
)
110 return ECHO_CLOCK_BIT_INTERNAL
;
115 /* The IndigoIO has no ASIC. Just do nothing */
116 static int load_asic(struct echoaudio
*chip
)