u_tcm.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. // SPDX-License-Identifier: GPL-2.0
  2. /*
  3. * u_tcm.h
  4. *
  5. * Utility definitions for the tcm function
  6. *
  7. * Copyright (c) 2015 Samsung Electronics Co., Ltd.
  8. * http://www.samsung.com
  9. *
  10. * Author: Andrzej Pietrasiewicz <andrzej.p@xxxxxxxxxxx>
  11. */
  12. #ifndef U_TCM_H
  13. #define U_TCM_H
  14. #include <linux/usb/composite.h>
  15. /**
  16. * @dependent: optional dependent module. Meant for legacy gadget.
  17. * If non-null its refcount will be increased when a tpg is created and
  18. * decreased when tpg is dropped.
  19. * @dep_lock: lock for dependent module operations.
  20. * @ready: true if the dependent module information is set.
  21. * @can_attach: true a function can be bound to gadget
  22. * @has_dep: true if there is a dependent module
  23. *
  24. */
  25. struct f_tcm_opts {
  26. struct usb_function_instance func_inst;
  27. struct module *dependent;
  28. struct mutex dep_lock;
  29. bool ready;
  30. bool can_attach;
  31. bool has_dep;
  32. /*
  33. * Callbacks to be removed when legacy tcm gadget disappears.
  34. *
  35. * If you use the new function registration interface
  36. * programmatically, you MUST set these callbacks to
  37. * something sensible (e.g. probe/remove the composite).
  38. */
  39. int (*tcm_register_callback)(struct usb_function_instance *);
  40. void (*tcm_unregister_callback)(struct usb_function_instance *);
  41. };
  42. #endif /* U_TCM_H */