panel.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /* SPDX-License-Identifier: GPL-2.0+ */
  2. /*
  3. * Copyright (c) 2016 Google, Inc
  4. * Written by Simon Glass <sjg@chromium.org>
  5. */
  6. #ifndef _PANEL_H
  7. #define _PANEL_H
  8. struct panel_ops {
  9. /**
  10. * enable_backlight() - Enable the panel backlight
  11. *
  12. * @dev: Panel device containing the backlight to enable
  13. * @return 0 if OK, -ve on error
  14. */
  15. int (*enable_backlight)(struct udevice *dev);
  16. /**
  17. * set_backlight - Set panel backlight brightness
  18. *
  19. * @dev: Panel device containing the backlight to update
  20. * @percent: Brightness value (0 to 100, or BACKLIGHT_... value)
  21. * @return 0 if OK, -ve on error
  22. */
  23. int (*set_backlight)(struct udevice *dev, int percent);
  24. /**
  25. * get_timings() - Get display timings from panel.
  26. *
  27. * @dev: Panel device containing the display timings
  28. * @tim: Place to put timings
  29. * @return 0 if OK, -ve on error
  30. */
  31. int (*get_display_timing)(struct udevice *dev,
  32. struct display_timing *timing);
  33. };
  34. #define panel_get_ops(dev) ((struct panel_ops *)(dev)->driver->ops)
  35. /**
  36. * panel_enable_backlight() - Enable/disable the panel backlight
  37. *
  38. * @dev: Panel device containing the backlight to enable
  39. * @enable: true to enable the backlight, false to dis
  40. * @return 0 if OK, -ve on error
  41. */
  42. int panel_enable_backlight(struct udevice *dev);
  43. /**
  44. * panel_set_backlight - Set brightness for the panel backlight
  45. *
  46. * @dev: Panel device containing the backlight to update
  47. * @percent: Brightness value (0 to 100, or BACKLIGHT_... value)
  48. * @return 0 if OK, -ve on error
  49. */
  50. int panel_set_backlight(struct udevice *dev, int percent);
  51. /**
  52. * panel_get_display_timing() - Get display timings from panel.
  53. *
  54. * @dev: Panel device containing the display timings
  55. * @return 0 if OK, -ve on error
  56. */
  57. int panel_get_display_timing(struct udevice *dev,
  58. struct display_timing *timing);
  59. #endif