18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 28c2ecf20Sopenharmony_ci#ifndef SOUND_FIREWIRE_ISO_RESOURCES_H_INCLUDED 38c2ecf20Sopenharmony_ci#define SOUND_FIREWIRE_ISO_RESOURCES_H_INCLUDED 48c2ecf20Sopenharmony_ci 58c2ecf20Sopenharmony_ci#include <linux/mutex.h> 68c2ecf20Sopenharmony_ci#include <linux/types.h> 78c2ecf20Sopenharmony_ci 88c2ecf20Sopenharmony_cistruct fw_unit; 98c2ecf20Sopenharmony_ci 108c2ecf20Sopenharmony_ci/** 118c2ecf20Sopenharmony_ci * struct fw_iso_resources - manages channel/bandwidth allocation 128c2ecf20Sopenharmony_ci * @channels_mask: if the device does not support all channel numbers, set this 138c2ecf20Sopenharmony_ci * bit mask to something else than the default (all ones) 148c2ecf20Sopenharmony_ci * 158c2ecf20Sopenharmony_ci * This structure manages (de)allocation of isochronous resources (channel and 168c2ecf20Sopenharmony_ci * bandwidth) for one isochronous stream. 178c2ecf20Sopenharmony_ci */ 188c2ecf20Sopenharmony_cistruct fw_iso_resources { 198c2ecf20Sopenharmony_ci u64 channels_mask; 208c2ecf20Sopenharmony_ci /* private: */ 218c2ecf20Sopenharmony_ci struct fw_unit *unit; 228c2ecf20Sopenharmony_ci struct mutex mutex; 238c2ecf20Sopenharmony_ci unsigned int channel; 248c2ecf20Sopenharmony_ci unsigned int bandwidth; /* in bandwidth units, without overhead */ 258c2ecf20Sopenharmony_ci unsigned int bandwidth_overhead; 268c2ecf20Sopenharmony_ci int generation; /* in which allocation is valid */ 278c2ecf20Sopenharmony_ci bool allocated; 288c2ecf20Sopenharmony_ci}; 298c2ecf20Sopenharmony_ci 308c2ecf20Sopenharmony_ciint fw_iso_resources_init(struct fw_iso_resources *r, 318c2ecf20Sopenharmony_ci struct fw_unit *unit); 328c2ecf20Sopenharmony_civoid fw_iso_resources_destroy(struct fw_iso_resources *r); 338c2ecf20Sopenharmony_ci 348c2ecf20Sopenharmony_ciint fw_iso_resources_allocate(struct fw_iso_resources *r, 358c2ecf20Sopenharmony_ci unsigned int max_payload_bytes, int speed); 368c2ecf20Sopenharmony_ciint fw_iso_resources_update(struct fw_iso_resources *r); 378c2ecf20Sopenharmony_civoid fw_iso_resources_free(struct fw_iso_resources *r); 388c2ecf20Sopenharmony_ci 398c2ecf20Sopenharmony_ci#endif 40