configs/beaglebone-black/src/am335x_lcd.c: Can't use TDA19988 yet because there is no I2C driver. In the mean time, support LCD initialization using a fixed, configurable video mode.

This commit is contained in:
Gregory Nutt 2019-07-09 13:43:04 -06:00
parent c100f7ec7f
commit 8be74cdc48
6 changed files with 88 additions and 14 deletions

View File

@ -98,6 +98,7 @@ config AM335X_LCDC
bool "LCD controller"
default n
depends on VIDEO && EXPERIMENTAL
select LCD
select VIDEO_EDID
config AM335X_TSC

View File

@ -4,4 +4,14 @@
#
if ARCH_BOARD_BEAGLEBONE_BLACK
config BEAGLEBONE_VIDEOMODE
string "LCD Video Mode"
default "640x480x60"
depends on !CONFIG_LCD_TDA19988 || !CONFIG_AM335X_I2C2
---help---
If we are not using HDMI (via the TDA19988) then we must select a
fixed LCD resolution. The default, "640x480x60" is standard VGA
which should be supported by all LCDs.
endif # ARCH_BOARD_BEAGLEBONE_BLACK

View File

@ -51,7 +51,7 @@ CSRCS += am335x_buttons.c
endif
ifeq ($(CONFIG_AM335X_LCDC),y)
CSRCS += am335x_lcdc.c
CSRCS += am335x_lcd.c
endif
include $(TOPDIR)/configs/Board.mk

View File

@ -42,12 +42,13 @@
#include <stdint.h>
#include <assert.h>
#include <errno.h>
#include <debug.h>
#include <nuttx/lcd/tda19988.h>
#include <nuttx/video/fb.h>
#include <nuttx/video/edid.h>
#include "am335x_lcd.h"
#include "am335x_lcdc.h"
#include "beaglebone-black.h"
#ifdef HAVE_LCD
@ -56,15 +57,19 @@
* Private Function Prototypes
****************************************************************************/
#ifdef HAVE_TDA19988
static int am335x_attach(const struct tda19988_lower_s *lower,
xcpt_t handler, void *arg);
static int am335x_enable(const struct tda19988_lower_s *lower, bool enable);
#endif
/****************************************************************************
* Private Data
****************************************************************************/
#ifdef HAVE_TDA19988
static const strurct tda19988_lower_s g_lower;
#endif
/****************************************************************************
* Private Functions
@ -78,10 +83,14 @@ static const strurct tda19988_lower_s g_lower;
*
****************************************************************************/
#ifdef HAVE_TDA19988
static int am335x_attach(const struct tda19988_lower_s *lower,
xcpt_t handler, void *arg)
{
#warning Missing logic
return -ENOSYS;
}
#endif
/****************************************************************************
* Name: am335x_enable
@ -91,9 +100,13 @@ static int am335x_attach(const struct tda19988_lower_s *lower,
*
****************************************************************************/
#ifdef HAVE_TDA19988
static int am335x_enable(const struct tda19988_lower_s *lower, bool enable)
{
#warning Missing logic
return -ENOSYS;
}
#endif
/****************************************************************************
* Public Functions
@ -103,7 +116,8 @@ static int am335x_enable(const struct tda19988_lower_s *lower, bool enable)
* Name: up_fbinitialize
*
* Description:
* Initialize the LCD. This involves:
* Initialize the LCD. If support for the TDA19988 HDMI controller is
* enabled, then this involves:
*
* 1. Initializing the TDA19988 HDMI controller driver
* 2. Reading EDID data from the connected monitor
@ -111,10 +125,18 @@ static int am335x_enable(const struct tda19988_lower_s *lower, bool enable)
* 4. Initializing the LCD controller using this video mode
* 5. Initializing the HDMI controller using the video mode
*
* Otherwise, a default video mode is used to initialize the LCD
* controller.
*
****************************************************************************/
void up_fbinitialize(int display)
int up_fbinitialize(int display)
{
FAR const struct edid_videomode_s *videomode;
struct am335x_panel_info_s panel;
int ret;
#ifdef HAVE_TDA19988
/* Initialize the TDA19988 GPIO interrupt input */
/* Initialize the TDA19988 lower half state instance */
/* Initialize the TDA19988 HDMI controller driver */
@ -122,10 +144,41 @@ void up_fbinitialize(int display)
/* Read raw EDID data from the connected monitor */
/* Select a compatible video mode from the EDID data */
/* Free the allocated EDID buffer */
#warning Missing logic
#else
/* Lookup the video mode corresponding to the default video mode */
videomode = edid_mode_lookup(CONFIG_BEAGLEBONE_VIDEOMODE);
if (videomode == NULL)
{
lcderr("ERROR: Videomode \"%s\" is not supported.\n",
CONFIG_BEAGLEBONE_VIDEOMODE);
return -ENOTSUP;
}
#endif
/* Convert the video mode to a AM335X LCD panel configuration */
am335x_lcd_videomode(videomode, &panel);
/* Initialize the LCD controller using this video mode */
ret = am335x_lcd_initialize(&panel);
if (ret < 0)
{
lcderr("ERROR: am335x_lcd_initialize() failed: %d\n", ret);
return ret;
}
#ifdef HAVE_TDA19988
/* Convert the EDID video mode to a TDA19988 video mode */
/* Initialize the HDMI controller using the TDA19988 video mode */
#warning Missing logic
#endif
return OK;
}
#endif /* HAVE_LCD */

View File

@ -56,16 +56,25 @@
/* LCD ******************************************************************************/
#define HAVE_LCD 1
#if !defined(CONFIG_AM335X_LCDC) || !defined(CONFIG_VIDEO_EDID) || \
!defined(CONFIG_LCD_TDA19988) || !defined(CONFIG_AM335X_I2C2)
#define HAVE_LCD 1
#define HAVE_TDA19988 1
#if !defined(CONFIG_AM335X_LCDC) || !defined(CONFIG_VIDEO_EDID)
# undef HAVE_LCD
# undef HAVE_TDA19988
#elif !defined(CONFIG_LCD_TDA19988) || !defined(CONFIG_AM335X_I2C2)
# undef HAVE_TDA19988
# if !defined(CONFIG_BEAGLEBONE_VIDEOMODE)
# define CONFIG_BEAGLEBONE_VIDEOMODE "640x480x60"
# endif
#endif
#define TDA19988_I2CBUS 2
#define TDA19988_HDMI_I2CADDR 0x70
#define TDA19988_CEC_I2CADDR 0x34
#define TDA19988_I2CFREQUENCY 400000
#if defined(HAVE_LCD)
# define TDA19988_I2CBUS 2
# define TDA19988_HDMI_I2CADDR 0x70
# define TDA19988_CEC_I2CADDR 0x34
# define TDA19988_I2CFREQUENCY 400000
#endif
/* LEDs *****************************************************************************/

View File

@ -384,10 +384,11 @@ Configuration Subdirectories
You can debug the all RAM version using ZDS-II as follows:
a. Connect to the debugger,
b. Load the nuttx.lod file
b. Reset, Go, and Break. This will initialize the external RAM
c. Break and Load the nuttx.lod file
c. Set the PC to 0x040000
d. Single step a few times to make sure things look good, then
e. "GO"
e. Go
5. Optimizations:
@ -415,7 +416,7 @@ Configuration Subdirectories
configuration. Not yet verified.
2019-07-09: The RAM version does not run! I can single step through
the initialization and all looks well, but when I "GO", the system
the initialization and all looks well, but when I "Go", the system
crashes. The PC is sitting at a crazy address when I break in. I
have not yet debugged this.