2 * Copyright (C) 2012 Google, Inc.
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.
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.
14 #ifndef _EXYNOS_DRM_PANEL_H_
15 #define _EXYNOS_DRM_PANEL_H_
17 struct exynos_drm_overlay;
20 * Callbacks used to manipulate the panel (DP/HDMI/MIPI)
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
27 * @mode_fixup: Copies and optionally alters mode to adjusted_mode
28 * @mode_set: Sets the panel to output mode
29 * @commit: Commits changes to the panel from mode_set
30 * @get_max_res: Returns the maximum resolution in width/height
32 struct exynos_panel_ops {
33 int (*subdrv_probe)(void *ctx, struct drm_device *drm_dev);
34 bool (*is_connected)(void *ctx);
35 struct edid *(*get_edid)(void *ctx, struct drm_connector *connector);
36 int (*check_timing)(void *ctx, void *timing);
37 int (*dpms)(void *ctx, int mode);
38 void (*mode_fixup)(void *ctx, struct drm_connector *connector,
39 struct drm_display_mode *mode,
40 struct drm_display_mode *adjusted_mode);
41 void (*mode_set)(void *ctx, struct drm_display_mode *mode);
42 void (*commit)(void *ctx);
43 void (*get_max_res)(void *ctx, unsigned int *width,
44 unsigned int *height);
48 * Callbacks used to manipulate the controller (FIMD/Mixer)
50 * @subdrv_probe: Used to associate drm_dev with the controller context
51 * @get_panel: If we're not using edid, return the panel info
52 * @enable_vblank: Enable the controller's vblank interrupt and set pipe
53 * @disable_vblank: Disable the controller's vblank interrupt
54 * @dpms: Sets the controller's power to mode
55 * @mode_set: Sets the controller to output mode
56 * @commit: Applies controller level settings (as opposed to window level)
57 * @win_commit: Commits the changes on only one window
58 * @win_disable: Disables one of the controller's windows
60 struct exynos_controller_ops {
61 int (*subdrv_probe)(void *ctx, struct drm_device *drm_dev);
62 struct exynos_drm_panel_info *(*get_panel)(void *ctx);
63 int (*enable_vblank)(void *ctx, int pipe);
64 void (*disable_vblank)(void *ctx);
65 int (*dpms)(void *ctx, int mode);
66 void (*mode_set)(void *ctx, struct exynos_drm_overlay *overlay);
67 void (*commit)(void *ctx);
68 void (*win_commit)(void *ctx, int zpos);
69 void (*win_disable)(void *ctx, int zpos);
73 * The various bits we need to keep track of to manipulate the hardware from
74 * the connector/encoder/crtc drm callbacks.
76 * @display_type: The type of display, depends on which CONFIGs are enabled
77 * @subdrv: The exynos drm sub driver pointer
78 * @panel_ops: The panel callbacks to use
79 * @controller_ops: The controller callbacks to use
80 * @panel_ctx: The context pointer to pass to panel callbacks
81 * @controller_ctx: The context pointer to pass to controller callbacks
82 * @pipe: The current pipe number for this display
83 * @suspend_dpms: The dpms mode of the display before suspend
85 struct exynos_drm_display {
86 enum exynos_drm_display_type display_type;
87 struct exynos_drm_subdrv *subdrv;
88 struct exynos_panel_ops *panel_ops;
89 struct exynos_controller_ops *controller_ops;
96 const char *exynos_display_type_name(const struct exynos_drm_display *display);
99 * Used by the hardware drivers to attach panel and controller callbacks and
100 * contexts to a display.
102 void exynos_display_attach_panel(enum exynos_drm_display_type type,
103 struct exynos_panel_ops *ops, void *ctx);
104 void exynos_display_attach_controller(enum exynos_drm_display_type type,
105 struct exynos_controller_ops *ops, void *ctx);
107 /* Initializes the given display to type */
108 int exynos_display_init(struct exynos_drm_display *display,
109 enum exynos_drm_display_type type);
111 /* Cleans up the given display */
112 void exynos_display_remove(struct exynos_drm_display *display);