chromium: add drm drivers files based on
[firefly-linux-kernel-4.4.55.git] / drivers / gpu / drm / rockchip / rockchip_drm_hdmi.h
1 /*
2  * Copyright (C) ROCKCHIP, Inc.
3  * Author:yzq<yzq@rock-chips.com>
4  *
5  * based on exynos_drm_hdmi.h
6  *
7  * This software is licensed under the terms of the GNU General Public
8  * License version 2, as published by the Free Software Foundation, and
9  * may be copied, distributed, and modified under those terms.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  */
16 #ifndef _ROCKCHIP_DRM_HDMI_H_
17 #define _ROCKCHIP_DRM_HDMI_H_
18
19 #define MIXER_WIN_NR            3
20 #define MIXER_DEFAULT_WIN       0
21
22 /*
23  * rockchip hdmi common context structure.
24  *
25  * @drm_dev: pointer to drm_device.
26  * @ctx: pointer to the context of specific device driver.
27  *      this context should be hdmi_context or mixer_context.
28  */
29 struct rockchip_drm_hdmi_context {
30         struct drm_device       *drm_dev;
31         void                    *ctx;
32 };
33
34 struct rockchip_hdmi_ops {
35         /* display */
36         bool (*is_connected)(void *ctx);
37         struct edid *(*get_edid)(void *ctx,
38                         struct drm_connector *connector);
39         int (*check_timing)(void *ctx, struct fb_videomode *timing);
40         int (*power_on)(void *ctx, int mode);
41
42         /* manager */
43         void (*mode_set)(void *ctx, void *mode);
44         void (*get_max_resol)(void *ctx, unsigned int *width,
45                                 unsigned int *height);
46         void (*commit)(void *ctx);
47         void (*dpms)(void *ctx, int mode);
48 };
49
50 struct rockchip_mixer_ops {
51         /* manager */
52         int (*iommu_on)(void *ctx, bool enable);
53         int (*enable_vblank)(void *ctx, int pipe);
54         void (*disable_vblank)(void *ctx);
55         void (*wait_for_vblank)(void *ctx);
56         void (*dpms)(void *ctx, int mode);
57
58         /* overlay */
59         void (*win_mode_set)(void *ctx, struct rockchip_drm_overlay *overlay);
60         void (*win_commit)(void *ctx, int zpos);
61         void (*win_disable)(void *ctx, int zpos);
62
63         /* display */
64         int (*check_timing)(void *ctx, struct fb_videomode *timing);
65 };
66
67 void rockchip_hdmi_drv_attach(struct rockchip_drm_hdmi_context *ctx);
68 void rockchip_mixer_drv_attach(struct rockchip_drm_hdmi_context *ctx);
69 void rockchip_hdmi_ops_register(struct rockchip_hdmi_ops *ops);
70 void rockchip_mixer_ops_register(struct rockchip_mixer_ops *ops);
71 #endif