Tom Rini | 83d290c | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
Simon Glass | f563dc1 | 2016-01-21 19:44:58 -0700 | [diff] [blame] | 2 | /* |
| 3 | * Copyright (c) 2016 Google, Inc |
| 4 | * Written by Simon Glass <sjg@chromium.org> |
Simon Glass | f563dc1 | 2016-01-21 19:44:58 -0700 | [diff] [blame] | 5 | */ |
| 6 | |
| 7 | #include <common.h> |
| 8 | #include <dm.h> |
| 9 | #include <panel.h> |
| 10 | |
| 11 | int panel_enable_backlight(struct udevice *dev) |
| 12 | { |
| 13 | struct panel_ops *ops = panel_get_ops(dev); |
| 14 | |
| 15 | if (!ops->enable_backlight) |
| 16 | return -ENOSYS; |
| 17 | |
| 18 | return ops->enable_backlight(dev); |
| 19 | } |
| 20 | |
Simon Glass | a4f737a | 2018-10-01 12:22:41 -0600 | [diff] [blame] | 21 | /** |
| 22 | * panel_set_backlight - Set brightness for the panel backlight |
| 23 | * |
| 24 | * @dev: Panel device containing the backlight to update |
| 25 | * @percent: Brightness value (0=off, 1=min brightness, |
| 26 | * 100=full brightness) |
| 27 | * @return 0 if OK, -ve on error |
| 28 | */ |
| 29 | int panel_set_backlight(struct udevice *dev, int percent) |
| 30 | { |
| 31 | struct panel_ops *ops = panel_get_ops(dev); |
| 32 | |
| 33 | if (!ops->set_backlight) |
| 34 | return -ENOSYS; |
| 35 | |
| 36 | return ops->set_backlight(dev, percent); |
| 37 | } |
| 38 | |
Yannick Fertré | 28576f8 | 2018-07-13 14:11:09 +0200 | [diff] [blame] | 39 | int panel_get_display_timing(struct udevice *dev, |
| 40 | struct display_timing *timings) |
| 41 | { |
| 42 | struct panel_ops *ops = panel_get_ops(dev); |
| 43 | |
| 44 | if (!ops->get_display_timing) |
| 45 | return -ENOSYS; |
| 46 | |
| 47 | return ops->get_display_timing(dev, timings); |
| 48 | } |
| 49 | |
Simon Glass | f563dc1 | 2016-01-21 19:44:58 -0700 | [diff] [blame] | 50 | UCLASS_DRIVER(panel) = { |
| 51 | .id = UCLASS_PANEL, |
| 52 | .name = "panel", |
| 53 | }; |