Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
Simon Glass | 8f79048 | 2016-01-21 19:44:56 -0700 | [diff] [blame] | 2 | /* |
| 3 | * Copyright (c) 2016 Google, Inc |
| 4 | * Written by Simon Glass <sjg@chromium.org> |
Simon Glass | 8f79048 | 2016-01-21 19:44:56 -0700 | [diff] [blame] | 5 | */ |
| 6 | |
| 7 | #include <common.h> |
| 8 | #include <dm.h> |
| 9 | #include <backlight.h> |
| 10 | |
| 11 | int backlight_enable(struct udevice *dev) |
| 12 | { |
| 13 | const struct backlight_ops *ops = backlight_get_ops(dev); |
| 14 | |
| 15 | if (!ops->enable) |
| 16 | return -ENOSYS; |
| 17 | |
| 18 | return ops->enable(dev); |
| 19 | } |
| 20 | |
Simon Glass | fe68a45 | 2018-10-01 12:22:41 -0600 | [diff] [blame] | 21 | int backlight_set_brightness(struct udevice *dev, int percent) |
| 22 | { |
| 23 | const struct backlight_ops *ops = backlight_get_ops(dev); |
| 24 | |
| 25 | if (!ops->set_brightness) |
| 26 | return -ENOSYS; |
| 27 | |
| 28 | return ops->set_brightness(dev, percent); |
| 29 | } |
| 30 | |
Simon Glass | 8f79048 | 2016-01-21 19:44:56 -0700 | [diff] [blame] | 31 | UCLASS_DRIVER(backlight) = { |
| 32 | .id = UCLASS_PANEL_BACKLIGHT, |
| 33 | .name = "backlight", |
| 34 | }; |