diff mbox series

[1/1] drm/i915/display: Handle lane polarity for DDI port

Message ID 20210415084830.1144823-2-kai.heng.feng@canonical.com
State New
Headers show
Series Fix no picture from HDMI when it's plugged after boot | expand

Commit Message

Kai-Heng Feng April 15, 2021, 8:48 a.m. UTC
From: Uma Shankar <uma.shankar@intel.com>

BugLink: https://bugs.launchpad.net/bugs/1924238

Lane Reversal is required for some of the DDI ports. This information
is populated in VBT and driver should read the same and set the
polarity while enabling the port. This patch handles the same.

It helps fix a display blankout issue on DP ports on certain
platforms.

Signed-off-by: Uma Shankar <uma.shankar@intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20210211114209.23866-1-uma.shankar@intel.com
(cherry picked from commit aaab24bb25e9fc4c8f3a1d9a593d3ace2c4af243 linux-next)
Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
---
 drivers/gpu/drm/i915/display/intel_bios.c | 17 +++++++++++++++++
 drivers/gpu/drm/i915/display/intel_bios.h |  2 ++
 drivers/gpu/drm/i915/display/intel_ddi.c  |  3 +++
 3 files changed, 22 insertions(+)

Comments

Paolo Pisati April 15, 2021, 11:14 a.m. UTC | #1
On Thu, Apr 15, 2021 at 04:48:30PM +0800, Kai-Heng Feng wrote:
> From: Uma Shankar <uma.shankar@intel.com>
> 
> BugLink: https://bugs.launchpad.net/bugs/1924238
Stefan Bader April 29, 2021, 6:50 a.m. UTC | #2
On 15.04.21 10:48, Kai-Heng Feng wrote:
> From: Uma Shankar <uma.shankar@intel.com>
> 
> BugLink: https://bugs.launchpad.net/bugs/1924238
> 
> Lane Reversal is required for some of the DDI ports. This information
> is populated in VBT and driver should read the same and set the
> polarity while enabling the port. This patch handles the same.
> 
> It helps fix a display blankout issue on DP ports on certain
> platforms.
> 
> Signed-off-by: Uma Shankar <uma.shankar@intel.com>
> Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> Link: https://patchwork.freedesktop.org/patch/msgid/20210211114209.23866-1-uma.shankar@intel.com
cherry picked from commit aaab24bb25e9fc4c8f3a1d9a593d3ace2c4af243)
> Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
Acked-by: Stefan Bader <stefan.bader@canonical.com>
> ---

The patch is now upstream with the same SHA1.

-Stefan

