All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Manna, Animesh" <animesh.manna@intel.com>
To: Ville Syrjala <ville.syrjala@linux.intel.com>,
	"intel-gfx@lists.freedesktop.org"
	<intel-gfx@lists.freedesktop.org>
Subject: Re: [Intel-gfx] [PATCH v2 6/9] drm/i915: Reject unusablee power sequencers
Date: Thu, 8 Dec 2022 15:30:17 +0000	[thread overview]
Message-ID: <PH7PR11MB5981A0B1507801392B2B0356F91D9@PH7PR11MB5981.namprd11.prod.outlook.com> (raw)
In-Reply-To: <20221125173156.31689-7-ville.syrjala@linux.intel.com>



> -----Original Message-----
> From: Ville Syrjala <ville.syrjala@linux.intel.com>
> Sent: Friday, November 25, 2022 11:02 PM
> To: intel-gfx@lists.freedesktop.org
> Cc: Manna, Animesh <animesh.manna@intel.com>
> Subject: [PATCH v2 6/9] drm/i915: Reject unusablee power sequencers
> 
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> On ICP-ADP the pins used by the second PPS can be alternatively muxed to
> some other function. In that case the second power sequencer is unusable.
> 
> Unfortunately (on my ADL Thinkpad T14 gen3 at least) the BIOS still likes to
> enable the VDD on the second PPS (due to the VBT declaring the second
> bogus eDP panel) even when not correctly muxed, so we need to deal with it
> somehow.
> For now let's just initialize the PPS as normal, and then use the normal eDP
> probe failure VDD off path to turn it off (and release the wakeref the PPS init
> grabbed). The alternative of just declaring that the platform has a single PPS
> doesn't really work since it would cause the second eDP probe to also try to
> use the first PPS and thus clobber the state for the first (real) eDP panel.
> 
> Cc: Animesh Manna <animesh.manna@intel.com>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

Reviewed-by: Animesh Manna <animesh.manna@intel.com>

