api_display.c 1.1 KB

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