2018-05-06 21:58:06 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0+
|
2014-01-22 10:24:12 +00:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2013 Samsung Electronics
|
|
|
|
* Przemyslaw Marczak <p.marczak@samsung.com>
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <common.h>
|
|
|
|
#include <lcd.h>
|
|
|
|
#include <libtizen.h>
|
|
|
|
#include <samsung/misc.h>
|
2014-01-22 10:24:17 +00:00
|
|
|
#include <errno.h>
|
|
|
|
#include <version.h>
|
2014-09-01 11:50:46 +00:00
|
|
|
#include <malloc.h>
|
2015-09-02 23:24:58 +00:00
|
|
|
#include <memalign.h>
|
2014-02-26 13:47:58 +00:00
|
|
|
#include <linux/sizes.h>
|
2014-01-22 10:24:17 +00:00
|
|
|
#include <asm/arch/cpu.h>
|
|
|
|
#include <asm/gpio.h>
|
|
|
|
#include <linux/input.h>
|
2015-05-13 11:38:25 +00:00
|
|
|
#include <dm.h>
|
2017-05-19 02:09:31 +00:00
|
|
|
/*
|
|
|
|
* Use #ifdef to work around conflicting headers while we wait for this to be
|
|
|
|
* converted to driver model.
|
|
|
|
*/
|
|
|
|
#ifdef CONFIG_DM_PMIC_MAX77686
|
|
|
|
#include <power/max77686_pmic.h>
|
|
|
|
#endif
|
|
|
|
#ifdef CONFIG_DM_PMIC_MAX8998
|
|
|
|
#include <power/max8998_pmic.h>
|
|
|
|
#endif
|
|
|
|
#ifdef CONFIG_PMIC_MAX8997
|
|
|
|
#include <power/max8997_pmic.h>
|
|
|
|
#endif
|
2014-01-22 10:24:17 +00:00
|
|
|
#include <power/pmic.h>
|
|
|
|
#include <mmc.h>
|
|
|
|
|
|
|
|
DECLARE_GLOBAL_DATA_PTR;
|
|
|
|
|
2014-09-01 11:50:46 +00:00
|
|
|
#ifdef CONFIG_SET_DFU_ALT_INFO
|
2015-02-17 11:24:11 +00:00
|
|
|
void set_dfu_alt_info(char *interface, char *devstr)
|
2014-09-01 11:50:46 +00:00
|
|
|
{
|
|
|
|
size_t buf_size = CONFIG_SET_DFU_ALT_BUF_LEN;
|
|
|
|
ALLOC_CACHE_ALIGN_BUFFER(char, buf, buf_size);
|
|
|
|
char *alt_info = "Settings not found!";
|
|
|
|
char *status = "error!\n";
|
|
|
|
char *alt_setting;
|
|
|
|
char *alt_sep;
|
|
|
|
int offset = 0;
|
|
|
|
|
|
|
|
puts("DFU alt info setting: ");
|
|
|
|
|
2015-02-17 11:24:11 +00:00
|
|
|
alt_setting = get_dfu_alt_boot(interface, devstr);
|
2014-09-01 11:50:46 +00:00
|
|
|
if (alt_setting) {
|
2017-08-03 18:22:09 +00:00
|
|
|
env_set("dfu_alt_boot", alt_setting);
|
2014-09-01 11:50:46 +00:00
|
|
|
offset = snprintf(buf, buf_size, "%s", alt_setting);
|
|
|
|
}
|
|
|
|
|
2015-02-17 11:24:11 +00:00
|
|
|
alt_setting = get_dfu_alt_system(interface, devstr);
|
2014-09-01 11:50:46 +00:00
|
|
|
if (alt_setting) {
|
|
|
|
if (offset)
|
|
|
|
alt_sep = ";";
|
|
|
|
else
|
|
|
|
alt_sep = "";
|
|
|
|
|
|
|
|
offset += snprintf(buf + offset, buf_size - offset,
|
|
|
|
"%s%s", alt_sep, alt_setting);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (offset) {
|
|
|
|
alt_info = buf;
|
|
|
|
status = "done\n";
|
|
|
|
}
|
|
|
|
|
2017-08-03 18:22:09 +00:00
|
|
|
env_set("dfu_alt_info", alt_info);
|
2014-09-01 11:50:46 +00:00
|
|
|
puts(status);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2014-01-22 14:54:32 +00:00
|
|
|
#ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
|
|
|
|
void set_board_info(void)
|
|
|
|
{
|
|
|
|
char info[64];
|
|
|
|
|
2014-09-01 11:50:42 +00:00
|
|
|
snprintf(info, ARRAY_SIZE(info), "%u.%u", (s5p_cpu_rev & 0xf0) >> 4,
|
|
|
|
s5p_cpu_rev & 0xf);
|
2017-08-03 18:22:09 +00:00
|
|
|
env_set("soc_rev", info);
|
2014-01-22 14:54:32 +00:00
|
|
|
|
|
|
|
snprintf(info, ARRAY_SIZE(info), "%x", s5p_cpu_id);
|
2017-08-03 18:22:09 +00:00
|
|
|
env_set("soc_id", info);
|
2014-01-22 14:54:32 +00:00
|
|
|
|
|
|
|
#ifdef CONFIG_REVISION_TAG
|
|
|
|
snprintf(info, ARRAY_SIZE(info), "%x", get_board_rev());
|
2017-08-03 18:22:09 +00:00
|
|
|
env_set("board_rev", info);
|
2014-01-22 14:54:32 +00:00
|
|
|
#endif
|
|
|
|
#ifdef CONFIG_OF_LIBFDT
|
2014-09-01 11:50:50 +00:00
|
|
|
const char *bdtype = "";
|
|
|
|
const char *bdname = CONFIG_SYS_BOARD;
|
|
|
|
|
|
|
|
#ifdef CONFIG_BOARD_TYPES
|
|
|
|
bdtype = get_board_type();
|
2015-10-27 12:07:54 +00:00
|
|
|
if (!bdtype)
|
|
|
|
bdtype = "";
|
|
|
|
|
2014-09-01 11:50:50 +00:00
|
|
|
sprintf(info, "%s%s", bdname, bdtype);
|
2017-08-03 18:22:09 +00:00
|
|
|
env_set("boardname", info);
|
2014-09-01 11:50:50 +00:00
|
|
|
#endif
|
|
|
|
snprintf(info, ARRAY_SIZE(info), "%s%x-%s%s.dtb",
|
|
|
|
CONFIG_SYS_SOC, s5p_cpu_id, bdname, bdtype);
|
2017-08-03 18:22:09 +00:00
|
|
|
env_set("fdtfile", info);
|
2014-01-22 14:54:32 +00:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
#endif /* CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG */
|
|
|
|
|
2014-01-22 10:24:17 +00:00
|
|
|
#ifdef CONFIG_LCD_MENU
|
|
|
|
static int power_key_pressed(u32 reg)
|
|
|
|
{
|
2016-11-23 13:34:40 +00:00
|
|
|
#ifndef CONFIG_DM_I2C /* TODO(maintainer): Convert to driver model */
|
2014-01-22 10:24:17 +00:00
|
|
|
struct pmic *pmic;
|
|
|
|
u32 status;
|
|
|
|
u32 mask;
|
|
|
|
|
|
|
|
pmic = pmic_get(KEY_PWR_PMIC_NAME);
|
|
|
|
if (!pmic) {
|
|
|
|
printf("%s: Not found\n", KEY_PWR_PMIC_NAME);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (pmic_probe(pmic))
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
if (reg == KEY_PWR_STATUS_REG)
|
|
|
|
mask = KEY_PWR_STATUS_MASK;
|
|
|
|
else
|
|
|
|
mask = KEY_PWR_INTERRUPT_MASK;
|
|
|
|
|
|
|
|
if (pmic_reg_read(pmic, reg, &status))
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
return !!(status & mask);
|
2016-11-23 13:34:40 +00:00
|
|
|
#else
|
|
|
|
return 0;
|
|
|
|
#endif
|
2014-01-22 10:24:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static int key_pressed(int key)
|
|
|
|
{
|
|
|
|
int value;
|
|
|
|
|
|
|
|
switch (key) {
|
|
|
|
case KEY_POWER:
|
|
|
|
value = power_key_pressed(KEY_PWR_INTERRUPT_REG);
|
|
|
|
break;
|
|
|
|
case KEY_VOLUMEUP:
|
|
|
|
value = !gpio_get_value(KEY_VOL_UP_GPIO);
|
|
|
|
break;
|
|
|
|
case KEY_VOLUMEDOWN:
|
|
|
|
value = !gpio_get_value(KEY_VOL_DOWN_GPIO);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
value = 0;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return value;
|
|
|
|
}
|
|
|
|
|
2016-02-22 04:08:53 +00:00
|
|
|
#ifdef CONFIG_LCD
|
2014-01-22 10:24:17 +00:00
|
|
|
static int check_keys(void)
|
|
|
|
{
|
|
|
|
int keys = 0;
|
|
|
|
|
|
|
|
if (key_pressed(KEY_POWER))
|
|
|
|
keys += KEY_POWER;
|
|
|
|
if (key_pressed(KEY_VOLUMEUP))
|
|
|
|
keys += KEY_VOLUMEUP;
|
|
|
|
if (key_pressed(KEY_VOLUMEDOWN))
|
|
|
|
keys += KEY_VOLUMEDOWN;
|
|
|
|
|
|
|
|
return keys;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* 0 BOOT_MODE_INFO
|
|
|
|
* 1 BOOT_MODE_THOR
|
|
|
|
* 2 BOOT_MODE_UMS
|
|
|
|
* 3 BOOT_MODE_DFU
|
|
|
|
* 4 BOOT_MODE_EXIT
|
|
|
|
*/
|
|
|
|
static char *
|
2014-04-30 11:28:06 +00:00
|
|
|
mode_name[BOOT_MODE_EXIT + 1][2] = {
|
|
|
|
{"DEVICE", ""},
|
|
|
|
{"THOR", "thor"},
|
|
|
|
{"UMS", "ums"},
|
|
|
|
{"DFU", "dfu"},
|
2014-04-30 11:28:07 +00:00
|
|
|
{"GPT", "gpt"},
|
2014-04-30 11:28:08 +00:00
|
|
|
{"ENV", "env"},
|
2014-04-30 11:28:06 +00:00
|
|
|
{"EXIT", ""},
|
2014-01-22 10:24:17 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static char *
|
|
|
|
mode_info[BOOT_MODE_EXIT + 1] = {
|
|
|
|
"info",
|
|
|
|
"downloader",
|
|
|
|
"mass storage",
|
|
|
|
"firmware update",
|
2014-04-30 11:28:07 +00:00
|
|
|
"restore",
|
2014-04-30 11:28:08 +00:00
|
|
|
"default",
|
2014-01-22 10:24:17 +00:00
|
|
|
"and run normal boot"
|
|
|
|
};
|
|
|
|
|
|
|
|
static char *
|
2014-04-30 11:28:06 +00:00
|
|
|
mode_cmd[BOOT_MODE_EXIT + 1] = {
|
|
|
|
"",
|
|
|
|
"thor 0 mmc 0",
|
|
|
|
"ums 0 mmc 0",
|
|
|
|
"dfu 0 mmc 0",
|
2014-04-30 11:28:07 +00:00
|
|
|
"gpt write mmc 0 $partitions",
|
2014-04-30 11:28:08 +00:00
|
|
|
"env default -a; saveenv",
|
2014-04-30 11:28:06 +00:00
|
|
|
"",
|
2014-01-22 10:24:17 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static void display_board_info(void)
|
|
|
|
{
|
2017-05-09 11:31:39 +00:00
|
|
|
#ifdef CONFIG_MMC
|
2014-01-22 10:24:17 +00:00
|
|
|
struct mmc *mmc = find_mmc_device(0);
|
|
|
|
#endif
|
|
|
|
vidinfo_t *vid = &panel_info;
|
|
|
|
|
|
|
|
lcd_position_cursor(4, 4);
|
|
|
|
|
|
|
|
lcd_printf("%s\n\t", U_BOOT_VERSION);
|
|
|
|
lcd_puts("\n\t\tBoard Info:\n");
|
|
|
|
#ifdef CONFIG_SYS_BOARD
|
|
|
|
lcd_printf("\tBoard name: %s\n", CONFIG_SYS_BOARD);
|
|
|
|
#endif
|
|
|
|
#ifdef CONFIG_REVISION_TAG
|
|
|
|
lcd_printf("\tBoard rev: %u\n", get_board_rev());
|
|
|
|
#endif
|
|
|
|
lcd_printf("\tDRAM banks: %u\n", CONFIG_NR_DRAM_BANKS);
|
|
|
|
lcd_printf("\tDRAM size: %u MB\n", gd->ram_size / SZ_1M);
|
|
|
|
|
2017-05-09 11:31:39 +00:00
|
|
|
#ifdef CONFIG_MMC
|
2014-01-22 10:24:17 +00:00
|
|
|
if (mmc) {
|
|
|
|
if (!mmc->capacity)
|
|
|
|
mmc_init(mmc);
|
|
|
|
|
|
|
|
lcd_printf("\teMMC size: %llu MB\n", mmc->capacity / SZ_1M);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
if (vid)
|
|
|
|
lcd_printf("\tDisplay resolution: %u x % u\n",
|
|
|
|
vid->vl_col, vid->vl_row);
|
|
|
|
|
|
|
|
lcd_printf("\tDisplay BPP: %u\n", 1 << vid->vl_bpix);
|
|
|
|
}
|
2016-02-22 04:08:53 +00:00
|
|
|
#endif
|
2014-01-22 10:24:17 +00:00
|
|
|
|
|
|
|
static int mode_leave_menu(int mode)
|
|
|
|
{
|
2016-02-22 04:08:53 +00:00
|
|
|
#ifdef CONFIG_LCD
|
2014-01-22 10:24:17 +00:00
|
|
|
char *exit_option;
|
2014-04-30 11:28:06 +00:00
|
|
|
char *exit_reset = "reset";
|
2014-01-22 10:24:17 +00:00
|
|
|
char *exit_back = "back";
|
|
|
|
cmd_tbl_t *cmd;
|
|
|
|
int cmd_result;
|
|
|
|
int leave;
|
|
|
|
|
|
|
|
lcd_clear();
|
|
|
|
|
|
|
|
switch (mode) {
|
|
|
|
case BOOT_MODE_EXIT:
|
|
|
|
return 1;
|
|
|
|
case BOOT_MODE_INFO:
|
|
|
|
display_board_info();
|
|
|
|
exit_option = exit_back;
|
|
|
|
leave = 0;
|
|
|
|
break;
|
|
|
|
default:
|
2014-04-30 11:28:06 +00:00
|
|
|
cmd = find_cmd(mode_name[mode][1]);
|
2014-01-22 10:24:17 +00:00
|
|
|
if (cmd) {
|
2014-04-30 11:28:06 +00:00
|
|
|
printf("Enter: %s %s\n", mode_name[mode][0],
|
2015-10-23 07:21:20 +00:00
|
|
|
mode_info[mode]);
|
2014-04-30 11:28:06 +00:00
|
|
|
lcd_printf("\n\n\t%s %s\n", mode_name[mode][0],
|
2015-10-23 07:21:20 +00:00
|
|
|
mode_info[mode]);
|
2014-01-22 10:24:17 +00:00
|
|
|
lcd_puts("\n\tDo not turn off device before finish!\n");
|
|
|
|
|
2014-04-30 11:28:06 +00:00
|
|
|
cmd_result = run_command(mode_cmd[mode], 0);
|
2014-01-22 10:24:17 +00:00
|
|
|
|
|
|
|
if (cmd_result == CMD_RET_SUCCESS) {
|
|
|
|
printf("Command finished\n");
|
|
|
|
lcd_clear();
|
|
|
|
lcd_printf("\n\n\t%s finished\n",
|
2014-04-30 11:28:06 +00:00
|
|
|
mode_name[mode][0]);
|
2014-01-22 10:24:17 +00:00
|
|
|
|
2014-04-30 11:28:06 +00:00
|
|
|
exit_option = exit_reset;
|
2014-01-22 10:24:17 +00:00
|
|
|
leave = 1;
|
|
|
|
} else {
|
|
|
|
printf("Command error\n");
|
|
|
|
lcd_clear();
|
|
|
|
lcd_printf("\n\n\t%s command error\n",
|
2014-04-30 11:28:06 +00:00
|
|
|
mode_name[mode][0]);
|
2014-01-22 10:24:17 +00:00
|
|
|
|
|
|
|
exit_option = exit_back;
|
|
|
|
leave = 0;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
lcd_puts("\n\n\tThis mode is not supported.\n");
|
|
|
|
exit_option = exit_back;
|
|
|
|
leave = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
lcd_printf("\n\n\tPress POWER KEY to %s\n", exit_option);
|
|
|
|
|
|
|
|
/* Clear PWR button Rising edge interrupt status flag */
|
|
|
|
power_key_pressed(KEY_PWR_INTERRUPT_REG);
|
|
|
|
|
|
|
|
/* Wait for PWR key */
|
|
|
|
while (!key_pressed(KEY_POWER))
|
|
|
|
mdelay(1);
|
|
|
|
|
|
|
|
lcd_clear();
|
|
|
|
return leave;
|
2016-02-22 04:08:53 +00:00
|
|
|
#else
|
|
|
|
return 0;
|
|
|
|
#endif
|
2014-01-22 10:24:17 +00:00
|
|
|
}
|
|
|
|
|
2016-02-22 04:08:53 +00:00
|
|
|
#ifdef CONFIG_LCD
|
2014-01-22 10:24:17 +00:00
|
|
|
static void display_download_menu(int mode)
|
|
|
|
{
|
|
|
|
char *selection[BOOT_MODE_EXIT + 1];
|
|
|
|
int i;
|
|
|
|
|
|
|
|
for (i = 0; i <= BOOT_MODE_EXIT; i++)
|
|
|
|
selection[i] = "[ ]";
|
|
|
|
|
|
|
|
selection[mode] = "[=>]";
|
|
|
|
|
|
|
|
lcd_clear();
|
2014-04-30 11:28:10 +00:00
|
|
|
lcd_printf("\n\n\t\tDownload Mode Menu\n\n");
|
2014-01-22 10:24:17 +00:00
|
|
|
|
|
|
|
for (i = 0; i <= BOOT_MODE_EXIT; i++)
|
|
|
|
lcd_printf("\t%s %s - %s\n\n", selection[i],
|
2015-10-23 07:21:20 +00:00
|
|
|
mode_name[i][0], mode_info[i]);
|
2014-01-22 10:24:17 +00:00
|
|
|
}
|
2016-02-22 04:08:53 +00:00
|
|
|
#endif
|
2014-01-22 10:24:17 +00:00
|
|
|
|
|
|
|
static void download_menu(void)
|
|
|
|
{
|
2016-02-22 04:08:53 +00:00
|
|
|
#ifdef CONFIG_LCD
|
2014-01-22 10:24:17 +00:00
|
|
|
int mode = 0;
|
|
|
|
int last_mode = 0;
|
|
|
|
int run;
|
2014-04-30 11:28:10 +00:00
|
|
|
int key = 0;
|
|
|
|
int timeout = 15; /* sec */
|
|
|
|
int i;
|
2014-01-22 10:24:17 +00:00
|
|
|
|
|
|
|
display_download_menu(mode);
|
|
|
|
|
2014-04-30 11:28:10 +00:00
|
|
|
lcd_puts("\n");
|
|
|
|
|
|
|
|
/* Start count if no key is pressed */
|
|
|
|
while (check_keys())
|
|
|
|
continue;
|
|
|
|
|
|
|
|
while (timeout--) {
|
|
|
|
lcd_printf("\r\tNormal boot will start in: %2.d seconds.",
|
|
|
|
timeout);
|
|
|
|
|
|
|
|
/* about 1000 ms in for loop */
|
|
|
|
for (i = 0; i < 10; i++) {
|
|
|
|
mdelay(100);
|
|
|
|
key = check_keys();
|
|
|
|
if (key)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (key)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!key) {
|
|
|
|
lcd_clear();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2014-01-22 10:24:17 +00:00
|
|
|
while (1) {
|
|
|
|
run = 0;
|
|
|
|
|
|
|
|
if (mode != last_mode)
|
|
|
|
display_download_menu(mode);
|
|
|
|
|
|
|
|
last_mode = mode;
|
2014-04-30 11:28:09 +00:00
|
|
|
mdelay(200);
|
2014-01-22 10:24:17 +00:00
|
|
|
|
|
|
|
key = check_keys();
|
|
|
|
switch (key) {
|
|
|
|
case KEY_POWER:
|
|
|
|
run = 1;
|
|
|
|
break;
|
|
|
|
case KEY_VOLUMEUP:
|
|
|
|
if (mode > 0)
|
|
|
|
mode--;
|
|
|
|
break;
|
|
|
|
case KEY_VOLUMEDOWN:
|
|
|
|
if (mode < BOOT_MODE_EXIT)
|
|
|
|
mode++;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (run) {
|
|
|
|
if (mode_leave_menu(mode))
|
2014-04-30 11:28:06 +00:00
|
|
|
run_command("reset", 0);
|
2014-01-22 10:24:17 +00:00
|
|
|
|
|
|
|
display_download_menu(mode);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
lcd_clear();
|
2016-02-22 04:08:53 +00:00
|
|
|
#endif
|
2014-01-22 10:24:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void check_boot_mode(void)
|
|
|
|
{
|
|
|
|
int pwr_key;
|
|
|
|
|
|
|
|
pwr_key = power_key_pressed(KEY_PWR_STATUS_REG);
|
|
|
|
if (!pwr_key)
|
|
|
|
return;
|
|
|
|
|
|
|
|
/* Clear PWR button Rising edge interrupt status flag */
|
|
|
|
power_key_pressed(KEY_PWR_INTERRUPT_REG);
|
|
|
|
|
|
|
|
if (key_pressed(KEY_VOLUMEUP))
|
2014-04-30 11:28:10 +00:00
|
|
|
download_menu();
|
2014-01-22 10:24:17 +00:00
|
|
|
else if (key_pressed(KEY_VOLUMEDOWN))
|
|
|
|
mode_leave_menu(BOOT_MODE_THOR);
|
|
|
|
}
|
|
|
|
|
|
|
|
void keys_init(void)
|
|
|
|
{
|
|
|
|
/* Set direction to input */
|
2014-10-21 01:48:39 +00:00
|
|
|
gpio_request(KEY_VOL_UP_GPIO, "volume-up");
|
|
|
|
gpio_request(KEY_VOL_DOWN_GPIO, "volume-down");
|
2014-01-22 10:24:17 +00:00
|
|
|
gpio_direction_input(KEY_VOL_UP_GPIO);
|
|
|
|
gpio_direction_input(KEY_VOL_DOWN_GPIO);
|
|
|
|
}
|
|
|
|
#endif /* CONFIG_LCD_MENU */
|
2014-01-22 10:24:12 +00:00
|
|
|
|
|
|
|
#ifdef CONFIG_CMD_BMP
|
|
|
|
void draw_logo(void)
|
|
|
|
{
|
|
|
|
int x, y;
|
|
|
|
ulong addr;
|
|
|
|
|
|
|
|
addr = panel_info.logo_addr;
|
|
|
|
if (!addr) {
|
2018-06-04 07:03:05 +00:00
|
|
|
pr_err("There is no logo data.\n");
|
2014-01-22 10:24:12 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (panel_info.vl_width >= panel_info.logo_width) {
|
|
|
|
x = ((panel_info.vl_width - panel_info.logo_width) >> 1);
|
2013-11-29 17:30:43 +00:00
|
|
|
x += panel_info.logo_x_offset; /* For X center align */
|
2014-01-22 10:24:12 +00:00
|
|
|
} else {
|
|
|
|
x = 0;
|
|
|
|
printf("Warning: image width is bigger than display width\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
if (panel_info.vl_height >= panel_info.logo_height) {
|
|
|
|
y = ((panel_info.vl_height - panel_info.logo_height) >> 1);
|
2013-11-29 17:30:43 +00:00
|
|
|
y += panel_info.logo_y_offset; /* For Y center align */
|
2014-01-22 10:24:12 +00:00
|
|
|
} else {
|
|
|
|
y = 0;
|
|
|
|
printf("Warning: image height is bigger than display height\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
bmp_display(addr, x, y);
|
|
|
|
}
|
|
|
|
#endif /* CONFIG_CMD_BMP */
|