Squashed commit of the following:

arch/arm/src/lpc54xx:  LCD.. Fix some miconceptions about how the video address lines are used.
    arch/arm/src/lpc54xx:  Fix some LCD BPP and BRG vs RGB settings.
This commit is contained in:
Gregory Nutt 2017-12-14 10:45:53 -06:00
parent 1fbf788555
commit c53d88c75c
5 changed files with 56 additions and 57 deletions

View File

@ -719,29 +719,19 @@ config LPC54_LCD_BPP16_565
bool "16 BPP, 5:6:5 mode"
depends on !LPC54_LCD_MONOCHROME
config LPC54_LCD_BPP24_RGB565
bool "24 BPP, 5:6:5 mode"
depends on !LPC54_LCD_MONOCHROME && LPC54_LCD_TFTPANEL
---help---
16-bit color is, by default, provided on LCD VD0-VD15; 24-bit color
is provided on VD0-23:
16-bit: RRRRRGGG GGGB BBBB
24-bit: ........ RRRRRRRR GGGGGGGG BBBBBBBB
This option selects an alternative pin configuration where 16-bit
RGB565 is provided on VD3-7, VD10-15, and VD19-23. This essentially
accepts 32-bit RGB888 color as input but only uses the RGB565 color
resolution:
24-bit: ........ RRRRR... GGGGGG.. BBBBB...
config LPC54_LCD_BPP24
bool "24 BPP, 8:8:8 mode"
depends on LPC54_LCD_TFTPANEL
endchoice
config LPC54_LCD_BGR
bool "Blue-Green-Red color order"
default n
depends on !LPC54_LCD_MONOCHROME
---help---
This option selects BGR color order vs. default RGB
config LPC54_LCD_BACKCOLOR
hex "Initial background color"
default 0x0

View File

