Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Mario Limonciello (AMD)" <superm1@kernel.org>
Cc: dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org,
	intel-xe@lists.freedesktop.org
Subject: Re: [PATCH v11 11/12] drm/bridge: add PS8622 connector luminance support
Date: Tue, 03 Nov 2026 23:02:40 +0000	[thread overview]
Message-ID: <sashiko-outbox-196172@kernel.org> (raw)
In-Reply-To: <20261103-superm1-backlight-property-v11-11-00cce7b2ba22@kernel.org>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] drm/bridge: ps8622: clobbered brightness in ps8622_backlight_update()
--

commit a81389f64f9ebf64ed6660717e83f2f04182a30d
Author: Mario Limonciello <mario.limonciello@amd.com>

drm/bridge: add PS8622 connector luminance support

This commit exposes PS8622 brightness control through bridge luminance
operations when DRM_LUMINANCE is enabled, while continuing to register the
backlight class device otherwise.

> diff --git a/drivers/gpu/drm/bridge/parade-ps8622.c b/drivers/gpu/drm/bridge/parade-ps8622.c
> index 3a2ec482037df..c88bd7a97d4a4 100644
> --- a/drivers/gpu/drm/bridge/parade-ps8622.c
> +++ b/drivers/gpu/drm/bridge/parade-ps8622.c

[ ... ]

> @@ -268,7 +270,7 @@ static int ps8622_send_config(struct ps8622_bridge *ps8622)
>  		goto error;
>  
>  
> -	if (ps8622->bl) {
> +	if (ps8622->internal_pwm) {
>  		/* DPCD720, internal PWM */
>  		err = ps8622_set(cl, 0x01, 0xa5, 0xa0);
>  		if (err)
> @@ -276,7 +278,7 @@ static int ps8622_send_config(struct ps8622_bridge *ps8622)
>  
>  		/* FFh for 100% brightness, 0h for 0% brightness */
>  		err = ps8622_set(cl, 0x01, 0xa7,
> -				ps8622->bl->props.brightness);
> +				ps8622->brightness);
>  		if (err)
>  			goto error;
>  	} else {
> @@ -324,6 +326,8 @@ static int ps8622_backlight_update(struct backlight_device *bl)
>  	struct ps8622_bridge *ps8622 = dev_get_drvdata(&bl->dev);
>  	int ret, brightness = backlight_get_brightness(bl);
>  
> +	ps8622->brightness = brightness;
> +
>  	if (!ps8622->enabled)
>  		return -EINVAL;

[Severity: Medium]
Can updating ps8622->brightness from backlight_get_brightness(bl) before
checking ps8622->enabled clobber the cached brightness with 0 when the
backlight is blanked while the bridge is disabled?

Previously, ps8622_send_config() programmed ps8622->bl->props.brightness,
which preserves the requested brightness level across blanking. Now it
programs ps8622->brightness, which is updated in ps8622_backlight_update()
from backlight_get_brightness(bl):

static inline int backlight_get_brightness(const struct backlight_device *bd)
{
	if (backlight_is_blank(bd))
		return 0;
	else
		return bd->props.brightness;
}

If userspace writes BACKLIGHT_POWER_OFF to bl_power while ps8622->enabled is
false, bl_power_store() in drivers/video/backlight/backlight.c temporarily
sets bd->props.power and calls backlight_update_status(bd) ->
ps8622_backlight_update(bl), which overwrites ps8622->brightness with 0 and
returns -EINVAL:

	if (bd->props.power != power) {
		old_power = bd->props.power;
		bd->props.power = power;
		rc = backlight_update_status(bd);
		if (rc)
			bd->props.power = old_power;

Because ps8622_backlight_update() returns -EINVAL, bl_power_store() rolls
bd->props.power back to BACKLIGHT_POWER_ON, leaving the backlight device
unblanked at its non-zero bd->props.brightness while ps8622->brightness has
been overwritten with 0.

Similarly, during fbdev blanking or backlight_suspend(), if the bridge is
disabled first (setting ps8622->enabled = false in ps8622_post_disable()) and
the backlight notifier or suspend callback subsequently invokes
ps8622_backlight_update(bl), ps8622->brightness is overwritten with 0 while
disabled. On the next ps8622_pre_enable() -> ps8622_send_config(), the panel
backlight will be programmed to 0 instead of the configured brightness.

Would it make sense to avoid overwriting ps8622->brightness when returning
-EINVAL, or to keep using bl->props.brightness when restoring the initial
backlight level in ps8622_send_config()?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261103-superm1-backlight-property-v11-0-00cce7b2ba22@kernel.org?part=11

  reply	other threads:[~2026-11-03 23:02 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-03 22:42 [PATCH v11 00/12] Add support for a DRM backlight capability Mario Limonciello (AMD)
2026-11-03 22:42 ` [PATCH v11 01/12] drm: add connector LUMINANCE property Mario Limonciello (AMD)
2026-11-03 22:42 ` [PATCH v11 02/12] drm/amd/display: Pass up errors reading actual brightness Mario Limonciello (AMD)
2026-11-03 22:42 ` [PATCH v11 03/12] drm/amdgpu: Check bios_scratch_reg_offset in backlight level helper Mario Limonciello (AMD)
2026-11-03 22:42 ` [PATCH v11 04/12] drm/amd: add luminance property support Mario Limonciello (AMD)
2026-11-03 23:13   ` sashiko-bot
2026-11-03 22:42 ` [PATCH v11 05/12] drm/i915/display: " Mario Limonciello (AMD)
2026-11-03 22:42 ` [PATCH v11 06/12] drm/bridge: add connector luminance operations Mario Limonciello (AMD)
2026-11-03 22:42 ` [PATCH v11 07/12] drm/panel: add connector luminance forwarding Mario Limonciello (AMD)
2026-11-03 22:55   ` sashiko-bot
2026-11-03 22:42 ` [PATCH v11 08/12] drm/bridge_connector: add luminance support Mario Limonciello (AMD)
2026-11-03 22:42 ` [PATCH v11 09/12] drm/nouveau: add connector " Mario Limonciello (AMD)
2026-11-03 23:09   ` sashiko-bot
2026-11-03 22:42 ` [PATCH v11 10/12] drm/gud: " Mario Limonciello (AMD)
2026-11-03 22:59   ` sashiko-bot
2026-11-03 22:42 ` [PATCH v11 11/12] drm/bridge: add PS8622 " Mario Limonciello (AMD)
2026-11-03 23:02   ` sashiko-bot [this message]
2026-11-03 22:42 ` [PATCH v11 12/12] drm/solomon: add SSD130x " Mario Limonciello (AMD)
2026-11-04 16:18 ` ✓ CI.KUnit: success for Add support for a DRM backlight capability Patchwork
2026-11-04 16:34 ` ✗ CI.checksparse: warning " Patchwork
2026-11-04 16:52 ` ✓ Xe.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=sashiko-outbox-196172@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=superm1@kernel.org \
    /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