diff options
| author | Dave Airlie <airlied@redhat.com> | 2014-09-10 05:43:29 -0400 |
|---|---|---|
| committer | Dave Airlie <airlied@redhat.com> | 2014-09-10 05:43:29 -0400 |
| commit | fdcaa1dbb7c6ed419b10fb8cdb5001ab0a00538f (patch) | |
| tree | b1e27087862402b573bb90567e27e4a739b82310 /include | |
| parent | bb6d822ec546603bca01f7ba17c52f0f4f80e329 (diff) | |
| parent | 3feb049f378da6aa1209e05ef5c656a1f26a9183 (diff) | |
Merge tag 'ipu-3.18' of git://git.pengutronix.de/git/pza/linux into drm-next
IPUv3 preparations for capture support
* tag 'ipu-3.18' of git://git.pengutronix.de/git/pza/linux: (26 commits)
gpu: ipu-v3: Add ipu_dump()
gpu: ipu-cpmem: Add ipu_cpmem_dump()
gpu: ipu-v3: Add more planar formats support
gpu: ipu-cpmem: Add second buffer support to ipu_cpmem_set_image()
gpu: ipu-cpmem: Add ipu_cpmem_set_rotation()
gpu: ipu-cpmem: Add ipu_cpmem_set_axi_id()
gpu: ipu-cpmem: Add ipu_cpmem_set_block_mode()
gpu: ipu-v3: Add ipu_idmac_lock_enable()
gpu: ipu-v3: Add ipu_idmac_enable_watermark()
gpu: ipu-v3: Add ipu_stride_to_bytes()
gpu: ipu-v3: Add __ipu_idmac_reset_current_buffer()
gpu: ipu-v3: Add ipu_idmac_clear_buffer()
gpu: ipu-v3: Add ipu_idmac_buffer_is_ready()
gpu: ipu-v3: Move IDMAC channel names to imx-ipu-v3.h
gpu: ipu-v3: Add helper function checking if pixfmt is planar
gpu: ipu-v3: Add rotation mode conversion utilities
gpu: ipu-v3: Add ipu_mbus_code_to_colorspace()
gpu: ipu-v3: smfc: Add ipu_smfc_set_watermark()
gpu: ipu-v3: smfc: Convert to per-channel
gpu: ipu-v3: smfc: Move enable/disable to ipu-smfc.c
...
Diffstat (limited to 'include')
| -rw-r--r-- | include/video/imx-ipu-v3.h | 326 |
1 files changed, 170 insertions, 156 deletions
diff --git a/include/video/imx-ipu-v3.h b/include/video/imx-ipu-v3.h index 3e43e22cdff9..c74bf4a0520e 100644 --- a/include/video/imx-ipu-v3.h +++ b/include/video/imx-ipu-v3.h | |||
| @@ -16,6 +16,7 @@ | |||
| 16 | #include <linux/videodev2.h> | 16 | #include <linux/videodev2.h> |
| 17 | #include <linux/bitmap.h> | 17 | #include <linux/bitmap.h> |
| 18 | #include <linux/fb.h> | 18 | #include <linux/fb.h> |
| 19 | #include <media/v4l2-mediabus.h> | ||
| 19 | 20 | ||
| 20 | struct ipu_soc; | 21 | struct ipu_soc; |
| 21 | 22 | ||
| @@ -61,6 +62,29 @@ struct ipu_di_signal_cfg { | |||
| 61 | u8 vsync_pin; | 62 | u8 vsync_pin; |
| 62 | }; | 63 | }; |
| 63 | 64 | ||
| 65 | /* | ||
| 66 | * Enumeration of CSI destinations | ||
| 67 | */ | ||
| 68 | enum ipu_csi_dest { | ||
| 69 | IPU_CSI_DEST_IDMAC, /* to memory via SMFC */ | ||
| 70 | IPU_CSI_DEST_IC, /* to Image Converter */ | ||
| 71 | IPU_CSI_DEST_VDIC, /* to VDIC */ | ||
| 72 | }; | ||
| 73 | |||
| 74 | /* | ||
| 75 | * Enumeration of IPU rotation modes | ||
| 76 | */ | ||
| 77 | enum ipu_rotate_mode { | ||
| 78 | IPU_ROTATE_NONE = 0, | ||
| 79 | IPU_ROTATE_VERT_FLIP, | ||
| 80 | IPU_ROTATE_HORIZ_FLIP, | ||
| 81 | IPU_ROTATE_180, | ||
| 82 | IPU_ROTATE_90_RIGHT, | ||
| 83 | IPU_ROTATE_90_RIGHT_VFLIP, | ||
| 84 | IPU_ROTATE_90_RIGHT_HFLIP, | ||
| 85 | IPU_ROTATE_90_LEFT, | ||
| 86 | }; | ||
| 87 | |||
| 64 | enum ipu_color_space { | 88 | enum ipu_color_space { |
| 65 | IPUV3_COLORSPACE_RGB, | 89 | IPUV3_COLORSPACE_RGB, |
| 66 | IPUV3_COLORSPACE_YUV, | 90 | IPUV3_COLORSPACE_YUV, |
| @@ -76,6 +100,36 @@ enum ipu_channel_irq { | |||
| 76 | IPU_IRQ_EOS = 192, | 100 | IPU_IRQ_EOS = 192, |
| 77 | }; | 101 | }; |
| 78 | 102 | ||
| 103 | /* | ||
| 104 | * Enumeration of IDMAC channels | ||
| 105 | */ | ||
| 106 | #define IPUV3_CHANNEL_CSI0 0 | ||
| 107 | #define IPUV3_CHANNEL_CSI1 1 | ||
| 108 | #define IPUV3_CHANNEL_CSI2 2 | ||
| 109 | #define IPUV3_CHANNEL_CSI3 3 | ||
| 110 | #define IPUV3_CHANNEL_VDI_MEM_IC_VF 5 | ||
| 111 | #define IPUV3_CHANNEL_MEM_IC_PP 11 | ||
| 112 | #define IPUV3_CHANNEL_MEM_IC_PRP_VF 12 | ||
| 113 | #define IPUV3_CHANNEL_G_MEM_IC_PRP_VF 14 | ||
| 114 | #define IPUV3_CHANNEL_G_MEM_IC_PP 15 | ||
| 115 | #define IPUV3_CHANNEL_IC_PRP_ENC_MEM 20 | ||
| 116 | #define IPUV3_CHANNEL_IC_PRP_VF_MEM 21 | ||
| 117 | #define IPUV3_CHANNEL_IC_PP_MEM 22 | ||
| 118 | #define IPUV3_CHANNEL_MEM_BG_SYNC 23 | ||
| 119 | #define IPUV3_CHANNEL_MEM_BG_ASYNC 24 | ||
| 120 | #define IPUV3_CHANNEL_MEM_FG_SYNC 27 | ||
| 121 | #define IPUV3_CHANNEL_MEM_DC_SYNC 28 | ||
| 122 | #define IPUV3_CHANNEL_MEM_FG_ASYNC 29 | ||
| 123 | #define IPUV3_CHANNEL_MEM_FG_SYNC_ALPHA 31 | ||
| 124 | #define IPUV3_CHANNEL_MEM_DC_ASYNC 41 | ||
| 125 | #define IPUV3_CHANNEL_MEM_ROT_ENC 45 | ||
| 126 | #define IPUV3_CHANNEL_MEM_ROT_VF 46 | ||
| 127 | #define IPUV3_CHANNEL_MEM_ROT_PP 47 | ||
| 128 | #define IPUV3_CHANNEL_ROT_ENC_MEM 48 | ||
| 129 | #define IPUV3_CHANNEL_ROT_VF_MEM 49 | ||
| 130 | #define IPUV3_CHANNEL_ROT_PP_MEM 50 | ||
| 131 | #define IPUV3_CHANNEL_MEM_BG_SYNC_ALPHA 51 | ||
| 132 | |||
| 79 | int ipu_map_irq(struct ipu_soc *ipu, int irq); | 133 | int ipu_map_irq(struct ipu_soc *ipu, int irq); |
| 80 | int ipu_idmac_channel_irq(struct ipu_soc *ipu, struct ipuv3_channel *channel, | 134 | int ipu_idmac_channel_irq(struct ipu_soc *ipu, struct ipuv3_channel *channel, |
| 81 | enum ipu_channel_irq irq); | 135 | enum ipu_channel_irq irq); |
| @@ -93,6 +147,13 @@ int ipu_idmac_channel_irq(struct ipu_soc *ipu, struct ipuv3_channel *channel, | |||
| 93 | #define IPU_IRQ_VSYNC_PRE_1 (448 + 15) | 147 | #define IPU_IRQ_VSYNC_PRE_1 (448 + 15) |
| 94 | 148 | ||
| 95 | /* | 149 | /* |
| 150 | * IPU Common functions | ||
| 151 | */ | ||
| 152 | void ipu_set_csi_src_mux(struct ipu_soc *ipu, int csi_id, bool mipi_csi2); | ||
| 153 | void ipu_set_ic_src_mux(struct ipu_soc *ipu, int csi_id, bool vdi); | ||
| 154 | void ipu_dump(struct ipu_soc *ipu); | ||
| 155 | |||
| 156 | /* | ||
| 96 | * IPU Image DMA Controller (idmac) functions | 157 | * IPU Image DMA Controller (idmac) functions |
| 97 | */ | 158 | */ |
| 98 | struct ipuv3_channel *ipu_idmac_get(struct ipu_soc *ipu, unsigned channel); | 159 | struct ipuv3_channel *ipu_idmac_get(struct ipu_soc *ipu, unsigned channel); |
| @@ -100,12 +161,58 @@ void ipu_idmac_put(struct ipuv3_channel *); | |||
| 100 | 161 | ||
| 101 | int ipu_idmac_enable_channel(struct ipuv3_channel *channel); | 162 | int ipu_idmac_enable_channel(struct ipuv3_channel *channel); |
| 102 | int ipu_idmac_disable_channel(struct ipuv3_channel *channel); | 163 | int ipu_idmac_disable_channel(struct ipuv3_channel *channel); |
| 164 | void ipu_idmac_enable_watermark(struct ipuv3_channel *channel, bool enable); | ||
| 165 | int ipu_idmac_lock_enable(struct ipuv3_channel *channel, int num_bursts); | ||
| 103 | int ipu_idmac_wait_busy(struct ipuv3_channel *channel, int ms); | 166 | int ipu_idmac_wait_busy(struct ipuv3_channel *channel, int ms); |
| 104 | 167 | ||
| 105 | void ipu_idmac_set_double_buffer(struct ipuv3_channel *channel, | 168 | void ipu_idmac_set_double_buffer(struct ipuv3_channel *channel, |
| 106 | bool doublebuffer); | 169 | bool doublebuffer); |
| 107 | int ipu_idmac_get_current_buffer(struct ipuv3_channel *channel); | 170 | int ipu_idmac_get_current_buffer(struct ipuv3_channel *channel); |
| 171 | bool ipu_idmac_buffer_is_ready(struct ipuv3_channel *channel, u32 buf_num); | ||
| 108 | void ipu_idmac_select_buffer(struct ipuv3_channel *channel, u32 buf_num); | 172 | void ipu_idmac_select_buffer(struct ipuv3_channel *channel, u32 buf_num); |
| 173 | void ipu_idmac_clear_buffer(struct ipuv3_channel *channel, u32 buf_num); | ||
| 174 | |||
| 175 | /* | ||
| 176 | * IPU Channel Parameter Memory (cpmem) functions | ||
| 177 | */ | ||
| 178 | struct ipu_rgb { | ||
| 179 | struct fb_bitfield red; | ||
| 180 | struct fb_bitfield green; | ||
| 181 | struct fb_bitfield blue; | ||
| 182 | struct fb_bitfield transp; | ||
| 183 | int bits_per_pixel; | ||
| 184 | }; | ||
| 185 | |||
| 186 | struct ipu_image { | ||
| 187 | struct v4l2_pix_format pix; | ||
| 188 | struct v4l2_rect rect; | ||
| 189 | dma_addr_t phys0; | ||
| 190 | dma_addr_t phys1; | ||
| 191 | }; | ||
| 192 | |||
| 193 | void ipu_cpmem_zero(struct ipuv3_channel *ch); | ||
| 194 | void ipu_cpmem_set_resolution(struct ipuv3_channel *ch, int xres, int yres); | ||
| 195 | void ipu_cpmem_set_stride(struct ipuv3_channel *ch, int stride); | ||
| 196 | void ipu_cpmem_set_high_priority(struct ipuv3_channel *ch); | ||
| 197 | void ipu_cpmem_set_buffer(struct ipuv3_channel *ch, int bufnum, dma_addr_t buf); | ||
| 198 | void ipu_cpmem_interlaced_scan(struct ipuv3_channel *ch, int stride); | ||
| 199 | void ipu_cpmem_set_axi_id(struct ipuv3_channel *ch, u32 id); | ||
| 200 | void ipu_cpmem_set_burstsize(struct ipuv3_channel *ch, int burstsize); | ||
| 201 | void ipu_cpmem_set_block_mode(struct ipuv3_channel *ch); | ||
| 202 | void ipu_cpmem_set_rotation(struct ipuv3_channel *ch, | ||
| 203 | enum ipu_rotate_mode rot); | ||
| 204 | int ipu_cpmem_set_format_rgb(struct ipuv3_channel *ch, | ||
| 205 | const struct ipu_rgb *rgb); | ||
| 206 | int ipu_cpmem_set_format_passthrough(struct ipuv3_channel *ch, int width); | ||
| 207 | void ipu_cpmem_set_yuv_interleaved(struct ipuv3_channel *ch, u32 pixel_format); | ||
| 208 | void ipu_cpmem_set_yuv_planar_full(struct ipuv3_channel *ch, | ||
| 209 | u32 pixel_format, int stride, | ||
| 210 | int u_offset, int v_offset); | ||
| 211 | void ipu_cpmem_set_yuv_planar(struct ipuv3_channel *ch, | ||
| 212 | u32 pixel_format, int stride, int height); | ||
| 213 | int ipu_cpmem_set_fmt(struct ipuv3_channel *ch, u32 drm_fourcc); | ||
| 214 | int ipu_cpmem_set_image(struct ipuv3_channel *ch, struct ipu_image *image); | ||
| 215 | void ipu_cpmem_dump(struct ipuv3_channel *ch); | ||
| 109 | 216 | ||
| 110 | /* | 217 | /* |
| 111 | * IPU Display Controller (dc) functions | 218 | * IPU Display Controller (dc) functions |
| @@ -169,171 +276,78 @@ int ipu_dp_set_global_alpha(struct ipu_dp *dp, bool enable, u8 alpha, | |||
| 169 | /* | 276 | /* |
| 170 | * IPU CMOS Sensor Interface (csi) functions | 277 | * IPU CMOS Sensor Interface (csi) functions |
| 171 | */ | 278 | */ |
| 172 | int ipu_csi_enable(struct ipu_soc *ipu, int csi); | 279 | struct ipu_csi; |
| 173 | int ipu_csi_disable(struct ipu_soc *ipu, int csi); | 280 | int ipu_csi_init_interface(struct ipu_csi *csi, |
| 281 | struct v4l2_mbus_config *mbus_cfg, | ||
| 282 | struct v4l2_mbus_framefmt *mbus_fmt); | ||
| 283 | bool ipu_csi_is_interlaced(struct ipu_csi *csi); | ||
| 284 | void ipu_csi_get_window(struct ipu_csi *csi, struct v4l2_rect *w); | ||
| 285 | void ipu_csi_set_window(struct ipu_csi *csi, struct v4l2_rect *w); | ||
| 286 | void ipu_csi_set_test_generator(struct ipu_csi *csi, bool active, | ||
| 287 | u32 r_value, u32 g_value, u32 b_value, | ||
| 288 | u32 pix_clk); | ||
| 289 | int ipu_csi_set_mipi_datatype(struct ipu_csi *csi, u32 vc, | ||
| 290 | struct v4l2_mbus_framefmt *mbus_fmt); | ||
| 291 | int ipu_csi_set_skip_smfc(struct ipu_csi *csi, u32 skip, | ||
| 292 | u32 max_ratio, u32 id); | ||
| 293 | int ipu_csi_set_dest(struct ipu_csi *csi, enum ipu_csi_dest csi_dest); | ||
| 294 | int ipu_csi_enable(struct ipu_csi *csi); | ||
| 295 | int ipu_csi_disable(struct ipu_csi *csi); | ||
| 296 | struct ipu_csi *ipu_csi_get(struct ipu_soc *ipu, int id); | ||
| 297 | void ipu_csi_put(struct ipu_csi *csi); | ||
| 298 | void ipu_csi_dump(struct ipu_csi *csi); | ||
| 174 | 299 | ||
| 175 | /* | 300 | /* |
| 176 | * IPU Sensor Multiple FIFO Controller (SMFC) functions | 301 | * IPU Image Converter (ic) functions |
| 177 | */ | 302 | */ |
| 178 | int ipu_smfc_enable(struct ipu_soc *ipu); | 303 | enum ipu_ic_task { |
| 179 | int ipu_smfc_disable(struct ipu_soc *ipu); | 304 | IC_TASK_ENCODER, |
| 180 | int ipu_smfc_map_channel(struct ipu_soc *ipu, int channel, int csi_id, int mipi_id); | 305 | IC_TASK_VIEWFINDER, |
| 181 | int ipu_smfc_set_burstsize(struct ipu_soc *ipu, int channel, int burstsize); | 306 | IC_TASK_POST_PROCESSOR, |
| 182 | 307 | IC_NUM_TASKS, | |
| 183 | #define IPU_CPMEM_WORD(word, ofs, size) ((((word) * 160 + (ofs)) << 8) | (size)) | ||
| 184 | |||
| 185 | #define IPU_FIELD_UBO IPU_CPMEM_WORD(0, 46, 22) | ||
| 186 | #define IPU_FIELD_VBO IPU_CPMEM_WORD(0, 68, 22) | ||
| 187 | #define IPU_FIELD_IOX IPU_CPMEM_WORD(0, 90, 4) | ||
| 188 | #define IPU_FIELD_RDRW IPU_CPMEM_WORD(0, 94, 1) | ||
| 189 | #define IPU_FIELD_SO IPU_CPMEM_WORD(0, 113, 1) | ||
| 190 | #define IPU_FIELD_SLY IPU_CPMEM_WORD(1, 102, 14) | ||
| 191 | #define IPU_FIELD_SLUV IPU_CPMEM_WORD(1, 128, 14) | ||
| 192 | |||
| 193 | #define IPU_FIELD_XV IPU_CPMEM_WORD(0, 0, 10) | ||
| 194 | #define IPU_FIELD_YV IPU_CPMEM_WORD(0, 10, 9) | ||
| 195 | #define IPU_FIELD_XB IPU_CPMEM_WORD(0, 19, 13) | ||
| 196 | #define IPU_FIELD_YB IPU_CPMEM_WORD(0, 32, 12) | ||
| 197 | #define IPU_FIELD_NSB_B IPU_CPMEM_WORD(0, 44, 1) | ||
| 198 | #define IPU_FIELD_CF IPU_CPMEM_WORD(0, 45, 1) | ||
| 199 | #define IPU_FIELD_SX IPU_CPMEM_WORD(0, 46, 12) | ||
| 200 | #define IPU_FIELD_SY IPU_CPMEM_WORD(0, 58, 11) | ||
| 201 | #define IPU_FIELD_NS IPU_CPMEM_WORD(0, 69, 10) | ||
| 202 | #define IPU_FIELD_SDX IPU_CPMEM_WORD(0, 79, 7) | ||
| 203 | #define IPU_FIELD_SM IPU_CPMEM_WORD(0, 86, 10) | ||
| 204 | #define IPU_FIELD_SCC IPU_CPMEM_WORD(0, 96, 1) | ||
| 205 | #define IPU_FIELD_SCE IPU_CPMEM_WORD(0, 97, 1) | ||
| 206 | #define IPU_FIELD_SDY IPU_CPMEM_WORD(0, 98, 7) | ||
| 207 | #define IPU_FIELD_SDRX IPU_CPMEM_WORD(0, 105, 1) | ||
| 208 | #define IPU_FIELD_SDRY IPU_CPMEM_WORD(0, 106, 1) | ||
| 209 | #define IPU_FIELD_BPP IPU_CPMEM_WORD(0, 107, 3) | ||
| 210 | #define IPU_FIELD_DEC_SEL IPU_CPMEM_WORD(0, 110, 2) | ||
| 211 | #define IPU_FIELD_DIM IPU_CPMEM_WORD(0, 112, 1) | ||
| 212 | #define IPU_FIELD_BNDM IPU_CPMEM_WORD(0, 114, 3) | ||
| 213 | #define IPU_FIELD_BM IPU_CPMEM_WORD(0, 117, 2) | ||
| 214 | #define IPU_FIELD_ROT IPU_CPMEM_WORD(0, 119, 1) | ||
| 215 | #define IPU_FIELD_HF IPU_CPMEM_WORD(0, 120, 1) | ||
| 216 | #define IPU_FIELD_VF IPU_CPMEM_WORD(0, 121, 1) | ||
| 217 | #define IPU_FIELD_THE IPU_CPMEM_WORD(0, 122, 1) | ||
| 218 | #define IPU_FIELD_CAP IPU_CPMEM_WORD(0, 123, 1) | ||
| 219 | #define IPU_FIELD_CAE IPU_CPMEM_WORD(0, 124, 1) | ||
| 220 | #define IPU_FIELD_FW IPU_CPMEM_WORD(0, 125, 13) | ||
| 221 | #define IPU_FIELD_FH IPU_CPMEM_WORD(0, 138, 12) | ||
| 222 | #define IPU_FIELD_EBA0 IPU_CPMEM_WORD(1, 0, 29) | ||
| 223 | #define IPU_FIELD_EBA1 IPU_CPMEM_WORD(1, 29, 29) | ||
| 224 | #define IPU_FIELD_ILO IPU_CPMEM_WORD(1, 58, 20) | ||
| 225 | #define IPU_FIELD_NPB IPU_CPMEM_WORD(1, 78, 7) | ||
| 226 | #define IPU_FIELD_PFS IPU_CPMEM_WORD(1, 85, 4) | ||
| 227 | #define IPU_FIELD_ALU IPU_CPMEM_WORD(1, 89, 1) | ||
| 228 | #define IPU_FIELD_ALBM IPU_CPMEM_WORD(1, 90, 3) | ||
| 229 | #define IPU_FIELD_ID IPU_CPMEM_WORD(1, 93, 2) | ||
| 230 | #define IPU_FIELD_TH IPU_CPMEM_WORD(1, 95, 7) | ||
| 231 | #define IPU_FIELD_SL IPU_CPMEM_WORD(1, 102, 14) | ||
| 232 | #define IPU_FIELD_WID0 IPU_CPMEM_WORD(1, 116, 3) | ||
| 233 | #define IPU_FIELD_WID1 IPU_CPMEM_WORD(1, 119, 3) | ||
| 234 | #define IPU_FIELD_WID2 IPU_CPMEM_WORD(1, 122, 3) | ||
| 235 | #define IPU_FIELD_WID3 IPU_CPMEM_WORD(1, 125, 3) | ||
| 236 | #define IPU_FIELD_OFS0 IPU_CPMEM_WORD(1, 128, 5) | ||
| 237 | #define IPU_FIELD_OFS1 IPU_CPMEM_WORD(1, 133, 5) | ||
| 238 | #define IPU_FIELD_OFS2 IPU_CPMEM_WORD(1, 138, 5) | ||
| 239 | #define IPU_FIELD_OFS3 IPU_CPMEM_WORD(1, 143, 5) | ||
| 240 | #define IPU_FIELD_SXYS IPU_CPMEM_WORD(1, 148, 1) | ||
| 241 | #define IPU_FIELD_CRE IPU_CPMEM_WORD(1, 149, 1) | ||
| 242 | #define IPU_FIELD_DEC_SEL2 IPU_CPMEM_WORD(1, 150, 1) | ||
| 243 | |||
| 244 | struct ipu_cpmem_word { | ||
| 245 | u32 data[5]; | ||
| 246 | u32 res[3]; | ||
| 247 | }; | ||
| 248 | |||
| 249 | struct ipu_ch_param { | ||
| 250 | struct ipu_cpmem_word word[2]; | ||
| 251 | }; | ||
| 252 | |||
| 253 | void ipu_ch_param_write_field(struct ipu_ch_param __iomem *base, u32 wbs, u32 v); | ||
| 254 | u32 ipu_ch_param_read_field(struct ipu_ch_param __iomem *base, u32 wbs); | ||
| 255 | struct ipu_ch_param __iomem *ipu_get_cpmem(struct ipuv3_channel *channel); | ||
| 256 | void ipu_ch_param_dump(struct ipu_ch_param __iomem *p); | ||
| 257 | |||
| 258 | static inline void ipu_ch_param_zero(struct ipu_ch_param __iomem *p) | ||
| 259 | { | ||
| 260 | int i; | ||
| 261 | void __iomem *base = p; | ||
| 262 | |||
| 263 | for (i = 0; i < sizeof(*p) / sizeof(u32); i++) | ||
| 264 | writel(0, base + i * sizeof(u32)); | ||
| 265 | } | ||
| 266 | |||
| 267 | static inline void ipu_cpmem_set_buffer(struct ipu_ch_param __iomem *p, | ||
| 268 | int bufnum, dma_addr_t buf) | ||
| 269 | { | ||
| 270 | if (bufnum) | ||
| 271 | ipu_ch_param_write_field(p, IPU_FIELD_EBA1, buf >> 3); | ||
| 272 | else | ||
| 273 | ipu_ch_param_write_field(p, IPU_FIELD_EBA0, buf >> 3); | ||
| 274 | } | ||
| 275 | |||
| 276 | static inline void ipu_cpmem_set_resolution(struct ipu_ch_param __iomem *p, | ||
| 277 | int xres, int yres) | ||
| 278 | { | ||
| 279 | ipu_ch_param_write_field(p, IPU_FIELD_FW, xres - 1); | ||
| 280 | ipu_ch_param_write_field(p, IPU_FIELD_FH, yres - 1); | ||
| 281 | } | ||
| 282 | |||
| 283 | static inline void ipu_cpmem_set_stride(struct ipu_ch_param __iomem *p, | ||
| 284 | int stride) | ||
| 285 | { | ||
| 286 | ipu_ch_param_write_field(p, IPU_FIELD_SLY, stride - 1); | ||
| 287 | } | ||
| 288 | |||
| 289 | void ipu_cpmem_set_high_priority(struct ipuv3_channel *channel); | ||
| 290 | |||
| 291 | struct ipu_rgb { | ||
| 292 | struct fb_bitfield red; | ||
| 293 | struct fb_bitfield green; | ||
| 294 | struct fb_bitfield blue; | ||
| 295 | struct fb_bitfield transp; | ||
| 296 | int bits_per_pixel; | ||
| 297 | }; | ||
| 298 | |||
| 299 | struct ipu_image { | ||
| 300 | struct v4l2_pix_format pix; | ||
| 301 | struct v4l2_rect rect; | ||
| 302 | dma_addr_t phys; | ||
| 303 | }; | 308 | }; |
| 304 | 309 | ||
| 305 | int ipu_cpmem_set_format_passthrough(struct ipu_ch_param __iomem *p, | 310 | struct ipu_ic; |
| 306 | int width); | 311 | int ipu_ic_task_init(struct ipu_ic *ic, |
| 307 | 312 | int in_width, int in_height, | |
| 308 | int ipu_cpmem_set_format_rgb(struct ipu_ch_param __iomem *, | 313 | int out_width, int out_height, |
| 309 | const struct ipu_rgb *rgb); | 314 | enum ipu_color_space in_cs, |
| 310 | 315 | enum ipu_color_space out_cs); | |
| 311 | static inline void ipu_cpmem_interlaced_scan(struct ipu_ch_param *p, | 316 | int ipu_ic_task_graphics_init(struct ipu_ic *ic, |
| 312 | int stride) | 317 | enum ipu_color_space in_g_cs, |
| 313 | { | 318 | bool galpha_en, u32 galpha, |
| 314 | ipu_ch_param_write_field(p, IPU_FIELD_SO, 1); | 319 | bool colorkey_en, u32 colorkey); |
| 315 | ipu_ch_param_write_field(p, IPU_FIELD_ILO, stride / 8); | 320 | void ipu_ic_task_enable(struct ipu_ic *ic); |
| 316 | ipu_ch_param_write_field(p, IPU_FIELD_SLY, (stride * 2) - 1); | 321 | void ipu_ic_task_disable(struct ipu_ic *ic); |
| 317 | }; | 322 | int ipu_ic_task_idma_init(struct ipu_ic *ic, struct ipuv3_channel *channel, |
| 323 | u32 width, u32 height, int burst_size, | ||
| 324 | enum ipu_rotate_mode rot); | ||
| 325 | int ipu_ic_enable(struct ipu_ic *ic); | ||
| 326 | int ipu_ic_disable(struct ipu_ic *ic); | ||
| 327 | struct ipu_ic *ipu_ic_get(struct ipu_soc *ipu, enum ipu_ic_task task); | ||
| 328 | void ipu_ic_put(struct ipu_ic *ic); | ||
| 329 | void ipu_ic_dump(struct ipu_ic *ic); | ||
| 318 | 330 | ||
| 319 | void ipu_cpmem_set_yuv_planar(struct ipu_ch_param __iomem *p, u32 pixel_format, | 331 | /* |
| 320 | int stride, int height); | 332 | * IPU Sensor Multiple FIFO Controller (SMFC) functions |
| 321 | void ipu_cpmem_set_yuv_interleaved(struct ipu_ch_param __iomem *p, | 333 | */ |
| 322 | u32 pixel_format); | 334 | struct ipu_smfc *ipu_smfc_get(struct ipu_soc *ipu, unsigned int chno); |
| 323 | void ipu_cpmem_set_yuv_planar_full(struct ipu_ch_param __iomem *p, | 335 | void ipu_smfc_put(struct ipu_smfc *smfc); |
| 324 | u32 pixel_format, int stride, int u_offset, int v_offset); | 336 | int ipu_smfc_enable(struct ipu_smfc *smfc); |
| 325 | int ipu_cpmem_set_fmt(struct ipu_ch_param __iomem *cpmem, u32 pixelformat); | 337 | int ipu_smfc_disable(struct ipu_smfc *smfc); |
| 326 | int ipu_cpmem_set_image(struct ipu_ch_param __iomem *cpmem, | 338 | int ipu_smfc_map_channel(struct ipu_smfc *smfc, int csi_id, int mipi_id); |
| 327 | struct ipu_image *image); | 339 | int ipu_smfc_set_burstsize(struct ipu_smfc *smfc, int burstsize); |
| 340 | int ipu_smfc_set_watermark(struct ipu_smfc *smfc, u32 set_level, u32 clr_level); | ||
| 328 | 341 | ||
| 329 | enum ipu_color_space ipu_drm_fourcc_to_colorspace(u32 drm_fourcc); | 342 | enum ipu_color_space ipu_drm_fourcc_to_colorspace(u32 drm_fourcc); |
| 330 | enum ipu_color_space ipu_pixelformat_to_colorspace(u32 pixelformat); | 343 | enum ipu_color_space ipu_pixelformat_to_colorspace(u32 pixelformat); |
| 331 | 344 | enum ipu_color_space ipu_mbus_code_to_colorspace(u32 mbus_code); | |
| 332 | static inline void ipu_cpmem_set_burstsize(struct ipu_ch_param __iomem *p, | 345 | int ipu_stride_to_bytes(u32 pixel_stride, u32 pixelformat); |
| 333 | int burstsize) | 346 | bool ipu_pixelformat_is_planar(u32 pixelformat); |
| 334 | { | 347 | int ipu_degrees_to_rot_mode(enum ipu_rotate_mode *mode, int degrees, |
| 335 | ipu_ch_param_write_field(p, IPU_FIELD_NPB, burstsize - 1); | 348 | bool hflip, bool vflip); |
| 336 | }; | 349 | int ipu_rot_mode_to_degrees(int *degrees, enum ipu_rotate_mode mode, |
| 350 | bool hflip, bool vflip); | ||
| 337 | 351 | ||
| 338 | struct ipu_client_platformdata { | 352 | struct ipu_client_platformdata { |
| 339 | int csi; | 353 | int csi; |
