On 13/10/17 11:40, Meghana Madhyastha wrote:
Move the helper functions enable_backlight and disable_backlight
from tinydrm-helpers.c to backlight.h as static inline functions so
that they can be used by other drivers.
Signed-off-by: Meghana Madhyastha <meghana.madhyastha@xxxxxxxxx>
---
<snip>
diff --git a/include/linux/backlight.h b/include/linux/backlight.h
index 5f2fd61..b88fabb 100644
--- a/include/linux/backlight.h
+++ b/include/linux/backlight.h
@@ -129,6 +129,36 @@ static inline int backlight_update_status(struct backlight_device *bd)
return ret;
}
+/**
+ * backlight_enable - Enable backlight
+ * @bd: the backlight device to enable
+ */
+static inline int backlight_enable(struct backlight_device *bd)
+{
+ if (!bd)
+ return 0;
+
+ bd->props.power = FB_BLANK_UNBLANK;
+ bd->props.state &= ~BL_CORE_FBBLANK;
I wonder if we should be updating bd->probs.fb_blank here?
The semantics around bd->probs.fb_blank is a bit nasty (alright, a lot
nasty). Essentially it's a duplicated copy of the BL_CORE_FBBLANK bit
with a different bit pattern. Its part of a refactoring that git tells
me has been 8 years in the making (and counting)...
However, so long as we've got it, I would prefer to keep it consistent
with the BL_CORE_FBBLANK bit, both here...
+
+ return backlight_update_status(bd);
+}
+
+/**
+ * backlight_disable - Disable backlight
+ * @bd: the backlight device to disable
+ */
+static inline int backlight_disable(struct backlight_device *bd)
+{
+ if (!bd)
+ return 0;
+
+ bd->props.power = FB_BLANK_POWERDOWN;
+ bd->props.state |= BL_CORE_FBBLANK;
... and here.
Daniel.
_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/dri-devel