diff --git a/drivers/video/backlight-uclass.c b/drivers/video/backlight-uclass.c index 0238289d1b..d7041227d8 100644 --- a/drivers/video/backlight-uclass.c +++ b/drivers/video/backlight-uclass.c @@ -19,6 +19,16 @@ int backlight_enable(struct udevice *dev) return ops->enable(dev); } +int backlight_disable(struct udevice *dev) +{ + const struct backlight_ops *ops = backlight_get_ops(dev); + + if (!ops->disable) + return -ENOSYS; + + return ops->disable(dev); +} + UCLASS_DRIVER(backlight) = { .id = UCLASS_PANEL_BACKLIGHT, .name = "backlight", diff --git a/include/backlight.h b/include/backlight.h index 90e1d981e1..c3e1a9d194 100644 --- a/include/backlight.h +++ b/include/backlight.h @@ -16,6 +16,14 @@ struct backlight_ops { * @return 0 if OK, -ve on error */ int (*enable)(struct udevice *dev); + + /** + * disable() - Disable a backlight + * + * @dev: Backlight device to disable + * @return 0 if OK, -ve on error + */ + int (*disable)(struct udevice *dev); }; #define backlight_get_ops(dev) ((struct backlight_ops *)(dev)->driver->ops) @@ -28,4 +36,12 @@ struct backlight_ops { */ int backlight_enable(struct udevice *dev); +/** + * backlight_disable() - Disable a backlight + * + * @dev: Backlight device to disable + * @return 0 if OK, -ve on error + */ +int backlight_disable(struct udevice *dev); + #endif