Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2)  * demux.h
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4)  * The Kernel Digital TV Demux kABI defines a driver-internal interface for
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5)  * registering low-level, hardware specific driver to a hardware independent
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6)  * demux layer.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8)  * Copyright (c) 2002 Convergence GmbH
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10)  * based on code:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11)  * Copyright (c) 2000 Nokia Research Center
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12)  *                    Tampere, FINLAND
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14)  * This program is free software; you can redistribute it and/or
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15)  * modify it under the terms of the GNU Lesser General Public License
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16)  * as published by the Free Software Foundation; either version 2.1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17)  * of the License, or (at your option) any later version.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19)  * This program is distributed in the hope that it will be useful,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20)  * but WITHOUT ANY WARRANTY; without even the implied warranty of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21)  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22)  * GNU General Public License for more details.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26) #ifndef __DEMUX_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27) #define __DEMUX_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29) #include <linux/types.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30) #include <linux/errno.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) #include <linux/list.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) #include <linux/time.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) #include <linux/dvb/dmx.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36)  * Common definitions
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40)  * DMX_MAX_FILTER_SIZE: Maximum length (in bytes) of a section/PES filter.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) #ifndef DMX_MAX_FILTER_SIZE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) #define DMX_MAX_FILTER_SIZE 18
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48)  * DMX_MAX_SECFEED_SIZE: Maximum length (in bytes) of a private section feed
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49)  * filter.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) #ifndef DMX_MAX_SECTION_SIZE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) #define DMX_MAX_SECTION_SIZE 4096
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) #ifndef DMX_MAX_SECFEED_SIZE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) #define DMX_MAX_SECFEED_SIZE (DMX_MAX_SECTION_SIZE + 188)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60)  * TS packet reception
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64)  * enum ts_filter_type - filter type bitmap for dmx_ts_feed.set\(\)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66)  * @TS_PACKET:		Send TS packets (188 bytes) to callback (default).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67)  * @TS_PAYLOAD_ONLY:	In case TS_PACKET is set, only send the TS payload
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68)  *			(<=184 bytes per packet) to callback
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69)  * @TS_DECODER:		Send stream to built-in decoder (if present).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70)  * @TS_DEMUX:		In case TS_PACKET is set, send the TS to the demux
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71)  *			device, not to the dvr device
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) enum ts_filter_type {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) 	TS_PACKET = 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) 	TS_PAYLOAD_ONLY = 2,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) 	TS_DECODER = 4,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) 	TS_DEMUX = 8,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81)  * struct dmx_ts_feed - Structure that contains a TS feed filter
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83)  * @is_filtering:	Set to non-zero when filtering in progress
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84)  * @parent:		pointer to struct dmx_demux
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85)  * @priv:		pointer to private data of the API client
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86)  * @set:		sets the TS filter
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87)  * @start_filtering:	starts TS filtering
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88)  * @stop_filtering:	stops TS filtering
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90)  * A TS feed is typically mapped to a hardware PID filter on the demux chip.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91)  * Using this API, the client can set the filtering properties to start/stop
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92)  * filtering TS packets on a particular TS feed.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) struct dmx_ts_feed {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) 	int is_filtering;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) 	struct dmx_demux *parent;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) 	void *priv;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) 	int (*set)(struct dmx_ts_feed *feed,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) 		   u16 pid,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) 		   int type,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) 		   enum dmx_ts_pes pes_type,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) 		   ktime_t timeout);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) 	int (*start_filtering)(struct dmx_ts_feed *feed);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) 	int (*stop_filtering)(struct dmx_ts_feed *feed);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108)  * Section reception
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112)  * struct dmx_section_filter - Structure that describes a section filter
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114)  * @filter_value: Contains up to 16 bytes (128 bits) of the TS section header
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115)  *		  that will be matched by the section filter
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116)  * @filter_mask:  Contains a 16 bytes (128 bits) filter mask with the bits
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117)  *		  specified by @filter_value that will be used on the filter
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118)  *		  match logic.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119)  * @filter_mode:  Contains a 16 bytes (128 bits) filter mode.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120)  * @parent:	  Back-pointer to struct dmx_section_feed.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121)  * @priv:	  Pointer to private data of the API client.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124)  * The @filter_mask controls which bits of @filter_value are compared with
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125)  * the section headers/payload. On a binary value of 1 in filter_mask, the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126)  * corresponding bits are compared. The filter only accepts sections that are
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127)  * equal to filter_value in all the tested bit positions.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) struct dmx_section_filter {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) 	u8 filter_value[DMX_MAX_FILTER_SIZE];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) 	u8 filter_mask[DMX_MAX_FILTER_SIZE];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) 	u8 filter_mode[DMX_MAX_FILTER_SIZE];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) 	struct dmx_section_feed *parent;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) 	void *priv;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139)  * struct dmx_section_feed - Structure that contains a section feed filter
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141)  * @is_filtering:	Set to non-zero when filtering in progress
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142)  * @parent:		pointer to struct dmx_demux
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143)  * @priv:		pointer to private data of the API client
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144)  * @check_crc:		If non-zero, check the CRC values of filtered sections.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145)  * @set:		sets the section filter
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146)  * @allocate_filter:	This function is used to allocate a section filter on
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147)  *			the demux. It should only be called when no filtering
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148)  *			is in progress on this section feed. If a filter cannot
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149)  *			be allocated, the function fails with -ENOSPC.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150)  * @release_filter:	This function releases all the resources of a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151)  *			previously allocated section filter. The function
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152)  *			should not be called while filtering is in progress
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153)  *			on this section feed. After calling this function,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154)  *			the caller should not try to dereference the filter
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155)  *			pointer.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156)  * @start_filtering:	starts section filtering
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157)  * @stop_filtering:	stops section filtering
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159)  * A TS feed is typically mapped to a hardware PID filter on the demux chip.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160)  * Using this API, the client can set the filtering properties to start/stop
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161)  * filtering TS packets on a particular TS feed.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) struct dmx_section_feed {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) 	int is_filtering;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) 	struct dmx_demux *parent;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) 	void *priv;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) 	int check_crc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) 	/* private: Used internally at dvb_demux.c */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) 	u32 crc_val;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) 	u8 *secbuf;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) 	u8 secbuf_base[DMX_MAX_SECFEED_SIZE];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) 	u16 secbufp, seclen, tsfeedp;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) 	/* public: */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) 	int (*set)(struct dmx_section_feed *feed,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) 		   u16 pid,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) 		   int check_crc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) 	int (*allocate_filter)(struct dmx_section_feed *feed,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) 			       struct dmx_section_filter **filter);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) 	int (*release_filter)(struct dmx_section_feed *feed,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) 			      struct dmx_section_filter *filter);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) 	int (*start_filtering)(struct dmx_section_feed *feed);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) 	int (*stop_filtering)(struct dmx_section_feed *feed);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190)  * typedef dmx_ts_cb - DVB demux TS filter callback function prototype
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192)  * @buffer1:		Pointer to the start of the filtered TS packets.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193)  * @buffer1_length:	Length of the TS data in buffer1.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194)  * @buffer2:		Pointer to the tail of the filtered TS packets, or NULL.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195)  * @buffer2_length:	Length of the TS data in buffer2.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196)  * @source:		Indicates which TS feed is the source of the callback.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197)  * @buffer_flags:	Address where buffer flags are stored. Those are
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198)  *			used to report discontinuity users via DVB
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199)  *			memory mapped API, as defined by
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200)  *			&enum dmx_buffer_flags.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202)  * This function callback prototype, provided by the client of the demux API,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203)  * is called from the demux code. The function is only called when filtering
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204)  * on a TS feed has been enabled using the start_filtering\(\) function at
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205)  * the &dmx_demux.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206)  * Any TS packets that match the filter settings are copied to a circular
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207)  * buffer. The filtered TS packets are delivered to the client using this
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208)  * callback function.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209)  * It is expected that the @buffer1 and @buffer2 callback parameters point to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210)  * addresses within the circular buffer, but other implementations are also
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211)  * possible. Note that the called party should not try to free the memory
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212)  * the @buffer1 and @buffer2 parameters point to.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214)  * When this function is called, the @buffer1 parameter typically points to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215)  * the start of the first undelivered TS packet within a circular buffer.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216)  * The @buffer2 buffer parameter is normally NULL, except when the received
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217)  * TS packets have crossed the last address of the circular buffer and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218)  * "wrapped" to the beginning of the buffer. In the latter case the @buffer1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219)  * parameter would contain an address within the circular buffer, while the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220)  * @buffer2 parameter would contain the first address of the circular buffer.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221)  * The number of bytes delivered with this function (i.e. @buffer1_length +
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222)  * @buffer2_length) is usually equal to the value of callback_length parameter
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223)  * given in the set() function, with one exception: if a timeout occurs before
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224)  * receiving callback_length bytes of TS data, any undelivered packets are
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225)  * immediately delivered to the client by calling this function. The timeout
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226)  * duration is controlled by the set() function in the TS Feed API.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228)  * If a TS packet is received with errors that could not be fixed by the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229)  * TS-level forward error correction (FEC), the Transport_error_indicator
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230)  * flag of the TS packet header should be set. The TS packet should not be
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231)  * discarded, as the error can possibly be corrected by a higher layer
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232)  * protocol. If the called party is slow in processing the callback, it
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233)  * is possible that the circular buffer eventually fills up. If this happens,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234)  * the demux driver should discard any TS packets received while the buffer
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235)  * is full and return -EOVERFLOW.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237)  * The type of data returned to the callback can be selected by the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238)  * &dmx_ts_feed.@set function. The type parameter decides if the raw
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239)  * TS packet (TS_PACKET) or just the payload (TS_PACKET|TS_PAYLOAD_ONLY)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240)  * should be returned. If additionally the TS_DECODER bit is set the stream
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241)  * will also be sent to the hardware MPEG decoder.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243)  * Return:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245)  * - 0, on success;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247)  * - -EOVERFLOW, on buffer overflow.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) typedef int (*dmx_ts_cb)(const u8 *buffer1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) 			 size_t buffer1_length,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) 			 const u8 *buffer2,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) 			 size_t buffer2_length,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) 			 struct dmx_ts_feed *source,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254) 			 u32 *buffer_flags);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257)  * typedef dmx_section_cb - DVB demux TS filter callback function prototype
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259)  * @buffer1:		Pointer to the start of the filtered section, e.g.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260)  *			within the circular buffer of the demux driver.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261)  * @buffer1_len:	Length of the filtered section data in @buffer1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262)  *			including headers and CRC.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263)  * @buffer2:		Pointer to the tail of the filtered section data,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264)  *			or NULL. Useful to handle the wrapping of a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265)  *			circular buffer.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266)  * @buffer2_len:	Length of the filtered section data in @buffer2,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267)  *			including headers and CRC.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268)  * @source:		Indicates which section feed is the source of the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269)  *			callback.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270)  * @buffer_flags:	Address where buffer flags are stored. Those are
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271)  *			used to report discontinuity users via DVB
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272)  *			memory mapped API, as defined by
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273)  *			&enum dmx_buffer_flags.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275)  * This function callback prototype, provided by the client of the demux API,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276)  * is called from the demux code. The function is only called when
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 277)  * filtering of sections has been enabled using the function
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 278)  * &dmx_ts_feed.@start_filtering. When the demux driver has received a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 279)  * complete section that matches at least one section filter, the client
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 280)  * is notified via this callback function. Normally this function is called
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 281)  * for each received section; however, it is also possible to deliver
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 282)  * multiple sections with one callback, for example when the system load
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 283)  * is high. If an error occurs while receiving a section, this
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 284)  * function should be called with the corresponding error type set in the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 285)  * success field, whether or not there is data to deliver. The Section Feed
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 286)  * implementation should maintain a circular buffer for received sections.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 287)  * However, this is not necessary if the Section Feed API is implemented as
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 288)  * a client of the TS Feed API, because the TS Feed implementation then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 289)  * buffers the received data. The size of the circular buffer can be
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 290)  * configured using the &dmx_ts_feed.@set function in the Section Feed API.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 291)  * If there is no room in the circular buffer when a new section is received,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 292)  * the section must be discarded. If this happens, the value of the success
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 293)  * parameter should be DMX_OVERRUN_ERROR on the next callback.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 294)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 295) typedef int (*dmx_section_cb)(const u8 *buffer1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 296) 			      size_t buffer1_len,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 297) 			      const u8 *buffer2,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 298) 			      size_t buffer2_len,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 299) 			      struct dmx_section_filter *source,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 300) 			      u32 *buffer_flags);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 301) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 302) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 303)  * DVB Front-End
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 304)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 305) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 306) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 307)  * enum dmx_frontend_source - Used to identify the type of frontend
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 308)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 309)  * @DMX_MEMORY_FE:	The source of the demux is memory. It means that
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 310)  *			the MPEG-TS to be filtered comes from userspace,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 311)  *			via write() syscall.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 312)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 313)  * @DMX_FRONTEND_0:	The source of the demux is a frontend connected
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 314)  *			to the demux.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 315)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 316) enum dmx_frontend_source {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 317) 	DMX_MEMORY_FE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 318) 	DMX_FRONTEND_0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 319) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 320) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 321) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 322)  * struct dmx_frontend - Structure that lists the frontends associated with
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 323)  *			 a demux
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 324)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 325)  * @connectivity_list:	List of front-ends that can be connected to a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 326)  *			particular demux;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 327)  * @source:		Type of the frontend.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 328)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 329)  * FIXME: this structure should likely be replaced soon by some
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 330)  *	media-controller based logic.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 331)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 332) struct dmx_frontend {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 333) 	struct list_head connectivity_list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 334) 	enum dmx_frontend_source source;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 335) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 336) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 337) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 338)  * MPEG-2 TS Demux
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 339)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 340) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 341) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 342)  * enum dmx_demux_caps - MPEG-2 TS Demux capabilities bitmap
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 343)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 344)  * @DMX_TS_FILTERING:		set if TS filtering is supported;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 345)  * @DMX_SECTION_FILTERING:	set if section filtering is supported;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 346)  * @DMX_MEMORY_BASED_FILTERING:	set if write() available.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 347)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 348)  * Those flags are OR'ed in the &dmx_demux.capabilities field
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 349)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 350) enum dmx_demux_caps {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 351) 	DMX_TS_FILTERING = 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 352) 	DMX_SECTION_FILTERING = 4,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 353) 	DMX_MEMORY_BASED_FILTERING = 8,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 354) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 355) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 356) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 357)  * Demux resource type identifier.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 358)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 359) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 360) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 361)  * DMX_FE_ENTRY - Casts elements in the list of registered
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 362)  *		  front-ends from the generic type struct list_head
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 363)  *		  to the type * struct dmx_frontend
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 364)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 365)  * @list: list of struct dmx_frontend
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 366)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 367) #define DMX_FE_ENTRY(list) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 368) 	list_entry(list, struct dmx_frontend, connectivity_list)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 369) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 370) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 371)  * struct dmx_demux - Structure that contains the demux capabilities and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 372)  *		      callbacks.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 373)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 374)  * @capabilities: Bitfield of capability flags.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 375)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 376)  * @frontend: Front-end connected to the demux
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 377)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 378)  * @priv: Pointer to private data of the API client
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 379)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 380)  * @open: This function reserves the demux for use by the caller and, if
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 381)  *	necessary, initializes the demux. When the demux is no longer needed,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 382)  *	the function @close should be called. It should be possible for
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 383)  *	multiple clients to access the demux at the same time. Thus, the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 384)  *	function implementation should increment the demux usage count when
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 385)  *	@open is called and decrement it when @close is called.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 386)  *	The @demux function parameter contains a pointer to the demux API and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 387)  *	instance data.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 388)  *	It returns:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 389)  *	0 on success;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 390)  *	-EUSERS, if maximum usage count was reached;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 391)  *	-EINVAL, on bad parameter.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 392)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 393)  * @close: This function reserves the demux for use by the caller and, if
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 394)  *	necessary, initializes the demux. When the demux is no longer needed,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 395)  *	the function @close should be called. It should be possible for
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 396)  *	multiple clients to access the demux at the same time. Thus, the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 397)  *	function implementation should increment the demux usage count when
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 398)  *	@open is called and decrement it when @close is called.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 399)  *	The @demux function parameter contains a pointer to the demux API and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 400)  *	instance data.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 401)  *	It returns:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 402)  *	0 on success;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 403)  *	-ENODEV, if demux was not in use (e. g. no users);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 404)  *	-EINVAL, on bad parameter.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 405)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 406)  * @write: This function provides the demux driver with a memory buffer
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 407)  *	containing TS packets. Instead of receiving TS packets from the DVB
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 408)  *	front-end, the demux driver software will read packets from memory.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 409)  *	Any clients of this demux with active TS, PES or Section filters will
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 410)  *	receive filtered data via the Demux callback API (see 0). The function
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 411)  *	returns when all the data in the buffer has been consumed by the demux.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 412)  *	Demux hardware typically cannot read TS from memory. If this is the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 413)  *	case, memory-based filtering has to be implemented entirely in software.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 414)  *	The @demux function parameter contains a pointer to the demux API and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 415)  *	instance data.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 416)  *	The @buf function parameter contains a pointer to the TS data in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 417)  *	kernel-space memory.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 418)  *	The @count function parameter contains the length of the TS data.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 419)  *	It returns:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 420)  *	0 on success;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 421)  *	-ERESTARTSYS, if mutex lock was interrupted;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 422)  *	-EINTR, if a signal handling is pending;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 423)  *	-ENODEV, if demux was removed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 424)  *	-EINVAL, on bad parameter.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 425)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 426)  * @allocate_ts_feed: Allocates a new TS feed, which is used to filter the TS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 427)  *	packets carrying a certain PID. The TS feed normally corresponds to a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 428)  *	hardware PID filter on the demux chip.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 429)  *	The @demux function parameter contains a pointer to the demux API and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 430)  *	instance data.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 431)  *	The @feed function parameter contains a pointer to the TS feed API and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 432)  *	instance data.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 433)  *	The @callback function parameter contains a pointer to the callback
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 434)  *	function for passing received TS packet.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 435)  *	It returns:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 436)  *	0 on success;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 437)  *	-ERESTARTSYS, if mutex lock was interrupted;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 438)  *	-EBUSY, if no more TS feeds is available;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 439)  *	-EINVAL, on bad parameter.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 440)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 441)  * @release_ts_feed: Releases the resources allocated with @allocate_ts_feed.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 442)  *	Any filtering in progress on the TS feed should be stopped before
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 443)  *	calling this function.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 444)  *	The @demux function parameter contains a pointer to the demux API and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 445)  *	instance data.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 446)  *	The @feed function parameter contains a pointer to the TS feed API and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 447)  *	instance data.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 448)  *	It returns:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 449)  *	0 on success;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 450)  *	-EINVAL on bad parameter.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 451)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 452)  * @allocate_section_feed: Allocates a new section feed, i.e. a demux resource
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 453)  *	for filtering and receiving sections. On platforms with hardware
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 454)  *	support for section filtering, a section feed is directly mapped to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 455)  *	the demux HW. On other platforms, TS packets are first PID filtered in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 456)  *	hardware and a hardware section filter then emulated in software. The
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 457)  *	caller obtains an API pointer of type dmx_section_feed_t as an out
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 458)  *	parameter. Using this API the caller can set filtering parameters and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 459)  *	start receiving sections.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 460)  *	The @demux function parameter contains a pointer to the demux API and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 461)  *	instance data.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 462)  *	The @feed function parameter contains a pointer to the TS feed API and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 463)  *	instance data.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 464)  *	The @callback function parameter contains a pointer to the callback
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 465)  *	function for passing received TS packet.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 466)  *	It returns:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 467)  *	0 on success;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 468)  *	-EBUSY, if no more TS feeds is available;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 469)  *	-EINVAL, on bad parameter.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 470)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 471)  * @release_section_feed: Releases the resources allocated with
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 472)  *	@allocate_section_feed, including allocated filters. Any filtering in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 473)  *	progress on the section feed should be stopped before calling this
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 474)  *	function.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 475)  *	The @demux function parameter contains a pointer to the demux API and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 476)  *	instance data.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 477)  *	The @feed function parameter contains a pointer to the TS feed API and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 478)  *	instance data.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 479)  *	It returns:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 480)  *	0 on success;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 481)  *	-EINVAL, on bad parameter.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 482)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 483)  * @add_frontend: Registers a connectivity between a demux and a front-end,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 484)  *	i.e., indicates that the demux can be connected via a call to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 485)  *	@connect_frontend to use the given front-end as a TS source. The
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 486)  *	client of this function has to allocate dynamic or static memory for
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 487)  *	the frontend structure and initialize its fields before calling this
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 488)  *	function. This function is normally called during the driver
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 489)  *	initialization. The caller must not free the memory of the frontend
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 490)  *	struct before successfully calling @remove_frontend.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 491)  *	The @demux function parameter contains a pointer to the demux API and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 492)  *	instance data.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 493)  *	The @frontend function parameter contains a pointer to the front-end
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 494)  *	instance data.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 495)  *	It returns:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 496)  *	0 on success;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 497)  *	-EINVAL, on bad parameter.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 498)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 499)  * @remove_frontend: Indicates that the given front-end, registered by a call
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 500)  *	to @add_frontend, can no longer be connected as a TS source by this
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 501)  *	demux. The function should be called when a front-end driver or a demux
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 502)  *	driver is removed from the system. If the front-end is in use, the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 503)  *	function fails with the return value of -EBUSY. After successfully
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 504)  *	calling this function, the caller can free the memory of the frontend
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 505)  *	struct if it was dynamically allocated before the @add_frontend
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 506)  *	operation.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 507)  *	The @demux function parameter contains a pointer to the demux API and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 508)  *	instance data.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 509)  *	The @frontend function parameter contains a pointer to the front-end
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 510)  *	instance data.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 511)  *	It returns:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 512)  *	0 on success;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 513)  *	-ENODEV, if the front-end was not found,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 514)  *	-EINVAL, on bad parameter.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 515)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 516)  * @get_frontends: Provides the APIs of the front-ends that have been
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 517)  *	registered for this demux. Any of the front-ends obtained with this
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 518)  *	call can be used as a parameter for @connect_frontend. The include
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 519)  *	file demux.h contains the macro DMX_FE_ENTRY() for converting an
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 520)  *	element of the generic type struct &list_head * to the type
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 521)  *	struct &dmx_frontend *. The caller must not free the memory of any of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 522)  *	the elements obtained via this function call.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 523)  *	The @demux function parameter contains a pointer to the demux API and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 524)  *	instance data.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 525)  *	It returns a struct list_head pointer to the list of front-end
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 526)  *	interfaces, or NULL in the case of an empty list.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 527)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 528)  * @connect_frontend: Connects the TS output of the front-end to the input of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 529)  *	the demux. A demux can only be connected to a front-end registered to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 530)  *	the demux with the function @add_frontend. It may or may not be
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 531)  *	possible to connect multiple demuxes to the same front-end, depending
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 532)  *	on the capabilities of the HW platform. When not used, the front-end
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 533)  *	should be released by calling @disconnect_frontend.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 534)  *	The @demux function parameter contains a pointer to the demux API and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 535)  *	instance data.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 536)  *	The @frontend function parameter contains a pointer to the front-end
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 537)  *	instance data.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 538)  *	It returns:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 539)  *	0 on success;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 540)  *	-EINVAL, on bad parameter.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 541)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 542)  * @disconnect_frontend: Disconnects the demux and a front-end previously
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 543)  *	connected by a @connect_frontend call.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 544)  *	The @demux function parameter contains a pointer to the demux API and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 545)  *	instance data.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 546)  *	It returns:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 547)  *	0 on success;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 548)  *	-EINVAL on bad parameter.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 549)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 550)  * @get_pes_pids: Get the PIDs for DMX_PES_AUDIO0, DMX_PES_VIDEO0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 551)  *	DMX_PES_TELETEXT0, DMX_PES_SUBTITLE0 and DMX_PES_PCR0.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 552)  *	The @demux function parameter contains a pointer to the demux API and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 553)  *	instance data.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 554)  *	The @pids function parameter contains an array with five u16 elements
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 555)  *	where the PIDs will be stored.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 556)  *	It returns:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 557)  *	0 on success;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 558)  *	-EINVAL on bad parameter.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 559)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 560) struct dmx_demux {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 561) 	enum dmx_demux_caps capabilities;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 562) 	struct dmx_frontend *frontend;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 563) 	void *priv;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 564) 	int (*open)(struct dmx_demux *demux);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 565) 	int (*close)(struct dmx_demux *demux);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 566) 	int (*write)(struct dmx_demux *demux, const char __user *buf,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 567) 		     size_t count);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 568) 	int (*allocate_ts_feed)(struct dmx_demux *demux,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 569) 				struct dmx_ts_feed **feed,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 570) 				dmx_ts_cb callback);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 571) 	int (*release_ts_feed)(struct dmx_demux *demux,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 572) 			       struct dmx_ts_feed *feed);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 573) 	int (*allocate_section_feed)(struct dmx_demux *demux,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 574) 				     struct dmx_section_feed **feed,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 575) 				     dmx_section_cb callback);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 576) 	int (*release_section_feed)(struct dmx_demux *demux,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 577) 				    struct dmx_section_feed *feed);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 578) 	int (*add_frontend)(struct dmx_demux *demux,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 579) 			    struct dmx_frontend *frontend);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 580) 	int (*remove_frontend)(struct dmx_demux *demux,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 581) 			       struct dmx_frontend *frontend);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 582) 	struct list_head *(*get_frontends)(struct dmx_demux *demux);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 583) 	int (*connect_frontend)(struct dmx_demux *demux,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 584) 				struct dmx_frontend *frontend);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 585) 	int (*disconnect_frontend)(struct dmx_demux *demux);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 586) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 587) 	int (*get_pes_pids)(struct dmx_demux *demux, u16 *pids);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 588) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 589) 	/* private: */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 590) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 591) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 592) 	 * Only used at av7110, to read some data from firmware.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 593) 	 * As this was never documented, we have no clue about what's
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 594) 	 * there, and its usage on other drivers aren't encouraged.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 595) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 596) 	int (*get_stc)(struct dmx_demux *demux, unsigned int num,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 597) 		       u64 *stc, unsigned int *base);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 598) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 599) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 600) #endif /* #ifndef __DEMUX_H */