1*b2441318SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 */ 231ef9134SClemens Ladisch #ifndef SOUND_FIREWIRE_ISO_RESOURCES_H_INCLUDED 331ef9134SClemens Ladisch #define SOUND_FIREWIRE_ISO_RESOURCES_H_INCLUDED 431ef9134SClemens Ladisch 531ef9134SClemens Ladisch #include <linux/mutex.h> 631ef9134SClemens Ladisch #include <linux/types.h> 731ef9134SClemens Ladisch 831ef9134SClemens Ladisch struct fw_unit; 931ef9134SClemens Ladisch 1031ef9134SClemens Ladisch /** 1131ef9134SClemens Ladisch * struct fw_iso_resources - manages channel/bandwidth allocation 1231ef9134SClemens Ladisch * @channels_mask: if the device does not support all channel numbers, set this 1331ef9134SClemens Ladisch * bit mask to something else than the default (all ones) 1431ef9134SClemens Ladisch * 1531ef9134SClemens Ladisch * This structure manages (de)allocation of isochronous resources (channel and 1631ef9134SClemens Ladisch * bandwidth) for one isochronous stream. 1731ef9134SClemens Ladisch */ 1831ef9134SClemens Ladisch struct fw_iso_resources { 1931ef9134SClemens Ladisch u64 channels_mask; 2031ef9134SClemens Ladisch /* private: */ 2131ef9134SClemens Ladisch struct fw_unit *unit; 2231ef9134SClemens Ladisch struct mutex mutex; 2331ef9134SClemens Ladisch unsigned int channel; 2431ef9134SClemens Ladisch unsigned int bandwidth; /* in bandwidth units, without overhead */ 2531ef9134SClemens Ladisch unsigned int bandwidth_overhead; 2631ef9134SClemens Ladisch int generation; /* in which allocation is valid */ 2731ef9134SClemens Ladisch bool allocated; 2831ef9134SClemens Ladisch }; 2931ef9134SClemens Ladisch 305b2599a0SClemens Ladisch int fw_iso_resources_init(struct fw_iso_resources *r, 3131ef9134SClemens Ladisch struct fw_unit *unit); 3231ef9134SClemens Ladisch void fw_iso_resources_destroy(struct fw_iso_resources *r); 3331ef9134SClemens Ladisch 3431ef9134SClemens Ladisch int fw_iso_resources_allocate(struct fw_iso_resources *r, 3531ef9134SClemens Ladisch unsigned int max_payload_bytes, int speed); 3631ef9134SClemens Ladisch int fw_iso_resources_update(struct fw_iso_resources *r); 3731ef9134SClemens Ladisch void fw_iso_resources_free(struct fw_iso_resources *r); 3831ef9134SClemens Ladisch 3931ef9134SClemens Ladisch #endif 40