Lines Matching refs:buf
63 struct ispstat_buffer *buf, in __isp_stat_buf_sync_magic() argument
70 dma_sync(stat->isp->dev, buf->dma_addr, 0, MAGIC_SIZE, dir); in __isp_stat_buf_sync_magic()
71 dma_sync(stat->isp->dev, buf->dma_addr + (buf_size & PAGE_MASK), in __isp_stat_buf_sync_magic()
76 struct ispstat_buffer *buf, in isp_stat_buf_sync_magic_for_device() argument
83 __isp_stat_buf_sync_magic(stat, buf, buf_size, dir, in isp_stat_buf_sync_magic_for_device()
88 struct ispstat_buffer *buf, in isp_stat_buf_sync_magic_for_cpu() argument
95 __isp_stat_buf_sync_magic(stat, buf, buf_size, dir, in isp_stat_buf_sync_magic_for_cpu()
100 struct ispstat_buffer *buf) in isp_stat_buf_check_magic() argument
103 buf->buf_size + AF_EXTRA_DATA : buf->buf_size; in isp_stat_buf_check_magic()
108 isp_stat_buf_sync_magic_for_cpu(stat, buf, buf_size, DMA_FROM_DEVICE); in isp_stat_buf_check_magic()
111 for (w = buf->virt_addr, end = w + MAGIC_SIZE; w < end; w++) in isp_stat_buf_check_magic()
122 for (w = buf->virt_addr + buf_size, end = w + MAGIC_SIZE; in isp_stat_buf_check_magic()
131 isp_stat_buf_sync_magic_for_device(stat, buf, buf_size, in isp_stat_buf_check_magic()
138 struct ispstat_buffer *buf) in isp_stat_buf_insert_magic() argument
143 isp_stat_buf_sync_magic_for_cpu(stat, buf, buf_size, DMA_FROM_DEVICE); in isp_stat_buf_insert_magic()
151 memset(buf->virt_addr, MAGIC_NUM, MAGIC_SIZE); in isp_stat_buf_insert_magic()
152 memset(buf->virt_addr + buf_size, MAGIC_NUM, MAGIC_SIZE); in isp_stat_buf_insert_magic()
154 isp_stat_buf_sync_magic_for_device(stat, buf, buf_size, in isp_stat_buf_insert_magic()
159 struct ispstat_buffer *buf) in isp_stat_buf_sync_for_device() argument
164 dma_sync_sg_for_device(stat->isp->dev, buf->sgt.sgl, in isp_stat_buf_sync_for_device()
165 buf->sgt.nents, DMA_FROM_DEVICE); in isp_stat_buf_sync_for_device()
169 struct ispstat_buffer *buf) in isp_stat_buf_sync_for_cpu() argument
174 dma_sync_sg_for_cpu(stat->isp->dev, buf->sgt.sgl, in isp_stat_buf_sync_for_cpu()
175 buf->sgt.nents, DMA_FROM_DEVICE); in isp_stat_buf_sync_for_cpu()
183 stat->buf[i].empty = 1; in isp_stat_buf_clear()
193 struct ispstat_buffer *curr = &stat->buf[i]; in __isp_stat_buf_find()
282 struct ispstat_buffer *buf; in isp_stat_buf_get() local
287 buf = isp_stat_buf_find_oldest(stat); in isp_stat_buf_get()
288 if (!buf) { in isp_stat_buf_get()
294 if (isp_stat_buf_check_magic(stat, buf)) { in isp_stat_buf_get()
298 buf->empty = 1; in isp_stat_buf_get()
305 stat->locked_buf = buf; in isp_stat_buf_get()
309 if (buf->buf_size > data->buf_size) { in isp_stat_buf_get()
316 isp_stat_buf_sync_for_cpu(stat, buf); in isp_stat_buf_get()
318 rval = copy_to_user(data->buf, in isp_stat_buf_get()
319 buf->virt_addr, in isp_stat_buf_get()
320 buf->buf_size); in isp_stat_buf_get()
326 buf = ERR_PTR(-EFAULT); in isp_stat_buf_get()
330 return buf; in isp_stat_buf_get()
340 struct ispstat_buffer *buf = &stat->buf[i]; in isp_stat_bufs_free() local
342 if (!buf->virt_addr) in isp_stat_bufs_free()
345 sg_free_table(&buf->sgt); in isp_stat_bufs_free()
347 dma_free_coherent(dev, stat->buf_alloc_size, buf->virt_addr, in isp_stat_bufs_free()
348 buf->dma_addr); in isp_stat_bufs_free()
350 buf->dma_addr = 0; in isp_stat_bufs_free()
351 buf->virt_addr = NULL; in isp_stat_bufs_free()
352 buf->empty = 1; in isp_stat_bufs_free()
363 struct ispstat_buffer *buf, in isp_stat_bufs_alloc_one() argument
368 buf->virt_addr = dma_alloc_coherent(dev, size, &buf->dma_addr, in isp_stat_bufs_alloc_one()
370 if (!buf->virt_addr) in isp_stat_bufs_alloc_one()
373 ret = dma_get_sgtable(dev, &buf->sgt, buf->virt_addr, buf->dma_addr, in isp_stat_bufs_alloc_one()
376 dma_free_coherent(dev, size, buf->virt_addr, buf->dma_addr); in isp_stat_bufs_alloc_one()
377 buf->virt_addr = NULL; in isp_stat_bufs_alloc_one()
378 buf->dma_addr = 0; in isp_stat_bufs_alloc_one()
433 struct ispstat_buffer *buf = &stat->buf[i]; in isp_stat_bufs_alloc() local
436 ret = isp_stat_bufs_alloc_one(dev, buf, size); in isp_stat_bufs_alloc()
445 buf->empty = 1; in isp_stat_bufs_alloc()
450 (unsigned long)buf->dma_addr, in isp_stat_bufs_alloc()
451 (unsigned long)buf->virt_addr); in isp_stat_bufs_alloc()
484 struct ispstat_buffer *buf; in omap3isp_stat_request_statistics() local
493 buf = isp_stat_buf_get(stat, data); in omap3isp_stat_request_statistics()
494 if (IS_ERR(buf)) { in omap3isp_stat_request_statistics()
496 return PTR_ERR(buf); in omap3isp_stat_request_statistics()
499 data->ts.tv_sec = buf->ts.tv_sec; in omap3isp_stat_request_statistics()
500 data->ts.tv_usec = buf->ts.tv_nsec / NSEC_PER_USEC; in omap3isp_stat_request_statistics()
501 data->config_counter = buf->config_counter; in omap3isp_stat_request_statistics()
502 data->frame_number = buf->frame_number; in omap3isp_stat_request_statistics()
503 data->buf_size = buf->buf_size; in omap3isp_stat_request_statistics()
505 buf->empty = 1; in omap3isp_stat_request_statistics()
1040 stat->buf = kcalloc(STAT_MAX_BUFS, sizeof(*stat->buf), GFP_KERNEL); in omap3isp_stat_init()
1041 if (!stat->buf) in omap3isp_stat_init()
1051 kfree(stat->buf); in omap3isp_stat_init()
1062 kfree(stat->buf); in omap3isp_stat_cleanup()