diff mbox

[1/2] drm/i915: Update VBT fields for child devices

Message ID 1458047634-29790-1-git-send-email-shubhangi.shrivastava@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Shubhangi Shrivastava March 15, 2016, 1:13 p.m. UTC
This patch adds new fields that are not yet added in drm code
in child devices struct

Signed-off-by: Sivakumar Thulasimani <sivakumar.thulasimani@intel.com>
Signed-off-by: Durgadoss R <durgadoss.r@intel.com>
Signed-off-by: Shubhangi Shrivastava <shubhangi.shrivastava@intel.com>
---
 drivers/gpu/drm/i915/intel_bios.c | 15 ++++++++++++++-
 drivers/gpu/drm/i915/intel_bios.h | 16 +++++++++++-----
 2 files changed, 25 insertions(+), 6 deletions(-)

Comments

Ville Syrjälä March 15, 2016, 2:47 p.m. UTC | #1
On Tue, Mar 15, 2016 at 06:43:53PM +0530, Shubhangi Shrivastava wrote:
> This patch adds new fields that are not yet added in drm code
> in child devices struct
> 
> Signed-off-by: Sivakumar Thulasimani <sivakumar.thulasimani@intel.com>
> Signed-off-by: Durgadoss R <durgadoss.r@intel.com>
> Signed-off-by: Shubhangi Shrivastava <shubhangi.shrivastava@intel.com>
> ---
>  drivers/gpu/drm/i915/intel_bios.c | 15 ++++++++++++++-
>  drivers/gpu/drm/i915/intel_bios.h | 16 +++++++++++-----
>  2 files changed, 25 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_bios.c b/drivers/gpu/drm/i915/intel_bios.c
> index bf62a19..a26d4b4 100644
> --- a/drivers/gpu/drm/i915/intel_bios.c
> +++ b/drivers/gpu/drm/i915/intel_bios.c
> @@ -1124,7 +1124,7 @@ static void parse_ddi_port(struct drm_i915_private *dev_priv, enum port port,
>  	}
>  
>  	/* Parse the I_boost config for SKL and above */
> -	if (bdb->version >= 196 && (child->common.flags_1 & IBOOST_ENABLE)) {
> +	if (bdb->version >= 196 && child->common.iboost) {
>  		info->dp_boost_level = translate_iboost(child->common.iboost_level & 0xF);
>  		DRM_DEBUG_KMS("VBT (e)DP boost level for port %c: %d\n",
>  			      port_name(port), info->dp_boost_level);
> @@ -1250,6 +1250,19 @@ parse_device_mapping(struct drm_i915_private *dev_priv,
>  		 */
>  		memcpy(child_dev_ptr, p_child,
>  		       min_t(size_t, p_defs->child_dev_size, sizeof(*p_child)));
> +
> +		/*
> +		 * copied full block, now init values when they are not
> +		 * available in current version
> +		 */
> +		if (bdb->version < 196) {
> +			/* Set default values for bits added from v196 */
> +			child_dev_ptr->common.iboost = 0;
> +			child_dev_ptr->common.hpd_invert = 0;
> +		}
> +
> +		if (bdb->version < 192)
> +			child_dev_ptr->common.lspcon = 0;
>  	}
>  	return;
>  }
> diff --git a/drivers/gpu/drm/i915/intel_bios.h b/drivers/gpu/drm/i915/intel_bios.h
> index 350d4e0..2898323 100644
> --- a/drivers/gpu/drm/i915/intel_bios.h
> +++ b/drivers/gpu/drm/i915/intel_bios.h
> @@ -250,9 +250,6 @@ struct old_child_dev_config {
>   * versions. Notice that the meaning of the contents contents may still change,
>   * but at least the offsets are consistent. */
>  
> -/* Definitions for flags_1 */
> -#define IBOOST_ENABLE (1<<3)
> -
>  struct common_child_dev_config {
>  	u16 handle;
>  	u16 device_type;
> @@ -261,8 +258,17 @@ struct common_child_dev_config {
>  	u8 not_common2[2];
>  	u8 ddc_pin;
>  	u16 edid_ptr;
> -	u8 obsolete;
> -	u8 flags_1;
> +	u8 dvo_cfg; /* See DEVICE_CFG_* above */
> +	u8 efp_routed:1;
> +	u8 lane_reversal:1;
> +	u8 lspcon:1;
> +	u8 iboost:1;
> +	u8 hpd_invert:1;
> +	u8 flag_reserved:3;
> +	u8 hdmi_support:1;
> +	u8 dp_support:1;
> +	u8 tmds_support:1;
> +	u8 support_reserved:5;

I think we should probably annotate each of these with a version
comment. Otherwise you always have to dig up the spec to see which
version added which field.

Anyways these look to match the spec, so
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

>  	u8 not_common3[13];
>  	u8 iboost_level;
>  } __packed;
> -- 
> 2.6.1
Ville Syrjälä March 22, 2016, 4:36 p.m. UTC | #2
On Tue, Mar 15, 2016 at 04:47:46PM +0200, Ville Syrjälä wrote:
> On Tue, Mar 15, 2016 at 06:43:53PM +0530, Shubhangi Shrivastava wrote:
> > This patch adds new fields that are not yet added in drm code
> > in child devices struct
> > 
> > Signed-off-by: Sivakumar Thulasimani <sivakumar.thulasimani@intel.com>
> > Signed-off-by: Durgadoss R <durgadoss.r@intel.com>
> > Signed-off-by: Shubhangi Shrivastava <shubhangi.shrivastava@intel.com>
> > ---
> >  drivers/gpu/drm/i915/intel_bios.c | 15 ++++++++++++++-
> >  drivers/gpu/drm/i915/intel_bios.h | 16 +++++++++++-----
> >  2 files changed, 25 insertions(+), 6 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/i915/intel_bios.c b/drivers/gpu/drm/i915/intel_bios.c
> > index bf62a19..a26d4b4 100644
> > --- a/drivers/gpu/drm/i915/intel_bios.c
> > +++ b/drivers/gpu/drm/i915/intel_bios.c
> > @@ -1124,7 +1124,7 @@ static void parse_ddi_port(struct drm_i915_private *dev_priv, enum port port,
> >  	}
> >  
> >  	/* Parse the I_boost config for SKL and above */
> > -	if (bdb->version >= 196 && (child->common.flags_1 & IBOOST_ENABLE)) {
> > +	if (bdb->version >= 196 && child->common.iboost) {
> >  		info->dp_boost_level = translate_iboost(child->common.iboost_level & 0xF);
> >  		DRM_DEBUG_KMS("VBT (e)DP boost level for port %c: %d\n",
> >  			      port_name(port), info->dp_boost_level);
> > @@ -1250,6 +1250,19 @@ parse_device_mapping(struct drm_i915_private *dev_priv,
> >  		 */
> >  		memcpy(child_dev_ptr, p_child,
> >  		       min_t(size_t, p_defs->child_dev_size, sizeof(*p_child)));
> > +
> > +		/*
> > +		 * copied full block, now init values when they are not
> > +		 * available in current version
> > +		 */
> > +		if (bdb->version < 196) {
> > +			/* Set default values for bits added from v196 */
> > +			child_dev_ptr->common.iboost = 0;
> > +			child_dev_ptr->common.hpd_invert = 0;
> > +		}
> > +
> > +		if (bdb->version < 192)
> > +			child_dev_ptr->common.lspcon = 0;
> >  	}
> >  	return;
> >  }
> > diff --git a/drivers/gpu/drm/i915/intel_bios.h b/drivers/gpu/drm/i915/intel_bios.h
> > index 350d4e0..2898323 100644
> > --- a/drivers/gpu/drm/i915/intel_bios.h
> > +++ b/drivers/gpu/drm/i915/intel_bios.h
> > @@ -250,9 +250,6 @@ struct old_child_dev_config {
> >   * versions. Notice that the meaning of the contents contents may still change,
> >   * but at least the offsets are consistent. */
> >  
> > -/* Definitions for flags_1 */
> > -#define IBOOST_ENABLE (1<<3)
> > -
> >  struct common_child_dev_config {
> >  	u16 handle;
> >  	u16 device_type;
> > @@ -261,8 +258,17 @@ struct common_child_dev_config {
> >  	u8 not_common2[2];
> >  	u8 ddc_pin;
> >  	u16 edid_ptr;
> > -	u8 obsolete;
> > -	u8 flags_1;
> > +	u8 dvo_cfg; /* See DEVICE_CFG_* above */
> > +	u8 efp_routed:1;
> > +	u8 lane_reversal:1;
> > +	u8 lspcon:1;
> > +	u8 iboost:1;
> > +	u8 hpd_invert:1;
> > +	u8 flag_reserved:3;
> > +	u8 hdmi_support:1;
> > +	u8 dp_support:1;
> > +	u8 tmds_support:1;
> > +	u8 support_reserved:5;
> 
> I think we should probably annotate each of these with a version
> comment. Otherwise you always have to dig up the spec to see which
> version added which field.
> 
> Anyways these look to match the spec, so
> Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

I tried to apply this, but the code changed underneath so it won't
actually apply. Can you pls rebase and resend?

> 
> >  	u8 not_common3[13];
> >  	u8 iboost_level;
> >  } __packed;
> > -- 
> > 2.6.1
> 
> -- 
> Ville Syrjälä
> Intel OTC
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/intel_bios.c b/drivers/gpu/drm/i915/intel_bios.c
index bf62a19..a26d4b4 100644
--- a/drivers/gpu/drm/i915/intel_bios.c
+++ b/drivers/gpu/drm/i915/intel_bios.c
@@ -1124,7 +1124,7 @@  static void parse_ddi_port(struct drm_i915_private *dev_priv, enum port port,
 	}
 
 	/* Parse the I_boost config for SKL and above */
-	if (bdb->version >= 196 && (child->common.flags_1 & IBOOST_ENABLE)) {
+	if (bdb->version >= 196 && child->common.iboost) {
 		info->dp_boost_level = translate_iboost(child->common.iboost_level & 0xF);
 		DRM_DEBUG_KMS("VBT (e)DP boost level for port %c: %d\n",
 			      port_name(port), info->dp_boost_level);
@@ -1250,6 +1250,19 @@  parse_device_mapping(struct drm_i915_private *dev_priv,
 		 */
 		memcpy(child_dev_ptr, p_child,
 		       min_t(size_t, p_defs->child_dev_size, sizeof(*p_child)));
+
+		/*
+		 * copied full block, now init values when they are not
+		 * available in current version
+		 */
+		if (bdb->version < 196) {
+			/* Set default values for bits added from v196 */
+			child_dev_ptr->common.iboost = 0;
+			child_dev_ptr->common.hpd_invert = 0;
+		}
+
+		if (bdb->version < 192)
+			child_dev_ptr->common.lspcon = 0;
 	}
 	return;
 }
diff --git a/drivers/gpu/drm/i915/intel_bios.h b/drivers/gpu/drm/i915/intel_bios.h
index 350d4e0..2898323 100644
--- a/drivers/gpu/drm/i915/intel_bios.h
+++ b/drivers/gpu/drm/i915/intel_bios.h
@@ -250,9 +250,6 @@  struct old_child_dev_config {
  * versions. Notice that the meaning of the contents contents may still change,
  * but at least the offsets are consistent. */
 
-/* Definitions for flags_1 */
-#define IBOOST_ENABLE (1<<3)
-
 struct common_child_dev_config {
 	u16 handle;
 	u16 device_type;
@@ -261,8 +258,17 @@  struct common_child_dev_config {
 	u8 not_common2[2];
 	u8 ddc_pin;
 	u16 edid_ptr;
-	u8 obsolete;
-	u8 flags_1;
+	u8 dvo_cfg; /* See DEVICE_CFG_* above */
+	u8 efp_routed:1;
+	u8 lane_reversal:1;
+	u8 lspcon:1;
+	u8 iboost:1;
+	u8 hpd_invert:1;
+	u8 flag_reserved:3;
+	u8 hdmi_support:1;
+	u8 dp_support:1;
+	u8 tmds_support:1;
+	u8 support_reserved:5;
 	u8 not_common3[13];
 	u8 iboost_level;
 } __packed;