18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci#ifndef __PVRUSB2_DVB_H__
38c2ecf20Sopenharmony_ci#define __PVRUSB2_DVB_H__
48c2ecf20Sopenharmony_ci
58c2ecf20Sopenharmony_ci#include <media/dvb_frontend.h>
68c2ecf20Sopenharmony_ci#include <media/dvb_demux.h>
78c2ecf20Sopenharmony_ci#include <media/dvb_net.h>
88c2ecf20Sopenharmony_ci#include <media/dmxdev.h>
98c2ecf20Sopenharmony_ci#include "pvrusb2-context.h"
108c2ecf20Sopenharmony_ci
118c2ecf20Sopenharmony_ci#define PVR2_DVB_BUFFER_COUNT 32
128c2ecf20Sopenharmony_ci#define PVR2_DVB_BUFFER_SIZE PAGE_ALIGN(0x4000)
138c2ecf20Sopenharmony_ci
148c2ecf20Sopenharmony_cistruct pvr2_dvb_adapter {
158c2ecf20Sopenharmony_ci	struct pvr2_channel	channel;
168c2ecf20Sopenharmony_ci
178c2ecf20Sopenharmony_ci	struct dvb_adapter	dvb_adap;
188c2ecf20Sopenharmony_ci	struct dmxdev		dmxdev;
198c2ecf20Sopenharmony_ci	struct dvb_demux	demux;
208c2ecf20Sopenharmony_ci	struct dvb_net		dvb_net;
218c2ecf20Sopenharmony_ci	struct dvb_frontend	*fe[2];
228c2ecf20Sopenharmony_ci
238c2ecf20Sopenharmony_ci	struct i2c_client	*i2c_client_demod[2];
248c2ecf20Sopenharmony_ci	struct i2c_client	*i2c_client_tuner;
258c2ecf20Sopenharmony_ci
268c2ecf20Sopenharmony_ci	int			feedcount;
278c2ecf20Sopenharmony_ci	int			max_feed_count;
288c2ecf20Sopenharmony_ci
298c2ecf20Sopenharmony_ci	struct task_struct	*thread;
308c2ecf20Sopenharmony_ci	struct mutex		lock;
318c2ecf20Sopenharmony_ci
328c2ecf20Sopenharmony_ci	unsigned int		stream_run:1;
338c2ecf20Sopenharmony_ci
348c2ecf20Sopenharmony_ci	wait_queue_head_t	buffer_wait_data;
358c2ecf20Sopenharmony_ci	char			*buffer_storage[PVR2_DVB_BUFFER_COUNT];
368c2ecf20Sopenharmony_ci};
378c2ecf20Sopenharmony_ci
388c2ecf20Sopenharmony_cistruct pvr2_dvb_props {
398c2ecf20Sopenharmony_ci	int (*frontend_attach) (struct pvr2_dvb_adapter *);
408c2ecf20Sopenharmony_ci	int (*tuner_attach) (struct pvr2_dvb_adapter *);
418c2ecf20Sopenharmony_ci};
428c2ecf20Sopenharmony_ci
438c2ecf20Sopenharmony_cistruct pvr2_dvb_adapter *pvr2_dvb_create(struct pvr2_context *pvr);
448c2ecf20Sopenharmony_ci
458c2ecf20Sopenharmony_ci#endif /* __PVRUSB2_DVB_H__ */
46