mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-05 20:54:31 +00:00
720620e691
-----BEGIN PGP SIGNATURE----- iQGzBAABCgAdFiEEGjx/cOCPqxcHgJu/FHw5/5Y0tywFAl/0YVIACgkQFHw5/5Y0 tywtEwv/cJWlKgcSnYjuJrxwuJdauUTfXdbUgtCxOtBw/BP4dsKkbGTJPw5q5M+4 LJJSKyksmJVTX26h1dpkzQjOpWtTDnWqm5CTIxD52oQD7pxK+zCQ9T6S+QbQD0Se ogHmZluzFoluxbNgo8tiO52xvMhDO3TVAzxsNDdGfkd5/tAXOHClPc34RmAkdRHU VsR89AKdT2q543fiUfrRZYDzdctaNWhRGXMDcJ4+QU/8hQhrpcr8EtHbF+3mWX4K pA01pDz150Rn4UI6S2xKEWrjSTHe55fxVj/Qj0rq9z2E/+NqGXemf5s13AR0G/z3 PqHdVLHzDe64pbOvmyU1pVQ0aMb8vMJUnqx68SQZY3On2c+MjRWQ+7aVVaKOcPGp uatk6QMrggHp3Li+3yZrLBE0qPr/sNMVb7mUesdZb6lFd2VIs8siwhfeGXMS+nDI xePzsR43Fnn5Q5KIqqvcWUb+TTTqUDUff0wyAU8NBgCaIBIZK8h2ppS1jjnbms0I mr8Er2vb =Dfum -----END PGP SIGNATURE----- Merge tag 'v2021.01-rc5' into next Prepare v2021.01-rc5 Signed-off-by: Tom Rini <trini@konsulko.com>
72 lines
1.5 KiB
C
72 lines
1.5 KiB
C
// SPDX-License-Identifier: GPL-2.0+
|
|
/*
|
|
* Copyright (C) 2017, STMicroelectronics - All Rights Reserved
|
|
* Author: Patrick Delaunay <patrick.delaunay@foss.st.com>
|
|
*/
|
|
|
|
#include <common.h>
|
|
#include <dm.h>
|
|
#include <backlight.h>
|
|
#include <log.h>
|
|
#include <asm/gpio.h>
|
|
|
|
struct gpio_backlight_priv {
|
|
struct gpio_desc gpio;
|
|
bool def_value;
|
|
};
|
|
|
|
static int gpio_backlight_enable(struct udevice *dev)
|
|
{
|
|
struct gpio_backlight_priv *priv = dev_get_priv(dev);
|
|
|
|
dm_gpio_set_value(&priv->gpio, 1);
|
|
|
|
return 0;
|
|
}
|
|
|
|
static int gpio_backlight_of_to_plat(struct udevice *dev)
|
|
{
|
|
struct gpio_backlight_priv *priv = dev_get_priv(dev);
|
|
int ret;
|
|
|
|
ret = gpio_request_by_name(dev, "gpios", 0, &priv->gpio,
|
|
GPIOD_IS_OUT);
|
|
if (ret) {
|
|
debug("%s: Warning: cannot get GPIO: ret=%d\n",
|
|
__func__, ret);
|
|
return ret;
|
|
}
|
|
|
|
priv->def_value = dev_read_bool(dev, "default-on");
|
|
|
|
return 0;
|
|
}
|
|
|
|
static int gpio_backlight_probe(struct udevice *dev)
|
|
{
|
|
struct gpio_backlight_priv *priv = dev_get_priv(dev);
|
|
|
|
if (priv->def_value)
|
|
gpio_backlight_enable(dev);
|
|
|
|
return 0;
|
|
}
|
|
|
|
static const struct backlight_ops gpio_backlight_ops = {
|
|
.enable = gpio_backlight_enable,
|
|
};
|
|
|
|
static const struct udevice_id gpio_backlight_ids[] = {
|
|
{ .compatible = "gpio-backlight" },
|
|
{ }
|
|
};
|
|
|
|
U_BOOT_DRIVER(gpio_backlight) = {
|
|
.name = "gpio_backlight",
|
|
.id = UCLASS_PANEL_BACKLIGHT,
|
|
.of_match = gpio_backlight_ids,
|
|
.ops = &gpio_backlight_ops,
|
|
.of_to_plat = gpio_backlight_of_to_plat,
|
|
.probe = gpio_backlight_probe,
|
|
.priv_auto = sizeof(struct gpio_backlight_priv),
|
|
};
|