diff mbox

[v2,1/3] drm/i915: Replace vbt edp.support with int_lvds_support

Message ID 20180508124136.10969-1-ville.syrjala@linux.intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Ville Syrjälä May 8, 2018, 12:41 p.m. UTC
From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Replace dev_priv->vbt.edp.support with
dev_priv->vbt.int_lvds_support. We'll want to extend its
use beyond the LVDS vs. eDP case in the future.

Cc: Jani Nikula <jani.nikula@intel.com>
Cc: Ondrej Zary <linux@rainbow-software.org>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/i915/i915_drv.h   | 2 +-
 drivers/gpu/drm/i915/intel_bios.c | 5 ++++-
 drivers/gpu/drm/i915/intel_lvds.c | 9 +++++----
 3 files changed, 10 insertions(+), 6 deletions(-)

Comments

Jani Nikula May 8, 2018, 1:29 p.m. UTC | #1
On Tue, 08 May 2018, Ville Syrjala <ville.syrjala@linux.intel.com> wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> Replace dev_priv->vbt.edp.support with
> dev_priv->vbt.int_lvds_support. We'll want to extend its
> use beyond the LVDS vs. eDP case in the future.
>
> Cc: Jani Nikula <jani.nikula@intel.com>
> Cc: Ondrej Zary <linux@rainbow-software.org>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>  drivers/gpu/drm/i915/i915_drv.h   | 2 +-
>  drivers/gpu/drm/i915/intel_bios.c | 5 ++++-
>  drivers/gpu/drm/i915/intel_lvds.c | 9 +++++----
>  3 files changed, 10 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> index 04e27806e581..3bdc7cfd4189 100644
> --- a/drivers/gpu/drm/i915/i915_drv.h
> +++ b/drivers/gpu/drm/i915/i915_drv.h
> @@ -1052,6 +1052,7 @@ struct intel_vbt_data {
>  	unsigned int lvds_vbt:1;
>  	unsigned int int_crt_support:1;
>  	unsigned int lvds_use_ssc:1;
> +	unsigned int int_lvds_support:1;
>  	unsigned int display_clock_mode:1;
>  	unsigned int fdi_rx_polarity_inverted:1;
>  	unsigned int panel_type:4;
> @@ -1067,7 +1068,6 @@ struct intel_vbt_data {
>  		int vswing;
>  		bool low_vswing;
>  		bool initialized;
> -		bool support;
>  		int bpp;
>  		struct edp_power_seq pps;
>  	} edp;
> diff --git a/drivers/gpu/drm/i915/intel_bios.c b/drivers/gpu/drm/i915/intel_bios.c
> index 702d3fab97fc..49c6816d008c 100644
> --- a/drivers/gpu/drm/i915/intel_bios.c
> +++ b/drivers/gpu/drm/i915/intel_bios.c
> @@ -519,7 +519,7 @@ parse_driver_features(struct drm_i915_private *dev_priv,
>  		return;
>  
>  	if (driver->lvds_config == BDB_DRIVER_FEATURE_EDP)
> -		dev_priv->vbt.edp.support = 1;
> +		dev_priv->vbt.int_lvds_support = 0;

Sorry to nitpick, but this now changes behaviour for pre-PCH split
platforms. Worse, patch 2 then reverts that change. I think you could've
added the if (gen >= 5) check already here to not modify behaviour.

parse_edp() also needs to drop references to dev_priv->vbt.edp.support.

BR,
Jani.

>  
>  	DRM_DEBUG_KMS("DRRS State Enabled:%d\n", driver->drrs_enabled);
>  	/*
> @@ -1512,6 +1512,9 @@ init_vbt_defaults(struct drm_i915_private *dev_priv)
>  	dev_priv->vbt.int_tv_support = 1;
>  	dev_priv->vbt.int_crt_support = 1;
>  
> +	/* driver features */
> +	dev_priv->vbt.int_lvds_support = 1;
> +
>  	/* Default to using SSC */
>  	dev_priv->vbt.lvds_use_ssc = 1;
>  	/*
> diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c
> index d35d2d50f595..05d012358df8 100644
> --- a/drivers/gpu/drm/i915/intel_lvds.c
> +++ b/drivers/gpu/drm/i915/intel_lvds.c
> @@ -965,6 +965,11 @@ void intel_lvds_init(struct drm_i915_private *dev_priv)
>  	if (dmi_check_system(intel_no_lvds))
>  		return;
>  
> +	if (!dev_priv->vbt.int_lvds_support) {
> +		DRM_DEBUG_KMS("Internal LVDS support disabled by VBT\n");
> +		return;
> +	}
> +
>  	if (HAS_PCH_SPLIT(dev_priv))
>  		lvds_reg = PCH_LVDS;
>  	else
> @@ -975,10 +980,6 @@ void intel_lvds_init(struct drm_i915_private *dev_priv)
>  	if (HAS_PCH_SPLIT(dev_priv)) {
>  		if ((lvds & LVDS_DETECTED) == 0)
>  			return;
> -		if (dev_priv->vbt.edp.support) {
> -			DRM_DEBUG_KMS("disable LVDS for eDP support\n");
> -			return;
> -		}
>  	}
>  
>  	pin = GMBUS_PIN_PANEL;
Ville Syrjälä May 8, 2018, 1:41 p.m. UTC | #2
On Tue, May 08, 2018 at 04:29:01PM +0300, Jani Nikula wrote:
> On Tue, 08 May 2018, Ville Syrjala <ville.syrjala@linux.intel.com> wrote:
> > From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> >
> > Replace dev_priv->vbt.edp.support with
> > dev_priv->vbt.int_lvds_support. We'll want to extend its
> > use beyond the LVDS vs. eDP case in the future.
> >
> > Cc: Jani Nikula <jani.nikula@intel.com>
> > Cc: Ondrej Zary <linux@rainbow-software.org>
> > Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > ---
> >  drivers/gpu/drm/i915/i915_drv.h   | 2 +-
> >  drivers/gpu/drm/i915/intel_bios.c | 5 ++++-
> >  drivers/gpu/drm/i915/intel_lvds.c | 9 +++++----
> >  3 files changed, 10 insertions(+), 6 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> > index 04e27806e581..3bdc7cfd4189 100644
> > --- a/drivers/gpu/drm/i915/i915_drv.h
> > +++ b/drivers/gpu/drm/i915/i915_drv.h
> > @@ -1052,6 +1052,7 @@ struct intel_vbt_data {
> >  	unsigned int lvds_vbt:1;
> >  	unsigned int int_crt_support:1;
> >  	unsigned int lvds_use_ssc:1;
> > +	unsigned int int_lvds_support:1;
> >  	unsigned int display_clock_mode:1;
> >  	unsigned int fdi_rx_polarity_inverted:1;
> >  	unsigned int panel_type:4;
> > @@ -1067,7 +1068,6 @@ struct intel_vbt_data {
> >  		int vswing;
> >  		bool low_vswing;
> >  		bool initialized;
> > -		bool support;
> >  		int bpp;
> >  		struct edp_power_seq pps;
> >  	} edp;
> > diff --git a/drivers/gpu/drm/i915/intel_bios.c b/drivers/gpu/drm/i915/intel_bios.c
> > index 702d3fab97fc..49c6816d008c 100644
> > --- a/drivers/gpu/drm/i915/intel_bios.c
> > +++ b/drivers/gpu/drm/i915/intel_bios.c
> > @@ -519,7 +519,7 @@ parse_driver_features(struct drm_i915_private *dev_priv,
> >  		return;
> >  
> >  	if (driver->lvds_config == BDB_DRIVER_FEATURE_EDP)
> > -		dev_priv->vbt.edp.support = 1;
> > +		dev_priv->vbt.int_lvds_support = 0;
> 
> Sorry to nitpick, but this now changes behaviour for pre-PCH split
> platforms. Worse, patch 2 then reverts that change. I think you could've
> added the if (gen >= 5) check already here to not modify behaviour.

Ack.

> 
> parse_edp() also needs to drop references to dev_priv->vbt.edp.support.

Hmm. Did I not even compile test this? Bad me.

> 
> BR,
> Jani.
> 
> >  
> >  	DRM_DEBUG_KMS("DRRS State Enabled:%d\n", driver->drrs_enabled);
> >  	/*
> > @@ -1512,6 +1512,9 @@ init_vbt_defaults(struct drm_i915_private *dev_priv)
> >  	dev_priv->vbt.int_tv_support = 1;
> >  	dev_priv->vbt.int_crt_support = 1;
> >  
> > +	/* driver features */
> > +	dev_priv->vbt.int_lvds_support = 1;
> > +
> >  	/* Default to using SSC */
> >  	dev_priv->vbt.lvds_use_ssc = 1;
> >  	/*
> > diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c
> > index d35d2d50f595..05d012358df8 100644
> > --- a/drivers/gpu/drm/i915/intel_lvds.c
> > +++ b/drivers/gpu/drm/i915/intel_lvds.c
> > @@ -965,6 +965,11 @@ void intel_lvds_init(struct drm_i915_private *dev_priv)
> >  	if (dmi_check_system(intel_no_lvds))
> >  		return;
> >  
> > +	if (!dev_priv->vbt.int_lvds_support) {
> > +		DRM_DEBUG_KMS("Internal LVDS support disabled by VBT\n");
> > +		return;
> > +	}
> > +
> >  	if (HAS_PCH_SPLIT(dev_priv))
> >  		lvds_reg = PCH_LVDS;
> >  	else
> > @@ -975,10 +980,6 @@ void intel_lvds_init(struct drm_i915_private *dev_priv)
> >  	if (HAS_PCH_SPLIT(dev_priv)) {
> >  		if ((lvds & LVDS_DETECTED) == 0)
> >  			return;
> > -		if (dev_priv->vbt.edp.support) {
> > -			DRM_DEBUG_KMS("disable LVDS for eDP support\n");
> > -			return;
> > -		}
> >  	}
> >  
> >  	pin = GMBUS_PIN_PANEL;
> 
> -- 
> Jani Nikula, Intel Open Source Technology Center
kernel test robot May 8, 2018, 9:19 p.m. UTC | #3
Hi Ville,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on drm-intel/for-linux-next]
[also build test ERROR on v4.17-rc4 next-20180508]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Ville-Syrjala/drm-i915-Replace-vbt-edp-support-with-int_lvds_support/20180509-043426
base:   git://anongit.freedesktop.org/drm-intel for-linux-next
config: i386-randconfig-x003-201818 (attached as .config)
compiler: gcc-7 (Debian 7.3.0-16) 7.3.0
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

All errors (new ones prefixed by >>):

   drivers/gpu//drm/i915/intel_bios.c: In function 'parse_edp':
>> drivers/gpu//drm/i915/intel_bios.c:545:24: error: 'struct <anonymous>' has no member named 'support'
      if (dev_priv->vbt.edp.support)
                           ^

vim +545 drivers/gpu//drm/i915/intel_bios.c

32f9d658a Zhenyu Wang      2009-07-24  534  
6363ee6f4 Zhao Yakui       2009-11-24  535  static void
dcb58a40c Jani Nikula      2015-05-12  536  parse_edp(struct drm_i915_private *dev_priv, const struct bdb_header *bdb)
500a8cc46 Zhenyu Wang      2010-01-13  537  {
e8ef3b4c9 Jani Nikula      2015-04-15  538  	const struct bdb_edp *edp;
e8ef3b4c9 Jani Nikula      2015-04-15  539  	const struct edp_power_seq *edp_pps;
058727ee8 Jani Nikula      2017-08-25  540  	const struct edp_fast_link_params *edp_link_params;
3e845c7a4 Ville Syrjälä    2016-04-08  541  	int panel_type = dev_priv->vbt.panel_type;
500a8cc46 Zhenyu Wang      2010-01-13  542  
500a8cc46 Zhenyu Wang      2010-01-13  543  	edp = find_section(bdb, BDB_EDP);
500a8cc46 Zhenyu Wang      2010-01-13  544  	if (!edp) {
6aa23e658 Jani Nikula      2016-03-24 @545  		if (dev_priv->vbt.edp.support)
9a30a61f3 Jani Nikula      2012-11-12  546  			DRM_DEBUG_KMS("No eDP BDB found but eDP panel supported.\n");
500a8cc46 Zhenyu Wang      2010-01-13  547  		return;
500a8cc46 Zhenyu Wang      2010-01-13  548  	}
500a8cc46 Zhenyu Wang      2010-01-13  549  
500a8cc46 Zhenyu Wang      2010-01-13  550  	switch ((edp->color_depth >> (panel_type * 2)) & 3) {
500a8cc46 Zhenyu Wang      2010-01-13  551  	case EDP_18BPP:
6aa23e658 Jani Nikula      2016-03-24  552  		dev_priv->vbt.edp.bpp = 18;
500a8cc46 Zhenyu Wang      2010-01-13  553  		break;
500a8cc46 Zhenyu Wang      2010-01-13  554  	case EDP_24BPP:
6aa23e658 Jani Nikula      2016-03-24  555  		dev_priv->vbt.edp.bpp = 24;
500a8cc46 Zhenyu Wang      2010-01-13  556  		break;
500a8cc46 Zhenyu Wang      2010-01-13  557  	case EDP_30BPP:
6aa23e658 Jani Nikula      2016-03-24  558  		dev_priv->vbt.edp.bpp = 30;
500a8cc46 Zhenyu Wang      2010-01-13  559  		break;
500a8cc46 Zhenyu Wang      2010-01-13  560  	}
5ceb0f9bb Chris Wilson     2010-09-24  561  
9f0e7ff4b Jesse Barnes     2010-10-07  562  	/* Get the eDP sequencing and link info */
9f0e7ff4b Jesse Barnes     2010-10-07  563  	edp_pps = &edp->power_seqs[panel_type];
058727ee8 Jani Nikula      2017-08-25  564  	edp_link_params = &edp->fast_link_params[panel_type];
5ceb0f9bb Chris Wilson     2010-09-24  565  
6aa23e658 Jani Nikula      2016-03-24  566  	dev_priv->vbt.edp.pps = *edp_pps;
5ceb0f9bb Chris Wilson     2010-09-24  567  
e13e2b2c4 Jani Nikula      2014-05-06  568  	switch (edp_link_params->rate) {
e13e2b2c4 Jani Nikula      2014-05-06  569  	case EDP_RATE_1_62:
6aa23e658 Jani Nikula      2016-03-24  570  		dev_priv->vbt.edp.rate = DP_LINK_BW_1_62;
e13e2b2c4 Jani Nikula      2014-05-06  571  		break;
e13e2b2c4 Jani Nikula      2014-05-06  572  	case EDP_RATE_2_7:
6aa23e658 Jani Nikula      2016-03-24  573  		dev_priv->vbt.edp.rate = DP_LINK_BW_2_7;
e13e2b2c4 Jani Nikula      2014-05-06  574  		break;
e13e2b2c4 Jani Nikula      2014-05-06  575  	default:
e13e2b2c4 Jani Nikula      2014-05-06  576  		DRM_DEBUG_KMS("VBT has unknown eDP link rate value %u\n",
e13e2b2c4 Jani Nikula      2014-05-06  577  			      edp_link_params->rate);
e13e2b2c4 Jani Nikula      2014-05-06  578  		break;
e13e2b2c4 Jani Nikula      2014-05-06  579  	}
e13e2b2c4 Jani Nikula      2014-05-06  580  
9f0e7ff4b Jesse Barnes     2010-10-07  581  	switch (edp_link_params->lanes) {
e13e2b2c4 Jani Nikula      2014-05-06  582  	case EDP_LANE_1:
6aa23e658 Jani Nikula      2016-03-24  583  		dev_priv->vbt.edp.lanes = 1;
9f0e7ff4b Jesse Barnes     2010-10-07  584  		break;
e13e2b2c4 Jani Nikula      2014-05-06  585  	case EDP_LANE_2:
6aa23e658 Jani Nikula      2016-03-24  586  		dev_priv->vbt.edp.lanes = 2;
9f0e7ff4b Jesse Barnes     2010-10-07  587  		break;
e13e2b2c4 Jani Nikula      2014-05-06  588  	case EDP_LANE_4:
6aa23e658 Jani Nikula      2016-03-24  589  		dev_priv->vbt.edp.lanes = 4;
9f0e7ff4b Jesse Barnes     2010-10-07  590  		break;
e13e2b2c4 Jani Nikula      2014-05-06  591  	default:
e13e2b2c4 Jani Nikula      2014-05-06  592  		DRM_DEBUG_KMS("VBT has unknown eDP lane count value %u\n",
e13e2b2c4 Jani Nikula      2014-05-06  593  			      edp_link_params->lanes);
e13e2b2c4 Jani Nikula      2014-05-06  594  		break;
9f0e7ff4b Jesse Barnes     2010-10-07  595  	}
e13e2b2c4 Jani Nikula      2014-05-06  596  
9f0e7ff4b Jesse Barnes     2010-10-07  597  	switch (edp_link_params->preemphasis) {
e13e2b2c4 Jani Nikula      2014-05-06  598  	case EDP_PREEMPHASIS_NONE:
6aa23e658 Jani Nikula      2016-03-24  599  		dev_priv->vbt.edp.preemphasis = DP_TRAIN_PRE_EMPH_LEVEL_0;
9f0e7ff4b Jesse Barnes     2010-10-07  600  		break;
e13e2b2c4 Jani Nikula      2014-05-06  601  	case EDP_PREEMPHASIS_3_5dB:
6aa23e658 Jani Nikula      2016-03-24  602  		dev_priv->vbt.edp.preemphasis = DP_TRAIN_PRE_EMPH_LEVEL_1;
9f0e7ff4b Jesse Barnes     2010-10-07  603  		break;
e13e2b2c4 Jani Nikula      2014-05-06  604  	case EDP_PREEMPHASIS_6dB:
6aa23e658 Jani Nikula      2016-03-24  605  		dev_priv->vbt.edp.preemphasis = DP_TRAIN_PRE_EMPH_LEVEL_2;
9f0e7ff4b Jesse Barnes     2010-10-07  606  		break;
e13e2b2c4 Jani Nikula      2014-05-06  607  	case EDP_PREEMPHASIS_9_5dB:
6aa23e658 Jani Nikula      2016-03-24  608  		dev_priv->vbt.edp.preemphasis = DP_TRAIN_PRE_EMPH_LEVEL_3;
9f0e7ff4b Jesse Barnes     2010-10-07  609  		break;
e13e2b2c4 Jani Nikula      2014-05-06  610  	default:
e13e2b2c4 Jani Nikula      2014-05-06  611  		DRM_DEBUG_KMS("VBT has unknown eDP pre-emphasis value %u\n",
e13e2b2c4 Jani Nikula      2014-05-06  612  			      edp_link_params->preemphasis);
e13e2b2c4 Jani Nikula      2014-05-06  613  		break;
9f0e7ff4b Jesse Barnes     2010-10-07  614  	}
e13e2b2c4 Jani Nikula      2014-05-06  615  
9f0e7ff4b Jesse Barnes     2010-10-07  616  	switch (edp_link_params->vswing) {
e13e2b2c4 Jani Nikula      2014-05-06  617  	case EDP_VSWING_0_4V:
6aa23e658 Jani Nikula      2016-03-24  618  		dev_priv->vbt.edp.vswing = DP_TRAIN_VOLTAGE_SWING_LEVEL_0;
9f0e7ff4b Jesse Barnes     2010-10-07  619  		break;
e13e2b2c4 Jani Nikula      2014-05-06  620  	case EDP_VSWING_0_6V:
6aa23e658 Jani Nikula      2016-03-24  621  		dev_priv->vbt.edp.vswing = DP_TRAIN_VOLTAGE_SWING_LEVEL_1;
9f0e7ff4b Jesse Barnes     2010-10-07  622  		break;
e13e2b2c4 Jani Nikula      2014-05-06  623  	case EDP_VSWING_0_8V:
6aa23e658 Jani Nikula      2016-03-24  624  		dev_priv->vbt.edp.vswing = DP_TRAIN_VOLTAGE_SWING_LEVEL_2;
9f0e7ff4b Jesse Barnes     2010-10-07  625  		break;
e13e2b2c4 Jani Nikula      2014-05-06  626  	case EDP_VSWING_1_2V:
6aa23e658 Jani Nikula      2016-03-24  627  		dev_priv->vbt.edp.vswing = DP_TRAIN_VOLTAGE_SWING_LEVEL_3;
9f0e7ff4b Jesse Barnes     2010-10-07  628  		break;
e13e2b2c4 Jani Nikula      2014-05-06  629  	default:
e13e2b2c4 Jani Nikula      2014-05-06  630  		DRM_DEBUG_KMS("VBT has unknown eDP voltage swing value %u\n",
e13e2b2c4 Jani Nikula      2014-05-06  631  			      edp_link_params->vswing);
e13e2b2c4 Jani Nikula      2014-05-06  632  		break;
9f0e7ff4b Jesse Barnes     2010-10-07  633  	}
9a57f5bb7 Sonika Jindal    2015-02-25  634  
9a57f5bb7 Sonika Jindal    2015-02-25  635  	if (bdb->version >= 173) {
9a57f5bb7 Sonika Jindal    2015-02-25  636  		uint8_t vswing;
9a57f5bb7 Sonika Jindal    2015-02-25  637  
9e4580346 Sonika Jindal    2015-05-06  638  		/* Don't read from VBT if module parameter has valid value*/
4f044a88a Michal Wajdeczko 2017-09-19  639  		if (i915_modparams.edp_vswing) {
4f044a88a Michal Wajdeczko 2017-09-19  640  			dev_priv->vbt.edp.low_vswing =
4f044a88a Michal Wajdeczko 2017-09-19  641  				i915_modparams.edp_vswing == 1;
9e4580346 Sonika Jindal    2015-05-06  642  		} else {
9a57f5bb7 Sonika Jindal    2015-02-25  643  			vswing = (edp->edp_vswing_preemph >> (panel_type * 4)) & 0xF;
06411f08b Jani Nikula      2016-03-24  644  			dev_priv->vbt.edp.low_vswing = vswing == 0;
9e4580346 Sonika Jindal    2015-05-06  645  		}
9a57f5bb7 Sonika Jindal    2015-02-25  646  	}
500a8cc46 Zhenyu Wang      2010-01-13  647  }
500a8cc46 Zhenyu Wang      2010-01-13  648  

:::::: The code at line 545 was first introduced by commit
:::::: 6aa23e658d910342e8fedb23780638ddaed744d7 drm/i915: use a substruct in vbt data for edp

:::::: TO: Jani Nikula <jani.nikula@intel.com>
:::::: CC: Jani Nikula <jani.nikula@intel.com>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
kernel test robot May 8, 2018, 10:39 p.m. UTC | #4
Hi Ville,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on drm-intel/for-linux-next]
[also build test WARNING on v4.17-rc4 next-20180508]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Ville-Syrjala/drm-i915-Replace-vbt-edp-support-with-int_lvds_support/20180509-043426
base:   git://anongit.freedesktop.org/drm-intel for-linux-next
config: i386-randconfig-x076-201818 (attached as .config)
compiler: gcc-7 (Debian 7.3.0-16) 7.3.0
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

