Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0-only
0002 /*
0003  *  ALSA driver for Echoaudio soundcards.
0004  *  Copyright (C) 2003-2004 Giuliano Pochini <pochini@shiny.it>
0005  */
0006 
0007 #define ECHO24_FAMILY
0008 #define ECHOCARD_GINA24
0009 #define ECHOCARD_NAME "Gina24"
0010 #define ECHOCARD_HAS_MONITOR
0011 #define ECHOCARD_HAS_ASIC
0012 #define ECHOCARD_HAS_INPUT_NOMINAL_LEVEL
0013 #define ECHOCARD_HAS_OUTPUT_NOMINAL_LEVEL
0014 #define ECHOCARD_HAS_SUPER_INTERLEAVE
0015 #define ECHOCARD_HAS_DIGITAL_IO
0016 #define ECHOCARD_HAS_DIGITAL_IN_AUTOMUTE
0017 #define ECHOCARD_HAS_DIGITAL_MODE_SWITCH
0018 #define ECHOCARD_HAS_EXTERNAL_CLOCK
0019 #define ECHOCARD_HAS_ADAT   6
0020 #define ECHOCARD_HAS_STEREO_BIG_ENDIAN32
0021 
0022 /* Pipe indexes */
0023 #define PX_ANALOG_OUT   0   /* 8 */
0024 #define PX_DIGITAL_OUT  8   /* 8 */
0025 #define PX_ANALOG_IN    16  /* 2 */
0026 #define PX_DIGITAL_IN   18  /* 8 */
0027 #define PX_NUM      26
0028 
0029 /* Bus indexes */
0030 #define BX_ANALOG_OUT   0   /* 8 */
0031 #define BX_DIGITAL_OUT  8   /* 8 */
0032 #define BX_ANALOG_IN    16  /* 2 */
0033 #define BX_DIGITAL_IN   18  /* 8 */
0034 #define BX_NUM      26
0035 
0036 
0037 #include <linux/delay.h>
0038 #include <linux/init.h>
0039 #include <linux/interrupt.h>
0040 #include <linux/pci.h>
0041 #include <linux/module.h>
0042 #include <linux/firmware.h>
0043 #include <linux/slab.h>
0044 #include <linux/io.h>
0045 #include <sound/core.h>
0046 #include <sound/info.h>
0047 #include <sound/control.h>
0048 #include <sound/tlv.h>
0049 #include <sound/pcm.h>
0050 #include <sound/pcm_params.h>
0051 #include <sound/asoundef.h>
0052 #include <sound/initval.h>
0053 #include <linux/atomic.h>
0054 #include "echoaudio.h"
0055 
0056 MODULE_FIRMWARE("ea/loader_dsp.fw");
0057 MODULE_FIRMWARE("ea/gina24_301_dsp.fw");
0058 MODULE_FIRMWARE("ea/gina24_361_dsp.fw");
0059 MODULE_FIRMWARE("ea/gina24_301_asic.fw");
0060 MODULE_FIRMWARE("ea/gina24_361_asic.fw");
0061 
0062 #define FW_361_LOADER       0
0063 #define FW_GINA24_301_DSP   1
0064 #define FW_GINA24_361_DSP   2
0065 #define FW_GINA24_301_ASIC  3
0066 #define FW_GINA24_361_ASIC  4
0067 
0068 static const struct firmware card_fw[] = {
0069     {0, "loader_dsp.fw"},
0070     {0, "gina24_301_dsp.fw"},
0071     {0, "gina24_361_dsp.fw"},
0072     {0, "gina24_301_asic.fw"},
0073     {0, "gina24_361_asic.fw"}
0074 };
0075 
0076 static const struct pci_device_id snd_echo_ids[] = {
0077     {0x1057, 0x1801, 0xECC0, 0x0050, 0, 0, 0},  /* DSP 56301 Gina24 rev.0 */
0078     {0x1057, 0x1801, 0xECC0, 0x0051, 0, 0, 0},  /* DSP 56301 Gina24 rev.1 */
0079     {0x1057, 0x3410, 0xECC0, 0x0050, 0, 0, 0},  /* DSP 56361 Gina24 rev.0 */
0080     {0x1057, 0x3410, 0xECC0, 0x0051, 0, 0, 0},  /* DSP 56361 Gina24 rev.1 */
0081     {0,}
0082 };
0083 
0084 static const struct snd_pcm_hardware pcm_hardware_skel = {
0085     .info = SNDRV_PCM_INFO_MMAP |
0086         SNDRV_PCM_INFO_INTERLEAVED |
0087         SNDRV_PCM_INFO_BLOCK_TRANSFER |
0088         SNDRV_PCM_INFO_MMAP_VALID |
0089         SNDRV_PCM_INFO_PAUSE |
0090         SNDRV_PCM_INFO_SYNC_START,
0091     .formats =  SNDRV_PCM_FMTBIT_U8 |
0092             SNDRV_PCM_FMTBIT_S16_LE |
0093             SNDRV_PCM_FMTBIT_S24_3LE |
0094             SNDRV_PCM_FMTBIT_S32_LE |
0095             SNDRV_PCM_FMTBIT_S32_BE,
0096     .rates =    SNDRV_PCM_RATE_8000_48000 |
0097             SNDRV_PCM_RATE_88200 |
0098             SNDRV_PCM_RATE_96000,
0099     .rate_min = 8000,
0100     .rate_max = 96000,
0101     .channels_min = 1,
0102     .channels_max = 8,
0103     .buffer_bytes_max = 262144,
0104     .period_bytes_min = 32,
0105     .period_bytes_max = 131072,
0106     .periods_min = 2,
0107     .periods_max = 220,
0108     /* One page (4k) contains 512 instructions. I don't know if the hw
0109     supports lists longer than this. In this case periods_max=220 is a
0110     safe limit to make sure the list never exceeds 512 instructions.
0111     220 ~= (512 - 1 - (BUFFER_BYTES_MAX / PAGE_SIZE)) / 2 */
0112 };
0113 
0114 #include "gina24_dsp.c"
0115 #include "echoaudio_dsp.c"
0116 #include "echoaudio_gml.c"
0117 #include "echoaudio.c"