1873e65bcSThomas Gleixner // SPDX-License-Identifier: GPL-2.0-only 2dd7b254dSGiuliano Pochini /* 3dd7b254dSGiuliano Pochini * ALSA driver for Echoaudio soundcards. 4dd7b254dSGiuliano Pochini * Copyright (C) 2003-2004 Giuliano Pochini <pochini@shiny.it> 5dd7b254dSGiuliano Pochini */ 6dd7b254dSGiuliano Pochini 7dd7b254dSGiuliano Pochini #define ECHO24_FAMILY 8dd7b254dSGiuliano Pochini #define ECHOCARD_GINA24 9dd7b254dSGiuliano Pochini #define ECHOCARD_NAME "Gina24" 10dd7b254dSGiuliano Pochini #define ECHOCARD_HAS_MONITOR 11dd7b254dSGiuliano Pochini #define ECHOCARD_HAS_ASIC 12dd7b254dSGiuliano Pochini #define ECHOCARD_HAS_INPUT_NOMINAL_LEVEL 13dd7b254dSGiuliano Pochini #define ECHOCARD_HAS_OUTPUT_NOMINAL_LEVEL 14dd7b254dSGiuliano Pochini #define ECHOCARD_HAS_SUPER_INTERLEAVE 15dd7b254dSGiuliano Pochini #define ECHOCARD_HAS_DIGITAL_IO 16dd7b254dSGiuliano Pochini #define ECHOCARD_HAS_DIGITAL_IN_AUTOMUTE 17dd7b254dSGiuliano Pochini #define ECHOCARD_HAS_DIGITAL_MODE_SWITCH 18dd7b254dSGiuliano Pochini #define ECHOCARD_HAS_EXTERNAL_CLOCK 19dd7b254dSGiuliano Pochini #define ECHOCARD_HAS_ADAT 6 20dd7b254dSGiuliano Pochini #define ECHOCARD_HAS_STEREO_BIG_ENDIAN32 21dd7b254dSGiuliano Pochini 22dd7b254dSGiuliano Pochini /* Pipe indexes */ 23dd7b254dSGiuliano Pochini #define PX_ANALOG_OUT 0 /* 8 */ 24dd7b254dSGiuliano Pochini #define PX_DIGITAL_OUT 8 /* 8 */ 25dd7b254dSGiuliano Pochini #define PX_ANALOG_IN 16 /* 2 */ 26dd7b254dSGiuliano Pochini #define PX_DIGITAL_IN 18 /* 8 */ 27dd7b254dSGiuliano Pochini #define PX_NUM 26 28dd7b254dSGiuliano Pochini 29dd7b254dSGiuliano Pochini /* Bus indexes */ 30dd7b254dSGiuliano Pochini #define BX_ANALOG_OUT 0 /* 8 */ 31dd7b254dSGiuliano Pochini #define BX_DIGITAL_OUT 8 /* 8 */ 32dd7b254dSGiuliano Pochini #define BX_ANALOG_IN 16 /* 2 */ 33dd7b254dSGiuliano Pochini #define BX_DIGITAL_IN 18 /* 8 */ 34dd7b254dSGiuliano Pochini #define BX_NUM 26 35dd7b254dSGiuliano Pochini 36dd7b254dSGiuliano Pochini 37dd7b254dSGiuliano Pochini #include <linux/delay.h> 38dd7b254dSGiuliano Pochini #include <linux/init.h> 39dd7b254dSGiuliano Pochini #include <linux/interrupt.h> 40dd7b254dSGiuliano Pochini #include <linux/pci.h> 4165a77217SPaul Gortmaker #include <linux/module.h> 42dd7b254dSGiuliano Pochini #include <linux/firmware.h> 435a0e3ad6STejun Heo #include <linux/slab.h> 446cbbfe1cSTakashi Iwai #include <linux/io.h> 45dd7b254dSGiuliano Pochini #include <sound/core.h> 46dd7b254dSGiuliano Pochini #include <sound/info.h> 47dd7b254dSGiuliano Pochini #include <sound/control.h> 48048b9450SGiuliano Pochini #include <sound/tlv.h> 49dd7b254dSGiuliano Pochini #include <sound/pcm.h> 50dd7b254dSGiuliano Pochini #include <sound/pcm_params.h> 51dd7b254dSGiuliano Pochini #include <sound/asoundef.h> 52dd7b254dSGiuliano Pochini #include <sound/initval.h> 5360063497SArun Sharma #include <linux/atomic.h> 54dd7b254dSGiuliano Pochini #include "echoaudio.h" 55dd7b254dSGiuliano Pochini 567e0af29dSClemens Ladisch MODULE_FIRMWARE("ea/loader_dsp.fw"); 577e0af29dSClemens Ladisch MODULE_FIRMWARE("ea/gina24_301_dsp.fw"); 587e0af29dSClemens Ladisch MODULE_FIRMWARE("ea/gina24_361_dsp.fw"); 597e0af29dSClemens Ladisch MODULE_FIRMWARE("ea/gina24_301_asic.fw"); 607e0af29dSClemens Ladisch MODULE_FIRMWARE("ea/gina24_361_asic.fw"); 617e0af29dSClemens Ladisch 62dd7b254dSGiuliano Pochini #define FW_361_LOADER 0 63dd7b254dSGiuliano Pochini #define FW_GINA24_301_DSP 1 64dd7b254dSGiuliano Pochini #define FW_GINA24_361_DSP 2 65dd7b254dSGiuliano Pochini #define FW_GINA24_301_ASIC 3 66dd7b254dSGiuliano Pochini #define FW_GINA24_361_ASIC 4 67dd7b254dSGiuliano Pochini 68dd7b254dSGiuliano Pochini static const struct firmware card_fw[] = { 69dd7b254dSGiuliano Pochini {0, "loader_dsp.fw"}, 70dd7b254dSGiuliano Pochini {0, "gina24_301_dsp.fw"}, 71dd7b254dSGiuliano Pochini {0, "gina24_361_dsp.fw"}, 72dd7b254dSGiuliano Pochini {0, "gina24_301_asic.fw"}, 73dd7b254dSGiuliano Pochini {0, "gina24_361_asic.fw"} 74dd7b254dSGiuliano Pochini }; 75dd7b254dSGiuliano Pochini 769baa3c34SBenoit Taine static const struct pci_device_id snd_echo_ids[] = { 77dd7b254dSGiuliano Pochini {0x1057, 0x1801, 0xECC0, 0x0050, 0, 0, 0}, /* DSP 56301 Gina24 rev.0 */ 78dd7b254dSGiuliano Pochini {0x1057, 0x1801, 0xECC0, 0x0051, 0, 0, 0}, /* DSP 56301 Gina24 rev.1 */ 79dd7b254dSGiuliano Pochini {0x1057, 0x3410, 0xECC0, 0x0050, 0, 0, 0}, /* DSP 56361 Gina24 rev.0 */ 80dd7b254dSGiuliano Pochini {0x1057, 0x3410, 0xECC0, 0x0051, 0, 0, 0}, /* DSP 56361 Gina24 rev.1 */ 81dd7b254dSGiuliano Pochini {0,} 82dd7b254dSGiuliano Pochini }; 83dd7b254dSGiuliano Pochini 84*c1c3981fSTakashi Iwai static const struct snd_pcm_hardware pcm_hardware_skel = { 85dd7b254dSGiuliano Pochini .info = SNDRV_PCM_INFO_MMAP | 86dd7b254dSGiuliano Pochini SNDRV_PCM_INFO_INTERLEAVED | 87dd7b254dSGiuliano Pochini SNDRV_PCM_INFO_BLOCK_TRANSFER | 88dd7b254dSGiuliano Pochini SNDRV_PCM_INFO_MMAP_VALID | 89dd7b254dSGiuliano Pochini SNDRV_PCM_INFO_PAUSE | 90dd7b254dSGiuliano Pochini SNDRV_PCM_INFO_SYNC_START, 91dd7b254dSGiuliano Pochini .formats = SNDRV_PCM_FMTBIT_U8 | 92dd7b254dSGiuliano Pochini SNDRV_PCM_FMTBIT_S16_LE | 93dd7b254dSGiuliano Pochini SNDRV_PCM_FMTBIT_S24_3LE | 94dd7b254dSGiuliano Pochini SNDRV_PCM_FMTBIT_S32_LE | 95dd7b254dSGiuliano Pochini SNDRV_PCM_FMTBIT_S32_BE, 96dd7b254dSGiuliano Pochini .rates = SNDRV_PCM_RATE_8000_48000 | 97dd7b254dSGiuliano Pochini SNDRV_PCM_RATE_88200 | 98dd7b254dSGiuliano Pochini SNDRV_PCM_RATE_96000, 99dd7b254dSGiuliano Pochini .rate_min = 8000, 100dd7b254dSGiuliano Pochini .rate_max = 96000, 101dd7b254dSGiuliano Pochini .channels_min = 1, 102dd7b254dSGiuliano Pochini .channels_max = 8, 103dd7b254dSGiuliano Pochini .buffer_bytes_max = 262144, 104dd7b254dSGiuliano Pochini .period_bytes_min = 32, 105dd7b254dSGiuliano Pochini .period_bytes_max = 131072, 106dd7b254dSGiuliano Pochini .periods_min = 2, 107dd7b254dSGiuliano Pochini .periods_max = 220, 108dd7b254dSGiuliano Pochini /* One page (4k) contains 512 instructions. I don't know if the hw 109dd7b254dSGiuliano Pochini supports lists longer than this. In this case periods_max=220 is a 110dd7b254dSGiuliano Pochini safe limit to make sure the list never exceeds 512 instructions. 111dd7b254dSGiuliano Pochini 220 ~= (512 - 1 - (BUFFER_BYTES_MAX / PAGE_SIZE)) / 2 */ 112dd7b254dSGiuliano Pochini }; 113dd7b254dSGiuliano Pochini 114dd7b254dSGiuliano Pochini #include "gina24_dsp.c" 115dd7b254dSGiuliano Pochini #include "echoaudio_dsp.c" 116dd7b254dSGiuliano Pochini #include "echoaudio_gml.c" 117dd7b254dSGiuliano Pochini #include "echoaudio.c" 118