]> git.ipfire.org Git - thirdparty/u-boot.git/blame - include/backlight.h
configs: ls1028a: Enable DM support for pcf2127 rtc
[thirdparty/u-boot.git] / include / backlight.h
CommitLineData
83d290c5 1/* SPDX-License-Identifier: GPL-2.0+ */
363bf77a
SG
2/*
3 * Copyright (c) 2016 Google, Inc
4 * Written by Simon Glass <sjg@chromium.org>
363bf77a
SG
5 */
6
7#ifndef _BACKLIGHT_H
8#define _BACKLIGHT_H
9
a4f737a9
SG
10enum {
11 BACKLIGHT_MAX = 100,
12 BACKLIGHT_MIN = 0,
13 BACKLIGHT_OFF = -1,
14 BACKLIGHT_DEFAULT = -2,
15};
16
363bf77a
SG
17struct backlight_ops {
18 /**
19 * enable() - Enable a backlight
20 *
21 * @dev: Backlight device to enable
22 * @return 0 if OK, -ve on error
23 */
24 int (*enable)(struct udevice *dev);
a4f737a9
SG
25
26 /**
27 * set_brightness - Set brightness
28 *
29 * @dev: Backlight device to update
30 * @percent: Brightness value (0 to 100, or BACKLIGHT_... value)
31 * @return 0 if OK, -ve on error
32 */
33 int (*set_brightness)(struct udevice *dev, int percent);
363bf77a
SG
34};
35
36#define backlight_get_ops(dev) ((struct backlight_ops *)(dev)->driver->ops)
37
38/**
39 * backlight_enable() - Enable a backlight
40 *
41 * @dev: Backlight device to enable
42 * @return 0 if OK, -ve on error
43 */
44int backlight_enable(struct udevice *dev);
45
a4f737a9
SG
46/**
47 * backlight_set_brightness - Set brightness
48 *
49 * @dev: Backlight device to update
50 * @percent: Brightness value (0 to 100, or BACKLIGHT_... value)
51 * @return 0 if OK, -ve on error
52 */
53int backlight_set_brightness(struct udevice *dev, int percent);
54
363bf77a 55#endif