[Intel-gfx] [PATCH 10/10] drm/i915: Use encoder->devdata in eDP init
Jani Nikula
jani.nikula at linux.intel.com
Mon Feb 13 16:13:33 UTC 2023
On Wed, 08 Feb 2023, Ville Syrjala <ville.syrjala at linux.intel.com> wrote:
> From: Ville Syrjälä <ville.syrjala at linux.intel.com>
>
> Since we now populate encoder->devdata for all DP capable
> platforms we can consult it directly during the eDP
> connector init instead of taking a detour via some global
> list/array.
>
> Unfortunately we can't quire get rid of
*quite
> intel_dp_is_port_edp() since it's still used by the higher
> level ilk/vlv/chv output setup code.
>
> Signed-off-by: Ville Syrjälä <ville.syrjala at linux.intel.com>
> ---
> drivers/gpu/drm/i915/display/intel_bios.c | 17 +----------------
> drivers/gpu/drm/i915/display/intel_bios.h | 1 +
> drivers/gpu/drm/i915/display/intel_dp.c | 17 +++++++++++++----
> 3 files changed, 15 insertions(+), 20 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_bios.c b/drivers/gpu/drm/i915/display/intel_bios.c
> index 1af175b48ae6..ec4544a8b333 100644
> --- a/drivers/gpu/drm/i915/display/intel_bios.c
> +++ b/drivers/gpu/drm/i915/display/intel_bios.c
> @@ -2584,7 +2584,7 @@ intel_bios_encoder_supports_dp(const struct intel_bios_encoder_data *devdata)
> return devdata->child.device_type & DEVICE_TYPE_DISPLAYPORT_OUTPUT;
> }
>
> -static bool
> +bool
> intel_bios_encoder_supports_edp(const struct intel_bios_encoder_data *devdata)
> {
> return intel_bios_encoder_supports_dp(devdata) &&
> @@ -3413,21 +3413,6 @@ bool intel_bios_is_port_present(struct drm_i915_private *i915, enum port port)
> return false;
> }
>
> -/**
> - * intel_bios_is_port_edp - is the device in given port eDP
> - * @i915: i915 device instance
> - * @port: port to check
> - *
> - * Return true if the device in %port is eDP.
> - */
> -bool intel_bios_is_port_edp(struct drm_i915_private *i915, enum port port)
> -{
> - const struct intel_bios_encoder_data *devdata =
> - intel_bios_encoder_data_lookup(i915, port);
> -
> - return devdata && intel_bios_encoder_supports_edp(devdata);
> -}
> -
> static bool intel_bios_encoder_supports_dp_dual_mode(const struct intel_bios_encoder_data *devdata)
> {
> const struct child_device_config *child = &devdata->child;
> diff --git a/drivers/gpu/drm/i915/display/intel_bios.h b/drivers/gpu/drm/i915/display/intel_bios.h
> index eaff41256a9c..1a6ae38bd4f6 100644
> --- a/drivers/gpu/drm/i915/display/intel_bios.h
> +++ b/drivers/gpu/drm/i915/display/intel_bios.h
> @@ -268,6 +268,7 @@ intel_bios_encoder_data_lookup(struct drm_i915_private *i915, enum port port);
> bool intel_bios_encoder_supports_dvi(const struct intel_bios_encoder_data *devdata);
> bool intel_bios_encoder_supports_hdmi(const struct intel_bios_encoder_data *devdata);
> bool intel_bios_encoder_supports_dp(const struct intel_bios_encoder_data *devdata);
> +bool intel_bios_encoder_supports_edp(const struct intel_bios_encoder_data *devdata);
> bool intel_bios_encoder_supports_typec_usb(const struct intel_bios_encoder_data *devdata);
> bool intel_bios_encoder_supports_tbt(const struct intel_bios_encoder_data *devdata);
> bool intel_bios_encoder_is_lspcon(const struct intel_bios_encoder_data *devdata);
> diff --git a/drivers/gpu/drm/i915/display/intel_dp.c b/drivers/gpu/drm/i915/display/intel_dp.c
> index 6b836afa0698..e4ea84b5d946 100644
> --- a/drivers/gpu/drm/i915/display/intel_dp.c
> +++ b/drivers/gpu/drm/i915/display/intel_dp.c
> @@ -5129,8 +5129,9 @@ intel_dp_hpd_pulse(struct intel_digital_port *dig_port, bool long_hpd)
> return IRQ_HANDLED;
> }
>
> -/* check the VBT to see whether the eDP is on another port */
> -bool intel_dp_is_port_edp(struct drm_i915_private *dev_priv, enum port port)
> +static bool _intel_dp_is_port_edp(struct drm_i915_private *dev_priv,
> + const struct intel_bios_encoder_data *devdata,
> + enum port port)
> {
> /*
> * eDP not supported on g4x. so bail out early just
> @@ -5142,7 +5143,15 @@ bool intel_dp_is_port_edp(struct drm_i915_private *dev_priv, enum port port)
> if (DISPLAY_VER(dev_priv) < 9 && port == PORT_A)
> return true;
>
> - return intel_bios_is_port_edp(dev_priv, port);
> + return devdata && intel_bios_encoder_supports_edp(devdata);
> +}
> +
> +bool intel_dp_is_port_edp(struct drm_i915_private *i915, enum port port)
> +{
> + const struct intel_bios_encoder_data *devdata =
> + intel_bios_encoder_data_lookup(i915, port);
> +
> + return _intel_dp_is_port_edp(i915, devdata, port);
> }
>
> static bool
> @@ -5415,7 +5424,7 @@ intel_dp_init_connector(struct intel_digital_port *dig_port,
> intel_dp->DP = intel_de_read(dev_priv, intel_dp->output_reg);
> intel_dp->attached_connector = intel_connector;
>
> - if (intel_dp_is_port_edp(dev_priv, port)) {
> + if (_intel_dp_is_port_edp(dev_priv, intel_encoder->devdata, port)) {
> /*
> * Currently we don't support eDP on TypeC ports, although in
> * theory it could work on TypeC legacy ports.
--
Jani Nikula, Intel Open Source Graphics Center
More information about the Intel-gfx
mailing list