1 // SPDX-License-Identifier: GPL-2.0-only << 2 /* 1 /* 3 * ALSA driver for Echoaudio soundcards. 2 * ALSA driver for Echoaudio soundcards. 4 * Copyright (C) 2003-2004 Giuliano Pochini < 3 * Copyright (C) 2003-2004 Giuliano Pochini <pochini@shiny.it> >> 4 * >> 5 * This program is free software; you can redistribute it and/or modify >> 6 * it under the terms of the GNU General Public License as published by >> 7 * the Free Software Foundation; version 2 of the License. >> 8 * >> 9 * This program is distributed in the hope that it will be useful, >> 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of >> 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the >> 12 * GNU General Public License for more details. >> 13 * >> 14 * You should have received a copy of the GNU General Public License >> 15 * along with this program; if not, write to the Free Software >> 16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 5 */ 17 */ 6 18 7 #define ECHO24_FAMILY 19 #define ECHO24_FAMILY 8 #define ECHOCARD_MONA 20 #define ECHOCARD_MONA 9 #define ECHOCARD_NAME "Mona" 21 #define ECHOCARD_NAME "Mona" 10 #define ECHOCARD_HAS_MONITOR 22 #define ECHOCARD_HAS_MONITOR 11 #define ECHOCARD_HAS_ASIC 23 #define ECHOCARD_HAS_ASIC 12 #define ECHOCARD_HAS_SUPER_INTERLEAVE 24 #define ECHOCARD_HAS_SUPER_INTERLEAVE 13 #define ECHOCARD_HAS_DIGITAL_IO 25 #define ECHOCARD_HAS_DIGITAL_IO 14 #define ECHOCARD_HAS_DIGITAL_IN_AUTOMUTE 26 #define ECHOCARD_HAS_DIGITAL_IN_AUTOMUTE 15 #define ECHOCARD_HAS_DIGITAL_MODE_SWITCH 27 #define ECHOCARD_HAS_DIGITAL_MODE_SWITCH 16 #define ECHOCARD_HAS_EXTERNAL_CLOCK 28 #define ECHOCARD_HAS_EXTERNAL_CLOCK 17 #define ECHOCARD_HAS_ADAT 6 29 #define ECHOCARD_HAS_ADAT 6 18 #define ECHOCARD_HAS_STEREO_BIG_ENDIAN32 30 #define ECHOCARD_HAS_STEREO_BIG_ENDIAN32 19 31 20 /* Pipe indexes */ 32 /* Pipe indexes */ 21 #define PX_ANALOG_OUT 0 /* 6 */ 33 #define PX_ANALOG_OUT 0 /* 6 */ 22 #define PX_DIGITAL_OUT 6 /* 8 */ 34 #define PX_DIGITAL_OUT 6 /* 8 */ 23 #define PX_ANALOG_IN 14 /* 4 */ 35 #define PX_ANALOG_IN 14 /* 4 */ 24 #define PX_DIGITAL_IN 18 /* 8 */ 36 #define PX_DIGITAL_IN 18 /* 8 */ 25 #define PX_NUM 26 37 #define PX_NUM 26 26 38 27 /* Bus indexes */ 39 /* Bus indexes */ 28 #define BX_ANALOG_OUT 0 /* 6 */ 40 #define BX_ANALOG_OUT 0 /* 6 */ 29 #define BX_DIGITAL_OUT 6 /* 8 */ 41 #define BX_DIGITAL_OUT 6 /* 8 */ 30 #define BX_ANALOG_IN 14 /* 4 */ 42 #define BX_ANALOG_IN 14 /* 4 */ 31 #define BX_DIGITAL_IN 18 /* 8 */ 43 #define BX_DIGITAL_IN 18 /* 8 */ 32 #define BX_NUM 26 44 #define BX_NUM 26 33 45 34 46 35 #include <linux/delay.h> 47 #include <linux/delay.h> 36 #include <linux/init.h> 48 #include <linux/init.h> 37 #include <linux/interrupt.h> 49 #include <linux/interrupt.h> 38 #include <linux/pci.h> 50 #include <linux/pci.h> 39 #include <linux/module.h> 51 #include <linux/module.h> 40 #include <linux/firmware.h> 52 #include <linux/firmware.h> 41 #include <linux/slab.h> 53 #include <linux/slab.h> 42 #include <linux/io.h> 54 #include <linux/io.h> 43 #include <sound/core.h> 55 #include <sound/core.h> 44 #include <sound/info.h> 56 #include <sound/info.h> 45 #include <sound/control.h> 57 #include <sound/control.h> 46 #include <sound/tlv.h> 58 #include <sound/tlv.h> 47 #include <sound/pcm.h> 59 #include <sound/pcm.h> 48 #include <sound/pcm_params.h> 60 #include <sound/pcm_params.h> 49 #include <sound/asoundef.h> 61 #include <sound/asoundef.h> 50 #include <sound/initval.h> 62 #include <sound/initval.h> 51 #include <linux/atomic.h> 63 #include <linux/atomic.h> 52 #include "echoaudio.h" 64 #include "echoaudio.h" 53 65 54 MODULE_FIRMWARE("ea/loader_dsp.fw"); 66 MODULE_FIRMWARE("ea/loader_dsp.fw"); 55 MODULE_FIRMWARE("ea/mona_301_dsp.fw"); 67 MODULE_FIRMWARE("ea/mona_301_dsp.fw"); 56 MODULE_FIRMWARE("ea/mona_361_dsp.fw"); 68 MODULE_FIRMWARE("ea/mona_361_dsp.fw"); 57 MODULE_FIRMWARE("ea/mona_301_1_asic_48.fw"); 69 MODULE_FIRMWARE("ea/mona_301_1_asic_48.fw"); 58 MODULE_FIRMWARE("ea/mona_301_1_asic_96.fw"); 70 MODULE_FIRMWARE("ea/mona_301_1_asic_96.fw"); 59 MODULE_FIRMWARE("ea/mona_361_1_asic_48.fw"); 71 MODULE_FIRMWARE("ea/mona_361_1_asic_48.fw"); 60 MODULE_FIRMWARE("ea/mona_361_1_asic_96.fw"); 72 MODULE_FIRMWARE("ea/mona_361_1_asic_96.fw"); 61 MODULE_FIRMWARE("ea/mona_2_asic.fw"); 73 MODULE_FIRMWARE("ea/mona_2_asic.fw"); 62 74 63 #define FW_361_LOADER 0 75 #define FW_361_LOADER 0 64 #define FW_MONA_301_DSP 1 76 #define FW_MONA_301_DSP 1 65 #define FW_MONA_361_DSP 2 77 #define FW_MONA_361_DSP 2 66 #define FW_MONA_301_1_ASIC48 3 78 #define FW_MONA_301_1_ASIC48 3 67 #define FW_MONA_301_1_ASIC96 4 79 #define FW_MONA_301_1_ASIC96 4 68 #define FW_MONA_361_1_ASIC48 5 80 #define FW_MONA_361_1_ASIC48 5 69 #define FW_MONA_361_1_ASIC96 6 81 #define FW_MONA_361_1_ASIC96 6 70 #define FW_MONA_2_ASIC 7 82 #define FW_MONA_2_ASIC 7 71 83 72 static const struct firmware card_fw[] = { 84 static const struct firmware card_fw[] = { 73 {0, "loader_dsp.fw"}, 85 {0, "loader_dsp.fw"}, 74 {0, "mona_301_dsp.fw"}, 86 {0, "mona_301_dsp.fw"}, 75 {0, "mona_361_dsp.fw"}, 87 {0, "mona_361_dsp.fw"}, 76 {0, "mona_301_1_asic_48.fw"}, 88 {0, "mona_301_1_asic_48.fw"}, 77 {0, "mona_301_1_asic_96.fw"}, 89 {0, "mona_301_1_asic_96.fw"}, 78 {0, "mona_361_1_asic_48.fw"}, 90 {0, "mona_361_1_asic_48.fw"}, 79 {0, "mona_361_1_asic_96.fw"}, 91 {0, "mona_361_1_asic_96.fw"}, 80 {0, "mona_2_asic.fw"} 92 {0, "mona_2_asic.fw"} 81 }; 93 }; 82 94 83 static const struct pci_device_id snd_echo_ids 95 static const struct pci_device_id snd_echo_ids[] = { 84 {0x1057, 0x1801, 0xECC0, 0x0070, 0, 0, 96 {0x1057, 0x1801, 0xECC0, 0x0070, 0, 0, 0}, /* DSP 56301 Mona rev.0 */ 85 {0x1057, 0x1801, 0xECC0, 0x0071, 0, 0, 97 {0x1057, 0x1801, 0xECC0, 0x0071, 0, 0, 0}, /* DSP 56301 Mona rev.1 */ 86 {0x1057, 0x1801, 0xECC0, 0x0072, 0, 0, 98 {0x1057, 0x1801, 0xECC0, 0x0072, 0, 0, 0}, /* DSP 56301 Mona rev.2 */ 87 {0x1057, 0x3410, 0xECC0, 0x0070, 0, 0, 99 {0x1057, 0x3410, 0xECC0, 0x0070, 0, 0, 0}, /* DSP 56361 Mona rev.0 */ 88 {0x1057, 0x3410, 0xECC0, 0x0071, 0, 0, 100 {0x1057, 0x3410, 0xECC0, 0x0071, 0, 0, 0}, /* DSP 56361 Mona rev.1 */ 89 {0x1057, 0x3410, 0xECC0, 0x0072, 0, 0, 101 {0x1057, 0x3410, 0xECC0, 0x0072, 0, 0, 0}, /* DSP 56361 Mona rev.2 */ 90 {0,} 102 {0,} 91 }; 103 }; 92 104 93 static const struct snd_pcm_hardware pcm_hardw !! 105 static struct snd_pcm_hardware pcm_hardware_skel = { 94 .info = SNDRV_PCM_INFO_MMAP | 106 .info = SNDRV_PCM_INFO_MMAP | 95 SNDRV_PCM_INFO_INTERLEAVED | 107 SNDRV_PCM_INFO_INTERLEAVED | 96 SNDRV_PCM_INFO_BLOCK_TRANSFER 108 SNDRV_PCM_INFO_BLOCK_TRANSFER | 97 SNDRV_PCM_INFO_MMAP_VALID | 109 SNDRV_PCM_INFO_MMAP_VALID | 98 SNDRV_PCM_INFO_PAUSE | 110 SNDRV_PCM_INFO_PAUSE | 99 SNDRV_PCM_INFO_SYNC_START, 111 SNDRV_PCM_INFO_SYNC_START, 100 .formats = SNDRV_PCM_FMTBIT_U8 | 112 .formats = SNDRV_PCM_FMTBIT_U8 | 101 SNDRV_PCM_FMTBIT_S16_L 113 SNDRV_PCM_FMTBIT_S16_LE | 102 SNDRV_PCM_FMTBIT_S24_3 114 SNDRV_PCM_FMTBIT_S24_3LE | 103 SNDRV_PCM_FMTBIT_S32_L 115 SNDRV_PCM_FMTBIT_S32_LE | 104 SNDRV_PCM_FMTBIT_S32_B 116 SNDRV_PCM_FMTBIT_S32_BE, 105 .rates = SNDRV_PCM_RATE_8000_48 117 .rates = SNDRV_PCM_RATE_8000_48000 | 106 SNDRV_PCM_RATE_88200 | 118 SNDRV_PCM_RATE_88200 | 107 SNDRV_PCM_RATE_96000, 119 SNDRV_PCM_RATE_96000, 108 .rate_min = 8000, 120 .rate_min = 8000, 109 .rate_max = 96000, 121 .rate_max = 96000, 110 .channels_min = 1, 122 .channels_min = 1, 111 .channels_max = 8, 123 .channels_max = 8, 112 .buffer_bytes_max = 262144, 124 .buffer_bytes_max = 262144, 113 .period_bytes_min = 32, 125 .period_bytes_min = 32, 114 .period_bytes_max = 131072, 126 .period_bytes_max = 131072, 115 .periods_min = 2, 127 .periods_min = 2, 116 .periods_max = 220, 128 .periods_max = 220, 117 /* One page (4k) contains 512 instruct 129 /* One page (4k) contains 512 instructions. I don't know if the hw 118 supports lists longer than this. In th 130 supports lists longer than this. In this case periods_max=220 is a 119 safe limit to make sure the list never 131 safe limit to make sure the list never exceeds 512 instructions. */ 120 }; 132 }; 121 133 122 134 123 #include "mona_dsp.c" 135 #include "mona_dsp.c" 124 #include "echoaudio_dsp.c" 136 #include "echoaudio_dsp.c" 125 #include "echoaudio_gml.c" 137 #include "echoaudio_gml.c" 126 #include "echoaudio.c" 138 #include "echoaudio.c" 127 139
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.