All warnings (new ones prefixed by >>):

   In file included from include/linux/string.h:6:0,
                    from include/linux/uuid.h:20,
                    from include/linux/mod_devicetable.h:13,
                    from include/linux/i2c.h:29,
                    from include/drm/drm_dp_helper.h:27,
                    from drivers/gpu//drm/i915/intel_bios.c:28:
   drivers/gpu//drm/i915/intel_bios.c: In function 'parse_edp':
   drivers/gpu//drm/i915/intel_bios.c:545:24: error: 'struct <anonymous>' has no member named 'support'
      if (dev_priv->vbt.edp.support)
                           ^
   include/linux/compiler.h:58:30: note: in definition of macro '__trace_if'
     if (__builtin_constant_p(!!(cond)) ? !!(cond) :   \
                                 ^~~~
>> drivers/gpu//drm/i915/intel_bios.c:545:3: note: in expansion of macro 'if'
      if (dev_priv->vbt.edp.support)
      ^~
   drivers/gpu//drm/i915/intel_bios.c:545:24: error: 'struct <anonymous>' has no member named 'support'
      if (dev_priv->vbt.edp.support)
                           ^
   include/linux/compiler.h:58:42: note: in definition of macro '__trace_if'
     if (__builtin_constant_p(!!(cond)) ? !!(cond) :   \
                                             ^~~~
>> drivers/gpu//drm/i915/intel_bios.c:545:3: note: in expansion of macro 'if'
      if (dev_priv->vbt.edp.support)
      ^~
   drivers/gpu//drm/i915/intel_bios.c:545:24: error: 'struct <anonymous>' has no member named 'support'
      if (dev_priv->vbt.edp.support)
                           ^
   include/linux/compiler.h:69:16: note: in definition of macro '__trace_if'
      ______r = !!(cond);     \
                   ^~~~
>> drivers/gpu//drm/i915/intel_bios.c:545:3: note: in expansion of macro 'if'
      if (dev_priv->vbt.edp.support)
      ^~

vim +/if +545 drivers/gpu//drm/i915/intel_bios.c

32f9d658a Zhenyu Wang      2009-07-24  534  
6363ee6f4 Zhao Yakui       2009-11-24  535  static void
dcb58a40c Jani Nikula      2015-05-12  536  parse_edp(struct drm_i915_private *dev_priv, const struct bdb_header *bdb)
500a8cc46 Zhenyu Wang      2010-01-13  537  {
e8ef3b4c9 Jani Nikula      2015-04-15  538  	const struct bdb_edp *edp;
e8ef3b4c9 Jani Nikula      2015-04-15  539  	const struct edp_power_seq *edp_pps;
058727ee8 Jani Nikula      2017-08-25  540  	const struct edp_fast_link_params *edp_link_params;
3e845c7a4 Ville Syrjälä    2016-04-08  541  	int panel_type = dev_priv->vbt.panel_type;
500a8cc46 Zhenyu Wang      2010-01-13  542  
500a8cc46 Zhenyu Wang      2010-01-13  543  	edp = find_section(bdb, BDB_EDP);
500a8cc46 Zhenyu Wang      2010-01-13  544  	if (!edp) {
6aa23e658 Jani Nikula      2016-03-24 @545  		if (dev_priv->vbt.edp.support)
9a30a61f3 Jani Nikula      2012-11-12  546  			DRM_DEBUG_KMS("No eDP BDB found but eDP panel supported.\n");
500a8cc46 Zhenyu Wang      2010-01-13  547  		return;
500a8cc46 Zhenyu Wang      2010-01-13  548  	}
500a8cc46 Zhenyu Wang      2010-01-13  549  
500a8cc46 Zhenyu Wang      2010-01-13  550  	switch ((edp->color_depth >> (panel_type * 2)) & 3) {
500a8cc46 Zhenyu Wang      2010-01-13  551  	case EDP_18BPP:
6aa23e658 Jani Nikula      2016-03-24  552  		dev_priv->vbt.edp.bpp = 18;
500a8cc46 Zhenyu Wang      2010-01-13  553  		break;
500a8cc46 Zhenyu Wang      2010-01-13  554  	case EDP_24BPP:
6aa23e658 Jani Nikula      2016-03-24  555  		dev_priv->vbt.edp.bpp = 24;
500a8cc46 Zhenyu Wang      2010-01-13  556  		break;
500a8cc46 Zhenyu Wang      2010-01-13  557  	case EDP_30BPP:
6aa23e658 Jani Nikula      2016-03-24  558  		dev_priv->vbt.edp.bpp = 30;
500a8cc46 Zhenyu Wang      2010-01-13  559  		break;
500a8cc46 Zhenyu Wang      2010-01-13  560  	}
5ceb0f9bb Chris Wilson     2010-09-24  561  
9f0e7ff4b Jesse Barnes     2010-10-07  562  	/* Get the eDP sequencing and link info */
9f0e7ff4b Jesse Barnes     2010-10-07  563  	edp_pps = &edp->power_seqs[panel_type];
058727ee8 Jani Nikula      2017-08-25  564  	edp_link_params = &edp->fast_link_params[panel_type];
5ceb0f9bb Chris Wilson     2010-09-24  565  
6aa23e658 Jani Nikula      2016-03-24  566  	dev_priv->vbt.edp.pps = *edp_pps;
5ceb0f9bb Chris Wilson     2010-09-24  567  
e13e2b2c4 Jani Nikula      2014-05-06  568  	switch (edp_link_params->rate) {
e13e2b2c4 Jani Nikula      2014-05-06  569  	case EDP_RATE_1_62:
6aa23e658 Jani Nikula      2016-03-24  570  		dev_priv->vbt.edp.rate = DP_LINK_BW_1_62;
e13e2b2c4 Jani Nikula      2014-05-06  571  		break;
e13e2b2c4 Jani Nikula      2014-05-06  572  	case EDP_RATE_2_7:
6aa23e658 Jani Nikula      2016-03-24  573  		dev_priv->vbt.edp.rate = DP_LINK_BW_2_7;
e13e2b2c4 Jani Nikula      2014-05-06  574  		break;
e13e2b2c4 Jani Nikula      2014-05-06  575  	default:
e13e2b2c4 Jani Nikula      2014-05-06  576  		DRM_DEBUG_KMS("VBT has unknown eDP link rate value %u\n",
e13e2b2c4 Jani Nikula      2014-05-06  577  			      edp_link_params->rate);
e13e2b2c4 Jani Nikula      2014-05-06  578  		break;
e13e2b2c4 Jani Nikula      2014-05-06  579  	}
e13e2b2c4 Jani Nikula      2014-05-06  580  
9f0e7ff4b Jesse Barnes     2010-10-07  581  	switch (edp_link_params->lanes) {
e13e2b2c4 Jani Nikula      2014-05-06  582  	case EDP_LANE_1:
6aa23e658 Jani Nikula      2016-03-24  583  		dev_priv->vbt.edp.lanes = 1;
9f0e7ff4b Jesse Barnes     2010-10-07  584  		break;
e13e2b2c4 Jani Nikula      2014-05-06  585  	case EDP_LANE_2:
6aa23e658 Jani Nikula      2016-03-24  586  		dev_priv->vbt.edp.lanes = 2;
9f0e7ff4b Jesse Barnes     2010-10-07  587  		break;
e13e2b2c4 Jani Nikula      2014-05-06  588  	case EDP_LANE_4:
6aa23e658 Jani Nikula      2016-03-24  589  		dev_priv->vbt.edp.lanes = 4;
9f0e7ff4b Jesse Barnes     2010-10-07  590  		break;
e13e2b2c4 Jani Nikula      2014-05-06  591  	default:
e13e2b2c4 Jani Nikula      2014-05-06  592  		DRM_DEBUG_KMS("VBT has unknown eDP lane count value %u\n",
e13e2b2c4 Jani Nikula      2014-05-06  593  			      edp_link_params->lanes);
e13e2b2c4 Jani Nikula      2014-05-06  594  		break;
9f0e7ff4b Jesse Barnes     2010-10-07  595  	}
e13e2b2c4 Jani Nikula      2014-05-06  596  
9f0e7ff4b Jesse Barnes     2010-10-07  597  	switch (edp_link_params->preemphasis) {
e13e2b2c4 Jani Nikula      2014-05-06  598  	case EDP_PREEMPHASIS_NONE:
6aa23e658 Jani Nikula      2016-03-24  599  		dev_priv->vbt.edp.preemphasis = DP_TRAIN_PRE_EMPH_LEVEL_0;
9f0e7ff4b Jesse Barnes     2010-10-07  600  		break;
e13e2b2c4 Jani Nikula      2014-05-06  601  	case EDP_PREEMPHASIS_3_5dB:
6aa23e658 Jani Nikula      2016-03-24  602  		dev_priv->vbt.edp.preemphasis = DP_TRAIN_PRE_EMPH_LEVEL_1;
9f0e7ff4b Jesse Barnes     2010-10-07  603  		break;
e13e2b2c4 Jani Nikula      2014-05-06  604  	case EDP_PREEMPHASIS_6dB:
6aa23e658 Jani Nikula      2016-03-24  605  		dev_priv->vbt.edp.preemphasis = DP_TRAIN_PRE_EMPH_LEVEL_2;
9f0e7ff4b Jesse Barnes     2010-10-07  606  		break;
e13e2b2c4 Jani Nikula      2014-05-06  607  	case EDP_PREEMPHASIS_9_5dB:
6aa23e658 Jani Nikula      2016-03-24  608  		dev_priv->vbt.edp.preemphasis = DP_TRAIN_PRE_EMPH_LEVEL_3;
9f0e7ff4b Jesse Barnes     2010-10-07  609  		break;
e13e2b2c4 Jani Nikula      2014-05-06  610  	default:
e13e2b2c4 Jani Nikula      2014-05-06  611  		DRM_DEBUG_KMS("VBT has unknown eDP pre-emphasis value %u\n",
e13e2b2c4 Jani Nikula      2014-05-06  612  			      edp_link_params->preemphasis);
e13e2b2c4 Jani Nikula      2014-05-06  613  		break;
9f0e7ff4b Jesse Barnes     2010-10-07  614  	}
e13e2b2c4 Jani Nikula      2014-05-06  615  
9f0e7ff4b Jesse Barnes     2010-10-07  616  	switch (edp_link_params->vswing) {
e13e2b2c4 Jani Nikula      2014-05-06  617  	case EDP_VSWING_0_4V:
6aa23e658 Jani Nikula      2016-03-24  618  		dev_priv->vbt.edp.vswing = DP_TRAIN_VOLTAGE_SWING_LEVEL_0;
9f0e7ff4b Jesse Barnes     2010-10-07  619  		break;
e13e2b2c4 Jani Nikula      2014-05-06  620  	case EDP_VSWING_0_6V:
6aa23e658 Jani Nikula      2016-03-24  621  		dev_priv->vbt.edp.vswing = DP_TRAIN_VOLTAGE_SWING_LEVEL_1;
9f0e7ff4b Jesse Barnes     2010-10-07  622  		break;
e13e2b2c4 Jani Nikula      2014-05-06  623  	case EDP_VSWING_0_8V:
6aa23e658 Jani Nikula      2016-03-24  624  		dev_priv->vbt.edp.vswing = DP_TRAIN_VOLTAGE_SWING_LEVEL_2;
9f0e7ff4b Jesse Barnes     2010-10-07  625  		break;
e13e2b2c4 Jani Nikula      2014-05-06  626  	case EDP_VSWING_1_2V:
6aa23e658 Jani Nikula      2016-03-24  627  		dev_priv->vbt.edp.vswing = DP_TRAIN_VOLTAGE_SWING_LEVEL_3;
9f0e7ff4b Jesse Barnes     2010-10-07  628  		break;
e13e2b2c4 Jani Nikula      2014-05-06  629  	default:
e13e2b2c4 Jani Nikula      2014-05-06  630  		DRM_DEBUG_KMS("VBT has unknown eDP voltage swing value %u\n",
e13e2b2c4 Jani Nikula      2014-05-06  631  			      edp_link_params->vswing);
e13e2b2c4 Jani Nikula      2014-05-06  632  		break;
9f0e7ff4b Jesse Barnes     2010-10-07  633  	}
9a57f5bb7 Sonika Jindal    2015-02-25  634  
9a57f5bb7 Sonika Jindal    2015-02-25  635  	if (bdb->version >= 173) {
9a57f5bb7 Sonika Jindal    2015-02-25  636  		uint8_t vswing;
9a57f5bb7 Sonika Jindal    2015-02-25  637  
9e4580346 Sonika Jindal    2015-05-06  638  		/* Don't read from VBT if module parameter has valid value*/
4f044a88a Michal Wajdeczko 2017-09-19  639  		if (i915_modparams.edp_vswing) {
4f044a88a Michal Wajdeczko 2017-09-19  640  			dev_priv->vbt.edp.low_vswing =
4f044a88a Michal Wajdeczko 2017-09-19  641  				i915_modparams.edp_vswing == 1;
9e4580346 Sonika Jindal    2015-05-06  642  		} else {
9a57f5bb7 Sonika Jindal    2015-02-25  643  			vswing = (edp->edp_vswing_preemph >> (panel_type * 4)) & 0xF;
06411f08b Jani Nikula      2016-03-24  644  			dev_priv->vbt.edp.low_vswing = vswing == 0;
9e4580346 Sonika Jindal    2015-05-06  645  		}
9a57f5bb7 Sonika Jindal    2015-02-25  646  	}
500a8cc46 Zhenyu Wang      2010-01-13  647  }
500a8cc46 Zhenyu Wang      2010-01-13  648  

:::::: The code at line 545 was first introduced by commit
:::::: 6aa23e658d910342e8fedb23780638ddaed744d7 drm/i915: use a substruct in vbt data for edp

:::::: TO: Jani Nikula <jani.nikula@intel.com>
:::::: CC: Jani Nikula <jani.nikula@intel.com>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 04e27806e581..3bdc7cfd4189 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -1052,6 +1052,7 @@  struct intel_vbt_data {
 	unsigned int lvds_vbt:1;
 	unsigned int int_crt_support:1;
 	unsigned int lvds_use_ssc:1;
+	unsigned int int_lvds_support:1;
 	unsigned int display_clock_mode:1;
 	unsigned int fdi_rx_polarity_inverted:1;
 	unsigned int panel_type:4;
@@ -1067,7 +1068,6 @@  struct intel_vbt_data {
 		int vswing;
 		bool low_vswing;
 		bool initialized;
-		bool support;
 		int bpp;
 		struct edp_power_seq pps;
 	} edp;
diff --git a/drivers/gpu/drm/i915/intel_bios.c b/drivers/gpu/drm/i915/intel_bios.c
index 702d3fab97fc..49c6816d008c 100644
--- a/drivers/gpu/drm/i915/intel_bios.c
+++ b/drivers/gpu/drm/i915/intel_bios.c
@@ -519,7 +519,7 @@  parse_driver_features(struct drm_i915_private *dev_priv,
 		return;
 
 	if (driver->lvds_config == BDB_DRIVER_FEATURE_EDP)
-		dev_priv->vbt.edp.support = 1;
+		dev_priv->vbt.int_lvds_support = 0;
 
 	DRM_DEBUG_KMS("DRRS State Enabled:%d\n", driver->drrs_enabled);
 	/*
@@ -1512,6 +1512,9 @@  init_vbt_defaults(struct drm_i915_private *dev_priv)
 	dev_priv->vbt.int_tv_support = 1;
 	dev_priv->vbt.int_crt_support = 1;
 
+	/* driver features */
+	dev_priv->vbt.int_lvds_support = 1;
+
 	/* Default to using SSC */
 	dev_priv->vbt.lvds_use_ssc = 1;
 	/*
diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c
index d35d2d50f595..05d012358df8 100644
--- a/drivers/gpu/drm/i915/intel_lvds.c
+++ b/drivers/gpu/drm/i915/intel_lvds.c
@@ -965,6 +965,11 @@  void intel_lvds_init(struct drm_i915_private *dev_priv)
 	if (dmi_check_system(intel_no_lvds))
 		return;
 
+	if (!dev_priv->vbt.int_lvds_support) {
+		DRM_DEBUG_KMS("Internal LVDS support disabled by VBT\n");
+		return;
+	}
+
 	if (HAS_PCH_SPLIT(dev_priv))
 		lvds_reg = PCH_LVDS;
 	else
@@ -975,10 +980,6 @@  void intel_lvds_init(struct drm_i915_private *dev_priv)
 	if (HAS_PCH_SPLIT(dev_priv)) {
 		if ((lvds & LVDS_DETECTED) == 0)
 			return;
-		if (dev_priv->vbt.edp.support) {
-			DRM_DEBUG_KMS("disable LVDS for eDP support\n");
-			return;
-		}
 	}
 
 	pin = GMBUS_PIN_PANEL;