drm/i915: Let's use more enum intel_dpll_id pll_id.
Subsystems (2)
Rodrigo Vivi
maintainerPATCH 1/2 drm/i915: Let's use more enum intel_dpll_id pll_id.
No functional change expected. Just let's use this enum when possible and also same standard pll_id name so we can rework gen9+ port clock later.
--- drivers/gpu/drm/i915/intel_ddi.c | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-)
drivers/gpu/drm/i915/intel_ddi.c +18 -16
@@ -1108,14 +1108,14 @@ static int hsw_ddi_calc_wrpll_link(struct drm_i915_private *dev_priv, }static int skl_calc_wrpll_link (struct drm_i915_private *dev_priv, -uint32_t dpll) +enum intel_dpll_id pll_id) {i915_reg_t cfgcr1_reg, cfgcr2_reg;uint32_t cfgcr1_val, cfgcr2_val;uint32_t p0, p1, p2, dco_freq; - cfgcr1_reg =DPLL_CFGCR1 (dpll); - cfgcr2_reg =DPLL_CFGCR2 (dpll); + cfgcr1_reg =DPLL_CFGCR1 (pll_id); + cfgcr2_reg =DPLL_CFGCR2 (pll_id); cfgcr1_val =I915_READ (cfgcr1_reg); cfgcr2_val =I915_READ (cfgcr2_reg);
@@ -1168,7 +1168,7 @@ static int skl_calc_wrpll_link(struct drm_i915_private *dev_priv, }static int cnl_calc_wrpll_link (struct drm_i915_private *dev_priv, -uint32_t pll_id) +enum intel_dpll_id pll_id) {uint32_t cfgcr0, cfgcr1;uint32_t p0, p1, p2, dco_freq, ref_clock;
@@ -1255,7 +1255,8 @@ static void cnl_ddi_clock_get(struct intel_encoder *encoder, {struct drm_i915_private *dev_priv =to_i915 (encoder->base.dev);int link_clock =0 ; -uint32_t cfgcr0, pll_id; +uint32_t cfgcr0; +enum intel_dpll_id pll_id; pll_id =intel_get_shared_dpll_id (dev_priv, pipe_config->shared_dpll);
@@ -1308,17 +1309,18 @@ static void skl_ddi_clock_get(struct intel_encoder *encoder, {struct drm_i915_private *dev_priv =to_i915 (encoder->base.dev);int link_clock =0 ; -uint32_t dpll_ctl1, dpll; +uint32_t dpll_ctl1; +enum intel_dpll_id pll_id; - dpll =intel_get_shared_dpll_id (dev_priv, pipe_config->shared_dpll); + pll_id =intel_get_shared_dpll_id (dev_priv, pipe_config->shared_dpll); dpll_ctl1 =I915_READ (DPLL_CTRL1 ); -if (dpll_ctl1 &DPLL_CTRL1_HDMI_MODE (dpll)) { - link_clock =skl_calc_wrpll_link (dev_priv, dpll); +if (dpll_ctl1 &DPLL_CTRL1_HDMI_MODE (pll_id)) { + link_clock =skl_calc_wrpll_link (dev_priv, pll_id); }else { - link_clock = dpll_ctl1 &DPLL_CTRL1_LINK_RATE_MASK (dpll); - link_clock >>=DPLL_CTRL1_LINK_RATE_SHIFT (dpll); + link_clock = dpll_ctl1 &DPLL_CTRL1_LINK_RATE_MASK (pll_id); + link_clock >>=DPLL_CTRL1_LINK_RATE_SHIFT (pll_id);switch (link_clock) {case DPLL_CTRL1_LINK_RATE_810 :
@@ -1399,17 +1401,17 @@ static void hsw_ddi_clock_get(struct intel_encoder *encoder, }static int bxt_calc_pll_link (struct drm_i915_private *dev_priv, -enum intel_dpll_id dpll) +enum intel_dpll_id pll_id) {struct intel_shared_dpll *pll;struct intel_dpll_hw_state *state;struct dpll clock;/* For DDI ports we always use a shared PLL. */ -if (WARN_ON (dpll ==DPLL_ID_PRIVATE )) +if (WARN_ON (pll_id ==DPLL_ID_PRIVATE ))return 0 ; - pll = &dev_priv->shared_dplls[dpll]; + pll = &dev_priv->shared_dplls[pll_id]; state = &pll->state.hw_state; clock.m1 =2 ;
@@ -1428,9 +1430,9 @@ static void bxt_ddi_clock_get(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 dpll = port; +enum intel_dpll_id pll_id = port; - pipe_config->port_clock =bxt_calc_pll_link (dev_priv, dpll); + pipe_config->port_clock =bxt_calc_pll_link (dev_priv, pll_id);ddi_dotclock_get (pipe_config); }
Signature · 6 lines
2.13.5 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Rodrigo Vivi
maintainerPATCH 2/2 drm/i915/cnl: extract cnl_dvfs_{pre, post}_change
From: Paulo Zanoni <[email protected]>
These functions even have their own page in our spec, so extract them from cnl_set_cdclk().
v2: (By Rodrigo) Fixed inverted logic on error return of
cnl_dvfs_pre_change.
v3: Rebase on top of rps rework with pcu_lock.
--- drivers/gpu/drm/i915/intel_cdclk.c | 33 +++++++++++++++++++++++---------- 1 file changed, 23 insertions(+), 10 deletions(-)
drivers/gpu/drm/i915/intel_cdclk.c +23 -10
@@ -1510,12 +1510,8 @@ static void cnl_cdclk_pll_enable(struct drm_i915_private *dev_priv, int vco) dev_priv->cdclk.hw.vco = vco; } -static void cnl_set_cdclk (struct drm_i915_private *dev_priv, -const struct intel_cdclk_state *cdclk_state) +static int cnl_dvfs_pre_change (struct drm_i915_private *dev_priv) { -int cdclk = cdclk_state->cdclk; -int vco = cdclk_state->vco; -u32 val, divider, pcu_ack;int ret;mutex_lock (&dev_priv->pcu_lock);
@@ -1524,11 +1520,30 @@ static void cnl_set_cdclk(struct drm_i915_private *dev_priv,SKL_CDCLK_READY_FOR_CHANGE , SKL_CDCLK_READY_FOR_CHANGE, 3);mutex_unlock (&dev_priv->pcu_lock); -if (ret) { + +if (ret)DRM_ERROR ("Failed to inform PCU about cdclk change (%d)\n" , ret); + +return ret; +} + +static void cnl_dvfs_post_change (struct drm_i915_private *dev_priv,int level) +{ +mutex_lock (&dev_priv->pcu_lock); +sandybridge_pcode_write (dev_priv,SKL_PCODE_CDCLK_CONTROL , level); +mutex_unlock (&dev_priv->pcu_lock); +} + +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; + +if (cnl_dvfs_pre_change (dev_priv))return ; - }/* cdclk = vco / 2 / div{1,2} */ switch (DIV_ROUND_CLOSEST (vco, cdclk)) {
@@ -1575,9 +1590,7 @@ static void cnl_set_cdclk(struct drm_i915_private *dev_priv,I915_WRITE (CDCLK_CTL , val);/* inform PCU of the change */ -mutex_lock (&dev_priv->pcu_lock); -sandybridge_pcode_write (dev_priv,SKL_PCODE_CDCLK_CONTROL , pcu_ack); -mutex_unlock (&dev_priv->pcu_lock); +cnl_dvfs_post_change (dev_priv, pcu_ack);intel_update_cdclk (dev_priv); }
Signature · 6 lines
2.13.5 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✓ Fi.CI.BAT: success for series starting with [1/2] drm/i915: Let's use more enum intel_dpll_id pll_id.
In reply to Rodrigo Vivi== Series Details ==
== Series Details ==
Series: series starting with [1/2] drm/i915: Let's use more enum intel_dpll_id pll_id.
URL : https://patchwork.freedesktop.org/series/32245/
State : success
== Summary ==
Series 32245v1 series starting with [1/2] drm/i915: Let's use more enum intel_dpll_id pll_id.
https://patchwork.freedesktop.org/api/1.0/series/32245/revisions/1/mbox/
Test gem_exec_reloc:
Subgroup basic-cpu-active:
pass -> FAIL (fi-gdg-551) fdo#102582 +6fdo#102582 https://bugs.freedesktop.org/show_bug.cgi?id=102582
fi-bdw-5557u total:289 pass:268 dwarn:0 dfail:0 fail:0 skip:21 time:439s fi-bdw-gvtdvm total:289 pass:265 dwarn:0 dfail:0 fail:0 skip:24 time:450s fi-blb-e6850 total:289 pass:223 dwarn:1 dfail:0 fail:0 skip:65 time:370s fi-bsw-n3050 total:289 pass:243 dwarn:0 dfail:0 fail:0 skip:46 time:532s fi-bwr-2160 total:289 pass:183 dwarn:0 dfail:0 fail:0 skip:106 time:262s fi-bxt-dsi total:289 pass:259 dwarn:0 dfail:0 fail:0 skip:30 time:497s fi-bxt-j4205 total:289 pass:260 dwarn:0 dfail:0 fail:0 skip:29 time:496s fi-byt-j1900 total:289 pass:253 dwarn:1 dfail:0 fail:0 skip:35 time:491s fi-byt-n2820 total:289 pass:249 dwarn:1 dfail:0 fail:0 skip:39 time:480s fi-elk-e7500 total:289 pass:229 dwarn:0 dfail:0 fail:0 skip:60 time:415s fi-gdg-551 total:289 pass:171 dwarn:1 dfail:0 fail:8 skip:109 time:252s fi-glk-1 total:289 pass:261 dwarn:0 dfail:0 fail:0 skip:28 time:576s fi-hsw-4770 total:289 pass:262 dwarn:0 dfail:0 fail:0 skip:27 time:443s fi-hsw-4770r total:289 pass:262 dwarn:0 dfail:0 fail:0 skip:27 time:423s fi-ilk-650 total:289 pass:228 dwarn:0 dfail:0 fail:0 skip:61 time:435s fi-ivb-3520m total:289 pass:260 dwarn:0 dfail:0 fail:0 skip:29 time:485s fi-ivb-3770 total:289 pass:260 dwarn:0 dfail:0 fail:0 skip:29 time:455s fi-kbl-7500u total:289 pass:264 dwarn:1 dfail:0 fail:0 skip:24 time:491s fi-kbl-7560u total:289 pass:270 dwarn:0 dfail:0 fail:0 skip:19 time:570s fi-kbl-7567u total:289 pass:269 dwarn:0 dfail:0 fail:0 skip:20 time:471s fi-kbl-r total:289 pass:262 dwarn:0 dfail:0 fail:0 skip:27 time:580s fi-pnv-d510 total:289 pass:222 dwarn:1 dfail:0 fail:0 skip:66 time:549s fi-skl-6260u total:289 pass:269 dwarn:0 dfail:0 fail:0 skip:20 time:456s fi-skl-6700hq total:289 pass:263 dwarn:0 dfail:0 fail:0 skip:26 time:642s fi-skl-6700k total:289 pass:265 dwarn:0 dfail:0 fail:0 skip:24 time:516s fi-skl-6770hq total:289 pass:269 dwarn:0 dfail:0 fail:0 skip:20 time:494s fi-skl-gvtdvm total:289 pass:266 dwarn:0 dfail:0 fail:0 skip:23 time:455s fi-snb-2520m total:289 pass:250 dwarn:0 dfail:0 fail:0 skip:39 time:564s fi-snb-2600 total:289 pass:249 dwarn:0 dfail:0 fail:0 skip:40 time:416s
7edf6833df0ac2c6d24969d48074203bd305e623 drm-tip: 2017y-10m-18d-16h-29m-02s UTC integration manifest 8c496465cb9e drm/i915/cnl: extract cnl_dvfs_{pre, post}_change4d0c664dc6de drm/i915: Let's use more enum intel_dpll_id pll_id.
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_6095/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✓ Fi.CI.IGT: success for series starting with [1/2] drm/i915: Let's use more enum intel_dpll_id pll_id.
In reply to Rodrigo Vivi== Series Details ==
== Series Details ==
Series: series starting with [1/2] drm/i915: Let's use more enum intel_dpll_id pll_id.
URL : https://patchwork.freedesktop.org/series/32245/
State : success
== Summary ==
Test kms_setmode:
Subgroup basic:
pass -> FAIL (shard-hsw) fdo#99912
Test kms_chv_cursor_fail:
Subgroup pipe-A-64x64-top-edge:
skip -> PASS (shard-hsw)fdo#99912 https://bugs.freedesktop.org/show_bug.cgi?id=99912
shard-hsw total:2540 pass:1430 dwarn:0 dfail:0 fail:9 skip:1101 time:9224s
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_6095/shards.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Rodrigo Vivi
maintainerQuoted 8 lines · Rodrigo Vivi
No functional change expected. Just let's use this enum when possible and also same standard
pll_idname so we can rework gen9+ port clock later.Cc Mika Kahola <[email protected]>Cc Paulo Zanoni <[email protected]>Signed-off-by Rodrigo Vivi <[email protected]>Reviewed-by Mika Kahola <[email protected]>
I merged this patch to dinq since it was ready and reviewed and gets code cleaner.
Although all initial DVFS series
including the patch 2 in this series is going probably to be droped in favor of Ville's dvfs version that includes atomic commit and all platforms.
Quoted 106 lines
--- drivers/gpu/drm/i915/intel_ddi.c | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-)drivers/gpu/drm/i915/intel_ddi.c +18
-16@@ -1108,14 +1108,14 @@ static int hsw_ddi_calc_wrpll_link(struct drm_i915_private *dev_priv, }static int skl_calc_wrpll_link (struct drm_i915_private *dev_priv, -uint32_t dpll) +enum intel_dpll_id pll_id) {i915_reg_t cfgcr1_reg, cfgcr2_reg;uint32_t cfgcr1_val, cfgcr2_val;uint32_t p0, p1, p2, dco_freq; - cfgcr1_reg =DPLL_CFGCR1 (dpll); - cfgcr2_reg =DPLL_CFGCR2 (dpll); + cfgcr1_reg =DPLL_CFGCR1 (pll_id); + cfgcr2_reg =DPLL_CFGCR2 (pll_id); cfgcr1_val =I915_READ (cfgcr1_reg); cfgcr2_val =I915_READ (cfgcr2_reg);@@ -1168,7 +1168,7 @@ static int skl_calc_wrpll_link(struct drm_i915_private *dev_priv, }static int cnl_calc_wrpll_link (struct drm_i915_private *dev_priv, -uint32_t pll_id) +enum intel_dpll_id pll_id) {uint32_t cfgcr0, cfgcr1;uint32_t p0, p1, p2, dco_freq, ref_clock;@@ -1255,7 +1255,8 @@ static void cnl_ddi_clock_get(struct intel_encoder *encoder, {struct drm_i915_private *dev_priv =to_i915 (encoder->base.dev);int link_clock =0 ; -uint32_t cfgcr0, pll_id; +uint32_t cfgcr0; +enum intel_dpll_id pll_id; pll_id =intel_get_shared_dpll_id (dev_priv, pipe_config->shared_dpll);@@ -1308,17 +1309,18 @@ static void skl_ddi_clock_get(struct intel_encoder *encoder, {struct drm_i915_private *dev_priv =to_i915 (encoder->base.dev);int link_clock =0 ; -uint32_t dpll_ctl1, dpll; +uint32_t dpll_ctl1; +enum intel_dpll_id pll_id; - dpll =intel_get_shared_dpll_id (dev_priv, pipe_config->shared_dpll); + pll_id =intel_get_shared_dpll_id (dev_priv, pipe_config->shared_dpll); dpll_ctl1 =I915_READ (DPLL_CTRL1 ); -if (dpll_ctl1 &DPLL_CTRL1_HDMI_MODE (dpll)) { - link_clock =skl_calc_wrpll_link (dev_priv, dpll); +if (dpll_ctl1 &DPLL_CTRL1_HDMI_MODE (pll_id)) { + link_clock =skl_calc_wrpll_link (dev_priv, pll_id); }else { - link_clock = dpll_ctl1 &DPLL_CTRL1_LINK_RATE_MASK (dpll); - link_clock >>=DPLL_CTRL1_LINK_RATE_SHIFT (dpll); + link_clock = dpll_ctl1 &DPLL_CTRL1_LINK_RATE_MASK (pll_id); + link_clock >>=DPLL_CTRL1_LINK_RATE_SHIFT (pll_id);switch (link_clock) {case DPLL_CTRL1_LINK_RATE_810 :@@ -1399,17 +1401,17 @@ static void hsw_ddi_clock_get(struct intel_encoder *encoder, }static int bxt_calc_pll_link (struct drm_i915_private *dev_priv, -enum intel_dpll_id dpll) +enum intel_dpll_id pll_id) {struct intel_shared_dpll *pll;struct intel_dpll_hw_state *state;struct dpll clock;/* For DDI ports we always use a shared PLL. */ -if (WARN_ON (dpll ==DPLL_ID_PRIVATE )) +if (WARN_ON (pll_id ==DPLL_ID_PRIVATE ))return 0 ; - pll = &dev_priv->shared_dplls[dpll]; + pll = &dev_priv->shared_dplls[pll_id]; state = &pll->state.hw_state; clock.m1 =2 ;@@ -1428,9 +1430,9 @@ static void bxt_ddi_clock_get(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 dpll = port; +enum intel_dpll_id pll_id = port; - pipe_config->port_clock =bxt_calc_pll_link (dev_priv, dpll); + pipe_config->port_clock =bxt_calc_pll_link (dev_priv, pll_id);ddi_dotclock_get (pipe_config); }Signature · 1 line
2.13.5
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx