git: 2cc3af6e1d79 - main - linuxkpi: Add backlight_device_set_brightness

From: Emmanuel Vadot <manu_at_FreeBSD.org>
Date: Thu, 17 Feb 2022 08:43:21 UTC
The branch main has been updated by manu:

URL: https://cgit.FreeBSD.org/src/commit/?id=2cc3af6e1d795c6d33afaf994c18abaab87a443b

commit 2cc3af6e1d795c6d33afaf994c18abaab87a443b
Author:     Emmanuel Vadot <manu@FreeBSD.org>
AuthorDate: 2022-02-15 11:05:07 +0000
Commit:     Emmanuel Vadot <manu@FreeBSD.org>
CommitDate: 2022-02-17 08:31:12 +0000

    linuxkpi: Add backlight_device_set_brightness
    
    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
---
 sys/compat/linuxkpi/common/include/linux/backlight.h | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/sys/compat/linuxkpi/common/include/linux/backlight.h b/sys/compat/linuxkpi/common/include/linux/backlight.h
index 38b3786e738d..9591a4b671ab 100644
--- a/sys/compat/linuxkpi/common/include/linux/backlight.h
+++ b/sys/compat/linuxkpi/common/include/linux/backlight.h
@@ -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)
 {