Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@intel.com>
To: Animesh Manna <animesh.manna@intel.com>,
	intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org,
	dri-devel@lists.freedesktop.org
Cc: "Animesh Manna" <animesh.manna@intel.com>,
	"Jouni Högander" <jouni.hogander@intel.com>
Subject: Re: [PATCH v2 02/10] drm/i915/alpm: alpm_init() for DP2.1
Date: Mon, 10 Nov 2025 11:01:12 +0200	[thread overview]
Message-ID: <7c735321b2c5c08ce1fac9f2d358ae06e9ad0b60@intel.com> (raw)
In-Reply-To: <20251103220957.1229608-3-animesh.manna@intel.com>

On Tue, 04 Nov 2025, Animesh Manna <animesh.manna@intel.com> wrote:
> Initialize alpm for DP2.1 and separate out alpm mutex-init
> from alpm-init.
>
> v1: Initial version.
> v2: Separate out mutex-init. [Jani]

Under no circumstances should you have two places and code paths to
initialize a mutex.

I think you need two or three functions, one for initializing the mutex
(and potentially other similar stuff), one for dynamic initialization
for eDP and one for DP. Don't sprinkle the display version checks all
over the place.

BR,
Jani.

>
> Cc: Jouni Högander <jouni.hogander@intel.com>
> Signed-off-by: Animesh Manna <animesh.manna@intel.com>
> ---
>  drivers/gpu/drm/i915/display/intel_alpm.c |  1 -
>  drivers/gpu/drm/i915/display/intel_dp.c   | 11 ++++++++++-
>  2 files changed, 10 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_alpm.c b/drivers/gpu/drm/i915/display/intel_alpm.c
> index 6372f533f65b..639941e332f3 100644
> --- a/drivers/gpu/drm/i915/display/intel_alpm.c
> +++ b/drivers/gpu/drm/i915/display/intel_alpm.c
> @@ -49,7 +49,6 @@ void intel_alpm_init(struct intel_dp *intel_dp)
>  		return;
>  
>  	intel_dp->alpm_dpcd = dpcd;
> -	mutex_init(&intel_dp->alpm.lock);
>  }
>  
>  static int get_silence_period_symbols(const struct intel_crtc_state *crtc_state)
> diff --git a/drivers/gpu/drm/i915/display/intel_dp.c b/drivers/gpu/drm/i915/display/intel_dp.c
> index 0ec82fcbcf48..f995a98df2c3 100644
> --- a/drivers/gpu/drm/i915/display/intel_dp.c
> +++ b/drivers/gpu/drm/i915/display/intel_dp.c
> @@ -6074,8 +6074,12 @@ intel_dp_detect(struct drm_connector *_connector,
>  	if (ret == 1)
>  		connector->base.epoch_counter++;
>  
> -	if (!intel_dp_is_edp(intel_dp))
> +	if (!intel_dp_is_edp(intel_dp)) {
> +		if (DISPLAY_VER(display) >= 35)
> +			intel_alpm_init(intel_dp);
> +
>  		intel_psr_init_dpcd(intel_dp);
> +	}
>  
>  	intel_dp_detect_dsc_caps(intel_dp, connector);
>  
> @@ -6717,6 +6721,8 @@ static bool intel_edp_init_connector(struct intel_dp *intel_dp,
>  	intel_hpd_enable_detection(encoder);
>  
>  	intel_alpm_init(intel_dp);
> +	if (intel_dp->alpm_dpcd)
> +		mutex_init(&intel_dp->alpm.lock);
>  
>  	/* Cache DPCD and EDID for edp. */
>  	has_dpcd = intel_edp_init_dpcd(intel_dp, connector);
> @@ -6932,6 +6938,9 @@ intel_dp_init_connector(struct intel_digital_port *dig_port,
>  
>  	intel_psr_init(intel_dp);
>  
> +	if (DISPLAY_VER(display) >= 35)
> +		mutex_init(&intel_dp->alpm.lock);
> +
>  	return true;
>  
>  fail:

-- 
Jani Nikula, Intel

  reply	other threads:[~2025-11-10  9:01 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-03 22:09 [PATCH v2 00/10] Enable DP2.1 alpm Animesh Manna
2025-11-03 22:09 ` [PATCH v2 01/10] drm/i915/alpm: Add dpcd definition for DP2.1 alpm capability Animesh Manna
2025-11-04  4:01   ` Kandpal, Suraj
2025-11-03 22:09 ` [PATCH v2 02/10] drm/i915/alpm: alpm_init() for DP2.1 Animesh Manna
2025-11-10  9:01   ` Jani Nikula [this message]
2025-11-03 22:09 ` [PATCH v2 03/10] drm/i915/alpm: Enable debugfs " Animesh Manna
2025-11-04  4:08   ` Kandpal, Suraj
2025-11-10  9:03   ` Jani Nikula
2025-11-03 22:09 ` [PATCH v2 04/10] drm/i915/alpm: Refactor Auxless wake time calculation Animesh Manna
2025-11-07  4:00   ` Kandpal, Suraj
2025-11-07  9:32     ` Manna, Animesh
2025-11-10  9:06       ` Jani Nikula
2025-11-03 22:09 ` [PATCH v2 05/10] drm/i915/alpm: Auxless wake time calculation for Xe3p Animesh Manna
2025-11-03 22:09 ` [PATCH v2 06/10] drm/i915/alpm: Half LFPS cycle calculation Animesh Manna
2025-11-03 22:09 ` [PATCH v2 07/10] drm/i915/alpm: Program lttpr count for DP 2.1 alpm Animesh Manna
2025-11-03 22:09 ` [PATCH v2 08/10] drm/i915/alpm: Enable MAC Transmitting LFPS for LT phy Animesh Manna
2025-11-04  5:02   ` Kandpal, Suraj
2025-11-03 22:09 ` [PATCH v2 09/10] drm/i915/alpm: Replace is_edp() with alpm_is_possible() Animesh Manna
2025-11-03 22:09 ` [PATCH v2 10/10] drm/i915/alpm: Introduce has_alpm to decouple from pr/psr2/lobf Animesh Manna
2025-11-07  3:49   ` Kandpal, Suraj
2025-11-10  7:50     ` Manna, Animesh
2025-11-03 23:48 ` ✓ CI.KUnit: success for Enable DP2.1 alpm (rev2) Patchwork
2025-11-04 13:55 ` ✗ Xe.CI.Full: failure " 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=7c735321b2c5c08ce1fac9f2d358ae06e9ad0b60@intel.com \
    --to=jani.nikula@intel.com \
    --cc=animesh.manna@intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=jouni.hogander@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox