Skip to content

Commit

Permalink
sunxi-disp: Fb_Init: don't assume the lcd driver is always loaded first
Browse files Browse the repository at this point in the history
Currently the sunxi-disp code depends on the lcd driver always being
loaded first, which is not a good idea. This fixes this. With this it
should be safe to simply build the disp, hdmi and lcd driver into the
kernel (worksforme).

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
  • Loading branch information
jwrdegoede authored and amery committed Jan 3, 2013
1 parent 73818d4 commit 199825c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
11 changes: 9 additions & 2 deletions drivers/video/sunxi/disp/dev_fb.c
Original file line number Diff line number Diff line change
Expand Up @@ -1560,10 +1560,13 @@ __s32 Fb_Init(__u32 from)
__disp_fb_create_para_t fb_para = {
.primary_screen_id = 0,
};
static DEFINE_MUTEX(fb_init_mutex);
static bool first_time = true;

__inf("Fb_Init:%d\n", from);
mutex_lock(&fb_init_mutex);
if (first_time) { /* First call ? */
DRV_DISP_Init();

if (from == 0) { /* call from lcd driver */
#ifdef CONFIG_FB_SUNXI_RESERVED_MEM
__inf("fbmem: fb_start=%lu, fb_size=%lu\n", fb_start, fb_size);
disp_create_heap((unsigned long)(__va(fb_start)), fb_size);
Expand Down Expand Up @@ -1616,7 +1619,9 @@ __s32 Fb_Init(__u32 from)
return -ENOMEM;
}
parser_disp_init_para(&(g_fbi.disp_init));
first_time = false;
}
mutex_unlock(&fb_init_mutex);

if (g_fbi.disp_init.b_init) {
__u32 sel = 0;
Expand All @@ -1633,6 +1638,8 @@ __s32 Fb_Init(__u32 from)
}
}

__inf("Fb_Init: %d %d\n", from, need_open_hdmi);

if (need_open_hdmi == 1 && from == 0)
/* it is called from lcd driver, but hdmi need to be opened */
return 0;
Expand Down
2 changes: 0 additions & 2 deletions drivers/video/sunxi/lcd/dev_lcd.c
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,6 @@ lcd_init(void)
LCD_get_panel_funs_1(&lcd1_cfg);
LCD_set_panel_funs(&lcd0_cfg, &lcd1_cfg);

DRV_DISP_Init();

Fb_Init(0);

return 0;
Expand Down

0 comments on commit 199825c

Please sign in to comment.