dp_aux.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Copyright (c) 2012-2020, The Linux Foundation. All rights reserved.
  4. */
  5. #ifndef _DP_AUX_H_
  6. #define _DP_AUX_H_
  7. #include "dp_catalog.h"
  8. #include "drm_dp_helper.h"
  9. #define DP_STATE_NOTIFICATION_SENT BIT(0)
  10. #define DP_STATE_TRAIN_1_STARTED BIT(1)
  11. #define DP_STATE_TRAIN_1_SUCCEEDED BIT(2)
  12. #define DP_STATE_TRAIN_1_FAILED BIT(3)
  13. #define DP_STATE_TRAIN_2_STARTED BIT(4)
  14. #define DP_STATE_TRAIN_2_SUCCEEDED BIT(5)
  15. #define DP_STATE_TRAIN_2_FAILED BIT(6)
  16. #define DP_STATE_CTRL_POWERED_ON BIT(7)
  17. #define DP_STATE_CTRL_POWERED_OFF BIT(8)
  18. #define DP_STATE_LINK_MAINTENANCE_STARTED BIT(9)
  19. #define DP_STATE_LINK_MAINTENANCE_COMPLETED BIT(10)
  20. #define DP_STATE_LINK_MAINTENANCE_FAILED BIT(11)
  21. #define DP_STATE_AUX_TIMEOUT BIT(12)
  22. #define DP_STATE_PLL_LOCKED BIT(13)
  23. enum dp_aux_error {
  24. DP_AUX_ERR_NONE = 0,
  25. DP_AUX_ERR_ADDR = -1,
  26. DP_AUX_ERR_TOUT = -2,
  27. DP_AUX_ERR_NACK = -3,
  28. DP_AUX_ERR_DEFER = -4,
  29. DP_AUX_ERR_NACK_DEFER = -5,
  30. DP_AUX_ERR_PHY = -6,
  31. };
  32. struct dp_aux {
  33. u32 reg;
  34. u32 size;
  35. u32 state;
  36. bool read;
  37. struct mutex *access_lock;
  38. struct drm_dp_aux *drm_aux;
  39. int (*drm_aux_register)(struct dp_aux *aux);
  40. void (*drm_aux_deregister)(struct dp_aux *aux);
  41. void (*isr)(struct dp_aux *aux);
  42. void (*init)(struct dp_aux *aux, struct dp_aux_cfg *aux_cfg);
  43. void (*deinit)(struct dp_aux *aux);
  44. void (*reconfig)(struct dp_aux *aux);
  45. void (*abort)(struct dp_aux *aux, bool abort);
  46. void (*dpcd_updated)(struct dp_aux *aux);
  47. void (*set_sim_mode)(struct dp_aux *aux, bool en, u8 *edid, u8 *dpcd);
  48. int (*aux_switch)(struct dp_aux *aux, bool enable, int orientation);
  49. };
  50. struct dp_aux *dp_aux_get(struct device *dev, struct dp_catalog_aux *catalog,
  51. struct dp_parser *parser, struct device_node *aux_switch);
  52. void dp_aux_put(struct dp_aux *aux);
  53. #endif /*__DP_AUX_H_*/