2 * linux/include/video/mmp_disp.h
3 * Header file for Marvell MMP Display Controller
5 * Copyright (C) 2012 Marvell Technology Group Ltd.
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 */
101 /* path related para: mode */
120 /* main structures */
131 static inline const char *stat_name(int stat)
139 return "UNKNOWNSTAT";
143 struct mmp_overlay_ops {
144 /* should be provided by driver */
145 void (*set_fetch)(struct mmp_overlay *overlay, int fetch_id);
146 void (*set_onoff)(struct mmp_overlay *overlay, int status);
147 void (*set_win)(struct mmp_overlay *overlay, struct mmp_win *win);
148 int (*set_addr)(struct mmp_overlay *overlay, struct mmp_addr *addr);
151 /* overlay describes a z-order indexed slot in each path. */
155 struct mmp_path *path;
157 /* overlay info: private data */
159 struct mmp_addr addr;
165 struct mutex access_ok;
167 struct mmp_overlay_ops *ops;
172 PANELTYPE_ACTIVE = 0,
180 /* use node to register to list */
181 struct list_head node;
183 /* path name used to connect to proper path configed */
184 const char *plat_path_name;
188 int (*get_modelist)(struct mmp_panel *panel,
189 struct mmp_mode **modelist);
190 void (*set_mode)(struct mmp_panel *panel,
191 struct mmp_mode *mode);
192 void (*set_onoff)(struct mmp_panel *panel,
196 struct mmp_path_ops {
197 int (*check_status)(struct mmp_path *path);
198 struct mmp_overlay *(*get_overlay)(struct mmp_path *path,
200 int (*get_modelist)(struct mmp_path *path,
201 struct mmp_mode **modelist);
203 /* follow ops should be provided by driver */
204 void (*set_mode)(struct mmp_path *path, struct mmp_mode *mode);
205 void (*set_onoff)(struct mmp_path *path, int status);
206 /* todo: add query */
209 /* path output types */
216 /* path is main part of mmp-disp */
218 /* use node to register to list */
219 struct list_head node;
227 struct mmp_panel *panel;
231 struct mmp_mode mode;
236 struct mutex access_ok;
238 struct mmp_path_ops ops;
242 struct mmp_overlay overlays[0];
245 extern struct mmp_path *mmp_get_path(const char *name);
246 static inline void mmp_path_set_mode(struct mmp_path *path,
247 struct mmp_mode *mode)
250 path->ops.set_mode(path, mode);
252 static inline void mmp_path_set_onoff(struct mmp_path *path, int status)
255 path->ops.set_onoff(path, status);
257 static inline int mmp_path_get_modelist(struct mmp_path *path,
258 struct mmp_mode **modelist)
261 return path->ops.get_modelist(path, modelist);
264 static inline struct mmp_overlay *mmp_path_get_overlay(
265 struct mmp_path *path, int overlay_id)
268 return path->ops.get_overlay(path, overlay_id);
271 static inline void mmp_overlay_set_fetch(struct mmp_overlay *overlay,
275 overlay->ops->set_fetch(overlay, fetch_id);
277 static inline void mmp_overlay_set_onoff(struct mmp_overlay *overlay,
281 overlay->ops->set_onoff(overlay, status);
283 static inline void mmp_overlay_set_win(struct mmp_overlay *overlay,
287 overlay->ops->set_win(overlay, win);
289 static inline int mmp_overlay_set_addr(struct mmp_overlay *overlay,
290 struct mmp_addr *addr)
293 return overlay->ops->set_addr(overlay, addr);
298 * driver data is set from each detailed ctrl driver for path usage
299 * it defined a common interface that plat driver need to implement
301 struct mmp_path_info {
302 /* driver data, set when registed*/
308 void (*set_mode)(struct mmp_path *path, struct mmp_mode *mode);
309 void (*set_onoff)(struct mmp_path *path, int status);
310 struct mmp_overlay_ops *overlay_ops;
314 extern struct mmp_path *mmp_register_path(
315 struct mmp_path_info *info);
316 extern void mmp_unregister_path(struct mmp_path *path);
317 extern void mmp_register_panel(struct mmp_panel *panel);
318 extern void mmp_unregister_panel(struct mmp_panel *panel);
320 /* defintions for platform data */
321 /* interface for buffer driver */
322 struct mmp_buffer_driver_mach_info {
324 const char *path_name;
330 /* interface for controllers driver */
331 struct mmp_mach_path_config {
339 struct mmp_mach_plat_info {
341 const char *clk_name;
343 struct mmp_mach_path_config *paths;
346 /* interface for panel drivers */
347 struct mmp_mach_panel_info {
349 void (*plat_set_onoff)(int status);
350 const char *plat_path_name;
352 #endif /* _MMP_DISP_H_ */