samsung: common: Add file for common functions, draw_logo() cleanup.
[oweals/u-boot.git] / board / samsung / common / misc.c
1 /*
2  * Copyright (C) 2013 Samsung Electronics
3  * Przemyslaw Marczak <p.marczak@samsung.com>
4  *
5  * SPDX-License-Identifier:     GPL-2.0+
6  */
7
8 #include <common.h>
9 #include <lcd.h>
10 #include <libtizen.h>
11 #include <samsung/misc.h>
12
13 #ifdef CONFIG_CMD_BMP
14 void draw_logo(void)
15 {
16         int x, y;
17         ulong addr;
18
19         addr = panel_info.logo_addr;
20         if (!addr) {
21                 error("There is no logo data.");
22                 return;
23         }
24
25         if (panel_info.vl_width >= panel_info.logo_width) {
26                 x = ((panel_info.vl_width - panel_info.logo_width) >> 1);
27         } else {
28                 x = 0;
29                 printf("Warning: image width is bigger than display width\n");
30         }
31
32         if (panel_info.vl_height >= panel_info.logo_height) {
33                 y = ((panel_info.vl_height - panel_info.logo_height) >> 1);
34         } else {
35                 y = 0;
36                 printf("Warning: image height is bigger than display height\n");
37         }
38
39         bmp_display(addr, x, y);
40 }
41 #endif /* CONFIG_CMD_BMP */