1*4882a593Smuzhiyun /*
2*4882a593Smuzhiyun * Copyright © 2010 Intel Corporation
3*4882a593Smuzhiyun *
4*4882a593Smuzhiyun * Permission is hereby granted, free of charge, to any person obtaining a
5*4882a593Smuzhiyun * copy of this software and associated documentation files (the "Software"),
6*4882a593Smuzhiyun * to deal in the Software without restriction, including without limitation
7*4882a593Smuzhiyun * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8*4882a593Smuzhiyun * and/or sell copies of the Software, and to permit persons to whom the
9*4882a593Smuzhiyun * Software is furnished to do so, subject to the following conditions:
10*4882a593Smuzhiyun *
11*4882a593Smuzhiyun * The above copyright notice and this permission notice (including the next
12*4882a593Smuzhiyun * paragraph) shall be included in all copies or substantial portions of the
13*4882a593Smuzhiyun * Software.
14*4882a593Smuzhiyun *
15*4882a593Smuzhiyun * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16*4882a593Smuzhiyun * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17*4882a593Smuzhiyun * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18*4882a593Smuzhiyun * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19*4882a593Smuzhiyun * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20*4882a593Smuzhiyun * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21*4882a593Smuzhiyun * DEALINGS IN THE SOFTWARE.
22*4882a593Smuzhiyun *
23*4882a593Smuzhiyun * Authors:
24*4882a593Smuzhiyun * jim liu <jim.liu@intel.com>
25*4882a593Smuzhiyun * Jackie Li<yaodong.li@intel.com>
26*4882a593Smuzhiyun */
27*4882a593Smuzhiyun
28*4882a593Smuzhiyun #include "mdfld_dsi_dpi.h"
29*4882a593Smuzhiyun
tpo_vid_get_config_mode(struct drm_device * dev)30*4882a593Smuzhiyun static struct drm_display_mode *tpo_vid_get_config_mode(struct drm_device *dev)
31*4882a593Smuzhiyun {
32*4882a593Smuzhiyun struct drm_display_mode *mode;
33*4882a593Smuzhiyun
34*4882a593Smuzhiyun mode = kzalloc(sizeof(*mode), GFP_KERNEL);
35*4882a593Smuzhiyun if (!mode)
36*4882a593Smuzhiyun return NULL;
37*4882a593Smuzhiyun
38*4882a593Smuzhiyun mode->hdisplay = 864;
39*4882a593Smuzhiyun mode->vdisplay = 480;
40*4882a593Smuzhiyun mode->hsync_start = 873;
41*4882a593Smuzhiyun mode->hsync_end = 876;
42*4882a593Smuzhiyun mode->htotal = 887;
43*4882a593Smuzhiyun mode->vsync_start = 487;
44*4882a593Smuzhiyun mode->vsync_end = 490;
45*4882a593Smuzhiyun mode->vtotal = 499;
46*4882a593Smuzhiyun mode->clock = 33264;
47*4882a593Smuzhiyun
48*4882a593Smuzhiyun drm_mode_set_name(mode);
49*4882a593Smuzhiyun drm_mode_set_crtcinfo(mode, 0);
50*4882a593Smuzhiyun
51*4882a593Smuzhiyun mode->type |= DRM_MODE_TYPE_PREFERRED;
52*4882a593Smuzhiyun
53*4882a593Smuzhiyun return mode;
54*4882a593Smuzhiyun }
55*4882a593Smuzhiyun
tpo_vid_get_panel_info(struct drm_device * dev,int pipe,struct panel_info * pi)56*4882a593Smuzhiyun static int tpo_vid_get_panel_info(struct drm_device *dev,
57*4882a593Smuzhiyun int pipe,
58*4882a593Smuzhiyun struct panel_info *pi)
59*4882a593Smuzhiyun {
60*4882a593Smuzhiyun if (!dev || !pi)
61*4882a593Smuzhiyun return -EINVAL;
62*4882a593Smuzhiyun
63*4882a593Smuzhiyun pi->width_mm = TPO_PANEL_WIDTH;
64*4882a593Smuzhiyun pi->height_mm = TPO_PANEL_HEIGHT;
65*4882a593Smuzhiyun
66*4882a593Smuzhiyun return 0;
67*4882a593Smuzhiyun }
68*4882a593Smuzhiyun
69*4882a593Smuzhiyun /*TPO DPI encoder helper funcs*/
70*4882a593Smuzhiyun static const struct drm_encoder_helper_funcs
71*4882a593Smuzhiyun mdfld_tpo_dpi_encoder_helper_funcs = {
72*4882a593Smuzhiyun .dpms = mdfld_dsi_dpi_dpms,
73*4882a593Smuzhiyun .mode_fixup = mdfld_dsi_dpi_mode_fixup,
74*4882a593Smuzhiyun .prepare = mdfld_dsi_dpi_prepare,
75*4882a593Smuzhiyun .mode_set = mdfld_dsi_dpi_mode_set,
76*4882a593Smuzhiyun .commit = mdfld_dsi_dpi_commit,
77*4882a593Smuzhiyun };
78*4882a593Smuzhiyun
79*4882a593Smuzhiyun const struct panel_funcs mdfld_tpo_vid_funcs = {
80*4882a593Smuzhiyun .encoder_helper_funcs = &mdfld_tpo_dpi_encoder_helper_funcs,
81*4882a593Smuzhiyun .get_config_mode = &tpo_vid_get_config_mode,
82*4882a593Smuzhiyun .get_panel_info = tpo_vid_get_panel_info,
83*4882a593Smuzhiyun };
84