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