Path: blob/master/sound/pci/echoaudio/indigo_express_dsp.c
10817 views
/************************************************************************12This file is part of Echo Digital Audio's generic driver library.3Copyright Echo Digital Audio Corporation (c) 1998 - 20054All rights reserved5www.echoaudio.com67This library is free software; you can redistribute it and/or8modify it under the terms of the GNU Lesser General Public9License as published by the Free Software Foundation; either10version 2.1 of the License, or (at your option) any later version.1112This library is distributed in the hope that it will be useful,13but WITHOUT ANY WARRANTY; without even the implied warranty of14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU15Lesser General Public License for more details.1617You should have received a copy of the GNU Lesser General Public18License along with this library; if not, write to the Free Software19Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA2021*************************************************************************2223Translation from C++ and adaptation for use in ALSA-Driver24were made by Giuliano Pochini <[email protected]>2526*************************************************************************/2728static int set_sample_rate(struct echoaudio *chip, u32 rate)29{30u32 clock, control_reg, old_control_reg;3132if (wait_handshake(chip))33return -EIO;3435old_control_reg = le32_to_cpu(chip->comm_page->control_register);36control_reg = old_control_reg & ~INDIGO_EXPRESS_CLOCK_MASK;3738switch (rate) {39case 32000:40clock = INDIGO_EXPRESS_32000;41break;42case 44100:43clock = INDIGO_EXPRESS_44100;44break;45case 48000:46clock = INDIGO_EXPRESS_48000;47break;48case 64000:49clock = INDIGO_EXPRESS_32000|INDIGO_EXPRESS_DOUBLE_SPEED;50break;51case 88200:52clock = INDIGO_EXPRESS_44100|INDIGO_EXPRESS_DOUBLE_SPEED;53break;54case 96000:55clock = INDIGO_EXPRESS_48000|INDIGO_EXPRESS_DOUBLE_SPEED;56break;57default:58return -EINVAL;59}6061control_reg |= clock;62if (control_reg != old_control_reg) {63DE_ACT(("set_sample_rate: %d clock %d\n", rate, clock));64chip->comm_page->control_register = cpu_to_le32(control_reg);65chip->sample_rate = rate;66clear_handshake(chip);67return send_vector(chip, DSP_VC_UPDATE_CLOCKS);68}69return 0;70}71727374/* This function routes the sound from a virtual channel to a real output */75static int set_vmixer_gain(struct echoaudio *chip, u16 output, u16 pipe,76int gain)77{78int index;7980if (snd_BUG_ON(pipe >= num_pipes_out(chip) ||81output >= num_busses_out(chip)))82return -EINVAL;8384if (wait_handshake(chip))85return -EIO;8687chip->vmixer_gain[output][pipe] = gain;88index = output * num_pipes_out(chip) + pipe;89chip->comm_page->vmixer[index] = gain;9091DE_ACT(("set_vmixer_gain: pipe %d, out %d = %d\n", pipe, output, gain));92return 0;93}94959697/* Tell the DSP to read and update virtual mixer levels in comm page. */98static int update_vmixer_level(struct echoaudio *chip)99{100if (wait_handshake(chip))101return -EIO;102clear_handshake(chip);103return send_vector(chip, DSP_VC_SET_VMIXER_GAIN);104}105106107108static u32 detect_input_clocks(const struct echoaudio *chip)109{110return ECHO_CLOCK_BIT_INTERNAL;111}112113114115/* The IndigoIO has no ASIC. Just do nothing */116static int load_asic(struct echoaudio *chip)117{118return 0;119}120121122