lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Y17jNddKjZNk59EK@ravnborg.org>
Date:   Sun, 30 Oct 2022 21:48:53 +0100
From:   Sam Ravnborg <sam@...nborg.org>
To:     antoniospg <antoniospg100@...il.com>
Cc:     linux-kernel@...r.kernel.org, Karol Herbst <kherbst@...hat.com>,
        David Airlie <airlied@...ux.ie>,
        "open list:DRM DRIVER FOR NVIDIA GEFORCE/QUADRO GPUS" 
        <nouveau@...ts.freedesktop.org>,
        "open list:DRM DRIVER FOR NVIDIA GEFORCE/QUADRO GPUS" 
        <dri-devel@...ts.freedesktop.org>, Ben Skeggs <bskeggs@...hat.com>
Subject: Re: [PATCH] drm/nouveau: Adding support to control backlight using
 bl_power for nva3.

On Sat, Oct 29, 2022 at 03:48:50PM -0300, antoniospg wrote:
> Test plan:
> 
> * Turn off:
> echo 1 > /sys/class/backlight/nv_backlight/bl_power
> 
> * Turn on:
> echo 0 > /sys/class/backlight/nv_backlight/bl_power
> 
> Signed-off-by: antoniospg <antoniospg100@...il.com>
> ---
>  drivers/gpu/drm/nouveau/nouveau_backlight.c | 11 ++++++++++-
>  1 file changed, 10 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/nouveau/nouveau_backlight.c b/drivers/gpu/drm/nouveau/nouveau_backlight.c
> index a2141d3d9b1d..855d0ce9f7fa 100644
> --- a/drivers/gpu/drm/nouveau/nouveau_backlight.c
> +++ b/drivers/gpu/drm/nouveau/nouveau_backlight.c
> @@ -263,7 +263,16 @@ nva3_set_intensity(struct backlight_device *bd)
>  	u32 div, val;
>  
>  	div = nvif_rd32(device, NV50_PDISP_SOR_PWM_DIV(or));
> -	val = (bd->props.brightness * div) / 100;
> +
> +	switch (bd->props.power) {
> +	case FB_BLANK_UNBLANK:
> +		val = (bd->props.brightness * div) / 100;
> +		break;
> +	default:
> +		val = 0;
> +		break;
> +	}
> +

Consider the following change:

	val = backlight_get_brightness(bd);
	if (val)
		val = (val * dev) / 100;

Then you avoid hard coding the use of FB_BLANK_UNBLANK.

	Sam

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