]> xenbits.xensource.com Git - people/royger/freebsd.git/commitdiff
linuxkpi: Add backlight_device_set_brightness
authorEmmanuel Vadot <manu@FreeBSD.org>
Tue, 15 Feb 2022 11:05:07 +0000 (12:05 +0100)
committerEmmanuel Vadot <manu@FreeBSD.org>
Sat, 5 Mar 2022 11:12:44 +0000 (12:12 +0100)
This simply set the brightness of a backlight device.
Needed by drm-kmod v5.8

Reviewed by: bz, emaste
MFC after: 2 weeks
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D34285

(cherry picked from commit 2cc3af6e1d795c6d33afaf994c18abaab87a443b)

sys/compat/linuxkpi/common/include/linux/backlight.h

index 38b3786e738ddd84960662ad38d80bdcba76917e..9591a4b671ab85f08b0605f406fcc6c61bfd90f6 100644 (file)
@@ -91,6 +91,16 @@ backlight_force_update(struct backlight_device *bd, int reason)
        bd->props.brightness = bd->ops->get_brightness(bd);
 }
 
+static inline int
+backlight_device_set_brightness(struct backlight_device *bd, int brightness)
+{
+
+       if (brightness > bd->props.max_brightness)
+               return (EINVAL);
+       bd->props.brightness = brightness;
+       return (bd->ops->update_status(bd));
+}
+
 static inline int
 backlight_enable(struct backlight_device *bd)
 {