提交 2f4647a1 编写于 作者: S Stefan Agner 提交者: Lee Jones

backlight: gpio-backlight: Use default-on on GPIO request

There are situations where the backlight should be on at boot time
(e.g. if the boot loader already turned the display on). The DT
bindings specify the "default-on" property for that purpose.
Currently, the initial state of the GPIO at request time is always
set to logical off (high or low depending on whether it is an
active high or low GPIO). Since the GPIO is requested as an output,
the GPIO will be driven low for a short period of time, which leads
to a flickering display in the above use-case.

Initialize the GPIO depending on the default-on property to be
logical on or off.
Signed-off-by: NStefan Agner <stefan@agner.ch>
Signed-off-by: NLee Jones <lee.jones@linaro.org>
上级 87770780
...@@ -89,6 +89,7 @@ static int gpio_backlight_probe(struct platform_device *pdev) ...@@ -89,6 +89,7 @@ static int gpio_backlight_probe(struct platform_device *pdev)
struct backlight_device *bl; struct backlight_device *bl;
struct gpio_backlight *gbl; struct gpio_backlight *gbl;
struct device_node *np = pdev->dev.of_node; struct device_node *np = pdev->dev.of_node;
unsigned long flags = GPIOF_DIR_OUT;
int ret; int ret;
if (!pdata && !np) { if (!pdata && !np) {
...@@ -114,9 +115,12 @@ static int gpio_backlight_probe(struct platform_device *pdev) ...@@ -114,9 +115,12 @@ static int gpio_backlight_probe(struct platform_device *pdev)
gbl->def_value = pdata->def_value; gbl->def_value = pdata->def_value;
} }
ret = devm_gpio_request_one(gbl->dev, gbl->gpio, GPIOF_DIR_OUT | if (gbl->active)
(gbl->active ? GPIOF_INIT_LOW flags |= gbl->def_value ? GPIOF_INIT_HIGH : GPIOF_INIT_LOW;
: GPIOF_INIT_HIGH), else
flags |= gbl->def_value ? GPIOF_INIT_LOW : GPIOF_INIT_HIGH;
ret = devm_gpio_request_one(gbl->dev, gbl->gpio, flags,
pdata ? pdata->name : "backlight"); pdata ? pdata->name : "backlight");
if (ret < 0) { if (ret < 0) {
dev_err(&pdev->dev, "unable to request GPIO\n"); dev_err(&pdev->dev, "unable to request GPIO\n");
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册