1 /* SPDX-License-Identifier: GPL-2.0-only */
6 * Copyright (C) 2005-2007 Freescale Semiconductor, Inc.
9 #ifndef __LINUX_DMA_IPU_DMA_H
10 #define __LINUX_DMA_IPU_DMA_H
12 #include <linux/types.h>
13 #include <linux/dmaengine.h>
15 /* IPU DMA Controller channel definitions. */
17 IDMAC_IC_0 = 0, /* IC (encoding task) to memory */
18 IDMAC_IC_1 = 1, /* IC (viewfinder task) to memory */
26 IDMAC_IC_7 = 7, /* IC (sensor data) to memory */
33 IDMAC_SDC_0 = 14, /* Background synchronous display data */
34 IDMAC_SDC_1 = 15, /* Foreground data (overlay) */
53 /* Order significant! */
54 enum ipu_channel_status {
56 IPU_CHANNEL_INITIALIZED,
61 #define IPU_CHANNELS_NUM 32
81 IPU_PIX_FMT_GENERIC_32,
89 enum ipu_color_space {
96 * Enumeration of IPU rotation modes
98 enum ipu_rotate_mode {
99 /* Note the enum values correspond to BAM value */
101 IPU_ROTATE_VERT_FLIP = 1,
102 IPU_ROTATE_HORIZ_FLIP = 2,
104 IPU_ROTATE_90_RIGHT = 4,
105 IPU_ROTATE_90_RIGHT_VFLIP = 5,
106 IPU_ROTATE_90_RIGHT_HFLIP = 6,
107 IPU_ROTATE_90_LEFT = 7,
111 * Enumeration of DI ports for ADC.
120 struct idmac_video_param {
121 unsigned short in_width;
122 unsigned short in_height;
123 uint32_t in_pixel_fmt;
124 unsigned short out_width;
125 unsigned short out_height;
126 uint32_t out_pixel_fmt;
127 unsigned short out_stride;
128 bool graphics_combine_en;
129 bool global_alpha_en;
131 enum display_port disp;
132 unsigned short out_left;
133 unsigned short out_top;
137 * Union of initialization parameters for a logical channel. So far only video
138 * parameters are used.
140 union ipu_channel_param {
141 struct idmac_video_param video;
144 struct idmac_tx_desc {
145 struct dma_async_tx_descriptor txd;
146 struct scatterlist *sg; /* scatterlist for this */
147 unsigned int sg_len; /* tx-descriptor. */
148 struct list_head list;
151 struct idmac_channel {
152 struct dma_chan dma_chan;
153 dma_cookie_t completed; /* last completed cookie */
154 union ipu_channel_param params;
155 enum ipu_channel link; /* input channel, linked to the output */
156 enum ipu_channel_status status;
157 void *client; /* Only one client per channel */
158 unsigned int n_tx_desc;
159 struct idmac_tx_desc *desc; /* allocated tx-descriptors */
160 struct scatterlist *sg[2]; /* scatterlist elements in buffer-0 and -1 */
161 struct list_head free_list; /* free tx-descriptors */
162 struct list_head queue; /* queued tx-descriptors */
163 spinlock_t lock; /* protects sg[0,1], queue */
164 struct mutex chan_mutex; /* protects status, cookie, free_list */
167 unsigned int eof_irq;
168 char eof_name[16]; /* EOF IRQ name for request_irq() */
171 #define to_tx_desc(tx) container_of(tx, struct idmac_tx_desc, txd)
172 #define to_idmac_chan(c) container_of(c, struct idmac_channel, dma_chan)
174 #endif /* __LINUX_DMA_IPU_DMA_H */