18c2ecf20Sopenharmony_ci/*
28c2ecf20Sopenharmony_ci * Copyright © 2010 Intel Corporation
38c2ecf20Sopenharmony_ci *
48c2ecf20Sopenharmony_ci * Permission is hereby granted, free of charge, to any person obtaining a
58c2ecf20Sopenharmony_ci * copy of this software and associated documentation files (the "Software"),
68c2ecf20Sopenharmony_ci * to deal in the Software without restriction, including without limitation
78c2ecf20Sopenharmony_ci * the rights to use, copy, modify, merge, publish, distribute, sublicense,
88c2ecf20Sopenharmony_ci * and/or sell copies of the Software, and to permit persons to whom the
98c2ecf20Sopenharmony_ci * Software is furnished to do so, subject to the following conditions:
108c2ecf20Sopenharmony_ci *
118c2ecf20Sopenharmony_ci * The above copyright notice and this permission notice (including the next
128c2ecf20Sopenharmony_ci * paragraph) shall be included in all copies or substantial portions of the
138c2ecf20Sopenharmony_ci * Software.
148c2ecf20Sopenharmony_ci *
158c2ecf20Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
168c2ecf20Sopenharmony_ci * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
178c2ecf20Sopenharmony_ci * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
188c2ecf20Sopenharmony_ci * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
198c2ecf20Sopenharmony_ci * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
208c2ecf20Sopenharmony_ci * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
218c2ecf20Sopenharmony_ci * DEALINGS IN THE SOFTWARE.
228c2ecf20Sopenharmony_ci *
238c2ecf20Sopenharmony_ci * Authors:
248c2ecf20Sopenharmony_ci * jim liu <jim.liu@intel.com>
258c2ecf20Sopenharmony_ci * Jackie Li<yaodong.li@intel.com>
268c2ecf20Sopenharmony_ci */
278c2ecf20Sopenharmony_ci
288c2ecf20Sopenharmony_ci#include "mdfld_dsi_dpi.h"
298c2ecf20Sopenharmony_ci
308c2ecf20Sopenharmony_cistatic struct drm_display_mode *tpo_vid_get_config_mode(struct drm_device *dev)
318c2ecf20Sopenharmony_ci{
328c2ecf20Sopenharmony_ci	struct drm_display_mode *mode;
338c2ecf20Sopenharmony_ci
348c2ecf20Sopenharmony_ci	mode = kzalloc(sizeof(*mode), GFP_KERNEL);
358c2ecf20Sopenharmony_ci	if (!mode)
368c2ecf20Sopenharmony_ci		return NULL;
378c2ecf20Sopenharmony_ci
388c2ecf20Sopenharmony_ci	mode->hdisplay = 864;
398c2ecf20Sopenharmony_ci	mode->vdisplay = 480;
408c2ecf20Sopenharmony_ci	mode->hsync_start = 873;
418c2ecf20Sopenharmony_ci	mode->hsync_end = 876;
428c2ecf20Sopenharmony_ci	mode->htotal = 887;
438c2ecf20Sopenharmony_ci	mode->vsync_start = 487;
448c2ecf20Sopenharmony_ci	mode->vsync_end = 490;
458c2ecf20Sopenharmony_ci	mode->vtotal = 499;
468c2ecf20Sopenharmony_ci	mode->clock = 33264;
478c2ecf20Sopenharmony_ci
488c2ecf20Sopenharmony_ci	drm_mode_set_name(mode);
498c2ecf20Sopenharmony_ci	drm_mode_set_crtcinfo(mode, 0);
508c2ecf20Sopenharmony_ci
518c2ecf20Sopenharmony_ci	mode->type |= DRM_MODE_TYPE_PREFERRED;
528c2ecf20Sopenharmony_ci
538c2ecf20Sopenharmony_ci	return mode;
548c2ecf20Sopenharmony_ci}
558c2ecf20Sopenharmony_ci
568c2ecf20Sopenharmony_cistatic int tpo_vid_get_panel_info(struct drm_device *dev,
578c2ecf20Sopenharmony_ci				int pipe,
588c2ecf20Sopenharmony_ci				struct panel_info *pi)
598c2ecf20Sopenharmony_ci{
608c2ecf20Sopenharmony_ci	if (!dev || !pi)
618c2ecf20Sopenharmony_ci		return -EINVAL;
628c2ecf20Sopenharmony_ci
638c2ecf20Sopenharmony_ci	pi->width_mm = TPO_PANEL_WIDTH;
648c2ecf20Sopenharmony_ci	pi->height_mm = TPO_PANEL_HEIGHT;
658c2ecf20Sopenharmony_ci
668c2ecf20Sopenharmony_ci	return 0;
678c2ecf20Sopenharmony_ci}
688c2ecf20Sopenharmony_ci
698c2ecf20Sopenharmony_ci/*TPO DPI encoder helper funcs*/
708c2ecf20Sopenharmony_cistatic const struct drm_encoder_helper_funcs
718c2ecf20Sopenharmony_ci				mdfld_tpo_dpi_encoder_helper_funcs = {
728c2ecf20Sopenharmony_ci	.dpms = mdfld_dsi_dpi_dpms,
738c2ecf20Sopenharmony_ci	.mode_fixup = mdfld_dsi_dpi_mode_fixup,
748c2ecf20Sopenharmony_ci	.prepare = mdfld_dsi_dpi_prepare,
758c2ecf20Sopenharmony_ci	.mode_set = mdfld_dsi_dpi_mode_set,
768c2ecf20Sopenharmony_ci	.commit = mdfld_dsi_dpi_commit,
778c2ecf20Sopenharmony_ci};
788c2ecf20Sopenharmony_ci
798c2ecf20Sopenharmony_ciconst struct panel_funcs mdfld_tpo_vid_funcs = {
808c2ecf20Sopenharmony_ci	.encoder_helper_funcs = &mdfld_tpo_dpi_encoder_helper_funcs,
818c2ecf20Sopenharmony_ci	.get_config_mode = &tpo_vid_get_config_mode,
828c2ecf20Sopenharmony_ci	.get_panel_info = tpo_vid_get_panel_info,
838c2ecf20Sopenharmony_ci};
84