blob: 2a09b2da91063dc8c6ede1a2be084798618924fc [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
Simon Glass8f790482016-01-21 19:44:56 -07009#include <dm.h>
10#include <backlight.h>
11
12int backlight_enable(struct udevice *dev)
13{
14 const struct backlight_ops *ops = backlight_get_ops(dev);
15
16 if (!ops->enable)
17 return -ENOSYS;
18
19 return ops->enable(dev);
20}
21
Simon Glassfe68a452018-10-01 12:22:41 -060022int backlight_set_brightness(struct udevice *dev, int percent)
23{
24 const struct backlight_ops *ops = backlight_get_ops(dev);
25
26 if (!ops->set_brightness)
27 return -ENOSYS;
28
29 return ops->set_brightness(dev, percent);
30}
31
Simon Glass8f790482016-01-21 19:44:56 -070032UCLASS_DRIVER(backlight) = {
33 .id = UCLASS_PANEL_BACKLIGHT,
34 .name = "backlight",
35};