Lines Matching +full:gpio +full:- +full:backlight

1 // SPDX-License-Identifier: GPL-2.0-only
3 * gpio_backlight.c - Simple GPIO-controlled backlight
6 #include <linux/backlight.h>
8 #include <linux/gpio/consumer.h>
27 gpiod_set_value_cansleep(gbl->gpiod, backlight_get_brightness(bl)); in gpio_backlight_update_status()
37 return !gbl->dev || gbl->dev == display_dev; in gpio_backlight_controls_device()
48 struct device *dev = &pdev->dev; in gpio_backlight_probe()
50 struct device_node *of_node = dev->of_node; in gpio_backlight_probe()
58 return -ENOMEM; in gpio_backlight_probe()
61 gbl->dev = pdata->dev; in gpio_backlight_probe()
63 def_value = device_property_read_bool(dev, "default-on"); in gpio_backlight_probe()
65 gbl->gpiod = devm_gpiod_get(dev, NULL, GPIOD_ASIS); in gpio_backlight_probe()
66 if (IS_ERR(gbl->gpiod)) in gpio_backlight_probe()
67 return dev_err_probe(dev, PTR_ERR(gbl->gpiod), in gpio_backlight_probe()
76 dev_err(dev, "failed to register backlight\n"); in gpio_backlight_probe()
81 if (!of_node || !of_node->phandle) in gpio_backlight_probe()
83 bl->props.power = def_value ? BACKLIGHT_POWER_ON in gpio_backlight_probe()
85 else if (gpiod_get_value_cansleep(gbl->gpiod) == 0) in gpio_backlight_probe()
86 bl->props.power = BACKLIGHT_POWER_OFF; in gpio_backlight_probe()
88 bl->props.power = BACKLIGHT_POWER_ON; in gpio_backlight_probe()
90 bl->props.brightness = 1; in gpio_backlight_probe()
93 ret = gpiod_direction_output(gbl->gpiod, init_brightness); in gpio_backlight_probe()
104 { .compatible = "gpio-backlight" },
112 .name = "gpio-backlight",
121 MODULE_DESCRIPTION("GPIO-based Backlight Driver");
123 MODULE_ALIAS("platform:gpio-backlight");