xref: /openbmc/u-boot/include/panel.h (revision 286a5c44)
1 /* SPDX-License-Identifier: GPL-2.0+ */
2 /*
3  * Copyright (c) 2016 Google, Inc
4  * Written by Simon Glass <sjg@chromium.org>
5  */
6 
7 #ifndef _PANEL_H
8 #define _PANEL_H
9 
10 struct panel_ops {
11 	/**
12 	 * enable_backlight() - Enable the panel backlight
13 	 *
14 	 * @dev:	Panel device containing the backlight to enable
15 	 * @return 0 if OK, -ve on error
16 	 */
17 	int (*enable_backlight)(struct udevice *dev);
18 
19 	/**
20 	 * set_backlight - Set panel backlight brightness
21 	 *
22 	 * @dev:	Panel device containing the backlight to update
23 	 * @percent:	Brightness value (0 to 100, or BACKLIGHT_... value)
24 	 * @return 0 if OK, -ve on error
25 	 */
26 	int (*set_backlight)(struct udevice *dev, int percent);
27 
28 	/**
29 	 * get_timings() - Get display timings from panel.
30 	 *
31 	 * @dev:	Panel device containing the display timings
32 	 * @tim:	Place to put timings
33 	 * @return 0 if OK, -ve on error
34 	 */
35 	int (*get_display_timing)(struct udevice *dev,
36 				  struct display_timing *timing);
37 };
38 
39 #define panel_get_ops(dev)	((struct panel_ops *)(dev)->driver->ops)
40 
41 /**
42  * panel_enable_backlight() - Enable/disable the panel backlight
43  *
44  * @dev:	Panel device containing the backlight to enable
45  * @enable:	true to enable the backlight, false to dis
46  * @return 0 if OK, -ve on error
47  */
48 int panel_enable_backlight(struct udevice *dev);
49 
50 /**
51  * panel_set_backlight - Set brightness for the panel backlight
52  *
53  * @dev:	Panel device containing the backlight to update
54  * @percent:	Brightness value (0 to 100, or BACKLIGHT_... value)
55  * @return 0 if OK, -ve on error
56  */
57 int panel_set_backlight(struct udevice *dev, int percent);
58 
59 /**
60  * panel_get_display_timing() - Get display timings from panel.
61  *
62  * @dev:	Panel device containing the display timings
63  * @return 0 if OK, -ve on error
64  */
65 int panel_get_display_timing(struct udevice *dev,
66 			     struct display_timing *timing);
67 
68 #endif
69