> ---
>  drivers/gpu/drm/i915/display/intel_dp.c  | 12 ++++++++-
> drivers/gpu/drm/i915/display/intel_pps.c | 34 +++++++++++++++++-------
> drivers/gpu/drm/i915/display/intel_pps.h |  2 +-
>  drivers/gpu/drm/i915/i915_reg.h          |  1 +
>  4 files changed, 38 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_dp.c
> b/drivers/gpu/drm/i915/display/intel_dp.c
> index c1bebe77ed8e..9deaa5e3632a 100644
> --- a/drivers/gpu/drm/i915/display/intel_dp.c
> +++ b/drivers/gpu/drm/i915/display/intel_dp.c
> @@ -5283,7 +5283,17 @@ static bool intel_edp_init_connector(struct
> intel_dp *intel_dp,
>  	intel_bios_init_panel_early(dev_priv, &intel_connector->panel,
>  				    encoder->devdata);
> 
> -	intel_pps_init(intel_dp);
> +	if (!intel_pps_init(intel_dp)) {
> +		drm_info(&dev_priv->drm,
> +			 "[ENCODER:%d:%s] unusable PPS, disabling eDP\n",
> +			 encoder->base.base.id, encoder->base.name);
> +		/*
> +		 * The BIOS may have still enabled VDD on the PPS even
> +		 * though it's unusable. Make sure we turn it back off
> +		 * and to release the power domain references/etc.
> +		 */
> +		goto out_vdd_off;
> +	}
> 
>  	/* Cache DPCD and EDID for edp. */
>  	has_dpcd = intel_edp_init_dpcd(intel_dp); diff --git
> a/drivers/gpu/drm/i915/display/intel_pps.c
> b/drivers/gpu/drm/i915/display/intel_pps.c
> index 77b0a4f27abc..d18c1c58dfcf 100644
> --- a/drivers/gpu/drm/i915/display/intel_pps.c
> +++ b/drivers/gpu/drm/i915/display/intel_pps.c
> @@ -327,6 +327,18 @@ static int intel_num_pps(struct drm_i915_private
> *i915)
>  	return 1;
>  }
> 
> +static bool intel_pps_is_valid(struct intel_dp *intel_dp) {
> +	struct drm_i915_private *i915 = dp_to_i915(intel_dp);
> +
> +	if (intel_dp->pps.pps_idx == 1 &&
> +	    INTEL_PCH_TYPE(i915) >= PCH_ICP &&
> +	    INTEL_PCH_TYPE(i915) < PCH_MTP)
> +		return intel_de_read(i915, SOUTH_CHICKEN1) &
> +ICP_SECOND_PPS_IO_SELECT;
> +
> +	return true;
> +}
> +
>  static int
>  bxt_initial_pps_idx(struct drm_i915_private *i915, pps_check check)  { @@ -
> 340,7 +352,7 @@ bxt_initial_pps_idx(struct drm_i915_private *i915,
> pps_check check)
>  	return -1;
>  }
> 
> -static void
> +static bool
>  pps_initial_setup(struct intel_dp *intel_dp)  {
>  	struct intel_encoder *encoder = &dp_to_dig_port(intel_dp)->base;
> @@ -351,7 +363,7 @@ pps_initial_setup(struct intel_dp *intel_dp)
> 
>  	if (IS_VALLEYVIEW(i915) || IS_CHERRYVIEW(i915)) {
>  		vlv_initial_power_sequencer_setup(intel_dp);
> -		return;
> +		return true;
>  	}
> 
>  	/* first ask the VBT */
> @@ -377,13 +389,14 @@ pps_initial_setup(struct intel_dp *intel_dp)
>  			    "[ENCODER:%d:%s] no initial power sequencer,
> assuming %d\n",
>  			    encoder->base.base.id, encoder->base.name,
>  			    intel_dp->pps.pps_idx);
> -		return;
> +	} else {
> +		drm_dbg_kms(&i915->drm,
> +			    "[ENCODER:%d:%s] initial power sequencer:
> %d\n",
> +			    encoder->base.base.id, encoder->base.name,
> +			    intel_dp->pps.pps_idx);
>  	}
> 
> -	drm_dbg_kms(&i915->drm,
> -		    "[ENCODER:%d:%s] initial power sequencer: %d\n",
> -		    encoder->base.base.id, encoder->base.name,
> -		    intel_dp->pps.pps_idx);
> +	return intel_pps_is_valid(intel_dp);
>  }
> 
>  void intel_pps_reset_all(struct drm_i915_private *dev_priv) @@ -1504,9
> +1517,10 @@ void intel_pps_encoder_reset(struct intel_dp *intel_dp)
>  	}
>  }
> 
> -void intel_pps_init(struct intel_dp *intel_dp)
> +bool intel_pps_init(struct intel_dp *intel_dp)
>  {
>  	intel_wakeref_t wakeref;
> +	bool ret;
> 
>  	intel_dp->pps.initializing = true;
>  	INIT_DELAYED_WORK(&intel_dp->pps.panel_vdd_work,
> edp_panel_vdd_work); @@ -1514,12 +1528,14 @@ void
> intel_pps_init(struct intel_dp *intel_dp)
>  	pps_init_timestamps(intel_dp);
> 
>  	with_intel_pps_lock(intel_dp, wakeref) {
> -		pps_initial_setup(intel_dp);
> +		ret = pps_initial_setup(intel_dp);
> 
>  		pps_init_delays(intel_dp);
>  		pps_init_registers(intel_dp, false);
>  		pps_vdd_init(intel_dp);
>  	}
> +
> +	return ret;
>  }
> 
>  static void pps_init_late(struct intel_dp *intel_dp) diff --git
> a/drivers/gpu/drm/i915/display/intel_pps.h
> b/drivers/gpu/drm/i915/display/intel_pps.h
> index a3a56f903f26..a2c2467e3c22 100644
> --- a/drivers/gpu/drm/i915/display/intel_pps.h
> +++ b/drivers/gpu/drm/i915/display/intel_pps.h
> @@ -40,7 +40,7 @@ void intel_pps_vdd_off_sync(struct intel_dp *intel_dp);
> bool intel_pps_have_panel_power_or_vdd(struct intel_dp *intel_dp);  void
> intel_pps_wait_power_cycle(struct intel_dp *intel_dp);
> 
> -void intel_pps_init(struct intel_dp *intel_dp);
> +bool intel_pps_init(struct intel_dp *intel_dp);
>  void intel_pps_init_late(struct intel_dp *intel_dp);  void
> intel_pps_encoder_reset(struct intel_dp *intel_dp);  void
> intel_pps_reset_all(struct drm_i915_private *i915); diff --git
> a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
> index 0b90fe6a28f7..ebb45935750c 100644
> --- a/drivers/gpu/drm/i915/i915_reg.h
> +++ b/drivers/gpu/drm/i915/i915_reg.h
> @@ -6242,6 +6242,7 @@
>  #define  CHASSIS_CLK_REQ_DURATION_MASK	(0xf << 8)
>  #define  CHASSIS_CLK_REQ_DURATION(x)	((x) << 8)
>  #define  SBCLK_RUN_REFCLK_DIS		(1 << 7)
> +#define  ICP_SECOND_PPS_IO_SELECT	REG_BIT(2)
>  #define  SPT_PWM_GRANULARITY		(1 << 0)
>  #define SOUTH_CHICKEN2		_MMIO(0xc2004)
>  #define  FDI_MPHY_IOSFSB_RESET_STATUS	(1 << 13)
> --
> 2.37.4


  reply	other threads:[~2022-12-08 15:30 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-25 17:31 [Intel-gfx] [PATCH v2 0/9] drm/i915: Fake dual eDP VBT fixes Ville Syrjala
2022-11-25 17:31 ` [Intel-gfx] [PATCH v2 1/9] drm/i915: Introduce intel_panel_init_alloc() Ville Syrjala
2022-11-25 17:31 ` [Intel-gfx] [PATCH v2 2/9] drm/i915: Do panel VBT init early if the VBT declares an explicit panel type Ville Syrjala
2022-11-25 17:31 ` [Intel-gfx] [PATCH v2 3/9] drm/i915: Generalize the PPS vlv_pipe_check() stuff Ville Syrjala
2022-11-25 17:31 ` [Intel-gfx] [PATCH v2 4/9] drm/i915: Try to use the correct power sequencer intiially on bxt/glk Ville Syrjala
2022-12-08 15:28   ` Manna, Animesh
2022-11-25 17:31 ` [Intel-gfx] [PATCH v2 5/9] drm/i915: Extend dual PPS handlind for ICP+ Ville Syrjala
2022-12-08 15:29   ` Manna, Animesh
2022-11-25 17:31 ` [Intel-gfx] [PATCH v2 6/9] drm/i915: Reject unusablee power sequencers Ville Syrjala
2022-12-08 15:30   ` Manna, Animesh [this message]
2022-11-25 17:31 ` [Intel-gfx] [PATCH v2 7/9] drm/i915: Print the PPS registers using consistent format Ville Syrjala
2022-12-08 15:30   ` Manna, Animesh
2022-11-25 17:31 ` [Intel-gfx] [PATCH v2 8/9] drm/i915: Fix whitespace Ville Syrjala
2022-12-08 15:31   ` Manna, Animesh
2022-11-25 17:31 ` [Intel-gfx] [PATCH v2 9/9] drm/i915: Improve PPS debugs Ville Syrjala
2022-11-27 13:42   ` [Intel-gfx] [PATCH v3 " Ville Syrjala
2022-11-27 15:52   ` [Intel-gfx] [PATCH v4 " Ville Syrjala
2022-12-08 15:41   ` [Intel-gfx] [PATCH v2 " Manna, Animesh
2022-11-25 17:54 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for drm/i915: Fake dual eDP VBT fixes (rev2) Patchwork
2022-11-25 17:54 ` [Intel-gfx] ✗ Fi.CI.SPARSE: " Patchwork
2022-11-25 18:15 ` [Intel-gfx] ✗ Fi.CI.BAT: failure " Patchwork
2022-11-27 13:56 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for drm/i915: Fake dual eDP VBT fixes (rev3) Patchwork
2022-11-27 13:56 ` [Intel-gfx] ✗ Fi.CI.SPARSE: " Patchwork
2022-11-27 14:18 ` [Intel-gfx] ✗ Fi.CI.BAT: failure " Patchwork
2022-11-27 16:07 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for drm/i915: Fake dual eDP VBT fixes (rev4) Patchwork
2022-11-27 16:07 ` [Intel-gfx] ✗ Fi.CI.SPARSE: " Patchwork
2022-11-27 16:29 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=PH7PR11MB5981A0B1507801392B2B0356F91D9@PH7PR11MB5981.namprd11.prod.outlook.com \
    --to=animesh.manna@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=ville.syrjala@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.