This commit brings in an initial LCD driver sof the AM335x architecture. This is a work in progress and so depends on EXPERIMENTAL. The code is nearly compete, missing some clock configureation settings. It does compile properly.

Squashed commit of the following:

    arch/arm/src/am335x/am335x_lcdc.c:  LCD driver now compiles.
    arch/arm/src/am335x/am335x_lcd.c:  This brings the LCD driver to code complete.  Have not yet attempted to compile.
    arch/arm/src/am335x/am335x_edid.c:  Framebuffer is pre-allocated.  In verification of video mode, include a test to assure that the video mode can be supported by the pre-allocated framebuffer memory.
    arch/arm/src/am335x/am335x_lcd.c:  At a little bit of LCD initialization logic.  There is a long way to go.
    arch/arm/src/am335x/am335x_edid.c:  Add am335x_lcd_videomode() which provides an alternative way of initializing the LCD controller.
    arch/arm/src/am335x/am335x_edid.c:  edit.h has move to include/nuttx/video.
    arch/arm/src/am335x/hardware/am335x_cm.h:  Fix a typo in a macro name.
    arch/arm/src/am335x/am335x_edid.c:  Integrate video/edid support.
    arch/arm/src/am335x/am335x_edid.c:  Fall back to VGA mode is not valid videomode is availabe in the EDID data.
    arch/arm/src/am335x/am335x_edid.c:  Fixes for a partially clean compile.
    arch/arm/src/am335x/am335x_edid.c:  Add basic logic to convert EDID montor descriptions into a form usable for LCD configuration.
    arch/arm/src/am335x: Add framework (only) for an LCD driver.  Initial commit is simply the LPC54 framebuffer driver with naming changes.
