Merge tag 'block-5.11-2021-01-10' of git://git.kernel.dk/linux-block
[linux/fpc-iii.git] / drivers / gpu / drm / gma500 / mdfld_tpo_vid.c
blob11845978fb0a68efa7679332aa7f534b5e5f845a
1 /*
2 * Copyright © 2010 Intel Corporation
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:
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.
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.
23 * Authors:
24 * jim liu <jim.liu@intel.com>
25 * Jackie Li<yaodong.li@intel.com>
28 #include "mdfld_dsi_dpi.h"
30 static struct drm_display_mode *tpo_vid_get_config_mode(struct drm_device *dev)
32 struct drm_display_mode *mode;
34 mode = kzalloc(sizeof(*mode), GFP_KERNEL);
35 if (!mode)
36 return NULL;
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;
48 drm_mode_set_name(mode);
49 drm_mode_set_crtcinfo(mode, 0);
51 mode->type |= DRM_MODE_TYPE_PREFERRED;
53 return mode;
56 static int tpo_vid_get_panel_info(struct drm_device *dev,
57 int pipe,
58 struct panel_info *pi)
60 if (!dev || !pi)
61 return -EINVAL;
63 pi->width_mm = TPO_PANEL_WIDTH;
64 pi->height_mm = TPO_PANEL_HEIGHT;
66 return 0;
69 /*TPO DPI encoder helper funcs*/
70 static 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,
79 const struct panel_funcs mdfld_tpo_vid_funcs = {
80 .encoder_helper_funcs = &mdfld_tpo_dpi_encoder_helper_funcs,
81 .get_config_mode = &tpo_vid_get_config_mode,
82 .get_panel_info = tpo_vid_get_panel_info,