u_uvc.h 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. /*
  2. * u_uvc.h
  3. *
  4. * Utility definitions for the uvc function
  5. *
  6. * Copyright (c) 2013-2014 Samsung Electronics Co., Ltd.
  7. * http://www.samsung.com
  8. *
  9. * Author: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
  10. *
  11. * This program is free software; you can redistribute it and/or modify
  12. * it under the terms of the GNU General Public License version 2 as
  13. * published by the Free Software Foundation.
  14. */
  15. #ifndef U_UVC_H
  16. #define U_UVC_H
  17. #include <linux/usb/composite.h>
  18. #include <linux/usb/video.h>
  19. #define fi_to_f_uvc_opts(f) container_of(f, struct f_uvc_opts, func_inst)
  20. struct f_uvc_opts {
  21. struct usb_function_instance func_inst;
  22. unsigned int uvc_gadget_trace_param;
  23. unsigned int streaming_interval;
  24. unsigned int streaming_maxpacket;
  25. unsigned int streaming_maxburst;
  26. /*
  27. * Control descriptors array pointers for full-/high-speed and
  28. * super-speed. They point by default to the uvc_fs_control_cls and
  29. * uvc_ss_control_cls arrays respectively. Legacy gadgets must
  30. * override them in their gadget bind callback.
  31. */
  32. const struct uvc_descriptor_header * const *fs_control;
  33. const struct uvc_descriptor_header * const *ss_control;
  34. /*
  35. * Streaming descriptors array pointers for full-speed, high-speed and
  36. * super-speed. They will point to the uvc_[fhs]s_streaming_cls arrays
  37. * for configfs-based gadgets. Legacy gadgets must initialize them in
  38. * their gadget bind callback.
  39. */
  40. const struct uvc_descriptor_header * const *fs_streaming;
  41. const struct uvc_descriptor_header * const *hs_streaming;
  42. const struct uvc_descriptor_header * const *ss_streaming;
  43. /* Default control descriptors for configfs-based gadgets. */
  44. struct uvc_camera_terminal_descriptor uvc_camera_terminal;
  45. struct uvc_processing_unit_descriptor uvc_processing;
  46. struct uvc_output_terminal_descriptor uvc_output_terminal;
  47. struct uvc_color_matching_descriptor uvc_color_matching;
  48. /*
  49. * Control descriptors pointers arrays for full-/high-speed and
  50. * super-speed. The first element is a configurable control header
  51. * descriptor, the other elements point to the fixed default control
  52. * descriptors. Used by configfs only, must not be touched by legacy
  53. * gadgets.
  54. */
  55. struct uvc_descriptor_header *uvc_fs_control_cls[5];
  56. struct uvc_descriptor_header *uvc_ss_control_cls[5];
  57. /*
  58. * Streaming descriptors for full-speed, high-speed and super-speed.
  59. * Used by configfs only, must not be touched by legacy gadgets. The
  60. * arrays are allocated at runtime as the number of descriptors isn't
  61. * known in advance.
  62. */
  63. struct uvc_descriptor_header **uvc_fs_streaming_cls;
  64. struct uvc_descriptor_header **uvc_hs_streaming_cls;
  65. struct uvc_descriptor_header **uvc_ss_streaming_cls;
  66. /*
  67. * Read/write access to configfs attributes is handled by configfs.
  68. *
  69. * This lock protects the descriptors from concurrent access by
  70. * read/write and symlink creation/removal.
  71. */
  72. struct mutex lock;
  73. int refcnt;
  74. };
  75. void uvc_set_trace_param(unsigned int trace);
  76. #endif /* U_UVC_H */