18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 28c2ecf20Sopenharmony_ci#ifndef SOUND_FIREWIRE_CMP_H_INCLUDED 38c2ecf20Sopenharmony_ci#define SOUND_FIREWIRE_CMP_H_INCLUDED 48c2ecf20Sopenharmony_ci 58c2ecf20Sopenharmony_ci#include <linux/mutex.h> 68c2ecf20Sopenharmony_ci#include <linux/types.h> 78c2ecf20Sopenharmony_ci#include "iso-resources.h" 88c2ecf20Sopenharmony_ci 98c2ecf20Sopenharmony_cistruct fw_unit; 108c2ecf20Sopenharmony_ci 118c2ecf20Sopenharmony_cienum cmp_direction { 128c2ecf20Sopenharmony_ci CMP_INPUT = 0, 138c2ecf20Sopenharmony_ci CMP_OUTPUT, 148c2ecf20Sopenharmony_ci}; 158c2ecf20Sopenharmony_ci 168c2ecf20Sopenharmony_ci/** 178c2ecf20Sopenharmony_ci * struct cmp_connection - manages an isochronous connection to a device 188c2ecf20Sopenharmony_ci * @speed: the connection's actual speed 198c2ecf20Sopenharmony_ci * 208c2ecf20Sopenharmony_ci * This structure manages (using CMP) an isochronous stream between the local 218c2ecf20Sopenharmony_ci * computer and a device's input plug (iPCR) and output plug (oPCR). 228c2ecf20Sopenharmony_ci * 238c2ecf20Sopenharmony_ci * There is no corresponding oPCR created on the local computer, so it is not 248c2ecf20Sopenharmony_ci * possible to overlay connections on top of this one. 258c2ecf20Sopenharmony_ci */ 268c2ecf20Sopenharmony_cistruct cmp_connection { 278c2ecf20Sopenharmony_ci int speed; 288c2ecf20Sopenharmony_ci /* private: */ 298c2ecf20Sopenharmony_ci bool connected; 308c2ecf20Sopenharmony_ci struct mutex mutex; 318c2ecf20Sopenharmony_ci struct fw_iso_resources resources; 328c2ecf20Sopenharmony_ci __be32 last_pcr_value; 338c2ecf20Sopenharmony_ci unsigned int pcr_index; 348c2ecf20Sopenharmony_ci unsigned int max_speed; 358c2ecf20Sopenharmony_ci enum cmp_direction direction; 368c2ecf20Sopenharmony_ci}; 378c2ecf20Sopenharmony_ci 388c2ecf20Sopenharmony_ciint cmp_connection_init(struct cmp_connection *connection, 398c2ecf20Sopenharmony_ci struct fw_unit *unit, 408c2ecf20Sopenharmony_ci enum cmp_direction direction, 418c2ecf20Sopenharmony_ci unsigned int pcr_index); 428c2ecf20Sopenharmony_ciint cmp_connection_check_used(struct cmp_connection *connection, bool *used); 438c2ecf20Sopenharmony_civoid cmp_connection_destroy(struct cmp_connection *connection); 448c2ecf20Sopenharmony_ci 458c2ecf20Sopenharmony_ciint cmp_connection_reserve(struct cmp_connection *connection, 468c2ecf20Sopenharmony_ci unsigned int max_payload); 478c2ecf20Sopenharmony_civoid cmp_connection_release(struct cmp_connection *connection); 488c2ecf20Sopenharmony_ci 498c2ecf20Sopenharmony_ciint cmp_connection_establish(struct cmp_connection *connection); 508c2ecf20Sopenharmony_ciint cmp_connection_update(struct cmp_connection *connection); 518c2ecf20Sopenharmony_civoid cmp_connection_break(struct cmp_connection *connection); 528c2ecf20Sopenharmony_ci 538c2ecf20Sopenharmony_ci#endif 54