From: Sam Ravnborg <sam@ravnborg.org>
To: antoniospg <antoniospg100@gmail.com>
Cc: linux-kernel@vger.kernel.org, Karol Herbst <kherbst@redhat.com>,
David Airlie <airlied@linux.ie>,
"open list:DRM DRIVER FOR NVIDIA GEFORCE/QUADRO GPUS"
<nouveau@lists.freedesktop.org>,
"open list:DRM DRIVER FOR NVIDIA GEFORCE/QUADRO GPUS"
<dri-devel@lists.freedesktop.org>,
Ben Skeggs <bskeggs@redhat.com>
Subject: Re: [PATCH] drm/nouveau: Adding support to control backlight using bl_power for nva3.
Date: Sun, 30 Oct 2022 21:48:53 +0100 [thread overview]
Message-ID: <Y17jNddKjZNk59EK@ravnborg.org> (raw)
In-Reply-To: <20221029184851.25340-1-antoniospg100@gmail.com>
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@gmail.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
next prev parent reply other threads:[~2022-10-30 21:05 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-29 18:48 [PATCH] drm/nouveau: Adding support to control backlight using bl_power for nva3 antoniospg
2022-10-30 13:05 ` Bagas Sanjaya
2022-10-30 20:48 ` Sam Ravnborg [this message]
2022-10-31 16:32 ` [PATCH] drm/nouveau: Add " antoniospg
2022-11-01 2:11 ` Bagas Sanjaya
2022-11-01 10:41 ` Karol Herbst
2022-11-04 22:01 ` [PATCH v3] " Antonio Gomes
2022-11-04 22:04 ` Antonio Gomes
2022-11-09 17:08 ` Karol Herbst
-- strict thread matches above, loose matches on Subject: below --
2022-10-29 18:42 [PATCH] drm/nouveau: Adding " antoniospg
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=Y17jNddKjZNk59EK@ravnborg.org \
--to=sam@ravnborg.org \
--cc=airlied@linux.ie \
--cc=antoniospg100@gmail.com \
--cc=bskeggs@redhat.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=kherbst@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=nouveau@lists.freedesktop.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