From: Daniel Vetter Subject: Re: [PATCH 2/2] drm/i915: use the HDMI DDI buffer translations from VBT Date: Tue, 3 Sep 2013 18:01:58 +0200 Message-ID: <20130903160158.GJ5767@phenom.ffwll.local> References: <1377634928-2898-2-git-send-email-przanoni@gmail.com> <1377704349-2941-1-git-send-email-przanoni@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail-ea0-f176.google.com (mail-ea0-f176.google.com [209.85.215.176]) by gabe.freedesktop.org (Postfix) with ESMTP id A8482E668E for ; Tue, 3 Sep 2013 09:01:46 -0700 (PDT) Received: by mail-ea0-f176.google.com with SMTP id q16so3099601ead.35 for ; Tue, 03 Sep 2013 09:01:44 -0700 (PDT) Content-Disposition: inline In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: intel-gfx-bounces+gcfxdi-intel-gfx=m.gmane.org@lists.freedesktop.org Errors-To: intel-gfx-bounces+gcfxdi-intel-gfx=m.gmane.org@lists.freedesktop.org To: Rodrigo Vivi Cc: intel-gfx , Paulo Zanoni List-Id: intel-gfx@lists.freedesktop.org On Tue, Sep 03, 2013 at 11:37:27AM -0300, Rodrigo Vivi wrote: > On Wed, Aug 28, 2013 at 12:39 PM, Paulo Zanoni wrote: > > From: Paulo Zanoni > > > > We currently use the recommended values from BSpec, but the VBT > > specifies the correct value to use for the hardware we have, so use > > it. We also fall back to the recommended value in case we can't find > > the VBT. > > > > In addition, this code also provides some infrastructure to parse more > > information about the DDI ports. There's a lot more information we > > could extract and use in the future. > > > > v2: - Move some code to init_vbt_defaults. > > > > Signed-off-by: Paulo Zanoni > > --- > > drivers/gpu/drm/i915/i915_drv.h | 6 ++++ > > drivers/gpu/drm/i915/intel_bios.c | 69 +++++++++++++++++++++++++++++++++++++++ > > drivers/gpu/drm/i915/intel_ddi.c | 24 ++++++++++++-- > > 3 files changed, 97 insertions(+), 2 deletions(-) > > > > diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h > > index 08fe1b6..645dd74 100644 > > --- a/drivers/gpu/drm/i915/i915_drv.h > > +++ b/drivers/gpu/drm/i915/i915_drv.h > > @@ -1039,6 +1039,10 @@ enum modeset_restore { > > MODESET_SUSPENDED, > > }; > > > > +struct ddi_vbt_port_info { > > + uint8_t hdmi_level_shift; > > +}; > > + > > struct intel_vbt_data { > > struct drm_display_mode *lfp_lvds_vbt_mode; /* if any */ > > struct drm_display_mode *sdvo_lvds_vbt_mode; /* if any */ > > @@ -1068,6 +1072,8 @@ struct intel_vbt_data { > > > > int child_dev_num; > > union child_device_config *child_dev; > > + > > + struct ddi_vbt_port_info ddi_port_info[5]; > > }; > > > > enum intel_ddb_partitioning { > > diff --git a/drivers/gpu/drm/i915/intel_bios.c b/drivers/gpu/drm/i915/intel_bios.c > > index 8a27925..79bb651 100644 > > --- a/drivers/gpu/drm/i915/intel_bios.c > > +++ b/drivers/gpu/drm/i915/intel_bios.c > > @@ -568,6 +568,63 @@ parse_edp(struct drm_i915_private *dev_priv, struct bdb_header *bdb) > > } > > } > > > > +static void parse_ddi_port(struct drm_i915_private *dev_priv, enum port port, > > + struct bdb_header *bdb) > > +{ > > + union child_device_config *it, *child = NULL; > > + struct ddi_vbt_port_info *info = &dev_priv->vbt.ddi_port_info[port]; > > + uint8_t hdmi_level_shift; > > + int i, j; > > + int dvo_ports[][2] = { > > + {0, 10}, {1, 7}, {2, 8}, {3, 9}, {6, /* Unused */ 0}, > > + }; > > + int n_dvo_ports[] = {2, 2, 2, 2, 1}; > > I hadn't get this until you explain on irc, but I have no better idea > how to make it more clear, so just ignore me ;) If you use -1 for the unused slot (and check for that value in the loop) you could ditch the n_dvo_ports array. Also I think the magic values in dvo_ports need a comment or so ... -Daniel -- Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch