Lines Matching refs:gosnd
66 struct go7007_snd *gosnd = go->snd_context;
67 struct snd_pcm_runtime *runtime = gosnd->substream->runtime;
71 spin_lock_irqsave(&gosnd->lock, flags);
72 gosnd->hw_ptr += frames;
73 if (gosnd->hw_ptr >= runtime->buffer_size)
74 gosnd->hw_ptr -= runtime->buffer_size;
75 gosnd->avail += frames;
76 spin_unlock_irqrestore(&gosnd->lock, flags);
77 if (gosnd->w_idx + length > runtime->dma_bytes) {
78 int cpy = runtime->dma_bytes - gosnd->w_idx;
80 memcpy(runtime->dma_area + gosnd->w_idx, buf, cpy);
83 gosnd->w_idx = 0;
85 memcpy(runtime->dma_area + gosnd->w_idx, buf, length);
86 gosnd->w_idx += length;
87 spin_lock_irqsave(&gosnd->lock, flags);
88 if (gosnd->avail < runtime->period_size) {
89 spin_unlock_irqrestore(&gosnd->lock, flags);
92 gosnd->avail -= runtime->period_size;
93 spin_unlock_irqrestore(&gosnd->lock, flags);
94 if (gosnd->capturing)
95 snd_pcm_period_elapsed(gosnd->substream);
118 struct go7007_snd *gosnd = go->snd_context;
122 spin_lock_irqsave(&gosnd->lock, flags);
123 if (gosnd->substream == NULL) {
124 gosnd->substream = substream;
129 spin_unlock_irqrestore(&gosnd->lock, flags);
136 struct go7007_snd *gosnd = go->snd_context;
138 gosnd->substream = NULL;
150 struct go7007_snd *gosnd = go->snd_context;
156 gosnd->capturing = 1;
159 gosnd->hw_ptr = gosnd->w_idx = gosnd->avail = 0;
160 gosnd->capturing = 0;
170 struct go7007_snd *gosnd = go->snd_context;
172 return gosnd->hw_ptr;
201 struct go7007_snd *gosnd;
210 gosnd = kmalloc(sizeof(struct go7007_snd), GFP_KERNEL);
211 if (gosnd == NULL)
213 spin_lock_init(&gosnd->lock);
214 gosnd->hw_ptr = gosnd->w_idx = gosnd->avail = 0;
215 gosnd->capturing = 0;
217 &gosnd->card);
221 ret = snd_device_new(gosnd->card, SNDRV_DEV_LOWLEVEL, go,
226 ret = snd_pcm_new(gosnd->card, "go7007", 0, 0, 1, &gosnd->pcm);
230 strscpy(gosnd->card->driver, "go7007", sizeof(gosnd->card->driver));
231 strscpy(gosnd->card->shortname, go->name, sizeof(gosnd->card->shortname));
232 strscpy(gosnd->card->longname, gosnd->card->shortname,
233 sizeof(gosnd->card->longname));
235 gosnd->pcm->private_data = go;
236 snd_pcm_set_ops(gosnd->pcm, SNDRV_PCM_STREAM_CAPTURE,
238 snd_pcm_set_managed_buffer_all(gosnd->pcm, SNDRV_DMA_TYPE_VMALLOC,
241 ret = snd_card_register(gosnd->card);
245 gosnd->substream = NULL;
246 go->snd_context = gosnd;
253 snd_card_free(gosnd->card);
255 kfree(gosnd);
262 struct go7007_snd *gosnd = go->snd_context;
264 snd_card_disconnect(gosnd->card);
265 snd_card_free_when_closed(gosnd->card);