Lines Matching refs:pt
51 static void pt_putsamples(struct pt_data *pt, u16 *ptr, u16 left, u16 right) in pt_putsamples() argument
55 ptr[pt->copyptr] = left; in pt_putsamples()
56 idx = pt->copyptr + PT_SAMPLES/2; in pt_putsamples()
61 static inline int pt_can_write(struct pt_data *pt) in pt_can_write() argument
63 return pt->blocks_copied < pt->blocks_played + 8; in pt_can_write()
69 struct pt_data *pt = &card->pt; in pt_wait_for_write() local
71 if (nonblock && !pt_can_write(pt)) in pt_wait_for_write()
73 while (!pt_can_write(pt) && pt->state != PT_STATE_INACTIVE) { in pt_wait_for_write()
74 interruptible_sleep_on(&pt->wait); in pt_wait_for_write()
78 if (pt->state == PT_STATE_INACTIVE) in pt_wait_for_write()
88 struct pt_data *pt = &card->pt; in pt_putblock() local
96 spin_lock_irqsave(&card->pt.lock, flags); in pt_putblock()
98 pt_putsamples(pt, ptr, block[2*i], block[2*i+1]); in pt_putblock()
99 if (pt->copyptr == 0) in pt_putblock()
100 pt->copyptr = PT_SAMPLES; in pt_putblock()
101 pt->copyptr--; in pt_putblock()
105 pt->blocks_copied++; in pt_putblock()
106 if (pt->blocks_copied >= 4 && pt->state != PT_STATE_PLAYING) { in pt_putblock()
108 sblive_writeptr(card, GPR_BASE + pt->enable_gpr, 0, 1); in pt_putblock()
109 pt->state = PT_STATE_PLAYING; in pt_putblock()
111 spin_unlock_irqrestore(&card->pt.lock, flags); in pt_putblock()
119 struct pt_data *pt = &card->pt; in pt_setup() local
123 pt->old_spcs[i] = sblive_readptr(card, SPCS0 + i, 0); in pt_setup()
124 if (pt->spcs_to_use & (1 << i)) { in pt_setup()
129 if (pt->ac3data) in pt_setup()
141 struct pt_data *pt = &card->pt; in emu10k1_pt_write() local
150 if (pt->state == PT_STATE_INACTIVE) { in emu10k1_pt_write()
152 pt->playptr = PT_SAMPLES-1; in emu10k1_pt_write()
153 pt->copyptr = PT_INITPTR; in emu10k1_pt_write()
154 pt->blocks_played = pt->blocks_copied = 0; in emu10k1_pt_write()
156 pt->state = PT_STATE_ACTIVATED; in emu10k1_pt_write()
157 pt->buf = kmalloc(PT_BLOCKSIZE, GFP_KERNEL); in emu10k1_pt_write()
158 pt->prepend_size = 0; in emu10k1_pt_write()
159 if (pt->buf == NULL) in emu10k1_pt_write()
163 if (pt->prepend_size) { in emu10k1_pt_write()
164 int needed = PT_BLOCKSIZE - pt->prepend_size; in emu10k1_pt_write()
166 DPD(3, "prepend size %d, prepending %d bytes\n", pt->prepend_size, needed); in emu10k1_pt_write()
168 copy_from_user(pt->buf + pt->prepend_size, buffer, count); in emu10k1_pt_write()
169 pt->prepend_size += count; in emu10k1_pt_write()
170 DPD(3, "prepend size now %d\n", pt->prepend_size); in emu10k1_pt_write()
173 copy_from_user(pt->buf + pt->prepend_size, buffer, needed); in emu10k1_pt_write()
174 r = pt_putblock(wave_dev, (u16 *) pt->buf, nonblock); in emu10k1_pt_write()
178 pt->prepend_size = 0; in emu10k1_pt_write()
184 copy_from_user(pt->buf, bufptr, PT_BLOCKSIZE); in emu10k1_pt_write()
185 bufptr = (u16 *) pt->buf; in emu10k1_pt_write()
199 pt->prepend_size = i; in emu10k1_pt_write()
200 copy_from_user(pt->buf, buffer + bytes_copied, i); in emu10k1_pt_write()
209 struct pt_data *pt = &card->pt; in emu10k1_pt_stop() local
212 if (pt->state != PT_STATE_INACTIVE) { in emu10k1_pt_stop()
214 sblive_writeptr(card, GPR_BASE + pt->enable_gpr, 0, 0); in emu10k1_pt_stop()
216 if (pt->spcs_to_use & (1 << i)) in emu10k1_pt_stop()
217 sblive_writeptr(card, SPCS0 + i, 0, pt->old_spcs[i]); in emu10k1_pt_stop()
219 pt->state = PT_STATE_INACTIVE; in emu10k1_pt_stop()
220 kfree(pt->buf); in emu10k1_pt_stop()
227 struct pt_data *pt = &wave_dev->card->pt; in emu10k1_pt_waveout_update() local
230 if (pt->state == PT_STATE_PLAYING && pt->pos_gpr >= 0) { in emu10k1_pt_waveout_update()
231 pos = sblive_readptr(wave_dev->card, GPR_BASE + pt->pos_gpr, 0); in emu10k1_pt_waveout_update()
237 woinst->total_played = pt->blocks_played * woinst->buffer.fragment_size + pos; in emu10k1_pt_waveout_update()