@@ -1827,94 +1827,56 @@ static const struct mipi_dsi_host_ops gen11_dsi_host_ops = {
18271827 .transfer = gen11_dsi_host_transfer ,
18281828};
18291829
1830- #define ICL_PREPARE_CNT_MAX 0x7
1831- #define ICL_CLK_ZERO_CNT_MAX 0xf
1832- #define ICL_TRAIL_CNT_MAX 0x7
1833- #define ICL_TCLK_PRE_CNT_MAX 0x3
1834- #define ICL_TCLK_POST_CNT_MAX 0x7
1835- #define ICL_HS_ZERO_CNT_MAX 0xf
1836- #define ICL_EXIT_ZERO_CNT_MAX 0x7
1837-
18381830static void icl_dphy_param_init (struct intel_dsi * intel_dsi )
18391831{
1840- struct intel_display * display = to_intel_display (& intel_dsi -> base );
18411832 struct intel_connector * connector = intel_dsi -> attached_connector ;
18421833 struct mipi_config * mipi_config = connector -> panel .vbt .dsi .config ;
18431834 u32 tlpx_ns ;
1844- u32 prepare_cnt , exit_zero_cnt , clk_zero_cnt ;
1845- u32 ths_prepare_esc_clk ;
1846- u32 hs_zero_cnt ;
1847- u32 tclk_pre_cnt ;
1835+ u32 tclk_prepare_esc_clk , tclk_zero_esc_clk , tclk_pre_esc_clk ;
1836+ u32 ths_prepare_esc_clk , ths_zero_esc_clk , ths_exit_esc_clk ;
18481837
18491838 tlpx_ns = intel_dsi_tlpx_ns (intel_dsi );
18501839
18511840 /*
1852- * prepare cnt in escape clocks
1853- * this field represents a hexadecimal value with a precision
1854- * of 1.2 – i.e. the most significant bit is the integer
1855- * and the least significant 2 bits are fraction bits.
1856- * so, the field can represent a range of 0.25 to 1.75
1841+ * The clock and data lane prepare timing parameters are in expressed in
1842+ * units of 1/4 escape clocks, and all the other timings parameters in
1843+ * escape clocks.
18571844 */
1858- prepare_cnt = DIV_ROUND_UP (mipi_config -> tclk_prepare * 4 , tlpx_ns );
1859- if (prepare_cnt > ICL_PREPARE_CNT_MAX ) {
1860- drm_dbg_kms (display -> drm , "prepare_cnt out of range (%d)\n" ,
1861- prepare_cnt );
1862- prepare_cnt = ICL_PREPARE_CNT_MAX ;
1863- }
1845+ tclk_prepare_esc_clk = DIV_ROUND_UP (mipi_config -> tclk_prepare * 4 , tlpx_ns );
1846+ tclk_prepare_esc_clk = min (tclk_prepare_esc_clk , 7 );
18641847
1865- /* clk zero count in escape clocks */
1866- clk_zero_cnt = DIV_ROUND_UP (mipi_config -> tclk_prepare_clkzero -
1867- mipi_config -> tclk_prepare , tlpx_ns );
1868- if (clk_zero_cnt > ICL_CLK_ZERO_CNT_MAX ) {
1869- drm_dbg_kms (display -> drm ,
1870- "clk_zero_cnt out of range (%d)\n" , clk_zero_cnt );
1871- clk_zero_cnt = ICL_CLK_ZERO_CNT_MAX ;
1872- }
1848+ tclk_zero_esc_clk = DIV_ROUND_UP (mipi_config -> tclk_prepare_clkzero -
1849+ mipi_config -> tclk_prepare , tlpx_ns );
1850+ tclk_zero_esc_clk = min (tclk_zero_esc_clk , 15 );
18731851
1874- /* tclk pre count in escape clocks */
1875- tclk_pre_cnt = DIV_ROUND_UP (mipi_config -> tclk_pre , tlpx_ns );
1876- if (tclk_pre_cnt > ICL_TCLK_PRE_CNT_MAX ) {
1877- drm_dbg_kms (display -> drm ,
1878- "tclk_pre_cnt out of range (%d)\n" , tclk_pre_cnt );
1879- tclk_pre_cnt = ICL_TCLK_PRE_CNT_MAX ;
1880- }
1852+ tclk_pre_esc_clk = DIV_ROUND_UP (mipi_config -> tclk_pre , tlpx_ns );
1853+ tclk_pre_esc_clk = min (tclk_pre_esc_clk , 3 );
18811854
18821855 ths_prepare_esc_clk = DIV_ROUND_UP (mipi_config -> ths_prepare * 4 , tlpx_ns );
18831856 ths_prepare_esc_clk = min (ths_prepare_esc_clk , 7 );
18841857
1885- /* hs zero cnt in escape clocks */
1886- hs_zero_cnt = DIV_ROUND_UP (mipi_config -> ths_prepare_hszero -
1887- mipi_config -> ths_prepare , tlpx_ns );
1888- if (hs_zero_cnt > ICL_HS_ZERO_CNT_MAX ) {
1889- drm_dbg_kms (display -> drm , "hs_zero_cnt out of range (%d)\n" ,
1890- hs_zero_cnt );
1891- hs_zero_cnt = ICL_HS_ZERO_CNT_MAX ;
1892- }
1858+ ths_zero_esc_clk = DIV_ROUND_UP (mipi_config -> ths_prepare_hszero -
1859+ mipi_config -> ths_prepare , tlpx_ns );
1860+ ths_zero_esc_clk = min (ths_zero_esc_clk , 15 );
18931861
1894- /* hs exit zero cnt in escape clocks */
1895- exit_zero_cnt = DIV_ROUND_UP (mipi_config -> ths_exit , tlpx_ns );
1896- if (exit_zero_cnt > ICL_EXIT_ZERO_CNT_MAX ) {
1897- drm_dbg_kms (display -> drm ,
1898- "exit_zero_cnt out of range (%d)\n" ,
1899- exit_zero_cnt );
1900- exit_zero_cnt = ICL_EXIT_ZERO_CNT_MAX ;
1901- }
1862+ ths_exit_esc_clk = DIV_ROUND_UP (mipi_config -> ths_exit , tlpx_ns );
1863+ ths_exit_esc_clk = min (ths_exit_esc_clk , 7 );
19021864
19031865 /* clock lane dphy timings */
19041866 intel_dsi -> dphy_reg = (CLK_PREPARE_OVERRIDE |
1905- CLK_PREPARE (prepare_cnt ) |
1867+ CLK_PREPARE (tclk_prepare_esc_clk ) |
19061868 CLK_ZERO_OVERRIDE |
1907- CLK_ZERO (clk_zero_cnt ) |
1869+ CLK_ZERO (tclk_zero_esc_clk ) |
19081870 CLK_PRE_OVERRIDE |
1909- CLK_PRE (tclk_pre_cnt ));
1871+ CLK_PRE (tclk_pre_esc_clk ));
19101872
19111873 /* data lanes dphy timings */
19121874 intel_dsi -> dphy_data_lane_reg = (HS_PREPARE_OVERRIDE |
19131875 HS_PREPARE (ths_prepare_esc_clk ) |
19141876 HS_ZERO_OVERRIDE |
1915- HS_ZERO (hs_zero_cnt ) |
1877+ HS_ZERO (ths_zero_esc_clk ) |
19161878 HS_EXIT_OVERRIDE |
1917- HS_EXIT (exit_zero_cnt ));
1879+ HS_EXIT (ths_exit_esc_clk ));
19181880
19191881 intel_dsi_log_params (intel_dsi );
19201882}
0 commit comments