On some board gpio to power LCD can be active low, so let's add
CONFIG_VIDEO_LCD_POWER_ACTIVE_LOW to allow this.

Signed-off-by: Giulio Benetti <giulio.bene...@benettiengineering.com>
---
 arch/arm/mach-sunxi/Kconfig         | 7 +++++++
 drivers/video/sunxi/sunxi_display.c | 4 ++++
 2 files changed, 11 insertions(+)

diff --git a/arch/arm/mach-sunxi/Kconfig b/arch/arm/mach-sunxi/Kconfig
index dbe6005daa..a7375b53a6 100644
--- a/arch/arm/mach-sunxi/Kconfig
+++ b/arch/arm/mach-sunxi/Kconfig
@@ -867,6 +867,13 @@ config VIDEO_LCD_POWER
        Set the power enable pin for the LCD panel. This takes a string in the
        format understood by sunxi_name_to_gpio, e.g. PH1 for pin 1 of port H.
 
+config VIDEO_LCD_POWER_ACTIVE_LOW
+       bool "LCD panel power enable pin is inverted"
+       depends on VIDEO_SUNXI
+       default n
+       ---help---
+       Set this if the lcd power pin is active low.
+
 config VIDEO_LCD_RESET
        string "LCD panel reset pin"
        depends on VIDEO_SUNXI
diff --git a/drivers/video/sunxi/sunxi_display.c 
b/drivers/video/sunxi/sunxi_display.c
index 2ee6212c58..12b542d65b 100644
--- a/drivers/video/sunxi/sunxi_display.c
+++ b/drivers/video/sunxi/sunxi_display.c
@@ -588,7 +588,11 @@ static void sunxi_lcdc_panel_enable(void)
        pin = sunxi_name_to_gpio(CONFIG_VIDEO_LCD_POWER);
        if (pin >= 0) {
                gpio_request(pin, "lcd_power");
+#ifdef CONFIG_VIDEO_LCD_POWER_ACTIVE_LOW
+               gpio_direction_output(pin, 0);
+#else
                gpio_direction_output(pin, 1);
+#endif
        }
 
        if (reset_pin >= 0)
-- 
2.34.1

Reply via email to