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