CHROMIUM: drm/exynos: Remove panel_ops->commit
[cascardo/linux.git] / drivers / gpu / drm / exynos / exynos_drm_display.h
1 /*
2  * Copyright (C) 2012 Google, Inc.
3  *
4  * This software is licensed under the terms of the GNU General Public
5  * License version 2, as published by the Free Software Foundation, and
6  * may be copied, distributed, and modified under those terms.
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11  * GNU General Public License for more details.
12  */
13
14 #ifndef _EXYNOS_DRM_PANEL_H_
15 #define _EXYNOS_DRM_PANEL_H_
16
17 struct exynos_drm_overlay;
18
19 /*
20  * Callbacks used to manipulate the panel (DP/HDMI/MIPI)
21  *
22  * @subdrv_probe: Used to associate drm_dev with panel context
23  * @is_connected: Returns true if the panel is connected
24  * @get_edid: Returns an edid with mode data from the panel
25  * @check_timing: Returns 0 if the given timing is valid for the panel
26  * @dpms: Sets the panel's power to mode and enables/disables video output
27  * @mode_fixup: Copies and optionally alters mode to adjusted_mode
28  * @mode_set: Sets the panel to output mode
29  * @get_max_res: Returns the maximum resolution in width/height
30  */
31 struct exynos_panel_ops {
32         int (*subdrv_probe)(void *ctx, struct drm_device *drm_dev);
33         bool (*is_connected)(void *ctx);
34         struct edid *(*get_edid)(void *ctx, struct drm_connector *connector);
35         int (*check_timing)(void *ctx, void *timing);
36         int (*dpms)(void *ctx, int mode);
37         void (*mode_fixup)(void *ctx, struct drm_connector *connector,
38                                 struct drm_display_mode *mode,
39                                 struct drm_display_mode *adjusted_mode);
40         void (*mode_set)(void *ctx, struct drm_display_mode *mode);
41         void (*get_max_res)(void *ctx, unsigned int *width,
42                                 unsigned int *height);
43 };
44
45 /*
46  * Callbacks used to manipulate the controller (FIMD/Mixer)
47  *
48  * @subdrv_probe: Used to associate drm_dev with the controller context
49  * @get_panel: If we're not using edid, return the panel info
50  * @enable_vblank: Enable the controller's vblank interrupt and set pipe
51  * @disable_vblank: Disable the controller's vblank interrupt
52  * @dpms: Sets the controller's power to mode
53  * @mode_set: Sets the controller to output mode
54  * @commit: Applies controller level settings (as opposed to window level)
55  * @win_commit: Commits the changes on only one window
56  * @win_disable: Disables one of the controller's windows
57  */
58 struct exynos_controller_ops {
59         int (*subdrv_probe)(void *ctx, struct drm_device *drm_dev);
60         struct exynos_drm_panel_info *(*get_panel)(void *ctx);
61         int (*enable_vblank)(void *ctx, int pipe);
62         void (*disable_vblank)(void *ctx);
63         int (*dpms)(void *ctx, int mode);
64         void (*mode_set)(void *ctx, struct exynos_drm_overlay *overlay);
65         void (*commit)(void *ctx);
66         void (*win_commit)(void *ctx, int zpos);
67         void (*win_disable)(void *ctx, int zpos);
68 };
69
70 /*
71  * The various bits we need to keep track of to manipulate the hardware from
72  * the connector/encoder/crtc drm callbacks.
73  *
74  * @display_type: The type of display, depends on which CONFIGs are enabled
75  * @subdrv: The exynos drm sub driver pointer
76  * @panel_ops: The panel callbacks to use
77  * @controller_ops: The controller callbacks to use
78  * @panel_ctx: The context pointer to pass to panel callbacks
79  * @controller_ctx: The context pointer to pass to controller callbacks
80  * @pipe: The current pipe number for this display
81  * @suspend_dpms: The dpms mode of the display before suspend
82  */
83 struct exynos_drm_display {
84         enum exynos_drm_display_type display_type;
85         struct exynos_drm_subdrv *subdrv;
86         struct exynos_panel_ops *panel_ops;
87         struct exynos_controller_ops *controller_ops;
88         void *panel_ctx;
89         void *controller_ctx;
90         int pipe;
91         int suspend_dpms;
92 };
93
94 const char *exynos_display_type_name(const struct exynos_drm_display *display);
95
96 /*
97  * Used by the hardware drivers to attach panel and controller callbacks and
98  * contexts to a display.
99  */
100 void exynos_display_attach_panel(enum exynos_drm_display_type type,
101                 struct exynos_panel_ops *ops, void *ctx);
102 void exynos_display_attach_controller(enum exynos_drm_display_type type,
103                 struct exynos_controller_ops *ops, void *ctx);
104
105 /* Initializes the given display to type */
106 int exynos_display_init(struct exynos_drm_display *display,
107                 enum exynos_drm_display_type type);
108
109 /* Cleans up the given display */
110 void exynos_display_remove(struct exynos_drm_display *display);
111
112 #endif