1#ifndef __SOUND_ES1688_H
2#define __SOUND_ES1688_H
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25#include "control.h"
26#include "pcm.h"
27#include <linux/interrupt.h>
28
29#define ES1688_HW_AUTO 0x0000
30#define ES1688_HW_688 0x0001
31#define ES1688_HW_1688 0x0002
32
33struct snd_es1688 {
34 unsigned long port;
35 struct resource *res_port;
36 unsigned long mpu_port;
37 int irq;
38 int mpu_irq;
39 int dma8;
40 unsigned short version;
41 unsigned short hardware;
42
43 unsigned short trigger_value;
44 unsigned char pad;
45 unsigned int dma_size;
46
47 struct snd_pcm *pcm;
48 struct snd_pcm_substream *playback_substream;
49 struct snd_pcm_substream *capture_substream;
50
51 spinlock_t reg_lock;
52 spinlock_t mixer_lock;
53};
54
55
56
57#define ES1688P(codec, x) ((codec)->port + e_s_s_ESS1688##x)
58
59#define e_s_s_ESS1688RESET 0x6
60#define e_s_s_ESS1688READ 0xa
61#define e_s_s_ESS1688WRITE 0xc
62#define e_s_s_ESS1688COMMAND 0xc
63#define e_s_s_ESS1688STATUS 0xc
64#define e_s_s_ESS1688DATA_AVAIL 0xe
65#define e_s_s_ESS1688DATA_AVAIL_16 0xf
66#define e_s_s_ESS1688MIXER_ADDR 0x4
67#define e_s_s_ESS1688MIXER_DATA 0x5
68#define e_s_s_ESS1688OPL3_LEFT 0x0
69#define e_s_s_ESS1688OPL3_RIGHT 0x2
70#define e_s_s_ESS1688OPL3_BOTH 0x8
71#define e_s_s_ESS1688ENABLE0 0x0
72#define e_s_s_ESS1688ENABLE1 0x9
73#define e_s_s_ESS1688ENABLE2 0xb
74#define e_s_s_ESS1688INIT1 0x7
75
76#define ES1688_DSP_CMD_DMAOFF 0xd0
77#define ES1688_DSP_CMD_SPKON 0xd1
78#define ES1688_DSP_CMD_SPKOFF 0xd3
79#define ES1688_DSP_CMD_DMAON 0xd4
80
81#define ES1688_PCM_DEV 0x14
82#define ES1688_MIC_DEV 0x1a
83#define ES1688_REC_DEV 0x1c
84#define ES1688_MASTER_DEV 0x32
85#define ES1688_FM_DEV 0x36
86#define ES1688_CD_DEV 0x38
87#define ES1688_AUX_DEV 0x3a
88#define ES1688_SPEAKER_DEV 0x3c
89#define ES1688_LINE_DEV 0x3e
90#define ES1688_RECLEV_DEV 0xb4
91
92#define ES1688_MIXS_MASK 0x17
93#define ES1688_MIXS_MIC 0x00
94#define ES1688_MIXS_MIC_MASTER 0x01
95#define ES1688_MIXS_CD 0x02
96#define ES1688_MIXS_AOUT 0x03
97#define ES1688_MIXS_MIC1 0x04
98#define ES1688_MIXS_REC_MIX 0x05
99#define ES1688_MIXS_LINE 0x06
100#define ES1688_MIXS_MASTER 0x07
101#define ES1688_MIXS_MUTE 0x10
102
103
104
105
106
107void snd_es1688_mixer_write(struct snd_es1688 *chip, unsigned char reg, unsigned char data);
108
109int snd_es1688_create(struct snd_card *card,
110 struct snd_es1688 *chip,
111 unsigned long port,
112 unsigned long mpu_port,
113 int irq,
114 int mpu_irq,
115 int dma8,
116 unsigned short hardware);
117int snd_es1688_pcm(struct snd_card *card, struct snd_es1688 *chip, int device,
118 struct snd_pcm **rpcm);
119int snd_es1688_mixer(struct snd_card *card, struct snd_es1688 *chip);
120int snd_es1688_reset(struct snd_es1688 *chip);
121
122#endif
123