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
+1
View File
@@ -98,6 +98,7 @@ config AM335X_LCDC
bool "LCD controller" bool "LCD controller"
default n default n
depends on VIDEO && EXPERIMENTAL depends on VIDEO && EXPERIMENTAL
select LCD
select VIDEO_EDID select VIDEO_EDID
config AM335X_TSC config AM335X_TSC
+10
View File
@@ -4,4 +4,14 @@
# #
if ARCH_BOARD_BEAGLEBONE_BLACK 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 endif # ARCH_BOARD_BEAGLEBONE_BLACK
+1 -1
View File
@@ -51,7 +51,7 @@ CSRCS += am335x_buttons.c
endif endif
ifeq ($(CONFIG_AM335X_LCDC),y) ifeq ($(CONFIG_AM335X_LCDC),y)
CSRCS += am335x_lcdc.c CSRCS += am335x_lcd.c
endif endif
include $(TOPDIR)/configs/Board.mk include $(TOPDIR)/configs/Board.mk
+56 -3
View File
@@ -42,12 +42,13 @@
#include <stdint.h> #include <stdint.h>
#include <assert.h> #include <assert.h>
#include <errno.h> #include <errno.h>
#include <debug.h>
#include <nuttx/lcd/tda19988.h> #include <nuttx/lcd/tda19988.h>
#include <nuttx/video/fb.h> #include <nuttx/video/fb.h>
#include <nuttx/video/edid.h> #include <nuttx/video/edid.h>
#include "am335x_lcd.h" #include "am335x_lcdc.h"
#include "beaglebone-black.h" #include "beaglebone-black.h"
#ifdef HAVE_LCD #ifdef HAVE_LCD
@@ -56,15 +57,19 @@
* Private Function Prototypes * Private Function Prototypes
****************************************************************************/ ****************************************************************************/
#ifdef HAVE_TDA19988
static int am335x_attach(const struct tda19988_lower_s *lower, static int am335x_attach(const struct tda19988_lower_s *lower,
xcpt_t handler, void *arg); xcpt_t handler, void *arg);
static int am335x_enable(const struct tda19988_lower_s *lower, bool enable); static int am335x_enable(const struct tda19988_lower_s *lower, bool enable);
#endif
/**************************************************************************** /****************************************************************************
* Private Data * Private Data
****************************************************************************/ ****************************************************************************/
#ifdef HAVE_TDA19988
static const strurct tda19988_lower_s g_lower; static const strurct tda19988_lower_s g_lower;
#endif
/**************************************************************************** /****************************************************************************
* Private Functions * 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, static int am335x_attach(const struct tda19988_lower_s *lower,
xcpt_t handler, void *arg) xcpt_t handler, void *arg)
{ {
#warning Missing logic
return -ENOSYS;
} }
#endif
/**************************************************************************** /****************************************************************************
* Name: am335x_enable * 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) static int am335x_enable(const struct tda19988_lower_s *lower, bool enable)
{ {
#warning Missing logic
return -ENOSYS;
} }
#endif
/**************************************************************************** /****************************************************************************
* Public Functions * Public Functions
@@ -103,7 +116,8 @@ static int am335x_enable(const struct tda19988_lower_s *lower, bool enable)
* Name: up_fbinitialize * Name: up_fbinitialize
* *
* Description: * 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 * 1. Initializing the TDA19988 HDMI controller driver
* 2. Reading EDID data from the connected monitor * 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 * 4. Initializing the LCD controller using this video mode
* 5. Initializing the HDMI controller using the 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 GPIO interrupt input */
/* Initialize the TDA19988 lower half state instance */ /* Initialize the TDA19988 lower half state instance */
/* Initialize the TDA19988 HDMI controller driver */ /* Initialize the TDA19988 HDMI controller driver */
@@ -122,10 +144,41 @@ void up_fbinitialize(int display)
/* Read raw EDID data from the connected monitor */ /* Read raw EDID data from the connected monitor */
/* Select a compatible video mode from the EDID data */ /* Select a compatible video mode from the EDID data */
/* Free the allocated EDID buffer */ /* 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 */ /* Convert the video mode to a AM335X LCD panel configuration */
am335x_lcd_videomode(videomode, &panel);
/* Initialize the LCD controller using this video mode */ /* 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 */ /* Convert the EDID video mode to a TDA19988 video mode */
/* Initialize the HDMI controller using the TDA19988 video mode */ /* Initialize the HDMI controller using the TDA19988 video mode */
#warning Missing logic
#endif
return OK;
} }
#endif /* HAVE_LCD */ #endif /* HAVE_LCD */
@@ -56,16 +56,25 @@
/* LCD ******************************************************************************/ /* LCD ******************************************************************************/
#define HAVE_LCD 1 #define HAVE_LCD 1
#if !defined(CONFIG_AM335X_LCDC) || !defined(CONFIG_VIDEO_EDID) || \ #define HAVE_TDA19988 1
!defined(CONFIG_LCD_TDA19988) || !defined(CONFIG_AM335X_I2C2)
#if !defined(CONFIG_AM335X_LCDC) || !defined(CONFIG_VIDEO_EDID)
# undef HAVE_LCD # 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 #endif
#define TDA19988_I2CBUS 2 #if defined(HAVE_LCD)
#define TDA19988_HDMI_I2CADDR 0x70 # define TDA19988_I2CBUS 2
#define TDA19988_CEC_I2CADDR 0x34 # define TDA19988_HDMI_I2CADDR 0x70
#define TDA19988_I2CFREQUENCY 400000 # define TDA19988_CEC_I2CADDR 0x34
# define TDA19988_I2CFREQUENCY 400000
#endif
/* LEDs *****************************************************************************/ /* LEDs *****************************************************************************/
+4 -3
View File
@@ -384,10 +384,11 @@ Configuration Subdirectories
You can debug the all RAM version using ZDS-II as follows: You can debug the all RAM version using ZDS-II as follows:
a. Connect to the debugger, 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 c. Set the PC to 0x040000
d. Single step a few times to make sure things look good, then d. Single step a few times to make sure things look good, then
e. "GO" e. Go
5. Optimizations: 5. Optimizations:
@@ -415,7 +416,7 @@ Configuration Subdirectories
configuration. Not yet verified. configuration. Not yet verified.
2019-07-09: The RAM version does not run! I can single step through 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 crashes. The PC is sitting at a crazy address when I break in. I
have not yet debugged this. have not yet debugged this.