Stepan Moskovchenko | 9d20015 | 2010-05-19 11:03:30 -0700 | [diff] [blame] | 1 | /* include/linux/msm_mdp.h |
| 2 | * |
| 3 | * Copyright (C) 2007 Google Incorporated |
| 4 | * Copyright (c) 2009-2010, Code Aurora Forum. All rights reserved. |
| 5 | * |
| 6 | * This software is licensed under the terms of the GNU General Public |
| 7 | * License version 2, as published by the Free Software Foundation, and |
| 8 | * may be copied, distributed, and modified under those terms. |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | * GNU General Public License for more details. |
| 14 | */ |
| 15 | #ifndef _MSM_MDP_H_ |
| 16 | #define _MSM_MDP_H_ |
| 17 | |
| 18 | #include <linux/types.h> |
| 19 | #include <linux/fb.h> |
| 20 | |
| 21 | #define MSMFB_IOCTL_MAGIC 'm' |
| 22 | #define MSMFB_GRP_DISP _IOW(MSMFB_IOCTL_MAGIC, 1, unsigned int) |
| 23 | #define MSMFB_BLIT _IOW(MSMFB_IOCTL_MAGIC, 2, unsigned int) |
| 24 | #define MSMFB_SUSPEND_SW_REFRESHER _IOW(MSMFB_IOCTL_MAGIC, 128, unsigned int) |
| 25 | #define MSMFB_RESUME_SW_REFRESHER _IOW(MSMFB_IOCTL_MAGIC, 129, unsigned int) |
| 26 | #define MSMFB_CURSOR _IOW(MSMFB_IOCTL_MAGIC, 130, struct fb_cursor) |
| 27 | #define MSMFB_SET_LUT _IOW(MSMFB_IOCTL_MAGIC, 131, struct fb_cmap) |
| 28 | #define MSMFB_HISTOGRAM _IOWR(MSMFB_IOCTL_MAGIC, 132, struct mdp_histogram) |
| 29 | /* new ioctls's for set/get ccs matrix */ |
| 30 | #define MSMFB_GET_CCS_MATRIX _IOWR(MSMFB_IOCTL_MAGIC, 133, struct mdp_ccs) |
| 31 | #define MSMFB_SET_CCS_MATRIX _IOW(MSMFB_IOCTL_MAGIC, 134, struct mdp_ccs) |
| 32 | #define MSMFB_OVERLAY_SET _IOWR(MSMFB_IOCTL_MAGIC, 135, \ |
| 33 | struct mdp_overlay) |
| 34 | #define MSMFB_OVERLAY_UNSET _IOW(MSMFB_IOCTL_MAGIC, 136, unsigned int) |
| 35 | #define MSMFB_OVERLAY_PLAY _IOW(MSMFB_IOCTL_MAGIC, 137, \ |
| 36 | struct msmfb_overlay_data) |
| 37 | #define MSMFB_GET_PAGE_PROTECTION _IOR(MSMFB_IOCTL_MAGIC, 138, \ |
| 38 | struct mdp_page_protection) |
| 39 | #define MSMFB_SET_PAGE_PROTECTION _IOW(MSMFB_IOCTL_MAGIC, 139, \ |
| 40 | struct mdp_page_protection) |
| 41 | #define MSMFB_OVERLAY_GET _IOR(MSMFB_IOCTL_MAGIC, 140, \ |
| 42 | struct mdp_overlay) |
| 43 | |
| 44 | /* new ioctls for async MDP ops */ |
| 45 | #define MSMFB_ASYNC_BLIT _IOW(MSMFB_IOCTL_MAGIC, 141, unsigned int) |
| 46 | #define MSMFB_BLIT_FLUSH _IOR(MSMFB_IOCTL_MAGIC, 142, unsigned int) |
| 47 | |
| 48 | #define MDP_IMGTYPE2_START 0x10000 |
| 49 | |
| 50 | enum { |
| 51 | MDP_RGB_565, /* RGB 565 planer */ |
| 52 | MDP_XRGB_8888, /* RGB 888 padded */ |
| 53 | MDP_Y_CBCR_H2V2, /* Y and CbCr, pseudo planer w/ Cb is in MSB */ |
| 54 | MDP_ARGB_8888, /* ARGB 888 */ |
| 55 | MDP_RGB_888, /* RGB 888 planer */ |
| 56 | MDP_Y_CRCB_H2V2, /* Y and CrCb, pseudo planer w/ Cr is in MSB */ |
| 57 | MDP_YCRYCB_H2V1, /* YCrYCb interleave */ |
| 58 | MDP_Y_CRCB_H2V1, /* Y and CrCb, pseduo planer w/ Cr is in MSB */ |
| 59 | MDP_Y_CBCR_H2V1, /* Y and CrCb, pseduo planer w/ Cr is in MSB */ |
| 60 | MDP_RGBA_8888, /* ARGB 888 */ |
| 61 | MDP_BGRA_8888, /* ABGR 888 */ |
| 62 | MDP_Y_CRCB_H2V2_TILE, /* Y and CrCb, pseudo planer tile */ |
| 63 | MDP_Y_CBCR_H2V2_TILE, /* Y and CbCr, pseudo planer tile */ |
| 64 | MDP_IMGTYPE_LIMIT, |
| 65 | MDP_BGR_565 = MDP_IMGTYPE2_START, /* BGR 565 planer */ |
| 66 | MDP_FB_FORMAT, /* framebuffer format */ |
| 67 | MDP_IMGTYPE_LIMIT2 /* Non valid image type after this enum */ |
| 68 | }; |
| 69 | |
| 70 | enum { |
| 71 | PMEM_IMG, |
| 72 | FB_IMG, |
| 73 | }; |
| 74 | |
| 75 | /* mdp_blit_req flag values */ |
| 76 | #define MDP_ROT_NOP 0 |
| 77 | #define MDP_FLIP_LR 0x1 |
| 78 | #define MDP_FLIP_UD 0x2 |
| 79 | #define MDP_ROT_90 0x4 |
| 80 | #define MDP_ROT_180 (MDP_FLIP_UD|MDP_FLIP_LR) |
| 81 | #define MDP_ROT_270 (MDP_ROT_90|MDP_FLIP_UD|MDP_FLIP_LR) |
| 82 | #define MDP_DITHER 0x8 |
| 83 | #define MDP_BLUR 0x10 |
| 84 | #define MDP_BLEND_FG_PREMULT 0x20000 |
| 85 | |
| 86 | #define MDP_DEINTERLACE 0x80000000 |
| 87 | #define MDP_SHARPENING 0x40000000 |
| 88 | |
| 89 | #define MDP_NO_DMA_BARRIER_START 0x20000000 |
| 90 | #define MDP_NO_DMA_BARRIER_END 0x10000000 |
| 91 | #define MDP_NO_BLIT 0x08000000 |
| 92 | #define MDP_BLIT_WITH_DMA_BARRIERS 0x000 |
| 93 | #define MDP_BLIT_WITH_NO_DMA_BARRIERS \ |
| 94 | (MDP_NO_DMA_BARRIER_START | MDP_NO_DMA_BARRIER_END) |
| 95 | #define MDP_TRANSP_NOP 0xffffffff |
| 96 | #define MDP_ALPHA_NOP 0xff |
| 97 | |
| 98 | #define MDP_BLIT_SRC_GEM 0x02000000 /* set for GEM, clear for PMEM */ |
| 99 | #define MDP_BLIT_DST_GEM 0x01000000 /* set for GEM, clear for PMEM */ |
| 100 | |
| 101 | #define MDP_FB_PAGE_PROTECTION_NONCACHED (0) |
| 102 | #define MDP_FB_PAGE_PROTECTION_WRITECOMBINE (1) |
| 103 | #define MDP_FB_PAGE_PROTECTION_WRITETHROUGHCACHE (2) |
| 104 | #define MDP_FB_PAGE_PROTECTION_WRITEBACKCACHE (3) |
| 105 | #define MDP_FB_PAGE_PROTECTION_WRITEBACKWACACHE (4) |
| 106 | /* Sentinel: Don't use! */ |
| 107 | #define MDP_FB_PAGE_PROTECTION_INVALID (5) |
| 108 | /* Count of the number of MDP_FB_PAGE_PROTECTION_... values. */ |
| 109 | #define MDP_NUM_FB_PAGE_PROTECTION_VALUES (5) |
| 110 | |
| 111 | struct mdp_rect { |
| 112 | uint32_t x; |
| 113 | uint32_t y; |
| 114 | uint32_t w; |
| 115 | uint32_t h; |
| 116 | }; |
| 117 | |
| 118 | struct mdp_img { |
| 119 | uint32_t width; |
| 120 | uint32_t height; |
| 121 | uint32_t format; |
| 122 | uint32_t offset; |
| 123 | int memory_id; /* the file descriptor */ |
| 124 | uint32_t priv; |
| 125 | }; |
| 126 | |
| 127 | /* |
| 128 | * {3x3} + {3} ccs matrix |
| 129 | */ |
| 130 | |
| 131 | #define MDP_CCS_RGB2YUV 0 |
| 132 | #define MDP_CCS_YUV2RGB 1 |
| 133 | |
| 134 | #define MDP_CCS_SIZE 9 |
| 135 | #define MDP_BV_SIZE 3 |
| 136 | |
| 137 | struct mdp_ccs { |
| 138 | int direction; /* MDP_CCS_RGB2YUV or YUV2RGB */ |
| 139 | uint16_t ccs[MDP_CCS_SIZE]; /* 3x3 color coefficients */ |
| 140 | uint16_t bv[MDP_BV_SIZE]; /* 1x3 bias vector */ |
| 141 | }; |
| 142 | |
| 143 | /* The version of the mdp_blit_req structure so that |
| 144 | * user applications can selectively decide which functionality |
| 145 | * to include |
| 146 | */ |
| 147 | |
| 148 | #define MDP_BLIT_REQ_VERSION 2 |
| 149 | |
| 150 | struct mdp_blit_req { |
| 151 | struct mdp_img src; |
| 152 | struct mdp_img dst; |
| 153 | struct mdp_rect src_rect; |
| 154 | struct mdp_rect dst_rect; |
| 155 | uint32_t alpha; |
| 156 | uint32_t transp_mask; |
| 157 | uint32_t flags; |
| 158 | int sharpening_strength; /* -127 <--> 127, default 64 */ |
| 159 | }; |
| 160 | |
| 161 | struct mdp_blit_req_list { |
| 162 | uint32_t count; |
| 163 | struct mdp_blit_req req[]; |
| 164 | }; |
| 165 | |
| 166 | struct msmfb_data { |
| 167 | uint32_t offset; |
| 168 | int memory_id; |
| 169 | int id; |
| 170 | }; |
| 171 | |
| 172 | #define MSMFB_NEW_REQUEST -1 |
| 173 | |
| 174 | struct msmfb_overlay_data { |
| 175 | uint32_t id; |
| 176 | struct msmfb_data data; |
| 177 | }; |
| 178 | |
| 179 | struct msmfb_img { |
| 180 | uint32_t width; |
| 181 | uint32_t height; |
| 182 | uint32_t format; |
| 183 | }; |
| 184 | |
| 185 | struct mdp_overlay { |
| 186 | struct msmfb_img src; |
| 187 | struct mdp_rect src_rect; |
| 188 | struct mdp_rect dst_rect; |
| 189 | uint32_t z_order; /* stage number */ |
| 190 | uint32_t is_fg; /* control alpha & transp */ |
| 191 | uint32_t alpha; |
| 192 | uint32_t transp_mask; |
| 193 | uint32_t flags; |
| 194 | uint32_t id; |
| 195 | uint32_t user_data[8]; |
| 196 | }; |
| 197 | |
| 198 | struct mdp_histogram { |
| 199 | uint32_t frame_cnt; |
| 200 | uint32_t bin_cnt; |
| 201 | uint32_t *r; |
| 202 | uint32_t *g; |
| 203 | uint32_t *b; |
| 204 | }; |
| 205 | |
| 206 | struct mdp_page_protection { |
| 207 | uint32_t page_protection; |
| 208 | }; |
| 209 | |
| 210 | |
| 211 | struct msm_panel_common_pdata { |
| 212 | int gpio; |
| 213 | int (*backlight_level)(int level, int max, int min); |
| 214 | int (*pmic_backlight)(int level); |
| 215 | int (*panel_num)(void); |
| 216 | void (*panel_config_gpio)(int); |
| 217 | int *gpio_num; |
| 218 | }; |
| 219 | |
| 220 | struct lcdc_platform_data { |
| 221 | int (*lcdc_gpio_config)(int on); |
| 222 | void (*lcdc_power_save)(int); |
| 223 | }; |
| 224 | |
| 225 | struct tvenc_platform_data { |
| 226 | int (*pm_vid_en)(int on); |
| 227 | }; |
| 228 | |
| 229 | struct mddi_platform_data { |
| 230 | void (*mddi_power_save)(int on); |
| 231 | int (*mddi_sel_clk)(u32 *clk_rate); |
| 232 | }; |
| 233 | |
| 234 | struct msm_fb_platform_data { |
| 235 | int (*detect_client)(const char *name); |
| 236 | int mddi_prescan; |
| 237 | int (*allow_set_offset)(void); |
| 238 | }; |
| 239 | |
| 240 | struct msm_hdmi_platform_data { |
| 241 | int irq; |
| 242 | int (*cable_detect)(int insert); |
| 243 | }; |
| 244 | |
| 245 | #endif /*_MSM_MDP_H_*/ |