dp_aux.h 2.1 KB

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