Lines Matching defs:gosnd
81 struct go7007_snd *gosnd = go->snd_context;
82 struct snd_pcm_runtime *runtime = gosnd->substream->runtime;
85 spin_lock(&gosnd->lock);
86 gosnd->hw_ptr += frames;
87 if (gosnd->hw_ptr >= runtime->buffer_size)
88 gosnd->hw_ptr -= runtime->buffer_size;
89 gosnd->avail += frames;
90 spin_unlock(&gosnd->lock);
91 if (gosnd->w_idx + length > runtime->dma_bytes) {
92 int cpy = runtime->dma_bytes - gosnd->w_idx;
94 memcpy(runtime->dma_area + gosnd->w_idx, buf, cpy);
97 gosnd->w_idx = 0;
99 memcpy(runtime->dma_area + gosnd->w_idx, buf, length);
100 gosnd->w_idx += length;
101 spin_lock(&gosnd->lock);
102 if (gosnd->avail < runtime->period_size) {
103 spin_unlock(&gosnd->lock);
106 gosnd->avail -= runtime->period_size;
107 spin_unlock(&gosnd->lock);
108 if (gosnd->capturing)
109 snd_pcm_period_elapsed(gosnd->substream);
144 struct go7007_snd *gosnd = go->snd_context;
148 spin_lock_irqsave(&gosnd->lock, flags);
149 if (gosnd->substream == NULL) {
150 gosnd->substream = substream;
155 spin_unlock_irqrestore(&gosnd->lock, flags);
162 struct go7007_snd *gosnd = go->snd_context;
164 gosnd->substream = NULL;
176 struct go7007_snd *gosnd = go->snd_context;
182 gosnd->capturing = 1;
185 gosnd->hw_ptr = gosnd->w_idx = gosnd->avail = 0;
186 gosnd->capturing = 0;
196 struct go7007_snd *gosnd = go->snd_context;
198 return gosnd->hw_ptr;
237 struct go7007_snd *gosnd;
246 gosnd = kmalloc(sizeof(struct go7007_snd), GFP_KERNEL);
247 if (gosnd == NULL)
249 spin_lock_init(&gosnd->lock);
250 gosnd->hw_ptr = gosnd->w_idx = gosnd->avail = 0;
251 gosnd->capturing = 0;
253 &gosnd->card);
255 kfree(gosnd);
258 ret = snd_device_new(gosnd->card, SNDRV_DEV_LOWLEVEL, go,
261 kfree(gosnd);
264 snd_card_set_dev(gosnd->card, go->dev);
265 ret = snd_pcm_new(gosnd->card, "go7007", 0, 0, 1, &gosnd->pcm);
267 snd_card_free(gosnd->card);
268 kfree(gosnd);
271 strncpy(gosnd->card->driver, "go7007", sizeof(gosnd->card->driver));
272 strncpy(gosnd->card->shortname, go->name, sizeof(gosnd->card->driver));
273 strncpy(gosnd->card->longname, gosnd->card->shortname,
274 sizeof(gosnd->card->longname));
276 gosnd->pcm->private_data = go;
277 snd_pcm_set_ops(gosnd->pcm, SNDRV_PCM_STREAM_CAPTURE,
280 ret = snd_card_register(gosnd->card);
282 snd_card_free(gosnd->card);
283 kfree(gosnd);
287 gosnd->substream = NULL;
288 go->snd_context = gosnd;
298 struct go7007_snd *gosnd = go->snd_context;
300 snd_card_disconnect(gosnd->card);
301 snd_card_free_when_closed(gosnd->card);