2 * linux/include/video/mmp_disp.h
3 * Header file for Marvell MMP Display Controller
5 * Copyright (C) 2012 Marvell Technology Group Ltd.
6 * Authors: Zhou Zhu <zzhu3@marvell.com>
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2 of the License, or (at your
11 * option) any later version.
13 * This program is distributed in the hope that it will be useful, but WITHOUT
14 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
18 * You should have received a copy of the GNU General Public License along with
19 * this program. If not, see <http://www.gnu.org/licenses/>.
25 #include <linux/kthread.h>
35 PIXFMT_RGB565 = 0x100,
45 PIXFMT_RGB666, /* for output usage */
46 PIXFMT_PSEUDOCOLOR = 0x200,
49 static inline int pixfmt_to_stride(int pix_fmt)
60 case PIXFMT_RGB888UNPACK:
61 case PIXFMT_BGR888UNPACK:
65 case PIXFMT_RGB888PACK:
66 case PIXFMT_BGR888PACK:
72 case PIXFMT_PSEUDOCOLOR:
79 /* parameters used by path/overlay */
80 /* overlay related para: win/addr */
82 /* position/size of window */
95 * pitch[0]: graphics/video layer line length or y pitch
96 * pitch[1]/pitch[2]: video u/v pitch if non-zero
106 /* path related para: mode */
125 /* main structures */
136 static inline const char *stat_name(int stat)
144 return "UNKNOWNSTAT";
148 struct mmp_overlay_ops {
149 /* should be provided by driver */
150 void (*set_fetch)(struct mmp_overlay *overlay, int fetch_id);
151 void (*set_onoff)(struct mmp_overlay *overlay, int status);
152 void (*set_win)(struct mmp_overlay *overlay, struct mmp_win *win);
153 int (*set_addr)(struct mmp_overlay *overlay, struct mmp_addr *addr);
156 /* overlay describes a z-order indexed slot in each path. */
160 struct mmp_path *path;
162 /* overlay info: private data */
164 struct mmp_addr addr;
170 struct mutex access_ok;
172 struct mmp_overlay_ops *ops;
177 PANELTYPE_ACTIVE = 0,
185 /* use node to register to list */
186 struct list_head node;
188 /* path name used to connect to proper path configed */
189 const char *plat_path_name;
193 int (*get_modelist)(struct mmp_panel *panel,
194 struct mmp_mode **modelist);
195 void (*set_mode)(struct mmp_panel *panel,
196 struct mmp_mode *mode);
197 void (*set_onoff)(struct mmp_panel *panel,
201 struct mmp_path_ops {
202 int (*check_status)(struct mmp_path *path);
203 struct mmp_overlay *(*get_overlay)(struct mmp_path *path,
205 int (*get_modelist)(struct mmp_path *path,
206 struct mmp_mode **modelist);
208 /* follow ops should be provided by driver */
209 void (*set_mode)(struct mmp_path *path, struct mmp_mode *mode);
210 void (*set_onoff)(struct mmp_path *path, int status);
211 /* todo: add query */
214 /* path output types */
221 /* path is main part of mmp-disp */
223 /* use node to register to list */
224 struct list_head node;
232 struct mmp_panel *panel;
236 struct mmp_mode mode;
241 struct mutex access_ok;
243 struct mmp_path_ops ops;
247 struct mmp_overlay overlays[0];
250 extern struct mmp_path *mmp_get_path(const char *name);
251 static inline void mmp_path_set_mode(struct mmp_path *path,
252 struct mmp_mode *mode)
255 path->ops.set_mode(path, mode);
257 static inline void mmp_path_set_onoff(struct mmp_path *path, int status)
260 path->ops.set_onoff(path, status);
262 static inline int mmp_path_get_modelist(struct mmp_path *path,
263 struct mmp_mode **modelist)
266 return path->ops.get_modelist(path, modelist);
269 static inline struct mmp_overlay *mmp_path_get_overlay(
270 struct mmp_path *path, int overlay_id)
273 return path->ops.get_overlay(path, overlay_id);
276 static inline void mmp_overlay_set_fetch(struct mmp_overlay *overlay,
280 overlay->ops->set_fetch(overlay, fetch_id);
282 static inline void mmp_overlay_set_onoff(struct mmp_overlay *overlay,
286 overlay->ops->set_onoff(overlay, status);
288 static inline void mmp_overlay_set_win(struct mmp_overlay *overlay,
292 overlay->ops->set_win(overlay, win);
294 static inline int mmp_overlay_set_addr(struct mmp_overlay *overlay,
295 struct mmp_addr *addr)
298 return overlay->ops->set_addr(overlay, addr);
303 * driver data is set from each detailed ctrl driver for path usage
304 * it defined a common interface that plat driver need to implement
306 struct mmp_path_info {
307 /* driver data, set when registed*/
313 void (*set_mode)(struct mmp_path *path, struct mmp_mode *mode);
314 void (*set_onoff)(struct mmp_path *path, int status);
315 struct mmp_overlay_ops *overlay_ops;
319 extern struct mmp_path *mmp_register_path(
320 struct mmp_path_info *info);
321 extern void mmp_unregister_path(struct mmp_path *path);
322 extern void mmp_register_panel(struct mmp_panel *panel);
323 extern void mmp_unregister_panel(struct mmp_panel *panel);
325 /* defintions for platform data */
326 /* interface for buffer driver */
327 struct mmp_buffer_driver_mach_info {
329 const char *path_name;
335 /* interface for controllers driver */
336 struct mmp_mach_path_config {
345 struct mmp_mach_plat_info {
347 const char *clk_name;
349 struct mmp_mach_path_config *paths;
352 /* interface for panel drivers */
353 struct mmp_mach_panel_info {
355 void (*plat_set_onoff)(int status);
356 const char *plat_path_name;
358 #endif /* _MMP_DISP_H_ */