dp_usbpd.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Copyright (c) 2012-2019, The Linux Foundation. All rights reserved.
  4. */
  5. #ifndef _DP_USBPD_H_
  6. #define _DP_USBPD_H_
  7. #include <linux/types.h>
  8. #include "dp_hpd.h"
  9. struct device;
  10. /**
  11. * enum dp_usbpd_port - usb/dp port type
  12. * @DP_USBPD_PORT_NONE: port not configured
  13. * @DP_USBPD_PORT_UFP_D: Upstream Facing Port - DisplayPort
  14. * @DP_USBPD_PORT_DFP_D: Downstream Facing Port - DisplayPort
  15. * @DP_USBPD_PORT_D_UFP_D: Both UFP & DFP - DisplayPort
  16. */
  17. enum dp_usbpd_port {
  18. DP_USBPD_PORT_NONE,
  19. DP_USBPD_PORT_UFP_D,
  20. DP_USBPD_PORT_DFP_D,
  21. DP_USBPD_PORT_D_UFP_D,
  22. };
  23. /**
  24. * struct dp_usbpd - DisplayPort status
  25. *
  26. * @port: port configured
  27. * @low_pow_st: low power state
  28. * @adaptor_dp_en: adaptor functionality enabled
  29. * @usb_config_req: request to switch to usb
  30. * @exit_dp_mode: request exit from displayport mode
  31. * @debug_en: bool to specify debug mode
  32. */
  33. struct dp_usbpd {
  34. struct dp_hpd base;
  35. enum dp_usbpd_port port;
  36. bool low_pow_st;
  37. bool adaptor_dp_en;
  38. bool usb_config_req;
  39. bool exit_dp_mode;
  40. bool debug_en;
  41. };
  42. /**
  43. * dp_usbpd_get() - setup usbpd module
  44. *
  45. * @dev: device instance of the caller
  46. * @cb: struct containing callback function pointers.
  47. *
  48. * This function allows the client to initialize the usbpd
  49. * module. The module will communicate with usb driver and
  50. * handles the power delivery (PD) communication with the
  51. * sink/usb device. This module will notify the client using
  52. * the callback functions about the connection and status.
  53. */
  54. struct dp_hpd *dp_usbpd_get(struct device *dev, struct dp_hpd_cb *cb);
  55. void dp_usbpd_put(struct dp_hpd *pd);
  56. #endif /* _DP_USBPD_H_ */