interface.h 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. /*
  2. * Greybus Interface Block code
  3. *
  4. * Copyright 2014 Google Inc.
  5. * Copyright 2014 Linaro Ltd.
  6. *
  7. * Released under the GPLv2 only.
  8. */
  9. #ifndef __INTERFACE_H
  10. #define __INTERFACE_H
  11. enum gb_interface_type {
  12. GB_INTERFACE_TYPE_INVALID = 0,
  13. GB_INTERFACE_TYPE_UNKNOWN,
  14. GB_INTERFACE_TYPE_DUMMY,
  15. GB_INTERFACE_TYPE_UNIPRO,
  16. GB_INTERFACE_TYPE_GREYBUS,
  17. };
  18. #define GB_INTERFACE_QUIRK_NO_CPORT_FEATURES BIT(0)
  19. #define GB_INTERFACE_QUIRK_NO_INIT_STATUS BIT(1)
  20. #define GB_INTERFACE_QUIRK_NO_GMP_IDS BIT(2)
  21. #define GB_INTERFACE_QUIRK_FORCED_DISABLE BIT(3)
  22. #define GB_INTERFACE_QUIRK_LEGACY_MODE_SWITCH BIT(4)
  23. #define GB_INTERFACE_QUIRK_NO_BUNDLE_ACTIVATE BIT(5)
  24. #define GB_INTERFACE_QUIRK_NO_PM BIT(6)
  25. struct gb_interface {
  26. struct device dev;
  27. struct gb_control *control;
  28. struct list_head bundles;
  29. struct list_head module_node;
  30. struct list_head manifest_descs;
  31. u8 interface_id; /* Physical location within the Endo */
  32. u8 device_id;
  33. u8 features; /* Feature flags set in the manifest */
  34. enum gb_interface_type type;
  35. u32 ddbl1_manufacturer_id;
  36. u32 ddbl1_product_id;
  37. u32 vendor_id;
  38. u32 product_id;
  39. u64 serial_number;
  40. struct gb_host_device *hd;
  41. struct gb_module *module;
  42. unsigned long quirks;
  43. struct mutex mutex;
  44. bool disconnected;
  45. bool ejected;
  46. bool removed;
  47. bool active;
  48. bool enabled;
  49. bool mode_switch;
  50. bool dme_read;
  51. struct work_struct mode_switch_work;
  52. struct completion mode_switch_completion;
  53. };
  54. #define to_gb_interface(d) container_of(d, struct gb_interface, dev)
  55. struct gb_interface *gb_interface_create(struct gb_module *module,
  56. u8 interface_id);
  57. int gb_interface_activate(struct gb_interface *intf);
  58. void gb_interface_deactivate(struct gb_interface *intf);
  59. int gb_interface_enable(struct gb_interface *intf);
  60. void gb_interface_disable(struct gb_interface *intf);
  61. int gb_interface_timesync_enable(struct gb_interface *intf, u8 count,
  62. u64 frame_time, u32 strobe_delay, u32 refclk);
  63. int gb_interface_timesync_authoritative(struct gb_interface *intf,
  64. u64 *frame_time);
  65. int gb_interface_timesync_disable(struct gb_interface *intf);
  66. int gb_interface_add(struct gb_interface *intf);
  67. void gb_interface_del(struct gb_interface *intf);
  68. void gb_interface_put(struct gb_interface *intf);
  69. void gb_interface_mailbox_event(struct gb_interface *intf, u16 result,
  70. u32 mailbox);
  71. int gb_interface_request_mode_switch(struct gb_interface *intf);
  72. #endif /* __INTERFACE_H */