@ -74,24 +74,7 @@
/* Framebuffer characteristics in bytes */
#if defined(CONFIG_LPC54_LCD_BPP1)
# define LPC54_STRIDE ((CONFIG_LPC54_LCD_HWIDTH * 1 + 7) / 8)
#elif defined(CONFIG_LPC54_LCD_BPP2)
# define LPC54_STRIDE ((CONFIG_LPC54_LCD_HWIDTH * 2 + 7) / 8)
#elif defined(CONFIG_LPC54_LCD_BPP4)
# define LPC54_STRIDE ((CONFIG_LPC54_LCD_HWIDTH * 4 + 7) / 8)
#elif defined(CONFIG_LPC54_LCD_BPP8)
# define LPC54_STRIDE ((CONFIG_LPC54_LCD_HWIDTH * 8 + 7) / 8)
#elif defined(CONFIG_LPC54_LCD_BPP16)
# define LPC54_STRIDE ((CONFIG_LPC54_LCD_HWIDTH * 16 + 7) / 8)
#elif defined(CONFIG_LPC54_LCD_BPP24)
# define LPC54_STRIDE ((CONFIG_LPC54_LCD_HWIDTH * 32 + 7) / 8)
#elif defined(CONFIG_LPC54_LCD_BPP16_565)
# define LPC54_STRIDE ((CONFIG_LPC54_LCD_HWIDTH * 16 + 7) / 8)
#else /* defined(CONFIG_LPC54_LCD_BPP12_444) */
# define LPC54_STRIDE ((CONFIG_LPC54_LCD_HWIDTH * 16 + 7) / 8)
#endif
#define LPC54_STRIDE ((CONFIG_LPC54_LCD_HWIDTH * LPC54_BPP + 7) / 8)
#define LPC54_FBSIZE (LPC54_STRIDE * CONFIG_LPC54_LCD_VHEIGHT)
/* Delays */
@ -99,10 +82,6 @@
#define LPC54_LCD_PWRDIS_DELAY 10000
#define LPC54_LCD_PWREN_DELAY 10000
/****************************************************************************
* Private Types
****************************************************************************/
/****************************************************************************
* Private Function Prototypes
****************************************************************************/
@ -478,39 +457,56 @@ int up_fbinitialize(int display)
int i;
/* Configure pins */
/* LCD panel data. Pins used depend on the panel configuration */
/* LCD panel data. Pins used depend on the panel configuration:
*
* STN 4BPP: VD0-VD3 (single panel)
* VD0-VD3, VD8-VD11 (dual panel)
* STN 8BPP: VD0-VD7 (single panel)
* VD0-VD15 (dual panel)
* TFT 12BPP: VD4-VD7, VD12-VD15, VD20-VD23
* TFT 16BPP: VD3-VD7, VD10-VD15, VD19-VD23
* TFT 24BPP: VD0-VD23
*/
lcdinfo("Configuring pins\n");
#ifndef CONFIG_LPC54_LCD_BPP24_RGB565
#if !defined(CONFIG_LPC54_LCD_BPP16_565) && !defined(CONFIG_LPC54_LCD_BPP12_444)
lpc54_gpio_config(GPIO_LCD_VD0);
lpc54_gpio_config(GPIO_LCD_VD1);
lpc54_gpio_config(GPIO_LCD_VD2);
#endif
#ifndef CONFIG_LPC54_LCD_BPP12_444
lpc54_gpio_config(GPIO_LCD_VD3);
#endif
lpc54_gpio_config(GPIO_LCD_VD4);
lpc54_gpio_config(GPIO_LCD_VD5);
lpc54_gpio_config(GPIO_LCD_VD6);
lpc54_gpio_config(GPIO_LCD_VD7);
#ifndef CONFIG_LPC54_LCD_BPP24_RGB565
#if LPC54_BPP > 8 /* Or STN 8-BPP Dual panel */
#if !defined(CONFIG_LPC54_LCD_BPP16_565) && !defined(CONFIG_LPC54_LCD_BPP12_444)
lpc54_gpio_config(GPIO_LCD_VD8);
lpc54_gpio_config(GPIO_LCD_VD9);
#endif
#ifndef CONFIG_LPC54_LCD_BPP12_444
lpc54_gpio_config(GPIO_LCD_VD10);
lpc54_gpio_config(GPIO_LCD_VD11);
#endif
lpc54_gpio_config(GPIO_LCD_VD12);
lpc54_gpio_config(GPIO_LCD_VD13);
lpc54_gpio_config(GPIO_LCD_VD14);
lpc54_gpio_config(GPIO_LCD_VD15);
#endif
#if LPC54_BPP > 16
#ifndef CONFIG_LPC54_LCD_BPP24_RGB565
#if LPC54_BPP > 16 || defined(CONFIG_LPC54_LCD_TFTPANEL)
#if !defined(CONFIG_LPC54_LCD_BPP16_565) && !defined(CONFIG_LPC54_LCD_BPP12_444)
lpc54_gpio_config(GPIO_LCD_VD16);
lpc54_gpio_config(GPIO_LCD_VD17);
lpc54_gpio_config(GPIO_LCD_VD18);
#endif
#ifndef CONFIG_LPC54_LCD_BPP12_444
lpc54_gpio_config(GPIO_LCD_VD19);
#endif
lpc54_gpio_config(GPIO_LCD_VD20);
lpc54_gpio_config(GPIO_LCD_VD21);
lpc54_gpio_config(GPIO_LCD_VD22);
@ -595,15 +591,23 @@ int up_fbinitialize(int display)
regval |= LCD_CTRL_LCDBPP_444; /* 12 bpp, 4:4:4 mode */
#endif
#ifdef CONFIG_LPC54_LCD_TFTPANEL
/* TFT panel */
#ifdef CONFIG_LPC54_LCD_TFTPANEL
regval |= LCD_CTRL_LCDTFT;
#else
/* STN panel */
regval &= ~LCD_CTRL_LCDTFT;
#endif
#ifdef CONFIG_LPC54_LCD_BGR
/* Swap red and blue. The colors will be 0x00RRGGBB, not 0x00BBGGRR. */
regval |= LCD_CTRL_BGR;
#else
regval &= ~LCD_CTRL_BGR;
#endif
/* Single panel */
@ -618,11 +622,11 @@ int up_fbinitialize(int display)
/* Select 4- or 8-bit monochrome interface */
# if LPC54_BPP > 4
#if LPC54_BPP > 4
regval |= LCD_CTRL_LCDMONO8;
# else
#else
regval &= ~LCD_CTRL_LCDMONO8;
# endif
#endif
#else
/* Select color LCD */

