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