dm: backlight: add backlight_disable() interface
Change-Id: I3b3d1e961b31ac0d4e4bf4656da1ae063e3b5a72 Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
This commit is contained in:
parent
282d550a61
commit
91d246a3ae
|
|
@ -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",
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in New Issue