···400400 To compile this driver as a module, choose M here: the module401401 will be called snd-indigodj402402403403+config SND_INDIGOIOX404404+ tristate "(Echoaudio) Indigo IOx"405405+ select FW_LOADER406406+ select SND_PCM407407+ help408408+ Say 'Y' or 'M' to include support for Echoaudio Indigo IOx.409409+410410+ To compile this driver as a module, choose M here: the module411411+ will be called snd-indigoiox412412+413413+config SND_INDIGODJX414414+ tristate "(Echoaudio) Indigo DJx"415415+ select FW_LOADER416416+ select SND_PCM417417+ help418418+ Say 'Y' or 'M' to include support for Echoaudio Indigo DJx.419419+420420+ To compile this driver as a module, choose M here: the module421421+ will be called snd-indigodjx422422+403423config SND_EMU10K1404424 tristate "Emu10k1 (SB Live!, Audigy, E-mu APS)"405425 select FW_LOADER
···6363 if ((err = init_line_levels(chip)) < 0)6464 return err;65656666- /* Default routing of the virtual channels: all vchannels are routed6767- to the stereo output */6868- set_vmixer_gain(chip, 0, 0, 0);6969- set_vmixer_gain(chip, 1, 1, 0);7070- set_vmixer_gain(chip, 0, 2, 0);7171- set_vmixer_gain(chip, 1, 3, 0);7272- set_vmixer_gain(chip, 0, 4, 0);7373- set_vmixer_gain(chip, 1, 5, 0);7474- set_vmixer_gain(chip, 0, 6, 0);7575- set_vmixer_gain(chip, 1, 7, 0);7676- err = update_vmixer_level(chip);7777-7866 DE_INIT(("init_hw done\n"));7967 return err;8068}
+119
sound/pci/echoaudio/indigo_express_dsp.c
···11+/************************************************************************22+33+This file is part of Echo Digital Audio's generic driver library.44+Copyright Echo Digital Audio Corporation (c) 1998 - 200555+All rights reserved66+www.echoaudio.com77+88+This library is free software; you can redistribute it and/or99+modify it under the terms of the GNU Lesser General Public1010+License as published by the Free Software Foundation; either1111+version 2.1 of the License, or (at your option) any later version.1212+1313+This library is distributed in the hope that it will be useful,1414+but WITHOUT ANY WARRANTY; without even the implied warranty of1515+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU1616+Lesser General Public License for more details.1717+1818+You should have received a copy of the GNU Lesser General Public1919+License along with this library; if not, write to the Free Software2020+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA2121+2222+*************************************************************************2323+2424+ Translation from C++ and adaptation for use in ALSA-Driver2525+ were made by Giuliano Pochini <pochini@shiny.it>2626+2727+*************************************************************************/2828+2929+static int set_sample_rate(struct echoaudio *chip, u32 rate)3030+{3131+ u32 clock, control_reg, old_control_reg;3232+3333+ if (wait_handshake(chip))3434+ return -EIO;3535+3636+ old_control_reg = le32_to_cpu(chip->comm_page->control_register);3737+ control_reg = old_control_reg & ~INDIGO_EXPRESS_CLOCK_MASK;3838+3939+ switch (rate) {4040+ case 32000:4141+ clock = INDIGO_EXPRESS_32000;4242+ break;4343+ case 44100:4444+ clock = INDIGO_EXPRESS_44100;4545+ break;4646+ case 48000:4747+ clock = INDIGO_EXPRESS_48000;4848+ break;4949+ case 64000:5050+ clock = INDIGO_EXPRESS_32000|INDIGO_EXPRESS_DOUBLE_SPEED;5151+ break;5252+ case 88200:5353+ clock = INDIGO_EXPRESS_44100|INDIGO_EXPRESS_DOUBLE_SPEED;5454+ break;5555+ case 96000:5656+ clock = INDIGO_EXPRESS_48000|INDIGO_EXPRESS_DOUBLE_SPEED;5757+ break;5858+ default:5959+ return -EINVAL;6060+ }6161+6262+ control_reg |= clock;6363+ if (control_reg != old_control_reg) {6464+ chip->comm_page->control_register = cpu_to_le32(control_reg);6565+ chip->sample_rate = rate;6666+ clear_handshake(chip);6767+ return send_vector(chip, DSP_VC_UPDATE_CLOCKS);6868+ }6969+ return 0;7070+}7171+7272+7373+7474+/* This function routes the sound from a virtual channel to a real output */7575+static int set_vmixer_gain(struct echoaudio *chip, u16 output, u16 pipe,7676+ int gain)7777+{7878+ int index;7979+8080+ if (snd_BUG_ON(pipe >= num_pipes_out(chip) ||8181+ output >= num_busses_out(chip)))8282+ return -EINVAL;8383+8484+ if (wait_handshake(chip))8585+ return -EIO;8686+8787+ chip->vmixer_gain[output][pipe] = gain;8888+ index = output * num_pipes_out(chip) + pipe;8989+ chip->comm_page->vmixer[index] = gain;9090+9191+ DE_ACT(("set_vmixer_gain: pipe %d, out %d = %d\n", pipe, output, gain));9292+ return 0;9393+}9494+9595+9696+9797+/* Tell the DSP to read and update virtual mixer levels in comm page. */9898+static int update_vmixer_level(struct echoaudio *chip)9999+{100100+ if (wait_handshake(chip))101101+ return -EIO;102102+ clear_handshake(chip);103103+ return send_vector(chip, DSP_VC_SET_VMIXER_GAIN);104104+}105105+106106+107107+108108+static u32 detect_input_clocks(const struct echoaudio *chip)109109+{110110+ return ECHO_CLOCK_BIT_INTERNAL;111111+}112112+113113+114114+115115+/* The IndigoIO has no ASIC. Just do nothing */116116+static int load_asic(struct echoaudio *chip)117117+{118118+ return 0;119119+}
···11+/*22+ * ALSA driver for Echoaudio soundcards.33+ * Copyright (C) 2009 Giuliano Pochini <pochini@shiny.it>44+ *55+ * This program is free software; you can redistribute it and/or modify66+ * it under the terms of the GNU General Public License as published by77+ * the Free Software Foundation; version 2 of the License.88+ *99+ * This program is distributed in the hope that it will be useful,1010+ * but WITHOUT ANY WARRANTY; without even the implied warranty of1111+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the1212+ * GNU General Public License for more details.1313+ *1414+ * You should have received a copy of the GNU General Public License1515+ * along with this program; if not, write to the Free Software1616+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.1717+ */1818+1919+#define INDIGO_FAMILY2020+#define ECHOCARD_INDIGO_DJX2121+#define ECHOCARD_NAME "Indigo DJx"2222+#define ECHOCARD_HAS_SUPER_INTERLEAVE2323+#define ECHOCARD_HAS_VMIXER2424+#define ECHOCARD_HAS_STEREO_BIG_ENDIAN322525+2626+/* Pipe indexes */2727+#define PX_ANALOG_OUT 0 /* 8 */2828+#define PX_DIGITAL_OUT 8 /* 0 */2929+#define PX_ANALOG_IN 8 /* 0 */3030+#define PX_DIGITAL_IN 8 /* 0 */3131+#define PX_NUM 83232+3333+/* Bus indexes */3434+#define BX_ANALOG_OUT 0 /* 4 */3535+#define BX_DIGITAL_OUT 4 /* 0 */3636+#define BX_ANALOG_IN 4 /* 0 */3737+#define BX_DIGITAL_IN 4 /* 0 */3838+#define BX_NUM 43939+4040+4141+#include <linux/delay.h>4242+#include <linux/init.h>4343+#include <linux/interrupt.h>4444+#include <linux/pci.h>4545+#include <linux/slab.h>4646+#include <linux/moduleparam.h>4747+#include <linux/firmware.h>4848+#include <linux/io.h>4949+#include <sound/core.h>5050+#include <sound/info.h>5151+#include <sound/control.h>5252+#include <sound/tlv.h>5353+#include <sound/pcm.h>5454+#include <sound/pcm_params.h>5555+#include <sound/asoundef.h>5656+#include <sound/initval.h>5757+#include <asm/atomic.h>5858+#include "echoaudio.h"5959+6060+MODULE_FIRMWARE("ea/loader_dsp.fw");6161+MODULE_FIRMWARE("ea/indigo_djx_dsp.fw");6262+6363+#define FW_361_LOADER 06464+#define FW_INDIGO_DJX_DSP 16565+6666+static const struct firmware card_fw[] = {6767+ {0, "loader_dsp.fw"},6868+ {0, "indigo_djx_dsp.fw"}6969+};7070+7171+static struct pci_device_id snd_echo_ids[] = {7272+ {0x1057, 0x3410, 0xECC0, 0x00E0, 0, 0, 0}, /* Indigo DJx*/7373+ {0,}7474+};7575+7676+static struct snd_pcm_hardware pcm_hardware_skel = {7777+ .info = SNDRV_PCM_INFO_MMAP |7878+ SNDRV_PCM_INFO_INTERLEAVED |7979+ SNDRV_PCM_INFO_BLOCK_TRANSFER |8080+ SNDRV_PCM_INFO_MMAP_VALID |8181+ SNDRV_PCM_INFO_PAUSE |8282+ SNDRV_PCM_INFO_SYNC_START,8383+ .formats = SNDRV_PCM_FMTBIT_U8 |8484+ SNDRV_PCM_FMTBIT_S16_LE |8585+ SNDRV_PCM_FMTBIT_S24_3LE |8686+ SNDRV_PCM_FMTBIT_S32_LE |8787+ SNDRV_PCM_FMTBIT_S32_BE,8888+ .rates = SNDRV_PCM_RATE_32000 |8989+ SNDRV_PCM_RATE_44100 |9090+ SNDRV_PCM_RATE_48000 |9191+ SNDRV_PCM_RATE_88200 |9292+ SNDRV_PCM_RATE_96000,9393+ .rate_min = 32000,9494+ .rate_max = 96000,9595+ .channels_min = 1,9696+ .channels_max = 4,9797+ .buffer_bytes_max = 262144,9898+ .period_bytes_min = 32,9999+ .period_bytes_max = 131072,100100+ .periods_min = 2,101101+ .periods_max = 220,102102+};103103+104104+#include "indigodjx_dsp.c"105105+#include "indigo_express_dsp.c"106106+#include "echoaudio_dsp.c"107107+#include "echoaudio.c"
+68
sound/pci/echoaudio/indigodjx_dsp.c
···11+/************************************************************************22+33+This file is part of Echo Digital Audio's generic driver library.44+Copyright Echo Digital Audio Corporation (c) 1998 - 200555+All rights reserved66+www.echoaudio.com77+88+This library is free software; you can redistribute it and/or99+modify it under the terms of the GNU Lesser General Public1010+License as published by the Free Software Foundation; either1111+version 2.1 of the License, or (at your option) any later version.1212+1313+This library is distributed in the hope that it will be useful,1414+but WITHOUT ANY WARRANTY; without even the implied warranty of1515+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU1616+Lesser General Public License for more details.1717+1818+You should have received a copy of the GNU Lesser General Public1919+License along with this library; if not, write to the Free Software2020+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA2121+2222+*************************************************************************2323+2424+ Translation from C++ and adaptation for use in ALSA-Driver2525+ were made by Giuliano Pochini <pochini@shiny.it>2626+2727+*************************************************************************/2828+2929+static int update_vmixer_level(struct echoaudio *chip);3030+static int set_vmixer_gain(struct echoaudio *chip, u16 output,3131+ u16 pipe, int gain);3232+3333+3434+static int init_hw(struct echoaudio *chip, u16 device_id, u16 subdevice_id)3535+{3636+ int err;3737+3838+ DE_INIT(("init_hw() - Indigo DJx\n"));3939+ if (snd_BUG_ON((subdevice_id & 0xfff0) != INDIGO_DJX))4040+ return -ENODEV;4141+4242+ err = init_dsp_comm_page(chip);4343+ if (err < 0) {4444+ DE_INIT(("init_hw - could not initialize DSP comm page\n"));4545+ return err;4646+ }4747+4848+ chip->device_id = device_id;4949+ chip->subdevice_id = subdevice_id;5050+ chip->bad_board = TRUE;5151+ chip->dsp_code_to_load = &card_fw[FW_INDIGO_DJX_DSP];5252+ /* Since this card has no ASIC, mark it as loaded so everything5353+ works OK */5454+ chip->asic_loaded = TRUE;5555+ chip->input_clock_types = ECHO_CLOCK_BIT_INTERNAL;5656+5757+ err = load_firmware(chip);5858+ if (err < 0)5959+ return err;6060+ chip->bad_board = FALSE;6161+6262+ err = init_line_levels(chip);6363+ if (err < 0)6464+ return err;6565+6666+ DE_INIT(("init_hw done\n"));6767+ return err;6868+}
-12
sound/pci/echoaudio/indigoio_dsp.c
···6363 if ((err = init_line_levels(chip)) < 0)6464 return err;65656666- /* Default routing of the virtual channels: all vchannels are routed6767- to the stereo output */6868- set_vmixer_gain(chip, 0, 0, 0);6969- set_vmixer_gain(chip, 1, 1, 0);7070- set_vmixer_gain(chip, 0, 2, 0);7171- set_vmixer_gain(chip, 1, 3, 0);7272- set_vmixer_gain(chip, 0, 4, 0);7373- set_vmixer_gain(chip, 1, 5, 0);7474- set_vmixer_gain(chip, 0, 6, 0);7575- set_vmixer_gain(chip, 1, 7, 0);7676- err = update_vmixer_level(chip);7777-7866 DE_INIT(("init_hw done\n"));7967 return err;8068}
+109
sound/pci/echoaudio/indigoiox.c
···11+/*22+ * ALSA driver for Echoaudio soundcards.33+ * Copyright (C) 2009 Giuliano Pochini <pochini@shiny.it>44+ *55+ * This program is free software; you can redistribute it and/or modify66+ * it under the terms of the GNU General Public License as published by77+ * the Free Software Foundation; version 2 of the License.88+ *99+ * This program is distributed in the hope that it will be useful,1010+ * but WITHOUT ANY WARRANTY; without even the implied warranty of1111+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the1212+ * GNU General Public License for more details.1313+ *1414+ * You should have received a copy of the GNU General Public License1515+ * along with this program; if not, write to the Free Software1616+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.1717+ */1818+1919+#define INDIGO_FAMILY2020+#define ECHOCARD_INDIGO_IOX2121+#define ECHOCARD_NAME "Indigo IOx"2222+#define ECHOCARD_HAS_MONITOR2323+#define ECHOCARD_HAS_SUPER_INTERLEAVE2424+#define ECHOCARD_HAS_VMIXER2525+#define ECHOCARD_HAS_STEREO_BIG_ENDIAN322626+2727+/* Pipe indexes */2828+#define PX_ANALOG_OUT 0 /* 8 */2929+#define PX_DIGITAL_OUT 8 /* 0 */3030+#define PX_ANALOG_IN 8 /* 2 */3131+#define PX_DIGITAL_IN 10 /* 0 */3232+#define PX_NUM 103333+3434+/* Bus indexes */3535+#define BX_ANALOG_OUT 0 /* 2 */3636+#define BX_DIGITAL_OUT 2 /* 0 */3737+#define BX_ANALOG_IN 2 /* 2 */3838+#define BX_DIGITAL_IN 4 /* 0 */3939+#define BX_NUM 44040+4141+4242+#include <linux/delay.h>4343+#include <linux/init.h>4444+#include <linux/interrupt.h>4545+#include <linux/pci.h>4646+#include <linux/slab.h>4747+#include <linux/moduleparam.h>4848+#include <linux/firmware.h>4949+#include <linux/io.h>5050+#include <sound/core.h>5151+#include <sound/info.h>5252+#include <sound/control.h>5353+#include <sound/tlv.h>5454+#include <sound/pcm.h>5555+#include <sound/pcm_params.h>5656+#include <sound/asoundef.h>5757+#include <sound/initval.h>5858+#include <asm/atomic.h>5959+#include "echoaudio.h"6060+6161+MODULE_FIRMWARE("ea/loader_dsp.fw");6262+MODULE_FIRMWARE("ea/indigo_iox_dsp.fw");6363+6464+#define FW_361_LOADER 06565+#define FW_INDIGO_IOX_DSP 16666+6767+static const struct firmware card_fw[] = {6868+ {0, "loader_dsp.fw"},6969+ {0, "indigo_iox_dsp.fw"}7070+};7171+7272+static struct pci_device_id snd_echo_ids[] = {7373+ {0x1057, 0x3410, 0xECC0, 0x00D0, 0, 0, 0}, /* Indigo IOx */7474+ {0,}7575+};7676+7777+static struct snd_pcm_hardware pcm_hardware_skel = {7878+ .info = SNDRV_PCM_INFO_MMAP |7979+ SNDRV_PCM_INFO_INTERLEAVED |8080+ SNDRV_PCM_INFO_BLOCK_TRANSFER |8181+ SNDRV_PCM_INFO_MMAP_VALID |8282+ SNDRV_PCM_INFO_PAUSE |8383+ SNDRV_PCM_INFO_SYNC_START,8484+ .formats = SNDRV_PCM_FMTBIT_U8 |8585+ SNDRV_PCM_FMTBIT_S16_LE |8686+ SNDRV_PCM_FMTBIT_S24_3LE |8787+ SNDRV_PCM_FMTBIT_S32_LE |8888+ SNDRV_PCM_FMTBIT_S32_BE,8989+ .rates = SNDRV_PCM_RATE_32000 |9090+ SNDRV_PCM_RATE_44100 |9191+ SNDRV_PCM_RATE_48000 |9292+ SNDRV_PCM_RATE_88200 |9393+ SNDRV_PCM_RATE_96000,9494+ .rate_min = 32000,9595+ .rate_max = 96000,9696+ .channels_min = 1,9797+ .channels_max = 8,9898+ .buffer_bytes_max = 262144,9999+ .period_bytes_min = 32,100100+ .period_bytes_max = 131072,101101+ .periods_min = 2,102102+ .periods_max = 220,103103+};104104+105105+#include "indigoiox_dsp.c"106106+#include "indigo_express_dsp.c"107107+#include "echoaudio_dsp.c"108108+#include "echoaudio.c"109109+
+68
sound/pci/echoaudio/indigoiox_dsp.c
···11+/************************************************************************22+33+This file is part of Echo Digital Audio's generic driver library.44+Copyright Echo Digital Audio Corporation (c) 1998 - 200555+All rights reserved66+www.echoaudio.com77+88+This library is free software; you can redistribute it and/or99+modify it under the terms of the GNU Lesser General Public1010+License as published by the Free Software Foundation; either1111+version 2.1 of the License, or (at your option) any later version.1212+1313+This library is distributed in the hope that it will be useful,1414+but WITHOUT ANY WARRANTY; without even the implied warranty of1515+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU1616+Lesser General Public License for more details.1717+1818+You should have received a copy of the GNU Lesser General Public1919+License along with this library; if not, write to the Free Software2020+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA2121+2222+*************************************************************************2323+2424+ Translation from C++ and adaptation for use in ALSA-Driver2525+ were made by Giuliano Pochini <pochini@shiny.it>2626+2727+*************************************************************************/2828+2929+static int update_vmixer_level(struct echoaudio *chip);3030+static int set_vmixer_gain(struct echoaudio *chip, u16 output,3131+ u16 pipe, int gain);3232+3333+3434+static int init_hw(struct echoaudio *chip, u16 device_id, u16 subdevice_id)3535+{3636+ int err;3737+3838+ DE_INIT(("init_hw() - Indigo IOx\n"));3939+ if (snd_BUG_ON((subdevice_id & 0xfff0) != INDIGO_IOX))4040+ return -ENODEV;4141+4242+ err = init_dsp_comm_page(chip);4343+ if (err < 0) {4444+ DE_INIT(("init_hw - could not initialize DSP comm page\n"));4545+ return err;4646+ }4747+4848+ chip->device_id = device_id;4949+ chip->subdevice_id = subdevice_id;5050+ chip->bad_board = TRUE;5151+ chip->dsp_code_to_load = &card_fw[FW_INDIGO_IOX_DSP];5252+ /* Since this card has no ASIC, mark it as loaded so everything5353+ works OK */5454+ chip->asic_loaded = TRUE;5555+ chip->input_clock_types = ECHO_CLOCK_BIT_INTERNAL;5656+5757+ err = load_firmware(chip);5858+ if (err < 0)5959+ return err;6060+ chip->bad_board = FALSE;6161+6262+ err = init_line_levels(chip);6363+ if (err < 0)6464+ return err;6565+6666+ DE_INIT(("init_hw done\n"));6767+ return err;6868+}
-12
sound/pci/echoaudio/mia_dsp.c
···6969 if ((err = init_line_levels(chip)))7070 return err;71717272- /* Default routing of the virtual channels: vchannels 0-3 go to analog7373- outputs and vchannels 4-7 go to S/PDIF outputs */7474- set_vmixer_gain(chip, 0, 0, 0);7575- set_vmixer_gain(chip, 1, 1, 0);7676- set_vmixer_gain(chip, 0, 2, 0);7777- set_vmixer_gain(chip, 1, 3, 0);7878- set_vmixer_gain(chip, 2, 4, 0);7979- set_vmixer_gain(chip, 3, 5, 0);8080- set_vmixer_gain(chip, 2, 6, 0);8181- set_vmixer_gain(chip, 3, 7, 0);8282- err = update_vmixer_level(chip);8383-8472 DE_INIT(("init_hw done\n"));8573 return err;8674}