Skip to content
This repository was archived by the owner on Jan 8, 2025. It is now read-only.

Commit

Permalink
[msm]: Enable display driver by default for splash screen on 7627 & 8650
Browse files Browse the repository at this point in the history
If rgb565 image is available in splash partition then display it
as splash screen.

On Linux, splash.img can be created as follows:
convert -depth 8 splash.png rgb:- | out/host/linux-x86/bin/rgb2565  > splash.img

Change-Id: I24b61cbc94af4bac14b9a49b030b59484a0b283e
  • Loading branch information
Chandan Uddaraju authored and Ajay Dudani committed Jul 14, 2010
1 parent 5e856b5 commit 2943fd6
Show file tree
Hide file tree
Showing 37 changed files with 738 additions and 103 deletions.
69 changes: 41 additions & 28 deletions app/aboot/aboot.c
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,6 @@ int boot_linux_from_flash(void)
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;
Expand All @@ -295,22 +294,6 @@ int boot_linux_from_flash(void)
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");
Expand Down Expand Up @@ -535,17 +518,43 @@ void cmd_reboot_bootloader(const char *arg, void *data, unsigned sz)
reboot_device(FASTBOOT_MODE);
}

void splash_screen ()
{
struct ptentry *ptn;
struct ptable *ptable;
struct fbcon_config *fb_display = NULL;

if (!target_is_emmc_boot())
{
ptable = flash_get_ptable();
if (ptable == NULL) {
dprintf(CRITICAL, "ERROR: Partition table not found\n");
return -1;
}

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");
}
}
}
}
}

void aboot_init(const struct app_descriptor *app)
{
unsigned reboot_mode = 0;
unsigned disp_init = 0;
unsigned usb_init = 0;
#if DISPLAY_SPLASH_SCREEN
display_init();
dprintf(INFO, "Diplay initialized\n");
disp_init = 1;
#endif

/* Setup page size information for nand/emmc reads */
if (target_is_emmc_boot())
{
page_size = 2048;
Expand All @@ -557,6 +566,15 @@ void aboot_init(const struct app_descriptor *app)
page_mask = page_size - 1;
}

/* Display splash screen if enabled */
#if DISPLAY_SPLASH_SCREEN
display_init();
dprintf(INFO, "Diplay initialized\n");
disp_init = 1;
splash_screen();
#endif

/* Check if we should do something other than booting up */
if (keys_get_state(KEY_HOME) != 0)
boot_into_recovery = 1;
if (keys_get_state(KEY_BACK) != 0)
Expand Down Expand Up @@ -592,12 +610,7 @@ void aboot_init(const struct app_descriptor *app)
"to fastboot mode.\n");

fastboot:
if(!disp_init) {
display_init();
} else {
fbcon_clear();
}
dprintf(INFO, "Diplay initialized\n");

if(!usb_init)
udc_init(&surf_udc_device);

