xref: /OK3568_Linux_fs/u-boot/api/api_display.c (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun /*
2*4882a593Smuzhiyun  * Copyright (c) 2011 The Chromium OS Authors.
3*4882a593Smuzhiyun  * SPDX-License-Identifier:	GPL-2.0+
4*4882a593Smuzhiyun  */
5*4882a593Smuzhiyun 
6*4882a593Smuzhiyun #include <common.h>
7*4882a593Smuzhiyun #include <api_public.h>
8*4882a593Smuzhiyun #include <lcd.h>
9*4882a593Smuzhiyun #include <video_font.h> /* Get font width and height */
10*4882a593Smuzhiyun 
11*4882a593Smuzhiyun /* lcd.h needs BMP_LOGO_HEIGHT to calculate CONSOLE_ROWS */
12*4882a593Smuzhiyun #if defined(CONFIG_LCD_LOGO) && !defined(CONFIG_LCD_INFO_BELOW_LOGO)
13*4882a593Smuzhiyun #include <bmp_logo.h>
14*4882a593Smuzhiyun #endif
15*4882a593Smuzhiyun 
16*4882a593Smuzhiyun /* TODO(clchiou): add support of video device */
17*4882a593Smuzhiyun 
display_get_info(int type,struct display_info * di)18*4882a593Smuzhiyun int display_get_info(int type, struct display_info *di)
19*4882a593Smuzhiyun {
20*4882a593Smuzhiyun 	if (!di)
21*4882a593Smuzhiyun 		return API_EINVAL;
22*4882a593Smuzhiyun 
23*4882a593Smuzhiyun 	switch (type) {
24*4882a593Smuzhiyun 	default:
25*4882a593Smuzhiyun 		debug("%s: unsupport display device type: %d\n",
26*4882a593Smuzhiyun 				__FILE__, type);
27*4882a593Smuzhiyun 		return API_ENODEV;
28*4882a593Smuzhiyun #ifdef CONFIG_LCD
29*4882a593Smuzhiyun 	case DISPLAY_TYPE_LCD:
30*4882a593Smuzhiyun 		di->pixel_width  = panel_info.vl_col;
31*4882a593Smuzhiyun 		di->pixel_height = panel_info.vl_row;
32*4882a593Smuzhiyun 		di->screen_rows = lcd_get_screen_rows();
33*4882a593Smuzhiyun 		di->screen_cols = lcd_get_screen_columns();
34*4882a593Smuzhiyun 		break;
35*4882a593Smuzhiyun #endif
36*4882a593Smuzhiyun 	}
37*4882a593Smuzhiyun 
38*4882a593Smuzhiyun 	di->type = type;
39*4882a593Smuzhiyun 	return 0;
40*4882a593Smuzhiyun }
41*4882a593Smuzhiyun 
display_draw_bitmap(ulong bitmap,int x,int y)42*4882a593Smuzhiyun int display_draw_bitmap(ulong bitmap, int x, int y)
43*4882a593Smuzhiyun {
44*4882a593Smuzhiyun 	if (!bitmap)
45*4882a593Smuzhiyun 		return API_EINVAL;
46*4882a593Smuzhiyun #ifdef CONFIG_LCD
47*4882a593Smuzhiyun 	return lcd_display_bitmap(bitmap, x, y);
48*4882a593Smuzhiyun #else
49*4882a593Smuzhiyun 	return API_ENODEV;
50*4882a593Smuzhiyun #endif
51*4882a593Smuzhiyun }
52*4882a593Smuzhiyun 
display_clear(void)53*4882a593Smuzhiyun void display_clear(void)
54*4882a593Smuzhiyun {
55*4882a593Smuzhiyun #ifdef CONFIG_LCD
56*4882a593Smuzhiyun 	lcd_clear();
57*4882a593Smuzhiyun #endif
58*4882a593Smuzhiyun }
59