* [PATCH] drm/nouveau: Adding support to control backlight using bl_power for nva3.
@ 2022-10-29 18:42 antoniospg
0 siblings, 0 replies; 10+ messages in thread
From: antoniospg @ 2022-10-29 18:42 UTC (permalink / raw)
To: linux-kernel
Cc: antoniospg, Ben Skeggs, Karol Herbst, Lyude Paul, David Airlie,
Daniel Vetter,
open list:DRM DRIVER FOR NVIDIA GEFORCE/QUADRO GPUS,
open list:DRM DRIVER FOR NVIDIA GEFORCE/QUADRO GPUS
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;
+ }
+
if (div) {
nvif_wr32(device, NV50_PDISP_SOR_PWM_CTL(or),
val |
--
2.25.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH] drm/nouveau: Adding support to control backlight using bl_power for nva3.
@ 2022-10-29 18:48 antoniospg
2022-10-30 13:05 ` Bagas Sanjaya
` (2 more replies)
0 siblings, 3 replies; 10+ messages in thread
From: antoniospg @ 2022-10-29 18:48 UTC (permalink / raw)
To: linux-kernel
Cc: antoniospg, Ben Skeggs, Karol Herbst, Lyude Paul, David Airlie,
Daniel Vetter,
open list:DRM DRIVER FOR NVIDIA GEFORCE/QUADRO GPUS,
open list:DRM DRIVER FOR NVIDIA GEFORCE/QUADRO GPUS
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;
+ }
+
if (div) {
nvif_wr32(device, NV50_PDISP_SOR_PWM_CTL(or),
val |
--
2.25.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH] drm/nouveau: Adding support to control backlight using bl_power for nva3.
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
2022-10-31 16:32 ` [PATCH] drm/nouveau: Add " antoniospg
2 siblings, 0 replies; 10+ messages in thread
From: Bagas Sanjaya @ 2022-10-30 13:05 UTC (permalink / raw)
To: antoniospg
Cc: linux-kernel, Ben Skeggs, Karol Herbst, Lyude Paul, David Airlie,
Daniel Vetter,
open list:DRM DRIVER FOR NVIDIA GEFORCE/QUADRO GPUS,
open list:DRM DRIVER FOR NVIDIA GEFORCE/QUADRO GPUS
[-- Attachment #1: Type: text/plain, Size: 451 bytes --]
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
>
You sent this patch twice, so I reply to the latest one.
What is it doing? Please describe the patch. Remember to write the
description in imperative mood.
--
An old man doll... just what I always wanted! - Clara
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] drm/nouveau: Adding support to control backlight using bl_power for nva3.
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
2022-10-31 16:32 ` [PATCH] drm/nouveau: Add " antoniospg
2 siblings, 0 replies; 10+ messages in thread
From: Sam Ravnborg @ 2022-10-30 20:48 UTC (permalink / raw)
To: antoniospg
Cc: linux-kernel, Karol Herbst, David Airlie,
open list:DRM DRIVER FOR NVIDIA GEFORCE/QUADRO GPUS,
open list:DRM DRIVER FOR NVIDIA GEFORCE/QUADRO GPUS, Ben Skeggs
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
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH] drm/nouveau: Add support to control backlight using bl_power for nva3.
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
@ 2022-10-31 16:32 ` antoniospg
2022-11-01 2:11 ` Bagas Sanjaya
` (2 more replies)
2 siblings, 3 replies; 10+ messages in thread
From: antoniospg @ 2022-10-31 16:32 UTC (permalink / raw)
To: linux-kernel
Cc: bagasdotme, sam, antoniospg, Ben Skeggs, Karol Herbst, Lyude Paul,
David Airlie, Daniel Vetter, dri-devel, nouveau
Summary:
* Add support to turn on/off backlight when changing values in bl_power
file. This is achieved by using function backlight_get_brightness()
in nva3_set_intensity to get current brightness.
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 | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/nouveau/nouveau_backlight.c b/drivers/gpu/drm/nouveau/nouveau_backlight.c
index a2141d3d9b1d..5c82f5189b79 100644
--- a/drivers/gpu/drm/nouveau/nouveau_backlight.c
+++ b/drivers/gpu/drm/nouveau/nouveau_backlight.c
@@ -263,7 +263,11 @@ 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;
+
+ val = backlight_get_brightness(bd);
+ if (val)
+ val = (val * div) / 100;
+
if (div) {
nvif_wr32(device, NV50_PDISP_SOR_PWM_CTL(or),
val |
--
2.25.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH] drm/nouveau: Add support to control backlight using bl_power for nva3.
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
2 siblings, 1 reply; 10+ messages in thread
From: Bagas Sanjaya @ 2022-11-01 2:11 UTC (permalink / raw)
To: antoniospg, linux-kernel
Cc: sam, Ben Skeggs, Karol Herbst, Lyude Paul, David Airlie,
Daniel Vetter, dri-devel, nouveau
On 10/31/22 23:32, antoniospg wrote:
> Summary:
>
> * Add support to turn on/off backlight when changing values in bl_power
> file. This is achieved by using function backlight_get_brightness()
> in nva3_set_intensity to get current brightness.
>
This is [PATCH v2], right? If so, next time please pass -v <version
number> to git-format-patch(1).
Also, just say the prose without using bullet list. "Summary:" line
is also redundant. And again, please describe why this change be made.
> Test plan:
>
> * Turn off:
> echo 1 > /sys/class/backlight/nv_backlight/bl_power
>
> * Turn on:
> echo 0 > /sys/class/backlight/nv_backlight/bl_power
>
Shouldn't "test plan" above be documented in Documentation/ instead?
Last but not least, is "antoniospg" your real, legal name?
Thanks.
--
An old man doll... just what I always wanted! - Clara
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] drm/nouveau: Add support to control backlight using bl_power for nva3.
2022-11-01 2:11 ` Bagas Sanjaya
@ 2022-11-01 10:41 ` Karol Herbst
0 siblings, 0 replies; 10+ messages in thread
From: Karol Herbst @ 2022-11-01 10:41 UTC (permalink / raw)
To: Bagas Sanjaya
Cc: antoniospg, linux-kernel, sam, Ben Skeggs, Lyude Paul,
David Airlie, Daniel Vetter, dri-devel, nouveau
On Tue, Nov 1, 2022 at 3:12 AM Bagas Sanjaya <bagasdotme@gmail.com> wrote:
>
> On 10/31/22 23:32, antoniospg wrote:
> > Summary:
> >
> > * Add support to turn on/off backlight when changing values in bl_power
> > file. This is achieved by using function backlight_get_brightness()
> > in nva3_set_intensity to get current brightness.
> >
>
> This is [PATCH v2], right? If so, next time please pass -v <version
> number> to git-format-patch(1).
>
> Also, just say the prose without using bullet list. "Summary:" line
> is also redundant. And again, please describe why this change be made.
>
it's right there in the title....
> > Test plan:
> >
> > * Turn off:
> > echo 1 > /sys/class/backlight/nv_backlight/bl_power
> >
> > * Turn on:
> > echo 0 > /sys/class/backlight/nv_backlight/bl_power
> >
>
> Shouldn't "test plan" above be documented in Documentation/ instead?
>
Given that's already existing infrastructure and is actually
documented already (the existence of `bl_power` I mean), why would
that be needed? I don't think it's needed to point that out in the
commit log, but if the contributor chooses to document how the patch
was tested, then why not?
> Last but not least, is "antoniospg" your real, legal name?
>
Please leave those discussions to subsystem maintainers.
Saying that, if the contributors prefers to go by this name, this is
good enough for me, but having a more explicit or detailed name (like
fore- and surname) is generally prefered.
> Thanks.
>
> --
> An old man doll... just what I always wanted! - Clara
>
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH v3] drm/nouveau: Add support to control backlight using bl_power for nva3.
2022-10-31 16:32 ` [PATCH] drm/nouveau: Add " antoniospg
2022-11-01 2:11 ` Bagas Sanjaya
@ 2022-11-04 22:01 ` Antonio Gomes
2022-11-04 22:04 ` Antonio Gomes
2 siblings, 0 replies; 10+ messages in thread
From: Antonio Gomes @ 2022-11-04 22:01 UTC (permalink / raw)
To: linux-kernel
Cc: antoniospg100, Ben Skeggs, Karol Herbst, Lyude Paul, David Airlie,
Daniel Vetter, dri-devel, nouveau
From: antoniospg <antoniospg100@gmail.com>
Summary:
* Add support to turn on/off backlight when changing values in bl_power
file. This is achieved by using function backlight_get_brightness()
in nva3_set_intensity to get current brightness.
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 | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/nouveau/nouveau_backlight.c b/drivers/gpu/drm/nouveau/nouveau_backlight.c
index a2141d3d9b1d..5c82f5189b79 100644
--- a/drivers/gpu/drm/nouveau/nouveau_backlight.c
+++ b/drivers/gpu/drm/nouveau/nouveau_backlight.c
@@ -263,7 +263,11 @@ 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;
+
+ val = backlight_get_brightness(bd);
+ if (val)
+ val = (val * div) / 100;
+
if (div) {
nvif_wr32(device, NV50_PDISP_SOR_PWM_CTL(or),
val |
--
2.25.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH v3] drm/nouveau: Add support to control backlight using bl_power for nva3.
2022-10-31 16:32 ` [PATCH] drm/nouveau: Add " antoniospg
2022-11-01 2:11 ` Bagas Sanjaya
2022-11-04 22:01 ` [PATCH v3] " Antonio Gomes
@ 2022-11-04 22:04 ` Antonio Gomes
2022-11-09 17:08 ` Karol Herbst
2 siblings, 1 reply; 10+ messages in thread
From: Antonio Gomes @ 2022-11-04 22:04 UTC (permalink / raw)
To: linux-kernel
Cc: antoniospg100, Ben Skeggs, Karol Herbst, Lyude Paul, David Airlie,
Daniel Vetter, dri-devel, nouveau
From: antoniospg <antoniospg100@gmail.com>
Summary:
* Add support to turn on/off backlight when changing values in bl_power
file. This is achieved by using function backlight_get_brightness()
in nva3_set_intensity to get current brightness.
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 | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/nouveau/nouveau_backlight.c b/drivers/gpu/drm/nouveau/nouveau_backlight.c
index a2141d3d9b1d..5c82f5189b79 100644
--- a/drivers/gpu/drm/nouveau/nouveau_backlight.c
+++ b/drivers/gpu/drm/nouveau/nouveau_backlight.c
@@ -263,7 +263,11 @@ 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;
+
+ val = backlight_get_brightness(bd);
+ if (val)
+ val = (val * div) / 100;
+
if (div) {
nvif_wr32(device, NV50_PDISP_SOR_PWM_CTL(or),
val |
--
2.25.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH v3] drm/nouveau: Add support to control backlight using bl_power for nva3.
2022-11-04 22:04 ` Antonio Gomes
@ 2022-11-09 17:08 ` Karol Herbst
0 siblings, 0 replies; 10+ messages in thread
From: Karol Herbst @ 2022-11-09 17:08 UTC (permalink / raw)
To: Antonio Gomes
Cc: linux-kernel, Ben Skeggs, Lyude Paul, David Airlie, Daniel Vetter,
dri-devel, nouveau
On Fri, Nov 4, 2022 at 11:04 PM Antonio Gomes <antoniospg100@gmail.com> wrote:
>
> From: antoniospg <antoniospg100@gmail.com>
>
> Summary:
>
> * Add support to turn on/off backlight when changing values in bl_power
> file. This is achieved by using function backlight_get_brightness()
> in nva3_set_intensity to get current brightness.
>
> 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 | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/nouveau/nouveau_backlight.c b/drivers/gpu/drm/nouveau/nouveau_backlight.c
> index a2141d3d9b1d..5c82f5189b79 100644
> --- a/drivers/gpu/drm/nouveau/nouveau_backlight.c
> +++ b/drivers/gpu/drm/nouveau/nouveau_backlight.c
> @@ -263,7 +263,11 @@ 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;
> +
> + val = backlight_get_brightness(bd);
> + if (val)
> + val = (val * div) / 100;
> +
> if (div) {
> nvif_wr32(device, NV50_PDISP_SOR_PWM_CTL(or),
> val |
> --
> 2.25.1
>
Reviewed-by: Karol Herbst <kherbst@redhat.com>
btw, i'll fix up the name with the one from the Email From field, so
you won't have to send it out again.
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2022-11-09 17:10 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox