[Intel-gfx] [PATCH v2 3/4] drm/i915: Parse VBT data for lspcon

Rodrigo Vivi rodrigo.vivi at gmail.com
Thu Jun 30 22:48:25 UTC 2016


On Tue, Jun 21, 2016 at 8:00 AM, Shashank Sharma
<shashank.sharma at intel.com> wrote:
> Many GEN9 boards come with on-board lspcon cards.
> Fot these boards, VBT configuration should properly point out
> if a particular port contains lspcon device, so that driver can
> initialize it properly.
>
> This patch adds a utility function, which checks the VBT flag
> for lspcon bit, and tells us if a port is configured to have a
> lspcon device or not.
>
> V2: Fixed review comments from Ville
> - Do not forget PORT_D while checking lspcon for GEN9
>
> Signed-off-by: Shashank Sharma <shashank.sharma at intel.com>
> ---
>  drivers/gpu/drm/i915/i915_drv.h   |  3 +++
>  drivers/gpu/drm/i915/intel_bios.c | 49 +++++++++++++++++++++++++++++++++++++++
>  2 files changed, 52 insertions(+)
>
> diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> index 25ebe46..3719b81 100644
> --- a/drivers/gpu/drm/i915/i915_drv.h
> +++ b/drivers/gpu/drm/i915/i915_drv.h
> @@ -3671,6 +3671,9 @@ bool intel_bios_is_port_dp_dual_mode(struct drm_i915_private *dev_priv, enum por
>  bool intel_bios_is_dsi_present(struct drm_i915_private *dev_priv, enum port *port);
>  bool intel_bios_is_port_hpd_inverted(struct drm_i915_private *dev_priv,
>                                      enum port port);
> +bool intel_bios_is_lspcon_present(struct drm_i915_private *dev_priv,
> +                               enum port port);
> +
>
>  /* intel_opregion.c */
>  #ifdef CONFIG_ACPI
> diff --git a/drivers/gpu/drm/i915/intel_bios.c b/drivers/gpu/drm/i915/intel_bios.c
> index da5ed4a..2b00c89 100644
> --- a/drivers/gpu/drm/i915/intel_bios.c
> +++ b/drivers/gpu/drm/i915/intel_bios.c
> @@ -1759,3 +1759,52 @@ intel_bios_is_port_hpd_inverted(struct drm_i915_private *dev_priv,
>
>         return false;
>  }
> +
> +/**
> + * intel_bios_is_lspcon_present - if LSPCON is attached on %port
> + * @dev_priv:  i915 device instance
> + * @port:      port to check
> + *
> + * Return true if LSPCON is present on this port
> + */
> +bool
> +intel_bios_is_lspcon_present(struct drm_i915_private *dev_priv,
> +                               enum port port)
> +{
> +       int i;
> +
> +       if (WARN_ON_ONCE(!IS_GEN9(dev_priv)))
> +               return false;

This will cause noise on other platforms.

Also I'd prefer gen < 9 assuming next gens will inherit this support.
Or also create a HAS_LSPCON on the platform definition and there use gen < 9.

> +
> +       for (i = 0; i < dev_priv->vbt.child_dev_num; i++) {
> +               if (!dev_priv->vbt.child_dev[i].common.lspcon)
> +                       continue;
> +
> +               switch (dev_priv->vbt.child_dev[i].common.dvo_port) {
> +               case DVO_PORT_DPA:
> +               case DVO_PORT_HDMIA:
> +                       if (port == PORT_A)
> +                               return true;
> +                       break;
> +               case DVO_PORT_DPB:
> +               case DVO_PORT_HDMIB:
> +                       if (port == PORT_B)
> +                               return true;
> +                       break;
> +               case DVO_PORT_DPC:
> +               case DVO_PORT_HDMIC:
> +                       if (port == PORT_C)
> +                               return true;
> +                       break;
> +               case DVO_PORT_DPD:
> +               case DVO_PORT_HDMID:
> +                       if (port == PORT_D)
> +                               return true;
> +                       break;
> +               default:
> +                       break;
> +               }
> +       }
> +
> +       return false;
> +}
> --
> 1.9.1
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx



-- 
Rodrigo Vivi
Blog: http://blog.vivi.eng.br


More information about the Intel-gfx mailing list