1 // SPDX-License-Identifier: GPL-2.0-only 2 /* 3 * ALSA driver for Echoaudio soundcards. 4 * Copyright (C) 2003-2004 Giuliano Pochini <pochini@shiny.it> 5 */ 6 7 #define ECHO24_FAMILY 8 #define ECHOCARD_MONA 9 #define ECHOCARD_NAME "Mona" 10 #define ECHOCARD_HAS_MONITOR 11 #define ECHOCARD_HAS_ASIC 12 #define ECHOCARD_HAS_SUPER_INTERLEAVE 13 #define ECHOCARD_HAS_DIGITAL_IO 14 #define ECHOCARD_HAS_DIGITAL_IN_AUTOMUTE 15 #define ECHOCARD_HAS_DIGITAL_MODE_SWITCH 16 #define ECHOCARD_HAS_EXTERNAL_CLOCK 17 #define ECHOCARD_HAS_ADAT 6 18 #define ECHOCARD_HAS_STEREO_BIG_ENDIAN32 19 20 /* Pipe indexes */ 21 #define PX_ANALOG_OUT 0 /* 6 */ 22 #define PX_DIGITAL_OUT 6 /* 8 */ 23 #define PX_ANALOG_IN 14 /* 4 */ 24 #define PX_DIGITAL_IN 18 /* 8 */ 25 #define PX_NUM 26 26 27 /* Bus indexes */ 28 #define BX_ANALOG_OUT 0 /* 6 */ 29 #define BX_DIGITAL_OUT 6 /* 8 */ 30 #define BX_ANALOG_IN 14 /* 4 */ 31 #define BX_DIGITAL_IN 18 /* 8 */ 32 #define BX_NUM 26 33 34 35 #include <linux/delay.h> 36 #include <linux/init.h> 37 #include <linux/interrupt.h> 38 #include <linux/pci.h> 39 #include <linux/module.h> 40 #include <linux/firmware.h> 41 #include <linux/slab.h> 42 #include <linux/io.h> 43 #include <sound/core.h> 44 #include <sound/info.h> 45 #include <sound/control.h> 46 #include <sound/tlv.h> 47 #include <sound/pcm.h> 48 #include <sound/pcm_params.h> 49 #include <sound/asoundef.h> 50 #include <sound/initval.h> 51 #include <linux/atomic.h> 52 #include "echoaudio.h" 53 54 MODULE_FIRMWARE("ea/loader_dsp.fw"); 55 MODULE_FIRMWARE("ea/mona_301_dsp.fw"); 56 MODULE_FIRMWARE("ea/mona_361_dsp.fw"); 57 MODULE_FIRMWARE("ea/mona_301_1_asic_48.fw"); 58 MODULE_FIRMWARE("ea/mona_301_1_asic_96.fw"); 59 MODULE_FIRMWARE("ea/mona_361_1_asic_48.fw"); 60 MODULE_FIRMWARE("ea/mona_361_1_asic_96.fw"); 61 MODULE_FIRMWARE("ea/mona_2_asic.fw"); 62 63 #define FW_361_LOADER 0 64 #define FW_MONA_301_DSP 1 65 #define FW_MONA_361_DSP 2 66 #define FW_MONA_301_1_ASIC48 3 67 #define FW_MONA_301_1_ASIC96 4 68 #define FW_MONA_361_1_ASIC48 5 69 #define FW_MONA_361_1_ASIC96 6 70 #define FW_MONA_2_ASIC 7 71 72 static const struct firmware card_fw[] = { 73 {0, "loader_dsp.fw"}, 74 {0, "mona_301_dsp.fw"}, 75 {0, "mona_361_dsp.fw"}, 76 {0, "mona_301_1_asic_48.fw"}, 77 {0, "mona_301_1_asic_96.fw"}, 78 {0, "mona_361_1_asic_48.fw"}, 79 {0, "mona_361_1_asic_96.fw"}, 80 {0, "mona_2_asic.fw"} 81 }; 82 83 static const struct pci_device_id snd_echo_ids[] = { 84 {0x1057, 0x1801, 0xECC0, 0x0070, 0, 0, 0}, /* DSP 56301 Mona rev.0 */ 85 {0x1057, 0x1801, 0xECC0, 0x0071, 0, 0, 0}, /* DSP 56301 Mona rev.1 */ 86 {0x1057, 0x1801, 0xECC0, 0x0072, 0, 0, 0}, /* DSP 56301 Mona rev.2 */ 87 {0x1057, 0x3410, 0xECC0, 0x0070, 0, 0, 0}, /* DSP 56361 Mona rev.0 */ 88 {0x1057, 0x3410, 0xECC0, 0x0071, 0, 0, 0}, /* DSP 56361 Mona rev.1 */ 89 {0x1057, 0x3410, 0xECC0, 0x0072, 0, 0, 0}, /* DSP 56361 Mona rev.2 */ 90 {0,} 91 }; 92 93 static struct snd_pcm_hardware pcm_hardware_skel = { 94 .info = SNDRV_PCM_INFO_MMAP | 95 SNDRV_PCM_INFO_INTERLEAVED | 96 SNDRV_PCM_INFO_BLOCK_TRANSFER | 97 SNDRV_PCM_INFO_MMAP_VALID | 98 SNDRV_PCM_INFO_PAUSE | 99 SNDRV_PCM_INFO_SYNC_START, 100 .formats = SNDRV_PCM_FMTBIT_U8 | 101 SNDRV_PCM_FMTBIT_S16_LE | 102 SNDRV_PCM_FMTBIT_S24_3LE | 103 SNDRV_PCM_FMTBIT_S32_LE | 104 SNDRV_PCM_FMTBIT_S32_BE, 105 .rates = SNDRV_PCM_RATE_8000_48000 | 106 SNDRV_PCM_RATE_88200 | 107 SNDRV_PCM_RATE_96000, 108 .rate_min = 8000, 109 .rate_max = 96000, 110 .channels_min = 1, 111 .channels_max = 8, 112 .buffer_bytes_max = 262144, 113 .period_bytes_min = 32, 114 .period_bytes_max = 131072, 115 .periods_min = 2, 116 .periods_max = 220, 117 /* One page (4k) contains 512 instructions. I don't know if the hw 118 supports lists longer than this. In this case periods_max=220 is a 119 safe limit to make sure the list never exceeds 512 instructions. */ 120 }; 121 122 123 #include "mona_dsp.c" 124 #include "echoaudio_dsp.c" 125 #include "echoaudio_gml.c" 126 #include "echoaudio.c" 127