@@ -3049,49 +3049,26 @@ static int icl_ddi_combo_pll_get_freq(struct drm_i915_private *i915,
3049
3049
icl_wrpll_ref_clock (i915 ));
3050
3050
}
3051
3051
3052
- static bool icl_calc_dpll_state (struct intel_crtc_state * crtc_state ,
3053
- struct intel_encoder * encoder ,
3052
+ static void icl_calc_dpll_state (struct drm_i915_private * i915 ,
3053
+ const struct skl_wrpll_params * pll_params ,
3054
3054
struct intel_dpll_hw_state * pll_state )
3055
3055
{
3056
- struct drm_i915_private * dev_priv = to_i915 (crtc_state -> uapi .crtc -> dev );
3057
- u32 cfgcr0 , cfgcr1 ;
3058
- struct skl_wrpll_params pll_params = { 0 };
3059
- bool ret ;
3060
-
3061
- if (intel_phy_is_tc (dev_priv , intel_port_to_phy (dev_priv ,
3062
- encoder -> port )))
3063
- ret = icl_calc_tbt_pll (crtc_state , & pll_params );
3064
- else if (intel_crtc_has_type (crtc_state , INTEL_OUTPUT_HDMI ) ||
3065
- intel_crtc_has_type (crtc_state , INTEL_OUTPUT_DSI ))
3066
- ret = icl_calc_wrpll (crtc_state , & pll_params );
3067
- else
3068
- ret = icl_calc_dp_combo_pll (crtc_state , & pll_params );
3069
-
3070
- if (!ret )
3071
- return false;
3056
+ memset (pll_state , 0 , sizeof (* pll_state ));
3072
3057
3073
- cfgcr0 = DPLL_CFGCR0_DCO_FRACTION (pll_params . dco_fraction ) |
3074
- pll_params . dco_integer ;
3058
+ pll_state -> cfgcr0 = DPLL_CFGCR0_DCO_FRACTION (pll_params -> dco_fraction ) |
3059
+ pll_params -> dco_integer ;
3075
3060
3076
- cfgcr1 = DPLL_CFGCR1_QDIV_RATIO (pll_params . qdiv_ratio ) |
3077
- DPLL_CFGCR1_QDIV_MODE (pll_params . qdiv_mode ) |
3078
- DPLL_CFGCR1_KDIV (pll_params . kdiv ) |
3079
- DPLL_CFGCR1_PDIV (pll_params . pdiv );
3061
+ pll_state -> cfgcr1 = DPLL_CFGCR1_QDIV_RATIO (pll_params -> qdiv_ratio ) |
3062
+ DPLL_CFGCR1_QDIV_MODE (pll_params -> qdiv_mode ) |
3063
+ DPLL_CFGCR1_KDIV (pll_params -> kdiv ) |
3064
+ DPLL_CFGCR1_PDIV (pll_params -> pdiv );
3080
3065
3081
- if (INTEL_GEN (dev_priv ) >= 12 )
3082
- cfgcr1 |= TGL_DPLL_CFGCR1_CFSELOVRD_NORMAL_XTAL ;
3066
+ if (INTEL_GEN (i915 ) >= 12 )
3067
+ pll_state -> cfgcr1 |= TGL_DPLL_CFGCR1_CFSELOVRD_NORMAL_XTAL ;
3083
3068
else
3084
- cfgcr1 |= DPLL_CFGCR1_CENTRAL_FREQ_8400 ;
3085
-
3086
- memset (pll_state , 0 , sizeof (* pll_state ));
3087
-
3088
- pll_state -> cfgcr0 = cfgcr0 ;
3089
- pll_state -> cfgcr1 = cfgcr1 ;
3090
-
3091
- return true;
3069
+ pll_state -> cfgcr1 |= DPLL_CFGCR1_CENTRAL_FREQ_8400 ;
3092
3070
}
3093
3071
3094
-
3095
3072
static enum tc_port icl_pll_id_to_tc_port (enum intel_dpll_id id )
3096
3073
{
3097
3074
return id - DPLL_ID_ICL_MGPLL1 ;
@@ -3504,19 +3481,29 @@ static bool icl_get_combo_phy_dpll(struct intel_atomic_state *state,
3504
3481
{
3505
3482
struct intel_crtc_state * crtc_state =
3506
3483
intel_atomic_get_new_crtc_state (state , crtc );
3484
+ struct skl_wrpll_params pll_params = { };
3507
3485
struct icl_port_dpll * port_dpll =
3508
3486
& crtc_state -> icl_port_dplls [ICL_PORT_DPLL_DEFAULT ];
3509
3487
struct drm_i915_private * dev_priv = to_i915 (crtc -> base .dev );
3510
3488
enum port port = encoder -> port ;
3511
3489
unsigned long dpll_mask ;
3490
+ int ret ;
3512
3491
3513
- if (!icl_calc_dpll_state (crtc_state , encoder , & port_dpll -> hw_state )) {
3492
+ if (intel_crtc_has_type (crtc_state , INTEL_OUTPUT_HDMI ) ||
3493
+ intel_crtc_has_type (crtc_state , INTEL_OUTPUT_DSI ))
3494
+ ret = icl_calc_wrpll (crtc_state , & pll_params );
3495
+ else
3496
+ ret = icl_calc_dp_combo_pll (crtc_state , & pll_params );
3497
+
3498
+ if (!ret ) {
3514
3499
drm_dbg_kms (& dev_priv -> drm ,
3515
3500
"Could not calculate combo PHY PLL state.\n" );
3516
3501
3517
3502
return false;
3518
3503
}
3519
3504
3505
+ icl_calc_dpll_state (dev_priv , & pll_params , & port_dpll -> hw_state );
3506
+
3520
3507
if (IS_ELKHARTLAKE (dev_priv ) && port != PORT_A )
3521
3508
dpll_mask =
3522
3509
BIT (DPLL_ID_EHL_DPLL4 ) |
@@ -3550,16 +3537,19 @@ static bool icl_get_tc_phy_dplls(struct intel_atomic_state *state,
3550
3537
struct drm_i915_private * dev_priv = to_i915 (state -> base .dev );
3551
3538
struct intel_crtc_state * crtc_state =
3552
3539
intel_atomic_get_new_crtc_state (state , crtc );
3540
+ struct skl_wrpll_params pll_params = { };
3553
3541
struct icl_port_dpll * port_dpll ;
3554
3542
enum intel_dpll_id dpll_id ;
3555
3543
3556
3544
port_dpll = & crtc_state -> icl_port_dplls [ICL_PORT_DPLL_DEFAULT ];
3557
- if (!icl_calc_dpll_state (crtc_state , encoder , & port_dpll -> hw_state )) {
3545
+ if (!icl_calc_tbt_pll (crtc_state , & pll_params )) {
3558
3546
drm_dbg_kms (& dev_priv -> drm ,
3559
3547
"Could not calculate TBT PLL state.\n" );
3560
3548
return false;
3561
3549
}
3562
3550
3551
+ icl_calc_dpll_state (dev_priv , & pll_params , & port_dpll -> hw_state );
3552
+
3563
3553
port_dpll -> pll = intel_find_shared_dpll (state , crtc ,
3564
3554
& port_dpll -> hw_state ,
3565
3555
BIT (DPLL_ID_ICL_TBTPLL ));
0 commit comments