blob: c14996d003c00041c7fe5a88b085d60b04717d7b [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
Simon Glass8f790482016-01-21 19:44:56 -07002/*
3 * Copyright (c) 2016 Google, Inc
4 * Written by Simon Glass <sjg@chromium.org>
Simon Glass8f790482016-01-21 19:44:56 -07005 */
6
Patrick Delaunay81313352021-04-27 11:02:19 +02007#define LOG_CATEGORY UCLASS_PANEL_BACKLIGHT
8
Tom Riniabb9a042024-05-18 20:20:43 -06009#include <common.h>
Simon Glass8f790482016-01-21 19:44:56 -070010#include <dm.h>
11#include <backlight.h>
12
13int backlight_enable(struct udevice *dev)
14{
15 const struct backlight_ops *ops = backlight_get_ops(dev);
16
17 if (!ops->enable)
18 return -ENOSYS;
19
20 return ops->enable(dev);
21}
22
Simon Glassfe68a452018-10-01 12:22:41 -060023int backlight_set_brightness(struct udevice *dev, int percent)
24{
25 const struct backlight_ops *ops = backlight_get_ops(dev);
26
27 if (!ops->set_brightness)
28 return -ENOSYS;
29
30 return ops->set_brightness(dev, percent);
31}
32
Simon Glass8f790482016-01-21 19:44:56 -070033UCLASS_DRIVER(backlight) = {
34 .id = UCLASS_PANEL_BACKLIGHT,
35 .name = "backlight",
36};