177b55e8cSThomas Abraham /* 277b55e8cSThomas Abraham * Copyright (C) 2012 Samsung Electronics 377b55e8cSThomas Abraham * 477b55e8cSThomas Abraham * Author: Donghwa Lee <dh09.lee@samsung.com> 577b55e8cSThomas Abraham * 677b55e8cSThomas Abraham * SPDX-License-Identifier: GPL-2.0+ 777b55e8cSThomas Abraham */ 877b55e8cSThomas Abraham 977b55e8cSThomas Abraham #ifndef _DP_INFO_H 1077b55e8cSThomas Abraham #define _DP_INFO_H 1177b55e8cSThomas Abraham 1277b55e8cSThomas Abraham #define msleep(a) udelay(a * 1000) 1377b55e8cSThomas Abraham 1477b55e8cSThomas Abraham #define DP_TIMEOUT_LOOP_COUNT 100 1577b55e8cSThomas Abraham #define MAX_CR_LOOP 5 1677b55e8cSThomas Abraham #define MAX_EQ_LOOP 4 1777b55e8cSThomas Abraham 1877b55e8cSThomas Abraham #define EXYNOS_DP_SUCCESS 0 1977b55e8cSThomas Abraham 2077b55e8cSThomas Abraham enum { 2177b55e8cSThomas Abraham DP_DISABLE, 2277b55e8cSThomas Abraham DP_ENABLE, 2377b55e8cSThomas Abraham }; 2477b55e8cSThomas Abraham 2577b55e8cSThomas Abraham struct edp_disp_info { 2677b55e8cSThomas Abraham char *name; 2777b55e8cSThomas Abraham unsigned int h_total; 2877b55e8cSThomas Abraham unsigned int h_res; 2977b55e8cSThomas Abraham unsigned int h_sync_width; 3077b55e8cSThomas Abraham unsigned int h_back_porch; 3177b55e8cSThomas Abraham unsigned int h_front_porch; 3277b55e8cSThomas Abraham unsigned int v_total; 3377b55e8cSThomas Abraham unsigned int v_res; 3477b55e8cSThomas Abraham unsigned int v_sync_width; 3577b55e8cSThomas Abraham unsigned int v_back_porch; 3677b55e8cSThomas Abraham unsigned int v_front_porch; 3777b55e8cSThomas Abraham 3877b55e8cSThomas Abraham unsigned int v_sync_rate; 3977b55e8cSThomas Abraham }; 4077b55e8cSThomas Abraham 4177b55e8cSThomas Abraham struct edp_link_train_info { 4277b55e8cSThomas Abraham unsigned int lt_status; 4377b55e8cSThomas Abraham 4477b55e8cSThomas Abraham unsigned int ep_loop; 4577b55e8cSThomas Abraham unsigned int cr_loop[4]; 4677b55e8cSThomas Abraham 4777b55e8cSThomas Abraham }; 4877b55e8cSThomas Abraham 4977b55e8cSThomas Abraham struct edp_video_info { 5077b55e8cSThomas Abraham unsigned int master_mode; 5177b55e8cSThomas Abraham unsigned int bist_mode; 5277b55e8cSThomas Abraham unsigned int bist_pattern; 5377b55e8cSThomas Abraham 5477b55e8cSThomas Abraham unsigned int h_sync_polarity; 5577b55e8cSThomas Abraham unsigned int v_sync_polarity; 5677b55e8cSThomas Abraham unsigned int interlaced; 5777b55e8cSThomas Abraham 5877b55e8cSThomas Abraham unsigned int color_space; 5977b55e8cSThomas Abraham unsigned int dynamic_range; 6077b55e8cSThomas Abraham unsigned int ycbcr_coeff; 6177b55e8cSThomas Abraham unsigned int color_depth; 6277b55e8cSThomas Abraham }; 6377b55e8cSThomas Abraham 6421f8f9bbSSimon Glass struct exynos_dp_priv { 6577b55e8cSThomas Abraham struct edp_disp_info disp_info; 6677b55e8cSThomas Abraham struct edp_link_train_info lt_info; 6777b55e8cSThomas Abraham struct edp_video_info video_info; 6877b55e8cSThomas Abraham 6977b55e8cSThomas Abraham /*below info get from panel during training*/ 7077b55e8cSThomas Abraham unsigned char lane_bw; 7177b55e8cSThomas Abraham unsigned char lane_cnt; 7277b55e8cSThomas Abraham unsigned char dpcd_rev; 7377b55e8cSThomas Abraham /*support enhanced frame cap */ 7477b55e8cSThomas Abraham unsigned char dpcd_efc; 75*bb5930d5SSimon Glass struct exynos_dp *regs; 7677b55e8cSThomas Abraham }; 7777b55e8cSThomas Abraham 7877b55e8cSThomas Abraham enum analog_power_block { 7977b55e8cSThomas Abraham AUX_BLOCK, 8077b55e8cSThomas Abraham CH0_BLOCK, 8177b55e8cSThomas Abraham CH1_BLOCK, 8277b55e8cSThomas Abraham CH2_BLOCK, 8377b55e8cSThomas Abraham CH3_BLOCK, 8477b55e8cSThomas Abraham ANALOG_TOTAL, 8577b55e8cSThomas Abraham POWER_ALL 8677b55e8cSThomas Abraham }; 8777b55e8cSThomas Abraham 8877b55e8cSThomas Abraham enum pll_status { 8977b55e8cSThomas Abraham PLL_UNLOCKED = 0, 9077b55e8cSThomas Abraham PLL_LOCKED 9177b55e8cSThomas Abraham }; 9277b55e8cSThomas Abraham 9377b55e8cSThomas Abraham enum { 9477b55e8cSThomas Abraham COLOR_RGB, 9577b55e8cSThomas Abraham COLOR_YCBCR422, 9677b55e8cSThomas Abraham COLOR_YCBCR444 9777b55e8cSThomas Abraham }; 9877b55e8cSThomas Abraham 9977b55e8cSThomas Abraham enum { 10077b55e8cSThomas Abraham VESA, 10177b55e8cSThomas Abraham CEA 10277b55e8cSThomas Abraham }; 10377b55e8cSThomas Abraham 10477b55e8cSThomas Abraham enum { 10577b55e8cSThomas Abraham COLOR_YCBCR601, 10677b55e8cSThomas Abraham COLOR_YCBCR709 10777b55e8cSThomas Abraham }; 10877b55e8cSThomas Abraham 10977b55e8cSThomas Abraham enum { 11077b55e8cSThomas Abraham COLOR_6, 11177b55e8cSThomas Abraham COLOR_8, 11277b55e8cSThomas Abraham COLOR_10, 11377b55e8cSThomas Abraham COLOR_12 11477b55e8cSThomas Abraham }; 11577b55e8cSThomas Abraham 11677b55e8cSThomas Abraham enum { 11777b55e8cSThomas Abraham DP_LANE_BW_1_62 = 0x06, 11877b55e8cSThomas Abraham DP_LANE_BW_2_70 = 0x0a, 11977b55e8cSThomas Abraham }; 12077b55e8cSThomas Abraham 12177b55e8cSThomas Abraham enum { 12277b55e8cSThomas Abraham DP_LANE_CNT_1 = 1, 12377b55e8cSThomas Abraham DP_LANE_CNT_2 = 2, 12477b55e8cSThomas Abraham DP_LANE_CNT_4 = 4, 12577b55e8cSThomas Abraham }; 12677b55e8cSThomas Abraham 12777b55e8cSThomas Abraham enum { 12877b55e8cSThomas Abraham DP_DPCD_REV_10 = 0x10, 12977b55e8cSThomas Abraham DP_DPCD_REV_11 = 0x11, 13077b55e8cSThomas Abraham }; 13177b55e8cSThomas Abraham 13277b55e8cSThomas Abraham enum { 13377b55e8cSThomas Abraham DP_LT_NONE, 13477b55e8cSThomas Abraham DP_LT_START, 13577b55e8cSThomas Abraham DP_LT_CR, 13677b55e8cSThomas Abraham DP_LT_ET, 13777b55e8cSThomas Abraham DP_LT_FINISHED, 13877b55e8cSThomas Abraham DP_LT_FAIL, 13977b55e8cSThomas Abraham }; 14077b55e8cSThomas Abraham 14177b55e8cSThomas Abraham enum { 14277b55e8cSThomas Abraham PRE_EMPHASIS_LEVEL_0, 14377b55e8cSThomas Abraham PRE_EMPHASIS_LEVEL_1, 14477b55e8cSThomas Abraham PRE_EMPHASIS_LEVEL_2, 14577b55e8cSThomas Abraham PRE_EMPHASIS_LEVEL_3, 14677b55e8cSThomas Abraham }; 14777b55e8cSThomas Abraham 14877b55e8cSThomas Abraham enum { 14977b55e8cSThomas Abraham PRBS7, 15077b55e8cSThomas Abraham D10_2, 15177b55e8cSThomas Abraham TRAINING_PTN1, 15277b55e8cSThomas Abraham TRAINING_PTN2, 15377b55e8cSThomas Abraham DP_NONE 15477b55e8cSThomas Abraham }; 15577b55e8cSThomas Abraham 15677b55e8cSThomas Abraham enum { 15777b55e8cSThomas Abraham VOLTAGE_LEVEL_0, 15877b55e8cSThomas Abraham VOLTAGE_LEVEL_1, 15977b55e8cSThomas Abraham VOLTAGE_LEVEL_2, 16077b55e8cSThomas Abraham VOLTAGE_LEVEL_3, 16177b55e8cSThomas Abraham }; 16277b55e8cSThomas Abraham 16377b55e8cSThomas Abraham enum pattern_type { 16477b55e8cSThomas Abraham NO_PATTERN, 16577b55e8cSThomas Abraham COLOR_RAMP, 16677b55e8cSThomas Abraham BALCK_WHITE_V_LINES, 16777b55e8cSThomas Abraham COLOR_SQUARE, 16877b55e8cSThomas Abraham INVALID_PATTERN, 16977b55e8cSThomas Abraham COLORBAR_32, 17077b55e8cSThomas Abraham COLORBAR_64, 17177b55e8cSThomas Abraham WHITE_GRAY_BALCKBAR_32, 17277b55e8cSThomas Abraham WHITE_GRAY_BALCKBAR_64, 17377b55e8cSThomas Abraham MOBILE_WHITEBAR_32, 17477b55e8cSThomas Abraham MOBILE_WHITEBAR_64 17577b55e8cSThomas Abraham }; 17677b55e8cSThomas Abraham 17777b55e8cSThomas Abraham enum { 17877b55e8cSThomas Abraham CALCULATED_M, 17977b55e8cSThomas Abraham REGISTER_M 18077b55e8cSThomas Abraham }; 18177b55e8cSThomas Abraham 18277b55e8cSThomas Abraham enum { 18377b55e8cSThomas Abraham VIDEO_TIMING_FROM_CAPTURE, 18477b55e8cSThomas Abraham VIDEO_TIMING_FROM_REGISTER 18577b55e8cSThomas Abraham }; 18677b55e8cSThomas Abraham 18777b55e8cSThomas Abraham 18877b55e8cSThomas Abraham struct exynos_dp_platform_data { 18921f8f9bbSSimon Glass struct exynos_dp_priv *edp_dev_info; 19077b55e8cSThomas Abraham }; 19177b55e8cSThomas Abraham 19277b55e8cSThomas Abraham #ifdef CONFIG_EXYNOS_DP 19377b55e8cSThomas Abraham unsigned int exynos_init_dp(void); 19477b55e8cSThomas Abraham #else 19577b55e8cSThomas Abraham unsigned int exynos_init_dp(void) 19677b55e8cSThomas Abraham { 19777b55e8cSThomas Abraham return 0; 19877b55e8cSThomas Abraham } 19977b55e8cSThomas Abraham #endif 20077b55e8cSThomas Abraham 20177b55e8cSThomas Abraham #endif /* _DP_INFO_H */ 202