Expand Down
Empty file modified app/aboot/recovery.c
100755 → 100644
Empty file.
Empty file modified app/aboot/recovery.h
100755 → 100644
Empty file.
6 changes: 3 additions & 3 deletions dev/fbcon/fbcon.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ struct pos {

static struct fbcon_config *config = NULL;

#define RGB565_BLUE 0x001f
#define RGB565_BLACK 0x0000
#define RGB565_WHITE 0xffff

#define FONT_WIDTH 5
Expand Down Expand Up @@ -179,7 +179,7 @@ void fbcon_setup(struct fbcon_config *_config)

switch (config->format) {
case FB_FORMAT_RGB565:
bg = RGB565_BLUE;
bg = RGB565_BLACK;
fg = RGB565_WHITE;
break;

Expand All @@ -191,7 +191,7 @@ void fbcon_setup(struct fbcon_config *_config)

fbcon_set_colors(bg, fg);

fbcon_clear();
//fbcon_clear();
fbcon_flush();

cur_pos.x = 0;
Expand Down
2 changes: 1 addition & 1 deletion target/msm7627_ffa/panel.c → platform/msm7k/panel.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#include <debug.h>
#include <dev/gpio.h>
#include <kernel/thread.h>
#include <platform/mddi.h>
#include <mddi.h>

#define MDDI_CLIENT_CORE_BASE 0x108000
#define LCD_CONTROL_BLOCK_BASE 0x110000
Expand Down
2 changes: 1 addition & 1 deletion platform/msm7k/platform.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
#include <debug.h>
#include <kernel/thread.h>
#include <platform/debug.h>
#include <platform/mddi.h>
#include <mddi.h>
#include <dev/fbcon.h>

static struct fbcon_config *fb_config;
Expand Down
2 changes: 1 addition & 1 deletion platform/msm7k/rules.mk
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ MODULES += dev/fbcon
OBJS += \
$(LOCAL_DIR)/platform.o \
$(LOCAL_DIR)/interrupts.o \
$(LOCAL_DIR)/mddi.o \
$(LOCAL_DIR)/gpio.o \
$(LOCAL_DIR)/panel.o \
$(LOCAL_DIR)/acpuclock.o

LINKER_SCRIPT += $(BUILDDIR)/system-onesegment.ld
Expand Down
Empty file modified platform/msm_shared/hsusb.c
100755 → 100644
Empty file.
File renamed without changes.
2 changes: 0 additions & 2 deletions platform/msm_shared/lcdc.c
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,6 @@ struct fbcon_config *lcdc_init(void)
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);
Expand Down
88 changes: 66 additions & 22 deletions platform/msm7k/mddi.c → platform/msm_shared/mddi.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,16 @@
#include <string.h>
#include <dev/fbcon.h>
#include <kernel/thread.h>
#include <platform/iomap.h>
#include <platform/mddi.h>
#include <mddi.h>
#include <target/display.h>

#include "mddi_hw.h"

static mddi_llentry *mlist = NULL;
static mddi_llentry *mlist_remote_write = NULL;

#define MDDI_MAX_REV_PKT_SIZE 0x60
#define MDDI_REV_PKT_BUF_SIZE (MDDI_MAX_REV_PKT_SIZE * 4)
#define MDDI_REV_PKT_BUF_SIZE 256
static void *rev_pkt_buf;

/* functions provided by the target specific panel code */
Expand Down Expand Up @@ -140,6 +140,8 @@ static void mddi_init_rev_encap(void)
memset(rev_pkt_buf, 0xee, MDDI_REV_PKT_BUF_SIZE);
writel((unsigned) rev_pkt_buf, MDDI_REV_PTR);
writel((unsigned) rev_pkt_buf, MDDI_REV_PTR);
writel(MDDI_REV_PKT_BUF_SIZE, MDDI_REV_SIZE);
writel(MDDI_REV_PKT_BUF_SIZE, MDDI_REV_ENCAP_SZ);
mddi_do_cmd(CMD_FORCE_NEW_REV_PTR);
}

Expand All @@ -150,6 +152,52 @@ static void mddi_set_auto_hibernate(unsigned on)
mddi_do_cmd(CMD_HIBERNATE | !!on);
}

void mddi_set_caps(mddi_client_caps *c)
{
/* Hardcoding the capability values */
c->length = 74;
c->type = 66;
c->client_id = 0;
c->protocol_ver = 1;
c->min_protocol_ver = 1;
c->data_rate_cap = 400;
c->interface_type_cap = 0;
c->num_alt_displays = 1;
c->postcal_data_rate = 400;
c->bitmap_width = TARGET_XRES;
c->bitmap_height = TARGET_YRES;
c->display_window_width = TARGET_XRES;
c->display_window_height = TARGET_YRES;
c->cmap_size = 0;
c->cmap_rgb_width = 0;
c->rgb_cap = 34592;
c->mono_cap = 0;
c->reserved1 = 0;
c->ycbcr_cap = 0;
c->bayer_cap = 0;
c->alpha_cursor_planes = 0;
c->client_feature_cap = 4489216;
c->max_video_frame_rate_cap = 60;
c->min_video_frame_rate_cap = 0;
c->min_sub_frame_rate = 0;
c->audio_buf_depth = 0;
c->audio_channel_cap = 0;
c->audio_sampe_rate_rap = 0;
c->audio_sample_res = 0;
c->mic_audio_sample_res = 0;
c->mic_sample_rate_cap = 0;
c->keyboard_data_fmt = 0;
c->pointing_device_data_fmt = 0;
c->content_protection_type = 0;
c->manufacturer_name = 53859;
c->product_code = 34594;
c->reserved3 = 0;
c->serial_no = 1;
c->week_of_manufacture = 0;
c->year_of_manufacture = 0;
c->crc = 53536;
}

