diff options
author | Meghana Madhyastha <meghana.madhyastha@gmail.com> | 2018-01-24 11:34:07 -0500 |
---|---|---|
committer | Sean Paul <seanpaul@chromium.org> | 2018-01-29 10:34:53 -0500 |
commit | 5b698be0497d8be986e2050e9b1c145b2e0603c2 (patch) | |
tree | bdef5f615f5c3e4170b34fab7966ac5135fbbfd8 | |
parent | d8a5b80568a9cb66810e75b182018e9edb68e8ff (diff) |
video: backlight: Add helpers to enable and disable backlight
Add helper functions backlight_enable and backlight_disable to
enable/disable a backlight device. These helper functions can
then be used by different drm and tinydrm drivers to avoid
repetition of code and also to enforce a uniform and consistent
way to enable/disable a backlight device.
Acked-by: Daniel Thompson <daniel.thompson@linaro.org>
Reviewed-by: Noralf Trønnes <noralf@tronnes.org>
Reviewed-by: Sean Paul <seanpaul@chromium.org>
Signed-off-by: Meghana Madhyastha <meghana.madhyastha@gmail.com>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Link: https://patchwork.freedesktop.org/patch/msgid/39b5bf0a02008a8072d910bdf8231c431e9ef504.1516810725.git.meghana.madhyastha@gmail.com
-rw-r--r-- | include/linux/backlight.h | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/include/linux/backlight.h b/include/linux/backlight.h index af7003548593..ace825e2ca2d 100644 --- a/include/linux/backlight.h +++ b/include/linux/backlight.h | |||
@@ -130,6 +130,38 @@ static inline int backlight_update_status(struct backlight_device *bd) | |||
130 | return ret; | 130 | return ret; |
131 | } | 131 | } |
132 | 132 | ||
133 | /** | ||
134 | * backlight_enable - Enable backlight | ||
135 | * @bd: the backlight device to enable | ||
136 | */ | ||
137 | static inline int backlight_enable(struct backlight_device *bd) | ||
138 | { | ||
139 | if (!bd) | ||
140 | return 0; | ||
141 | |||
142 | bd->props.power = FB_BLANK_UNBLANK; | ||
143 | bd->props.fb_blank = FB_BLANK_UNBLANK; | ||
144 | bd->props.state &= ~BL_CORE_FBBLANK; | ||
145 | |||
146 | return backlight_update_status(bd); | ||
147 | } | ||
148 | |||
149 | /** | ||
150 | * backlight_disable - Disable backlight | ||
151 | * @bd: the backlight device to disable | ||
152 | */ | ||
153 | static inline int backlight_disable(struct backlight_device *bd) | ||
154 | { | ||
155 | if (!bd) | ||
156 | return 0; | ||
157 | |||
158 | bd->props.power = FB_BLANK_POWERDOWN; | ||
159 | bd->props.fb_blank = FB_BLANK_POWERDOWN; | ||
160 | bd->props.state |= BL_CORE_FBBLANK; | ||
161 | |||
162 | return backlight_update_status(bd); | ||
163 | } | ||
164 | |||
133 | extern struct backlight_device *backlight_device_register(const char *name, | 165 | extern struct backlight_device *backlight_device_register(const char *name, |
134 | struct device *dev, void *devdata, const struct backlight_ops *ops, | 166 | struct device *dev, void *devdata, const struct backlight_ops *ops, |
135 | const struct backlight_properties *props); | 167 | const struct backlight_properties *props); |