iso-resources.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef SOUND_FIREWIRE_ISO_RESOURCES_H_INCLUDED
  3. #define SOUND_FIREWIRE_ISO_RESOURCES_H_INCLUDED
  4. #include <linux/mutex.h>
  5. #include <linux/types.h>
  6. struct fw_unit;
  7. /**
  8. * struct fw_iso_resources - manages channel/bandwidth allocation
  9. * @channels_mask: if the device does not support all channel numbers, set this
  10. * bit mask to something else than the default (all ones)
  11. *
  12. * This structure manages (de)allocation of isochronous resources (channel and
  13. * bandwidth) for one isochronous stream.
  14. */
  15. struct fw_iso_resources {
  16. u64 channels_mask;
  17. /* private: */
  18. struct fw_unit *unit;
  19. struct mutex mutex;
  20. unsigned int channel;
  21. unsigned int bandwidth; /* in bandwidth units, without overhead */
  22. unsigned int bandwidth_overhead;
  23. int generation; /* in which allocation is valid */
  24. bool allocated;
  25. };
  26. int fw_iso_resources_init(struct fw_iso_resources *r,
  27. struct fw_unit *unit);
  28. void fw_iso_resources_destroy(struct fw_iso_resources *r);
  29. int fw_iso_resources_allocate(struct fw_iso_resources *r,
  30. unsigned int max_payload_bytes, int speed);
  31. int fw_iso_resources_update(struct fw_iso_resources *r);
  32. void fw_iso_resources_free(struct fw_iso_resources *r);
  33. #endif