Lines Matching +full:bl +full:- +full:name

1 // SPDX-License-Identifier: GPL-2.0-only
3 * gpio_backlight.c - Simple GPIO-controlled backlight
24 static int gpio_backlight_update_status(struct backlight_device *bl) in gpio_backlight_update_status() argument
26 struct gpio_backlight *gbl = bl_get_data(bl); in gpio_backlight_update_status()
28 gpiod_set_value_cansleep(gbl->gpiod, backlight_get_brightness(bl)); in gpio_backlight_update_status()
33 static int gpio_backlight_check_fb(struct backlight_device *bl, in gpio_backlight_check_fb() argument
36 struct gpio_backlight *gbl = bl_get_data(bl); in gpio_backlight_check_fb()
38 return !gbl->dev || gbl->dev == info->device; in gpio_backlight_check_fb()
49 struct device *dev = &pdev->dev; in gpio_backlight_probe()
51 struct device_node *of_node = dev->of_node; in gpio_backlight_probe()
53 struct backlight_device *bl; in gpio_backlight_probe() local
59 return -ENOMEM; in gpio_backlight_probe()
62 gbl->dev = pdata->dev; in gpio_backlight_probe()
64 def_value = device_property_read_bool(dev, "default-on"); in gpio_backlight_probe()
66 gbl->gpiod = devm_gpiod_get(dev, NULL, GPIOD_ASIS); in gpio_backlight_probe()
67 if (IS_ERR(gbl->gpiod)) { in gpio_backlight_probe()
68 ret = PTR_ERR(gbl->gpiod); in gpio_backlight_probe()
69 if (ret != -EPROBE_DEFER) in gpio_backlight_probe()
78 bl = devm_backlight_device_register(dev, dev_name(dev), dev, gbl, in gpio_backlight_probe()
80 if (IS_ERR(bl)) { in gpio_backlight_probe()
82 return PTR_ERR(bl); in gpio_backlight_probe()
86 if (!of_node || !of_node->phandle) in gpio_backlight_probe()
88 bl->props.power = def_value ? FB_BLANK_UNBLANK in gpio_backlight_probe()
90 else if (gpiod_get_value_cansleep(gbl->gpiod) == 0) in gpio_backlight_probe()
91 bl->props.power = FB_BLANK_POWERDOWN; in gpio_backlight_probe()
93 bl->props.power = FB_BLANK_UNBLANK; in gpio_backlight_probe()
95 bl->props.brightness = 1; in gpio_backlight_probe()
97 init_brightness = backlight_get_brightness(bl); in gpio_backlight_probe()
98 ret = gpiod_direction_output(gbl->gpiod, init_brightness); in gpio_backlight_probe()
104 platform_set_drvdata(pdev, bl); in gpio_backlight_probe()
109 { .compatible = "gpio-backlight" },
117 .name = "gpio-backlight",
126 MODULE_DESCRIPTION("GPIO-based Backlight Driver");
128 MODULE_ALIAS("platform:gpio-backlight");