Lines 58-66
Link Here
|
58 |
MODULE_PARM_DESC(index, "Enable for the go7007 audio driver"); |
58 |
MODULE_PARM_DESC(index, "Enable for the go7007 audio driver"); |
59 |
|
59 |
|
60 |
struct go7007_snd { |
60 |
struct go7007_snd { |
61 |
snd_card_t *card; |
61 |
struct snd_card *card; |
62 |
snd_pcm_t *pcm; |
62 |
struct snd_pcm *pcm; |
63 |
snd_pcm_substream_t *substream; |
63 |
struct snd_pcm_substream *substream; |
64 |
spinlock_t lock; |
64 |
spinlock_t lock; |
65 |
int w_idx; |
65 |
int w_idx; |
66 |
int hw_ptr; |
66 |
int hw_ptr; |
Lines 68-74
Link Here
|
68 |
int capturing; |
68 |
int capturing; |
69 |
}; |
69 |
}; |
70 |
|
70 |
|
71 |
static snd_pcm_hardware_t go7007_snd_capture_hw = { |
71 |
static struct snd_pcm_hardware go7007_snd_capture_hw = { |
72 |
.info = (SNDRV_PCM_INFO_MMAP | |
72 |
.info = (SNDRV_PCM_INFO_MMAP | |
73 |
SNDRV_PCM_INFO_INTERLEAVED | |
73 |
SNDRV_PCM_INFO_INTERLEAVED | |
74 |
SNDRV_PCM_INFO_BLOCK_TRANSFER | |
74 |
SNDRV_PCM_INFO_BLOCK_TRANSFER | |
Lines 89-95
Link Here
|
89 |
static void parse_audio_stream_data(struct go7007 *go, u8 *buf, int length) |
89 |
static void parse_audio_stream_data(struct go7007 *go, u8 *buf, int length) |
90 |
{ |
90 |
{ |
91 |
struct go7007_snd *gosnd = go->snd_context; |
91 |
struct go7007_snd *gosnd = go->snd_context; |
92 |
snd_pcm_runtime_t *runtime = gosnd->substream->runtime; |
92 |
struct snd_pcm_runtime *runtime = gosnd->substream->runtime; |
93 |
int frames = bytes_to_frames(runtime, length); |
93 |
int frames = bytes_to_frames(runtime, length); |
94 |
|
94 |
|
95 |
spin_lock(&gosnd->lock); |
95 |
spin_lock(&gosnd->lock); |
Lines 119-126
Link Here
|
119 |
snd_pcm_period_elapsed(gosnd->substream); |
119 |
snd_pcm_period_elapsed(gosnd->substream); |
120 |
} |
120 |
} |
121 |
|
121 |
|
122 |
static int go7007_snd_hw_params(snd_pcm_substream_t *substream, |
122 |
static int go7007_snd_hw_params(struct snd_pcm_substream *substream, |
123 |
snd_pcm_hw_params_t *hw_params) |
123 |
struct snd_pcm_hw_params *hw_params) |
124 |
{ |
124 |
{ |
125 |
struct go7007 *go = snd_pcm_substream_chip(substream); |
125 |
struct go7007 *go = snd_pcm_substream_chip(substream); |
126 |
unsigned int bytes; |
126 |
unsigned int bytes; |
Lines 137-143
Link Here
|
137 |
return 0; |
137 |
return 0; |
138 |
} |
138 |
} |
139 |
|
139 |
|
140 |
static int go7007_snd_hw_free(snd_pcm_substream_t *substream) |
140 |
static int go7007_snd_hw_free(struct snd_pcm_substream *substream) |
141 |
{ |
141 |
{ |
142 |
struct go7007 *go = snd_pcm_substream_chip(substream); |
142 |
struct go7007 *go = snd_pcm_substream_chip(substream); |
143 |
|
143 |
|
Lines 148-154
Link Here
|
148 |
return 0; |
148 |
return 0; |
149 |
} |
149 |
} |
150 |
|
150 |
|
151 |
static int go7007_snd_capture_open(snd_pcm_substream_t *substream) |
151 |
static int go7007_snd_capture_open(struct snd_pcm_substream *substream) |
152 |
{ |
152 |
{ |
153 |
struct go7007 *go = snd_pcm_substream_chip(substream); |
153 |
struct go7007 *go = snd_pcm_substream_chip(substream); |
154 |
struct go7007_snd *gosnd = go->snd_context; |
154 |
struct go7007_snd *gosnd = go->snd_context; |
Lines 166-172
Link Here
|
166 |
return r; |
166 |
return r; |
167 |
} |
167 |
} |
168 |
|
168 |
|
169 |
static int go7007_snd_capture_close(snd_pcm_substream_t *substream) |
169 |
static int go7007_snd_capture_close(struct snd_pcm_substream *substream) |
170 |
{ |
170 |
{ |
171 |
struct go7007 *go = snd_pcm_substream_chip(substream); |
171 |
struct go7007 *go = snd_pcm_substream_chip(substream); |
172 |
struct go7007_snd *gosnd = go->snd_context; |
172 |
struct go7007_snd *gosnd = go->snd_context; |
Lines 175-186
Link Here
|
175 |
return 0; |
175 |
return 0; |
176 |
} |
176 |
} |
177 |
|
177 |
|
178 |
static int go7007_snd_pcm_prepare(snd_pcm_substream_t *substream) |
178 |
static int go7007_snd_pcm_prepare(struct snd_pcm_substream *substream) |
179 |
{ |
179 |
{ |
180 |
return 0; |
180 |
return 0; |
181 |
} |
181 |
} |
182 |
|
182 |
|
183 |
static int go7007_snd_pcm_trigger(snd_pcm_substream_t *substream, int cmd) |
183 |
static int go7007_snd_pcm_trigger(struct snd_pcm_substream *substream, int cmd) |
184 |
{ |
184 |
{ |
185 |
struct go7007 *go = snd_pcm_substream_chip(substream); |
185 |
struct go7007 *go = snd_pcm_substream_chip(substream); |
186 |
struct go7007_snd *gosnd = go->snd_context; |
186 |
struct go7007_snd *gosnd = go->snd_context; |
Lines 200-206
Link Here
|
200 |
} |
200 |
} |
201 |
} |
201 |
} |
202 |
|
202 |
|
203 |
static snd_pcm_uframes_t go7007_snd_pcm_pointer(snd_pcm_substream_t *substream) |
203 |
static snd_pcm_uframes_t go7007_snd_pcm_pointer(struct snd_pcm_substream *substream) |
204 |
{ |
204 |
{ |
205 |
struct go7007 *go = snd_pcm_substream_chip(substream); |
205 |
struct go7007 *go = snd_pcm_substream_chip(substream); |
206 |
struct go7007_snd *gosnd = go->snd_context; |
206 |
struct go7007_snd *gosnd = go->snd_context; |
Lines 208-220
Link Here
|
208 |
return gosnd->hw_ptr; |
208 |
return gosnd->hw_ptr; |
209 |
} |
209 |
} |
210 |
|
210 |
|
211 |
static struct page *go7007_snd_pcm_page(snd_pcm_substream_t *substream, |
211 |
static struct page *go7007_snd_pcm_page(struct snd_pcm_substream *substream, |
212 |
unsigned long offset) |
212 |
unsigned long offset) |
213 |
{ |
213 |
{ |
214 |
return vmalloc_to_page(substream->runtime->dma_area + offset); |
214 |
return vmalloc_to_page(substream->runtime->dma_area + offset); |
215 |
} |
215 |
} |
216 |
|
216 |
|
217 |
static snd_pcm_ops_t go7007_snd_capture_ops = { |
217 |
static struct snd_pcm_ops go7007_snd_capture_ops = { |
218 |
.open = go7007_snd_capture_open, |
218 |
.open = go7007_snd_capture_open, |
219 |
.close = go7007_snd_capture_close, |
219 |
.close = go7007_snd_capture_close, |
220 |
.ioctl = snd_pcm_lib_ioctl, |
220 |
.ioctl = snd_pcm_lib_ioctl, |
Lines 226-232
Link Here
|
226 |
.page = go7007_snd_pcm_page, |
226 |
.page = go7007_snd_pcm_page, |
227 |
}; |
227 |
}; |
228 |
|
228 |
|
229 |
static int go7007_snd_free(snd_device_t *device) |
229 |
static int go7007_snd_free(struct snd_device *device) |
230 |
{ |
230 |
{ |
231 |
struct go7007 *go = device->device_data; |
231 |
struct go7007 *go = device->device_data; |
232 |
|
232 |
|
Lines 237-243
Link Here
|
237 |
return 0; |
237 |
return 0; |
238 |
} |
238 |
} |
239 |
|
239 |
|
240 |
static snd_device_ops_t go7007_snd_device_ops = { |
240 |
static struct snd_device_ops go7007_snd_device_ops = { |
241 |
.dev_free = go7007_snd_free, |
241 |
.dev_free = go7007_snd_free, |
242 |
}; |
242 |
}; |
243 |
|
243 |
|