Merge branch 'master' of https://source.denx.de/u-boot/custodians/u-boot-sh
[u-boot.git] / drivers / video / panel-uclass.c
blob52a3466dc8c1203731dfcb62ebf4e63ed390bbb4
1 // SPDX-License-Identifier: GPL-2.0+
2 /*
3 * Copyright (c) 2016 Google, Inc
4 * Written by Simon Glass <sjg@chromium.org>
5 */
7 #define LOG_CATEGORY UCLASS_PANEL
9 #include <dm.h>
10 #include <panel.h>
12 int panel_enable_backlight(struct udevice *dev)
14 struct panel_ops *ops = panel_get_ops(dev);
16 if (!ops->enable_backlight)
17 return -ENOSYS;
19 return ops->enable_backlight(dev);
22 /**
23 * panel_set_backlight - Set brightness for the panel backlight
25 * @dev: Panel device containing the backlight to update
26 * @percent: Brightness value (0=off, 1=min brightness,
27 * 100=full brightness)
28 * Return: 0 if OK, -ve on error
30 int panel_set_backlight(struct udevice *dev, int percent)
32 struct panel_ops *ops = panel_get_ops(dev);
34 if (!ops->set_backlight)
35 return -ENOSYS;
37 return ops->set_backlight(dev, percent);
40 int panel_get_display_timing(struct udevice *dev,
41 struct display_timing *timings)
43 struct panel_ops *ops = panel_get_ops(dev);
45 if (!ops->get_display_timing)
46 return -ENOSYS;
48 return ops->get_display_timing(dev, timings);
51 UCLASS_DRIVER(panel) = {
52 .id = UCLASS_PANEL,
53 .name = "panel",