18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0-only 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * ALSA driver for Echoaudio soundcards. 48c2ecf20Sopenharmony_ci * Copyright (C) 2003-2004 Giuliano Pochini <pochini@shiny.it> 58c2ecf20Sopenharmony_ci */ 68c2ecf20Sopenharmony_ci 78c2ecf20Sopenharmony_ci#define ECHO24_FAMILY 88c2ecf20Sopenharmony_ci#define ECHOCARD_GINA24 98c2ecf20Sopenharmony_ci#define ECHOCARD_NAME "Gina24" 108c2ecf20Sopenharmony_ci#define ECHOCARD_HAS_MONITOR 118c2ecf20Sopenharmony_ci#define ECHOCARD_HAS_ASIC 128c2ecf20Sopenharmony_ci#define ECHOCARD_HAS_INPUT_NOMINAL_LEVEL 138c2ecf20Sopenharmony_ci#define ECHOCARD_HAS_OUTPUT_NOMINAL_LEVEL 148c2ecf20Sopenharmony_ci#define ECHOCARD_HAS_SUPER_INTERLEAVE 158c2ecf20Sopenharmony_ci#define ECHOCARD_HAS_DIGITAL_IO 168c2ecf20Sopenharmony_ci#define ECHOCARD_HAS_DIGITAL_IN_AUTOMUTE 178c2ecf20Sopenharmony_ci#define ECHOCARD_HAS_DIGITAL_MODE_SWITCH 188c2ecf20Sopenharmony_ci#define ECHOCARD_HAS_EXTERNAL_CLOCK 198c2ecf20Sopenharmony_ci#define ECHOCARD_HAS_ADAT 6 208c2ecf20Sopenharmony_ci#define ECHOCARD_HAS_STEREO_BIG_ENDIAN32 218c2ecf20Sopenharmony_ci 228c2ecf20Sopenharmony_ci/* Pipe indexes */ 238c2ecf20Sopenharmony_ci#define PX_ANALOG_OUT 0 /* 8 */ 248c2ecf20Sopenharmony_ci#define PX_DIGITAL_OUT 8 /* 8 */ 258c2ecf20Sopenharmony_ci#define PX_ANALOG_IN 16 /* 2 */ 268c2ecf20Sopenharmony_ci#define PX_DIGITAL_IN 18 /* 8 */ 278c2ecf20Sopenharmony_ci#define PX_NUM 26 288c2ecf20Sopenharmony_ci 298c2ecf20Sopenharmony_ci/* Bus indexes */ 308c2ecf20Sopenharmony_ci#define BX_ANALOG_OUT 0 /* 8 */ 318c2ecf20Sopenharmony_ci#define BX_DIGITAL_OUT 8 /* 8 */ 328c2ecf20Sopenharmony_ci#define BX_ANALOG_IN 16 /* 2 */ 338c2ecf20Sopenharmony_ci#define BX_DIGITAL_IN 18 /* 8 */ 348c2ecf20Sopenharmony_ci#define BX_NUM 26 358c2ecf20Sopenharmony_ci 368c2ecf20Sopenharmony_ci 378c2ecf20Sopenharmony_ci#include <linux/delay.h> 388c2ecf20Sopenharmony_ci#include <linux/init.h> 398c2ecf20Sopenharmony_ci#include <linux/interrupt.h> 408c2ecf20Sopenharmony_ci#include <linux/pci.h> 418c2ecf20Sopenharmony_ci#include <linux/module.h> 428c2ecf20Sopenharmony_ci#include <linux/firmware.h> 438c2ecf20Sopenharmony_ci#include <linux/slab.h> 448c2ecf20Sopenharmony_ci#include <linux/io.h> 458c2ecf20Sopenharmony_ci#include <sound/core.h> 468c2ecf20Sopenharmony_ci#include <sound/info.h> 478c2ecf20Sopenharmony_ci#include <sound/control.h> 488c2ecf20Sopenharmony_ci#include <sound/tlv.h> 498c2ecf20Sopenharmony_ci#include <sound/pcm.h> 508c2ecf20Sopenharmony_ci#include <sound/pcm_params.h> 518c2ecf20Sopenharmony_ci#include <sound/asoundef.h> 528c2ecf20Sopenharmony_ci#include <sound/initval.h> 538c2ecf20Sopenharmony_ci#include <linux/atomic.h> 548c2ecf20Sopenharmony_ci#include "echoaudio.h" 558c2ecf20Sopenharmony_ci 568c2ecf20Sopenharmony_ciMODULE_FIRMWARE("ea/loader_dsp.fw"); 578c2ecf20Sopenharmony_ciMODULE_FIRMWARE("ea/gina24_301_dsp.fw"); 588c2ecf20Sopenharmony_ciMODULE_FIRMWARE("ea/gina24_361_dsp.fw"); 598c2ecf20Sopenharmony_ciMODULE_FIRMWARE("ea/gina24_301_asic.fw"); 608c2ecf20Sopenharmony_ciMODULE_FIRMWARE("ea/gina24_361_asic.fw"); 618c2ecf20Sopenharmony_ci 628c2ecf20Sopenharmony_ci#define FW_361_LOADER 0 638c2ecf20Sopenharmony_ci#define FW_GINA24_301_DSP 1 648c2ecf20Sopenharmony_ci#define FW_GINA24_361_DSP 2 658c2ecf20Sopenharmony_ci#define FW_GINA24_301_ASIC 3 668c2ecf20Sopenharmony_ci#define FW_GINA24_361_ASIC 4 678c2ecf20Sopenharmony_ci 688c2ecf20Sopenharmony_cistatic const struct firmware card_fw[] = { 698c2ecf20Sopenharmony_ci {0, "loader_dsp.fw"}, 708c2ecf20Sopenharmony_ci {0, "gina24_301_dsp.fw"}, 718c2ecf20Sopenharmony_ci {0, "gina24_361_dsp.fw"}, 728c2ecf20Sopenharmony_ci {0, "gina24_301_asic.fw"}, 738c2ecf20Sopenharmony_ci {0, "gina24_361_asic.fw"} 748c2ecf20Sopenharmony_ci}; 758c2ecf20Sopenharmony_ci 768c2ecf20Sopenharmony_cistatic const struct pci_device_id snd_echo_ids[] = { 778c2ecf20Sopenharmony_ci {0x1057, 0x1801, 0xECC0, 0x0050, 0, 0, 0}, /* DSP 56301 Gina24 rev.0 */ 788c2ecf20Sopenharmony_ci {0x1057, 0x1801, 0xECC0, 0x0051, 0, 0, 0}, /* DSP 56301 Gina24 rev.1 */ 798c2ecf20Sopenharmony_ci {0x1057, 0x3410, 0xECC0, 0x0050, 0, 0, 0}, /* DSP 56361 Gina24 rev.0 */ 808c2ecf20Sopenharmony_ci {0x1057, 0x3410, 0xECC0, 0x0051, 0, 0, 0}, /* DSP 56361 Gina24 rev.1 */ 818c2ecf20Sopenharmony_ci {0,} 828c2ecf20Sopenharmony_ci}; 838c2ecf20Sopenharmony_ci 848c2ecf20Sopenharmony_cistatic const struct snd_pcm_hardware pcm_hardware_skel = { 858c2ecf20Sopenharmony_ci .info = SNDRV_PCM_INFO_MMAP | 868c2ecf20Sopenharmony_ci SNDRV_PCM_INFO_INTERLEAVED | 878c2ecf20Sopenharmony_ci SNDRV_PCM_INFO_BLOCK_TRANSFER | 888c2ecf20Sopenharmony_ci SNDRV_PCM_INFO_MMAP_VALID | 898c2ecf20Sopenharmony_ci SNDRV_PCM_INFO_PAUSE | 908c2ecf20Sopenharmony_ci SNDRV_PCM_INFO_SYNC_START, 918c2ecf20Sopenharmony_ci .formats = SNDRV_PCM_FMTBIT_U8 | 928c2ecf20Sopenharmony_ci SNDRV_PCM_FMTBIT_S16_LE | 938c2ecf20Sopenharmony_ci SNDRV_PCM_FMTBIT_S24_3LE | 948c2ecf20Sopenharmony_ci SNDRV_PCM_FMTBIT_S32_LE | 958c2ecf20Sopenharmony_ci SNDRV_PCM_FMTBIT_S32_BE, 968c2ecf20Sopenharmony_ci .rates = SNDRV_PCM_RATE_8000_48000 | 978c2ecf20Sopenharmony_ci SNDRV_PCM_RATE_88200 | 988c2ecf20Sopenharmony_ci SNDRV_PCM_RATE_96000, 998c2ecf20Sopenharmony_ci .rate_min = 8000, 1008c2ecf20Sopenharmony_ci .rate_max = 96000, 1018c2ecf20Sopenharmony_ci .channels_min = 1, 1028c2ecf20Sopenharmony_ci .channels_max = 8, 1038c2ecf20Sopenharmony_ci .buffer_bytes_max = 262144, 1048c2ecf20Sopenharmony_ci .period_bytes_min = 32, 1058c2ecf20Sopenharmony_ci .period_bytes_max = 131072, 1068c2ecf20Sopenharmony_ci .periods_min = 2, 1078c2ecf20Sopenharmony_ci .periods_max = 220, 1088c2ecf20Sopenharmony_ci /* One page (4k) contains 512 instructions. I don't know if the hw 1098c2ecf20Sopenharmony_ci supports lists longer than this. In this case periods_max=220 is a 1108c2ecf20Sopenharmony_ci safe limit to make sure the list never exceeds 512 instructions. 1118c2ecf20Sopenharmony_ci 220 ~= (512 - 1 - (BUFFER_BYTES_MAX / PAGE_SIZE)) / 2 */ 1128c2ecf20Sopenharmony_ci}; 1138c2ecf20Sopenharmony_ci 1148c2ecf20Sopenharmony_ci#include "gina24_dsp.c" 1158c2ecf20Sopenharmony_ci#include "echoaudio_dsp.c" 1168c2ecf20Sopenharmony_ci#include "echoaudio_gml.c" 1178c2ecf20Sopenharmony_ci#include "echoaudio.c" 118