diff options
author | Antonio Gomes <antoniospg100@gmail.com> | 2022-11-05 01:04:23 +0300 |
---|---|---|
committer | Karol Herbst <kherbst@redhat.com> | 2022-11-11 17:56:33 +0300 |
commit | 9df38728f78c544a8edab8acf2e4d3eee73dfaeb (patch) | |
tree | 7a061eaccdff82808e50d04784be691f70342511 /drivers/gpu/drm | |
parent | d23a6e3f764b69c122fc18537cc73548fdc95939 (diff) | |
download | linux-9df38728f78c544a8edab8acf2e4d3eee73dfaeb.tar.xz |
drm/nouveau: Add support to control backlight using bl_power for nva3.
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: Antonio Gomes <antoniospg100@gmail.com>
Signed-off-by: Karol Herbst <kherbst@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20221104220424.41164-1-antoniospg100@gmail.com
Diffstat (limited to 'drivers/gpu/drm')
-rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_backlight.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/gpu/drm/nouveau/nouveau_backlight.c b/drivers/gpu/drm/nouveau/nouveau_backlight.c index a614582779ca..40409a29f5b6 100644 --- a/drivers/gpu/drm/nouveau/nouveau_backlight.c +++ b/drivers/gpu/drm/nouveau/nouveau_backlight.c @@ -264,7 +264,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 | |