Daniel Walker | 29d3ded | 2010-04-23 16:02:19 -0700 | [diff] [blame] | 1 | /* arch/arm/mach-msm/include/mach/msm_fb.h |
| 2 | * |
| 3 | * Internal shared definitions for various MSM framebuffer parts. |
| 4 | * |
| 5 | * Copyright (C) 2007 Google Incorporated |
| 6 | * |
| 7 | * This software is licensed under the terms of the GNU General Public |
| 8 | * License version 2, as published by the Free Software Foundation, and |
| 9 | * may be copied, distributed, and modified under those terms. |
| 10 | * |
| 11 | * This program is distributed in the hope that it will be useful, |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | * GNU General Public License for more details. |
| 15 | */ |
| 16 | |
| 17 | #ifndef _MSM_FB_H_ |
| 18 | #define _MSM_FB_H_ |
| 19 | |
| 20 | #include <linux/device.h> |
| 21 | |
| 22 | struct mddi_info; |
| 23 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 24 | /* output interface format */ |
| 25 | #define MSM_MDP_OUT_IF_FMT_RGB565 0 |
| 26 | #define MSM_MDP_OUT_IF_FMT_RGB666 1 |
| 27 | |
Daniel Walker | 29d3ded | 2010-04-23 16:02:19 -0700 | [diff] [blame] | 28 | struct msm_fb_data { |
| 29 | int xres; /* x resolution in pixels */ |
| 30 | int yres; /* y resolution in pixels */ |
| 31 | int width; /* disply width in mm */ |
| 32 | int height; /* display height in mm */ |
| 33 | unsigned output_format; |
| 34 | }; |
| 35 | |
| 36 | struct msmfb_callback { |
| 37 | void (*func)(struct msmfb_callback *); |
| 38 | }; |
| 39 | |
| 40 | enum { |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 41 | MSM_MDDI_PMDH_INTERFACE = 0, |
Daniel Walker | 29d3ded | 2010-04-23 16:02:19 -0700 | [diff] [blame] | 42 | MSM_MDDI_EMDH_INTERFACE, |
| 43 | MSM_EBI2_INTERFACE, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 44 | MSM_LCDC_INTERFACE, |
| 45 | |
| 46 | MSM_MDP_NUM_INTERFACES = MSM_LCDC_INTERFACE + 1, |
Daniel Walker | 29d3ded | 2010-04-23 16:02:19 -0700 | [diff] [blame] | 47 | }; |
| 48 | |
| 49 | #define MSMFB_CAP_PARTIAL_UPDATES (1 << 0) |
| 50 | |
| 51 | struct msm_panel_data { |
| 52 | /* turns off the fb memory */ |
| 53 | int (*suspend)(struct msm_panel_data *); |
| 54 | /* turns on the fb memory */ |
| 55 | int (*resume)(struct msm_panel_data *); |
| 56 | /* turns off the panel */ |
| 57 | int (*blank)(struct msm_panel_data *); |
| 58 | /* turns on the panel */ |
| 59 | int (*unblank)(struct msm_panel_data *); |
| 60 | void (*wait_vsync)(struct msm_panel_data *); |
| 61 | void (*request_vsync)(struct msm_panel_data *, struct msmfb_callback *); |
| 62 | void (*clear_vsync)(struct msm_panel_data *); |
| 63 | /* from the enum above */ |
| 64 | unsigned interface_type; |
| 65 | /* data to be passed to the fb driver */ |
| 66 | struct msm_fb_data *fb_data; |
| 67 | |
| 68 | /* capabilities supported by the panel */ |
| 69 | uint32_t caps; |
| 70 | }; |
| 71 | |
| 72 | struct msm_mddi_client_data { |
| 73 | void (*suspend)(struct msm_mddi_client_data *); |
| 74 | void (*resume)(struct msm_mddi_client_data *); |
| 75 | void (*activate_link)(struct msm_mddi_client_data *); |
| 76 | void (*remote_write)(struct msm_mddi_client_data *, uint32_t val, |
| 77 | uint32_t reg); |
| 78 | uint32_t (*remote_read)(struct msm_mddi_client_data *, uint32_t reg); |
| 79 | void (*auto_hibernate)(struct msm_mddi_client_data *, int); |
Pawan Kumar | 4868468 | 2012-12-21 16:55:24 +0530 | [diff] [blame] | 80 | /* custom data that needs to be passed from the board file to a |
Daniel Walker | 29d3ded | 2010-04-23 16:02:19 -0700 | [diff] [blame] | 81 | * particular client */ |
| 82 | void *private_client_data; |
| 83 | struct resource *fb_resource; |
| 84 | /* from the list above */ |
| 85 | unsigned interface_type; |
| 86 | }; |
| 87 | |
| 88 | struct msm_mddi_platform_data { |
| 89 | unsigned int clk_rate; |
| 90 | void (*power_client)(struct msm_mddi_client_data *, int on); |
| 91 | |
| 92 | /* fixup the mfr name, product id */ |
| 93 | void (*fixup)(uint16_t *mfr_name, uint16_t *product_id); |
| 94 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 95 | int vsync_irq; |
| 96 | |
Daniel Walker | 29d3ded | 2010-04-23 16:02:19 -0700 | [diff] [blame] | 97 | struct resource *fb_resource; /*optional*/ |
| 98 | /* number of clients in the list that follows */ |
| 99 | int num_clients; |
| 100 | /* array of client information of clients */ |
| 101 | struct { |
| 102 | unsigned product_id; /* mfr id in top 16 bits, product id |
| 103 | * in lower 16 bits |
| 104 | */ |
| 105 | char *name; /* the device name will be the platform |
| 106 | * device name registered for the client, |
| 107 | * it should match the name of the associated |
| 108 | * driver |
| 109 | */ |
| 110 | unsigned id; /* id for mddi client device node, will also |
| 111 | * be used as device id of panel devices, if |
| 112 | * the client device will have multiple panels |
| 113 | * space must be left here for them |
| 114 | */ |
| 115 | void *client_data; /* required private client data */ |
| 116 | unsigned int clk_rate; /* optional: if the client requires a |
| 117 | * different mddi clk rate |
| 118 | */ |
| 119 | } client_platform_data[]; |
| 120 | }; |
| 121 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 122 | struct msm_lcdc_timing { |
| 123 | unsigned int clk_rate; /* dclk freq */ |
| 124 | unsigned int hsync_pulse_width; /* in dclks */ |
| 125 | unsigned int hsync_back_porch; /* in dclks */ |
| 126 | unsigned int hsync_front_porch; /* in dclks */ |
| 127 | unsigned int hsync_skew; /* in dclks */ |
| 128 | unsigned int vsync_pulse_width; /* in lines */ |
| 129 | unsigned int vsync_back_porch; /* in lines */ |
| 130 | unsigned int vsync_front_porch; /* in lines */ |
| 131 | |
| 132 | /* control signal polarity */ |
| 133 | unsigned int vsync_act_low:1; |
| 134 | unsigned int hsync_act_low:1; |
| 135 | unsigned int den_act_low:1; |
| 136 | }; |
| 137 | |
| 138 | struct msm_lcdc_panel_ops { |
| 139 | int (*init)(struct msm_lcdc_panel_ops *); |
| 140 | int (*uninit)(struct msm_lcdc_panel_ops *); |
| 141 | int (*blank)(struct msm_lcdc_panel_ops *); |
| 142 | int (*unblank)(struct msm_lcdc_panel_ops *); |
| 143 | }; |
| 144 | |
| 145 | struct msm_lcdc_platform_data { |
| 146 | struct msm_lcdc_panel_ops *panel_ops; |
| 147 | struct msm_lcdc_timing *timing; |
| 148 | int fb_id; |
| 149 | struct msm_fb_data *fb_data; |
| 150 | struct resource *fb_resource; |
| 151 | }; |
| 152 | |
Daniel Walker | 29d3ded | 2010-04-23 16:02:19 -0700 | [diff] [blame] | 153 | struct mdp_blit_req; |
| 154 | struct fb_info; |
| 155 | struct mdp_device { |
| 156 | struct device dev; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 157 | void (*dma)(struct mdp_device *mdp, uint32_t addr, |
Daniel Walker | 29d3ded | 2010-04-23 16:02:19 -0700 | [diff] [blame] | 158 | uint32_t stride, uint32_t w, uint32_t h, uint32_t x, |
| 159 | uint32_t y, struct msmfb_callback *callback, int interface); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 160 | void (*dma_wait)(struct mdp_device *mdp, int interface); |
Daniel Walker | 29d3ded | 2010-04-23 16:02:19 -0700 | [diff] [blame] | 161 | int (*blit)(struct mdp_device *mdp, struct fb_info *fb, |
| 162 | struct mdp_blit_req *req); |
| 163 | void (*set_grp_disp)(struct mdp_device *mdp, uint32_t disp_id); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 164 | int (*check_output_format)(struct mdp_device *mdp, int bpp); |
| 165 | int (*set_output_format)(struct mdp_device *mdp, int bpp); |
Daniel Walker | 29d3ded | 2010-04-23 16:02:19 -0700 | [diff] [blame] | 166 | }; |
| 167 | |
| 168 | struct class_interface; |
| 169 | int register_mdp_client(struct class_interface *class_intf); |
| 170 | |
| 171 | /**** private client data structs go below this line ***/ |
| 172 | |
| 173 | struct msm_mddi_bridge_platform_data { |
| 174 | /* from board file */ |
| 175 | int (*init)(struct msm_mddi_bridge_platform_data *, |
| 176 | struct msm_mddi_client_data *); |
| 177 | int (*uninit)(struct msm_mddi_bridge_platform_data *, |
| 178 | struct msm_mddi_client_data *); |
| 179 | /* passed to panel for use by the fb driver */ |
| 180 | int (*blank)(struct msm_mddi_bridge_platform_data *, |
| 181 | struct msm_mddi_client_data *); |
| 182 | int (*unblank)(struct msm_mddi_bridge_platform_data *, |
| 183 | struct msm_mddi_client_data *); |
| 184 | struct msm_fb_data fb_data; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 185 | |
| 186 | /* board file will identify what capabilities the panel supports */ |
| 187 | uint32_t panel_caps; |
Daniel Walker | 29d3ded | 2010-04-23 16:02:19 -0700 | [diff] [blame] | 188 | }; |
| 189 | |
| 190 | |
Alhad Purnapatre | c55856c | 2012-02-28 13:24:57 -0800 | [diff] [blame] | 191 | struct mdp_v4l2_req; |
| 192 | int msm_fb_v4l2_enable(struct mdp_overlay *req, bool enable, void **par); |
Pawan Kumar | 4868468 | 2012-12-21 16:55:24 +0530 | [diff] [blame] | 193 | int msm_fb_v4l2_update(void *par, bool bUserPtr, |
Alhad Purnapatre | c55856c | 2012-02-28 13:24:57 -0800 | [diff] [blame] | 194 | unsigned long srcp0_addr, unsigned long srcp0_size, |
| 195 | unsigned long srcp1_addr, unsigned long srcp1_size, |
| 196 | unsigned long srcp2_addr, unsigned long srcp2_size); |
Daniel Walker | 29d3ded | 2010-04-23 16:02:19 -0700 | [diff] [blame] | 197 | |
| 198 | #endif |