1 /*
2  * Internal shared definitions for various MSM framebuffer parts.
3  *
4  * Copyright (C) 2007 Google Incorporated
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 
16 #ifndef _MSM_FB_H_
17 #define _MSM_FB_H_
18 
19 #include <linux/device.h>
20 
21 struct mddi_info;
22 
23 struct msm_fb_data {
24 	int xres;	/* x resolution in pixels */
25 	int yres;	/* y resolution in pixels */
26 	int width;	/* disply width in mm */
27 	int height;	/* display height in mm */
28 	unsigned output_format;
29 };
30 
31 struct msmfb_callback {
32 	void (*func)(struct msmfb_callback *);
33 };
34 
35 enum {
36 	MSM_MDDI_PMDH_INTERFACE,
37 	MSM_MDDI_EMDH_INTERFACE,
38 	MSM_EBI2_INTERFACE,
39 };
40 
41 #define MSMFB_CAP_PARTIAL_UPDATES	(1 << 0)
42 
43 struct msm_panel_data {
44 	/* turns off the fb memory */
45 	int (*suspend)(struct msm_panel_data *);
46 	/* turns on the fb memory */
47 	int (*resume)(struct msm_panel_data *);
48 	/* turns off the panel */
49 	int (*blank)(struct msm_panel_data *);
50 	/* turns on the panel */
51 	int (*unblank)(struct msm_panel_data *);
52 	void (*wait_vsync)(struct msm_panel_data *);
53 	void (*request_vsync)(struct msm_panel_data *, struct msmfb_callback *);
54 	void (*clear_vsync)(struct msm_panel_data *);
55 	/* from the enum above */
56 	unsigned interface_type;
57 	/* data to be passed to the fb driver */
58 	struct msm_fb_data *fb_data;
59 
60 	/* capabilities supported by the panel */
61 	uint32_t caps;
62 };
63 
64 struct msm_mddi_client_data {
65 	void (*suspend)(struct msm_mddi_client_data *);
66 	void (*resume)(struct msm_mddi_client_data *);
67 	void (*activate_link)(struct msm_mddi_client_data *);
68 	void (*remote_write)(struct msm_mddi_client_data *, uint32_t val,
69 			     uint32_t reg);
70 	uint32_t (*remote_read)(struct msm_mddi_client_data *, uint32_t reg);
71 	void (*auto_hibernate)(struct msm_mddi_client_data *, int);
72 	/* custom data that needs to be passed from the board file to a
73 	 * particular client */
74 	void *private_client_data;
75 	struct resource *fb_resource;
76 	/* from the list above */
77 	unsigned interface_type;
78 };
79 
80 struct msm_mddi_platform_data {
81 	unsigned int clk_rate;
82 	void (*power_client)(struct msm_mddi_client_data *, int on);
83 
84 	/* fixup the mfr name, product id */
85 	void (*fixup)(uint16_t *mfr_name, uint16_t *product_id);
86 
87 	struct resource *fb_resource; /*optional*/
88 	/* number of clients in the list that follows */
89 	int num_clients;
90 	/* array of client information of clients */
91 	struct {
92 		unsigned product_id; /* mfr id in top 16 bits, product id
93 				      * in lower 16 bits
94 				      */
95 		char *name;	/* the device name will be the platform
96 				 * device name registered for the client,
97 				 * it should match the name of the associated
98 				 * driver
99 				 */
100 		unsigned id;	/* id for mddi client device node, will also
101 				 * be used as device id of panel devices, if
102 				 * the client device will have multiple panels
103 				 * space must be left here for them
104 				 */
105 		void *client_data;	/* required private client data */
106 		unsigned int clk_rate;	/* optional: if the client requires a
107 					* different mddi clk rate
108 					*/
109 	} client_platform_data[];
110 };
111 
112 struct mdp_blit_req;
113 struct fb_info;
114 struct mdp_device {
115 	struct device dev;
116 	void (*dma)(struct mdp_device *mpd, uint32_t addr,
117 		    uint32_t stride, uint32_t w, uint32_t h, uint32_t x,
118 		    uint32_t y, struct msmfb_callback *callback, int interface);
119 	void (*dma_wait)(struct mdp_device *mdp);
120 	int (*blit)(struct mdp_device *mdp, struct fb_info *fb,
121 		    struct mdp_blit_req *req);
122 	void (*set_grp_disp)(struct mdp_device *mdp, uint32_t disp_id);
123 };
124 
125 struct class_interface;
126 int register_mdp_client(struct class_interface *class_intf);
127 
128 /**** private client data structs go below this line ***/
129 
130 struct msm_mddi_bridge_platform_data {
131 	/* from board file */
132 	int (*init)(struct msm_mddi_bridge_platform_data *,
133 		    struct msm_mddi_client_data *);
134 	int (*uninit)(struct msm_mddi_bridge_platform_data *,
135 		      struct msm_mddi_client_data *);
136 	/* passed to panel for use by the fb driver */
137 	int (*blank)(struct msm_mddi_bridge_platform_data *,
138 		     struct msm_mddi_client_data *);
139 	int (*unblank)(struct msm_mddi_bridge_platform_data *,
140 		       struct msm_mddi_client_data *);
141 	struct msm_fb_data fb_data;
142 };
143 
144 
145 
146 #endif
147