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_LAYLA24 9dd7b254dSGiuliano Pochini #define ECHOCARD_NAME "Layla24" 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 #define ECHOCARD_HAS_MIDI 22dd7b254dSGiuliano Pochini 23dd7b254dSGiuliano Pochini /* Pipe indexes */ 24dd7b254dSGiuliano Pochini #define PX_ANALOG_OUT 0 /* 8 */ 25dd7b254dSGiuliano Pochini #define PX_DIGITAL_OUT 8 /* 8 */ 26dd7b254dSGiuliano Pochini #define PX_ANALOG_IN 16 /* 8 */ 27dd7b254dSGiuliano Pochini #define PX_DIGITAL_IN 24 /* 8 */ 28dd7b254dSGiuliano Pochini #define PX_NUM 32 29dd7b254dSGiuliano Pochini 30dd7b254dSGiuliano Pochini /* Bus indexes */ 31dd7b254dSGiuliano Pochini #define BX_ANALOG_OUT 0 /* 8 */ 32dd7b254dSGiuliano Pochini #define BX_DIGITAL_OUT 8 /* 8 */ 33dd7b254dSGiuliano Pochini #define BX_ANALOG_IN 16 /* 8 */ 34dd7b254dSGiuliano Pochini #define BX_DIGITAL_IN 24 /* 8 */ 35dd7b254dSGiuliano Pochini #define BX_NUM 32 36dd7b254dSGiuliano Pochini 37dd7b254dSGiuliano Pochini 38dd7b254dSGiuliano Pochini #include <linux/delay.h> 39dd7b254dSGiuliano Pochini #include <linux/init.h> 40dd7b254dSGiuliano Pochini #include <linux/interrupt.h> 41dd7b254dSGiuliano Pochini #include <linux/pci.h> 4265a77217SPaul Gortmaker #include <linux/module.h> 43dd7b254dSGiuliano Pochini #include <linux/firmware.h> 445a0e3ad6STejun Heo #include <linux/slab.h> 456cbbfe1cSTakashi Iwai #include <linux/io.h> 46dd7b254dSGiuliano Pochini #include <sound/core.h> 47dd7b254dSGiuliano Pochini #include <sound/info.h> 48dd7b254dSGiuliano Pochini #include <sound/control.h> 49048b9450SGiuliano Pochini #include <sound/tlv.h> 50dd7b254dSGiuliano Pochini #include <sound/pcm.h> 51dd7b254dSGiuliano Pochini #include <sound/pcm_params.h> 52dd7b254dSGiuliano Pochini #include <sound/asoundef.h> 53dd7b254dSGiuliano Pochini #include <sound/initval.h> 54dd7b254dSGiuliano Pochini #include <sound/rawmidi.h> 5560063497SArun Sharma #include <linux/atomic.h> 56dd7b254dSGiuliano Pochini #include "echoaudio.h" 57dd7b254dSGiuliano Pochini 587e0af29dSClemens Ladisch MODULE_FIRMWARE("ea/loader_dsp.fw"); 597e0af29dSClemens Ladisch MODULE_FIRMWARE("ea/layla24_dsp.fw"); 607e0af29dSClemens Ladisch MODULE_FIRMWARE("ea/layla24_1_asic.fw"); 617e0af29dSClemens Ladisch MODULE_FIRMWARE("ea/layla24_2A_asic.fw"); 627e0af29dSClemens Ladisch MODULE_FIRMWARE("ea/layla24_2S_asic.fw"); 637e0af29dSClemens Ladisch 64dd7b254dSGiuliano Pochini #define FW_361_LOADER 0 65dd7b254dSGiuliano Pochini #define FW_LAYLA24_DSP 1 66dd7b254dSGiuliano Pochini #define FW_LAYLA24_1_ASIC 2 67dd7b254dSGiuliano Pochini #define FW_LAYLA24_2A_ASIC 3 68dd7b254dSGiuliano Pochini #define FW_LAYLA24_2S_ASIC 4 69dd7b254dSGiuliano Pochini 70dd7b254dSGiuliano Pochini static const struct firmware card_fw[] = { 71dd7b254dSGiuliano Pochini {0, "loader_dsp.fw"}, 72dd7b254dSGiuliano Pochini {0, "layla24_dsp.fw"}, 73dd7b254dSGiuliano Pochini {0, "layla24_1_asic.fw"}, 74dd7b254dSGiuliano Pochini {0, "layla24_2A_asic.fw"}, 75dd7b254dSGiuliano Pochini {0, "layla24_2S_asic.fw"} 76dd7b254dSGiuliano Pochini }; 77dd7b254dSGiuliano Pochini 789baa3c34SBenoit Taine static const struct pci_device_id snd_echo_ids[] = { 79dd7b254dSGiuliano Pochini {0x1057, 0x3410, 0xECC0, 0x0060, 0, 0, 0}, /* DSP 56361 Layla24 rev.0 */ 80dd7b254dSGiuliano Pochini {0,} 81dd7b254dSGiuliano Pochini }; 82dd7b254dSGiuliano Pochini 83*c1c3981fSTakashi Iwai static const struct snd_pcm_hardware pcm_hardware_skel = { 84dd7b254dSGiuliano Pochini .info = SNDRV_PCM_INFO_MMAP | 85dd7b254dSGiuliano Pochini SNDRV_PCM_INFO_INTERLEAVED | 86dd7b254dSGiuliano Pochini SNDRV_PCM_INFO_BLOCK_TRANSFER | 87dd7b254dSGiuliano Pochini SNDRV_PCM_INFO_MMAP_VALID | 88dd7b254dSGiuliano Pochini SNDRV_PCM_INFO_PAUSE | 89dd7b254dSGiuliano Pochini SNDRV_PCM_INFO_SYNC_START, 90dd7b254dSGiuliano Pochini .formats = SNDRV_PCM_FMTBIT_U8 | 91dd7b254dSGiuliano Pochini SNDRV_PCM_FMTBIT_S16_LE | 92dd7b254dSGiuliano Pochini SNDRV_PCM_FMTBIT_S24_3LE | 93dd7b254dSGiuliano Pochini SNDRV_PCM_FMTBIT_S32_LE | 94dd7b254dSGiuliano Pochini SNDRV_PCM_FMTBIT_S32_BE, 95dd7b254dSGiuliano Pochini .rates = SNDRV_PCM_RATE_8000_96000, 96dd7b254dSGiuliano Pochini .rate_min = 8000, 97dd7b254dSGiuliano Pochini .rate_max = 100000, 98dd7b254dSGiuliano Pochini .channels_min = 1, 99dd7b254dSGiuliano Pochini .channels_max = 8, 100dd7b254dSGiuliano Pochini .buffer_bytes_max = 262144, 101dd7b254dSGiuliano Pochini .period_bytes_min = 32, 102dd7b254dSGiuliano Pochini .period_bytes_max = 131072, 103dd7b254dSGiuliano Pochini .periods_min = 2, 104dd7b254dSGiuliano Pochini .periods_max = 220, 105dd7b254dSGiuliano Pochini /* One page (4k) contains 512 instructions. I don't know if the hw 106dd7b254dSGiuliano Pochini supports lists longer than this. In this case periods_max=220 is a 107dd7b254dSGiuliano Pochini safe limit to make sure the list never exceeds 512 instructions. */ 108dd7b254dSGiuliano Pochini }; 109dd7b254dSGiuliano Pochini 110dd7b254dSGiuliano Pochini 111dd7b254dSGiuliano Pochini #include "layla24_dsp.c" 112dd7b254dSGiuliano Pochini #include "echoaudio_dsp.c" 113dd7b254dSGiuliano Pochini #include "echoaudio_gml.c" 114dd7b254dSGiuliano Pochini #include "echoaudio.c" 115dd7b254dSGiuliano Pochini #include "midi.c" 116