1/************************************************************************ 2 3This file is part of Echo Digital Audio's generic driver library. 4Copyright Echo Digital Audio Corporation (c) 1998 - 2005 5All rights reserved 6www.echoaudio.com 7 8This library is free software; you can redistribute it and/or 9modify it under the terms of the GNU Lesser General Public 10License as published by the Free Software Foundation; either 11version 2.1 of the License, or (at your option) any later version. 12 13This library is distributed in the hope that it will be useful, 14but WITHOUT ANY WARRANTY; without even the implied warranty of 15MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16Lesser General Public License for more details. 17 18You should have received a copy of the GNU Lesser General Public 19License along with this library; if not, write to the Free Software 20Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 22************************************************************************* 23 24 Translation from C++ and adaptation for use in ALSA-Driver 25 were made by Giuliano Pochini <pochini@shiny.it> 26 27*************************************************************************/ 28 29static int set_sample_rate(struct echoaudio *chip, u32 rate) 30{ 31 u32 clock, control_reg, old_control_reg; 32 33 if (wait_handshake(chip)) 34 return -EIO; 35 36 old_control_reg = le32_to_cpu(chip->comm_page->control_register); 37 control_reg = old_control_reg & ~INDIGO_EXPRESS_CLOCK_MASK; 38 39 switch (rate) { 40 case 32000: 41 clock = INDIGO_EXPRESS_32000; 42 break; 43 case 44100: 44 clock = INDIGO_EXPRESS_44100; 45 break; 46 case 48000: 47 clock = INDIGO_EXPRESS_48000; 48 break; 49 case 64000: 50 clock = INDIGO_EXPRESS_32000|INDIGO_EXPRESS_DOUBLE_SPEED; 51 break; 52 case 88200: 53 clock = INDIGO_EXPRESS_44100|INDIGO_EXPRESS_DOUBLE_SPEED; 54 break; 55 case 96000: 56 clock = INDIGO_EXPRESS_48000|INDIGO_EXPRESS_DOUBLE_SPEED; 57 break; 58 default: 59 return -EINVAL; 60 } 61 62 control_reg |= clock; 63 if (control_reg != old_control_reg) { 64 DE_ACT(("set_sample_rate: %d clock %d\n", rate, clock)); 65 chip->comm_page->control_register = cpu_to_le32(control_reg); 66 chip->sample_rate = rate; 67 clear_handshake(chip); 68 return send_vector(chip, DSP_VC_UPDATE_CLOCKS); 69 } 70 return 0; 71} 72 73 74 75/* 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, 77 int gain) 78{ 79 int index; 80 81 if (snd_BUG_ON(pipe >= num_pipes_out(chip) || 82 output >= num_busses_out(chip))) 83 return -EINVAL; 84 85 if (wait_handshake(chip)) 86 return -EIO; 87 88 chip->vmixer_gain[output][pipe] = gain; 89 index = output * num_pipes_out(chip) + pipe; 90 chip->comm_page->vmixer[index] = gain; 91 92 DE_ACT(("set_vmixer_gain: pipe %d, out %d = %d\n", pipe, output, gain)); 93 return 0; 94} 95 96 97 98/* Tell the DSP to read and update virtual mixer levels in comm page. */ 99static int update_vmixer_level(struct echoaudio *chip) 100{ 101 if (wait_handshake(chip)) 102 return -EIO; 103 clear_handshake(chip); 104 return send_vector(chip, DSP_VC_SET_VMIXER_GAIN); 105} 106 107 108 109static u32 detect_input_clocks(const struct echoaudio *chip) 110{ 111 return ECHO_CLOCK_BIT_INTERNAL; 112} 113 114 115 116/* The IndigoIO has no ASIC. Just do nothing */ 117static int load_asic(struct echoaudio *chip) 118{ 119 return 0; 120} 121