Path: blob/master/sound/pci/echoaudio/indigoio_dsp.c
10817 views
/****************************************************************************12Copyright Echo Digital Audio Corporation (c) 1998 - 20043All rights reserved4www.echoaudio.com56This file is part of Echo Digital Audio's generic driver library.78Echo Digital Audio's generic driver library is free software;9you can redistribute it and/or modify it under the terms of10the GNU General Public License as published by the Free Software11Foundation.1213This program is distributed in the hope that it will be useful,14but WITHOUT ANY WARRANTY; without even the implied warranty of15MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the16GNU General Public License for more details.1718You should have received a copy of the GNU General Public License19along with this program; if not, write to the Free Software20Foundation, Inc., 59 Temple Place - Suite 330, Boston,21MA 02111-1307, USA.2223*************************************************************************2425Translation from C++ and adaptation for use in ALSA-Driver26were made by Giuliano Pochini <[email protected]>2728****************************************************************************/293031static int set_vmixer_gain(struct echoaudio *chip, u16 output, u16 pipe,32int gain);33static int update_vmixer_level(struct echoaudio *chip);343536static int init_hw(struct echoaudio *chip, u16 device_id, u16 subdevice_id)37{38int err;3940DE_INIT(("init_hw() - Indigo IO\n"));41if (snd_BUG_ON((subdevice_id & 0xfff0) != INDIGO_IO))42return -ENODEV;4344if ((err = init_dsp_comm_page(chip))) {45DE_INIT(("init_hw - could not initialize DSP comm page\n"));46return err;47}4849chip->device_id = device_id;50chip->subdevice_id = subdevice_id;51chip->bad_board = TRUE;52chip->dsp_code_to_load = FW_INDIGO_IO_DSP;53/* Since this card has no ASIC, mark it as loaded so everything54works OK */55chip->asic_loaded = TRUE;56chip->input_clock_types = ECHO_CLOCK_BIT_INTERNAL;5758if ((err = load_firmware(chip)) < 0)59return err;60chip->bad_board = FALSE;6162DE_INIT(("init_hw done\n"));63return err;64}65666768static int set_mixer_defaults(struct echoaudio *chip)69{70return init_line_levels(chip);71}72737475static u32 detect_input_clocks(const struct echoaudio *chip)76{77return ECHO_CLOCK_BIT_INTERNAL;78}79808182/* The IndigoIO has no ASIC. Just do nothing */83static int load_asic(struct echoaudio *chip)84{85return 0;86}87888990static int set_sample_rate(struct echoaudio *chip, u32 rate)91{92if (wait_handshake(chip))93return -EIO;9495chip->sample_rate = rate;96chip->comm_page->sample_rate = cpu_to_le32(rate);97clear_handshake(chip);98return send_vector(chip, DSP_VC_UPDATE_CLOCKS);99}100101102103/* This function routes the sound from a virtual channel to a real output */104static int set_vmixer_gain(struct echoaudio *chip, u16 output, u16 pipe,105int gain)106{107int index;108109if (snd_BUG_ON(pipe >= num_pipes_out(chip) ||110output >= num_busses_out(chip)))111return -EINVAL;112113if (wait_handshake(chip))114return -EIO;115116chip->vmixer_gain[output][pipe] = gain;117index = output * num_pipes_out(chip) + pipe;118chip->comm_page->vmixer[index] = gain;119120DE_ACT(("set_vmixer_gain: pipe %d, out %d = %d\n", pipe, output, gain));121return 0;122}123124125126/* Tell the DSP to read and update virtual mixer levels in comm page. */127static int update_vmixer_level(struct echoaudio *chip)128{129if (wait_handshake(chip))130return -EIO;131clear_handshake(chip);132return send_vector(chip, DSP_VC_SET_VMIXER_GAIN);133}134135136137