LK: Add support for splash screen on MSM7627_SURF
Moving lcdc.c file from qsd8k and msm7x30 to msm_shared under platform
directory.
diff --git a/app/aboot/aboot.c b/app/aboot/aboot.c
index 6abe321..cbdc64a 100755
--- a/app/aboot/aboot.c
+++ b/app/aboot/aboot.c
@@ -2,7 +2,7 @@
* Copyright (c) 2009, Google Inc.
* All rights reserved.
*
- * Copyright (c) 2009, Code Aurora Forum. All rights reserved.
+ * Copyright (c) 2009-2010, Code Aurora Forum. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@@ -41,6 +41,7 @@
#include <dev/flash.h>
#include <lib/ptable.h>
#include <dev/keys.h>
+#include <dev/fbcon.h>
#include "bootimg.h"
#include "fastboot.h"
@@ -187,7 +188,7 @@
struct ptable *ptable;
unsigned offset = 0;
const char *cmdline;
-
+ struct fbcon_config *fb_display = NULL;
if (target_is_emmc_boot()) {
hdr = (struct boot_img_hdr *)EMMC_BOOT_IMG_HEADER_ADDR;
@@ -204,6 +205,22 @@
return -1;
}
+#if DISPLAY_SPLASH_SCREEN
+ ptn = ptable_find(ptable, "splash");
+ if (ptn == NULL) {
+ dprintf(CRITICAL, "ERROR: No splash partition found\n");
+ } else {
+ fb_display = fbcon_display();
+ if (fb_display) {
+ if (flash_read(ptn, 0, fb_display->base,
+ (fb_display->width * fb_display->height * fb_display->bpp/8))) {
+ fbcon_clear();
+ dprintf(CRITICAL, "ERROR: Cannot read splash image\n");
+ }
+ }
+ }
+#endif
+
if(!boot_into_recovery)
{
ptn = ptable_find(ptable, "boot");
@@ -397,7 +414,13 @@
void aboot_init(const struct app_descriptor *app)
{
- unsigned reboot_mode = 0;
+ unsigned reboot_mode = 0;
+ unsigned disp_init = 0;
+ #if DISPLAY_SPLASH_SCREEN
+ display_init();
+ dprintf(INFO, "Diplay initialized\n");
+ disp_init = 1;
+ #endif
page_size = flash_page_size();
page_mask = page_size - 1;
if (keys_get_state(KEY_HOME) != 0)
@@ -419,7 +442,11 @@
"to fastboot mode.\n");
fastboot:
- display_init();
+ if(!disp_init) {
+ display_init();
+ } else {
+ fbcon_clear();
+ }
dprintf(INFO, "Diplay initialized\n");
udc_init(&surf_udc_device);
diff --git a/dev/fbcon/fbcon.c b/dev/fbcon/fbcon.c
index abe1c79..5aadb1f 100644
--- a/dev/fbcon/fbcon.c
+++ b/dev/fbcon/fbcon.c
@@ -2,6 +2,8 @@
* Copyright (c) 2008, Google Inc.
* All rights reserved.
*
+ * Copyright (c) 2009-2010, Code Aurora Forum. All rights reserved.
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -109,7 +111,7 @@
}
/* TODO: take stride into account */
-static void fbcon_clear(void)
+void fbcon_clear(void)
{
uint16_t *dst = config->base;
unsigned count = config->width * config->height;
@@ -197,3 +199,8 @@
max_pos.x = config->width / (FONT_WIDTH+1);
max_pos.y = (config->height - 1) / FONT_HEIGHT;
}
+
+struct fbcon_config* fbcon_display(void)
+{
+ return config;
+}
diff --git a/include/dev/fbcon.h b/include/dev/fbcon.h
index 49d73b5..e7121f5 100644
--- a/include/dev/fbcon.h
+++ b/include/dev/fbcon.h
@@ -2,6 +2,8 @@
* Copyright (c) 2008, Google Inc.
* All rights reserved.
*
+ * Copyright (c) 2009-2010, Code Aurora Forum. All rights reserved.
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -45,5 +47,7 @@
void fbcon_setup(struct fbcon_config *cfg);
void fbcon_putc(char c);
+void fbcon_clear(void);
+struct fbcon_config* fbcon_display(void);
#endif /* __DEV_FBCON_H */
diff --git a/platform/msm7k/platform.c b/platform/msm7k/platform.c
index ded9cca..409af52 100755
--- a/platform/msm7k/platform.c
+++ b/platform/msm7k/platform.c
@@ -2,6 +2,8 @@
* Copyright (c) 2008, Google Inc.
* All rights reserved.
*
+ * Copyright (c) 2009-2010, Code Aurora Forum. All rights reserved.
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -71,4 +73,9 @@
ASSERT(fb_config);
fbcon_setup(fb_config);
#endif
+#if DISPLAY_TYPE_LCDC
+ fb_config = lcdc_init();
+ ASSERT(fb_config);
+ fbcon_setup(fb_config);
+#endif
}
diff --git a/platform/msm7x30/rules.mk b/platform/msm7x30/rules.mk
index 237c469..7a1d434 100644
--- a/platform/msm7x30/rules.mk
+++ b/platform/msm7x30/rules.mk
@@ -17,8 +17,7 @@
$(LOCAL_DIR)/platform.o \
$(LOCAL_DIR)/interrupts.o \
$(LOCAL_DIR)/gpio.o \
- $(LOCAL_DIR)/acpuclock.o \
- $(LOCAL_DIR)/lcdc.o
+ $(LOCAL_DIR)/acpuclock.o
LINKER_SCRIPT += $(BUILDDIR)/system-onesegment.ld
diff --git a/platform/msm7x30/lcdc.c b/platform/msm_shared/lcdc.c
old mode 100644
new mode 100755
similarity index 99%
rename from platform/msm7x30/lcdc.c
rename to platform/msm_shared/lcdc.c
index 29152d3..9970923
--- a/platform/msm7x30/lcdc.c
+++ b/platform/msm_shared/lcdc.c
@@ -140,3 +140,4 @@
return &fb_cfg;
}
+
diff --git a/platform/msm_shared/rules.mk b/platform/msm_shared/rules.mk
old mode 100644
new mode 100755
index d856dfa..7e48af7
--- a/platform/msm_shared/rules.mk
+++ b/platform/msm_shared/rules.mk
@@ -13,5 +13,6 @@
$(LOCAL_DIR)/hsusb.o \
$(LOCAL_DIR)/jtag_hook.o \
$(LOCAL_DIR)/jtag.o \
- $(LOCAL_DIR)/nand.o
+ $(LOCAL_DIR)/nand.o \
+ $(LOCAL_DIR)/lcdc.o
diff --git a/platform/qsd8k/lcdc.c b/platform/qsd8k/lcdc.c
deleted file mode 100644
index 29152d3..0000000
--- a/platform/qsd8k/lcdc.c
+++ /dev/null
@@ -1,142 +0,0 @@
-/*
- * Copyright (c) 2008, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- *
- * 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.
- */
-
-#include <debug.h>
-#include <stdlib.h>
-#include <reg.h>
-#include <platform/iomap.h>
-#include <dev/fbcon.h>
-
-#define MSM_MDP_BASE1 0xAA200000
-
-#define LCDC_PIXCLK_IN_PS 26
-#define LCDC_FB_PHYS 0x16600000
-#define LCDC_FB_BPP 16
-
-#if 1
-/* SURF */
-#define LCDC_FB_WIDTH 800
-#define LCDC_FB_HEIGHT 480
-
-#define LCDC_HSYNC_PULSE_WIDTH_DCLK 60
-#define LCDC_HSYNC_BACK_PORCH_DCLK 81
-#define LCDC_HSYNC_FRONT_PORCH_DCLK 81
-#define LCDC_HSYNC_SKEW_DCLK 0
-
-#define LCDC_VSYNC_PULSE_WIDTH_LINES 2
-#define LCDC_VSYNC_BACK_PORCH_LINES 20
-#define LCDC_VSYNC_FRONT_PORCH_LINES 27
-
-#else
-/* FFA */
-#define LCDC_FB_WIDTH 480
-#define LCDC_FB_HEIGHT 640
-
-#define LCDC_HSYNC_PULSE_WIDTH_DCLK 60
-#define LCDC_HSYNC_BACK_PORCH_DCLK 144
-#define LCDC_HSYNC_FRONT_PORCH_DCLK 33
-#define LCDC_HSYNC_SKEW_DCLK 0
-
-#define LCDC_VSYNC_PULSE_WIDTH_LINES 2
-#define LCDC_VSYNC_BACK_PORCH_LINES 2
-#define LCDC_VSYNC_FRONT_PORCH_LINES 2
-
-#endif
-
-#define BIT(x) (1<<(x))
-#define DMA_DSTC0G_8BITS (BIT(1)|BIT(0))
-#define DMA_DSTC1B_8BITS (BIT(3)|BIT(2))
-#define DMA_DSTC2R_8BITS (BIT(5)|BIT(4))
-#define CLR_G 0x0
-#define CLR_B 0x1
-#define CLR_R 0x2
-#define MDP_GET_PACK_PATTERN(a,x,y,z,bit) (((a)<<(bit*3))|((x)<<(bit*2))|((y)<<bit)|(z))
-#define DMA_PACK_ALIGN_LSB 0
-#define DMA_PACK_PATTERN_RGB \
- (MDP_GET_PACK_PATTERN(0,CLR_R,CLR_G,CLR_B,2)<<8)
-#define DMA_DITHER_EN BIT(24)
-#define DMA_OUT_SEL_LCDC BIT(20)
-#define DMA_IBUF_FORMAT_RGB565 BIT(25)
-
-static struct fbcon_config fb_cfg = {
- .height = LCDC_FB_HEIGHT,
- .width = LCDC_FB_WIDTH,
- .stride = LCDC_FB_WIDTH,
- .format = FB_FORMAT_RGB565,
- .bpp = LCDC_FB_BPP,
- .update_start = NULL,
- .update_done = NULL,
-};
-
-void lcdc_clock_init(unsigned rate);
-
-struct fbcon_config *lcdc_init(void)
-{
- dprintf(INFO, "lcdc_init(): panel is %d x %d\n", fb_cfg.width, fb_cfg.height);
-
- fb_cfg.base =
- memalign(4096, fb_cfg.width * fb_cfg.height * (fb_cfg.bpp / 8));
-
- lcdc_clock_init(1000000000 / LCDC_PIXCLK_IN_PS);
-
- writel((unsigned) fb_cfg.base, MSM_MDP_BASE1 + 0x90008);
-
- writel((fb_cfg.height << 16) | fb_cfg.width, MSM_MDP_BASE1 + 0x90004);
- writel(fb_cfg.width * fb_cfg.bpp / 8, MSM_MDP_BASE1 + 0x9000c);
- writel(0, MSM_MDP_BASE1 + 0x90010);
-
- writel(DMA_PACK_ALIGN_LSB|DMA_PACK_PATTERN_RGB|DMA_DITHER_EN|DMA_OUT_SEL_LCDC|
- DMA_IBUF_FORMAT_RGB565|DMA_DSTC0G_8BITS|DMA_DSTC1B_8BITS|DMA_DSTC2R_8BITS,
- MSM_MDP_BASE1 + 0x90000);
-
- int hsync_period = LCDC_HSYNC_PULSE_WIDTH_DCLK + LCDC_HSYNC_BACK_PORCH_DCLK + fb_cfg.width + LCDC_HSYNC_FRONT_PORCH_DCLK;
- int vsync_period = (LCDC_VSYNC_PULSE_WIDTH_LINES + LCDC_VSYNC_BACK_PORCH_LINES + fb_cfg.height + LCDC_VSYNC_FRONT_PORCH_LINES) * hsync_period;
- int hsync_start_x = LCDC_HSYNC_PULSE_WIDTH_DCLK + LCDC_HSYNC_BACK_PORCH_DCLK;
- int hsync_end_x = hsync_period - LCDC_HSYNC_FRONT_PORCH_DCLK - 1;
- int display_hctl = (hsync_end_x << 16) | hsync_start_x;
- int display_vstart= (LCDC_VSYNC_PULSE_WIDTH_LINES + LCDC_VSYNC_BACK_PORCH_LINES) * hsync_period + LCDC_HSYNC_SKEW_DCLK;
- int display_vend = vsync_period - (LCDC_VSYNC_FRONT_PORCH_LINES * hsync_period) + LCDC_HSYNC_SKEW_DCLK - 1;
-
- writel((hsync_period << 16) | LCDC_HSYNC_PULSE_WIDTH_DCLK, MSM_MDP_BASE1 + 0xe0004);
- writel(vsync_period, MSM_MDP_BASE1 + 0xe0008);
- writel(LCDC_VSYNC_PULSE_WIDTH_LINES * hsync_period, MSM_MDP_BASE1 + 0xe000c);
- writel(display_hctl, MSM_MDP_BASE1 + 0xe0010);
- writel(display_vstart, MSM_MDP_BASE1 + 0xe0014);
- writel(display_vend, MSM_MDP_BASE1 + 0xe0018);
- writel(0, MSM_MDP_BASE1 + 0xe0028);
- writel(0xff, MSM_MDP_BASE1 + 0xe002c);
- writel(LCDC_HSYNC_SKEW_DCLK, MSM_MDP_BASE1 + 0xe0030);
- writel(0, MSM_MDP_BASE1 + 0xe0038);
- writel(0, MSM_MDP_BASE1 + 0xe001c);
- writel(0, MSM_MDP_BASE1 + 0xe0020);
- writel(0, MSM_MDP_BASE1 + 0xe0024);
-
- writel(1, MSM_MDP_BASE1 + 0xe0000);
-
- return &fb_cfg;
-}
diff --git a/platform/qsd8k/rules.mk b/platform/qsd8k/rules.mk
index 237c469..7a1d434 100644
--- a/platform/qsd8k/rules.mk
+++ b/platform/qsd8k/rules.mk
@@ -17,8 +17,7 @@
$(LOCAL_DIR)/platform.o \
$(LOCAL_DIR)/interrupts.o \
$(LOCAL_DIR)/gpio.o \
- $(LOCAL_DIR)/acpuclock.o \
- $(LOCAL_DIR)/lcdc.o
+ $(LOCAL_DIR)/acpuclock.o
LINKER_SCRIPT += $(BUILDDIR)/system-onesegment.ld
diff --git a/project/msm7627_surf.mk b/project/msm7627_surf.mk
index 59f98ed..0b98025 100644
--- a/project/msm7627_surf.mk
+++ b/project/msm7627_surf.mk
@@ -8,4 +8,4 @@
#DEFINES += WITH_DEBUG_DCC=1
#DEFINES += WITH_DEBUG_UART=1
-#DEFINES += WITH_DEBUG_FBCON=1
\ No newline at end of file
+DEFINES += WITH_DEBUG_FBCON=1
diff --git a/target/msm7627_surf/init.c b/target/msm7627_surf/init.c
index c62a6b3..f1cb0b2 100644
--- a/target/msm7627_surf/init.c
+++ b/target/msm7627_surf/init.c
@@ -1,7 +1,7 @@
/*
* Copyright (c) 2009, Google Inc.
* All rights reserved.
- * Copyright (c) 2009, Code Aurora Forum. All rights reserved.
+ * Copyright (c) 2009-2010, Code Aurora Forum. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -65,12 +65,17 @@
.name = "system",
},
{
- .start = 720,
+ .start = 720,
+ .length = 8,
+ .name = "splash",
+ },
+ {
+ .start = 728,
.length = 40 /* 5MB */,
.name = "cache",
},
{
- .start = 760,
+ .start = 768,
.length = VARIABLE_LENGTH,
.name = "userdata",
},
diff --git a/target/msm7627_surf/rules.mk b/target/msm7627_surf/rules.mk
index c473d06..b62c420 100644
--- a/target/msm7627_surf/rules.mk
+++ b/target/msm7627_surf/rules.mk
@@ -17,6 +17,8 @@
KEYS_USE_GPIO_KEYPAD := 1
DEFINES += DISPLAY_TYPE_MDDI=0
+DEFINES += DISPLAY_TYPE_LCDC=1
+DEFINES += DISPLAY_SPLASH_SCREEN=0
MODULES += \
dev/keys \