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 _BACKLIGHT_H 8#define _BACKLIGHT_H 9 10struct udevice; 11 12enum { 13 BACKLIGHT_MAX = 100, 14 BACKLIGHT_MIN = 0, 15 BACKLIGHT_OFF = -1, 16 BACKLIGHT_DEFAULT = -2, 17}; 18 19struct backlight_ops { 20 /** 21 * enable() - Enable a backlight 22 * 23 * @dev: Backlight device to enable 24 * @return 0 if OK, -ve on error 25 */ 26 int (*enable)(struct udevice *dev); 27 28 /** 29 * set_brightness - Set brightness 30 * 31 * @dev: Backlight device to update 32 * @percent: Brightness value (0 to 100, or BACKLIGHT_... value) 33 * @return 0 if OK, -ve on error 34 */ 35 int (*set_brightness)(struct udevice *dev, int percent); 36}; 37 38#define backlight_get_ops(dev) ((struct backlight_ops *)(dev)->driver->ops) 39 40/** 41 * backlight_enable() - Enable a backlight 42 * 43 * @dev: Backlight device to enable 44 * Return: 0 if OK, -ve on error 45 */ 46int backlight_enable(struct udevice *dev); 47 48/** 49 * backlight_set_brightness - Set brightness 50 * 51 * @dev: Backlight device to update 52 * @percent: Brightness value (0 to 100, or BACKLIGHT_... value) 53 * Return: 0 if OK, -ve on error 54 */ 55int backlight_set_brightness(struct udevice *dev, int percent); 56 57#endif 58