1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27#ifndef __INTELMID_H
28#define __INTELMID_H
29
30#include <linux/time.h>
31
32#define DRIVER_NAME_MFLD "msic_audio"
33#define DRIVER_NAME_MRST "pmic_audio"
34#define DRIVER_NAME "intelmid_audio"
35#define PMIC_SOUND_IRQ_TYPE_MASK (1 << 15)
36#define AUDINT_BASE (0xFFFFEFF8 + (6 * sizeof(u8)))
37#define REG_IRQ
38
39
40#define MAX_DEVICES 1
41#define MIN_RATE 8000
42#define MAX_RATE 48000
43#define MAX_BUFFER (800*1024)
44#define MIN_BUFFER (800*1024)
45#define MAX_PERIODS (1024*2)
46#define MIN_PERIODS 1
47#define MAX_PERIOD_BYTES MAX_BUFFER
48#define MIN_PERIOD_BYTES 32
49
50#define MAX_MUTE 1
51#define MIN_MUTE 0
52#define MONO_CNTL 1
53#define STEREO_CNTL 2
54#define MIN_CHANNEL 1
55#define MAX_CHANNEL_AMIC 2
56#define MAX_CHANNEL_DMIC 4
57#define FIFO_SIZE 0
58#define INTEL_MAD "Intel MAD"
59#define MAX_CTRL_MRST 7
60#define MAX_CTRL_MFLD 2
61#define MAX_CTRL 7
62#define MAX_VENDORS 4
63
64#define MAX_VOL 64
65
66#define MIN_VOL 0
67#define PLAYBACK_COUNT 1
68#define CAPTURE_COUNT 1
69
70extern int sst_card_vendor_id;
71
72struct mad_jack {
73 struct snd_jack jack;
74 int jack_status;
75 struct timeval buttonpressed;
76 struct timeval buttonreleased;
77};
78
79struct mad_jack_msg_wq {
80 u8 intsts;
81 struct snd_intelmad *intelmaddata;
82 struct work_struct wq;
83
84};
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108struct snd_intelmad {
109 struct snd_card *card;
110 int card_index;
111 char *card_id;
112 struct intel_sst_card_ops *sstdrv_ops;
113 struct platform_device *pdev;
114 int irq;
115 int pmic_status;
116 void __iomem *int_base;
117 int output_sel;
118 int input_sel;
119 int master_mute;
120 struct mad_jack jack[4];
121 int playback_cnt;
122 int capture_cnt;
123 struct mad_jack_msg_wq mad_jack_msg;
124 struct workqueue_struct *mad_jack_wq;
125 u8 jack_prev_state;
126 unsigned int cpu_id;
127};
128
129struct snd_control_val {
130 int playback_vol_max;
131 int playback_vol_min;
132 int capture_vol_max;
133 int capture_vol_min;
134};
135
136struct mad_stream_pvt {
137 int stream_status;
138 int stream_ops;
139 struct snd_pcm_substream *substream;
140 struct pcm_stream_info stream_info;
141 ssize_t dbg_cum_bytes;
142 enum snd_sst_device_type device;
143};
144
145enum mad_drv_status {
146 INIT = 1,
147 STARTED,
148 RUNNING,
149 PAUSED,
150 DROPPED,
151};
152
153enum mad_pmic_status {
154 PMIC_UNINIT = 1,
155 PMIC_INIT,
156};
157enum _widget_ctrl {
158 OUTPUT_SEL = 1,
159 INPUT_SEL,
160 PLAYBACK_VOL,
161 PLAYBACK_MUTE,
162 CAPTURE_VOL,
163 CAPTURE_MUTE,
164 MASTER_MUTE
165};
166
167void period_elapsed(void *mad_substream);
168int snd_intelmad_alloc_stream(struct snd_pcm_substream *substream);
169int snd_intelmad_init_stream(struct snd_pcm_substream *substream);
170
171int sst_sc_reg_access(struct sc_reg_access *sc_access,
172 int type, int num_val);
173#define CPU_CHIP_LINCROFT 1
174#define CPU_CHIP_PENWELL 2
175
176extern struct snd_control_val intelmad_ctrl_val[];
177extern struct snd_kcontrol_new snd_intelmad_controls_mrst[];
178extern struct snd_kcontrol_new snd_intelmad_controls_mfld[];
179extern struct snd_pmic_ops *intelmad_vendor_ops[];
180
181#endif
182