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#ifndef __MDFLD_DSI_DPI_H__ 298c2ecf20Sopenharmony_ci#define __MDFLD_DSI_DPI_H__ 308c2ecf20Sopenharmony_ci 318c2ecf20Sopenharmony_ci#include "mdfld_dsi_output.h" 328c2ecf20Sopenharmony_ci#include "mdfld_output.h" 338c2ecf20Sopenharmony_ci 348c2ecf20Sopenharmony_cistruct mdfld_dsi_dpi_timing { 358c2ecf20Sopenharmony_ci u16 hsync_count; 368c2ecf20Sopenharmony_ci u16 hbp_count; 378c2ecf20Sopenharmony_ci u16 hfp_count; 388c2ecf20Sopenharmony_ci u16 hactive_count; 398c2ecf20Sopenharmony_ci u16 vsync_count; 408c2ecf20Sopenharmony_ci u16 vbp_count; 418c2ecf20Sopenharmony_ci u16 vfp_count; 428c2ecf20Sopenharmony_ci}; 438c2ecf20Sopenharmony_ci 448c2ecf20Sopenharmony_cistruct mdfld_dsi_dpi_output { 458c2ecf20Sopenharmony_ci struct mdfld_dsi_encoder base; 468c2ecf20Sopenharmony_ci struct drm_device *dev; 478c2ecf20Sopenharmony_ci 488c2ecf20Sopenharmony_ci int panel_on; 498c2ecf20Sopenharmony_ci int first_boot; 508c2ecf20Sopenharmony_ci 518c2ecf20Sopenharmony_ci const struct panel_funcs *p_funcs; 528c2ecf20Sopenharmony_ci}; 538c2ecf20Sopenharmony_ci 548c2ecf20Sopenharmony_ci#define MDFLD_DSI_DPI_OUTPUT(dsi_encoder)\ 558c2ecf20Sopenharmony_ci container_of(dsi_encoder, struct mdfld_dsi_dpi_output, base) 568c2ecf20Sopenharmony_ci 578c2ecf20Sopenharmony_ci/* Export functions */ 588c2ecf20Sopenharmony_ciextern int mdfld_dsi_dpi_timing_calculation(struct drm_display_mode *mode, 598c2ecf20Sopenharmony_ci struct mdfld_dsi_dpi_timing *dpi_timing, 608c2ecf20Sopenharmony_ci int num_lane, int bpp); 618c2ecf20Sopenharmony_ciextern struct mdfld_dsi_encoder *mdfld_dsi_dpi_init(struct drm_device *dev, 628c2ecf20Sopenharmony_ci struct mdfld_dsi_connector *dsi_connector, 638c2ecf20Sopenharmony_ci const struct panel_funcs *p_funcs); 648c2ecf20Sopenharmony_ci 658c2ecf20Sopenharmony_ci/* MDFLD DPI helper functions */ 668c2ecf20Sopenharmony_ciextern void mdfld_dsi_dpi_dpms(struct drm_encoder *encoder, int mode); 678c2ecf20Sopenharmony_ciextern bool mdfld_dsi_dpi_mode_fixup(struct drm_encoder *encoder, 688c2ecf20Sopenharmony_ci const struct drm_display_mode *mode, 698c2ecf20Sopenharmony_ci struct drm_display_mode *adjusted_mode); 708c2ecf20Sopenharmony_ciextern void mdfld_dsi_dpi_prepare(struct drm_encoder *encoder); 718c2ecf20Sopenharmony_ciextern void mdfld_dsi_dpi_commit(struct drm_encoder *encoder); 728c2ecf20Sopenharmony_ciextern void mdfld_dsi_dpi_mode_set(struct drm_encoder *encoder, 738c2ecf20Sopenharmony_ci struct drm_display_mode *mode, 748c2ecf20Sopenharmony_ci struct drm_display_mode *adjusted_mode); 758c2ecf20Sopenharmony_ciextern void mdfld_dsi_dpi_turn_on(struct mdfld_dsi_dpi_output *output, 768c2ecf20Sopenharmony_ci int pipe); 778c2ecf20Sopenharmony_ciextern void mdfld_dsi_dpi_controller_init(struct mdfld_dsi_config *dsi_config, 788c2ecf20Sopenharmony_ci int pipe); 798c2ecf20Sopenharmony_ci#endif /*__MDFLD_DSI_DPI_H__*/ 80