video_bridge.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. /*
  2. * Copyright (C) 2015 Google, Inc
  3. * Written by Simon Glass <sjg@chromium.org>
  4. *
  5. * SPDX-License-Identifier: GPL-2.0+
  6. */
  7. #ifndef __VIDEO_BRIDGE
  8. #define __VIDEO_BRIDGE
  9. #include <asm/gpio.h>
  10. /**
  11. * struct video_bridge_priv - uclass information for video bridges
  12. *
  13. * @sleep: GPIO to assert to power down the bridge
  14. * @reset: GPIO to assert to reset the bridge
  15. * @hotplug: Optional GPIO to check if bridge is connected
  16. */
  17. struct video_bridge_priv {
  18. struct gpio_desc sleep;
  19. struct gpio_desc reset;
  20. struct gpio_desc hotplug;
  21. };
  22. /**
  23. * Operations for video bridges
  24. */
  25. struct video_bridge_ops {
  26. /**
  27. * attach() - attach a video bridge
  28. *
  29. * @return 0 if OK, -ve on error
  30. */
  31. int (*attach)(struct udevice *dev);
  32. /**
  33. * check_attached() - check if a bridge is correctly attached
  34. *
  35. * This method is optional - if not provided then the hotplug GPIO
  36. * will be checked instead.
  37. *
  38. * @dev: Device to check
  39. * @return 0 if attached, -EENOTCONN if not, or other -ve error
  40. */
  41. int (*check_attached)(struct udevice *dev);
  42. /**
  43. * set_backlight() - Set the backlight brightness
  44. *
  45. * @dev: device to adjust
  46. * @percent: brightness percentage (0=off, 100=full brightness)
  47. * @return 0 if OK, -ve on error
  48. */
  49. int (*set_backlight)(struct udevice *dev, int percent);
  50. };
  51. #define video_bridge_get_ops(dev) \
  52. ((struct video_bridge_ops *)(dev)->driver->ops)
  53. /**
  54. * video_bridge_attach() - attach a video bridge
  55. *
  56. * @return 0 if OK, -ve on error
  57. */
  58. int video_bridge_attach(struct udevice *dev);
  59. /**
  60. * video_bridge_set_backlight() - Set the backlight brightness
  61. *
  62. * @percent: brightness percentage (0=off, 100=full brightness)
  63. * @return 0 if OK, -ve on error
  64. */
  65. int video_bridge_set_backlight(struct udevice *dev, int percent);
  66. /**
  67. * video_bridge_set_active() - take the bridge in/out of reset/powerdown
  68. *
  69. * @dev: Device to adjust
  70. * @active: true to power up and reset, false to power down
  71. */
  72. int video_bridge_set_active(struct udevice *dev, bool active);
  73. /**
  74. * check_attached() - check if a bridge is correctly attached
  75. *
  76. * @dev: Device to check
  77. * @return 0 if attached, -EENOTCONN if not, or other -ve error
  78. */
  79. int video_bridge_check_attached(struct udevice *dev);
  80. #endif