1 | #ifndef __ES1688_H
|
---|
2 | #define __ES1688_H
|
---|
3 |
|
---|
4 | /*
|
---|
5 | * Header file for ES488/ES1688
|
---|
6 | * Copyright (c) by Jaroslav Kysela <perex@suse.cz>
|
---|
7 | *
|
---|
8 | *
|
---|
9 | * This program is free software; you can redistribute it and/or modify
|
---|
10 | * it under the terms of the GNU General Public License as published by
|
---|
11 | * the Free Software Foundation; either version 2 of the License, or
|
---|
12 | * (at your option) any later version.
|
---|
13 | *
|
---|
14 | * This program is distributed in the hope that it will be useful,
|
---|
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
17 | * GNU General Public License for more details.
|
---|
18 | *
|
---|
19 | * You should have received a copy of the GNU General Public License
|
---|
20 | * along with this program; if not, write to the Free Software
|
---|
21 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
---|
22 | *
|
---|
23 | */
|
---|
24 |
|
---|
25 | #include "control.h"
|
---|
26 | #include "pcm.h"
|
---|
27 |
|
---|
28 | #define ES1688_HW_AUTO 0x0000
|
---|
29 | #define ES1688_HW_688 0x0001
|
---|
30 | #define ES1688_HW_1688 0x0002
|
---|
31 |
|
---|
32 | struct _snd_es1688 {
|
---|
33 | unsigned long port; /* port of ESS chip */
|
---|
34 | struct resource *res_port;
|
---|
35 | unsigned long mpu_port; /* MPU-401 port of ESS chip */
|
---|
36 | int irq; /* IRQ number of ESS chip */
|
---|
37 | int mpu_irq; /* MPU IRQ */
|
---|
38 | int dma8; /* 8-bit DMA */
|
---|
39 | unsigned short version; /* version of ESS chip */
|
---|
40 | unsigned short hardware; /* see to ES1688_HW_XXXX */
|
---|
41 |
|
---|
42 | unsigned short trigger_value;
|
---|
43 | unsigned char pad;
|
---|
44 | unsigned int dma_size;
|
---|
45 |
|
---|
46 | snd_card_t *card;
|
---|
47 | snd_pcm_t *pcm;
|
---|
48 | snd_pcm_substream_t *playback_substream;
|
---|
49 | snd_pcm_substream_t *capture_substream;
|
---|
50 |
|
---|
51 | spinlock_t reg_lock;
|
---|
52 | spinlock_t mixer_lock;
|
---|
53 | };
|
---|
54 |
|
---|
55 | typedef struct _snd_es1688 es1688_t;
|
---|
56 |
|
---|
57 | /* I/O ports */
|
---|
58 |
|
---|
59 | #define ES1688P(codec, x) ((codec)->port + e_s_s_ESS1688##x)
|
---|
60 |
|
---|
61 | #define e_s_s_ESS1688RESET 0x6
|
---|
62 | #define e_s_s_ESS1688READ 0xa
|
---|
63 | #define e_s_s_ESS1688WRITE 0xc
|
---|
64 | #define e_s_s_ESS1688COMMAND 0xc
|
---|
65 | #define e_s_s_ESS1688STATUS 0xc
|
---|
66 | #define e_s_s_ESS1688DATA_AVAIL 0xe
|
---|
67 | #define e_s_s_ESS1688DATA_AVAIL_16 0xf
|
---|
68 | #define e_s_s_ESS1688MIXER_ADDR 0x4
|
---|
69 | #define e_s_s_ESS1688MIXER_DATA 0x5
|
---|
70 | #define e_s_s_ESS1688OPL3_LEFT 0x0
|
---|
71 | #define e_s_s_ESS1688OPL3_RIGHT 0x2
|
---|
72 | #define e_s_s_ESS1688OPL3_BOTH 0x8
|
---|
73 | #define e_s_s_ESS1688ENABLE0 0x0
|
---|
74 | #define e_s_s_ESS1688ENABLE1 0x9
|
---|
75 | #define e_s_s_ESS1688ENABLE2 0xb
|
---|
76 | #define e_s_s_ESS1688INIT1 0x7
|
---|
77 |
|
---|
78 | #define ES1688_DSP_CMD_DMAOFF 0xd0
|
---|
79 | #define ES1688_DSP_CMD_SPKON 0xd1
|
---|
80 | #define ES1688_DSP_CMD_SPKOFF 0xd3
|
---|
81 | #define ES1688_DSP_CMD_DMAON 0xd4
|
---|
82 |
|
---|
83 | #define ES1688_PCM_DEV 0x14
|
---|
84 | #define ES1688_MIC_DEV 0x1a
|
---|
85 | #define ES1688_REC_DEV 0x1c
|
---|
86 | #define ES1688_MASTER_DEV 0x32
|
---|
87 | #define ES1688_FM_DEV 0x36
|
---|
88 | #define ES1688_CD_DEV 0x38
|
---|
89 | #define ES1688_AUX_DEV 0x3a
|
---|
90 | #define ES1688_SPEAKER_DEV 0x3c
|
---|
91 | #define ES1688_LINE_DEV 0x3e
|
---|
92 | #define ES1688_RECLEV_DEV 0xb4
|
---|
93 |
|
---|
94 | #define ES1688_MIXS_MASK 0x17
|
---|
95 | #define ES1688_MIXS_MIC 0x00
|
---|
96 | #define ES1688_MIXS_MIC_MASTER 0x01
|
---|
97 | #define ES1688_MIXS_CD 0x02
|
---|
98 | #define ES1688_MIXS_AOUT 0x03
|
---|
99 | #define ES1688_MIXS_MIC1 0x04
|
---|
100 | #define ES1688_MIXS_REC_MIX 0x05
|
---|
101 | #define ES1688_MIXS_LINE 0x06
|
---|
102 | #define ES1688_MIXS_MASTER 0x07
|
---|
103 | #define ES1688_MIXS_MUTE 0x10
|
---|
104 |
|
---|
105 | /*
|
---|
106 |
|
---|
107 | */
|
---|
108 |
|
---|
109 | void snd_es1688_mixer_write(es1688_t *chip, unsigned char reg, unsigned char data);
|
---|
110 | unsigned char snd_es1688_mixer_read(es1688_t *chip, unsigned char reg);
|
---|
111 |
|
---|
112 | void snd_es1688_interrupt(int irq, void *dev_id, struct pt_regs *regs);
|
---|
113 |
|
---|
114 | int snd_es1688_create(snd_card_t * card,
|
---|
115 | unsigned long port,
|
---|
116 | unsigned long mpu_port,
|
---|
117 | int irq,
|
---|
118 | int mpu_irq,
|
---|
119 | int dma8,
|
---|
120 | unsigned short hardware,
|
---|
121 | es1688_t ** rchip);
|
---|
122 | int snd_es1688_pcm(es1688_t *chip, int device, snd_pcm_t ** rpcm);
|
---|
123 | int snd_es1688_mixer(es1688_t *chip);
|
---|
124 |
|
---|
125 | #endif /* __ES1688_H */
|
---|