On 5/4/26 08:55, Louis Chauvet wrote:
[You don't often get email from [email protected]. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]

On 4/25/26 00:09, Mario Limonciello wrote:
From: Marta Lofstedt <[email protected]>

Current brightness needs to be queried from drivers.

Signed-off-by: Marta Lofstedt <[email protected]>
v3:
  * Rebase
  * Add description
Signed-off-by: Mario Limonciello <[email protected]>
---
  drivers/video/backlight/backlight.c | 6 ++++++
  include/linux/backlight.h           | 1 +
  2 files changed, 7 insertions(+)

diff --git a/drivers/video/backlight/backlight.c b/drivers/video/ backlight/backlight.c
index c3673bee6d9cf..9bbfc16cf2d74 100644
--- a/drivers/video/backlight/backlight.c
+++ b/drivers/video/backlight/backlight.c
@@ -206,6 +206,12 @@ int backlight_device_set_brightness(struct backlight_device *bd,
  }
  EXPORT_SYMBOL(backlight_device_set_brightness);

+int backlight_device_get_brightness(struct backlight_device *bd)
+{
+     return bd->props.brightness;

Hello,

The function backlight_get_brightness already exists and is already
public, maybe you can use the existing function?


Thanks for the suggestion.  I'll have a try with this.


+}
+EXPORT_SYMBOL(backlight_device_get_brightness);
+
  static ssize_t brightness_store(struct device *dev,
              struct device_attribute *attr, const char *buf, size_t count)
  {
diff --git a/include/linux/backlight.h b/include/linux/backlight.h
index 7e4fee65fddd9..851570b39d041 100644
--- a/include/linux/backlight.h
+++ b/include/linux/backlight.h
@@ -412,6 +412,7 @@ struct backlight_device *backlight_device_get_by_name(const char *name);   struct backlight_device *backlight_device_get_by_type(enum backlight_type type);
  int backlight_device_set_brightness(struct backlight_device *bd,
                                  unsigned long brightness);
+extern int backlight_device_get_brightness(struct backlight_device *bd);

  #if IS_REACHABLE(CONFIG_BACKLIGHT_CLASS_DEVICE)
  void backlight_notify_blank(struct backlight_device *bd,


Reply via email to