]> git.karo-electronics.de Git - karo-tx-uboot.git/blobdiff - board/karo/tx48/tx48.c
karo: tx: get LCD backlight polarity from DT
[karo-tx-uboot.git] / board / karo / tx48 / tx48.c
index 5fcfbd1e18387b17aaf6f65a1fd5d6cd2b67a6d9..e59aa162898bcc92d7d4283227cf211f4436f400 100644 (file)
@@ -534,6 +534,12 @@ short console_col;
 short console_row;
 
 static int lcd_enabled = 1;
+static int lcd_bl_polarity;
+
+static int lcd_backlight_polarity(void)
+{
+       return lcd_bl_polarity;
+}
 
 void lcd_initcolregs(void)
 {
@@ -560,7 +566,8 @@ void lcd_enable(void)
                udelay(100);
                gpio_set_value(TX48_LCD_RST_GPIO, 1);
                udelay(300000);
-               gpio_set_value(TX48_LCD_BACKLIGHT_GPIO, 0);
+               gpio_set_value(TX48_LCD_BACKLIGHT_GPIO,
+                       lcd_backlight_polarity());
        }
 }
 
@@ -595,7 +602,8 @@ void lcd_panel_disable(void)
 {
        if (lcd_enabled) {
                debug("Switching LCD off\n");
-               gpio_set_value(TX48_LCD_BACKLIGHT_GPIO, 1);
+               gpio_set_value(TX48_LCD_BACKLIGHT_GPIO,
+                       !lcd_backlight_polarity());
                gpio_set_value(TX48_LCD_PWR_GPIO, 0);
                gpio_set_value(TX48_LCD_RST_GPIO, 0);
        }
@@ -625,6 +633,7 @@ void lcd_ctrl_init(void *lcdbase)
        }
 
        karo_fdt_move_fdt();
+       lcd_bl_polarity = karo_fdt_get_backlight_polarity(working_fdt);
 
        if (video_mode == NULL) {
                debug("Disabling LCD\n");