mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-07 19:30:30 +09:00
UPSTREAM: 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
Change-Id: I66bb87531ee94977376cde33070ab2650f6dfcf5
Signed-off-by: Wyon Bi <bivvy.bi@rock-chips.com>
(cherry picked from commit 5b698be049)
This commit is contained in:
committed by
Wyon Bi
parent
9fe8305b68
commit
ef16a0c44b
@@ -129,6 +129,38 @@ 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.fb_blank = FB_BLANK_UNBLANK;
|
||||
bd->props.state &= ~BL_CORE_FBBLANK;
|
||||
|
||||
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.fb_blank = FB_BLANK_POWERDOWN;
|
||||
bd->props.state |= BL_CORE_FBBLANK;
|
||||
|
||||
return backlight_update_status(bd);
|
||||
}
|
||||
|
||||
extern struct backlight_device *backlight_device_register(const char *name,
|
||||
struct device *dev, void *devdata, const struct backlight_ops *ops,
|
||||
const struct backlight_properties *props);
|
||||
|
||||
Reference in New Issue
Block a user