Path: blob/master/sound/pci/echoaudio/indigo_express_dsp.c
26439 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) {63dev_dbg(chip->card->dev,64"set_sample_rate: %d clock %d\n", rate, clock);65chip->comm_page->control_register = cpu_to_le32(control_reg);66chip->sample_rate = rate;67clear_handshake(chip);68return send_vector(chip, DSP_VC_UPDATE_CLOCKS);69}70return 0;71}72737475/* This function routes the sound from a virtual channel to a real output */76static int set_vmixer_gain(struct echoaudio *chip, u16 output, u16 pipe,77int gain)78{79int index;8081if (snd_BUG_ON(pipe >= num_pipes_out(chip) ||82output >= num_busses_out(chip)))83return -EINVAL;8485if (wait_handshake(chip))86return -EIO;8788chip->vmixer_gain[output][pipe] = gain;89index = output * num_pipes_out(chip) + pipe;90chip->comm_page->vmixer[index] = gain;9192dev_dbg(chip->card->dev,93"set_vmixer_gain: pipe %d, out %d = %d\n", pipe, output, gain);94return 0;95}96979899/* Tell the DSP to read and update virtual mixer levels in comm page. */100static int update_vmixer_level(struct echoaudio *chip)101{102if (wait_handshake(chip))103return -EIO;104clear_handshake(chip);105return send_vector(chip, DSP_VC_SET_VMIXER_GAIN);106}107108109110static u32 detect_input_clocks(const struct echoaudio *chip)111{112return ECHO_CLOCK_BIT_INTERNAL;113}114115116117/* The IndigoIO has no ASIC. Just do nothing */118static int load_asic(struct echoaudio *chip)119{120return 0;121}122123124