drm/i915/cnl: Implement .get_display_clock_speed() for CNL
Subsystems (2)
Rodrigo Vivi
maintainerPATCH 1/17 drm/i915/cnl: Implement .get_display_clock_speed() for CNL
From: Ville Syrjälä <[email protected]>
Add support for reading out the cdclk frequency from the hardware on CNL. Very similar to BXT, with a few new twists and turns:
* the PLL is now called CDCLK PLL, not DE PLL
* reference clock can be 24 MHz in addition to the 19.2 MHz BXT had
* the ratio now lives in the PLL enable register
* Only 1x and 2x CD2X dividers are supported
v2: Deal with PLL lock bit the same way as BXT/SKL do now
v3: DSSM refclk indicator is bit 31 not 24 (Ander)
v4: Rebased by Rodrigo after Ville's cdclk rework.
v5: Set cdclk to the ref clock as previous platforms. (Imre)
--- drivers/gpu/drm/i915/i915_reg.h | 5 ++++ drivers/gpu/drm/i915/intel_cdclk.c | 56 +++++++++++++++++++++++++++++++++++++- 2 files changed, 60 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_reg.h +5 -0
@@ -6550,6 +6550,9 @@ enum {#define SKL_DFSM_PIPE_B_DISABLE (1 << 21)#define SKL_DFSM_PIPE_C_DISABLE (1 << 28) +#define SKL_DSSM _MMIO(0x51004) +#define CNL_DSSM_CDCLK_PLL_REFCLK_24MHz (1 << 31) +#define GEN7_FF_SLICE_CS_CHICKEN1 _MMIO(0x20e0)#define GEN9_FFSC_PERCTX_PREEMPT_CTRL (1<<14)
@@ -8116,6 +8119,8 @@ enum {#define BXT_DE_PLL_ENABLE _MMIO(0x46070)#define BXT_DE_PLL_PLL_ENABLE (1 << 31)#define BXT_DE_PLL_LOCK (1 << 30) +#define CNL_CDCLK_PLL_RATIO (x) (x) +#define CNL_CDCLK_PLL_RATIO_MASK 0xff/* GEN9 DC */ #define DC_STATE_EN _MMIO(0x45504)
drivers/gpu/drm/i915/intel_cdclk.c +55 -1
68 lines not on this page · raw message
Signature · 6 lines
1.9.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Rodrigo Vivi
maintainerPATCH 2/17 drm/i915/cnl: Implement .set_cdclk() for CNL
From: Ville Syrjälä <[email protected]>
Add support for changing the cdclk frequency on CNL. Again, quite similar to BXT, but there are some annoying differences which means trying to share more code might not be feasible:
* PLL ratio now lives in the PLL enable register
* pcode came from SKL, not from BXT
We support three cdclk frequencies: 168,336,528 Mhz. The first two use the same PLL frequency, the last one uses a different one meaning we once again may need to toggle the PLL off and on when changing cdclk.
v2: Rebased by Rodrigo on top of Ville's cdclk rework.
v3: Respect order of set_ bellow get_ (Ville)
v4: Added __attribute__((unused)) to avoid broken compilation with Werror.
--- drivers/gpu/drm/i915/intel_cdclk.c | 106 +++++++++++++++++++++++++++++++++++++ 1 file changed, 106 insertions(+)
drivers/gpu/drm/i915/intel_cdclk.c +106 -0
@@ -1452,6 +1452,112 @@ static void cnl_get_cdclk(struct drm_i915_private *dev_priv, cdclk_state->cdclk =DIV_ROUND_CLOSEST (cdclk_state->vco, div); } +static void cnl_cdclk_pll_disable (struct drm_i915_private *dev_priv) +{ +u32 val; + + val =I915_READ (BXT_DE_PLL_ENABLE ); + val &= ~BXT_DE_PLL_PLL_ENABLE ; +I915_WRITE (BXT_DE_PLL_ENABLE , val); + +/* Timeout 200us */ +if (wait_for ((I915_READ (BXT_DE_PLL_ENABLE ) &BXT_DE_PLL_LOCK ) ==0 ,1 )) +DRM_ERROR ("timout waiting for CDCLK PLL unlock\n" ); + + dev_priv->cdclk.hw.vco =0 ; +} + +static void cnl_cdclk_pll_enable (struct drm_i915_private *dev_priv,int vco) +{ +int ratio =DIV_ROUND_CLOSEST (vco, dev_priv->cdclk.hw.ref); +u32 val; + + val =CNL_CDCLK_PLL_RATIO (ratio); +I915_WRITE (BXT_DE_PLL_ENABLE , val); + + val |=BXT_DE_PLL_PLL_ENABLE ; +I915_WRITE (BXT_DE_PLL_ENABLE , val); + +/* Timeout 200us */ +if (wait_for ((I915_READ (BXT_DE_PLL_ENABLE ) &BXT_DE_PLL_LOCK ) !=0 ,1 )) +DRM_ERROR ("timout waiting for CDCLK PLL lock\n" ); + + dev_priv->cdclk.hw.vco = vco; +} + +__attribute__((unused)) +static void cnl_set_cdclk (struct drm_i915_private *dev_priv, +const struct intel_cdclk_state *cdclk_state) +{ +int cdclk = cdclk_state->cdclk; +int vco = cdclk_state->vco; +u32 val, divider, pcu_ack; +int ret; + +mutex_lock (&dev_priv->rps.hw_lock); + ret =skl_pcode_request (dev_priv,SKL_PCODE_CDCLK_CONTROL , +SKL_CDCLK_PREPARE_FOR_CHANGE , +SKL_CDCLK_READY_FOR_CHANGE , +SKL_CDCLK_READY_FOR_CHANGE ,3 ); +mutex_unlock (&dev_priv->rps.hw_lock); +if (ret) { +DRM_ERROR ("Failed to inform PCU about cdclk change (%d)\n" , + ret); +return ; + } + +/* cdclk = vco / 2 / div{1,2} */ +switch (DIV_ROUND_CLOSEST (vco, cdclk)) { +case 4 : + divider =BXT_CDCLK_CD2X_DIV_SEL_2 ; +break ; +case 2 : + divider =BXT_CDCLK_CD2X_DIV_SEL_1 ; +break ; +default : +WARN_ON (cdclk != dev_priv->cdclk.hw.ref); +WARN_ON (vco !=0 ); + + divider =BXT_CDCLK_CD2X_DIV_SEL_1 ; +break ; + } + +switch (cdclk) { +case 528000 : + pcu_ack =2 ; +break ; +case 336000 : + pcu_ack =1 ; +break ; +case 168000 : +default : + pcu_ack =0 ; +break ; + } + +if (dev_priv->cdclk.hw.vco !=0 && + dev_priv->cdclk.hw.vco != vco) +cnl_cdclk_pll_disable (dev_priv); + +if (dev_priv->cdclk.hw.vco != vco) +cnl_cdclk_pll_enable (dev_priv, vco); + + val = divider |skl_cdclk_decimal (cdclk); +/* +* FIXME if only the cd2x divider needs changing, it could be done +* without shutting off the pipe (if only one pipe is active). +*/ + val |=BXT_CDCLK_CD2X_PIPE_NONE ; +I915_WRITE (CDCLK_CTL , val); + +/* inform PCU of the change */ +mutex_lock (&dev_priv->rps.hw_lock); +sandybridge_pcode_write (dev_priv,SKL_PCODE_CDCLK_CONTROL , pcu_ack); +mutex_unlock (&dev_priv->rps.hw_lock); + +intel_update_cdclk (dev_priv); +} +/** * intel_cdclk_state_compare - Determine if two CDCLK states differ * @a: first CDCLK state
Signature · 6 lines
1.9.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Rodrigo Vivi
maintainerPATCH 3/17 drm/i915/cnl: Implement CNL display init/unit sequence
In reply to Rodrigo ViviFrom: Ville Syrjälä <[email protected]>
Implement the CNL display init/uninit sequence as outlined in Bspec.
Quite similar to SKL/BXT. The main complicaiton is probably the extra procmon setup we must do based on the process/voltage information we can read out from some register.
v2: s/skl_dbuf/gen9_dbuf/ to follow upstream
bxt needed a cdclk sanitize step, so let's add it for cnl too
v3: s/CHICKEN_MISC_1/CHICKEN_MISC_2/ (Ander)
v4: Rebased by Rodrigo after Ville's cdclk rework
v5: Removed unecessary Aux IO forced enable/disable, Fix DW10 setup
Fix procpon Mask. (Credits-to Paulo and Clint) Remove A0 workaround.
v6: Rebased on top of recent code (Rodrigo).
v7: Respect the order of sanitize_ after set_
(Done by Rodrigo, Requested by Ville)
v8: Commit message updated to matvh v5 changes besides
Remove unused DW8 and an extra blank line. (all noticed by Imre).
v9: Remove __attribute__((unused)) added on latest version
of drm/i915/cnl: Implement .set_cdclk() for CNL.
--- drivers/gpu/drm/i915/i915_reg.h | 23 +++++++ drivers/gpu/drm/i915/intel_cdclk.c | 108 +++++++++++++++++++++++++++++- drivers/gpu/drm/i915/intel_drv.h | 2 + drivers/gpu/drm/i915/intel_runtime_pm.c | 113 +++++++++++++++++++++++++++++++- 4 files changed, 243 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/i915_reg.h +23 -0
@@ -1661,6 +1661,9 @@ enum skl_disp_power_wells {#define PHY_RESERVED (1 << 7)#define BXT_PORT_CL1CM_DW0 (phy) _BXT_PHY((phy), _PORT_CL1CM_DW0_BC) +#define CNL_PORT_CL1CM_DW5 _MMIO(0x162014) +#define CL_POWER_DOWN_ENABLE (1 << 4) +#define _PORT_CL1CM_DW9_A 0x162024#define _PORT_CL1CM_DW9_BC 0x6C024#define IREF0RC_OFFSET_SHIFT 8
@@ -1693,6 +1696,23 @@ enum skl_disp_power_wells {#define BXT_PORT_CL2CM_DW6 (phy) _BXT_PHY((phy), _PORT_CL2CM_DW6_BC)#define DW6_OLDO_DYN_PWR_DOWN_EN (1 << 28) +#define CNL_PORT_COMP_DW0 _MMIO(0x162100) +#define COMP_INIT (1 << 31) +#define CNL_PORT_COMP_DW1 _MMIO(0x162104) +#define CNL_PORT_COMP_DW3 _MMIO(0x16210c) +#define PROCESS_INFO_DOT_0 (0 << 26) +#define PROCESS_INFO_DOT_1 (1 << 26) +#define PROCESS_INFO_DOT_4 (2 << 26) +#define PROCESS_INFO_MASK (7 << 26) +#define PROCESS_INFO_SHIFT 26 +#define VOLTAGE_INFO_0_85V (0 << 24) +#define VOLTAGE_INFO_0_95V (1 << 24) +#define VOLTAGE_INFO_1_05V (2 << 24) +#define VOLTAGE_INFO_MASK (3 << 24) +#define VOLTAGE_INFO_SHIFT 24 +#define CNL_PORT_COMP_DW9 _MMIO(0x162124) +#define CNL_PORT_COMP_DW10 _MMIO(0x162128) +/* BXT PHY Ref registers */ #define _PORT_REF_DW3_A 0x16218C#define _PORT_REF_DW3_BC 0x6C18C
@@ -6510,6 +6530,9 @@ enum {#define GLK_CL1_PWR_DOWN (1 << 11)#define GLK_CL2_PWR_DOWN (1 << 12) +#define CHICKEN_MISC_2 _MMIO(0x42084) +#define COMP_PWR_DOWN (1 << 23) +#define _CHICKEN_PIPESL_1_A 0x420b0#define _CHICKEN_PIPESL_1_B 0x420b4#define HSW_FBCQ_DIS (1 << 22)
drivers/gpu/drm/i915/intel_cdclk.c +107 -1
120 lines not on this page · raw message
drivers/gpu/drm/i915/intel_drv.h +2 -0
@@ -1309,6 +1309,8 @@ void intel_audio_codec_enable(struct intel_encoder *encoder,/* intel_cdclk.c */ void skl_init_cdclk (struct drm_i915_private *dev_priv);void skl_uninit_cdclk (struct drm_i915_private *dev_priv); +void cnl_init_cdclk (struct drm_i915_private *dev_priv); +void cnl_uninit_cdclk (struct drm_i915_private *dev_priv);void bxt_init_cdclk (struct drm_i915_private *dev_priv);void bxt_uninit_cdclk (struct drm_i915_private *dev_priv);void intel_init_cdclk_hooks (struct drm_i915_private *dev_priv);
drivers/gpu/drm/i915/intel_runtime_pm.c +111 -2
131 lines not on this page · raw message
Signature · 6 lines
1.9.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Rodrigo Vivi
maintainerPATCH 4/17 drm/i915/cnl: Allow dynamic cdclk changes on CNL
In reply to Rodrigo ViviAll the low level cdclk bits are present, so let's add the required hooks to reconfigure cdclk on the fly.
v2: Rebase due to cnl_sanitize_cdclk()
v3: Rebased by Rodrigo on top of Ville's cdclk rework.
v4: Rebase moving cnl_calc_cdclk up to follow same order
as previous platforms.
v2: Squash drm/i915/cnl: Adjust min pixel rate. to address
the current limitation where CDCLK cannot be set to 168MHz if audio is used with 96MHz. (Imre)
Cannonlake also needs to adjust the minimal pixel rate as gen9 platforms. Specially for the Azalia audio case.
--- drivers/gpu/drm/i915/intel_cdclk.c | 56 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 53 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/intel_cdclk.c +53 -3
@@ -1400,6 +1400,16 @@ void bxt_uninit_cdclk(struct drm_i915_private *dev_priv)bxt_set_cdclk (dev_priv, &cdclk_state); } +static int cnl_calc_cdclk (int max_pixclk) +{ +if (max_pixclk >336000 ) +return 528000 ; +else if (max_pixclk >168000 ) +return 336000 ; +else +return 168000 ; +} +static void cnl_cdclk_pll_update (struct drm_i915_private *dev_priv,struct intel_cdclk_state *cdclk_state) {
@@ -1641,7 +1651,7 @@ void cnl_init_cdclk(struct drm_i915_private *dev_priv) cdclk_state = dev_priv->cdclk.hw; - cdclk_state.cdclk =168000 ; + cdclk_state.cdclk =cnl_calc_cdclk (0 ); cdclk_state.vco =cnl_cdclk_pll_vco (dev_priv, cdclk_state.cdclk);cnl_set_cdclk (dev_priv, &cdclk_state);
@@ -1768,7 +1778,7 @@ static int intel_max_pixel_rate(struct drm_atomic_state *state) pixel_rate = crtc_state->pixel_rate; -if (IS_BROADWELL (dev_priv) ||IS_GEN9 (dev_priv)) +if (IS_BROADWELL (dev_priv) ||INTEL_GEN (dev_priv) >=9 ) pixel_rate =bdw_adjust_min_pipe_pixel_rate (crtc_state, pixel_rate);
@@ -1929,6 +1939,40 @@ static int bxt_modeset_calc_cdclk(struct drm_atomic_state *state)return 0 ; } +static int cnl_modeset_calc_cdclk (struct drm_atomic_state *state) +{ +struct drm_i915_private *dev_priv =to_i915 (state->dev); +struct intel_atomic_state *intel_state = +to_intel_atomic_state (state); +int max_pixclk =intel_max_pixel_rate (state); +int cdclk, vco; + + cdclk =cnl_calc_cdclk (max_pixclk); + vco =cnl_cdclk_pll_vco (dev_priv, cdclk); + +if (cdclk > dev_priv->max_cdclk_freq) { +DRM_DEBUG_KMS ("requested cdclk (%d kHz) exceeds max (%d kHz)\n" , + cdclk, dev_priv->max_cdclk_freq); +return -EINVAL ; + } + + intel_state->cdclk.logical.vco = vco; + intel_state->cdclk.logical.cdclk = cdclk; + +if (!intel_state->active_crtcs) { + cdclk =cnl_calc_cdclk (0 ); + vco =cnl_cdclk_pll_vco (dev_priv, cdclk); + + intel_state->cdclk.actual.vco = vco; + intel_state->cdclk.actual.cdclk = cdclk; + }else { + intel_state->cdclk.actual = + intel_state->cdclk.logical; + } + +return 0 ; +} +static int intel_compute_max_dotclk (struct drm_i915_private *dev_priv) {int max_cdclk_freq = dev_priv->max_cdclk_freq;
@@ -1960,7 +2004,9 @@ static int intel_compute_max_dotclk(struct drm_i915_private *dev_priv)*/ void intel_update_max_cdclk (struct drm_i915_private *dev_priv) { -if (IS_GEN9_BC (dev_priv)) { +if (IS_CANNONLAKE (dev_priv)) { + dev_priv->max_cdclk_freq =528000 ; + }else if (IS_GEN9_BC (dev_priv)) {u32 limit =I915_READ (SKL_DFSM ) &SKL_DFSM_CDCLK_LIMIT_MASK ;int max_cdclk, vco;
@@ -2157,6 +2203,10 @@ void intel_init_cdclk_hooks(struct drm_i915_private *dev_priv) dev_priv->display.set_cdclk = skl_set_cdclk; dev_priv->display.modeset_calc_cdclk = skl_modeset_calc_cdclk; + }else if (IS_CANNONLAKE (dev_priv)) { + dev_priv->display.set_cdclk = cnl_set_cdclk; + dev_priv->display.modeset_calc_cdclk = + cnl_modeset_calc_cdclk; }if (IS_CANNONLAKE (dev_priv))
Signature · 6 lines
1.9.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 04/17] drm/i915/cnl: Allow dynamic cdclk changes on CNL
Quoted 57 lines · Rodrigo Vivi
All the low level cdclk bits are present, so let's add the required hooks to reconfigure cdclk on the fly.
v2: Rebase due to
cnl_sanitize_cdclk()
v3: Rebased by Rodrigo on top of Ville's cdclk rework.
v4: Rebase movingcnl_calc_cdclkup to follow same order
as previous platforms.
v2: Squash drm/i915/cnl: Adjust min pixel rate. to address
the current limitation where CDCLK cannot be set to 168MHz if audio is used with 96MHz. (Imre)Cc Imre Deak <[email protected]>Cc Dhinakaran Pandiyan <[email protected]>Signed-off-by Ville Syrjälä <[email protected]>Signed-off-by Rodrigo Vivi <[email protected]>Cannonlake also needs to adjust the minimal pixel rate as gen9 platforms. Specially for the Azalia audio case.
Cc Dhinakaran Pandiyan <[email protected]>Cc Sanyog Kale <[email protected]>Signed-off-by Rodrigo Vivi <[email protected]>--- drivers/gpu/drm/i915/intel_cdclk.c | 56 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 53 insertions(+), 3 deletions(-)drivers/gpu/drm/i915/intel_cdclk.c +11
-1@@ -1400,6 +1400,16 @@ void bxt_uninit_cdclk(struct drm_i915_private *dev_priv)bxt_set_cdclk (dev_priv, &cdclk_state); } +static int cnl_calc_cdclk (int max_pixclk) +{ +if (max_pixclk >336000 ) +return 528000 ; +else if (max_pixclk >168000 ) +return 336000 ; +else +return 168000 ; +} +static void cnl_cdclk_pll_update (struct drm_i915_private *dev_priv,struct intel_cdclk_state *cdclk_state) {@@ -1641,7 +1651,7 @@ void cnl_init_cdclk(struct drm_i915_private *dev_priv) cdclk_state = dev_priv->cdclk.hw; - cdclk_state.cdclk =168000 ; + cdclk_state.cdclk =cnl_calc_cdclk (0 ); cdclk_state.vco =cnl_cdclk_pll_vco (dev_priv, cdclk_state.cdclk);cnl_set_cdclk (dev_priv, &cdclk_state);
drivers/gpu/drm/i915/intel_cdclk.c static int intel_max_pixel_rate(struct drm_atomic_state *state) · line 1781
Quoted 5 lines
drivers/gpu/drm/i915/intel_cdclk.c +1
-1@@ -1768,7 +1778,7 @@ static int intel_max_pixel_rate(struct drm_atomic_state *state) pixel_rate = crtc_state->pixel_rate; -if (IS_BROADWELL (dev_priv) ||IS_GEN9 (dev_priv)) +if (IS_BROADWELL (dev_priv) ||INTEL_GEN (dev_priv) >=9 )
We have to remember to check this on newer platforms, looks ok for now:
Quoted 69 lines
drivers/gpu/drm/i915/intel_cdclk.c +41
-1pixel_rate =bdw_adjust_min_pipe_pixel_rate (crtc_state, pixel_rate);@@ -1929,6 +1939,40 @@ static int bxt_modeset_calc_cdclk(struct drm_atomic_state *state)return 0 ; } +static int cnl_modeset_calc_cdclk (struct drm_atomic_state *state) +{ +struct drm_i915_private *dev_priv =to_i915 (state->dev); +struct intel_atomic_state *intel_state = +to_intel_atomic_state (state); +int max_pixclk =intel_max_pixel_rate (state); +int cdclk, vco; + + cdclk =cnl_calc_cdclk (max_pixclk); + vco =cnl_cdclk_pll_vco (dev_priv, cdclk); + +if (cdclk > dev_priv->max_cdclk_freq) { +DRM_DEBUG_KMS ("requested cdclk (%d kHz) exceeds max (%d kHz)\n" , + cdclk, dev_priv->max_cdclk_freq); +return -EINVAL ; + } + + intel_state->cdclk.logical.vco = vco; + intel_state->cdclk.logical.cdclk = cdclk; + +if (!intel_state->active_crtcs) { + cdclk =cnl_calc_cdclk (0 ); + vco =cnl_cdclk_pll_vco (dev_priv, cdclk); + + intel_state->cdclk.actual.vco = vco; + intel_state->cdclk.actual.cdclk = cdclk; + }else { + intel_state->cdclk.actual = + intel_state->cdclk.logical; + } + +return 0 ; +} +static int intel_compute_max_dotclk (struct drm_i915_private *dev_priv) {int max_cdclk_freq = dev_priv->max_cdclk_freq;@@ -1960,7 +2004,9 @@ static int intel_compute_max_dotclk(struct drm_i915_private *dev_priv)*/ void intel_update_max_cdclk (struct drm_i915_private *dev_priv) { -if (IS_GEN9_BC (dev_priv)) { +if (IS_CANNONLAKE (dev_priv)) { + dev_priv->max_cdclk_freq =528000 ; + }else if (IS_GEN9_BC (dev_priv)) {u32 limit =I915_READ (SKL_DFSM ) &SKL_DFSM_CDCLK_LIMIT_MASK ;int max_cdclk, vco;@@ -2157,6 +2203,10 @@ void intel_init_cdclk_hooks(struct drm_i915_private *dev_priv) dev_priv->display.set_cdclk = skl_set_cdclk; dev_priv->display.modeset_calc_cdclk = skl_modeset_calc_cdclk; + }else if (IS_CANNONLAKE (dev_priv)) { + dev_priv->display.set_cdclk = cnl_set_cdclk; + dev_priv->display.modeset_calc_cdclk = + cnl_modeset_calc_cdclk; }if (IS_CANNONLAKE (dev_priv))Signature · 1 line
1.9.1
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 04/17] drm/i915/cnl: Allow dynamic cdclk changes on CNL
In reply to Rodrigo ViviQuoted 57 lines · Rodrigo Vivi
All the low level cdclk bits are present, so let's add the required hooks to reconfigure cdclk on the fly.
v2: Rebase due to
cnl_sanitize_cdclk()
v3: Rebased by Rodrigo on top of Ville's cdclk rework.
v4: Rebase movingcnl_calc_cdclkup to follow same order
as previous platforms.
v2: Squash drm/i915/cnl: Adjust min pixel rate. to address
the current limitation where CDCLK cannot be set to 168MHz if audio is used with 96MHz. (Imre)Cc Imre Deak <[email protected]>Cc Dhinakaran Pandiyan <[email protected]>Signed-off-by Ville Syrjälä <[email protected]>Signed-off-by Rodrigo Vivi <[email protected]>Cannonlake also needs to adjust the minimal pixel rate as gen9 platforms. Specially for the Azalia audio case.
Cc Dhinakaran Pandiyan <[email protected]>Cc Sanyog Kale <[email protected]>Signed-off-by Rodrigo Vivi <[email protected]>--- drivers/gpu/drm/i915/intel_cdclk.c | 56 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 53 insertions(+), 3 deletions(-)drivers/gpu/drm/i915/intel_cdclk.c +11
-1@@ -1400,6 +1400,16 @@ void bxt_uninit_cdclk(struct drm_i915_private *dev_priv)bxt_set_cdclk (dev_priv, &cdclk_state); } +static int cnl_calc_cdclk (int max_pixclk) +{ +if (max_pixclk >336000 ) +return 528000 ; +else if (max_pixclk >168000 ) +return 336000 ; +else +return 168000 ; +} +static void cnl_cdclk_pll_update (struct drm_i915_private *dev_priv,struct intel_cdclk_state *cdclk_state) {@@ -1641,7 +1651,7 @@ void cnl_init_cdclk(struct drm_i915_private *dev_priv) cdclk_state = dev_priv->cdclk.hw; - cdclk_state.cdclk =168000 ; + cdclk_state.cdclk =cnl_calc_cdclk (0 ); cdclk_state.vco =cnl_cdclk_pll_vco (dev_priv, cdclk_state.cdclk);cnl_set_cdclk (dev_priv, &cdclk_state);
drivers/gpu/drm/i915/intel_cdclk.c static int intel_max_pixel_rate(struct drm_atomic_state *state) · line 1784
Quoted 8 lines
drivers/gpu/drm/i915/intel_cdclk.c +1
-1@@ -1768,7 +1778,7 @@ static int intel_max_pixel_rate(struct drm_atomic_state *state) pixel_rate = crtc_state->pixel_rate; -if (IS_BROADWELL (dev_priv) ||IS_GEN9 (dev_priv)) +if (IS_BROADWELL (dev_priv) ||INTEL_GEN (dev_priv) >=9 ) pixel_rate =bdw_adjust_min_pipe_pixel_rate (crtc_state, pixel_rate);
I think you might also have to adjust some of the clock limits within bdw_adjust_min_pipe_pixel_rate().
Quoted 65 lines
drivers/gpu/drm/i915/intel_cdclk.c +41
-1@@ -1929,6 +1939,40 @@ static int bxt_modeset_calc_cdclk(struct drm_atomic_state *state)return 0 ; } +static int cnl_modeset_calc_cdclk (struct drm_atomic_state *state) +{ +struct drm_i915_private *dev_priv =to_i915 (state->dev); +struct intel_atomic_state *intel_state = +to_intel_atomic_state (state); +int max_pixclk =intel_max_pixel_rate (state); +int cdclk, vco; + + cdclk =cnl_calc_cdclk (max_pixclk); + vco =cnl_cdclk_pll_vco (dev_priv, cdclk); + +if (cdclk > dev_priv->max_cdclk_freq) { +DRM_DEBUG_KMS ("requested cdclk (%d kHz) exceeds max (%d kHz)\n" , + cdclk, dev_priv->max_cdclk_freq); +return -EINVAL ; + } + + intel_state->cdclk.logical.vco = vco; + intel_state->cdclk.logical.cdclk = cdclk; + +if (!intel_state->active_crtcs) { + cdclk =cnl_calc_cdclk (0 ); + vco =cnl_cdclk_pll_vco (dev_priv, cdclk); + + intel_state->cdclk.actual.vco = vco; + intel_state->cdclk.actual.cdclk = cdclk; + }else { + intel_state->cdclk.actual = + intel_state->cdclk.logical; + } + +return 0 ; +} +static int intel_compute_max_dotclk (struct drm_i915_private *dev_priv) {int max_cdclk_freq = dev_priv->max_cdclk_freq;@@ -1960,7 +2004,9 @@ static int intel_compute_max_dotclk(struct drm_i915_private *dev_priv)*/ void intel_update_max_cdclk (struct drm_i915_private *dev_priv) { -if (IS_GEN9_BC (dev_priv)) { +if (IS_CANNONLAKE (dev_priv)) { + dev_priv->max_cdclk_freq =528000 ; + }else if (IS_GEN9_BC (dev_priv)) {u32 limit =I915_READ (SKL_DFSM ) &SKL_DFSM_CDCLK_LIMIT_MASK ;int max_cdclk, vco;@@ -2157,6 +2203,10 @@ void intel_init_cdclk_hooks(struct drm_i915_private *dev_priv) dev_priv->display.set_cdclk = skl_set_cdclk; dev_priv->display.modeset_calc_cdclk = skl_modeset_calc_cdclk; + }else if (IS_CANNONLAKE (dev_priv)) { + dev_priv->display.set_cdclk = cnl_set_cdclk; + dev_priv->display.modeset_calc_cdclk = + cnl_modeset_calc_cdclk; }if (IS_CANNONLAKE (dev_priv))Signature · 1 line
1.9.1
Signature · 6 lines
Ville Syrjälä Intel OTC _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 04/17] drm/i915/cnl: Allow dynamic cdclk changes on CNL
Quoted 61 lines · Ville Syrjälä
Quoted 60 lines · Rodrigo Vivi
All the low level cdclk bits are present, so let's add the required hooks to reconfigure cdclk on the fly.
v2: Rebase due to
cnl_sanitize_cdclk()
v3: Rebased by Rodrigo on top of Ville's cdclk rework.
v4: Rebase movingcnl_calc_cdclkup to follow same order
as previous platforms.
v2: Squash drm/i915/cnl: Adjust min pixel rate. to address
the current limitation where CDCLK cannot be set to 168MHz if audio is used with 96MHz. (Imre)Cc Imre Deak <[email protected]>Cc Dhinakaran Pandiyan <[email protected]>Signed-off-by Ville Syrjälä <[email protected]>Signed-off-by Rodrigo Vivi <[email protected]>Cannonlake also needs to adjust the minimal pixel rate as gen9 platforms. Specially for the Azalia audio case.
Cc Dhinakaran Pandiyan <[email protected]>Cc Sanyog Kale <[email protected]>Signed-off-by Rodrigo Vivi <[email protected]>--- drivers/gpu/drm/i915/intel_cdclk.c | 56 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 53 insertions(+), 3 deletions(-)drivers/gpu/drm/i915/intel_cdclk.c +11
-1@@ -1400,6 +1400,16 @@ void bxt_uninit_cdclk(struct drm_i915_private *dev_priv)bxt_set_cdclk (dev_priv, &cdclk_state); } +static int cnl_calc_cdclk (int max_pixclk) +{ +if (max_pixclk >336000 ) +return 528000 ; +else if (max_pixclk >168000 ) +return 336000 ; +else +return 168000 ; +} +static void cnl_cdclk_pll_update (struct drm_i915_private *dev_priv,struct intel_cdclk_state *cdclk_state) {@@ -1641,7 +1651,7 @@ void cnl_init_cdclk(struct drm_i915_private *dev_priv) cdclk_state = dev_priv->cdclk.hw; - cdclk_state.cdclk =168000 ; + cdclk_state.cdclk =cnl_calc_cdclk (0 ); cdclk_state.vco =cnl_cdclk_pll_vco (dev_priv, cdclk_state.cdclk);cnl_set_cdclk (dev_priv, &cdclk_state);@@ -1768,7 +1778,7 @@ static int intel_max_pixel_rate(struct drm_atomic_state *state) pixel_rate = crtc_state->pixel_rate;
Quoted 8 lines
drivers/gpu/drm/i915/intel_cdclk.c static int intel_max_pixel_rate(struct drm_atomic_state *state) · line 1784
Quoted 5 lines
drivers/gpu/drm/i915/intel_cdclk.c +1
-1-if (IS_BROADWELL (dev_priv) ||IS_GEN9 (dev_priv)) +if (IS_BROADWELL (dev_priv) ||INTEL_GEN (dev_priv) >=9 ) pixel_rate =bdw_adjust_min_pipe_pixel_rate (crtc_state, pixel_rate);I think you might also have to adjust some of the clock limits within
bdw_adjust_min_pipe_pixel_rate().
Yeah, the GEN10 Display Port + audio workaround will be incorrectly applied.
if (intel_crtc_has_dp_encoder(crtc_state) &&
crtc_state->has_audio &&
crtc_state->port_clock >= 540000 &&
crtc_state->lane_count == 4) {
if (IS_GEMINILAKE(dev_priv))
pixel_rate = max(2 * 316800, pixel_rate);
else
pixel_rate = max(432000, pixel_rate);
}CNL needs pixel_rate = max(316800, pixel_rate).
Although, the Azalia workaround will make sure the cdclk is set to 336 MHz.
-DK
Quoted 63 lines
Quoted 63 lines
drivers/gpu/drm/i915/intel_cdclk.c +41
-1@@ -1929,6 +1939,40 @@ static int bxt_modeset_calc_cdclk(struct drm_atomic_state *state)return 0 ; } +static int cnl_modeset_calc_cdclk (struct drm_atomic_state *state) +{ +struct drm_i915_private *dev_priv =to_i915 (state->dev); +struct intel_atomic_state *intel_state = +to_intel_atomic_state (state); +int max_pixclk =intel_max_pixel_rate (state); +int cdclk, vco; + + cdclk =cnl_calc_cdclk (max_pixclk); + vco =cnl_cdclk_pll_vco (dev_priv, cdclk); + +if (cdclk > dev_priv->max_cdclk_freq) { +DRM_DEBUG_KMS ("requested cdclk (%d kHz) exceeds max (%d kHz)\n" , + cdclk, dev_priv->max_cdclk_freq); +return -EINVAL ; + } + + intel_state->cdclk.logical.vco = vco; + intel_state->cdclk.logical.cdclk = cdclk; + +if (!intel_state->active_crtcs) { + cdclk =cnl_calc_cdclk (0 ); + vco =cnl_cdclk_pll_vco (dev_priv, cdclk); + + intel_state->cdclk.actual.vco = vco; + intel_state->cdclk.actual.cdclk = cdclk; + }else { + intel_state->cdclk.actual = + intel_state->cdclk.logical; + } + +return 0 ; +} +static int intel_compute_max_dotclk (struct drm_i915_private *dev_priv) {int max_cdclk_freq = dev_priv->max_cdclk_freq;@@ -1960,7 +2004,9 @@ static int intel_compute_max_dotclk(struct drm_i915_private *dev_priv)*/ void intel_update_max_cdclk (struct drm_i915_private *dev_priv) { -if (IS_GEN9_BC (dev_priv)) { +if (IS_CANNONLAKE (dev_priv)) { + dev_priv->max_cdclk_freq =528000 ; + }else if (IS_GEN9_BC (dev_priv)) {u32 limit =I915_READ (SKL_DFSM ) &SKL_DFSM_CDCLK_LIMIT_MASK ;int max_cdclk, vco;@@ -2157,6 +2203,10 @@ void intel_init_cdclk_hooks(struct drm_i915_private *dev_priv) dev_priv->display.set_cdclk = skl_set_cdclk; dev_priv->display.modeset_calc_cdclk = skl_modeset_calc_cdclk; + }else if (IS_CANNONLAKE (dev_priv)) { + dev_priv->display.set_cdclk = cnl_set_cdclk; + dev_priv->display.modeset_calc_cdclk = + cnl_modeset_calc_cdclk; }
Quoted 4 lines
Quoted 3 lines
drivers/gpu/drm/i915/intel_cdclk.c +0
-0if (IS_CANNONLAKE (dev_priv))Signature · 1 line
1.9.1
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 04/17] drm/i915/cnl: Allow dynamic cdclk changes on CNL
In reply to Ville SyrjäläQuoted 61 lines · Ville Syrjälä
Quoted 60 lines · Rodrigo Vivi
All the low level cdclk bits are present, so let's add the required hooks to reconfigure cdclk on the fly.
v2: Rebase due to
cnl_sanitize_cdclk()
v3: Rebased by Rodrigo on top of Ville's cdclk rework.
v4: Rebase movingcnl_calc_cdclkup to follow same order
as previous platforms.
v2: Squash drm/i915/cnl: Adjust min pixel rate. to address
the current limitation where CDCLK cannot be set to 168MHz if audio is used with 96MHz. (Imre)Cc Imre Deak <[email protected]>Cc Dhinakaran Pandiyan <[email protected]>Signed-off-by Ville Syrjälä <[email protected]>Signed-off-by Rodrigo Vivi <[email protected]>Cannonlake also needs to adjust the minimal pixel rate as gen9 platforms. Specially for the Azalia audio case.
Cc Dhinakaran Pandiyan <[email protected]>Cc Sanyog Kale <[email protected]>Signed-off-by Rodrigo Vivi <[email protected]>--- drivers/gpu/drm/i915/intel_cdclk.c | 56 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 53 insertions(+), 3 deletions(-)drivers/gpu/drm/i915/intel_cdclk.c +11
-1@@ -1400,6 +1400,16 @@ void bxt_uninit_cdclk(struct drm_i915_private *dev_priv)bxt_set_cdclk (dev_priv, &cdclk_state); } +static int cnl_calc_cdclk (int max_pixclk) +{ +if (max_pixclk >336000 ) +return 528000 ; +else if (max_pixclk >168000 ) +return 336000 ; +else +return 168000 ; +} +static void cnl_cdclk_pll_update (struct drm_i915_private *dev_priv,struct intel_cdclk_state *cdclk_state) {@@ -1641,7 +1651,7 @@ void cnl_init_cdclk(struct drm_i915_private *dev_priv) cdclk_state = dev_priv->cdclk.hw; - cdclk_state.cdclk =168000 ; + cdclk_state.cdclk =cnl_calc_cdclk (0 ); cdclk_state.vco =cnl_cdclk_pll_vco (dev_priv, cdclk_state.cdclk);cnl_set_cdclk (dev_priv, &cdclk_state);@@ -1768,7 +1778,7 @@ static int intel_max_pixel_rate(struct drm_atomic_state *state) pixel_rate = crtc_state->pixel_rate;
Quoted 8 lines
drivers/gpu/drm/i915/intel_cdclk.c static int intel_max_pixel_rate(struct drm_atomic_state *state) · line 1784
Quoted 5 lines
drivers/gpu/drm/i915/intel_cdclk.c +1
-1-if (IS_BROADWELL (dev_priv) ||IS_GEN9 (dev_priv)) +if (IS_BROADWELL (dev_priv) ||INTEL_GEN (dev_priv) >=9 ) pixel_rate =bdw_adjust_min_pipe_pixel_rate (crtc_state, pixel_rate);I think you might also have to adjust some of the clock limits within
bdw_adjust_min_pipe_pixel_rate().
Yes, we missed this. The DP/HBR2/4-lanes/audio workaround on CNL is the same as on GLK. So in bdw_adjust_min_pipe_pixel_rate() we could use the same limits as on GLK, except I don't understand the 2x multiplier there in
pixel_rate = max(2 * 316800, pixel_rate);
and
pixel_rate = max(2 * 2 * 96000, pixel_rate);
This pixel_rate value will be compared against CDCLK limit values in glk_calc_cdclk() not CD2XCLK limit values. Removing the 2x multiplier from the above pixel_rate values wouldn't change anything on GLK AFAICS and it would allow us to use the same code to calculate these on GLK and CNL (and simplify the second pixel_rate calculation).
--Imre
Quoted 63 lines
Quoted 63 lines
drivers/gpu/drm/i915/intel_cdclk.c +41
-1@@ -1929,6 +1939,40 @@ static int bxt_modeset_calc_cdclk(struct drm_atomic_state *state)return 0 ; } +static int cnl_modeset_calc_cdclk (struct drm_atomic_state *state) +{ +struct drm_i915_private *dev_priv =to_i915 (state->dev); +struct intel_atomic_state *intel_state = +to_intel_atomic_state (state); +int max_pixclk =intel_max_pixel_rate (state); +int cdclk, vco; + + cdclk =cnl_calc_cdclk (max_pixclk); + vco =cnl_cdclk_pll_vco (dev_priv, cdclk); + +if (cdclk > dev_priv->max_cdclk_freq) { +DRM_DEBUG_KMS ("requested cdclk (%d kHz) exceeds max (%d kHz)\n" , + cdclk, dev_priv->max_cdclk_freq); +return -EINVAL ; + } + + intel_state->cdclk.logical.vco = vco; + intel_state->cdclk.logical.cdclk = cdclk; + +if (!intel_state->active_crtcs) { + cdclk =cnl_calc_cdclk (0 ); + vco =cnl_cdclk_pll_vco (dev_priv, cdclk); + + intel_state->cdclk.actual.vco = vco; + intel_state->cdclk.actual.cdclk = cdclk; + }else { + intel_state->cdclk.actual = + intel_state->cdclk.logical; + } + +return 0 ; +} +static int intel_compute_max_dotclk (struct drm_i915_private *dev_priv) {int max_cdclk_freq = dev_priv->max_cdclk_freq;@@ -1960,7 +2004,9 @@ static int intel_compute_max_dotclk(struct drm_i915_private *dev_priv)*/ void intel_update_max_cdclk (struct drm_i915_private *dev_priv) { -if (IS_GEN9_BC (dev_priv)) { +if (IS_CANNONLAKE (dev_priv)) { + dev_priv->max_cdclk_freq =528000 ; + }else if (IS_GEN9_BC (dev_priv)) {u32 limit =I915_READ (SKL_DFSM ) &SKL_DFSM_CDCLK_LIMIT_MASK ;int max_cdclk, vco;@@ -2157,6 +2203,10 @@ void intel_init_cdclk_hooks(struct drm_i915_private *dev_priv) dev_priv->display.set_cdclk = skl_set_cdclk; dev_priv->display.modeset_calc_cdclk = skl_modeset_calc_cdclk; + }else if (IS_CANNONLAKE (dev_priv)) { + dev_priv->display.set_cdclk = cnl_set_cdclk; + dev_priv->display.modeset_calc_cdclk = + cnl_modeset_calc_cdclk; }
Quoted 7 lines
Quoted 3 lines
drivers/gpu/drm/i915/intel_cdclk.c +0
-0if (IS_CANNONLAKE (dev_priv))Signature · 1 line
1.9.1Signature · 2 lines
Ville Syrjälä Intel OTC
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 04/17] drm/i915/cnl: Allow dynamic cdclk changes on CNL
Quoted 76 lines · Imre Deak
Quoted 61 lines · Ville Syrjälä
Quoted 60 lines · Rodrigo Vivi
All the low level cdclk bits are present, so let's add the required hooks to reconfigure cdclk on the fly.
v2: Rebase due to
cnl_sanitize_cdclk()
v3: Rebased by Rodrigo on top of Ville's cdclk rework.
v4: Rebase movingcnl_calc_cdclkup to follow same order
as previous platforms.
v2: Squash drm/i915/cnl: Adjust min pixel rate. to address
the current limitation where CDCLK cannot be set to 168MHz if audio is used with 96MHz. (Imre)Cc Imre Deak <[email protected]>Cc Dhinakaran Pandiyan <[email protected]>Signed-off-by Ville Syrjälä <[email protected]>Signed-off-by Rodrigo Vivi <[email protected]>Cannonlake also needs to adjust the minimal pixel rate as gen9 platforms. Specially for the Azalia audio case.
Cc Dhinakaran Pandiyan <[email protected]>Cc Sanyog Kale <[email protected]>Signed-off-by Rodrigo Vivi <[email protected]>--- drivers/gpu/drm/i915/intel_cdclk.c | 56 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 53 insertions(+), 3 deletions(-)drivers/gpu/drm/i915/intel_cdclk.c +11
-1@@ -1400,6 +1400,16 @@ void bxt_uninit_cdclk(struct drm_i915_private *dev_priv)bxt_set_cdclk (dev_priv, &cdclk_state); } +static int cnl_calc_cdclk (int max_pixclk) +{ +if (max_pixclk >336000 ) +return 528000 ; +else if (max_pixclk >168000 ) +return 336000 ; +else +return 168000 ; +} +static void cnl_cdclk_pll_update (struct drm_i915_private *dev_priv,struct intel_cdclk_state *cdclk_state) {@@ -1641,7 +1651,7 @@ void cnl_init_cdclk(struct drm_i915_private *dev_priv) cdclk_state = dev_priv->cdclk.hw; - cdclk_state.cdclk =168000 ; + cdclk_state.cdclk =cnl_calc_cdclk (0 ); cdclk_state.vco =cnl_cdclk_pll_vco (dev_priv, cdclk_state.cdclk);cnl_set_cdclk (dev_priv, &cdclk_state);@@ -1768,7 +1778,7 @@ static int intel_max_pixel_rate(struct drm_atomic_state *state) pixel_rate = crtc_state->pixel_rate;Quoted 8 lines
drivers/gpu/drm/i915/intel_cdclk.c static int intel_max_pixel_rate(struct drm_atomic_state *state) · line 1784
Quoted 5 lines
drivers/gpu/drm/i915/intel_cdclk.c +1
-1-if (IS_BROADWELL (dev_priv) ||IS_GEN9 (dev_priv)) +if (IS_BROADWELL (dev_priv) ||INTEL_GEN (dev_priv) >=9 ) pixel_rate =bdw_adjust_min_pipe_pixel_rate (crtc_state, pixel_rate);I think you might also have to adjust some of the clock limits within
bdw_adjust_min_pipe_pixel_rate().Yes, we missed this. The DP/HBR2/4-lanes/audio workaround on CNL is the same as on GLK. So in
bdw_adjust_min_pipe_pixel_rate()we could use the same limits as on GLK, except I don't understand the 2x multiplier there in
Quoted 8 lines
pixel_rate=max(2 * 316800, pixel_rate);and
pixel_rate=max(2 * 2 * 96000, pixel_rate);This
pixel_ratevalue will be compared against CDCLK limit values inglk_calc_cdclk()
It's going to compare against 2*cdclk. But that doesn't mean it isn't extremely confusing. To make it more sane, I think we should probably s/min_pixclk/min_cdclk/ and actually track the "min acceptable cdclk" rather than "the pixel rate corresponding to the min acceptable cdclk".
Quoted 77 lines
not CD2XCLK limit values. Removing the 2x multiplier
from the abovepixel_ratevalues wouldn't change anything on GLK AFAICS and it would allow us to use the same code to calculate these on GLK and CNL (and simplify the secondpixel_ratecalculation).--Imre
Quoted 70 lines
Quoted 66 lines
drivers/gpu/drm/i915/intel_cdclk.c +41
-1@@ -1929,6 +1939,40 @@ static int bxt_modeset_calc_cdclk(struct drm_atomic_state *state)return 0 ; } +static int cnl_modeset_calc_cdclk (struct drm_atomic_state *state) +{ +struct drm_i915_private *dev_priv =to_i915 (state->dev); +struct intel_atomic_state *intel_state = +to_intel_atomic_state (state); +int max_pixclk =intel_max_pixel_rate (state); +int cdclk, vco; + + cdclk =cnl_calc_cdclk (max_pixclk); + vco =cnl_cdclk_pll_vco (dev_priv, cdclk); + +if (cdclk > dev_priv->max_cdclk_freq) { +DRM_DEBUG_KMS ("requested cdclk (%d kHz) exceeds max (%d kHz)\n" , + cdclk, dev_priv->max_cdclk_freq); +return -EINVAL ; + } + + intel_state->cdclk.logical.vco = vco; + intel_state->cdclk.logical.cdclk = cdclk; + +if (!intel_state->active_crtcs) { + cdclk =cnl_calc_cdclk (0 ); + vco =cnl_cdclk_pll_vco (dev_priv, cdclk); + + intel_state->cdclk.actual.vco = vco; + intel_state->cdclk.actual.cdclk = cdclk; + }else { + intel_state->cdclk.actual = + intel_state->cdclk.logical; + } + +return 0 ; +} +static int intel_compute_max_dotclk (struct drm_i915_private *dev_priv) {int max_cdclk_freq = dev_priv->max_cdclk_freq;@@ -1960,7 +2004,9 @@ static int intel_compute_max_dotclk(struct drm_i915_private *dev_priv)*/ void intel_update_max_cdclk (struct drm_i915_private *dev_priv) { -if (IS_GEN9_BC (dev_priv)) { +if (IS_CANNONLAKE (dev_priv)) { + dev_priv->max_cdclk_freq =528000 ; + }else if (IS_GEN9_BC (dev_priv)) {u32 limit =I915_READ (SKL_DFSM ) &SKL_DFSM_CDCLK_LIMIT_MASK ;int max_cdclk, vco;@@ -2157,6 +2203,10 @@ void intel_init_cdclk_hooks(struct drm_i915_private *dev_priv) dev_priv->display.set_cdclk = skl_set_cdclk; dev_priv->display.modeset_calc_cdclk = skl_modeset_calc_cdclk; + }else if (IS_CANNONLAKE (dev_priv)) { + dev_priv->display.set_cdclk = cnl_set_cdclk; + dev_priv->display.modeset_calc_cdclk = + cnl_modeset_calc_cdclk; }if (IS_CANNONLAKE (dev_priv))Signature · 1 line
1.9.1Signature · 2 lines
Ville Syrjälä Intel OTC
Signature · 6 lines
Ville Syrjälä Intel OTC _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 04/17] drm/i915/cnl: Allow dynamic cdclk changes on CNL
Quoted 83 lines · Ville Syrjälä
Quoted 82 lines · Imre Deak
Quoted 61 lines · Ville Syrjälä
Quoted 60 lines · Rodrigo Vivi
All the low level cdclk bits are present, so let's add the required hooks to reconfigure cdclk on the fly.
v2: Rebase due to
cnl_sanitize_cdclk()
v3: Rebased by Rodrigo on top of Ville's cdclk rework.
v4: Rebase movingcnl_calc_cdclkup to follow same order
as previous platforms.
v2: Squash drm/i915/cnl: Adjust min pixel rate. to address
the current limitation where CDCLK cannot be set to 168MHz if audio is used with 96MHz. (Imre)Cc Imre Deak <[email protected]>Cc Dhinakaran Pandiyan <[email protected]>Signed-off-by Ville Syrjälä <[email protected]>Signed-off-by Rodrigo Vivi <[email protected]>Cannonlake also needs to adjust the minimal pixel rate as gen9 platforms. Specially for the Azalia audio case.
Cc Dhinakaran Pandiyan <[email protected]>Cc Sanyog Kale <[email protected]>Signed-off-by Rodrigo Vivi <[email protected]>--- drivers/gpu/drm/i915/intel_cdclk.c | 56 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 53 insertions(+), 3 deletions(-)drivers/gpu/drm/i915/intel_cdclk.c +11
-1@@ -1400,6 +1400,16 @@ void bxt_uninit_cdclk(struct drm_i915_private *dev_priv)bxt_set_cdclk (dev_priv, &cdclk_state); } +static int cnl_calc_cdclk (int max_pixclk) +{ +if (max_pixclk >336000 ) +return 528000 ; +else if (max_pixclk >168000 ) +return 336000 ; +else +return 168000 ; +} +static void cnl_cdclk_pll_update (struct drm_i915_private *dev_priv,struct intel_cdclk_state *cdclk_state) {@@ -1641,7 +1651,7 @@ void cnl_init_cdclk(struct drm_i915_private *dev_priv) cdclk_state = dev_priv->cdclk.hw; - cdclk_state.cdclk =168000 ; + cdclk_state.cdclk =cnl_calc_cdclk (0 ); cdclk_state.vco =cnl_cdclk_pll_vco (dev_priv, cdclk_state.cdclk);cnl_set_cdclk (dev_priv, &cdclk_state);@@ -1768,7 +1778,7 @@ static int intel_max_pixel_rate(struct drm_atomic_state *state) pixel_rate = crtc_state->pixel_rate;Quoted 8 lines
drivers/gpu/drm/i915/intel_cdclk.c static int intel_max_pixel_rate(struct drm_atomic_state *state) · line 1784
Quoted 5 lines
drivers/gpu/drm/i915/intel_cdclk.c +1
-1-if (IS_BROADWELL (dev_priv) ||IS_GEN9 (dev_priv)) +if (IS_BROADWELL (dev_priv) ||INTEL_GEN (dev_priv) >=9 ) pixel_rate =bdw_adjust_min_pipe_pixel_rate (crtc_state, pixel_rate);I think you might also have to adjust some of the clock limits within
bdw_adjust_min_pipe_pixel_rate().Yes, we missed this. The DP/HBR2/4-lanes/audio workaround on CNL is the same as on GLK. So in
bdw_adjust_min_pipe_pixel_rate()we could use the same limits as on GLK, except I don't understand the 2x multiplier there in
pixel_rate=max(2 * 316800, pixel_rate);and
pixel_rate=max(2 * 2 * 96000, pixel_rate);
Quoted 7 lines
Quoted 2 lines
This
pixel_ratevalue will be compared against CDCLK limit values inglk_calc_cdclk()It's going to compare against 2*cdclk. But that doesn't mean it isn't extremely confusing. To make it more sane, I think we should probably s/min_pixclk/min_cdclk/ and actually track the "min acceptable cdclk" rather than "the pixel rate corresponding to the min acceptable cdclk".
Arr, correct. And now I found in BSpec how to calculate cdclk for a given dotclock. So yes, the GLK part is correct, sorry for the noise.
However. For CNL the target CDCLK calculation should be the same as for GLK, based on the "GEN10 Resolution Support". So as an example there if the max pixel rate is 299MHz we can use a CDCLK of 168MHz. With the current code we'd use a CDCLK of 336MHz. Is that correct?
Quoted 71 lines
Quoted 71 lines
not CD2XCLK limit values. Removing the 2x multiplier
from the abovepixel_ratevalues wouldn't change anything on GLK AFAICS and it would allow us to use the same code to calculate these on GLK and CNL (and simplify the secondpixel_ratecalculation).--Imre
Quoted 63 lines
Quoted 63 lines
drivers/gpu/drm/i915/intel_cdclk.c +41
-1@@ -1929,6 +1939,40 @@ static int bxt_modeset_calc_cdclk(struct drm_atomic_state *state)return 0 ; } +static int cnl_modeset_calc_cdclk (struct drm_atomic_state *state) +{ +struct drm_i915_private *dev_priv =to_i915 (state->dev); +struct intel_atomic_state *intel_state = +to_intel_atomic_state (state); +int max_pixclk =intel_max_pixel_rate (state); +int cdclk, vco; + + cdclk =cnl_calc_cdclk (max_pixclk); + vco =cnl_cdclk_pll_vco (dev_priv, cdclk); + +if (cdclk > dev_priv->max_cdclk_freq) { +DRM_DEBUG_KMS ("requested cdclk (%d kHz) exceeds max (%d kHz)\n" , + cdclk, dev_priv->max_cdclk_freq); +return -EINVAL ; + } + + intel_state->cdclk.logical.vco = vco; + intel_state->cdclk.logical.cdclk = cdclk; + +if (!intel_state->active_crtcs) { + cdclk =cnl_calc_cdclk (0 ); + vco =cnl_cdclk_pll_vco (dev_priv, cdclk); + + intel_state->cdclk.actual.vco = vco; + intel_state->cdclk.actual.cdclk = cdclk; + }else { + intel_state->cdclk.actual = + intel_state->cdclk.logical; + } + +return 0 ; +} +static int intel_compute_max_dotclk (struct drm_i915_private *dev_priv) {int max_cdclk_freq = dev_priv->max_cdclk_freq;@@ -1960,7 +2004,9 @@ static int intel_compute_max_dotclk(struct drm_i915_private *dev_priv)*/ void intel_update_max_cdclk (struct drm_i915_private *dev_priv) { -if (IS_GEN9_BC (dev_priv)) { +if (IS_CANNONLAKE (dev_priv)) { + dev_priv->max_cdclk_freq =528000 ; + }else if (IS_GEN9_BC (dev_priv)) {u32 limit =I915_READ (SKL_DFSM ) &SKL_DFSM_CDCLK_LIMIT_MASK ;int max_cdclk, vco;@@ -2157,6 +2203,10 @@ void intel_init_cdclk_hooks(struct drm_i915_private *dev_priv) dev_priv->display.set_cdclk = skl_set_cdclk; dev_priv->display.modeset_calc_cdclk = skl_modeset_calc_cdclk; + }else if (IS_CANNONLAKE (dev_priv)) { + dev_priv->display.set_cdclk = cnl_set_cdclk; + dev_priv->display.modeset_calc_cdclk = + cnl_modeset_calc_cdclk; }
Quoted 11 lines
Quoted 7 lines
Quoted 7 lines
Quoted 3 lines
drivers/gpu/drm/i915/intel_cdclk.c +0
-0if (IS_CANNONLAKE (dev_priv))Signature · 1 line
1.9.1Signature · 2 lines
Ville Syrjälä Intel OTCSignature · 2 lines
Ville Syrjälä Intel OTC
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Vivi, Rodrigo
maintainerRe: [PATCH 04/17] drm/i915/cnl: Allow dynamic cdclk changes on CNL
Quoted 92 lines · Imre Deak
Quoted 83 lines · Ville Syrjälä
Quoted 82 lines · Imre Deak
Quoted 61 lines · Ville Syrjälä
Quoted 60 lines · Rodrigo Vivi
All the low level cdclk bits are present, so let's add the required hooks to reconfigure cdclk on the fly.
v2: Rebase due to
cnl_sanitize_cdclk()
v3: Rebased by Rodrigo on top of Ville's cdclk rework.
v4: Rebase movingcnl_calc_cdclkup to follow same order
as previous platforms.
v2: Squash drm/i915/cnl: Adjust min pixel rate. to address
the current limitation where CDCLK cannot be set to 168MHz if audio is used with 96MHz. (Imre)Cc Imre Deak <[email protected]>Cc Dhinakaran Pandiyan <[email protected]>Signed-off-by Ville Syrjälä <[email protected]>Signed-off-by Rodrigo Vivi <[email protected]>Cannonlake also needs to adjust the minimal pixel rate as gen9 platforms. Specially for the Azalia audio case.
Cc Dhinakaran Pandiyan <[email protected]>Cc Sanyog Kale <[email protected]>Signed-off-by Rodrigo Vivi <[email protected]>--- drivers/gpu/drm/i915/intel_cdclk.c | 56 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 53 insertions(+), 3 deletions(-)drivers/gpu/drm/i915/intel_cdclk.c +11
-1@@ -1400,6 +1400,16 @@ void bxt_uninit_cdclk(struct drm_i915_private *dev_priv)bxt_set_cdclk (dev_priv, &cdclk_state); } +static int cnl_calc_cdclk (int max_pixclk) +{ +if (max_pixclk >336000 ) +return 528000 ; +else if (max_pixclk >168000 ) +return 336000 ; +else +return 168000 ; +} +static void cnl_cdclk_pll_update (struct drm_i915_private *dev_priv,struct intel_cdclk_state *cdclk_state) {@@ -1641,7 +1651,7 @@ void cnl_init_cdclk(struct drm_i915_private *dev_priv) cdclk_state = dev_priv->cdclk.hw; - cdclk_state.cdclk =168000 ; + cdclk_state.cdclk =cnl_calc_cdclk (0 ); cdclk_state.vco =cnl_cdclk_pll_vco (dev_priv, cdclk_state.cdclk);cnl_set_cdclk (dev_priv, &cdclk_state);@@ -1768,7 +1778,7 @@ static int intel_max_pixel_rate(struct drm_atomic_state *state) pixel_rate = crtc_state->pixel_rate;Quoted 8 lines
drivers/gpu/drm/i915/intel_cdclk.c static int intel_max_pixel_rate(struct drm_atomic_state *state) · line 1784
Quoted 5 lines
drivers/gpu/drm/i915/intel_cdclk.c +1
-1-if (IS_BROADWELL (dev_priv) ||IS_GEN9 (dev_priv)) +if (IS_BROADWELL (dev_priv) ||INTEL_GEN (dev_priv) >=9 ) pixel_rate =bdw_adjust_min_pipe_pixel_rate (crtc_state, pixel_rate);I think you might also have to adjust some of the clock limits within
bdw_adjust_min_pipe_pixel_rate().Yes, we missed this. The DP/HBR2/4-lanes/audio workaround on CNL is the same as on GLK. So in
bdw_adjust_min_pipe_pixel_rate()we could use the same limits as on GLK, except I don't understand the 2x multiplier there in
pixel_rate=max(2 * 316800, pixel_rate);and
pixel_rate=max(2 * 2 * 96000, pixel_rate);Quoted 7 lines
Quoted 2 lines
This
pixel_ratevalue will be compared against CDCLK limit values inglk_calc_cdclk()It's going to compare against 2*cdclk. But that doesn't mean it isn't extremely confusing. To make it more sane, I think we should probably s/min_pixclk/min_cdclk/ and actually track the "min acceptable cdclk" rather than "the pixel rate corresponding to the min acceptable cdclk".
Quoted 7 lines
Arr, correct. And now I found in BSpec how to calculate cdclk for a given dotclock. So yes, the GLK part is correct, sorry for the noise.
However. For CNL the target CDCLK calculation should be the same as for GLK, based on the "GEN10 Resolution Support". So as an example there if the max pixel rate is 299MHz we can use a CDCLK of 168MHz. With the current code we'd use a CDCLK of 336MHz. Is that correct?
on current cnl code 2-pixel-per-clock is disabled. I got a conflict and decided to take a look after upstreaming the basic support.
So I believe the current code is the correct one, right?! (But honestly I'm a bit lost here)
Quoted 81 lines
Quoted 81 lines
Quoted 80 lines
not CD2XCLK limit values. Removing the 2x multiplier
from the abovepixel_ratevalues wouldn't change anything on GLK AFAICS and it would allow us to use the same code to calculate these on GLK and CNL (and simplify the secondpixel_ratecalculation).--Imre
Quoted 70 lines
Quoted 66 lines
drivers/gpu/drm/i915/intel_cdclk.c +41
-1@@ -1929,6 +1939,40 @@ static int bxt_modeset_calc_cdclk(struct drm_atomic_state *state)return 0 ; } +static int cnl_modeset_calc_cdclk (struct drm_atomic_state *state) +{ +struct drm_i915_private *dev_priv =to_i915 (state->dev); +struct intel_atomic_state *intel_state = +to_intel_atomic_state (state); +int max_pixclk =intel_max_pixel_rate (state); +int cdclk, vco; + + cdclk =cnl_calc_cdclk (max_pixclk); + vco =cnl_cdclk_pll_vco (dev_priv, cdclk); + +if (cdclk > dev_priv->max_cdclk_freq) { +DRM_DEBUG_KMS ("requested cdclk (%d kHz) exceeds max (%d kHz)\n" , + cdclk, dev_priv->max_cdclk_freq); +return -EINVAL ; + } + + intel_state->cdclk.logical.vco = vco; + intel_state->cdclk.logical.cdclk = cdclk; + +if (!intel_state->active_crtcs) { + cdclk =cnl_calc_cdclk (0 ); + vco =cnl_cdclk_pll_vco (dev_priv, cdclk); + + intel_state->cdclk.actual.vco = vco; + intel_state->cdclk.actual.cdclk = cdclk; + }else { + intel_state->cdclk.actual = + intel_state->cdclk.logical; + } + +return 0 ; +} +static int intel_compute_max_dotclk (struct drm_i915_private *dev_priv) {int max_cdclk_freq = dev_priv->max_cdclk_freq;@@ -1960,7 +2004,9 @@ static int intel_compute_max_dotclk(struct drm_i915_private *dev_priv)*/ void intel_update_max_cdclk (struct drm_i915_private *dev_priv) { -if (IS_GEN9_BC (dev_priv)) { +if (IS_CANNONLAKE (dev_priv)) { + dev_priv->max_cdclk_freq =528000 ; + }else if (IS_GEN9_BC (dev_priv)) {u32 limit =I915_READ (SKL_DFSM ) &SKL_DFSM_CDCLK_LIMIT_MASK ;int max_cdclk, vco;@@ -2157,6 +2203,10 @@ void intel_init_cdclk_hooks(struct drm_i915_private *dev_priv) dev_priv->display.set_cdclk = skl_set_cdclk; dev_priv->display.modeset_calc_cdclk = skl_modeset_calc_cdclk; + }else if (IS_CANNONLAKE (dev_priv)) { + dev_priv->display.set_cdclk = cnl_set_cdclk; + dev_priv->display.modeset_calc_cdclk = + cnl_modeset_calc_cdclk; }if (IS_CANNONLAKE (dev_priv))Signature · 1 line
1.9.1Signature · 2 lines
Ville Syrjälä Intel OTC
Quoted 3 lines
Quoted 3 lines
Signature · 2 lines
Ville Syrjälä Intel OTC
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 04/17] drm/i915/cnl: Allow dynamic cdclk changes on CNL
Quoted 101 lines · Rodrigo
Quoted 92 lines · Imre Deak
Quoted 83 lines · Ville Syrjälä
Quoted 82 lines · Imre Deak
Quoted 61 lines · Ville Syrjälä
Quoted 60 lines · Rodrigo Vivi
All the low level cdclk bits are present, so let's add the required hooks to reconfigure cdclk on the fly.
v2: Rebase due to
cnl_sanitize_cdclk()
v3: Rebased by Rodrigo on top of Ville's cdclk rework.
v4: Rebase movingcnl_calc_cdclkup to follow same order
as previous platforms.
v2: Squash drm/i915/cnl: Adjust min pixel rate. to address
the current limitation where CDCLK cannot be set to 168MHz if audio is used with 96MHz. (Imre)Cc Imre Deak <[email protected]>Cc Dhinakaran Pandiyan <[email protected]>Signed-off-by Ville Syrjälä <[email protected]>Signed-off-by Rodrigo Vivi <[email protected]>Cannonlake also needs to adjust the minimal pixel rate as gen9 platforms. Specially for the Azalia audio case.
Cc Dhinakaran Pandiyan <[email protected]>Cc Sanyog Kale <[email protected]>Signed-off-by Rodrigo Vivi <[email protected]>--- drivers/gpu/drm/i915/intel_cdclk.c | 56 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 53 insertions(+), 3 deletions(-)drivers/gpu/drm/i915/intel_cdclk.c +11
-1@@ -1400,6 +1400,16 @@ void bxt_uninit_cdclk(struct drm_i915_private *dev_priv)bxt_set_cdclk (dev_priv, &cdclk_state); } +static int cnl_calc_cdclk (int max_pixclk) +{ +if (max_pixclk >336000 ) +return 528000 ; +else if (max_pixclk >168000 ) +return 336000 ; +else +return 168000 ; +} +static void cnl_cdclk_pll_update (struct drm_i915_private *dev_priv,struct intel_cdclk_state *cdclk_state) {@@ -1641,7 +1651,7 @@ void cnl_init_cdclk(struct drm_i915_private *dev_priv) cdclk_state = dev_priv->cdclk.hw; - cdclk_state.cdclk =168000 ; + cdclk_state.cdclk =cnl_calc_cdclk (0 ); cdclk_state.vco =cnl_cdclk_pll_vco (dev_priv, cdclk_state.cdclk);cnl_set_cdclk (dev_priv, &cdclk_state);@@ -1768,7 +1778,7 @@ static int intel_max_pixel_rate(struct drm_atomic_state *state) pixel_rate = crtc_state->pixel_rate;Quoted 8 lines
drivers/gpu/drm/i915/intel_cdclk.c static int intel_max_pixel_rate(struct drm_atomic_state *state) · line 1784
Quoted 5 lines
drivers/gpu/drm/i915/intel_cdclk.c +1
-1-if (IS_BROADWELL (dev_priv) ||IS_GEN9 (dev_priv)) +if (IS_BROADWELL (dev_priv) ||INTEL_GEN (dev_priv) >=9 ) pixel_rate =bdw_adjust_min_pipe_pixel_rate (crtc_state, pixel_rate);I think you might also have to adjust some of the clock limits within
bdw_adjust_min_pipe_pixel_rate().Yes, we missed this. The DP/HBR2/4-lanes/audio workaround on CNL is the same as on GLK. So in
bdw_adjust_min_pipe_pixel_rate()we could use the same limits as on GLK, except I don't understand the 2x multiplier there in
pixel_rate=max(2 * 316800, pixel_rate);and
pixel_rate=max(2 * 2 * 96000, pixel_rate);Quoted 7 lines
Quoted 2 lines
This
pixel_ratevalue will be compared against CDCLK limit values inglk_calc_cdclk()It's going to compare against 2*cdclk. But that doesn't mean it isn't extremely confusing. To make it more sane, I think we should probably s/min_pixclk/min_cdclk/ and actually track the "min acceptable cdclk" rather than "the pixel rate corresponding to the min acceptable cdclk".
Quoted 7 lines
Arr, correct. And now I found in BSpec how to calculate cdclk for a given dotclock. So yes, the GLK part is correct, sorry for the noise.
However. For CNL the target CDCLK calculation should be the same as for GLK, based on the "GEN10 Resolution Support". So as an example there if the max pixel rate is 299MHz we can use a CDCLK of 168MHz. With the current code we'd use a CDCLK of 336MHz. Is that correct?
Quoted 5 lines
on current cnl code 2-pixel-per-clock is disabled. I got a conflict and decided to take a look after upstreaming the basic support.
So I believe the current code is the correct one, right?! (But honestly I'm a bit lost here)
Ok, found that internal patch now, with that the current code looks ok. Would make sense to add a note about this to the commit message.
Quoted 81 lines
Quoted 81 lines
Quoted 81 lines
Quoted 80 lines
not CD2XCLK limit values. Removing the 2x multiplier
from the abovepixel_ratevalues wouldn't change anything on GLK AFAICS and it would allow us to use the same code to calculate these on GLK and CNL (and simplify the secondpixel_ratecalculation).--Imre
Quoted 70 lines
Quoted 66 lines
drivers/gpu/drm/i915/intel_cdclk.c +41
-1@@ -1929,6 +1939,40 @@ static int bxt_modeset_calc_cdclk(struct drm_atomic_state *state)return 0 ; } +static int cnl_modeset_calc_cdclk (struct drm_atomic_state *state) +{ +struct drm_i915_private *dev_priv =to_i915 (state->dev); +struct intel_atomic_state *intel_state = +to_intel_atomic_state (state); +int max_pixclk =intel_max_pixel_rate (state); +int cdclk, vco; + + cdclk =cnl_calc_cdclk (max_pixclk); + vco =cnl_cdclk_pll_vco (dev_priv, cdclk); + +if (cdclk > dev_priv->max_cdclk_freq) { +DRM_DEBUG_KMS ("requested cdclk (%d kHz) exceeds max (%d kHz)\n" , + cdclk, dev_priv->max_cdclk_freq); +return -EINVAL ; + } + + intel_state->cdclk.logical.vco = vco; + intel_state->cdclk.logical.cdclk = cdclk; + +if (!intel_state->active_crtcs) { + cdclk =cnl_calc_cdclk (0 ); + vco =cnl_cdclk_pll_vco (dev_priv, cdclk); + + intel_state->cdclk.actual.vco = vco; + intel_state->cdclk.actual.cdclk = cdclk; + }else { + intel_state->cdclk.actual = + intel_state->cdclk.logical; + } + +return 0 ; +} +static int intel_compute_max_dotclk (struct drm_i915_private *dev_priv) {int max_cdclk_freq = dev_priv->max_cdclk_freq;@@ -1960,7 +2004,9 @@ static int intel_compute_max_dotclk(struct drm_i915_private *dev_priv)*/ void intel_update_max_cdclk (struct drm_i915_private *dev_priv) { -if (IS_GEN9_BC (dev_priv)) { +if (IS_CANNONLAKE (dev_priv)) { + dev_priv->max_cdclk_freq =528000 ; + }else if (IS_GEN9_BC (dev_priv)) {u32 limit =I915_READ (SKL_DFSM ) &SKL_DFSM_CDCLK_LIMIT_MASK ;int max_cdclk, vco;@@ -2157,6 +2203,10 @@ void intel_init_cdclk_hooks(struct drm_i915_private *dev_priv) dev_priv->display.set_cdclk = skl_set_cdclk; dev_priv->display.modeset_calc_cdclk = skl_modeset_calc_cdclk; + }else if (IS_CANNONLAKE (dev_priv)) { + dev_priv->display.set_cdclk = cnl_set_cdclk; + dev_priv->display.modeset_calc_cdclk = + cnl_modeset_calc_cdclk; }if (IS_CANNONLAKE (dev_priv))Signature · 1 line
1.9.1Signature · 2 lines
Ville Syrjälä Intel OTC
Quoted 4 lines
Quoted 3 lines
Quoted 3 lines
Signature · 2 lines
Ville Syrjälä Intel OTC
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Vivi, Rodrigo
maintainerRe: [PATCH 04/17] drm/i915/cnl: Allow dynamic cdclk changes on CNL
Quoted 102 lines · Imre Deak
Quoted 101 lines · Rodrigo
Quoted 99 lines · Imre Deak
Quoted 83 lines · Ville Syrjälä
Quoted 82 lines · Imre Deak
Quoted 61 lines · Ville Syrjälä
Quoted 60 lines · Rodrigo Vivi
All the low level cdclk bits are present, so let's add the required hooks to reconfigure cdclk on the fly.
v2: Rebase due to
cnl_sanitize_cdclk()
v3: Rebased by Rodrigo on top of Ville's cdclk rework.
v4: Rebase movingcnl_calc_cdclkup to follow same order
as previous platforms.
v2: Squash drm/i915/cnl: Adjust min pixel rate. to address
the current limitation where CDCLK cannot be set to 168MHz if audio is used with 96MHz. (Imre)Cc Imre Deak <[email protected]>Cc Dhinakaran Pandiyan <[email protected]>Signed-off-by Ville Syrjälä <[email protected]>Signed-off-by Rodrigo Vivi <[email protected]>Cannonlake also needs to adjust the minimal pixel rate as gen9 platforms. Specially for the Azalia audio case.
Cc Dhinakaran Pandiyan <[email protected]>Cc Sanyog Kale <[email protected]>Signed-off-by Rodrigo Vivi <[email protected]>--- drivers/gpu/drm/i915/intel_cdclk.c | 56 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 53 insertions(+), 3 deletions(-)drivers/gpu/drm/i915/intel_cdclk.c +11
-1@@ -1400,6 +1400,16 @@ void bxt_uninit_cdclk(struct drm_i915_private *dev_priv)bxt_set_cdclk (dev_priv, &cdclk_state); } +static int cnl_calc_cdclk (int max_pixclk) +{ +if (max_pixclk >336000 ) +return 528000 ; +else if (max_pixclk >168000 ) +return 336000 ; +else +return 168000 ; +} +static void cnl_cdclk_pll_update (struct drm_i915_private *dev_priv,struct intel_cdclk_state *cdclk_state) {@@ -1641,7 +1651,7 @@ void cnl_init_cdclk(struct drm_i915_private *dev_priv) cdclk_state = dev_priv->cdclk.hw; - cdclk_state.cdclk =168000 ; + cdclk_state.cdclk =cnl_calc_cdclk (0 ); cdclk_state.vco =cnl_cdclk_pll_vco (dev_priv, cdclk_state.cdclk);cnl_set_cdclk (dev_priv, &cdclk_state);@@ -1768,7 +1778,7 @@ static int intel_max_pixel_rate(struct drm_atomic_state *state) pixel_rate = crtc_state->pixel_rate;Quoted 8 lines
drivers/gpu/drm/i915/intel_cdclk.c static int intel_max_pixel_rate(struct drm_atomic_state *state) · line 1784
Quoted 5 lines
drivers/gpu/drm/i915/intel_cdclk.c +1
-1-if (IS_BROADWELL (dev_priv) ||IS_GEN9 (dev_priv)) +if (IS_BROADWELL (dev_priv) ||INTEL_GEN (dev_priv) >=9 ) pixel_rate =bdw_adjust_min_pipe_pixel_rate (crtc_state, pixel_rate);I think you might also have to adjust some of the clock limits within
bdw_adjust_min_pipe_pixel_rate().Yes, we missed this. The DP/HBR2/4-lanes/audio workaround on CNL is the same as on GLK. So in
bdw_adjust_min_pipe_pixel_rate()we could use the same limits as on GLK, except I don't understand the 2x multiplier there in
pixel_rate=max(2 * 316800, pixel_rate);and
pixel_rate=max(2 * 2 * 96000, pixel_rate);Quoted 7 lines
Quoted 2 lines
This
pixel_ratevalue will be compared against CDCLK limit values inglk_calc_cdclk()It's going to compare against 2*cdclk. But that doesn't mean it isn't extremely confusing. To make it more sane, I think we should probably s/min_pixclk/min_cdclk/ and actually track the "min acceptable cdclk" rather than "the pixel rate corresponding to the min acceptable cdclk".
Arr, correct. And now I found in BSpec how to calculate cdclk for a given dotclock. So yes, the GLK part is correct, sorry for the noise.
However. For CNL the target CDCLK calculation should be the same as for GLK, based on the "GEN10 Resolution Support". So as an example there if the max pixel rate is 299MHz we can use a CDCLK of 168MHz. With the current code we'd use a CDCLK of 336MHz. Is that correct?
Quoted 8 lines
Quoted 5 lines
on current cnl code 2-pixel-per-clock is disabled. I got a conflict and decided to take a look after upstreaming the basic support.
So I believe the current code is the correct one, right?! (But honestly I'm a bit lost here)
Ok, found that internal patch now, with that the current code looks ok. Would make sense to add a note about this to the commit message.
What about: "Note: Current CNL code doesn't support 2 pixel per clock. All 2*cdclk that is currently in place for GLK doesn't apply for CNL for now."
with that can I keep your rv-b? and apply the comment when merging?
Quoted 82 lines
Quoted 82 lines
Quoted 82 lines
Quoted 82 lines
Quoted 81 lines
not CD2XCLK limit values. Removing the 2x multiplier
from the abovepixel_ratevalues wouldn't change anything on GLK AFAICS and it would allow us to use the same code to calculate these on GLK and CNL (and simplify the secondpixel_ratecalculation).--Imre
Quoted 70 lines
Quoted 66 lines
drivers/gpu/drm/i915/intel_cdclk.c +41
-1@@ -1929,6 +1939,40 @@ static int bxt_modeset_calc_cdclk(struct drm_atomic_state *state)return 0 ; } +static int cnl_modeset_calc_cdclk (struct drm_atomic_state *state) +{ +struct drm_i915_private *dev_priv =to_i915 (state->dev); +struct intel_atomic_state *intel_state = +to_intel_atomic_state (state); +int max_pixclk =intel_max_pixel_rate (state); +int cdclk, vco; + + cdclk =cnl_calc_cdclk (max_pixclk); + vco =cnl_cdclk_pll_vco (dev_priv, cdclk); + +if (cdclk > dev_priv->max_cdclk_freq) { +DRM_DEBUG_KMS ("requested cdclk (%d kHz) exceeds max (%d kHz)\n" , + cdclk, dev_priv->max_cdclk_freq); +return -EINVAL ; + } + + intel_state->cdclk.logical.vco = vco; + intel_state->cdclk.logical.cdclk = cdclk; + +if (!intel_state->active_crtcs) { + cdclk =cnl_calc_cdclk (0 ); + vco =cnl_cdclk_pll_vco (dev_priv, cdclk); + + intel_state->cdclk.actual.vco = vco; + intel_state->cdclk.actual.cdclk = cdclk; + }else { + intel_state->cdclk.actual = + intel_state->cdclk.logical; + } + +return 0 ; +} +static int intel_compute_max_dotclk (struct drm_i915_private *dev_priv) {int max_cdclk_freq = dev_priv->max_cdclk_freq;@@ -1960,7 +2004,9 @@ static int intel_compute_max_dotclk(struct drm_i915_private *dev_priv)*/ void intel_update_max_cdclk (struct drm_i915_private *dev_priv) { -if (IS_GEN9_BC (dev_priv)) { +if (IS_CANNONLAKE (dev_priv)) { + dev_priv->max_cdclk_freq =528000 ; + }else if (IS_GEN9_BC (dev_priv)) {u32 limit =I915_READ (SKL_DFSM ) &SKL_DFSM_CDCLK_LIMIT_MASK ;int max_cdclk, vco;@@ -2157,6 +2203,10 @@ void intel_init_cdclk_hooks(struct drm_i915_private *dev_priv) dev_priv->display.set_cdclk = skl_set_cdclk; dev_priv->display.modeset_calc_cdclk = skl_modeset_calc_cdclk; + }else if (IS_CANNONLAKE (dev_priv)) { + dev_priv->display.set_cdclk = cnl_set_cdclk; + dev_priv->display.modeset_calc_cdclk = + cnl_modeset_calc_cdclk; }if (IS_CANNONLAKE (dev_priv))Signature · 1 line
1.9.1Signature · 2 lines
Ville Syrjälä Intel OTC
Quoted 4 lines
Quoted 4 lines
Quoted 3 lines
Quoted 3 lines
Signature · 2 lines
Ville Syrjälä Intel OTC
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 04/17] drm/i915/cnl: Allow dynamic cdclk changes on CNL
Quoted 109 lines · Rodrigo
Quoted 108 lines · Imre Deak
Quoted 106 lines · Rodrigo
Quoted 92 lines · Imre Deak
Quoted 83 lines · Ville Syrjälä
Quoted 82 lines · Imre Deak
Quoted 61 lines · Ville Syrjälä
Quoted 60 lines · Rodrigo Vivi
All the low level cdclk bits are present, so let's add the required hooks to reconfigure cdclk on the fly.
v2: Rebase due to
cnl_sanitize_cdclk()
v3: Rebased by Rodrigo on top of Ville's cdclk rework.
v4: Rebase movingcnl_calc_cdclkup to follow same order
as previous platforms.
v2: Squash drm/i915/cnl: Adjust min pixel rate. to address
the current limitation where CDCLK cannot be set to 168MHz if audio is used with 96MHz. (Imre)Cc Imre Deak <[email protected]>Cc Dhinakaran Pandiyan <[email protected]>Signed-off-by Ville Syrjälä <[email protected]>Signed-off-by Rodrigo Vivi <[email protected]>Cannonlake also needs to adjust the minimal pixel rate as gen9 platforms. Specially for the Azalia audio case.
Cc Dhinakaran Pandiyan <[email protected]>Cc Sanyog Kale <[email protected]>Signed-off-by Rodrigo Vivi <[email protected]>--- drivers/gpu/drm/i915/intel_cdclk.c | 56 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 53 insertions(+), 3 deletions(-)drivers/gpu/drm/i915/intel_cdclk.c +11
-1@@ -1400,6 +1400,16 @@ void bxt_uninit_cdclk(struct drm_i915_private *dev_priv)bxt_set_cdclk (dev_priv, &cdclk_state); } +static int cnl_calc_cdclk (int max_pixclk) +{ +if (max_pixclk >336000 ) +return 528000 ; +else if (max_pixclk >168000 ) +return 336000 ; +else +return 168000 ; +} +static void cnl_cdclk_pll_update (struct drm_i915_private *dev_priv,struct intel_cdclk_state *cdclk_state) {@@ -1641,7 +1651,7 @@ void cnl_init_cdclk(struct drm_i915_private *dev_priv) cdclk_state = dev_priv->cdclk.hw; - cdclk_state.cdclk =168000 ; + cdclk_state.cdclk =cnl_calc_cdclk (0 ); cdclk_state.vco =cnl_cdclk_pll_vco (dev_priv, cdclk_state.cdclk);cnl_set_cdclk (dev_priv, &cdclk_state);@@ -1768,7 +1778,7 @@ static int intel_max_pixel_rate(struct drm_atomic_state *state) pixel_rate = crtc_state->pixel_rate;Quoted 8 lines
drivers/gpu/drm/i915/intel_cdclk.c static int intel_max_pixel_rate(struct drm_atomic_state *state) · line 1784
Quoted 5 lines
drivers/gpu/drm/i915/intel_cdclk.c +1
-1-if (IS_BROADWELL (dev_priv) ||IS_GEN9 (dev_priv)) +if (IS_BROADWELL (dev_priv) ||INTEL_GEN (dev_priv) >=9 ) pixel_rate =bdw_adjust_min_pipe_pixel_rate (crtc_state, pixel_rate);I think you might also have to adjust some of the clock limits within
bdw_adjust_min_pipe_pixel_rate().Yes, we missed this. The DP/HBR2/4-lanes/audio workaround on CNL is the same as on GLK. So in
bdw_adjust_min_pipe_pixel_rate()we could use the same limits as on GLK, except I don't understand the 2x multiplier there in
pixel_rate=max(2 * 316800, pixel_rate);and
pixel_rate=max(2 * 2 * 96000, pixel_rate);Quoted 7 lines
Quoted 2 lines
This
pixel_ratevalue will be compared against CDCLK limit values inglk_calc_cdclk()It's going to compare against 2*cdclk. But that doesn't mean it isn't extremely confusing. To make it more sane, I think we should probably s/min_pixclk/min_cdclk/ and actually track the "min acceptable cdclk" rather than "the pixel rate corresponding to the min acceptable cdclk".
Quoted 7 lines
Arr, correct. And now I found in BSpec how to calculate cdclk for a given dotclock. So yes, the GLK part is correct, sorry for the noise.
However. For CNL the target CDCLK calculation should be the same as for GLK, based on the "GEN10 Resolution Support". So as an example there if the max pixel rate is 299MHz we can use a CDCLK of 168MHz. With the current code we'd use a CDCLK of 336MHz. Is that correct?
on current cnl code 2-pixel-per-clock is disabled. I got a conflict and decided to take a look after upstreaming the basic support.
So I believe the current code is the correct one, right?! (But honestly I'm a bit lost here)
Quoted 6 lines
Quoted 2 lines
Ok, found that internal patch now, with that the current code looks ok. Would make sense to add a note about this to the commit message.
What about: "Note: Current CNL code doesn't support 2 pixel per clock. All 2*cdclk that is currently in place for GLK doesn't apply for CNL for now."
Yes looks ok. Should've noticed the difference in any case during my review:/
Quoted 1 line
with that can I keep your rv-b? and apply the comment when merging?
The DP/4-lane WA limit in bdw_adjust_min_pipe_pixel_rate() should be still adjusted for CNL as Ville hinted. So you need to add there a
if IS_CANONLAKE()
pixel_rate = max(316800, pixel_rate); else if IS_GEMINILAKE() pixel_rate = max(2 * 316800, pixel_rate);
--Imre
Quoted 83 lines
Quoted 83 lines
Quoted 83 lines
Quoted 83 lines
Quoted 83 lines
Quoted 82 lines
not CD2XCLK limit values. Removing the 2x multiplier
from the abovepixel_ratevalues wouldn't change anything on GLK AFAICS and it would allow us to use the same code to calculate these on GLK and CNL (and simplify the secondpixel_ratecalculation).--Imre
Quoted 70 lines
Quoted 66 lines
drivers/gpu/drm/i915/intel_cdclk.c +41
-1@@ -1929,6 +1939,40 @@ static int bxt_modeset_calc_cdclk(struct drm_atomic_state *state)return 0 ; } +static int cnl_modeset_calc_cdclk (struct drm_atomic_state *state) +{ +struct drm_i915_private *dev_priv =to_i915 (state->dev); +struct intel_atomic_state *intel_state = +to_intel_atomic_state (state); +int max_pixclk =intel_max_pixel_rate (state); +int cdclk, vco; + + cdclk =cnl_calc_cdclk (max_pixclk); + vco =cnl_cdclk_pll_vco (dev_priv, cdclk); + +if (cdclk > dev_priv->max_cdclk_freq) { +DRM_DEBUG_KMS ("requested cdclk (%d kHz) exceeds max (%d kHz)\n" , + cdclk, dev_priv->max_cdclk_freq); +return -EINVAL ; + } + + intel_state->cdclk.logical.vco = vco; + intel_state->cdclk.logical.cdclk = cdclk; + +if (!intel_state->active_crtcs) { + cdclk =cnl_calc_cdclk (0 ); + vco =cnl_cdclk_pll_vco (dev_priv, cdclk); + + intel_state->cdclk.actual.vco = vco; + intel_state->cdclk.actual.cdclk = cdclk; + }else { + intel_state->cdclk.actual = + intel_state->cdclk.logical; + } + +return 0 ; +} +static int intel_compute_max_dotclk (struct drm_i915_private *dev_priv) {int max_cdclk_freq = dev_priv->max_cdclk_freq;@@ -1960,7 +2004,9 @@ static int intel_compute_max_dotclk(struct drm_i915_private *dev_priv)*/ void intel_update_max_cdclk (struct drm_i915_private *dev_priv) { -if (IS_GEN9_BC (dev_priv)) { +if (IS_CANNONLAKE (dev_priv)) { + dev_priv->max_cdclk_freq =528000 ; + }else if (IS_GEN9_BC (dev_priv)) {u32 limit =I915_READ (SKL_DFSM ) &SKL_DFSM_CDCLK_LIMIT_MASK ;int max_cdclk, vco;@@ -2157,6 +2203,10 @@ void intel_init_cdclk_hooks(struct drm_i915_private *dev_priv) dev_priv->display.set_cdclk = skl_set_cdclk; dev_priv->display.modeset_calc_cdclk = skl_modeset_calc_cdclk; + }else if (IS_CANNONLAKE (dev_priv)) { + dev_priv->display.set_cdclk = cnl_set_cdclk; + dev_priv->display.modeset_calc_cdclk = + cnl_modeset_calc_cdclk; }if (IS_CANNONLAKE (dev_priv))Signature · 1 line
1.9.1Signature · 2 lines
Ville Syrjälä Intel OTC
Quoted 5 lines
Quoted 4 lines
Quoted 4 lines
Quoted 3 lines
Quoted 3 lines
Signature · 2 lines
Ville Syrjälä Intel OTC
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Vivi, Rodrigo
maintainerRe: [PATCH 04/17] drm/i915/cnl: Allow dynamic cdclk changes on CNL
Quoted 122 lines · Imre Deak
Quoted 109 lines · Rodrigo
Quoted 108 lines · Imre Deak
Quoted 106 lines · Rodrigo
Quoted 92 lines · Imre Deak
Quoted 83 lines · Ville Syrjälä
Quoted 82 lines · Imre Deak
Quoted 61 lines · Ville Syrjälä
Quoted 60 lines · Rodrigo Vivi
All the low level cdclk bits are present, so let's add the required hooks to reconfigure cdclk on the fly.
v2: Rebase due to
cnl_sanitize_cdclk()
v3: Rebased by Rodrigo on top of Ville's cdclk rework.
v4: Rebase movingcnl_calc_cdclkup to follow same order
as previous platforms.
v2: Squash drm/i915/cnl: Adjust min pixel rate. to address
the current limitation where CDCLK cannot be set to 168MHz if audio is used with 96MHz. (Imre)Cc Imre Deak <[email protected]>Cc Dhinakaran Pandiyan <[email protected]>Signed-off-by Ville Syrjälä <[email protected]>Signed-off-by Rodrigo Vivi <[email protected]>Cannonlake also needs to adjust the minimal pixel rate as gen9 platforms. Specially for the Azalia audio case.
Cc Dhinakaran Pandiyan <[email protected]>Cc Sanyog Kale <[email protected]>Signed-off-by Rodrigo Vivi <[email protected]>--- drivers/gpu/drm/i915/intel_cdclk.c | 56 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 53 insertions(+), 3 deletions(-)drivers/gpu/drm/i915/intel_cdclk.c +11
-1@@ -1400,6 +1400,16 @@ void bxt_uninit_cdclk(struct drm_i915_private *dev_priv)bxt_set_cdclk (dev_priv, &cdclk_state); } +static int cnl_calc_cdclk (int max_pixclk) +{ +if (max_pixclk >336000 ) +return 528000 ; +else if (max_pixclk >168000 ) +return 336000 ; +else +return 168000 ; +} +static void cnl_cdclk_pll_update (struct drm_i915_private *dev_priv,struct intel_cdclk_state *cdclk_state) {@@ -1641,7 +1651,7 @@ void cnl_init_cdclk(struct drm_i915_private *dev_priv) cdclk_state = dev_priv->cdclk.hw; - cdclk_state.cdclk =168000 ; + cdclk_state.cdclk =cnl_calc_cdclk (0 ); cdclk_state.vco =cnl_cdclk_pll_vco (dev_priv, cdclk_state.cdclk);cnl_set_cdclk (dev_priv, &cdclk_state);@@ -1768,7 +1778,7 @@ static int intel_max_pixel_rate(struct drm_atomic_state *state) pixel_rate = crtc_state->pixel_rate;Quoted 8 lines
drivers/gpu/drm/i915/intel_cdclk.c static int intel_max_pixel_rate(struct drm_atomic_state *state) · line 1784
Quoted 5 lines
drivers/gpu/drm/i915/intel_cdclk.c +1
-1-if (IS_BROADWELL (dev_priv) ||IS_GEN9 (dev_priv)) +if (IS_BROADWELL (dev_priv) ||INTEL_GEN (dev_priv) >=9 ) pixel_rate =bdw_adjust_min_pipe_pixel_rate (crtc_state, pixel_rate);I think you might also have to adjust some of the clock limits within
bdw_adjust_min_pipe_pixel_rate().Yes, we missed this. The DP/HBR2/4-lanes/audio workaround on CNL is the same as on GLK. So in
bdw_adjust_min_pipe_pixel_rate()we could use the same limits as on GLK, except I don't understand the 2x multiplier there in
pixel_rate=max(2 * 316800, pixel_rate);and
pixel_rate=max(2 * 2 * 96000, pixel_rate);Quoted 7 lines
Quoted 2 lines
This
pixel_ratevalue will be compared against CDCLK limit values inglk_calc_cdclk()It's going to compare against 2*cdclk. But that doesn't mean it isn't extremely confusing. To make it more sane, I think we should probably s/min_pixclk/min_cdclk/ and actually track the "min acceptable cdclk" rather than "the pixel rate corresponding to the min acceptable cdclk".
Quoted 7 lines
Arr, correct. And now I found in BSpec how to calculate cdclk for a given dotclock. So yes, the GLK part is correct, sorry for the noise.
However. For CNL the target CDCLK calculation should be the same as for GLK, based on the "GEN10 Resolution Support". So as an example there if the max pixel rate is 299MHz we can use a CDCLK of 168MHz. With the current code we'd use a CDCLK of 336MHz. Is that correct?
on current cnl code 2-pixel-per-clock is disabled. I got a conflict and decided to take a look after upstreaming the basic support.
So I believe the current code is the correct one, right?! (But honestly I'm a bit lost here)
Quoted 6 lines
Quoted 2 lines
Ok, found that internal patch now, with that the current code looks ok. Would make sense to add a note about this to the commit message.
What about: "Note: Current CNL code doesn't support 2 pixel per clock. All 2*cdclk that is currently in place for GLK doesn't apply for CNL for now."
Yes looks ok. Should've noticed the difference in any case during my review:/
Quoted 1 line
with that can I keep your rv-b? and apply the comment when merging?
Quoted 8 lines
The DP/4-lane WA limit in
bdw_adjust_min_pipe_pixel_rate()should be still adjusted for CNL as Ville hinted. So you need to add there aif
IS_CANONLAKE()pixel_rate = max(316800, pixel_rate); else if IS_GEMINILAKE() pixel_rate = max(2 * 316800, pixel_rate);
oh, indeed!
So I will have to resubmit anyways.
Thanks.
Quoted 90 lines
--Imre
Quoted 88 lines
Quoted 87 lines
Quoted 87 lines
Quoted 86 lines
Quoted 86 lines
Quoted 82 lines
not CD2XCLK limit values. Removing the 2x multiplier
from the abovepixel_ratevalues wouldn't change anything on GLK AFAICS and it would allow us to use the same code to calculate these on GLK and CNL (and simplify the secondpixel_ratecalculation).--Imre
Quoted 70 lines
Quoted 66 lines
drivers/gpu/drm/i915/intel_cdclk.c +41
-1@@ -1929,6 +1939,40 @@ static int bxt_modeset_calc_cdclk(struct drm_atomic_state *state)return 0 ; } +static int cnl_modeset_calc_cdclk (struct drm_atomic_state *state) +{ +struct drm_i915_private *dev_priv =to_i915 (state->dev); +struct intel_atomic_state *intel_state = +to_intel_atomic_state (state); +int max_pixclk =intel_max_pixel_rate (state); +int cdclk, vco; + + cdclk =cnl_calc_cdclk (max_pixclk); + vco =cnl_cdclk_pll_vco (dev_priv, cdclk); + +if (cdclk > dev_priv->max_cdclk_freq) { +DRM_DEBUG_KMS ("requested cdclk (%d kHz) exceeds max (%d kHz)\n" , + cdclk, dev_priv->max_cdclk_freq); +return -EINVAL ; + } + + intel_state->cdclk.logical.vco = vco; + intel_state->cdclk.logical.cdclk = cdclk; + +if (!intel_state->active_crtcs) { + cdclk =cnl_calc_cdclk (0 ); + vco =cnl_cdclk_pll_vco (dev_priv, cdclk); + + intel_state->cdclk.actual.vco = vco; + intel_state->cdclk.actual.cdclk = cdclk; + }else { + intel_state->cdclk.actual = + intel_state->cdclk.logical; + } + +return 0 ; +} +static int intel_compute_max_dotclk (struct drm_i915_private *dev_priv) {int max_cdclk_freq = dev_priv->max_cdclk_freq;@@ -1960,7 +2004,9 @@ static int intel_compute_max_dotclk(struct drm_i915_private *dev_priv)*/ void intel_update_max_cdclk (struct drm_i915_private *dev_priv) { -if (IS_GEN9_BC (dev_priv)) { +if (IS_CANNONLAKE (dev_priv)) { + dev_priv->max_cdclk_freq =528000 ; + }else if (IS_GEN9_BC (dev_priv)) {u32 limit =I915_READ (SKL_DFSM ) &SKL_DFSM_CDCLK_LIMIT_MASK ;int max_cdclk, vco;@@ -2157,6 +2203,10 @@ void intel_init_cdclk_hooks(struct drm_i915_private *dev_priv) dev_priv->display.set_cdclk = skl_set_cdclk; dev_priv->display.modeset_calc_cdclk = skl_modeset_calc_cdclk; + }else if (IS_CANNONLAKE (dev_priv)) { + dev_priv->display.set_cdclk = cnl_set_cdclk; + dev_priv->display.modeset_calc_cdclk = + cnl_modeset_calc_cdclk; }if (IS_CANNONLAKE (dev_priv))Signature · 1 line
1.9.1Signature · 2 lines
Ville Syrjälä Intel OTCSignature · 2 lines
Ville Syrjälä Intel OTC
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 04/17] drm/i915/cnl: Allow dynamic cdclk changes on CNL
In reply to Imre DeakQuoted 76 lines · Imre Deak
Quoted 61 lines · Ville Syrjälä
Quoted 60 lines · Rodrigo Vivi
All the low level cdclk bits are present, so let's add the required hooks to reconfigure cdclk on the fly.
v2: Rebase due to
cnl_sanitize_cdclk()
v3: Rebased by Rodrigo on top of Ville's cdclk rework.
v4: Rebase movingcnl_calc_cdclkup to follow same order
as previous platforms.
v2: Squash drm/i915/cnl: Adjust min pixel rate. to address
the current limitation where CDCLK cannot be set to 168MHz if audio is used with 96MHz. (Imre)Cc Imre Deak <[email protected]>Cc Dhinakaran Pandiyan <[email protected]>Signed-off-by Ville Syrjälä <[email protected]>Signed-off-by Rodrigo Vivi <[email protected]>Cannonlake also needs to adjust the minimal pixel rate as gen9 platforms. Specially for the Azalia audio case.
Cc Dhinakaran Pandiyan <[email protected]>Cc Sanyog Kale <[email protected]>Signed-off-by Rodrigo Vivi <[email protected]>--- drivers/gpu/drm/i915/intel_cdclk.c | 56 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 53 insertions(+), 3 deletions(-)drivers/gpu/drm/i915/intel_cdclk.c +11
-1@@ -1400,6 +1400,16 @@ void bxt_uninit_cdclk(struct drm_i915_private *dev_priv)bxt_set_cdclk (dev_priv, &cdclk_state); } +static int cnl_calc_cdclk (int max_pixclk) +{ +if (max_pixclk >336000 ) +return 528000 ; +else if (max_pixclk >168000 ) +return 336000 ; +else +return 168000 ; +} +static void cnl_cdclk_pll_update (struct drm_i915_private *dev_priv,struct intel_cdclk_state *cdclk_state) {@@ -1641,7 +1651,7 @@ void cnl_init_cdclk(struct drm_i915_private *dev_priv) cdclk_state = dev_priv->cdclk.hw; - cdclk_state.cdclk =168000 ; + cdclk_state.cdclk =cnl_calc_cdclk (0 ); cdclk_state.vco =cnl_cdclk_pll_vco (dev_priv, cdclk_state.cdclk);cnl_set_cdclk (dev_priv, &cdclk_state);@@ -1768,7 +1778,7 @@ static int intel_max_pixel_rate(struct drm_atomic_state *state) pixel_rate = crtc_state->pixel_rate;Quoted 8 lines
drivers/gpu/drm/i915/intel_cdclk.c static int intel_max_pixel_rate(struct drm_atomic_state *state) · line 1784
Quoted 5 lines
drivers/gpu/drm/i915/intel_cdclk.c +1
-1-if (IS_BROADWELL (dev_priv) ||IS_GEN9 (dev_priv)) +if (IS_BROADWELL (dev_priv) ||INTEL_GEN (dev_priv) >=9 ) pixel_rate =bdw_adjust_min_pipe_pixel_rate (crtc_state, pixel_rate);I think you might also have to adjust some of the clock limits within
bdw_adjust_min_pipe_pixel_rate().Yes, we missed this. The DP/HBR2/4-lanes/audio workaround on CNL is the same as on GLK. So in
bdw_adjust_min_pipe_pixel_rate()we could use the same limits as on GLK, except I don't understand the 2x multiplier there in
Quoted 6 lines
pixel_rate=max(2 * 316800, pixel_rate);and
pixel_rate=max(2 * 2 * 96000, pixel_rate);
If pixel_rate was returned as 192 MHz for the Azalia workaround. glk_calc_cdclk() has
if (max_pixclk > DIV_ROUND_UP(2 * 158400 * 99, 100))
return 316800;
else if (max_pixclk > DIV_ROUND_UP(2 * 79200 * 99, 100))
return 158400;
else
return 79200;We'll end up selecting 158.4 MHz as cdclk. But BSpec explicitly says "158.4 MHz CD (cannot be used when audio is enabled and Azalia BCLK is 96 MHz. Am I missing something here?
Quoted 78 lines
This
pixel_ratevalue will be compared against CDCLK limit values inglk_calc_cdclk()not CD2XCLK limit values. Removing the 2x multiplier from the abovepixel_ratevalues wouldn't change anything on GLK AFAICS and it would allow us to use the same code to calculate these on GLK and CNL (and simplify the secondpixel_ratecalculation).--Imre
Quoted 63 lines
Quoted 63 lines
drivers/gpu/drm/i915/intel_cdclk.c +41
-1@@ -1929,6 +1939,40 @@ static int bxt_modeset_calc_cdclk(struct drm_atomic_state *state)return 0 ; } +static int cnl_modeset_calc_cdclk (struct drm_atomic_state *state) +{ +struct drm_i915_private *dev_priv =to_i915 (state->dev); +struct intel_atomic_state *intel_state = +to_intel_atomic_state (state); +int max_pixclk =intel_max_pixel_rate (state); +int cdclk, vco; + + cdclk =cnl_calc_cdclk (max_pixclk); + vco =cnl_cdclk_pll_vco (dev_priv, cdclk); + +if (cdclk > dev_priv->max_cdclk_freq) { +DRM_DEBUG_KMS ("requested cdclk (%d kHz) exceeds max (%d kHz)\n" , + cdclk, dev_priv->max_cdclk_freq); +return -EINVAL ; + } + + intel_state->cdclk.logical.vco = vco; + intel_state->cdclk.logical.cdclk = cdclk; + +if (!intel_state->active_crtcs) { + cdclk =cnl_calc_cdclk (0 ); + vco =cnl_cdclk_pll_vco (dev_priv, cdclk); + + intel_state->cdclk.actual.vco = vco; + intel_state->cdclk.actual.cdclk = cdclk; + }else { + intel_state->cdclk.actual = + intel_state->cdclk.logical; + } + +return 0 ; +} +static int intel_compute_max_dotclk (struct drm_i915_private *dev_priv) {int max_cdclk_freq = dev_priv->max_cdclk_freq;@@ -1960,7 +2004,9 @@ static int intel_compute_max_dotclk(struct drm_i915_private *dev_priv)*/ void intel_update_max_cdclk (struct drm_i915_private *dev_priv) { -if (IS_GEN9_BC (dev_priv)) { +if (IS_CANNONLAKE (dev_priv)) { + dev_priv->max_cdclk_freq =528000 ; + }else if (IS_GEN9_BC (dev_priv)) {u32 limit =I915_READ (SKL_DFSM ) &SKL_DFSM_CDCLK_LIMIT_MASK ;int max_cdclk, vco;@@ -2157,6 +2203,10 @@ void intel_init_cdclk_hooks(struct drm_i915_private *dev_priv) dev_priv->display.set_cdclk = skl_set_cdclk; dev_priv->display.modeset_calc_cdclk = skl_modeset_calc_cdclk; + }else if (IS_CANNONLAKE (dev_priv)) { + dev_priv->display.set_cdclk = cnl_set_cdclk; + dev_priv->display.modeset_calc_cdclk = + cnl_modeset_calc_cdclk; }Quoted 7 lines
Quoted 3 lines
drivers/gpu/drm/i915/intel_cdclk.c +0
-0if (IS_CANNONLAKE (dev_priv))Signature · 1 line
1.9.1Signature · 2 lines
Ville Syrjälä Intel OTC
Quoted 4 lines
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Rodrigo Vivi
maintainerPATCH 5/17 drm/i915/cnl: DDI - PLL mapping
In reply to Rodrigo ViviOne of the steps for PLL (un)initialization is to (un)map the correspondent DDI that is actually using that PLL.
So, let's do this step following the places already stablished and used so far, although spec put this as part of PLL initialization sequences.
v2: Use proper prefix on bits names as suggested by Ander.
v3: Add missed "~". Without that the logic was inverted
so we were disabling interrupts.
Credits-to: Clinton
Credits-to: Art
v4: Spec is getting updated to do DDI -> PLL mapping
and clock on in 2 separated reg writes. (Paulo) Also update bits definitions to use space
(1 << 1) instead of (1<<1). (Paulo)
--- drivers/gpu/drm/i915/i915_reg.h | 9 +++++++++ drivers/gpu/drm/i915/intel_ddi.c | 23 ++++++++++++++++++++--- 2 files changed, 29 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/i915_reg.h +9 -0
@@ -8134,6 +8134,15 @@ enum {#define DPLL_CFGCR1 (id) _MMIO_PIPE((id) - SKL_DPLL1, _DPLL1_CFGCR1, _DPLL2_CFGCR1)#define DPLL_CFGCR2 (id) _MMIO_PIPE((id) - SKL_DPLL1, _DPLL1_CFGCR2, _DPLL2_CFGCR2) +/* +* CNL Clocks +*/ +#define DPCLKA_CFGCR0 _MMIO(0x6C200) +#define DPCLKA_CFGCR0_DDI_CLK_OFF (port) (1 << ((port)+10)) +#define DPCLKA_CFGCR0_DDI_CLK_SEL_MASK (port) (3 << ((port)*2)) +#define DPCLKA_CFGCR0_DDI_CLK_SEL_SHIFT (port) ((port)*2) +#define DPCLKA_CFGCR0_DDI_CLK_SEL (pll, port) ((pll) << ((port)*2)) +/* BXT display engine PLL */ #define BXT_DE_PLL_CTL _MMIO(0x6d000)#define BXT_DE_PLL_RATIO (x) (x)/* {60,65,100} * 19.2MHz */
drivers/gpu/drm/i915/intel_ddi.c +20 -3
@@ -1621,13 +1621,27 @@ static void intel_ddi_clk_select(struct intel_encoder *encoder, {struct drm_i915_private *dev_priv =to_i915 (encoder->base.dev);enum port port =intel_ddi_get_encoder_port (encoder); +uint32_t val;if (WARN_ON (!pll))return ; -if (IS_GEN9_BC (dev_priv)) { -uint32_t val; +if (IS_CANNONLAKE (dev_priv)) { +/* Configure DPCLKA_CFGCR0 to map the DPLL to the DDI. */ + val =I915_READ (DPCLKA_CFGCR0 ); + val |=DPCLKA_CFGCR0_DDI_CLK_SEL (pll->id, port); +I915_WRITE (DPCLKA_CFGCR0 , val); +/* +* Configure DPCLKA_CFGCR0 to turn on the clock for the DDI. +* This step and the step before must be done with separate +* register writes. +*/ + val =I915_READ (DPCLKA_CFGCR0 ); + val &= ~(DPCLKA_CFGCR0_DDI_CLK_OFF (port) | +DPCLKA_CFGCR0_DDI_CLK_SEL_MASK (port)); +I915_WRITE (DPCLKA_CFGCR0 , val); + }else if (IS_GEN9_BC (dev_priv)) {/* DDI -> PLL mapping */ val =I915_READ (DPLL_CTRL2 );
@@ -1767,7 +1781,10 @@ static void intel_ddi_post_disable(struct intel_encoder *intel_encoder,if (dig_port)intel_display_power_put (dev_priv, dig_port->ddi_io_power_domain); -if (IS_GEN9_BC (dev_priv)) +if (IS_CANNONLAKE (dev_priv)) +I915_WRITE (DPCLKA_CFGCR0 ,I915_READ (DPCLKA_CFGCR0 ) | +DPCLKA_CFGCR0_DDI_CLK_OFF (port)); +else if (IS_GEN9_BC (dev_priv))I915_WRITE (DPLL_CTRL2 , (I915_READ (DPLL_CTRL2 ) |DPLL_CTRL2_DDI_CLK_OFF (port)));else if (INTEL_GEN (dev_priv) <9 )
Signature · 6 lines
1.9.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Rodrigo Vivi
maintainerPATCH 6/17 drm/i915: Configure DPLL's for Cannonlake
In reply to Rodrigo ViviFrom: "Kahola, Mika" <[email protected]>
DPLL's are defined in DPCLKA_CFGCR0 register (0x6C200). Let's use these definitions when computing dpll's for ddi ports.
v2: (Rodrigo) Remove register that was defined in another patch with
fixed name and more bits.
--- drivers/gpu/drm/i915/intel_display.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_display.c +19 -1
@@ -8874,6 +8874,22 @@ static int haswell_crtc_compute_clock(struct intel_crtc *crtc,return 0 ; } +static void cannonlake_get_ddi_pll (struct drm_i915_private *dev_priv, +enum port port, +struct intel_crtc_state *pipe_config) +{ +enum intel_dpll_id id; +u32 temp; + + temp =I915_READ (DPCLKA_CFGCR0 ) &DPCLKA_CFGCR0_DDI_CLK_SEL_MASK (port); + id = temp >> (port *2 ); + +if (WARN_ON (id <SKL_DPLL0 || id >SKL_DPLL2 )) +return ; + + pipe_config->shared_dpll =intel_get_shared_dpll_by_id (dev_priv, id); +} +static void bxt_get_ddi_pll (struct drm_i915_private *dev_priv,enum port port,struct intel_crtc_state *pipe_config)
@@ -9061,7 +9077,9 @@ static void haswell_get_ddi_port_state(struct intel_crtc *crtc, port = (tmp &TRANS_DDI_PORT_MASK ) >>TRANS_DDI_PORT_SHIFT ; -if (IS_GEN9_BC (dev_priv)) +if (IS_CANNONLAKE (dev_priv)) +cannonlake_get_ddi_pll (dev_priv, port, pipe_config); +else if (IS_GEN9_BC (dev_priv))skylake_get_ddi_pll (dev_priv, port, pipe_config);else if (IS_GEN9_LP (dev_priv))bxt_get_ddi_pll (dev_priv, port, pipe_config);
Signature · 6 lines
1.9.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Rodrigo Vivi
maintainerPATCH 7/17 drm/i915/cnl: Initialize PLLs
In reply to Rodrigo ViviAlthough CNL follows PLL initialization more like Skylake than Broxton we have a completely different initialization sequence and registers used.
One big difference from SKL is that CDCLK PLL is now exclusive (ADPLL) and for DDIs and MIPI we need to use DFGPLLs 0, 1 or 2.
v2: Accept all Ander's suggestions and fixes:
- Registers and bits names prefix
- Group pll functions
- bits masks fixes
- remove read and modify on cfgcr1
- fix cfgcr0 setup
v3: Set SSC_ENABLE for DP.
Fix HDMI_MODE cfgcr0.
Avoid touch cfgcr0 on DP.
Add missed else on dpll_mgr definition so we use cnl one, not hsw.
v3: Centra freq should be always set to default and change bits
definitions to (1 << 1) instead of (1<<1). (by Paulo)
v4: Rebased.
--- drivers/gpu/drm/i915/i915_reg.h | 48 ++++++ drivers/gpu/drm/i915/intel_dpll_mgr.c | 300 +++++++++++++++++++++++++++++++++- drivers/gpu/drm/i915/intel_dpll_mgr.h | 4 + 3 files changed, 350 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/i915_reg.h +48 -0
@@ -60,6 +60,8 @@ static inline bool i915_mmio_reg_valid(i915_reg_t reg)#define _MMIO_PORT (port, a, b) _MMIO(_PORT(port, a, b))#define _MMIO_PIPE3 (pipe, a, b, c) _MMIO(_PICK(pipe, a, b, c))#define _MMIO_PORT3 (pipe, a, b, c) _MMIO(_PICK(pipe, a, b, c)) +#define _PLL (pll, a, b) ((a) + (pll)*((b)-(a))) +#define _MMIO_PLL (pll, a, b) _MMIO(_PLL(pll, a, b))#define _PHY3 (phy, ...) _PICK(phy, __VA_ARGS__)#define _MMIO_PHY3 (phy, a, b, c) _MMIO(_PHY3(phy, a, b, c))
@@ -8143,6 +8145,52 @@ enum {#define DPCLKA_CFGCR0_DDI_CLK_SEL_SHIFT (port) ((port)*2)#define DPCLKA_CFGCR0_DDI_CLK_SEL (pll, port) ((pll) << ((port)*2)) +/* CNL PLL */ +#define DPLL0_ENABLE 0x46010 +#define DPLL1_ENABLE 0x46014 +#define PLL_ENABLE (1 << 31) +#define PLL_LOCK (1 << 30) +#define PLL_POWER_ENABLE (1 << 27) +#define PLL_POWER_STATE (1 << 26) +#define CNL_DPLL_ENABLE (pll) _MMIO_PLL(pll, DPLL0_ENABLE, DPLL1_ENABLE) + +#define _CNL_DPLL0_CFGCR0 0x6C000 +#define _CNL_DPLL1_CFGCR0 0x6C080 +#define DPLL_CFGCR0_HDMI_MODE (1 << 30) +#define DPLL_CFGCR0_SSC_ENABLE (1 << 29) +#define DPLL_CFGCR0_LINK_RATE_MASK (0xf << 25) +#define DPLL_CFGCR0_LINK_RATE_2700 (0 << 25) +#define DPLL_CFGCR0_LINK_RATE_1350 (1 << 25) +#define DPLL_CFGCR0_LINK_RATE_810 (2 << 25) +#define DPLL_CFGCR0_LINK_RATE_1620 (3 << 25) +#define DPLL_CFGCR0_LINK_RATE_1080 (4 << 25) +#define DPLL_CFGCR0_LINK_RATE_2160 (5 << 25) +#define DPLL_CFGCR0_LINK_RATE_3240 (6 << 25) +#define DPLL_CFGCR0_LINK_RATE_4050 (7 << 25) +#define DPLL_CFGCR0_DCO_FRACTION_MASK (0x7fff << 10) +#define DPLL_CFGCR0_DCO_FRACTION (x) ((x) << 10) +#define DPLL_CFGCR0_DCO_INTEGER_MASK (0x3ff) +#define CNL_DPLL_CFGCR0 (pll) _MMIO_PLL(pll, _CNL_DPLL0_CFGCR0, _CNL_DPLL1_CFGCR0) + +#define _CNL_DPLL0_CFGCR1 0x6C004 +#define _CNL_DPLL1_CFGCR1 0x6C084 +#define DPLL_CFGCR1_QDIV_RATIO_MASK (0xff << 10) +#define DPLL_CFGCR1_QDIV_RATIO (x) ((x) << 10) +#define DPLL_CFGCR1_QDIV_MODE (x) ((x) << 9) +#define DPLL_CFGCR1_KDIV_MASK (7 << 6) +#define DPLL_CFGCR1_KDIV (x) ((x) << 6) +#define DPLL_CFGCR1_KDIV_1 (1 << 6) +#define DPLL_CFGCR1_KDIV_2 (2 << 6) +#define DPLL_CFGCR1_KDIV_4 (4 << 6) +#define DPLL_CFGCR1_PDIV_MASK (0xf << 2) +#define DPLL_CFGCR1_PDIV (x) ((x) << 2) +#define DPLL_CFGCR1_PDIV_2 (1 << 2) +#define DPLL_CFGCR1_PDIV_3 (2 << 2) +#define DPLL_CFGCR1_PDIV_5 (4 << 2) +#define DPLL_CFGCR1_PDIV_7 (8 << 2) +#define DPLL_CFGCR1_CENTRAL_FREQ (3 << 0) +#define CNL_DPLL_CFGCR1 (pll) _MMIO_PLL(pll, _CNL_DPLL0_CFGCR1, _CNL_DPLL1_CFGCR1) +/* BXT display engine PLL */ #define BXT_DE_PLL_CTL _MMIO(0x6d000)#define BXT_DE_PLL_RATIO (x) (x)/* {60,65,100} * 19.2MHz */
drivers/gpu/drm/i915/intel_dpll_mgr.c +298 -2
318 lines not on this page · raw message
drivers/gpu/drm/i915/intel_dpll_mgr.h +4 -0
@@ -128,6 +128,10 @@ struct intel_dpll_hw_state {/* HDMI only, 0 when used for DP */ uint32_t cfgcr1, cfgcr2; +/* cnl */ +uint32_t cfgcr0; +/* CNL also uses cfgcr1 */ +/* bxt */ uint32_t ebb0, ebb4, pll0, pll1, pll2, pll3, pll6, pll8, pll9, pll10, pcsdw12;
Signature · 6 lines
1.9.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Rodrigo Vivi
maintainerPATCH 8/17 drm/i915: Add MMIO helper for 6 ports with different offsets.
In reply to Rodrigo ViviAlso new registers can have different mmio offsets per different lane per port.
v2: Use _PICK as PORT3 instead of creating a new
macro with if per port.
v3: Use _PICK directly on MMIO_PORT6. While MMIO_PORT
isn't flexible enough let's continue with MMIO_PORT6 as we have MMIO_PORT3.
--- drivers/gpu/drm/i915/i915_reg.h | 3 +++ 1 file changed, 3 insertions(+)
drivers/gpu/drm/i915/i915_reg.h +3 -0
@@ -62,6 +62,9 @@ static inline bool i915_mmio_reg_valid(i915_reg_t reg)#define _MMIO_PORT3 (pipe, a, b, c) _MMIO(_PICK(pipe, a, b, c))#define _PLL (pll, a, b) ((a) + (pll)*((b)-(a)))#define _MMIO_PLL (pll, a, b) _MMIO(_PLL(pll, a, b)) +#define _MMIO_PORT6 (port, a, b, c, d, e, f) _MMIO(_PICK(port, a, b, c, d, e, f)) +#define _MMIO_PORT6_LN (port, ln, a0, a1, b, c, d, e, f) \ + _MMIO(_PICK(port, a0, b, c, d, e, f) + (ln * (a1 - a0)))#define _PHY3 (phy, ...) _PICK(phy, __VA_ARGS__)#define _MMIO_PHY3 (phy, a, b, c) _MMIO(_PHY3(phy, a, b, c))
Signature · 6 lines
1.9.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 08/17] drm/i915: Add MMIO helper for 6 ports with different offsets.
Quoted 20 lines · Rodrigo Vivi
Also new registers can have different mmio offsets per different lane per port.
v2: Use
_PICKas PORT3 instead of creating a new
macro with if per port.
v3: Use_PICKdirectly onMMIO_PORT6. WhileMMIO_PORT
isn't flexible enough let's continue withMMIO_PORT6as we haveMMIO_PORT3.Cc Manasi Navare <[email protected]>Signed-off-by Rodrigo Vivi <[email protected]>--- drivers/gpu/drm/i915/i915_reg.h | 3 +++ 1 file changed, 3 insertions(+)drivers/gpu/drm/i915/i915_reg.h +0
-0
drivers/gpu/drm/i915/i915_reg.h static inline bool i915_mmio_reg_valid(i915_reg_t reg) · line 67
Quoted 6 lines
drivers/gpu/drm/i915/i915_reg.h +3
-0@@ -62,6 +62,9 @@ static inline bool i915_mmio_reg_valid(i915_reg_t reg)#define _MMIO_PORT3 (pipe, a, b, c) _MMIO(_PICK(pipe, a, b, c))#define _PLL (pll, a, b) ((a) + (pll)*((b)-(a)))#define _MMIO_PLL (pll, a, b) _MMIO(_PLL(pll, a, b)) +#define _MMIO_PORT6 (port, a, b, c, d, e, f) _MMIO(_PICK(port, a, b, c, d, e, f)) +#define _MMIO_PORT6_LN (port, ln, a0, a1, b, c, d, e, f) \ + _MMIO(_PICK(port, a0, b, c, d, e, f) + (ln * (a1 - a0)))
Don't you want to remove the #define for _PORT6, now that MMIO_PORT6 directly uses _PICK
Manasi
Quoted 6 lines
drivers/gpu/drm/i915/i915_reg.h +0
-0#define _PHY3 (phy, ...) _PICK(phy, __VA_ARGS__)#define _MMIO_PHY3 (phy, a, b, c) _MMIO(_PHY3(phy, a, b, c))Signature · 1 line
1.9.1
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Vivi, Rodrigo
maintainerRe: [PATCH 08/17] drm/i915: Add MMIO helper for 6 ports with different offsets.
Quoted 16 lines · Manasi Navare
Quoted 15 lines · Rodrigo Vivi
Also new registers can have different mmio offsets per different lane per port.
v2: Use
_PICKas PORT3 instead of creating a new
macro with if per port.
v3: Use_PICKdirectly onMMIO_PORT6. WhileMMIO_PORT
isn't flexible enough let's continue withMMIO_PORT6as we haveMMIO_PORT3.Cc Manasi Navare <[email protected]>Signed-off-by Rodrigo Vivi <[email protected]>--- drivers/gpu/drm/i915/i915_reg.h | 3 +++ 1 file changed, 3 insertions(+)
Quoted 14 lines
drivers/gpu/drm/i915/i915_reg.h static inline bool i915_mmio_reg_valid(i915_reg_t reg) · line 67
Quoted 11 lines
drivers/gpu/drm/i915/i915_reg.h +3
-0@@ -62,6 +62,9 @@ static inline bool i915_mmio_reg_valid(i915_reg_t reg)#define _MMIO_PORT3 (pipe, a, b, c) _MMIO(_PICK(pipe, a, b, c))#define _PLL (pll, a, b) ((a) + (pll)*((b)-(a)))#define _MMIO_PLL (pll, a, b) _MMIO(_PLL(pll, a, b)) +#define _MMIO_PORT6 (port, a, b, c, d, e, f) _MMIO(_PICK(port, a, b, c, d, e, f)) +#define _MMIO_PORT6_LN (port, ln, a0, a1, b, c, d, e, f) \ + _MMIO(_PICK(port, a0, b, c, d, e, f) + (ln * (a1 - a0)))Don't you want to remove the #define for
_PORT6, now thatMMIO_PORT6directly uses_PICK
_PORT6 was removed... are you looking to the latest version?
I hope to remove _MMIO_PORT6 with the generic/flexible _MMIO_PORT...
Quoted 9 lines
Manasi
Quoted 6 lines
drivers/gpu/drm/i915/i915_reg.h +0
-0#define _PHY3 (phy, ...) _PICK(phy, __VA_ARGS__)#define _MMIO_PHY3 (phy, a, b, c) _MMIO(_PHY3(phy, a, b, c))Signature · 1 line
1.9.1
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Rodrigo Vivi
maintainerPATCH 9/17 drm/i915/cnl: Add registers related to voltage swing sequences.
In reply to Rodrigo ViviThis are the registers and bits needed for the voltage swing sequence on Cannonlake.
v2: Remove CL_DW5 that was wrongly defined.
v3: Use (1 << 1) instead of (1<<1) as Paulo suggested
Change DW2 swing sel upper and lower macros to do the bit selection instead of definint a table that doesn't match the spec. It is based on a Manasi version of it.
Credits-to: Manasi.
v4: Let SCALING_MODE_SEL flexible. (Manasi)
--- drivers/gpu/drm/i915/i915_reg.h | 140 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 140 insertions(+)
drivers/gpu/drm/i915/i915_reg.h +140 -0
@@ -1693,6 +1693,146 @@ enum skl_disp_power_wells {#define OCL2_LDOFUSE_PWR_DIS (1 << 6)#define BXT_PORT_CL1CM_DW30 (phy) _BXT_PHY((phy), _PORT_CL1CM_DW30_BC) +#define _CNL_PORT_PCS_DW1_GRP_AE 0x162304 +#define _CNL_PORT_PCS_DW1_GRP_B 0x162384 +#define _CNL_PORT_PCS_DW1_GRP_C 0x162B04 +#define _CNL_PORT_PCS_DW1_GRP_D 0x162B84 +#define _CNL_PORT_PCS_DW1_GRP_F 0x162A04 +#define _CNL_PORT_PCS_DW1_LN0_AE 0x162404 +#define _CNL_PORT_PCS_DW1_LN0_B 0x162604 +#define _CNL_PORT_PCS_DW1_LN0_C 0x162C04 +#define _CNL_PORT_PCS_DW1_LN0_D 0x162E04 +#define _CNL_PORT_PCS_DW1_LN0_F 0x162804 +#define CNL_PORT_PCS_DW1_GRP (port) _MMIO_PORT6(port, \ + _CNL_PORT_PCS_DW1_GRP_AE, \ + _CNL_PORT_PCS_DW1_GRP_B, \ + _CNL_PORT_PCS_DW1_GRP_C, \ + _CNL_PORT_PCS_DW1_GRP_D, \ + _CNL_PORT_PCS_DW1_GRP_AE, \ + _CNL_PORT_PCS_DW1_GRP_F) +#define CNL_PORT_PCS_DW1_LN0 (port) _MMIO_PORT6(port, \ + _CNL_PORT_PCS_DW1_LN0_AE, \ + _CNL_PORT_PCS_DW1_LN0_B, \ + _CNL_PORT_PCS_DW1_LN0_C, \ + _CNL_PORT_PCS_DW1_LN0_D, \ + _CNL_PORT_PCS_DW1_LN0_AE, \ + _CNL_PORT_PCS_DW1_LN0_F) +#define COMMON_KEEPER_EN (1 << 26) + +#define _CNL_PORT_TX_DW2_GRP_AE 0x162348 +#define _CNL_PORT_TX_DW2_GRP_B 0x1623C8 +#define _CNL_PORT_TX_DW2_GRP_C 0x162B48 +#define _CNL_PORT_TX_DW2_GRP_D 0x162BC8 +#define _CNL_PORT_TX_DW2_GRP_F 0x162A48 +#define _CNL_PORT_TX_DW2_LN0_AE 0x162448 +#define _CNL_PORT_TX_DW2_LN0_B 0x162648 +#define _CNL_PORT_TX_DW2_LN0_C 0x162C48 +#define _CNL_PORT_TX_DW2_LN0_D 0x162E48 +#define _CNL_PORT_TX_DW2_LN0_F 0x162A48 +#define CNL_PORT_TX_DW2_GRP (port) _MMIO_PORT6(port, \ + _CNL_PORT_TX_DW2_GRP_AE, \ + _CNL_PORT_TX_DW2_GRP_B, \ + _CNL_PORT_TX_DW2_GRP_C, \ + _CNL_PORT_TX_DW2_GRP_D, \ + _CNL_PORT_TX_DW2_GRP_AE, \ + _CNL_PORT_TX_DW2_GRP_F) +#define CNL_PORT_TX_DW2_LN0 (port) _MMIO_PORT6(port, \ + _CNL_PORT_TX_DW2_LN0_AE, \ + _CNL_PORT_TX_DW2_LN0_B, \ + _CNL_PORT_TX_DW2_LN0_C, \ + _CNL_PORT_TX_DW2_LN0_D, \ + _CNL_PORT_TX_DW2_LN0_AE, \ + _CNL_PORT_TX_DW2_LN0_F) +#define SWING_SEL_UPPER (x) ((x >> 3) << 15) +#define SWING_SEL_LOWER (x) ((x & 0x7) << 11) +#define RCOMP_SCALAR (x) ((x) << 0) + +#define _CNL_PORT_TX_DW4_GRP_AE 0x162350 +#define _CNL_PORT_TX_DW4_GRP_B 0x1623D0 +#define _CNL_PORT_TX_DW4_GRP_C 0x162B50 +#define _CNL_PORT_TX_DW4_GRP_D 0x162BD0 +#define _CNL_PORT_TX_DW4_GRP_F 0x162A50 +#define _CNL_PORT_TX_DW4_LN0_AE 0x162450 +#define _CNL_PORT_TX_DW4_LN1_AE 0x1624D0 +#define _CNL_PORT_TX_DW4_LN0_B 0x162650 +#define _CNL_PORT_TX_DW4_LN0_C 0x162C50 +#define _CNL_PORT_TX_DW4_LN0_D 0x162E50 +#define _CNL_PORT_TX_DW4_LN0_F 0x162850 +#define CNL_PORT_TX_DW4_GRP (port) _MMIO_PORT6(port, \ + _CNL_PORT_TX_DW4_GRP_AE, \ + _CNL_PORT_TX_DW4_GRP_B, \ + _CNL_PORT_TX_DW4_GRP_C, \ + _CNL_PORT_TX_DW4_GRP_D, \ + _CNL_PORT_TX_DW4_GRP_AE, \ + _CNL_PORT_TX_DW4_GRP_F) +#define CNL_PORT_TX_DW4_LN (port, ln) _MMIO_PORT6_LN(port, ln, \ + _CNL_PORT_TX_DW4_LN0_AE, \ + _CNL_PORT_TX_DW4_LN1_AE, \ + _CNL_PORT_TX_DW4_LN0_B, \ + _CNL_PORT_TX_DW4_LN0_C, \ + _CNL_PORT_TX_DW4_LN0_D, \ + _CNL_PORT_TX_DW4_LN0_AE, \ + _CNL_PORT_TX_DW4_LN0_F) +#define LOADGEN_SELECT (1 << 31) +#define POST_CURSOR_1 (x) ((x) << 12) +#define POST_CURSOR_2 (x) ((x) << 6) +#define CURSOR_COEFF (x) ((x) << 0) + +#define _CNL_PORT_TX_DW5_GRP_AE 0x162354 +#define _CNL_PORT_TX_DW5_GRP_B 0x1623D4 +#define _CNL_PORT_TX_DW5_GRP_C 0x162B54 +#define _CNL_PORT_TX_DW5_GRP_D 0x162BD4 +#define _CNL_PORT_TX_DW5_GRP_F 0x162A54 +#define _CNL_PORT_TX_DW5_LN0_AE 0x162454 +#define _CNL_PORT_TX_DW5_LN0_B 0x162654 +#define _CNL_PORT_TX_DW5_LN0_C 0x162C54 +#define _CNL_PORT_TX_DW5_LN0_D 0x162ED4 +#define _CNL_PORT_TX_DW5_LN0_F 0x162854 +#define CNL_PORT_TX_DW5_GRP (port) _MMIO_PORT6(port, \ + _CNL_PORT_TX_DW5_GRP_AE, \ + _CNL_PORT_TX_DW5_GRP_B, \ + _CNL_PORT_TX_DW5_GRP_C, \ + _CNL_PORT_TX_DW5_GRP_D, \ + _CNL_PORT_TX_DW5_GRP_AE, \ + _CNL_PORT_TX_DW5_GRP_F) +#define CNL_PORT_TX_DW5_LN0 (port) _MMIO_PORT6(port, \ + _CNL_PORT_TX_DW5_LN0_AE, \ + _CNL_PORT_TX_DW5_LN0_B, \ + _CNL_PORT_TX_DW5_LN0_C, \ + _CNL_PORT_TX_DW5_LN0_D, \ + _CNL_PORT_TX_DW5_LN0_AE, \ + _CNL_PORT_TX_DW5_LN0_F) +#define TX_TRAINING_EN (1 << 31) +#define TAP3_DISABLE (1 << 29) +#define SCALING_MODE_SEL (x) ((x) << 18) +#define RTERM_SELECT (x) ((x) << 3) + +#define _CNL_PORT_TX_DW7_GRP_AE 0x16235C +#define _CNL_PORT_TX_DW7_GRP_B 0x1623DC +#define _CNL_PORT_TX_DW7_GRP_C 0x162B5C +#define _CNL_PORT_TX_DW7_GRP_D 0x162BDC +#define _CNL_PORT_TX_DW7_GRP_F 0x162A5C +#define _CNL_PORT_TX_DW7_LN0_AE 0x16245C +#define _CNL_PORT_TX_DW7_LN0_B 0x16265C +#define _CNL_PORT_TX_DW7_LN0_C 0x162C5C +#define _CNL_PORT_TX_DW7_LN0_D 0x162EDC +#define _CNL_PORT_TX_DW7_LN0_F 0x16285C +#define CNL_PORT_TX_DW7_GRP (port) _MMIO_PORT6(port, \ + _CNL_PORT_TX_DW7_GRP_AE, \ + _CNL_PORT_TX_DW7_GRP_B, \ + _CNL_PORT_TX_DW7_GRP_C, \ + _CNL_PORT_TX_DW7_GRP_D, \ + _CNL_PORT_TX_DW7_GRP_AE, \ + _CNL_PORT_TX_DW7_GRP_F) +#define CNL_PORT_TX_DW7_LN0 (port) _MMIO_PORT6(port, \ + _CNL_PORT_TX_DW7_LN0_AE, \ + _CNL_PORT_TX_DW7_LN0_B, \ + _CNL_PORT_TX_DW7_LN0_C, \ + _CNL_PORT_TX_DW7_LN0_D, \ + _CNL_PORT_TX_DW7_LN0_AE, \ + _CNL_PORT_TX_DW7_LN0_F) +#define N_SCALAR (x) ((x) << 24) +/* The spec defines this only for BXT PHY0, but lets assume that this * would exist for PHY1 too if it had a second channel. */
Signature · 6 lines
1.9.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Rodrigo Vivi
maintainerPATCH 10/17 drm/i915/cnl: Add DDI Buffer translation tables for Cannonlake.
In reply to Rodrigo ViviThese tables are used on voltage wswing sequence initialization on Cannonlake.
It is a complete new format now in use by the voltage swing team, not following any other standard in use by any other platform. Also the registers are different as well. So let's redefine the translation table for Cannonlake.
The table is huge. So we minimized with the fields that are different or might be different anytime soon. The common values will be hardcoded on the voltage swing sequence.
v2: Merge the lower and the upper bits to match the spec table
and make review easier. This was possible with the good idea for Manasi with a better way to handle it on the bit macro definition presented on previous patch.
Credits-to: Manasi
--- drivers/gpu/drm/i915/intel_ddi.c | 140 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 140 insertions(+)
drivers/gpu/drm/i915/intel_ddi.c +140 -0
@@ -353,6 +353,146 @@ struct bxt_ddi_buf_trans { { 154, 0x9A, 1, 128, true }, /* 9: 1200 0 */ }; +struct cnl_ddi_buf_trans { +u32 dw2_swing_sel; +u32 dw7_n_scalar; +u32 dw4_cursor_coeff; +u32 dw4_post_cursor_2; +u32 dw4_post_cursor_1; +}; + +/* Voltage Swing Programming for VccIO 0.85V for DP */ +static const struct cnl_ddi_buf_trans cnl_ddi_translations_dp_0_85V[] = { +/* NT mV Trans mV db */ + {0xA ,0x5D ,0x3F ,0x00 ,0x00 },/* 350 350 0.0 */ + {0xA ,0x6A ,0x38 ,0x00 ,0x07 },/* 350 500 3.1 */ + {0xB ,0x7A ,0x32 ,0x00 ,0x0D },/* 350 700 6.0 */ + {0x6 ,0x7C ,0x2D ,0x00 ,0x12 },/* 350 900 8.2 */ + {0xA ,0x69 ,0x3F ,0x00 ,0x00 },/* 500 500 0.0 */ + {0xB ,0x7A ,0x36 ,0x00 ,0x09 },/* 500 700 2.9 */ + {0x6 ,0x7C ,0x30 ,0x00 ,0x0F },/* 500 900 5.1 */ + {0xB ,0x7D ,0x3C ,0x00 ,0x03 },/* 650 725 0.9 */ + {0x6 ,0x7C ,0x34 ,0x00 ,0x0B },/* 600 900 3.5 */ + {0x6 ,0x7B ,0x3F ,0x00 ,0x00 },/* 900 900 0.0 */ +}; + +/* Voltage Swing Programming for VccIO 0.85V for HDMI */ +static const struct cnl_ddi_buf_trans cnl_ddi_translations_hdmi_0_85V[] = { +/* NT mV Trans mV db */ + {0xA ,0x60 ,0x3F ,0x00 ,0x00 },/* 450 450 0.0 */ + {0xB ,0x73 ,0x36 ,0x00 ,0x09 },/* 450 650 3.2 */ + {0x6 ,0x7F ,0x31 ,0x00 ,0x0E },/* 450 850 5.5 */ + {0xB ,0x73 ,0x3F ,0x00 ,0x00 },/* 650 650 0.0 */ + {0x6 ,0x7F ,0x37 ,0x00 ,0x08 },/* 650 850 2.3 */ + {0x6 ,0x7F ,0x3F ,0x00 ,0x00 },/* 850 850 0.0 */ + {0x6 ,0x7F ,0x35 ,0x00 ,0x0A },/* 600 850 3.0 */ +}; + +/* Voltage Swing Programming for VccIO 0.85V for eDP */ +static const struct cnl_ddi_buf_trans cnl_ddi_translations_edp_0_85V[] = { +/* NT mV Trans mV db */ + {0xA ,0x66 ,0x3A ,0x00 ,0x05 },/* 384 500 2.3 */ + {0x0 ,0x7F ,0x38 ,0x00 ,0x07 },/* 153 200 2.3 */ + {0x8 ,0x7F ,0x38 ,0x00 ,0x07 },/* 192 250 2.3 */ + {0x1 ,0x7F ,0x38 ,0x00 ,0x07 },/* 230 300 2.3 */ + {0x9 ,0x7F ,0x38 ,0x00 ,0x07 },/* 269 350 2.3 */ + {0xA ,0x66 ,0x3C ,0x00 ,0x03 },/* 446 500 1.0 */ + {0xB ,0x70 ,0x3C ,0x00 ,0x03 },/* 460 600 2.3 */ + {0xC ,0x75 ,0x3C ,0x00 ,0x03 },/* 537 700 2.3 */ + {0x2 ,0x7F ,0x3F ,0x00 ,0x00 },/* 400 400 0.0 */ +}; + +/* Voltage Swing Programming for VccIO 0.95V for DP */ +static const struct cnl_ddi_buf_trans cnl_ddi_translations_dp_0_95V[] = { +/* NT mV Trans mV db */ + {0xA ,0x5D ,0x3F ,0x00 ,0x00 },/* 350 350 0.0 */ + {0xA ,0x6A ,0x38 ,0x00 ,0x07 },/* 350 500 3.1 */ + {0xB ,0x7A ,0x32 ,0x00 ,0x0D },/* 350 700 6.0 */ + {0x6 ,0x7C ,0x2D ,0x00 ,0x12 },/* 350 900 8.2 */ + {0xA ,0x69 ,0x3F ,0x00 ,0x00 },/* 500 500 0.0 */ + {0xB ,0x7A ,0x36 ,0x00 ,0x09 },/* 500 700 2.9 */ + {0x6 ,0x7C ,0x30 ,0x00 ,0x0F },/* 500 900 5.1 */ + {0xB ,0x7D ,0x3C ,0x00 ,0x03 },/* 650 725 0.9 */ + {0x6 ,0x7C ,0x34 ,0x00 ,0x0B },/* 600 900 3.5 */ + {0x6 ,0x7B ,0x3F ,0x00 ,0x00 },/* 900 900 0.0 */ +}; + +/* Voltage Swing Programming for VccIO 0.95V for HDMI */ +static const struct cnl_ddi_buf_trans cnl_ddi_translations_hdmi_0_95V[] = { +/* NT mV Trans mV db */ + {0xA ,0x5C ,0x3F ,0x00 ,0x00 },/* 400 400 0.0 */ + {0xB ,0x69 ,0x37 ,0x00 ,0x08 },/* 400 600 3.5 */ + {0x5 ,0x76 ,0x31 ,0x00 ,0x0E },/* 400 800 6.0 */ + {0xA ,0x5E ,0x3F ,0x00 ,0x00 },/* 450 450 0.0 */ + {0xB ,0x69 ,0x3F ,0x00 ,0x00 },/* 600 600 0.0 */ + {0xB ,0x79 ,0x35 ,0x00 ,0x0A },/* 600 850 3.0 */ + {0x6 ,0x7D ,0x32 ,0x00 ,0x0D },/* 600 1000 4.4 */ + {0x5 ,0x76 ,0x3F ,0x00 ,0x00 },/* 800 800 0.0 */ + {0x6 ,0x7D ,0x39 ,0x00 ,0x06 },/* 800 1000 1.9 */ + {0x6 ,0x7F ,0x39 ,0x00 ,0x06 },/* 850 1050 1.8 */ + {0x6 ,0x7F ,0x3F ,0x00 ,0x00 },/* 1050 1050 0.0 */ +}; + +/* Voltage Swing Programming for VccIO 0.95V for eDP */ +static const struct cnl_ddi_buf_trans cnl_ddi_translations_edp_0_95V[] = { +/* NT mV Trans mV db */ + {0xA ,0x61 ,0x3A ,0x00 ,0x05 },/* 384 500 2.3 */ + {0x0 ,0x7F ,0x38 ,0x00 ,0x07 },/* 153 200 2.3 */ + {0x8 ,0x7F ,0x38 ,0x00 ,0x07 },/* 192 250 2.3 */ + {0x1 ,0x7F ,0x38 ,0x00 ,0x07 },/* 230 300 2.3 */ + {0x9 ,0x7F ,0x38 ,0x00 ,0x07 },/* 269 350 2.3 */ + {0xA ,0x61 ,0x3C ,0x00 ,0x03 },/* 446 500 1.0 */ + {0xB ,0x68 ,0x39 ,0x00 ,0x06 },/* 460 600 2.3 */ + {0xC ,0x6E ,0x39 ,0x00 ,0x06 },/* 537 700 2.3 */ + {0x4 ,0x7F ,0x3A ,0x00 ,0x05 },/* 460 600 2.3 */ + {0x2 ,0x7F ,0x3F ,0x00 ,0x00 },/* 400 400 0.0 */ +}; + +/* Voltage Swing Programming for VccIO 1.05V for DP */ +static const struct cnl_ddi_buf_trans cnl_ddi_translations_dp_1_05V[] = { +/* NT mV Trans mV db */ + {0xA ,0x58 ,0x3F ,0x00 ,0x00 },/* 400 400 0.0 */ + {0xB ,0x64 ,0x37 ,0x00 ,0x08 },/* 400 600 3.5 */ + {0x5 ,0x70 ,0x31 ,0x00 ,0x0E },/* 400 800 6.0 */ + {0x6 ,0x7F ,0x2C ,0x00 ,0x13 },/* 400 1050 8.4 */ + {0xB ,0x64 ,0x3F ,0x00 ,0x00 },/* 600 600 0.0 */ + {0x5 ,0x73 ,0x35 ,0x00 ,0x0A },/* 600 850 3.0 */ + {0x6 ,0x7F ,0x30 ,0x00 ,0x0F },/* 550 1050 5.6 */ + {0x5 ,0x76 ,0x3E ,0x00 ,0x01 },/* 850 900 0.5 */ + {0x6 ,0x7F ,0x36 ,0x00 ,0x09 },/* 750 1050 2.9 */ + {0x6 ,0x7F ,0x3F ,0x00 ,0x00 },/* 1050 1050 0.0 */ +}; + +/* Voltage Swing Programming for VccIO 1.05V for HDMI */ +static const struct cnl_ddi_buf_trans cnl_ddi_translations_hdmi_1_05V[] = { +/* NT mV Trans mV db */ + {0xA ,0x58 ,0x3F ,0x00 ,0x00 },/* 400 400 0.0 */ + {0xB ,0x64 ,0x37 ,0x00 ,0x08 },/* 400 600 3.5 */ + {0x5 ,0x70 ,0x31 ,0x00 ,0x0E },/* 400 800 6.0 */ + {0xA ,0x5B ,0x3F ,0x00 ,0x00 },/* 450 450 0.0 */ + {0xB ,0x64 ,0x3F ,0x00 ,0x00 },/* 600 600 0.0 */ + {0x5 ,0x73 ,0x35 ,0x00 ,0x0A },/* 600 850 3.0 */ + {0x6 ,0x7C ,0x32 ,0x00 ,0x0D },/* 600 1000 4.4 */ + {0x5 ,0x70 ,0x3F ,0x00 ,0x00 },/* 800 800 0.0 */ + {0x6 ,0x7C ,0x39 ,0x00 ,0x06 },/* 800 1000 1.9 */ + {0x6 ,0x7F ,0x39 ,0x00 ,0x06 },/* 850 1050 1.8 */ + {0x6 ,0x7F ,0x3F ,0x00 ,0x00 },/* 1050 1050 0.0 */ +}; + +/* Voltage Swing Programming for VccIO 1.05V for eDP */ +static const struct cnl_ddi_buf_trans cnl_ddi_translations_edp_1_05V[] = { +/* NT mV Trans mV db */ + {0xA ,0x5E ,0x3A ,0x00 ,0x05 },/* 384 500 2.3 */ + {0x0 ,0x7F ,0x38 ,0x00 ,0x07 },/* 153 200 2.3 */ + {0x8 ,0x7F ,0x38 ,0x00 ,0x07 },/* 192 250 2.3 */ + {0x1 ,0x7F ,0x38 ,0x00 ,0x07 },/* 230 300 2.3 */ + {0x9 ,0x7F ,0x38 ,0x00 ,0x07 },/* 269 350 2.3 */ + {0xA ,0x5E ,0x3C ,0x00 ,0x03 },/* 446 500 1.0 */ + {0xB ,0x64 ,0x39 ,0x00 ,0x06 },/* 460 600 2.3 */ + {0xE ,0x6A ,0x39 ,0x00 ,0x06 },/* 537 700 2.3 */ + {0x2 ,0x7F ,0x3F ,0x00 ,0x00 },/* 400 400 0.0 */ +}; +enum port intel_ddi_get_encoder_port (struct intel_encoder *encoder) {switch (encoder->type) {
Signature · 6 lines
1.9.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Rodrigo Vivi
maintainerPATCH 11/17 drm/i915/cnl: Implement voltage swing sequence.
In reply to Rodrigo ViviThis is an important part of the DDI initalization as well as for changing the voltage during DisplayPort link training.
This new sequence for Cannonlake is more like Broxton style but still with different registers, different table and different steps.
v2: Do not write to DW4_GRP to avoid overwrite individual loadgen.
Fix PORT_CL_DW5 SUS Clock Config set.
v3: As previous platforms use only eDP table if low voltage was
requested.
v4: fix Werror:maybe uninitialized (Paulo)
v5: Rebase on top of dw2_swing_sel changes
on previous patches.
v6: Using flexible SCALING_MODE_SEL(x).
--- drivers/gpu/drm/i915/i915_reg.h | 1 + drivers/gpu/drm/i915/intel_ddi.c | 176 ++++++++++++++++++++++++++++++++++++++- drivers/gpu/drm/i915/intel_dp.c | 2 +- 3 files changed, 177 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/i915_reg.h +1 -0
@@ -1668,6 +1668,7 @@ enum skl_disp_power_wells {#define CNL_PORT_CL1CM_DW5 _MMIO(0x162014)#define CL_POWER_DOWN_ENABLE (1 << 4) +#define SUS_CLOCK_CONFIG (3 << 0)#define _PORT_CL1CM_DW9_A 0x162024#define _PORT_CL1CM_DW9_BC 0x6C024
drivers/gpu/drm/i915/intel_ddi.c +175 -1
194 lines not on this page · raw message
drivers/gpu/drm/i915/intel_dp.c +1 -1
@@ -3462,7 +3462,7 @@ static uint32_t chv_signal_levels(struct intel_dp *intel_dp)if (HAS_DDI (dev_priv)) { signal_levels =ddi_signal_levels (intel_dp); -if (IS_GEN9_LP (dev_priv)) +if (IS_GEN9_LP (dev_priv) ||IS_CANNONLAKE (dev_priv)) signal_levels =0 ;else mask =DDI_BUF_EMP_MASK ;
Signature · 6 lines
1.9.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Rodrigo Vivi
maintainerPATCH 12/17 drm/i915/cnl: Enable loadgen_select bit for vswing sequence
In reply to Rodrigo ViviFrom: Clint Taylor <[email protected]>
vswing programming sequence step 2 requires the Loadgen_select bit to be set in PORT_TX_DW4 lane reigsters per table defined by Bit rate and lane width. Implemented the change that was marked as FIXME in the driver.
v2: (Rodrigo) checkpatch fixes.
--- drivers/gpu/drm/i915/intel_ddi.c | 38 ++++++++++++++++++++++++++++++++------ 1 file changed, 32 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/intel_ddi.c +32 -6
@@ -1846,10 +1846,24 @@ static void cnl_ddi_vswing_program(struct drm_i915_private *dev_priv,I915_WRITE (CNL_PORT_TX_DW7_GRP (port), val); } -static void cnl_ddi_vswing_sequence (struct drm_i915_private *dev_priv, -u32 level,enum port port,int type) +static void cnl_ddi_vswing_sequence (struct intel_encoder *encoder,u32 level) { +struct drm_i915_private *dev_priv =to_i915 (encoder->base.dev); +struct intel_dp *intel_dp =enc_to_intel_dp (&encoder->base); +enum port port =intel_ddi_get_encoder_port (encoder); +int type = encoder->type; +int width =0 ; +int rate =0 ;u32 val; +int ln =0 ; + +if ((intel_dp) && (type ==INTEL_OUTPUT_EDP || type ==INTEL_OUTPUT_DP )) { + width = intel_dp->lane_count; + rate = intel_dp->link_rate; + }else { + width =4 ; +/* Rate is always < than 6GHz for HDMI */ + }/* * 1. If port type is eDP or DP,
@@ -1865,8 +1879,21 @@ static void cnl_ddi_vswing_sequence(struct drm_i915_private *dev_priv,/* 2. Program loadgen select */ /* -* FIXME: Program PORT_TX_DW4_LN depending on Bit rate and used lanes +* Program PORT_TX_DW4_LN depending on Bit rate and used lanes +* <= 6 GHz and 4 lanes (LN0=0, LN1=1, LN2=1, LN3=1) +* <= 6 GHz and 1,2 lanes (LN0=0, LN1=1, LN2=1, LN3=0) +* > 6 GHz (LN0=0, LN1=0, LN2=0, LN3=0) */ +for (ln =0 ; ln <=3 ; ln++) { + val =I915_READ (CNL_PORT_TX_DW4_LN (port, ln)); + val &= ~LOADGEN_SELECT ; + +if (((rate <600000 ) && (width ==4 ) && (ln >=1 )) || + ((rate <600000 ) && (width <4 ) && ((ln ==1 ) || (ln ==2 )))) { + val |=LOADGEN_SELECT ; + } +I915_WRITE (CNL_PORT_TX_DW4_LN (port, ln), val); + }/* 3. Set PORT_CL_DW5 SUS Clock Config to 11b */ val =I915_READ (CNL_PORT_CL1CM_DW5 );
@@ -1920,7 +1947,7 @@ uint32_t ddi_signal_levels(struct intel_dp *intel_dp)else if (IS_GEN9_LP (dev_priv))bxt_ddi_vswing_sequence (dev_priv, level, port, encoder->type);else if (IS_CANNONLAKE (dev_priv)) { -cnl_ddi_vswing_sequence (dev_priv, level, port, encoder->type); +cnl_ddi_vswing_sequence (encoder, level);/* DDI_BUF_CTL bits 27:24 are reserved on CNL */ return 0 ; }
@@ -2022,8 +2049,7 @@ static void intel_ddi_pre_enable_hdmi(struct intel_encoder *encoder,bxt_ddi_vswing_sequence (dev_priv, level, port,INTEL_OUTPUT_HDMI ); else if (IS_CANNONLAKE(dev_priv)) - cnl_ddi_vswing_sequence(dev_priv, level, port, - INTEL_OUTPUT_HDMI); + cnl_ddi_vswing_sequence(encoder, level); intel_hdmi->set_infoframes(drm_encoder, has_hdmi_sink,
Signature · 6 lines
1.9.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Rodrigo Vivi
maintainerPATCH 13/17 drm/i915/DMC/CNL: Load DMC on CNL
In reply to Rodrigo ViviFrom: Anusha Srivatsa <[email protected]>
This patch loads the DMC on CNL.The firmware version is 1.04.
v2: (Rodrigo) Remove MODULE_FIRMWARE.
--- drivers/gpu/drm/i915/i915_pci.c | 1 + drivers/gpu/drm/i915/intel_csr.c | 11 +++++++++-- 2 files changed, 10 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/i915_pci.c +1 -0
@@ -444,6 +444,7 @@ .platform = INTEL_CANNONLAKE, .gen = 10, .ddb_size = 1024, + .has_csr = 1, };/*
drivers/gpu/drm/i915/intel_csr.c +9 -2
@@ -37,6 +37,9 @@#define I915_CSR_GLK "i915/glk_dmc_ver1_04.bin"#define GLK_CSR_VERSION_REQUIRED CSR_VERSION(1, 4) +#define I915_CSR_CNL "i915/cnl_dmc_ver1_04.bin" +#define CNL_CSR_VERSION_REQUIRED CSR_VERSION(1, 4) +#define I915_CSR_KBL "i915/kbl_dmc_ver1_01.bin"MODULE_FIRMWARE (I915_CSR_KBL );#define KBL_CSR_VERSION_REQUIRED CSR_VERSION(1, 1)
@@ -289,7 +292,9 @@ static uint32_t *parse_csr_fw(struct drm_i915_private *dev_priv, csr->version = css_header->version; -if (IS_GEMINILAKE (dev_priv)) { +if (IS_CANNONLAKE (dev_priv)) { + required_version =CNL_CSR_VERSION_REQUIRED ; + }else if (IS_GEMINILAKE (dev_priv)) { required_version =GLK_CSR_VERSION_REQUIRED ; }else if (IS_KABYLAKE (dev_priv)) { required_version =KBL_CSR_VERSION_REQUIRED ;
@@ -438,7 +443,9 @@ void intel_csr_ucode_init(struct drm_i915_private *dev_priv)if (!HAS_CSR (dev_priv))return ; -if (IS_GEMINILAKE (dev_priv)) +if (IS_CANNONLAKE (dev_priv)) + csr->fw_path =I915_CSR_CNL ; +else if (IS_GEMINILAKE (dev_priv)) csr->fw_path =I915_CSR_GLK ;else if (IS_KABYLAKE (dev_priv)) csr->fw_path =I915_CSR_KBL ;
Signature · 6 lines
1.9.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Rodrigo Vivi
maintainerPATCH 14/17 drm/i915: Use HAS_CSR instead of gen number on DMC load.
In reply to Rodrigo ViviSince we have HAS_CSR tied to the platform definition let's use this instead of checking per platform.
One less thing to worry when adding support to new platforms.
--- drivers/gpu/drm/i915/intel_csr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_csr.c +1 -1
@@ -241,7 +241,7 @@ void intel_csr_load_program(struct drm_i915_private *dev_priv)u32 *payload = dev_priv->csr.dmc_payload;uint32_t i, fw_size; -if (!IS_GEN9 (dev_priv)) { +if (!HAS_CSR (dev_priv)) {DRM_ERROR ("No CSR support available for this platform\n" );return ; }
Signature · 6 lines
1.9.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Rodrigo Vivi
maintainerPATCH 15/17 drm/i915/cnl: Fix Cannonlake scaler mode programing.
In reply to Rodrigo ViviAs Geminilake scalers Cannonlake also don't need and don't have the "high quality" mode programming.
--- drivers/gpu/drm/i915/intel_atomic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_atomic.c +1 -1
@@ -325,7 +325,7 @@ int intel_atomic_setup_scalers(struct drm_i915_private *dev_priv, }/* set scaler mode */ -if (IS_GEMINILAKE (dev_priv)) { +if (IS_GEMINILAKE (dev_priv) ||IS_CANNONLAKE (dev_priv)) { scaler_state->scalers[*scaler_id].mode =0 ; }else if (num_scalers_need ==1 && intel_crtc->pipe !=PIPE_C ) {/*
Signature · 6 lines
1.9.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Rodrigo Vivi
maintainerPATCH 16/17 drm/i915/cnl: Enable fifo underrun for Cannonlake.
In reply to Rodrigo ViviAlso in a way that reuse bdw+ for all next platforms.
--- drivers/gpu/drm/i915/intel_fifo_underrun.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_fifo_underrun.c +1 -1
@@ -262,7 +262,7 @@ static bool __intel_set_cpu_fifo_underrun_reporting(struct drm_device *dev,ironlake_set_fifo_underrun_reporting (dev, pipe, enable); else if (IS_GEN7(dev_priv)) ivybridge_set_fifo_underrun_reporting(dev, pipe, enable, old); - else if (IS_GEN8(dev_priv) || IS_GEN9(dev_priv)) + else if (INTEL_GEN(dev_priv) >= 8) broadwell_set_fifo_underrun_reporting(dev, pipe, enable);return old;
Signature · 6 lines
1.9.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Rodrigo Vivi
maintainerPATCH 17/17 drm/i915/cnl: LSPCON support is gen9+
In reply to Rodrigo ViviThere is no platform specific change needed for LSPCON support on Cannonlake. So let's make it gen9+.
--- drivers/gpu/drm/i915/i915_drv.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_drv.h +1 -1
@@ -3003,7 +3003,7 @@ static inline struct scatterlist *__sg_next(struct scatterlist *sg)#define HAS_GMCH_DISPLAY (dev_priv) ((dev_priv)->info.has_gmch_display) -#define HAS_LSPCON (dev_priv) (IS_GEN9(dev_priv)) +#define HAS_LSPCON (dev_priv) (INTEL_GEN(dev_priv) >= 9)/* DPF == dynamic parity feature */ #define HAS_L3_DPF (dev_priv) ((dev_priv)->info.has_l3_dpf)
Signature · 6 lines
1.9.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✓ Fi.CI.BAT: success for series starting with [01/17] drm/i915/cnl: Implement .get_display_clock_speed() for CNL
In reply to Rodrigo Vivi== Series Details ==
== Series Details ==
Series: series starting with [01/17] drm/i915/cnl: Implement .get_display_clock_speed() for CNL
URL : https://patchwork.freedesktop.org/series/25511/
State : success
== Summary ==
Series 25511v1 Series without cover letter
https://patchwork.freedesktop.org/api/1.0/series/25511/revisions/1/mbox/
fi-bdw-5557u total:278 pass:267 dwarn:0 dfail:0 fail:0 skip:11 time:443s fi-bdw-gvtdvm total:278 pass:256 dwarn:8 dfail:0 fail:0 skip:14 time:437s fi-bsw-n3050 total:278 pass:242 dwarn:0 dfail:0 fail:0 skip:36 time:586s fi-bxt-j4205 total:278 pass:259 dwarn:0 dfail:0 fail:0 skip:19 time:512s fi-byt-j1900 total:278 pass:254 dwarn:0 dfail:0 fail:0 skip:24 time:491s fi-byt-n2820 total:278 pass:250 dwarn:0 dfail:0 fail:0 skip:28 time:480s fi-glk-2a total:278 pass:259 dwarn:0 dfail:0 fail:0 skip:19 time:595s fi-hsw-4770 total:278 pass:262 dwarn:0 dfail:0 fail:0 skip:16 time:432s fi-hsw-4770r total:278 pass:262 dwarn:0 dfail:0 fail:0 skip:16 time:414s fi-ilk-650 total:278 pass:228 dwarn:0 dfail:0 fail:0 skip:50 time:415s fi-ivb-3520m total:278 pass:260 dwarn:0 dfail:0 fail:0 skip:18 time:495s fi-ivb-3770 total:278 pass:260 dwarn:0 dfail:0 fail:0 skip:18 time:466s fi-kbl-7500u total:278 pass:260 dwarn:0 dfail:0 fail:0 skip:18 time:466s fi-kbl-7560u total:278 pass:268 dwarn:0 dfail:0 fail:0 skip:10 time:582s fi-kbl-r total:278 pass:259 dwarn:1 dfail:0 fail:0 skip:18 time:567s fi-skl-6260u total:278 pass:268 dwarn:0 dfail:0 fail:0 skip:10 time:470s fi-skl-6700hq total:278 pass:228 dwarn:1 dfail:0 fail:27 skip:22 time:398s fi-skl-6700k total:278 pass:256 dwarn:4 dfail:0 fail:0 skip:18 time:466s fi-skl-6770hq total:278 pass:268 dwarn:0 dfail:0 fail:0 skip:10 time:503s fi-skl-gvtdvm total:278 pass:265 dwarn:0 dfail:0 fail:0 skip:13 time:435s fi-snb-2520m total:278 pass:250 dwarn:0 dfail:0 fail:0 skip:28 time:535s fi-snb-2600 total:278 pass:249 dwarn:0 dfail:0 fail:0 skip:29 time:403s
5b363842b49a66879d4c67d652923fb04e44b271 drm-tip: 2017y-06m-08d-20h-34m-37s UTC integration manifest 047d03a drm/i915/cnl: LSPCON support is gen9+
4602800 drm/i915/cnl: Enable fifo underrun for Cannonlake.
94002bc drm/i915/cnl: Fix Cannonlake scaler mode programing.
6ec0801 drm/i915: Use HAS_CSR instead of gen number on DMC load.
45cd393 drm/i915/DMC/CNL: Load DMC on CNL
158f796 drm/i915/cnl: Enable loadgen_select bit for vswing sequence
e3ac452 drm/i915/cnl: Implement voltage swing sequence.
3934c28 drm/i915/cnl: Add DDI Buffer translation tables for Cannonlake.b232247d drm/i915/cnl: Add registers related to voltage swing sequences.
8b1aeda drm/i915: Add MMIO helper for 6 ports with different offsets.
681fb13 drm/i915/cnl: Initialize PLLs
61a1a82 drm/i915: Configure DPLL's for Cannonlake
f670bf3 drm/i915/cnl: DDI - PLL mapping
ca823ce drm/i915/cnl: Allow dynamic cdclk changes on CNL
feab0e1 drm/i915/cnl: Implement CNL display init/unit sequence
be18d64 drm/i915/cnl: Implement .set_cdclk() for CNL
abf52fd drm/i915/cnl: Implement .get_display_clock_speed() for CNL
== Logs ==
For more details see: https://intel-gfx-ci.01.org/CI/Patchwork_4917/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx