Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@linux.intel.com>
To: Suraj Kandpal <suraj.kandpal@intel.com>,
	intel-xe@lists.freedesktop.org, intel-gfx@lists.freedesktop.org
Cc: ankit.k.nautiyal@intel.com, arun.r.murthy@intel.com,
	Suraj Kandpal <suraj.kandpal@intel.com>
Subject: Re: [PATCH] drm/i915/backlight: Sanitize BIOS-enabled PCH PWM in full-AUX VESA path
Date: Wed, 13 May 2026 11:30:21 +0300	[thread overview]
Message-ID: <b21c1fc24b8f87958183f360b3d2cd4d9986875b@intel.com> (raw)
In-Reply-To: <20260513080819.849479-1-suraj.kandpal@intel.com>

On Wed, 13 May 2026, Suraj Kandpal <suraj.kandpal@intel.com> wrote:
> In full-AUX VESA mode (aux_enable && aux_set) the driver never touches
> the native PCH PWM. If BIOS left PWM CTL register enabled, the PCH PWM
> keeps system alive during s2idle and blocks S0ix.
> Always run pwm_funcs->setup() so pwm_enabled reflects real HW state,
> and on first enable in full-AUX mode call pwm_funcs->disable() once to
> clear the stale bit. Runtime behaviour is otherwise unchanged.
>
> Fixes: 40d2f5820951 ("drm/i915/backlight: Remove try_vesa_interface")
> Signed-off-by: Suraj Kandpal <suraj.kandpal@intel.com>
> ---
>  .../drm/i915/display/intel_dp_aux_backlight.c | 32 +++++++++++++------
>  1 file changed, 23 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c b/drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c
> index a8d56ebf06a2..c828c568fb8b 100644
> --- a/drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c
> +++ b/drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c
> @@ -496,6 +496,17 @@ intel_dp_aux_vesa_enable_backlight(const struct intel_crtc_state *crtc_state,
>  	struct intel_panel *panel = &connector->panel;
>  	struct intel_dp *intel_dp = enc_to_intel_dp(connector->encoder);
>  
> +	/*
> +	 * In full AUX VESA mode the native PWM is never driven by us. If BIOS
> +	 * left it enabled, the PCH PWM keeps the system alive and blocks
> +	 * S0ix. Sanitize it once via pwm_funcs->disable.
> +	 */
> +	if (panel->backlight.edp.vesa.info.aux_enable &&
> +	    panel->backlight.edp.vesa.info.aux_set &&
> +	    panel->backlight.pwm_enabled)
> +		panel->backlight.pwm_funcs->disable(conn_state,
> +						    intel_backlight_invert_pwm_level(connector, 0));
> +
>  	if (!(panel->backlight.edp.vesa.info.aux_enable ||
>  	      panel->backlight.edp.vesa.info.luminance_set)) {
>  		u32 pwm_level;
> @@ -558,15 +569,18 @@ static int intel_dp_aux_vesa_setup_backlight(struct intel_connector *connector,
>  				    panel->backlight.edp.vesa.info.luminance_set),
>  		    backlight_unit_str(panel));
>  
> -	if (!panel->backlight.edp.vesa.info.aux_set ||
> -	    !panel->backlight.edp.vesa.info.aux_enable) {
> -		ret = panel->backlight.pwm_funcs->setup(connector, pipe);
> -		if (ret < 0) {
> -			drm_err(display->drm,
> -				"[CONNECTOR:%d:%s] Failed to setup PWM backlight controls for eDP backlight: %d\n",
> -				connector->base.base.id, connector->base.name, ret);
> -			return ret;
> -		}
> +	/*
> +	 * Always probe the native PWM HW state so panel->backlight.pwm_enabled
> +	 * reflects what BIOS left behind. Required for the full-AUX VESA path
> +	 * to detect and sanitize a BIOS-enabled PCH PWM that would otherwise
> +	 * block S0ix.
> +	 */
> +	ret = panel->backlight.pwm_funcs->setup(connector, pipe);

This will log something like "Using native PWM for backlight control" in
dmesg, which is going to be wildly confusing for AUX backlight.

BR,
Jani.

> +	if (ret < 0) {
> +		drm_err(display->drm,
> +			"[CONNECTOR:%d:%s] Failed to setup PWM backlight controls for eDP backlight: %d\n",
> +			connector->base.base.id, connector->base.name, ret);
> +		return ret;
>  	}
>  
>  	if (panel->backlight.edp.vesa.info.luminance_set) {

-- 
Jani Nikula, Intel

  parent reply	other threads:[~2026-05-13  8:30 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-13  8:08 [PATCH] drm/i915/backlight: Sanitize BIOS-enabled PCH PWM in full-AUX VESA path Suraj Kandpal
2026-05-13  8:13 ` Kandpal, Suraj
2026-05-13  8:30 ` Jani Nikula [this message]
2026-05-13  9:08   ` Kandpal, Suraj
2026-05-13 12:19     ` Jani Nikula
2026-05-13 10:10 ` ✗ Fi.CI.BUILD: warning for " Patchwork
2026-05-13 10:50 ` ✓ i915.CI.BAT: success " Patchwork
2026-05-13 10:52 ` 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=b21c1fc24b8f87958183f360b3d2cd4d9986875b@intel.com \
    --to=jani.nikula@linux.intel.com \
    --cc=ankit.k.nautiyal@intel.com \
    --cc=arun.r.murthy@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=suraj.kandpal@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