All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 1/2] sunxi: video: Make pwm polarity configurable
@ 2015-01-22 20:24 Hans de Goede
  2015-01-22 20:24 ` [U-Boot] [PATCH 2/2] sunxi: Add Hyundai A7HD support Hans de Goede
  2015-01-23  9:53 ` [U-Boot] [PATCH 1/2] sunxi: video: Make pwm polarity configurable Ian Campbell
  0 siblings, 2 replies; 4+ messages in thread
From: Hans de Goede @ 2015-01-22 20:24 UTC (permalink / raw)
  To: u-boot

It turns out that there are some panels where the pwm input is not active low,
so make it configurable.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 board/sunxi/Kconfig           |  7 +++++++
 drivers/video/sunxi_display.c | 17 +++++++++++------
 2 files changed, 18 insertions(+), 6 deletions(-)

diff --git a/board/sunxi/Kconfig b/board/sunxi/Kconfig
index 0e3c207..738b55e 100644
--- a/board/sunxi/Kconfig
+++ b/board/sunxi/Kconfig
@@ -319,6 +319,13 @@ config VIDEO_LCD_BL_PWM
 	Set the backlight pwm 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_BL_PWM_ACTIVE_LOW
+	bool "LCD panel backlight pwm is inverted"
+	depends on VIDEO
+	default y
+	---help---
+	Set this if the backlight pwm output is active low.
+
 
 # Note only one of these may be selected at a time! But hidden choices are
 # not supported by Kconfig
diff --git a/drivers/video/sunxi_display.c b/drivers/video/sunxi_display.c
index 5077111..af728b5 100644
--- a/drivers/video/sunxi_display.c
+++ b/drivers/video/sunxi_display.c
@@ -23,6 +23,14 @@
 #include "hitachi_tx18d42vm_lcd.h"
 #include "ssd2828.h"
 
+#ifdef CONFIG_VIDEO_LCD_BL_PWM_ACTIVE_LOW
+#define PWM_ON 0
+#define PWM_OFF 1
+#else
+#define PWM_ON 1
+#define PWM_OFF 0
+#endif
+
 DECLARE_GLOBAL_DATA_PTR;
 
 enum sunxi_monitor {
@@ -598,8 +606,7 @@ static void sunxi_lcdc_panel_enable(void)
 	pin = sunxi_name_to_gpio(CONFIG_VIDEO_LCD_BL_PWM);
 	if (pin != -1) {
 		gpio_request(pin, "lcd_backlight_pwm");
-		/* backlight pwm is inverted, set to 1 to disable backlight */
-		gpio_direction_output(pin, 1);
+		gpio_direction_output(pin, PWM_OFF);
 	}
 
 	/* Give the backlight some time to turn off and power up the panel. */
@@ -626,10 +633,8 @@ static void sunxi_lcdc_backlight_enable(void)
 		gpio_direction_output(pin, 1);
 
 	pin = sunxi_name_to_gpio(CONFIG_VIDEO_LCD_BL_PWM);
-	if (pin != -1) {
-		/* backlight pwm is inverted, set to 0 to enable backlight */
-		gpio_direction_output(pin, 0);
-	}
+	if (pin != -1)
+		gpio_direction_output(pin, PWM_ON);
 }
 
 static int sunxi_lcdc_get_clk_delay(const struct ctfb_res_modes *mode)
-- 
2.1.0

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-01-23  9:54 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-22 20:24 [U-Boot] [PATCH 1/2] sunxi: video: Make pwm polarity configurable Hans de Goede
2015-01-22 20:24 ` [U-Boot] [PATCH 2/2] sunxi: Add Hyundai A7HD support Hans de Goede
2015-01-23  9:54   ` Ian Campbell
2015-01-23  9:53 ` [U-Boot] [PATCH 1/2] sunxi: video: Make pwm polarity configurable Ian Campbell

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.