Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 /* Copyright (C) 2018 Intel Corporation */
0003 
0004 #ifndef __IPU3_UTIL_H
0005 #define __IPU3_UTIL_H
0006 
0007 struct device;
0008 struct imgu_device;
0009 
0010 #define IPU3_CSS_POOL_SIZE      4
0011 
0012 /**
0013  * struct imgu_css_map - store DMA mapping info for buffer
0014  *
0015  * @size:       size of the buffer in bytes.
0016  * @vaddr:      kernel virtual address.
0017  * @daddr:      iova dma address to access IPU3.
0018  * @pages:      pages mapped to this buffer
0019  */
0020 struct imgu_css_map {
0021     size_t size;
0022     void *vaddr;
0023     dma_addr_t daddr;
0024     struct page **pages;
0025 };
0026 
0027 /**
0028  * struct imgu_css_pool - circular buffer pool definition
0029  *
0030  * @entry:      array with IPU3_CSS_POOL_SIZE elements.
0031  * @entry.param:    a &struct imgu_css_map for storing the mem mapping.
0032  * @entry.valid:    used to mark if the entry has valid data.
0033  * @last:       write pointer, initialized to IPU3_CSS_POOL_SIZE.
0034  */
0035 struct imgu_css_pool {
0036     struct {
0037         struct imgu_css_map param;
0038         bool valid;
0039     } entry[IPU3_CSS_POOL_SIZE];
0040     u32 last;
0041 };
0042 
0043 int imgu_css_dma_buffer_resize(struct imgu_device *imgu,
0044                    struct imgu_css_map *map, size_t size);
0045 void imgu_css_pool_cleanup(struct imgu_device *imgu,
0046                struct imgu_css_pool *pool);
0047 int imgu_css_pool_init(struct imgu_device *imgu, struct imgu_css_pool *pool,
0048                size_t size);
0049 void imgu_css_pool_get(struct imgu_css_pool *pool);
0050 void imgu_css_pool_put(struct imgu_css_pool *pool);
0051 const struct imgu_css_map *imgu_css_pool_last(struct imgu_css_pool *pool,
0052                           u32 last);
0053 
0054 #endif