Linux 6.7-rc7
[linux-modified.git] / sound / pci / echoaudio / mona.c
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 /*(DEBLOBBED)*/
55
56 #define FW_361_LOADER           0
57 #define FW_MONA_301_DSP         1
58 #define FW_MONA_361_DSP         2
59 #define FW_MONA_301_1_ASIC48    3
60 #define FW_MONA_301_1_ASIC96    4
61 #define FW_MONA_361_1_ASIC48    5
62 #define FW_MONA_361_1_ASIC96    6
63 #define FW_MONA_2_ASIC          7
64
65 static const struct firmware card_fw[] = {
66         {0, "/*(DEBLOBBED)*/"},
67         {0, "/*(DEBLOBBED)*/"},
68         {0, "/*(DEBLOBBED)*/"},
69         {0, "/*(DEBLOBBED)*/"},
70         {0, "/*(DEBLOBBED)*/"},
71         {0, "/*(DEBLOBBED)*/"},
72         {0, "/*(DEBLOBBED)*/"},
73         {0, "/*(DEBLOBBED)*/"}
74 };
75
76 static const struct pci_device_id snd_echo_ids[] = {
77         {0x1057, 0x1801, 0xECC0, 0x0070, 0, 0, 0},      /* DSP 56301 Mona rev.0 */
78         {0x1057, 0x1801, 0xECC0, 0x0071, 0, 0, 0},      /* DSP 56301 Mona rev.1 */
79         {0x1057, 0x1801, 0xECC0, 0x0072, 0, 0, 0},      /* DSP 56301 Mona rev.2 */
80         {0x1057, 0x3410, 0xECC0, 0x0070, 0, 0, 0},      /* DSP 56361 Mona rev.0 */
81         {0x1057, 0x3410, 0xECC0, 0x0071, 0, 0, 0},      /* DSP 56361 Mona rev.1 */
82         {0x1057, 0x3410, 0xECC0, 0x0072, 0, 0, 0},      /* DSP 56361 Mona rev.2 */
83         {0,}
84 };
85
86 static const struct snd_pcm_hardware pcm_hardware_skel = {
87         .info = SNDRV_PCM_INFO_MMAP |
88                 SNDRV_PCM_INFO_INTERLEAVED |
89                 SNDRV_PCM_INFO_BLOCK_TRANSFER |
90                 SNDRV_PCM_INFO_MMAP_VALID |
91                 SNDRV_PCM_INFO_PAUSE |
92                 SNDRV_PCM_INFO_SYNC_START,
93         .formats =      SNDRV_PCM_FMTBIT_U8 |
94                         SNDRV_PCM_FMTBIT_S16_LE |
95                         SNDRV_PCM_FMTBIT_S24_3LE |
96                         SNDRV_PCM_FMTBIT_S32_LE |
97                         SNDRV_PCM_FMTBIT_S32_BE,
98         .rates =        SNDRV_PCM_RATE_8000_48000 |
99                         SNDRV_PCM_RATE_88200 |
100                         SNDRV_PCM_RATE_96000,
101         .rate_min = 8000,
102         .rate_max = 96000,
103         .channels_min = 1,
104         .channels_max = 8,
105         .buffer_bytes_max = 262144,
106         .period_bytes_min = 32,
107         .period_bytes_max = 131072,
108         .periods_min = 2,
109         .periods_max = 220,
110         /* One page (4k) contains 512 instructions. I don't know if the hw
111         supports lists longer than this. In this case periods_max=220 is a
112         safe limit to make sure the list never exceeds 512 instructions. */
113 };
114
115
116 #include "mona_dsp.c"
117 #include "echoaudio_dsp.c"
118 #include "echoaudio_gml.c"
119 #include "echoaudio.c"