18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * c8sectpfe-common.h - C8SECTPFE STi DVB driver
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci * Copyright (c) STMicroelectronics 2015
68c2ecf20Sopenharmony_ci *
78c2ecf20Sopenharmony_ci *   Author: Peter Griffin <peter.griffin@linaro.org>
88c2ecf20Sopenharmony_ci *
98c2ecf20Sopenharmony_ci */
108c2ecf20Sopenharmony_ci#ifndef _C8SECTPFE_COMMON_H_
118c2ecf20Sopenharmony_ci#define _C8SECTPFE_COMMON_H_
128c2ecf20Sopenharmony_ci
138c2ecf20Sopenharmony_ci#include <linux/dvb/dmx.h>
148c2ecf20Sopenharmony_ci#include <linux/dvb/frontend.h>
158c2ecf20Sopenharmony_ci#include <linux/gpio.h>
168c2ecf20Sopenharmony_ci#include <linux/version.h>
178c2ecf20Sopenharmony_ci
188c2ecf20Sopenharmony_ci#include <media/dmxdev.h>
198c2ecf20Sopenharmony_ci#include <media/dvb_demux.h>
208c2ecf20Sopenharmony_ci#include <media/dvb_frontend.h>
218c2ecf20Sopenharmony_ci#include <media/dvb_net.h>
228c2ecf20Sopenharmony_ci
238c2ecf20Sopenharmony_ci/* Maximum number of channels */
248c2ecf20Sopenharmony_ci#define C8SECTPFE_MAXADAPTER (4)
258c2ecf20Sopenharmony_ci#define C8SECTPFE_MAXCHANNEL 64
268c2ecf20Sopenharmony_ci#define STPTI_MAXCHANNEL 64
278c2ecf20Sopenharmony_ci
288c2ecf20Sopenharmony_ci#define MAX_INPUTBLOCKS 7
298c2ecf20Sopenharmony_ci
308c2ecf20Sopenharmony_cistruct c8sectpfe;
318c2ecf20Sopenharmony_cistruct stdemux;
328c2ecf20Sopenharmony_ci
338c2ecf20Sopenharmony_cistruct stdemux {
348c2ecf20Sopenharmony_ci	struct dvb_demux	dvb_demux;
358c2ecf20Sopenharmony_ci	struct dmxdev		dmxdev;
368c2ecf20Sopenharmony_ci	struct dmx_frontend	hw_frontend;
378c2ecf20Sopenharmony_ci	struct dmx_frontend	mem_frontend;
388c2ecf20Sopenharmony_ci	int			tsin_index;
398c2ecf20Sopenharmony_ci	int			running_feed_count;
408c2ecf20Sopenharmony_ci	struct			c8sectpfei *c8sectpfei;
418c2ecf20Sopenharmony_ci};
428c2ecf20Sopenharmony_ci
438c2ecf20Sopenharmony_cistruct c8sectpfe {
448c2ecf20Sopenharmony_ci	struct stdemux demux[MAX_INPUTBLOCKS];
458c2ecf20Sopenharmony_ci	struct mutex lock;
468c2ecf20Sopenharmony_ci	struct dvb_adapter adapter;
478c2ecf20Sopenharmony_ci	struct device *device;
488c2ecf20Sopenharmony_ci	int mapping;
498c2ecf20Sopenharmony_ci	int num_feeds;
508c2ecf20Sopenharmony_ci};
518c2ecf20Sopenharmony_ci
528c2ecf20Sopenharmony_ci/* Channel registration */
538c2ecf20Sopenharmony_ciint c8sectpfe_tuner_register_frontend(struct c8sectpfe **c8sectpfe,
548c2ecf20Sopenharmony_ci					struct c8sectpfei *fei,
558c2ecf20Sopenharmony_ci					void *start_feed,
568c2ecf20Sopenharmony_ci					void *stop_feed);
578c2ecf20Sopenharmony_ci
588c2ecf20Sopenharmony_civoid c8sectpfe_tuner_unregister_frontend(struct c8sectpfe *c8sectpfe,
598c2ecf20Sopenharmony_ci						struct c8sectpfei *fei);
608c2ecf20Sopenharmony_ci
618c2ecf20Sopenharmony_ci#endif
62