static void mddi_get_caps(struct mddi_client_caps *caps)
{
unsigned timeout = 100000;
Expand Down Expand Up @@ -182,7 +230,6 @@ static void mddi_get_caps(struct mddi_client_caps *caps)

static unsigned mddi_init_regs(void)
{
mddi_set_auto_hibernate(0);
mddi_do_cmd(CMD_RESET);

mddi_do_cmd(CMD_PERIODIC_REV_ENC);
Expand All @@ -192,17 +239,11 @@ static unsigned mddi_init_regs(void)
writel(0x0003, MDDI_SPM);

writel(0x0005, MDDI_TA1_LEN);
writel(0x000C, MDDI_TA2_LEN);
writel(0x001A, MDDI_TA2_LEN);
writel(0x0096, MDDI_DRIVE_HI);
writel(0x0050, MDDI_DRIVE_LO);
writel(0x003C, MDDI_DISP_WAKE);
writel(0x0002, MDDI_REV_RATE_DIV);

writel(MDDI_REV_PKT_BUF_SIZE, MDDI_REV_SIZE);
// writel(MDDI_REV_PKT_BUF_SIZE, MDDI_REV_ENCAP_SZ);
writel(MDDI_MAX_REV_PKT_SIZE, MDDI_REV_ENCAP_SZ);

mddi_do_cmd(CMD_PERIODIC_REV_ENC);
writel(0x0004, MDDI_REV_RATE_DIV);

/* needs to settle for 5uS */
if (readl(MDDI_PAD_CTL) == 0) {
Expand All @@ -213,11 +254,11 @@ static unsigned mddi_init_regs(void)
writel(0xA850F, MDDI_PAD_CTL);
writel(0x60006, MDDI_DRIVER_START_CNT);

mddi_init_rev_encap();

/* disable hibernate */
mddi_set_auto_hibernate(0);
mddi_do_cmd(CMD_IGNORE);
mddi_do_cmd(CMD_HIBERNATE | 0);

mddi_init_rev_encap();
return readl(MDDI_CORE_VER) & 0xffff;
}

Expand All @@ -234,8 +275,11 @@ struct fbcon_config *mddi_init(void)
n = mddi_init_regs();
dprintf(INFO, "mddi version: 0x%08x\n", n);

mddi_get_caps(&client_caps);
ASSERT(client_caps.length == 0x4a && client_caps.type == 0x42);
//mddi_get_caps(&client_caps);
//if(!(client_caps.length == 0x4a && client_caps.type == 0x42))
{
mddi_set_caps(&client_caps);
}

fb_cfg.width = client_caps.bitmap_width;
fb_cfg.stride = fb_cfg.width;
Expand All @@ -258,7 +302,7 @@ struct fbcon_config *mddi_init(void)

mlist = memalign(32, sizeof(mddi_llentry) * (fb_cfg.height / 8));
dprintf(INFO, "FB @ %p mlist @ %x\n", fb_cfg.base, (unsigned) mlist);

for(n = 0; n < (fb_cfg.height / 8); n++) {
unsigned y = n * 8;
unsigned pixels = fb_cfg.width * 8;
Expand All @@ -269,19 +313,19 @@ struct fbcon_config *mddi_init(void)
vs->client_id = 0;
vs->format = 0x5565; // FORMAT_16BPP;
vs->pixattr = PIXATTR_BOTH_EYES | PIXATTR_TO_ALL;

vs->left = 0;
vs->right = fb_cfg.width - 1;
vs->top = y;
vs->bottom = y + 7;

vs->start_x = 0;
vs->start_y = y;

vs->pixels = pixels;
vs->crc = 0;
vs->reserved = 0;

mlist[n].header_count = sizeof(mddi_video_stream) - 2;
mlist[n].data_count = pixels * 2;
mlist[n].reserved = 0;
Expand Down
4 changes: 4 additions & 0 deletions platform/msm7k/mddi_hw.h → platform/msm_shared/mddi_hw.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,11 @@
#ifndef __PLATFORM_MSM7K_MDDI_HW_H
#define __PLATFORM_MSM7K_MDDI_HW_H

#ifdef TARGET_MSM7630_SURF
#define MSM_MDDI_BASE 0xAD600000
#else
#define MSM_MDDI_BASE 0xAA600000
#endif

/* see 80-VA736-2 C pp 776-787 */

Expand Down
Empty file modified platform/msm_shared/mmc.c
100755 → 100644
Empty file.
Empty file modified platform/msm_shared/nand.c
100755 → 100644
Empty file.
4 changes: 4 additions & 0 deletions platform/msm_shared/rules.mk
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ LOCAL_DIR := $(GET_LOCAL_DIR)
INCLUDES += \
-I$(LOCAL_DIR)/include

DEFINES += $(TARGET_XRES)
DEFINES += $(TARGET_YRES)

OBJS += \
$(LOCAL_DIR)/uart.o \
$(LOCAL_DIR)/timer.o \
Expand All @@ -15,5 +18,6 @@ OBJS += \
$(LOCAL_DIR)/jtag.o \
$(LOCAL_DIR)/nand.o \
$(LOCAL_DIR)/lcdc.o \
$(LOCAL_DIR)/mddi.o \
$(LOCAL_DIR)/mmc.o

Loading

0 comments on commit 2943fd6

Please sign in to comment.