View File

@ -94,7 +94,7 @@
#elif defined(CONFIG_LPC54_LCD_BPP16_565)
# define LPC54_BPP 16
# define LPC54_COLOR_FMT FB_FMT_RGB16_565
#elif defined(CONFIG_LPC54_LCD_BPP24) || defined(CONFIG_LPC54_LCD_BPP24_RGB565)
#elif defined(CONFIG_LPC54_LCD_BPP24)
# define LPC54_BPP 32 /* Only 24 of 32 bits used for RGB */
# define LPC54_COLOR_FMT FB_FMT_RGB24
# ifndef CONFIG_LPC54_LCD_TFTPANEL

View File

@ -40,10 +40,12 @@ STATUS
minor clock source setting). That port required modifications only
for differences in some SYSCON and pin-related settings.
2017-12-13: Created the fb configuration for testing the LCD. Only
minimal testing has been performed. As of this writing, thre is
minimal testing has been performed. As of this writing, there is
some framebuffer functionality. There are recognizable but corrupted
patterns on the LCD. There are color formatting problems and some
horizontal elongation.
2017-12-14: Corrected a misconception about how the video data lines
were configured. Now the LCD appears to be fully functional.
Configurations
==============
@ -120,12 +122,16 @@ Configurations
enables the LPC54xx LCD driver in order to support the LPCXpresso's
TFT panel. In this configuration, the framebuffer resides in the
the lower half megabyte of SDRAM beginning at address 0xa0000000
(only 522,240 bytes actually used for the framebuffer). The
remainder of the SDRAM from 0xa0080000 up to 0xa1000000 is added
The remainder of the SDRAM from 0xa0080000 up to 0xa1000000 is added
to the heap.
2. The pdcurses test relies on some positional input device and so
is not yet usable.
The is wasteful of SDRAM: Only 261,120 bytes actually used for the
framebuffer. This memory could be reclaimed by changing the DRAM
CS0 offset value in the .config file.
2. Some of the pdcurses test rely on some positional input device and so
is not yet usable. Others work fine with no user include: charset,
xmas, firework, worms, rain, for examples.
nsh:
@ -173,4 +179,3 @@ Configurations
RAMTest: Pattern test: a0000000 16777216 33333333 cccccccc
RAMTest: Address-in-address test: a0000000 16777216
nsh>

View File

@ -21,7 +21,8 @@ CONFIG_LPC54_EMC_DYNAMIC_CS0_OFFSET=0x00080000
CONFIG_LPC54_EMC_DYNAMIC_CS0_SIZE=0x00f80000
CONFIG_LPC54_EMC_DYNAMIC_CS0=y
CONFIG_LPC54_EMC=y
CONFIG_LPC54_LCD_BPP24_RGB565=y
CONFIG_LPC54_LCD_BGR=y
CONFIG_LPC54_LCD_BPP16_565=y
CONFIG_LPC54_LCD_HBACKPORCH=43
CONFIG_LPC54_LCD_HFRONTPORCH=8
CONFIG_LPC54_LCD_VBACKPORCH=12
@ -41,7 +42,6 @@ CONFIG_NSH_DISABLE_IFUPDOWN=y
CONFIG_NSH_FILEIOSIZE=512
CONFIG_NSH_LINELEN=64
CONFIG_NSH_READLINE=y
CONFIG_PDCURSES_COLORFMT_RGB888=y
CONFIG_PDCURSES_FONT_6X9=y
CONFIG_PREALLOC_MQ_MSGS=4
CONFIG_PREALLOC_TIMERS=4