From: Jim Bride <jim.bride@linux.intel.com>
To: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH v2 04/10] drm/i915: Unduplicate CHV phy-releated pre pll enabling code
Date: Wed, 20 Apr 2016 12:45:35 -0700 [thread overview]
Message-ID: <20160420194535.GE13777@shiv> (raw)
In-Reply-To: <1460569673-13694-5-git-send-email-ander.conselvan.de.oliveira@intel.com>
On Wed, Apr 13, 2016 at 08:47:47PM +0300, Ander Conselvan de Oliveira wrote:
> The same logic is used for DP and HDMI so move it to intel_dpio_phy.c.
>
> Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>
Reviewed-by: Jim Bride <jim.bride@linux.intel.com>
> ---
> drivers/gpu/drm/i915/i915_drv.h | 1 +
> drivers/gpu/drm/i915/intel_dp.c | 83 +----------------------------------
> drivers/gpu/drm/i915/intel_dpio_phy.c | 81 ++++++++++++++++++++++++++++++++++
> drivers/gpu/drm/i915/intel_drv.h | 5 +++
> drivers/gpu/drm/i915/intel_hdmi.c | 74 +------------------------------
> 5 files changed, 89 insertions(+), 155 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> index fe40761..19bfe04 100644
> --- a/drivers/gpu/drm/i915/i915_drv.h
> +++ b/drivers/gpu/drm/i915/i915_drv.h
> @@ -3560,6 +3560,7 @@ void chv_set_phy_signal_level(struct intel_encoder *encoder,
> bool uniq_trans_scale);
> void chv_data_lane_soft_reset(struct intel_encoder *encoder,
> bool reset);
> +void chv_phy_pre_pll_enable(struct intel_encoder *encoder);
>
> int intel_gpu_freq(struct drm_i915_private *dev_priv, int val);
> int intel_freq_opcode(struct drm_i915_private *dev_priv, int val);
> diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
> index 4d63071..dd62bf0 100644
> --- a/drivers/gpu/drm/i915/intel_dp.c
> +++ b/drivers/gpu/drm/i915/intel_dp.c
> @@ -131,11 +131,6 @@ static void vlv_steal_power_sequencer(struct drm_device *dev,
> enum pipe pipe);
> static void intel_dp_unset_edid(struct intel_dp *intel_dp);
>
> -static unsigned int intel_dp_unused_lane_mask(int lane_count)
> -{
> - return ~((1 << lane_count) - 1) & 0xf;
> -}
> -
> static int
> intel_dp_max_link_bw(struct intel_dp *intel_dp)
> {
> @@ -2945,85 +2940,9 @@ static void chv_pre_enable_dp(struct intel_encoder *encoder)
>
> static void chv_dp_pre_pll_enable(struct intel_encoder *encoder)
> {
> - struct intel_digital_port *dport = enc_to_dig_port(&encoder->base);
> - struct drm_device *dev = encoder->base.dev;
> - struct drm_i915_private *dev_priv = dev->dev_private;
> - struct intel_crtc *intel_crtc =
> - to_intel_crtc(encoder->base.crtc);
> - enum dpio_channel ch = vlv_dport_to_channel(dport);
> - enum pipe pipe = intel_crtc->pipe;
> - unsigned int lane_mask =
> - intel_dp_unused_lane_mask(intel_crtc->config->lane_count);
> - u32 val;
> -
> intel_dp_prepare(encoder);
>
> - /*
> - * Must trick the second common lane into life.
> - * Otherwise we can't even access the PLL.
> - */
> - if (ch == DPIO_CH0 && pipe == PIPE_B)
> - dport->release_cl2_override =
> - !chv_phy_powergate_ch(dev_priv, DPIO_PHY0, DPIO_CH1, true);
> -
> - chv_phy_powergate_lanes(encoder, true, lane_mask);
> -
> - mutex_lock(&dev_priv->sb_lock);
> -
> - /* Assert data lane reset */
> - chv_data_lane_soft_reset(encoder, true);
> -
> - /* program left/right clock distribution */
> - if (pipe != PIPE_B) {
> - val = vlv_dpio_read(dev_priv, pipe, _CHV_CMN_DW5_CH0);
> - val &= ~(CHV_BUFLEFTENA1_MASK | CHV_BUFRIGHTENA1_MASK);
> - if (ch == DPIO_CH0)
> - val |= CHV_BUFLEFTENA1_FORCE;
> - if (ch == DPIO_CH1)
> - val |= CHV_BUFRIGHTENA1_FORCE;
> - vlv_dpio_write(dev_priv, pipe, _CHV_CMN_DW5_CH0, val);
> - } else {
> - val = vlv_dpio_read(dev_priv, pipe, _CHV_CMN_DW1_CH1);
> - val &= ~(CHV_BUFLEFTENA2_MASK | CHV_BUFRIGHTENA2_MASK);
> - if (ch == DPIO_CH0)
> - val |= CHV_BUFLEFTENA2_FORCE;
> - if (ch == DPIO_CH1)
> - val |= CHV_BUFRIGHTENA2_FORCE;
> - vlv_dpio_write(dev_priv, pipe, _CHV_CMN_DW1_CH1, val);
> - }
> -
> - /* program clock channel usage */
> - val = vlv_dpio_read(dev_priv, pipe, VLV_PCS01_DW8(ch));
> - val |= CHV_PCS_USEDCLKCHANNEL_OVRRIDE;
> - if (pipe != PIPE_B)
> - val &= ~CHV_PCS_USEDCLKCHANNEL;
> - else
> - val |= CHV_PCS_USEDCLKCHANNEL;
> - vlv_dpio_write(dev_priv, pipe, VLV_PCS01_DW8(ch), val);
> -
> - if (intel_crtc->config->lane_count > 2) {
> - val = vlv_dpio_read(dev_priv, pipe, VLV_PCS23_DW8(ch));
> - val |= CHV_PCS_USEDCLKCHANNEL_OVRRIDE;
> - if (pipe != PIPE_B)
> - val &= ~CHV_PCS_USEDCLKCHANNEL;
> - else
> - val |= CHV_PCS_USEDCLKCHANNEL;
> - vlv_dpio_write(dev_priv, pipe, VLV_PCS23_DW8(ch), val);
> - }
> -
> - /*
> - * This a a bit weird since generally CL
> - * matches the pipe, but here we need to
> - * pick the CL based on the port.
> - */
> - val = vlv_dpio_read(dev_priv, pipe, CHV_CMN_DW19(ch));
> - if (pipe != PIPE_B)
> - val &= ~CHV_CMN_USEDCLKCHANNEL;
> - else
> - val |= CHV_CMN_USEDCLKCHANNEL;
> - vlv_dpio_write(dev_priv, pipe, CHV_CMN_DW19(ch), val);
> -
> - mutex_unlock(&dev_priv->sb_lock);
> + chv_phy_pre_pll_enable(encoder);
> }
>
> static void chv_dp_post_pll_disable(struct intel_encoder *encoder)
> diff --git a/drivers/gpu/drm/i915/intel_dpio_phy.c b/drivers/gpu/drm/i915/intel_dpio_phy.c
> index 9854c93..b4ca3ff 100644
> --- a/drivers/gpu/drm/i915/intel_dpio_phy.c
> +++ b/drivers/gpu/drm/i915/intel_dpio_phy.c
> @@ -163,3 +163,84 @@ void chv_data_lane_soft_reset(struct intel_encoder *encoder,
> vlv_dpio_write(dev_priv, pipe, VLV_PCS23_DW1(ch), val);
> }
> }
> +
> +void chv_phy_pre_pll_enable(struct intel_encoder *encoder)
> +{
> + struct intel_digital_port *dport = enc_to_dig_port(&encoder->base);
> + struct drm_device *dev = encoder->base.dev;
> + struct drm_i915_private *dev_priv = dev->dev_private;
> + struct intel_crtc *intel_crtc =
> + to_intel_crtc(encoder->base.crtc);
> + enum dpio_channel ch = vlv_dport_to_channel(dport);
> + enum pipe pipe = intel_crtc->pipe;
> + unsigned int lane_mask =
> + intel_dp_unused_lane_mask(intel_crtc->config->lane_count);
> + u32 val;
> +
> + /*
> + * Must trick the second common lane into life.
> + * Otherwise we can't even access the PLL.
> + */
> + if (ch == DPIO_CH0 && pipe == PIPE_B)
> + dport->release_cl2_override =
> + !chv_phy_powergate_ch(dev_priv, DPIO_PHY0, DPIO_CH1, true);
> +
> + chv_phy_powergate_lanes(encoder, true, lane_mask);
> +
> + mutex_lock(&dev_priv->sb_lock);
> +
> + /* Assert data lane reset */
> + chv_data_lane_soft_reset(encoder, true);
> +
> + /* program left/right clock distribution */
> + if (pipe != PIPE_B) {
> + val = vlv_dpio_read(dev_priv, pipe, _CHV_CMN_DW5_CH0);
> + val &= ~(CHV_BUFLEFTENA1_MASK | CHV_BUFRIGHTENA1_MASK);
> + if (ch == DPIO_CH0)
> + val |= CHV_BUFLEFTENA1_FORCE;
> + if (ch == DPIO_CH1)
> + val |= CHV_BUFRIGHTENA1_FORCE;
> + vlv_dpio_write(dev_priv, pipe, _CHV_CMN_DW5_CH0, val);
> + } else {
> + val = vlv_dpio_read(dev_priv, pipe, _CHV_CMN_DW1_CH1);
> + val &= ~(CHV_BUFLEFTENA2_MASK | CHV_BUFRIGHTENA2_MASK);
> + if (ch == DPIO_CH0)
> + val |= CHV_BUFLEFTENA2_FORCE;
> + if (ch == DPIO_CH1)
> + val |= CHV_BUFRIGHTENA2_FORCE;
> + vlv_dpio_write(dev_priv, pipe, _CHV_CMN_DW1_CH1, val);
> + }
> +
> + /* program clock channel usage */
> + val = vlv_dpio_read(dev_priv, pipe, VLV_PCS01_DW8(ch));
> + val |= CHV_PCS_USEDCLKCHANNEL_OVRRIDE;
> + if (pipe != PIPE_B)
> + val &= ~CHV_PCS_USEDCLKCHANNEL;
> + else
> + val |= CHV_PCS_USEDCLKCHANNEL;
> + vlv_dpio_write(dev_priv, pipe, VLV_PCS01_DW8(ch), val);
> +
> + if (intel_crtc->config->lane_count > 2) {
> + val = vlv_dpio_read(dev_priv, pipe, VLV_PCS23_DW8(ch));
> + val |= CHV_PCS_USEDCLKCHANNEL_OVRRIDE;
> + if (pipe != PIPE_B)
> + val &= ~CHV_PCS_USEDCLKCHANNEL;
> + else
> + val |= CHV_PCS_USEDCLKCHANNEL;
> + vlv_dpio_write(dev_priv, pipe, VLV_PCS23_DW8(ch), val);
> + }
> +
> + /*
> + * This a a bit weird since generally CL
> + * matches the pipe, but here we need to
> + * pick the CL based on the port.
> + */
> + val = vlv_dpio_read(dev_priv, pipe, CHV_CMN_DW19(ch));
> + if (pipe != PIPE_B)
> + val &= ~CHV_CMN_USEDCLKCHANNEL;
> + else
> + val |= CHV_CMN_USEDCLKCHANNEL;
> + vlv_dpio_write(dev_priv, pipe, CHV_CMN_DW19(ch), val);
> +
> + mutex_unlock(&dev_priv->sb_lock);
> +}
> diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
> index e0fcfa1..ad11313 100644
> --- a/drivers/gpu/drm/i915/intel_drv.h
> +++ b/drivers/gpu/drm/i915/intel_drv.h
> @@ -1323,6 +1323,11 @@ bool intel_dp_source_supports_hbr2(struct intel_dp *intel_dp);
> bool
> intel_dp_get_link_status(struct intel_dp *intel_dp, uint8_t link_status[DP_LINK_STATUS_SIZE]);
>
> +static inline unsigned int intel_dp_unused_lane_mask(int lane_count)
> +{
> + return ~((1 << lane_count) - 1) & 0xf;
> +}
> +
> /* intel_dp_mst.c */
> int intel_dp_mst_encoder_init(struct intel_digital_port *intel_dig_port, int conn_id);
> void intel_dp_mst_encoder_cleanup(struct intel_digital_port *intel_dig_port);
> diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c
> index d1c0be5..e82d6e8 100644
> --- a/drivers/gpu/drm/i915/intel_hdmi.c
> +++ b/drivers/gpu/drm/i915/intel_hdmi.c
> @@ -1660,81 +1660,9 @@ static void vlv_hdmi_pre_pll_enable(struct intel_encoder *encoder)
>
> static void chv_hdmi_pre_pll_enable(struct intel_encoder *encoder)
> {
> - struct intel_digital_port *dport = enc_to_dig_port(&encoder->base);
> - struct drm_device *dev = encoder->base.dev;
> - struct drm_i915_private *dev_priv = dev->dev_private;
> - struct intel_crtc *intel_crtc =
> - to_intel_crtc(encoder->base.crtc);
> - enum dpio_channel ch = vlv_dport_to_channel(dport);
> - enum pipe pipe = intel_crtc->pipe;
> - u32 val;
> -
> intel_hdmi_prepare(encoder);
>
> - /*
> - * Must trick the second common lane into life.
> - * Otherwise we can't even access the PLL.
> - */
> - if (ch == DPIO_CH0 && pipe == PIPE_B)
> - dport->release_cl2_override =
> - !chv_phy_powergate_ch(dev_priv, DPIO_PHY0, DPIO_CH1, true);
> -
> - chv_phy_powergate_lanes(encoder, true, 0x0);
> -
> - mutex_lock(&dev_priv->sb_lock);
> -
> - /* Assert data lane reset */
> - chv_data_lane_soft_reset(encoder, true);
> -
> - /* program left/right clock distribution */
> - if (pipe != PIPE_B) {
> - val = vlv_dpio_read(dev_priv, pipe, _CHV_CMN_DW5_CH0);
> - val &= ~(CHV_BUFLEFTENA1_MASK | CHV_BUFRIGHTENA1_MASK);
> - if (ch == DPIO_CH0)
> - val |= CHV_BUFLEFTENA1_FORCE;
> - if (ch == DPIO_CH1)
> - val |= CHV_BUFRIGHTENA1_FORCE;
> - vlv_dpio_write(dev_priv, pipe, _CHV_CMN_DW5_CH0, val);
> - } else {
> - val = vlv_dpio_read(dev_priv, pipe, _CHV_CMN_DW1_CH1);
> - val &= ~(CHV_BUFLEFTENA2_MASK | CHV_BUFRIGHTENA2_MASK);
> - if (ch == DPIO_CH0)
> - val |= CHV_BUFLEFTENA2_FORCE;
> - if (ch == DPIO_CH1)
> - val |= CHV_BUFRIGHTENA2_FORCE;
> - vlv_dpio_write(dev_priv, pipe, _CHV_CMN_DW1_CH1, val);
> - }
> -
> - /* program clock channel usage */
> - val = vlv_dpio_read(dev_priv, pipe, VLV_PCS01_DW8(ch));
> - val |= CHV_PCS_USEDCLKCHANNEL_OVRRIDE;
> - if (pipe != PIPE_B)
> - val &= ~CHV_PCS_USEDCLKCHANNEL;
> - else
> - val |= CHV_PCS_USEDCLKCHANNEL;
> - vlv_dpio_write(dev_priv, pipe, VLV_PCS01_DW8(ch), val);
> -
> - val = vlv_dpio_read(dev_priv, pipe, VLV_PCS23_DW8(ch));
> - val |= CHV_PCS_USEDCLKCHANNEL_OVRRIDE;
> - if (pipe != PIPE_B)
> - val &= ~CHV_PCS_USEDCLKCHANNEL;
> - else
> - val |= CHV_PCS_USEDCLKCHANNEL;
> - vlv_dpio_write(dev_priv, pipe, VLV_PCS23_DW8(ch), val);
> -
> - /*
> - * This a a bit weird since generally CL
> - * matches the pipe, but here we need to
> - * pick the CL based on the port.
> - */
> - val = vlv_dpio_read(dev_priv, pipe, CHV_CMN_DW19(ch));
> - if (pipe != PIPE_B)
> - val &= ~CHV_CMN_USEDCLKCHANNEL;
> - else
> - val |= CHV_CMN_USEDCLKCHANNEL;
> - vlv_dpio_write(dev_priv, pipe, CHV_CMN_DW19(ch), val);
> -
> - mutex_unlock(&dev_priv->sb_lock);
> + chv_phy_pre_pll_enable(encoder);
> }
>
> static void chv_hdmi_post_pll_disable(struct intel_encoder *encoder)
> --
> 2.4.11
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2016-04-20 19:45 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-13 17:47 [PATCH v2 00/10] Unduplicate CHV phy code Ander Conselvan de Oliveira
2016-04-13 17:47 ` [PATCH v2 01/10] drm/i915: Set crtc_state->lane_count for HDMI Ander Conselvan de Oliveira
2016-04-19 20:40 ` Jim Bride
2016-04-13 17:47 ` [PATCH v2 02/10] drm/i915: Unduplicate CHV signal level code Ander Conselvan de Oliveira
2016-04-20 19:13 ` Jim Bride
2016-04-13 17:47 ` [PATCH v2 03/10] drm/i915: Unduplicate chv_data_lane_soft_reset() Ander Conselvan de Oliveira
2016-04-20 19:24 ` Jim Bride
2016-04-13 17:47 ` [PATCH v2 04/10] drm/i915: Unduplicate CHV phy-releated pre pll enabling code Ander Conselvan de Oliveira
2016-04-20 19:45 ` Jim Bride [this message]
2016-04-13 17:47 ` [PATCH v2 05/10] drm/i915: Unduplicate CHV pre-encoder enabling phy logic Ander Conselvan de Oliveira
2016-04-20 19:48 ` Jim Bride
2016-04-13 17:47 ` [PATCH v2 06/10] drm/i915: Undiplicate CHV encoders' post pll disable code Ander Conselvan de Oliveira
2016-04-19 20:42 ` Jim Bride
2016-04-13 17:47 ` [PATCH v2 07/10] drm/i915: Undiplicate VLV signal level code Ander Conselvan de Oliveira
2016-04-19 20:37 ` Jim Bride
2016-04-19 20:45 ` Jim Bride
2016-04-20 5:23 ` Conselvan De Oliveira, Ander
2016-04-13 17:47 ` [PATCH v2 08/10] drm/i915: Unduplicate VLV phy pre pll enabling code Ander Conselvan de Oliveira
2016-04-20 19:50 ` Jim Bride
2016-04-13 17:47 ` [PATCH v2 09/10] drm/i915: Unduplicate pre encoder enabling phy code Ander Conselvan de Oliveira
2016-04-20 19:52 ` Jim Bride
2016-04-13 17:47 ` [PATCH v2 10/10] drm/i915: Move VLV HDMI lane reset work around logic to intel_dpio_phy.c Ander Conselvan de Oliveira
2016-04-20 19:53 ` Jim Bride
2016-04-14 13:03 ` ✗ Fi.CI.BAT: failure for Unduplicate CHV phy code (rev3) Patchwork
2016-04-20 5:20 ` [PATCH v2 06/18] drm/i915: Unduplicate CHV encoders' post pll disable code Ander Conselvan de Oliveira
2016-04-20 17:20 ` Jim Bride
2016-04-20 5:22 ` [PATCH v2 07/18] drm/i915: Undiplicate VLV signal level code Ander Conselvan de Oliveira
2016-04-20 18:01 ` Jim Bride
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160420194535.GE13777@shiv \
--to=jim.bride@linux.intel.com \
--cc=ander.conselvan.de.oliveira@intel.com \
--cc=intel-gfx@lists.freedesktop.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox