display.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. /*
  2. * Copyright 2014 Google Inc.
  3. *
  4. * SPDX-License-Identifier: GPL-2.0+
  5. */
  6. #ifndef _DISPLAY_H
  7. #define _DISPLAY_H
  8. struct udevice;
  9. struct display_timing;
  10. /**
  11. * Display uclass platform data for each device
  12. *
  13. * @source_id: ID for the source of the display data, typically a video
  14. * controller
  15. * @src_dev: Source device providing the video
  16. * @in_use: Display is being used
  17. */
  18. struct display_plat {
  19. int source_id;
  20. struct udevice *src_dev;
  21. bool in_use;
  22. };
  23. /**
  24. * display_read_timing() - Read timing information
  25. *
  26. * @dev: Device to read from
  27. * @return 0 if OK, -ve on error
  28. */
  29. int display_read_timing(struct udevice *dev, struct display_timing *timing);
  30. /**
  31. * display_port_enable() - Enable a display port device
  32. *
  33. * @dev: Device to enable
  34. * @panel_bpp: Number of bits per pixel for panel
  35. * @timing: Display timings
  36. * @return 0 if OK, -ve on error
  37. */
  38. int display_enable(struct udevice *dev, int panel_bpp,
  39. const struct display_timing *timing);
  40. /**
  41. * display_in_use() - Check if a display is in use by any device
  42. *
  43. * @return true if the device is in use (display_enable() has been called
  44. * successfully), else false
  45. */
  46. bool display_in_use(struct udevice *dev);
  47. struct dm_display_ops {
  48. /**
  49. * read_timing() - Read information directly
  50. *
  51. * @dev: Device to read from
  52. * @timing: Display timings
  53. * @return 0 if OK, -ve on error
  54. */
  55. int (*read_timing)(struct udevice *dev, struct display_timing *timing);
  56. /**
  57. * read_edid() - Read information from EDID
  58. *
  59. * @dev: Device to read from
  60. * @buf: Buffer to read into (should be EDID_SIZE bytes)
  61. * @buf_size: Buffer size (should be EDID_SIZE)
  62. * @return number of bytes read, <=0 for error
  63. */
  64. int (*read_edid)(struct udevice *dev, u8 *buf, int buf_size);
  65. /**
  66. * enable() - Enable the display port device
  67. *
  68. * @dev: Device to enable
  69. * @panel_bpp: Number of bits per pixel for panel
  70. * @timing: Display timings
  71. * @return 0 if OK, -ve on error
  72. */
  73. int (*enable)(struct udevice *dev, int panel_bpp,
  74. const struct display_timing *timing);
  75. };
  76. #define display_get_ops(dev) ((struct dm_display_ops *)(dev)->driver->ops)
  77. #endif