api_display.c 1.1 KB

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