Skip to content
Snippets Groups Projects
Commit f32b8ab1 authored by minute's avatar minute
Browse files

Expose LCDIF as simple-framebuffer to pass to OSes


I didn't author this patch, just committing it. See below.

Co-authored-by: default avatarPatrick Wildt <patrick@blueri.se>
parent b2ca89ab
No related branches found
No related tags found
No related merge requests found
Pipeline #850 passed
......@@ -862,10 +862,11 @@ backlighton(void)
gpio_direction_output(IMX_GPIO_NR(1, 10), 1);
}
struct graphic_device imx_lcdif;
void*
video_hw_init(void)
{
static struct graphic_device lcdif;
struct dsi_cfg dsi_cfg;
struct video_mode mode;
char *err;
......@@ -944,25 +945,25 @@ video_hw_init(void)
goto out;
/* fill in Graphic device struct */
sprintf(lcdif.modeIdent, "%dx%dx%d", mode.hactive, mode.vactive, 24);
lcdif.winSizeX = mode.hactive;
lcdif.winSizeY = mode.vactive;
lcdif.plnSizeX = mode.hactive;
lcdif.plnSizeY = mode.vactive;
lcdif.gdfBytesPP = 4;
lcdif.gdfIndex = GDF_32BIT_X888RGB;
lcdif.memSize = lcdif.plnSizeX * lcdif.plnSizeY * lcdif.gdfBytesPP;
sprintf(imx_lcdif.modeIdent, "%dx%dx%d", mode.hactive, mode.vactive, 24);
imx_lcdif.winSizeX = mode.hactive;
imx_lcdif.winSizeY = mode.vactive;
imx_lcdif.plnSizeX = mode.hactive;
imx_lcdif.plnSizeY = mode.vactive;
imx_lcdif.gdfBytesPP = 4;
imx_lcdif.gdfIndex = GDF_32BIT_X888RGB;
imx_lcdif.memSize = imx_lcdif.plnSizeX * imx_lcdif.plnSizeY * imx_lcdif.gdfBytesPP;
fb = (void*)gd->fb_base;
if(fb == NULL) {
fb = memalign(0x10000, roundup(lcdif.memSize, 0x10000));
fb = memalign(0x10000, roundup(imx_lcdif.memSize, 0x10000));
if(fb == NULL){
err = "no memory for framebuffer";
goto out;
}
gd->fb_base = (uintptr_t)fb;
}
lcdif.frameAdrs = (uintptr_t)fb;
imx_lcdif.frameAdrs = (uintptr_t)fb;
/* start the pixel clock: SYSTEM_PLL1_CLK, 114Mz */
clock_set_target_val(LCDIF_PIXEL_CLK_ROOT, CLK_ROOT_ON | CLK_ROOT_SOURCE_SEL(4) | CLK_ROOT_PRE_DIV(CLK_ROOT_PRE_DIV7));
......@@ -978,7 +979,7 @@ video_hw_init(void)
/* send the pixels */
lcdifinit(&mode, (u32)(unsigned long long)fb);
return &lcdif;
return &imx_lcdif;
out:
printf("lcdif: video_hw_init(): %s\n", err);
......
......@@ -150,8 +150,40 @@ int dram_init(void)
}
#ifdef CONFIG_OF_BOARD_SETUP
extern struct graphic_device imx_lcdif;
int lcd_dt_simplefb_add_node(void *blob)
{
static const char compat[] = "simple-framebuffer";
static const char disabled[] = "disabled";
int off, ret;
off = fdt_add_subnode(blob, 0, "framebuffer");
if (off < 0)
return -1;
ret = fdt_setprop(blob, off, "status", disabled, sizeof(disabled));
if (ret < 0)
return -1;
ret = fdt_setprop(blob, off, "compatible", compat, sizeof(compat));
if (ret < 0)
return -1;
return fdt_setup_simplefb_node(blob, off, gd->fb_base, imx_lcdif.winSizeX,
imx_lcdif.winSizeY, imx_lcdif.winSizeX * imx_lcdif.gdfBytesPP,
"x8r8g8b8");
}
int ft_board_setup(void *blob, bd_t *bd)
{
/*
* For now, we simply always add the simplefb DT node. Later, we
* should be more intelligent, and e.g. only do this if no enabled DT
* node exists for the "real" graphics driver.
*/
lcd_dt_simplefb_add_node(blob);
return 0;
}
#endif
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment