]> git.baikalelectronics.ru Git - kernel.git/commit
backlight: gpio: Explicitly set the direction of the GPIO
authorBartosz Golaszewski <bgolaszewski@baylibre.com>
Tue, 22 Oct 2019 08:36:24 +0000 (10:36 +0200)
committerLee Jones <lee.jones@linaro.org>
Mon, 11 Nov 2019 11:34:01 +0000 (11:34 +0000)
commit5ef49ff59a7cca7490a158ab972f06d6c5b46cb8
treec8e7e4d5992802b25ac401df7a382fc14d9a59bd
parentdf589a7365287cc1a882c93b2de6e54294efb558
backlight: gpio: Explicitly set the direction of the GPIO

The GPIO backlight driver currently requests the line 'as is', without
acively setting its direction. This can lead to problems: if the line
is in input mode by default, we won't be able to drive it later when
updating the status and also reading its initial value doesn't make
sense for backlight setting.

Request the line 'as is' initially, so that we can read its value
without affecting it but then change the direction to output explicitly
when setting the initial brightness.

Also: check the current direction and only read the value if it's output.

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
drivers/video/backlight/gpio_backlight.c