>   drivers/gpu/drm/i915/display/intel_bios.c | 17 +++++++++++++++++
>   drivers/gpu/drm/i915/display/intel_bios.h |  2 ++
>   drivers/gpu/drm/i915/display/intel_ddi.c  |  3 +++
>   3 files changed, 22 insertions(+)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_bios.c b/drivers/gpu/drm/i915/display/intel_bios.c
> index 555e1bd9a34b..c3d345b04b19 100644
> --- a/drivers/gpu/drm/i915/display/intel_bios.c
> +++ b/drivers/gpu/drm/i915/display/intel_bios.c
> @@ -2701,6 +2701,23 @@ intel_bios_is_lspcon_present(const struct drm_i915_private *i915,
>   	return HAS_LSPCON(i915) && child && child->lspcon;
>   }
>   
> +/**
> + * intel_bios_is_lane_reversal_needed - if lane reversal needed on port
> + * @i915:       i915 device instance
> + * @port:       port to check
> + *
> + * Return true if port requires lane reversal
> + */
> +bool
> +intel_bios_is_lane_reversal_needed(const struct drm_i915_private *i915,
> +				   enum port port)
> +{
> +	const struct child_device_config *child =
> +		i915->vbt.ddi_port_info[port].child;
> +
> +	return child && child->lane_reversal;
> +}
> +
>   enum aux_ch intel_bios_port_aux_ch(struct drm_i915_private *dev_priv,
>   				   enum port port)
>   {
> diff --git a/drivers/gpu/drm/i915/display/intel_bios.h b/drivers/gpu/drm/i915/display/intel_bios.h
> index e29e79faa01b..f25190ecfe97 100644
> --- a/drivers/gpu/drm/i915/display/intel_bios.h
> +++ b/drivers/gpu/drm/i915/display/intel_bios.h
> @@ -241,6 +241,8 @@ bool intel_bios_is_port_hpd_inverted(const struct drm_i915_private *i915,
>   				     enum port port);
>   bool intel_bios_is_lspcon_present(const struct drm_i915_private *i915,
>   				  enum port port);
> +bool intel_bios_is_lane_reversal_needed(const struct drm_i915_private *i915,
> +					enum port port);
>   enum aux_ch intel_bios_port_aux_ch(struct drm_i915_private *dev_priv, enum port port);
>   bool intel_bios_get_dsc_params(struct intel_encoder *encoder,
>   			       struct intel_crtc_state *crtc_state,
> diff --git a/drivers/gpu/drm/i915/display/intel_ddi.c b/drivers/gpu/drm/i915/display/intel_ddi.c
> index 09c0da7c3436..1650bf53da61 100644
> --- a/drivers/gpu/drm/i915/display/intel_ddi.c
> +++ b/drivers/gpu/drm/i915/display/intel_ddi.c
> @@ -5665,6 +5665,9 @@ void intel_ddi_init(struct drm_i915_private *dev_priv, enum port port)
>   			intel_de_read(dev_priv, DDI_BUF_CTL(port))
>   			& (DDI_BUF_PORT_REVERSAL | DDI_A_4_LANES);
>   
> +	if (intel_bios_is_lane_reversal_needed(dev_priv, port))
> +		dig_port->saved_port_bits |= DDI_BUF_PORT_REVERSAL;
> +
>   	dig_port->dp.output_reg = INVALID_MMIO_REG;
>   	dig_port->max_lanes = intel_ddi_max_lanes(dig_port);
>   	dig_port->aux_ch = intel_bios_port_aux_ch(dev_priv, port);
>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/display/intel_bios.c b/drivers/gpu/drm/i915/display/intel_bios.c
index 555e1bd9a34b..c3d345b04b19 100644
--- a/drivers/gpu/drm/i915/display/intel_bios.c
+++ b/drivers/gpu/drm/i915/display/intel_bios.c
@@ -2701,6 +2701,23 @@  intel_bios_is_lspcon_present(const struct drm_i915_private *i915,
 	return HAS_LSPCON(i915) && child && child->lspcon;
 }
 
+/**
+ * intel_bios_is_lane_reversal_needed - if lane reversal needed on port
+ * @i915:       i915 device instance
+ * @port:       port to check
+ *
+ * Return true if port requires lane reversal
+ */
+bool
+intel_bios_is_lane_reversal_needed(const struct drm_i915_private *i915,
+				   enum port port)
+{
+	const struct child_device_config *child =
+		i915->vbt.ddi_port_info[port].child;
+
+	return child && child->lane_reversal;
+}
+
 enum aux_ch intel_bios_port_aux_ch(struct drm_i915_private *dev_priv,
 				   enum port port)
 {
diff --git a/drivers/gpu/drm/i915/display/intel_bios.h b/drivers/gpu/drm/i915/display/intel_bios.h
index e29e79faa01b..f25190ecfe97 100644
--- a/drivers/gpu/drm/i915/display/intel_bios.h
+++ b/drivers/gpu/drm/i915/display/intel_bios.h
@@ -241,6 +241,8 @@  bool intel_bios_is_port_hpd_inverted(const struct drm_i915_private *i915,
 				     enum port port);
 bool intel_bios_is_lspcon_present(const struct drm_i915_private *i915,
 				  enum port port);
+bool intel_bios_is_lane_reversal_needed(const struct drm_i915_private *i915,
+					enum port port);
 enum aux_ch intel_bios_port_aux_ch(struct drm_i915_private *dev_priv, enum port port);
 bool intel_bios_get_dsc_params(struct intel_encoder *encoder,
 			       struct intel_crtc_state *crtc_state,
diff --git a/drivers/gpu/drm/i915/display/intel_ddi.c b/drivers/gpu/drm/i915/display/intel_ddi.c
index 09c0da7c3436..1650bf53da61 100644
--- a/drivers/gpu/drm/i915/display/intel_ddi.c
+++ b/drivers/gpu/drm/i915/display/intel_ddi.c
@@ -5665,6 +5665,9 @@  void intel_ddi_init(struct drm_i915_private *dev_priv, enum port port)
 			intel_de_read(dev_priv, DDI_BUF_CTL(port))
 			& (DDI_BUF_PORT_REVERSAL | DDI_A_4_LANES);
 
+	if (intel_bios_is_lane_reversal_needed(dev_priv, port))
+		dig_port->saved_port_bits |= DDI_BUF_PORT_REVERSAL;
+
 	dig_port->dp.output_reg = INVALID_MMIO_REG;
 	dig_port->max_lanes = intel_ddi_max_lanes(dig_port);
 	dig_port->aux_ch = intel_bios_port_aux_ch(dev_priv, port);