This commit is contained in:
Gregory Nutt
2019-07-08 12:06:23 -06:00
parent 2b25d56bfd
commit b58f598d31
6 changed files with 1668 additions and 8 deletions
+124 -5
View File
@@ -94,16 +94,18 @@ config AM335X_GPIO
bool "GPIO"
default n
config AM335X_LCDC
bool "LCD controller"
default n
depends on VIDEO && EXPERIMENTAL
select VIDEO_EDID
config AM335X_TSC
bool "Touchscreen Controller"
default n
config AM335X_LCDC
bool "LCD Controller"
default n
config AM335X_CPSW
bool "Ethernet subsustem"
bool "Ethernet subsystem"
default n
config AM335X_PWMSS
@@ -248,4 +250,121 @@ config AM335X_DDR_MAPSIZE
plus the size of the available heap. NOTE that RAM_SIZE may not
include all of SDRAM up to the end of mapped region.
menu "LCD Configuration"
depends on AM335X_LCDC
config AM335X_LCDC_VRAMBASE
hex "Video RAM base address"
default 0xa0010000
---help---
Base address of the video RAM frame buffer. The default is
(AM335X_EXTDRAM_CS0 + 0x00010000)
config AM335X_LCDC_USE_CLKIN
bool "Use optional input clock"
default n
config AM335X_LCDC_CLKIN_FREQUENCY
int "Input clock frequency"
default 0
depends on AM335X_LCDC_USE_CLKIN
config AM335X_LCDC_REFRESH_FREQ
int "LCD refesh rate (Hz)"
default 50
---help---
LCD refesh rate (Hz)
choice
prompt "Bits per pixel"
default AM335X_LCDC_BPP16_565
config AM335X_LCDC_BPP1
bool "1 BPP"
config AM335X_LCDC_BPP2
bool "2 BPP"
config AM335X_LCDC_BPP4
bool "4 BPP"
config AM335X_LCDC_BPP8
bool "8 BPP"
config AM335X_LCDC_BPP12_444
bool "12 bpp, 4:4:4 mode"
config AM335X_LCDC_BPP16_565
bool "16 BPP, 5:6:5 mode"
config AM335X_LCDC_BPP24
bool "24 BPP, 8:8:8 mode (packed)"
config AM335X_LCDC_BPP32
bool "32 BPP, 8:8:8 mode (unpacked)"
endchoice
config AM335X_LCDC_BGR
bool "Blue-Green-Red color order"
default n
depends on !AM335X_LCDC_MONOCHROME
---help---
This option selects BGR color order vs. default RGB
config AM335X_LCDC_BACKCOLOR
hex "Initial background color"
default 0x0
---help---
Initial background color
config AM335X_LCDC_ACBIAS
int "AC bias pin frequency"
default 255
range 0 255
config AM335X_LCDC_ACBIAS_PINT
int "AC bias pin transitions per interrupt"
default 0
range 0 15
choice
prompt "DMA burst size"
default AM335X_LCDC_DMA_BURST16
config AM335X_LCDC_DMA_BURST1
bool "1"
config AM335X_LCDC_DMA_BURST2
bool "2"
config AM335X_LCDC_DMA_BURST4
bool "4"
config AM335X_LCDC_DMA_BURST8
bool "8"
config AM335X_LCDC_DMA_BURST16
bool "16"
endchoice
config AM335X_LCDC_FDD
int "Palette loading delay"
default 128
range 0 255
config AM335X_LCDC_SYNC_EDGE
bool "HSYNC/VSYNC rise or fall"
default n
config AM335X_LCDC_SYNC_CTRL
bool "Hsync/Vsync pixel clock control on/off"
default y
config AM335X_LCDC_PIXCLK_INVERT
bool "Invert pixel clock"
default y
endmenu # LCD Configuration
endif # ARCH_CHIP_AM335X
+5 -1
View File
@@ -133,4 +133,8 @@ endif
ifeq ($(CONFIG_AM335X_GPIO_IRQ),y)
CHIP_CSRCS += am335x_gpioirq.c
endif
endif
ifeq ($(CONFIG_AM335X_LCDC),y)
CHIP_CSRCS += am335x_lcdc.c am335x_edid.c
endif
+402
View File
@@ -0,0 +1,402 @@
/****************************************************************************
* arch/arm/src/am335x/am335x_wdog.c
*
* Copyright (C) 2019 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* The LCD driver derives from the LPC54xx LCD driver but also includes
* information from the FreeBSD AM335x LCD driver which was released under
* a two-clause BSD license:
*
* Copyright 2013 Oleksandr Tymoshenko <gonzo@freebsd.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name NuttX nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <string.h>
#include <assert.h>
#include <errno.h>
#include <debug.h>
#include <nuttx/video/edid.h>
#include "am335x_lcdc.h"
/****************************************************************************
* Pre-processor definitions Functions
****************************************************************************/
#define MODE_HBP(mode) ((mode)->htotal - (mode)->hsync_end)
#define MODE_HFP(mode) ((mode)->hsync_start - (mode)->hdisplay)
#define MODE_HSW(mode) ((mode)->hsync_end - (mode)->hsync_start)
#define MODE_VBP(mode) ((mode)->vtotal - (mode)->vsync_end)
#define MODE_VFP(mode) ((mode)->vsync_start - (mode)->vdisplay)
#define MODE_VSW(mode) ((mode)->vsync_end - (mode)->vsync_start)
#define MAX_PIXEL_CLOCK 126000
#define MAX_BANDWIDTH (1280*1024*60)
/****************************************************************************
* Private Functions
****************************************************************************/
/****************************************************************************
* Name: am335x_lcd_edid
*
* Description:
* Return the vertical refresh rate for this video mode.
*
****************************************************************************/
static uint32_t
am335x_videomode_vrefresh(FAR const struct edid_videomode_s *videomode)
{
uint32_t refresh;
/* Calculate vertical refresh rate */
refresh = (videomode->dotclock * 1000 / videomode->htotal);
refresh = (refresh + videomode->vtotal / 2) / videomode->vtotal;
if (videomode->flags & VID_INTERLACE)
{
refresh *= 2;
}
if (videomode->flags & VID_DBLSCAN)
{
refresh /= 2;
}
return refresh;
}
/****************************************************************************
* Name: am335x_videomode_valid
*
* Description:
* Return true if the provided video mode is valid.
*
****************************************************************************/
static bool
am335x_videomode_valid(FAR const struct edid_videomode_s *videomode,
FAR const struct am335x_fbinfo_s *fbinfo)
{
size_t fbstride;
size_t fbsize;
uint32_t hbp;
uint32_t hfp;
uint32_t hsw;
uint32_t vbp;
uint32_t vfp;
uint32_t vsw;
uint32_t vrefresh;
if (videomode->dotclock > MAX_PIXEL_CLOCK)
{
return false;
}
if (videomode->hdisplay & 0xf)
{
return false;
}
if (videomode->vdisplay > 2048)
{
return false;
}
/* Check ranges for timing parameters */
hbp = MODE_HBP(videomode) - 1;
hfp = MODE_HFP(videomode) - 1;
hsw = MODE_HSW(videomode) - 1;
vbp = MODE_VBP(videomode);
vfp = MODE_VFP(videomode);
vsw = MODE_VSW(videomode) - 1;
if (hbp > 0x3ff)
{
return false;
}
if (hfp > 0x3ff)
{
return false;
}
if (hsw > 0x3ff)
{
return false;
}
if (vbp > 0xff)
{
return false;
}
if (vfp > 0xff)
{
return false;
}
if (vsw > 0x3f)
{
return false;
}
vrefresh = am335x_videomode_vrefresh(videomode);
if (videomode->vdisplay * videomode->hdisplay * vrefresh > MAX_BANDWIDTH)
{
return false;
}
/* Finally, make sure that the framebuffer buffer region is large enough
* to support this video mode.
*/
fbstride = (videomode->hdisplay * AM335X_BPP + 7) >> 3;
fbsize = videomode->vdisplay * fbstride;
if (fbsize > fbinfo->fbsize)
{
return false;
}
return true;
}
/****************************************************************************
* Name: am335x_lcd_pickmode
*
* Description:
* If there is access to Extended Display Identification Data (EDIDI),
* then the board-specific logic may read the EDID data and use this
* function to select an appropriate video mode.
*
* edid_parse() should be used to convert the raw EDID data into the
* digested form of struct edid_info.
*
* The returned video mode may be used to both (1) configure HDMI and (2)
* initialize the AM335x LCD controller.
*
****************************************************************************/
static const struct edid_videomode_s *
am335x_lcd_pickmode(FAR struct edid_info_s *ei,
FAR const struct am335x_fbinfo_s *fbinfo)
{
FAR const struct edid_videomode_s *videomode;
int n;
/* Get standard VGA as default */
videomode = NULL;
/* Pick a video mode -- First check if we can support the preferred mode. */
if (ei->edid_preferred_mode != NULL)
{
if (am335x_videomode_valid(ei->edid_preferred_mode, fbinfo))
{
videomode = ei->edid_preferred_mode;
return videomode;
}
}
/* Sort video modes by refresh rate, aspect ratio (*), then resolution.
* Preferred mode or largest mode is first in the list and other modes
* are sorted on closest match to that mode.
*/
edid_sort_modes(ei->edid_modes, &ei->edid_preferred_mode, ei->edid_nmodes);
/* Pick the first valid mode in the list */
for (n = 0; n < ei->edid_nmodes; n++)
{
if (am335x_videomode_valid(&ei->edid_modes[n], fbinfo))
{
videomode = &ei->edid_modes[n];
break;
}
}
return videomode;
}
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: am335x_lcd_videomode
*
* Description:
* If the video mod is known, then the board-specific logic may read the
* use this function to convert the video mode data to an instance of
* struct am335x_panel_info_s which then may be used to initialize the
* the LCD/
*
* Input Parameters:
* videomode - A reference to the desired video mode.
* panel - A user provided location to receive the panel data.
*
* Returned value:
* None. Always succeeds.
*
****************************************************************************/
void am335x_lcd_videomode(FAR const struct edid_videomode_s *videomode,
FAR struct am335x_panel_info_s *panel)
{
lcdinfo("Detected videomode: %dx%d @ %dKHz\n",
videomode->hdisplay, videomode->vdisplay,
am335x_videomode_vrefresh(videomode));
panel->width = videomode->hdisplay;
panel->height = videomode->vdisplay;
panel->hfp = videomode->hsync_start - videomode->hdisplay;
panel->hbp = videomode->htotal - videomode->hsync_end;
panel->hsw = videomode->hsync_end - videomode->hsync_start;
panel->vfp = videomode->vsync_start - videomode->vdisplay;
panel->vbp = videomode->vtotal - videomode->vsync_end;
panel->vsw = videomode->vsync_end - videomode->vsync_start;
panel->pixelclk_active = true;
/* Logic for HSYNC should be reversed */
panel->hsync_active = ((videomode->flags & VID_NHSYNC) != 0);
panel->vsync_active = ((videomode->flags & VID_NVSYNC) == 0);
panel->pixclk = videomode->dotclock * 1000;
/* Set other values to the default */
#ifdef CONFIG_AM335X_LCDC_SYNC_EDGE
panel->sync_edge = true;
#else
panel->sync_edge = false;
#endif
#ifdef CONFIG_AM335X_LCDC_SYNC_CTRL
panel->sync_ctrl = true;
#else
panel->sync_ctrl = false;
#endif
#ifdef CONFIG_AM335X_LCDC_PIXCLK_INVERT
panel->pixelclk_active = true;
#else
panel->pixelclk_active = false;
#endif
panel->acbias = CONFIG_AM335X_LCDC_ACBIAS;
panel->acbias_pint = CONFIG_AM335X_LCDC_ACBIAS_PINT;
panel->dma_burstsz = AM335X_LCD_DMA_BURSTSZ;
panel->bpp = AM335X_BPP; /* REVISIT */
panel->fdd = CONFIG_AM335X_LCDC_FDD;
}
/****************************************************************************
* Name: am335x_lcd_edid
*
* Description:
* If there is access to Extended Display Identification Data (EDID),
* then the board-specific logic may read the EDID data and use this
* function to initialize an instance of struct am335x_panel_info_s.
*
* The returned video mode may optionally be returned to configure HDMI.
*
* Input Parameters:
* edid - A reference to the raw EDID data.
* len - The length of the EDID data in bytes
* panel - A user provided location to receive the panel data.
* selected - A user provided location to receive the selected video mode.
* fbinfo - Provides information about the pre-allocate framebuffer
* memory.
*
* Returned value:
* None. Always succeeds. The logic will fallback to VGA mode if no
* EDID data is provided or if there is no valid video mode in the EDID
* data.
*
****************************************************************************/
void am335x_lcd_edid(FAR const uint8_t *edid, size_t edid_len,
FAR struct am335x_panel_info_s *panel,
FAR struct edid_videomode_s *selected,
FAR const struct am335x_fbinfo_s *fbinfo)
{
FAR const struct edid_videomode_s *videomode = NULL;
struct edid_info_s ei;
/* Do we have EDID data? */
if (edid != NULL && edid_len > 0)
{
/* Parse the EDID data */
if (edid_parse(edid, &ei) == 0)
{
videomode = am335x_lcd_pickmode(&ei, fbinfo);
}
else
{
lcderr("ERROR: Failed to parse EDID\n");
}
}
/* Use standard VGA as fallback */
if (videomode == NULL)
{
videomode = edid_mode_lookup("640x480x60");
DEBUGASSERT(videomode != NULL);
}
/* Initialize the LCD using the selected video mode */
am335x_lcd_videomode(videomode, panel);
/* Return the selected video mode */
if (selected != NULL)
{
memcpy(selected, videomode, sizeof(struct edid_videomode_s));
}
}
File diff suppressed because it is too large Load Diff
+314
View File
@@ -0,0 +1,314 @@
/****************************************************************************
* arch/arm/src/am335x/am335x_lcdc.h
*
* Copyright (C) 2019 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* The LCD driver derives from the LPC54xx LCD driver but also includes
* information from the FreeBSD AM335x LCD driver which was released under
* a two-clause BSD license:
*
* Copyright 2013 Oleksandr Tymoshenko <gonzo@freebsd.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name NuttX nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
****************************************************************************/
/* The LPC54 LCD driver uses the common framebuffer interfaces declared in
* include/nuttx/video/fb.h.
*/
#ifndef __ARCH_ARM_SRC_AM335X_AM335X_LCDC_H
#define __ARCH_ARM_SRC_AM335X_AM335X_LCDC_H
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <stdbool.h>
#include <stdint.h>
#include <nuttx/nx/nxglib.h>
#include "hardware/am335x_lcd.h"
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/* Configuration ************************************************************/
/* Background color */
#ifndef CONFIG_AM335X_LCDC_BACKCOLOR
# warning "Assuming background color == 16"
# define CONFIG_AM335X_LCDC_BACKCOLOR 0 /* Initial background color */
#endif
/* Default characteristics (may be overridden via struct am335x_panel_info_s */
/* Bits per pixel / color format */
#undef AM335X_COLOR_FMT
#if defined(CONFIG_AM335X_LCDC_BPP1)
# define AM335X_BPP 1
# define AM335X_COLOR_FMT FB_FMT_Y1
#elif defined(CONFIG_AM335X_LCDC_BPP2)
# define AM335X_BPP 2
# define AM335X_COLOR_FMT FB_FMT_Y2
#elif defined(CONFIG_AM335X_LCDC_BPP4)
# define AM335X_BPP 4
# define AM335X_COLOR_FMT FB_FMT_Y4
#elif defined(CONFIG_AM335X_LCDC_BPP8)
# define AM335X_BPP 8
# define AM335X_COLOR_FMT FB_FMT_Y8
#elif defined(CONFIG_AM335X_LCDC_BPP12_444)
# define AM335X_BPP 1 12
# define AM335X_COLOR_FMT FB_FMT_RGB12_444
#elif defined(CONFIG_AM335X_LCDC_BPP16_565)
# define AM335X_BPP 16
# define AM335X_COLOR_FMT FB_FMT_RGB16_565
#elif defined(CONFIG_AM335X_LCDC_BPP24)
# define AM335X_BPP 24 RGB */
# define AM335X_COLOR_FMT FB_FMT_RGB24
#else
# warning "Assuming 16 BPP 5:6:5"
# define AM335X_BPP 16
# define CONFIG_AM335X_LCDC_BPP16_565 1
# define AM335X_COLOR_FMT FB_FMT_RGB16_565
#endif
#ifndef CONFIG_AM335X_LCDC_ACBIAS
# warning "Assuming AC bias == 255"
# define CONFIG_AM335X_LCDC_ACBIAS 255
#endif
#ifndef CONFIG_AM335X_LCDC_ACBIAS_PINT
# warning "Assuming AC bias per interrupt == 0"
# define CONFIG_AM335X_LCDC_ACBIAS_PINT 0
#endif
#if defined(CONFIG_AM335X_LCDC_DMA_BURST1)
# define AM335X_LCD_DMA_BURSTSZ 1
#elif defined(CONFIG_AM335X_LCDC_DMA_BURST2)
# define AM335X_LCD_DMA_BURSTSZ 2
#elif defined(CONFIG_AM335X_LCDC_DMA_BURST4)
# define AM335X_LCD_DMA_BURSTSZ 4
#elif defined(CONFIG_AM335X_LCDC_DMA_BURST8)
# define AM335X_LCD_DMA_BURSTSZ 8
#elif defined(CONFIG_AM335X_LCDC_DMA_BURST16)
# define AM335X_LCD_DMA_BURSTSZ 16
#else
# warning "Assuming DMA burst size == 16"
# define CONFIG_AM335X_LCDC_DMA_BURST16 1
# define AM335X_LCD_DMA_BURSTSZ 16
#endif
#ifndef CONFIG_AM335X_LCDC_FDD
# warning "Assuming FDD == 128"
# define CONFIG_AM335X_LCDC_FDD 128
#endif
/****************************************************************************
* Public Types
****************************************************************************/
/* Describes the LCD panel configuration */
struct am335x_panel_info_s
{
bool hsync_active; /* HSync active */
bool vsync_active; /* Invert VSync */
bool sync_edge; /* HSYNC/VSYNC rise or fall */
bool sync_ctrl; /* Hsync/Vsync pixel clock control on/off */
bool pixelclk_active; /* Invert pixel clock */
uint32_t width; /* Display width (pixels) */
uint32_t height; /* Display height (lines) */
uint32_t hfp; /* Horizontal front porch (pixels) */
uint32_t hbp; /* Horizontal back porch (pixels) */
uint32_t hsw; /* HSync width */
uint32_t vfp; /* Vertical front porch (lines) */
uint32_t vbp; /* Vertical back porch (lines) */
uint32_t vsw; /* VSync width */
uint32_t pixclk; /* Pixel clock */
uint32_t acbias; /* AC bias pin frequency */
uint32_t acbias_pint; /* AC bias pins transitions per interrupt */
uint32_t dma_burstsz; /* DMA burst size */
uint32_t bpp; /* Bits per pixel */
uint32_t fdd; /* Palette loading delay */
};
/* A special memory region is set aside for the framebuffer. This region
* must be set aside in the linker script and assigned a virtual address
* during initialization. The framebuffer memory region must be non-
* cached.
*/
struct am335x_fbinfo_s
{
FAR void *fbmem; /* Virtual address of the framebuffer */
FAR void *fbphys; /* Physical address of the framebuffer */
size_t fbsize; /* Size of the framebuffer region */
};
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: am335x_lcd_initialize
*
* Description:
* Initialize the AM335x for use the display described by the provided
* instance of struct am335x_panel_info_s.
*
* This function must be called by board specific logic to initialize the
* LCD. Normally the calling sequence is as follows:
*
* 1a. Graphics application starts and initializes the NX server via
* boardctl(BOARDIOC_NX_START). This calls the graphics
* initialization function nxmu_start() which, in turn, will call
* up_fbinitialize(). Or,
* 1b. The framebuffer character driver is initialized and calls
* up_fbinitialize().
* 2. The function up_fbinitialize() must reside in board specific logic
* under configs/. It must create the instance of struct
* am335x_panel_info_s and call this function with that instance.
*
* For a directly connected LCD, either (1) the struct am335x_panel_info_s
* may be initialized with constant data or (2) the desired video mode can
* obtained via lookup from edid_mode_lookup() and the struct
* am335x_panel_info_s can be created with am335x_lcd_videomode().
*
* If there is access to Extended Display Identification Data (EDID), then
* the board-specific logic may read the EDID data and use
* am335x_lcd_edid() to use the EDID data to initialize the struct
* am335x_panel_info_s instance.
*
* Input Parameters:
* panel - Provides information about the connect LCD panel.
* fbinfo - Provides information about the pre-allocate framebuffer
* memory.
*
* Returned value:
* Zero (OK) is returned on success; a negated errno value is returned in
* the the case of a failure.
*
****************************************************************************/
int am335x_lcd_initialize(FAR const struct am335x_panel_info_s *panel,
FAR const struct am335x_fbinfo_s *fbinfo);
/****************************************************************************
* Name: am335x_lcdclear
*
* Description:
* This is a non-standard LCD interface just for the AM335x. Clearing
* the display in the normal way by writing a sequences of runs that
* covers the entire display can be slow. Here the display is cleared by
* simply setting all VRAM memory to the specified color.
*
****************************************************************************/
void am335x_lcdclear(nxgl_mxpixel_t color);
/****************************************************************************
* Name: am335x_lcd_videomode
*
* Description:
* If the video mod is known, then the board-specific logic may read the
* use this function to convert the video mode data to an instance of
* struct am335x_panel_info_s which then may be used to initialize the
* the LCD/
*
* Input Parameters:
* videomode - A reference to the desired video mode.
* panel - A user provided location to receive the panel data.
*
* Returned value:
* None. Always succeeds.
*
****************************************************************************/
struct edid_videomode_s; /* Forward reference */
void am335x_lcd_videomode(FAR const struct edid_videomode_s *videomode,
FAR struct am335x_panel_info_s *panel);
/****************************************************************************
* Name: am335x_lcd_edid
*
* Description:
* If there is access to Extended Display Identification Data (EDID),
* then the board-specific logic may read the EDID data and use this
* function to initialize an instance of struct am335x_panel_info_s.
*
* The returned video mode may optionally be returned to configure HDMI.
*
* Input Parameters:
* edid - A reference to the raw EDID data.
* len - The length of the EDID data in bytes
* panel - A user provided location to receive the panel data.
* selected - A user provided location to receive the selected video mode.
* fbinfo - Provides information about the pre-allocate framebuffer
* memory.
*
* Returned value:
* None. Always succeeds. The logic will fallback to VGA mode if no
* EDID data is provided or if there is no valid video mode in the EDID
* data.
*
****************************************************************************/
void am335x_lcd_edid(FAR const uint8_t *edid, size_t edid_len,
FAR struct am335x_panel_info_s *panel,
FAR struct edid_videomode_s *selected,
FAR const struct am335x_fbinfo_s *fbinfo);
/****************************************************************************
* Name: am335x_backlight
*
* Description:
* If CONFIG_AM335X_LCDC_BACKLIGHT is defined, then the board-specific
* logic must provide this interface to turn the backlight on and off.
*
* REVISIT: Current assumes a discrete ON/OFF control. Needs additional
* support for backlight level control.
*
****************************************************************************/
#ifdef CONFIG_AM335X_LCDC_BACKLIGHT
void am335x_backlight(bool blon);
#endif
#endif /* __ARCH_ARM_SRC_AM335X_AM335X_LCDC_H */
+2 -2
View File
@@ -175,8 +175,8 @@
#define LCD_RASTER_CTRL_REQDLY_MASK (255 << LCD_RASTER_CTRL_REQDLY_SHIFT)
#define LCD_RASTER_CTRL_PALMODE_SHIFT (20) /* Bits 20-21: Palette Loading Mode */
#define LCD_RASTER_CTRL_PALMODE_MASK (3 << LCD_RASTER_CTRL_PALMODE_SHIFT)
# define LCD_RASTER_CTRL_PALLET_DATA (0 << LCD_RASTER_CTRL_PALMODE_SHIFT) /* Palette and data loading */
# define LCD_RASTER_CTRL_PALLET (1 << LCD_RASTER_CTRL_PALMODE_SHIFT) /* Palette loading only */
# define LCD_RASTER_CTRL_PALETTE_DATA (0 << LCD_RASTER_CTRL_PALMODE_SHIFT) /* Palette and data loading */
# define LCD_RASTER_CTRL_PALETTE (1 << LCD_RASTER_CTRL_PALMODE_SHIFT) /* Palette loading only */
# define LCD_RASTER_CTRL_DATA (2 << LCD_RASTER_CTRL_PALMODE_SHIFT) /* Data loading only For Raw Data (12/16/24 bpp) framebuffers, no palette lookup is employed */
#define LCD_RASTER_CTRL_NIB_MODE (1 << 22) /* Bit 22: Nibble Mode */
#define LCD_RASTER_CTRL_TFT_MAP (1 << 23) /* Bit 23: TFT Mode Alternate Signal Mapping for Palettized framebuffer */