#define __DVB_CORE__
#define pr_fmt(fmt) …
#include <linux/string.h>
#include <linux/kernel.h>
#include <linux/sched/signal.h>
#include <linux/wait.h>
#include <linux/slab.h>
#include <linux/poll.h>
#include <linux/semaphore.h>
#include <linux/module.h>
#include <linux/nospec.h>
#include <linux/list.h>
#include <linux/freezer.h>
#include <linux/jiffies.h>
#include <linux/kthread.h>
#include <linux/ktime.h>
#include <linux/compat.h>
#include <asm/processor.h>
#include <media/dvb_frontend.h>
#include <media/dvbdev.h>
#include <linux/dvb/version.h>
static int dvb_frontend_debug;
static int dvb_shutdown_timeout;
static int dvb_force_auto_inversion;
static int dvb_override_tune_delay;
static int dvb_powerdown_on_sleep = …;
static int dvb_mfe_wait_time = …;
module_param_named(frontend_debug, dvb_frontend_debug, int, 0644);
MODULE_PARM_DESC(…) …;
module_param(dvb_shutdown_timeout, int, 0644);
MODULE_PARM_DESC(…) …;
module_param(dvb_force_auto_inversion, int, 0644);
MODULE_PARM_DESC(…) …;
module_param(dvb_override_tune_delay, int, 0644);
MODULE_PARM_DESC(…) …;
module_param(dvb_powerdown_on_sleep, int, 0644);
MODULE_PARM_DESC(…) …;
module_param(dvb_mfe_wait_time, int, 0644);
MODULE_PARM_DESC(…) …;
#define dprintk(fmt, arg...) …
#define FESTATE_IDLE …
#define FESTATE_RETUNE …
#define FESTATE_TUNING_FAST …
#define FESTATE_TUNING_SLOW …
#define FESTATE_TUNED …
#define FESTATE_ZIGZAG_FAST …
#define FESTATE_ZIGZAG_SLOW …
#define FESTATE_DISEQC …
#define FESTATE_ERROR …
#define FESTATE_WAITFORLOCK …
#define FESTATE_SEARCHING_FAST …
#define FESTATE_SEARCHING_SLOW …
#define FESTATE_LOSTLOCK …
static DEFINE_MUTEX(frontend_mutex);
struct dvb_frontend_private { … };
static void dvb_frontend_invoke_release(struct dvb_frontend *fe,
void (*release)(struct dvb_frontend *fe));
static void __dvb_frontend_free(struct dvb_frontend *fe)
{ … }
static void dvb_frontend_free(struct kref *ref)
{ … }
static void dvb_frontend_put(struct dvb_frontend *fe)
{ … }
static void dvb_frontend_get(struct dvb_frontend *fe)
{ … }
static void dvb_frontend_wakeup(struct dvb_frontend *fe);
static int dtv_get_frontend(struct dvb_frontend *fe,
struct dtv_frontend_properties *c,
struct dvb_frontend_parameters *p_out);
static int
dtv_property_legacy_params_sync(struct dvb_frontend *fe,
const struct dtv_frontend_properties *c,
struct dvb_frontend_parameters *p);
static bool has_get_frontend(struct dvb_frontend *fe)
{ … }
enum dvbv3_emulation_type { … };
static enum dvbv3_emulation_type dvbv3_type(u32 delivery_system)
{ … }
static void dvb_frontend_add_event(struct dvb_frontend *fe,
enum fe_status status)
{ … }
static int dvb_frontend_test_event(struct dvb_frontend_private *fepriv,
struct dvb_fe_events *events)
{ … }
static int dvb_frontend_get_event(struct dvb_frontend *fe,
struct dvb_frontend_event *event, int flags)
{ … }
static void dvb_frontend_clear_events(struct dvb_frontend *fe)
{ … }
static void dvb_frontend_init(struct dvb_frontend *fe)
{ … }
void dvb_frontend_reinitialise(struct dvb_frontend *fe)
{ … }
EXPORT_SYMBOL(…);
static void dvb_frontend_swzigzag_update_delay(struct dvb_frontend_private *fepriv, int locked)
{ … }
static int dvb_frontend_swzigzag_autotune(struct dvb_frontend *fe, int check_wrapped)
{ … }
static void dvb_frontend_swzigzag(struct dvb_frontend *fe)
{ … }
static int dvb_frontend_is_exiting(struct dvb_frontend *fe)
{ … }
static int dvb_frontend_should_wakeup(struct dvb_frontend *fe)
{ … }
static void dvb_frontend_wakeup(struct dvb_frontend *fe)
{ … }
static int dvb_frontend_thread(void *data)
{ … }
static void dvb_frontend_stop(struct dvb_frontend *fe)
{ … }
void dvb_frontend_sleep_until(ktime_t *waketime, u32 add_usec)
{ … }
EXPORT_SYMBOL(…);
static int dvb_frontend_start(struct dvb_frontend *fe)
{ … }
static void dvb_frontend_get_frequency_limits(struct dvb_frontend *fe,
u32 *freq_min, u32 *freq_max,
u32 *tolerance)
{ … }
static u32 dvb_frontend_get_stepsize(struct dvb_frontend *fe)
{ … }
static int dvb_frontend_check_parameters(struct dvb_frontend *fe)
{ … }
static int dvb_frontend_clear_cache(struct dvb_frontend *fe)
{ … }
#define _DTV_CMD(n) …
static char *dtv_cmds[DTV_MAX_COMMAND + 1] = …;
static char *dtv_cmd_name(u32 cmd)
{ … }
static int dtv_property_cache_sync(struct dvb_frontend *fe,
struct dtv_frontend_properties *c,
const struct dvb_frontend_parameters *p)
{ … }
static int
dtv_property_legacy_params_sync(struct dvb_frontend *fe,
const struct dtv_frontend_properties *c,
struct dvb_frontend_parameters *p)
{ … }
static int dtv_get_frontend(struct dvb_frontend *fe,
struct dtv_frontend_properties *c,
struct dvb_frontend_parameters *p_out)
{ … }
static int dvb_frontend_handle_ioctl(struct file *file,
unsigned int cmd, void *parg);
static int dtv_property_process_get(struct dvb_frontend *fe,
const struct dtv_frontend_properties *c,
struct dtv_property *tvp,
struct file *file)
{ … }
static int dtv_set_frontend(struct dvb_frontend *fe);
static bool is_dvbv3_delsys(u32 delsys)
{ … }
static int emulate_delivery_system(struct dvb_frontend *fe, u32 delsys)
{ … }
static int dvbv5_set_delivery_system(struct dvb_frontend *fe,
u32 desired_system)
{ … }
static int dvbv3_set_delivery_system(struct dvb_frontend *fe)
{ … }
static void prepare_tuning_algo_parameters(struct dvb_frontend *fe)
{ … }
static int dtv_property_process_set(struct dvb_frontend *fe,
struct file *file,
u32 cmd, u32 data)
{ … }
static int dvb_frontend_do_ioctl(struct file *file, unsigned int cmd,
void *parg)
{ … }
static long dvb_frontend_ioctl(struct file *file, unsigned int cmd,
unsigned long arg)
{ … }
#ifdef CONFIG_COMPAT
struct compat_dtv_property { … } __attribute__ ((packed));
struct compat_dtv_properties { … };
#define COMPAT_FE_SET_PROPERTY …
#define COMPAT_FE_GET_PROPERTY …
static int dvb_frontend_handle_compat_ioctl(struct file *file, unsigned int cmd,
unsigned long arg)
{ … }
static long dvb_frontend_compat_ioctl(struct file *file, unsigned int cmd,
unsigned long arg)
{ … }
#endif
static int dtv_set_frontend(struct dvb_frontend *fe)
{ … }
static int dvb_get_property(struct dvb_frontend *fe, struct file *file,
struct dtv_properties *tvps)
{ … }
static int dvb_get_frontend(struct dvb_frontend *fe,
struct dvb_frontend_parameters *p_out)
{ … }
static int dvb_frontend_handle_ioctl(struct file *file,
unsigned int cmd, void *parg)
{ … }
static __poll_t dvb_frontend_poll(struct file *file, struct poll_table_struct *wait)
{ … }
static int dvb_frontend_open(struct inode *inode, struct file *file)
{ … }
static int dvb_frontend_release(struct inode *inode, struct file *file)
{ … }
static const struct file_operations dvb_frontend_fops = …;
int dvb_frontend_suspend(struct dvb_frontend *fe)
{ … }
EXPORT_SYMBOL(…);
int dvb_frontend_resume(struct dvb_frontend *fe)
{ … }
EXPORT_SYMBOL(…);
int dvb_register_frontend(struct dvb_adapter *dvb,
struct dvb_frontend *fe)
{ … }
EXPORT_SYMBOL(…);
int dvb_unregister_frontend(struct dvb_frontend *fe)
{ … }
EXPORT_SYMBOL(…);
static void dvb_frontend_invoke_release(struct dvb_frontend *fe,
void (*release)(struct dvb_frontend *fe))
{ … }
void dvb_frontend_detach(struct dvb_frontend *fe)
{ … }
EXPORT_SYMBOL(…);