xref: /openbmc/linux/sound/pci/echoaudio/mia.c (revision 9baa3c34)
1dd7b254dSGiuliano Pochini /*
2dd7b254dSGiuliano Pochini  *  ALSA driver for Echoaudio soundcards.
3dd7b254dSGiuliano Pochini  *  Copyright (C) 2003-2004 Giuliano Pochini <pochini@shiny.it>
4dd7b254dSGiuliano Pochini  *
5dd7b254dSGiuliano Pochini  *  This program is free software; you can redistribute it and/or modify
6dd7b254dSGiuliano Pochini  *  it under the terms of the GNU General Public License as published by
7dd7b254dSGiuliano Pochini  *  the Free Software Foundation; version 2 of the License.
8dd7b254dSGiuliano Pochini  *
9dd7b254dSGiuliano Pochini  *  This program is distributed in the hope that it will be useful,
10dd7b254dSGiuliano Pochini  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
11dd7b254dSGiuliano Pochini  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12dd7b254dSGiuliano Pochini  *  GNU General Public License for more details.
13dd7b254dSGiuliano Pochini  *
14dd7b254dSGiuliano Pochini  *  You should have received a copy of the GNU General Public License
15dd7b254dSGiuliano Pochini  *  along with this program; if not, write to the Free Software
16dd7b254dSGiuliano Pochini  *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17dd7b254dSGiuliano Pochini  */
18dd7b254dSGiuliano Pochini 
19dd7b254dSGiuliano Pochini #define ECHO24_FAMILY
20dd7b254dSGiuliano Pochini #define ECHOCARD_MIA
21dd7b254dSGiuliano Pochini #define ECHOCARD_NAME "Mia"
22dd7b254dSGiuliano Pochini #define ECHOCARD_HAS_MONITOR
23dd7b254dSGiuliano Pochini #define ECHOCARD_HAS_INPUT_NOMINAL_LEVEL
24dd7b254dSGiuliano Pochini #define ECHOCARD_HAS_OUTPUT_NOMINAL_LEVEL
25dd7b254dSGiuliano Pochini #define ECHOCARD_HAS_SUPER_INTERLEAVE
26dd7b254dSGiuliano Pochini #define ECHOCARD_HAS_VMIXER
27dd7b254dSGiuliano Pochini #define ECHOCARD_HAS_DIGITAL_IO
28dd7b254dSGiuliano Pochini #define ECHOCARD_HAS_EXTERNAL_CLOCK
29dd7b254dSGiuliano Pochini #define ECHOCARD_HAS_ADAT	FALSE
30dd7b254dSGiuliano Pochini #define ECHOCARD_HAS_STEREO_BIG_ENDIAN32
31dd7b254dSGiuliano Pochini #define ECHOCARD_HAS_MIDI
32392bf2f1SGiuliano Pochini #define ECHOCARD_HAS_LINE_OUT_GAIN
33dd7b254dSGiuliano Pochini 
34dd7b254dSGiuliano Pochini /* Pipe indexes */
35dd7b254dSGiuliano Pochini #define PX_ANALOG_OUT	0	/* 8 */
36dd7b254dSGiuliano Pochini #define PX_DIGITAL_OUT	8	/* 0 */
37dd7b254dSGiuliano Pochini #define PX_ANALOG_IN	8	/* 2 */
38dd7b254dSGiuliano Pochini #define PX_DIGITAL_IN	10	/* 2 */
39dd7b254dSGiuliano Pochini #define PX_NUM		12
40dd7b254dSGiuliano Pochini 
41dd7b254dSGiuliano Pochini /* Bus indexes */
42dd7b254dSGiuliano Pochini #define BX_ANALOG_OUT	0	/* 2 */
43dd7b254dSGiuliano Pochini #define BX_DIGITAL_OUT	2	/* 2 */
44dd7b254dSGiuliano Pochini #define BX_ANALOG_IN	4	/* 2 */
45dd7b254dSGiuliano Pochini #define BX_DIGITAL_IN	6	/* 2 */
46dd7b254dSGiuliano Pochini #define BX_NUM		8
47dd7b254dSGiuliano Pochini 
48dd7b254dSGiuliano Pochini 
49dd7b254dSGiuliano Pochini #include <linux/delay.h>
50dd7b254dSGiuliano Pochini #include <linux/init.h>
51dd7b254dSGiuliano Pochini #include <linux/interrupt.h>
52dd7b254dSGiuliano Pochini #include <linux/pci.h>
5365a77217SPaul Gortmaker #include <linux/module.h>
54dd7b254dSGiuliano Pochini #include <linux/firmware.h>
555a0e3ad6STejun Heo #include <linux/slab.h>
56dd7b254dSGiuliano Pochini #include <sound/core.h>
57dd7b254dSGiuliano Pochini #include <sound/info.h>
58dd7b254dSGiuliano Pochini #include <sound/control.h>
59048b9450SGiuliano Pochini #include <sound/tlv.h>
60dd7b254dSGiuliano Pochini #include <sound/pcm.h>
61dd7b254dSGiuliano Pochini #include <sound/pcm_params.h>
62dd7b254dSGiuliano Pochini #include <sound/asoundef.h>
63dd7b254dSGiuliano Pochini #include <sound/initval.h>
64dd7b254dSGiuliano Pochini #include <sound/rawmidi.h>
65dd7b254dSGiuliano Pochini #include <asm/io.h>
6660063497SArun Sharma #include <linux/atomic.h>
67dd7b254dSGiuliano Pochini #include "echoaudio.h"
68dd7b254dSGiuliano Pochini 
697e0af29dSClemens Ladisch MODULE_FIRMWARE("ea/loader_dsp.fw");
707e0af29dSClemens Ladisch MODULE_FIRMWARE("ea/mia_dsp.fw");
717e0af29dSClemens Ladisch 
72dd7b254dSGiuliano Pochini #define FW_361_LOADER	0
73dd7b254dSGiuliano Pochini #define FW_MIA_DSP	1
74dd7b254dSGiuliano Pochini 
75dd7b254dSGiuliano Pochini static const struct firmware card_fw[] = {
76dd7b254dSGiuliano Pochini 	{0, "loader_dsp.fw"},
77dd7b254dSGiuliano Pochini 	{0, "mia_dsp.fw"}
78dd7b254dSGiuliano Pochini };
79dd7b254dSGiuliano Pochini 
809baa3c34SBenoit Taine static const struct pci_device_id snd_echo_ids[] = {
81dd7b254dSGiuliano Pochini 	{0x1057, 0x3410, 0xECC0, 0x0080, 0, 0, 0},	/* DSP 56361 Mia rev.0 */
82dd7b254dSGiuliano Pochini 	{0x1057, 0x3410, 0xECC0, 0x0081, 0, 0, 0},	/* DSP 56361 Mia rev.1 */
83dd7b254dSGiuliano Pochini 	{0,}
84dd7b254dSGiuliano Pochini };
85dd7b254dSGiuliano Pochini 
86dd7b254dSGiuliano Pochini static struct snd_pcm_hardware pcm_hardware_skel = {
87dd7b254dSGiuliano Pochini 	.info = SNDRV_PCM_INFO_MMAP |
88dd7b254dSGiuliano Pochini 		SNDRV_PCM_INFO_INTERLEAVED |
89dd7b254dSGiuliano Pochini 		SNDRV_PCM_INFO_BLOCK_TRANSFER |
90dd7b254dSGiuliano Pochini 		SNDRV_PCM_INFO_MMAP_VALID |
91dd7b254dSGiuliano Pochini 		SNDRV_PCM_INFO_PAUSE |
92dd7b254dSGiuliano Pochini 		SNDRV_PCM_INFO_SYNC_START,
93dd7b254dSGiuliano Pochini 	.formats =	SNDRV_PCM_FMTBIT_U8 |
94dd7b254dSGiuliano Pochini 			SNDRV_PCM_FMTBIT_S16_LE |
95dd7b254dSGiuliano Pochini 			SNDRV_PCM_FMTBIT_S24_3LE |
96dd7b254dSGiuliano Pochini 			SNDRV_PCM_FMTBIT_S32_LE |
97dd7b254dSGiuliano Pochini 			SNDRV_PCM_FMTBIT_S32_BE,
98dd7b254dSGiuliano Pochini 	.rates = 	SNDRV_PCM_RATE_32000 |
99dd7b254dSGiuliano Pochini 			SNDRV_PCM_RATE_44100 |
100dd7b254dSGiuliano Pochini 			SNDRV_PCM_RATE_48000 |
101dd7b254dSGiuliano Pochini 			SNDRV_PCM_RATE_88200 |
102dd7b254dSGiuliano Pochini 			SNDRV_PCM_RATE_96000,
103dd7b254dSGiuliano Pochini 	.rate_min = 8000,
104dd7b254dSGiuliano Pochini 	.rate_max = 96000,
105dd7b254dSGiuliano Pochini 	.channels_min = 1,
106dd7b254dSGiuliano Pochini 	.channels_max = 8,
107dd7b254dSGiuliano Pochini 	.buffer_bytes_max = 262144,
108dd7b254dSGiuliano Pochini 	.period_bytes_min = 32,
109dd7b254dSGiuliano Pochini 	.period_bytes_max = 131072,
110dd7b254dSGiuliano Pochini 	.periods_min = 2,
111dd7b254dSGiuliano Pochini 	.periods_max = 220,
112dd7b254dSGiuliano Pochini 	/* One page (4k) contains 512 instructions. I don't know if the hw
113dd7b254dSGiuliano Pochini 	supports lists longer than this. In this case periods_max=220 is a
114dd7b254dSGiuliano Pochini 	safe limit to make sure the list never exceeds 512 instructions. */
115dd7b254dSGiuliano Pochini };
116dd7b254dSGiuliano Pochini 
117dd7b254dSGiuliano Pochini 
118dd7b254dSGiuliano Pochini #include "mia_dsp.c"
119dd7b254dSGiuliano Pochini #include "echoaudio_dsp.c"
120dd7b254dSGiuliano Pochini #include "echoaudio.c"
121dd7b254dSGiuliano Pochini #include "midi.c"
122