git: 53c44b917c35 - stable/13 - linuxkpi: Define `backlight_get_brightness()` and `backlight_is_blank()`

From: Jean-Sébastien Pédron <dumbbell_at_FreeBSD.org>
Date: Thu, 16 Feb 2023 11:56:20 UTC
The branch stable/13 has been updated by dumbbell (ports committer):

URL: https://cgit.FreeBSD.org/src/commit/?id=53c44b917c35cb8df9c464717c9b8df48c2e46c9

commit 53c44b917c35cb8df9c464717c9b8df48c2e46c9
Author:     Jean-Sébastien Pédron <dumbbell@FreeBSD.org>
AuthorDate: 2023-02-08 17:51:16 +0000
Commit:     Jean-Sébastien Pédron <dumbbell@FreeBSD.org>
CommitDate: 2023-02-16 11:55:18 +0000

    linuxkpi: Define `backlight_get_brightness()` and `backlight_is_blank()`
    
    This is not used by the DRM driver yet because we comment out the code
    calling them, but they are easy to implement.
    
    Reviewed by:    manu
    Approved by:    manu
    Differential Revision:  https://reviews.freebsd.org/D38530
    
    (cherry picked from commit a82a8a5e193587d819288c3c27f1c9472178e10e)
---
 sys/compat/linuxkpi/common/include/linux/backlight.h | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/sys/compat/linuxkpi/common/include/linux/backlight.h b/sys/compat/linuxkpi/common/include/linux/backlight.h
index 9591a4b671ab..5a3c7080b55d 100644
--- a/sys/compat/linuxkpi/common/include/linux/backlight.h
+++ b/sys/compat/linuxkpi/common/include/linux/backlight.h
@@ -91,6 +91,13 @@ backlight_force_update(struct backlight_device *bd, int reason)
 	bd->props.brightness = bd->ops->get_brightness(bd);
 }
 
+static inline int
+backlight_get_brightness(struct backlight_device *bd)
+{
+
+	return (bd->props.brightness);
+}
+
 static inline int
 backlight_device_set_brightness(struct backlight_device *bd, int brightness)
 {
@@ -119,4 +126,11 @@ backlight_disable(struct backlight_device *bd)
 	return (backlight_update_status(bd));
 }
 
+static inline bool
+backlight_is_blank(struct backlight_device *bd)
+{
+
+	return (bd->props.power != 0/* FB_BLANK_UNBLANK */);
+}
+
 #endif	/* _LINUXKPI_LINUX_BACKLIGHT_H_ */