/* SPDX-License-Identifier: (GPL-2.0 OR BSD-3-Clause) */
/*
 * Copyright (c) 2020 MediaTek Inc.
 */

#ifndef MDRV_DEMUX_FH_H
#define MDRV_DEMUX_FH_H

#include <linux/types.h>
#include <linux/list.h>
#include <linux/mutex.h>

struct dmx_fh_mgr {
	spinlock_t			fh_lock;
	struct list_head	fh_list;
};

struct dmx_fh {
	struct list_head	list;
	struct dmx_fh_mgr	*mgr;

	/* Events */
	wait_queue_head_t	wait;
	struct mutex		subscribe_lock;
	struct list_head	subscribed;
	struct list_head	available;
	u32					navailable;
	u32					sequence;
};

int  mdrv_demux_fh_init(struct dmx_fh *fh, struct dmx_fh_mgr *mgr);
void mdrv_demux_fh_add(struct dmx_fh *fh);
void mdrv_demux_fh_del(struct dmx_fh *fh);
int  mdrv_demux_fh_exit(struct dmx_fh *fh);

#endif	/* MDRV_DEMUX_FH_H */
