Lines Matching refs:buf

55 void saa7164_buffer_display(struct saa7164_buffer *buf)  in saa7164_buffer_display()  argument
57 struct saa7164_dev *dev = buf->port->dev; in saa7164_buffer_display()
61 __func__, buf, buf->idx); in saa7164_buffer_display()
63 buf->cpu, (long long)buf->dma, buf->pci_size); in saa7164_buffer_display()
65 buf->pt_cpu, (long long)buf->pt_dma, buf->pt_size); in saa7164_buffer_display()
71 i, buf->pt_cpu, (u64)*(buf->pt_cpu)); in saa7164_buffer_display()
82 struct saa7164_buffer *buf = NULL; in saa7164_buffer_alloc() local
91 buf = kzalloc(sizeof(*buf), GFP_KERNEL); in saa7164_buffer_alloc()
92 if (!buf) in saa7164_buffer_alloc()
95 buf->idx = -1; in saa7164_buffer_alloc()
96 buf->port = port; in saa7164_buffer_alloc()
97 buf->flags = SAA7164_BUFFER_FREE; in saa7164_buffer_alloc()
98 buf->pos = 0; in saa7164_buffer_alloc()
99 buf->actual_size = params->pitch * params->numberoflines; in saa7164_buffer_alloc()
100 buf->crc = 0; in saa7164_buffer_alloc()
102 buf->pci_size = SAA7164_PT_ENTRIES * 0x1000; in saa7164_buffer_alloc()
103 buf->pt_size = (SAA7164_PT_ENTRIES * sizeof(u64)) + 0x1000; in saa7164_buffer_alloc()
106 buf->cpu = dma_alloc_coherent(&port->dev->pci->dev, buf->pci_size, in saa7164_buffer_alloc()
107 &buf->dma, GFP_KERNEL); in saa7164_buffer_alloc()
108 if (!buf->cpu) in saa7164_buffer_alloc()
111 buf->pt_cpu = dma_alloc_coherent(&port->dev->pci->dev, buf->pt_size, in saa7164_buffer_alloc()
112 &buf->pt_dma, GFP_KERNEL); in saa7164_buffer_alloc()
113 if (!buf->pt_cpu) in saa7164_buffer_alloc()
117 memset(buf->cpu, 0xff, buf->pci_size); in saa7164_buffer_alloc()
118 buf->crc = crc32(0, buf->cpu, buf->actual_size); in saa7164_buffer_alloc()
119 memset(buf->pt_cpu, 0xff, buf->pt_size); in saa7164_buffer_alloc()
122 __func__, buf, params->numpagetables); in saa7164_buffer_alloc()
124 buf->cpu, (long)buf->dma, buf->pci_size); in saa7164_buffer_alloc()
126 buf->pt_cpu, (long)buf->pt_dma, buf->pt_size); in saa7164_buffer_alloc()
131 *(buf->pt_cpu + i) = buf->dma + (i * 0x1000); /* TODO */ in saa7164_buffer_alloc()
133 i, buf->pt_cpu, (u64)*(buf->pt_cpu)); in saa7164_buffer_alloc()
140 dma_free_coherent(&port->dev->pci->dev, buf->pci_size, buf->cpu, in saa7164_buffer_alloc()
141 buf->dma); in saa7164_buffer_alloc()
143 kfree(buf); in saa7164_buffer_alloc()
145 buf = NULL; in saa7164_buffer_alloc()
147 return buf; in saa7164_buffer_alloc()
150 int saa7164_buffer_dealloc(struct saa7164_buffer *buf) in saa7164_buffer_dealloc() argument
154 if (!buf || !buf->port) in saa7164_buffer_dealloc()
156 dev = buf->port->dev; in saa7164_buffer_dealloc()
159 __func__, buf); in saa7164_buffer_dealloc()
161 if (buf->flags != SAA7164_BUFFER_FREE) in saa7164_buffer_dealloc()
164 dma_free_coherent(&dev->pci->dev, buf->pci_size, buf->cpu, buf->dma); in saa7164_buffer_dealloc()
165 dma_free_coherent(&dev->pci->dev, buf->pt_size, buf->pt_cpu, in saa7164_buffer_dealloc()
166 buf->pt_dma); in saa7164_buffer_dealloc()
168 kfree(buf); in saa7164_buffer_dealloc()
188 int saa7164_buffer_activate(struct saa7164_buffer *buf, int i) in saa7164_buffer_activate() argument
190 struct saa7164_port *port = buf->port; in saa7164_buffer_activate()
198 buf->idx = i; /* Note of which buffer list index position we occupy */ in saa7164_buffer_activate()
199 buf->flags = SAA7164_BUFFER_BUSY; in saa7164_buffer_activate()
200 buf->pos = 0; in saa7164_buffer_activate()
204 saa7164_writel(port->bufptr32h + ((sizeof(u32) * 2) * i), buf->pt_dma); in saa7164_buffer_activate()
208 buf->idx, in saa7164_buffer_activate()
215 buf->idx); in saa7164_buffer_activate()
224 struct saa7164_buffer *buf; in saa7164_buffer_cfg_port() local
253 buf = list_entry(c, struct saa7164_buffer, list); in saa7164_buffer_cfg_port()
255 BUG_ON(buf->flags != SAA7164_BUFFER_FREE); in saa7164_buffer_cfg_port()
258 saa7164_buffer_activate(buf, i); in saa7164_buffer_cfg_port()
273 struct saa7164_user_buffer *buf; in saa7164_buffer_alloc_user() local
275 buf = kzalloc(sizeof(*buf), GFP_KERNEL); in saa7164_buffer_alloc_user()
276 if (!buf) in saa7164_buffer_alloc_user()
279 buf->data = kzalloc(len, GFP_KERNEL); in saa7164_buffer_alloc_user()
281 if (!buf->data) { in saa7164_buffer_alloc_user()
282 kfree(buf); in saa7164_buffer_alloc_user()
286 buf->actual_size = len; in saa7164_buffer_alloc_user()
287 buf->pos = 0; in saa7164_buffer_alloc_user()
288 buf->crc = 0; in saa7164_buffer_alloc_user()
291 __func__, buf); in saa7164_buffer_alloc_user()
293 return buf; in saa7164_buffer_alloc_user()
296 void saa7164_buffer_dealloc_user(struct saa7164_user_buffer *buf) in saa7164_buffer_dealloc_user() argument
298 if (!buf) in saa7164_buffer_dealloc_user()
301 kfree(buf->data); in saa7164_buffer_dealloc_user()
302 buf->data = NULL; in saa7164_buffer_dealloc_user()
304 kfree(buf); in saa7164_buffer_dealloc_user()