summaryrefslogtreecommitdiff
path: root/nuttx/arch/arm/src/lpc17xx/lpc17_lcd.c
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2013-03-28 17:12:11 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2013-03-28 17:12:11 +0000
commitfd7c0194d583e6f7d60e29f5fdd88b3a68b0d0de (patch)
tree66aa1997340b2fef132b29401f6bc33c0fe18857 /nuttx/arch/arm/src/lpc17xx/lpc17_lcd.c
parentff4412a0c33bfc12c87a98e354a092be5c0246a6 (diff)
downloadpx4-nuttx-fd7c0194d583e6f7d60e29f5fdd88b3a68b0d0de.tar.gz
px4-nuttx-fd7c0194d583e6f7d60e29f5fdd88b3a68b0d0de.tar.bz2
px4-nuttx-fd7c0194d583e6f7d60e29f5fdd88b3a68b0d0de.zip
In LPC1788 24-bit color mode, we need to tell NX that the resolution if 32 bpp; Add interfaces to control Open1788 backlight
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5798 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/arch/arm/src/lpc17xx/lpc17_lcd.c')
-rw-r--r--nuttx/arch/arm/src/lpc17xx/lpc17_lcd.c37
1 files changed, 33 insertions, 4 deletions
diff --git a/nuttx/arch/arm/src/lpc17xx/lpc17_lcd.c b/nuttx/arch/arm/src/lpc17xx/lpc17_lcd.c
index f1d2ea501..b4086ce0b 100644
--- a/nuttx/arch/arm/src/lpc17xx/lpc17_lcd.c
+++ b/nuttx/arch/arm/src/lpc17xx/lpc17_lcd.c
@@ -523,9 +523,7 @@ int up_fbinitialize(void)
/* Turn on LCD clock */
- regval = getreg32(LPC17_SYSCON_PCONP);
- regval |= SYSCON_PCONP_PCLCD;
- putreg32(regval, LPC17_SYSCON_PCONP);
+ modifyreg32(LPC17_SYSCON_PCONP, 0, SYSCON_PCONP_PCLCD);
/* Disable the cursor */
@@ -699,6 +697,11 @@ int up_fbinitialize(void)
regval |= LCD_CTRL_LCDPWR;
putreg32(regval, LPC17_LCD_CTRL);
+#ifdef CONFIG_LPC17_LCD_BACKLIGHT
+ /* Turn on the back light */
+
+ lpc17_backlight(true);
+#endif
return OK;
}
@@ -740,7 +743,33 @@ FAR struct fb_vtable_s *up_fbgetvplane(int vplane)
void fb_uninitialize(void)
{
- gdbg("Not implemented!\n");
+ uint32_t regval;
+ int i;
+
+ /* We assume there is only one use of the LCD and so we do not need to
+ * worry about mutually exclusive access to the LCD hardware.
+ */
+
+#ifdef CONFIG_LPC17_LCD_BACKLIGHT
+ /* Turn off the back light */
+
+ lpc17_backlight(false);
+#endif
+
+ /* Disable the LCD controller */
+
+ regval = getreg32(LPC17_LCD_CTRL);
+ regval &= ~LCD_CTRL_LCDPWR;
+ putreg32(regval, LPC17_LCD_CTRL);
+
+ for (i = LPC17_LCD_PWRDIS_DELAY; i; i--);
+
+ regval &= ~LCD_CTRL_LCDEN;
+ putreg32(regval, LPC17_LCD_CTRL);
+
+ /* Turn off clocking to the LCD. modifyreg32() can do this atomically. */
+
+ modifyreg32(LPC17_SYSCON_PCONP, SYSCON_PCONP_PCLCD, 0);
return OK;
}