linux/drivers/media/usb/pvrusb2/pvrusb2-hdw.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 *
 *  Copyright (C) 2005 Mike Isely <[email protected]>
 */

#include <linux/errno.h>
#include <linux/string.h>
#include <linux/slab.h>
#include <linux/module.h>
#include <linux/firmware.h>
#include <linux/videodev2.h>
#include <media/v4l2-common.h>
#include <media/tuner.h>
#include "pvrusb2.h"
#include "pvrusb2-std.h"
#include "pvrusb2-util.h"
#include "pvrusb2-hdw.h"
#include "pvrusb2-i2c-core.h"
#include "pvrusb2-eeprom.h"
#include "pvrusb2-hdw-internal.h"
#include "pvrusb2-encoder.h"
#include "pvrusb2-debug.h"
#include "pvrusb2-fx2-cmd.h"
#include "pvrusb2-wm8775.h"
#include "pvrusb2-video-v4l.h"
#include "pvrusb2-cx2584x-v4l.h"
#include "pvrusb2-cs53l32a.h"
#include "pvrusb2-audio.h"

#define TV_MIN_FREQ
#define TV_MAX_FREQ

/* This defines a minimum interval that the decoder must remain quiet
   before we are allowed to start it running. */
#define TIME_MSEC_DECODER_WAIT

/* This defines a minimum interval that the decoder must be allowed to run
   before we can safely begin using its streaming output. */
#define TIME_MSEC_DECODER_STABILIZATION_WAIT

/* This defines a minimum interval that the encoder must remain quiet
   before we are allowed to configure it. */
#define TIME_MSEC_ENCODER_WAIT

/* This defines the minimum interval that the encoder must successfully run
   before we consider that the encoder has run at least once since its
   firmware has been loaded.  This measurement is in important for cases
   where we can't do something until we know that the encoder has been run
   at least once. */
#define TIME_MSEC_ENCODER_OK

static struct pvr2_hdw *unit_pointers[PVR_NUM] =;
static DEFINE_MUTEX(pvr2_unit_mtx);

static int ctlchg;
static int procreload;
static int tuner[PVR_NUM] =;
static int tolerance[PVR_NUM] =;
static int video_std[PVR_NUM] =;
static int init_pause_msec;

module_param(ctlchg, int, S_IRUGO|S_IWUSR);
MODULE_PARM_DESC();
module_param(init_pause_msec, int, S_IRUGO|S_IWUSR);
MODULE_PARM_DESC();
module_param(procreload, int, S_IRUGO|S_IWUSR);
MODULE_PARM_DESC();
module_param_array();
MODULE_PARM_DESC();
module_param_array();
MODULE_PARM_DESC();
module_param_array();
MODULE_PARM_DESC();

/* US Broadcast channel 3 (61.25 MHz), to help with testing */
static int default_tv_freq    =;
/* 104.3 MHz, a usable FM station for my area */
static int default_radio_freq =;

module_param_named(tv_freq, default_tv_freq, int, 0444);
MODULE_PARM_DESC();
module_param_named(radio_freq, default_radio_freq, int, 0444);
MODULE_PARM_DESC();

#define PVR2_CTL_WRITE_ENDPOINT
#define PVR2_CTL_READ_ENDPOINT

#define PVR2_GPIO_IN
#define PVR2_GPIO_OUT
#define PVR2_GPIO_DIR

#define trace_firmware(...)

#define PVR2_FIRMWARE_ENDPOINT

/* size of a firmware chunk */
#define FIRMWARE_CHUNK_SIZE

pvr2_subdev_update_func;

static const pvr2_subdev_update_func pvr2_module_update_functions[] =;

static const char *module_names[] =;


static const unsigned char *module_i2c_addresses[] =;


static const char *ir_scheme_names[] =;


/* Define the list of additional controls we'll dynamically construct based
   on query of the cx2341x module. */
struct pvr2_mpeg_ids {};
static const struct pvr2_mpeg_ids mpeg_ids[] =;
#define MPEGDEF_COUNT


static const char *control_values_srate[] =;



static const char *control_values_input[] =;


static const char *control_values_audiomode[] =;


static const char *control_values_hsm[] =;


static const char *pvr2_state_names[] =;


struct pvr2_fx2cmd_descdef {};

static const struct pvr2_fx2cmd_descdef pvr2_fx2cmd_desc[] =;


static int pvr2_hdw_set_input(struct pvr2_hdw *hdw,int v);
static void pvr2_hdw_state_sched(struct pvr2_hdw *);
static int pvr2_hdw_state_eval(struct pvr2_hdw *);
static void pvr2_hdw_set_cur_freq(struct pvr2_hdw *,unsigned long);
static void pvr2_hdw_worker_poll(struct work_struct *work);
static int pvr2_hdw_wait(struct pvr2_hdw *,int state);
static int pvr2_hdw_untrip_unlocked(struct pvr2_hdw *);
static void pvr2_hdw_state_log_state(struct pvr2_hdw *);
static int pvr2_hdw_cmd_usbstream(struct pvr2_hdw *hdw,int runFl);
static int pvr2_hdw_commit_setup(struct pvr2_hdw *hdw);
static int pvr2_hdw_get_eeprom_addr(struct pvr2_hdw *hdw);
static void pvr2_hdw_quiescent_timeout(struct timer_list *);
static void pvr2_hdw_decoder_stabilization_timeout(struct timer_list *);
static void pvr2_hdw_encoder_wait_timeout(struct timer_list *);
static void pvr2_hdw_encoder_run_timeout(struct timer_list *);
static int pvr2_issue_simple_cmd(struct pvr2_hdw *,u32);
static int pvr2_send_request_ex(struct pvr2_hdw *hdw,
				unsigned int timeout,int probe_fl,
				void *write_data,unsigned int write_len,
				void *read_data,unsigned int read_len);
static int pvr2_hdw_check_cropcap(struct pvr2_hdw *hdw);
static v4l2_std_id pvr2_hdw_get_detected_std(struct pvr2_hdw *hdw);

static void trace_stbit(const char *name,int val)
{}

static int ctrl_channelfreq_get(struct pvr2_ctrl *cptr,int *vp)
{}

static int ctrl_channelfreq_set(struct pvr2_ctrl *cptr,int m,int v)
{}

static int ctrl_channelprog_get(struct pvr2_ctrl *cptr,int *vp)
{}

static int ctrl_channelprog_set(struct pvr2_ctrl *cptr,int m,int v)
{}

static int ctrl_channel_get(struct pvr2_ctrl *cptr,int *vp)
{}

static int ctrl_channel_set(struct pvr2_ctrl *cptr,int m,int slotId)
{}

static int ctrl_freq_get(struct pvr2_ctrl *cptr,int *vp)
{}

static int ctrl_freq_is_dirty(struct pvr2_ctrl *cptr)
{}

static void ctrl_freq_clear_dirty(struct pvr2_ctrl *cptr)
{}

static int ctrl_freq_set(struct pvr2_ctrl *cptr,int m,int v)
{}

static int ctrl_cropl_min_get(struct pvr2_ctrl *cptr, int *left)
{}

static int ctrl_cropl_max_get(struct pvr2_ctrl *cptr, int *left)
{}

static int ctrl_cropt_min_get(struct pvr2_ctrl *cptr, int *top)
{}

static int ctrl_cropt_max_get(struct pvr2_ctrl *cptr, int *top)
{}

static int ctrl_cropw_max_get(struct pvr2_ctrl *cptr, int *width)
{}

static int ctrl_croph_max_get(struct pvr2_ctrl *cptr, int *height)
{}

static int ctrl_get_cropcapbl(struct pvr2_ctrl *cptr, int *val)
{}

static int ctrl_get_cropcapbt(struct pvr2_ctrl *cptr, int *val)
{}

static int ctrl_get_cropcapbw(struct pvr2_ctrl *cptr, int *val)
{}

static int ctrl_get_cropcapbh(struct pvr2_ctrl *cptr, int *val)
{}

static int ctrl_get_cropcapdl(struct pvr2_ctrl *cptr, int *val)
{}

static int ctrl_get_cropcapdt(struct pvr2_ctrl *cptr, int *val)
{}

static int ctrl_get_cropcapdw(struct pvr2_ctrl *cptr, int *val)
{}

static int ctrl_get_cropcapdh(struct pvr2_ctrl *cptr, int *val)
{}

static int ctrl_get_cropcappan(struct pvr2_ctrl *cptr, int *val)
{}

static int ctrl_get_cropcappad(struct pvr2_ctrl *cptr, int *val)
{}

static int ctrl_vres_max_get(struct pvr2_ctrl *cptr,int *vp)
{}

static int ctrl_vres_min_get(struct pvr2_ctrl *cptr,int *vp)
{}

static int ctrl_get_input(struct pvr2_ctrl *cptr,int *vp)
{}

static int ctrl_check_input(struct pvr2_ctrl *cptr,int v)
{}

static int ctrl_set_input(struct pvr2_ctrl *cptr,int m,int v)
{}

static int ctrl_isdirty_input(struct pvr2_ctrl *cptr)
{}

static void ctrl_cleardirty_input(struct pvr2_ctrl *cptr)
{}


static int ctrl_freq_max_get(struct pvr2_ctrl *cptr, int *vp)
{}

static int ctrl_freq_min_get(struct pvr2_ctrl *cptr, int *vp)
{}

static int ctrl_cx2341x_is_dirty(struct pvr2_ctrl *cptr)
{}

static void ctrl_cx2341x_clear_dirty(struct pvr2_ctrl *cptr)
{}

static int ctrl_cx2341x_get(struct pvr2_ctrl *cptr,int *vp)
{}

static int ctrl_cx2341x_set(struct pvr2_ctrl *cptr,int m,int v)
{}

static unsigned int ctrl_cx2341x_getv4lflags(struct pvr2_ctrl *cptr)
{}

static int ctrl_streamingenabled_get(struct pvr2_ctrl *cptr,int *vp)
{}

static int ctrl_masterstate_get(struct pvr2_ctrl *cptr,int *vp)
{}

static int ctrl_hsm_get(struct pvr2_ctrl *cptr,int *vp)
{}

static int ctrl_stddetect_get(struct pvr2_ctrl *cptr, int *vp)
{}

static int ctrl_stdavail_get(struct pvr2_ctrl *cptr,int *vp)
{}

static int ctrl_stdavail_set(struct pvr2_ctrl *cptr,int m,int v)
{}

static int ctrl_std_val_to_sym(struct pvr2_ctrl *cptr,int msk,int val,
			       char *bufPtr,unsigned int bufSize,
			       unsigned int *len)
{}

static int ctrl_std_sym_to_val(struct pvr2_ctrl *cptr,
			       const char *bufPtr,unsigned int bufSize,
			       int *mskp,int *valp)
{}

static int ctrl_stdcur_get(struct pvr2_ctrl *cptr,int *vp)
{}

static int ctrl_stdcur_set(struct pvr2_ctrl *cptr,int m,int v)
{}

static int ctrl_stdcur_is_dirty(struct pvr2_ctrl *cptr)
{}

static void ctrl_stdcur_clear_dirty(struct pvr2_ctrl *cptr)
{}

static int ctrl_signal_get(struct pvr2_ctrl *cptr,int *vp)
{}

static int ctrl_audio_modes_present_get(struct pvr2_ctrl *cptr,int *vp)
{}


#define DEFINT(vmin,vmax)

#define DEFENUM(tab)

#define DEFBOOL

#define DEFMASK(msk,tab)

#define DEFREF(vname)


#define VCREATE_FUNCS(vname)

VCREATE_FUNCS()
VCREATE_FUNCS()
VCREATE_FUNCS()
VCREATE_FUNCS()
VCREATE_FUNCS()
VCREATE_FUNCS()
VCREATE_FUNCS()
VCREATE_FUNCS()
VCREATE_FUNCS()
VCREATE_FUNCS()
VCREATE_FUNCS()
VCREATE_FUNCS()
VCREATE_FUNCS()
VCREATE_FUNCS()
VCREATE_FUNCS()
VCREATE_FUNCS()
VCREATE_FUNCS()

/* Table definition of all controls which can be manipulated */
static const struct pvr2_ctl_info control_defs[] =;

#define CTRLDEF_COUNT


const char *pvr2_config_get_name(enum pvr2_config cfg)
{}


struct usb_device *pvr2_hdw_get_dev(struct pvr2_hdw *hdw)
{}


unsigned long pvr2_hdw_get_sn(struct pvr2_hdw *hdw)
{}


const char *pvr2_hdw_get_bus_info(struct pvr2_hdw *hdw)
{}


const char *pvr2_hdw_get_device_identifier(struct pvr2_hdw *hdw)
{}


unsigned long pvr2_hdw_get_cur_freq(struct pvr2_hdw *hdw)
{}

/* Set the currently tuned frequency and account for all possible
   driver-core side effects of this action. */
static void pvr2_hdw_set_cur_freq(struct pvr2_hdw *hdw,unsigned long val)
{}

int pvr2_hdw_get_unit_number(struct pvr2_hdw *hdw)
{}


/* Attempt to locate one of the given set of files.  Messages are logged
   appropriate to what has been found.  The return value will be 0 or
   greater on success (it will be the index of the file name found) and
   fw_entry will be filled in.  Otherwise a negative error is returned on
   failure.  If the return value is -ENOENT then no viable firmware file
   could be located. */
static int pvr2_locate_firmware(struct pvr2_hdw *hdw,
				const struct firmware **fw_entry,
				const char *fwtypename,
				unsigned int fwcount,
				const char *fwnames[])
{}


/*
 * pvr2_upload_firmware1().
 *
 * Send the 8051 firmware to the device.  After the upload, arrange for
 * device to re-enumerate.
 *
 * NOTE : the pointer to the firmware data given by request_firmware()
 * is not suitable for an usb transaction.
 *
 */
static int pvr2_upload_firmware1(struct pvr2_hdw *hdw)
{}


/*
 * pvr2_upload_firmware2()
 *
 * This uploads encoder firmware on endpoint 2.
 *
 */

int pvr2_upload_firmware2(struct pvr2_hdw *hdw)
{}


static const char *pvr2_get_state_name(unsigned int st)
{}

static int pvr2_decoder_enable(struct pvr2_hdw *hdw,int enablefl)
{}


int pvr2_hdw_get_state(struct pvr2_hdw *hdw)
{}


static int pvr2_hdw_untrip_unlocked(struct pvr2_hdw *hdw)
{}


int pvr2_hdw_untrip(struct pvr2_hdw *hdw)
{}




int pvr2_hdw_get_streaming(struct pvr2_hdw *hdw)
{}


int pvr2_hdw_set_streaming(struct pvr2_hdw *hdw,int enable_flag)
{}


int pvr2_hdw_set_stream_type(struct pvr2_hdw *hdw,enum pvr2_config config)
{}


static int get_default_tuner_type(struct pvr2_hdw *hdw)
{}


static v4l2_std_id get_default_standard(struct pvr2_hdw *hdw)
{}


static unsigned int get_default_error_tolerance(struct pvr2_hdw *hdw)
{}


static int pvr2_hdw_check_firmware(struct pvr2_hdw *hdw)
{}

struct pvr2_std_hack {};

/* This data structure labels specific combinations of standards from
   tveeprom that we'll try to recognize.  If we recognize one, then assume
   a specified default standard to use.  This is here because tveeprom only
   tells us about available standards not the intended default standard (if
   any) for the device in question.  We guess the default based on what has
   been reported as available.  Note that this is only for guessing a
   default - which can always be overridden explicitly - and if the user
   has otherwise named a default then that default will always be used in
   place of this table. */
static const struct pvr2_std_hack std_eeprom_maps[] =;

static void pvr2_hdw_setup_std(struct pvr2_hdw *hdw)
{}


static unsigned int pvr2_copy_i2c_addr_list(
	unsigned short *dst, const unsigned char *src,
	unsigned int dst_max)
{}


static void pvr2_hdw_cx25840_vbi_hack(struct pvr2_hdw *hdw)
{}


static int pvr2_hdw_load_subdev(struct pvr2_hdw *hdw,
				const struct pvr2_device_client_desc *cd)
{}


static void pvr2_hdw_load_modules(struct pvr2_hdw *hdw)
{}


static void pvr2_hdw_setup_low(struct pvr2_hdw *hdw)
{}


/* Set up the structure and attempt to put the device into a usable state.
   This can be a time-consuming operation, which is why it is not done
   internally as part of the create() step. */
static void pvr2_hdw_setup(struct pvr2_hdw *hdw)
{}


/* Perform second stage initialization.  Set callback pointer first so that
   we can avoid a possible initialization race (if the kernel thread runs
   before the callback has been set). */
int pvr2_hdw_initialize(struct pvr2_hdw *hdw,
			void (*callback_func)(void *),
			void *callback_data)
{}


/* Create, set up, and return a structure for interacting with the
   underlying hardware.  */
struct pvr2_hdw *pvr2_hdw_create(struct usb_interface *intf,
				 const struct usb_device_id *devid)
{}


/* Remove _all_ associations between this driver and the underlying USB
   layer. */
static void pvr2_hdw_remove_usb_stuff(struct pvr2_hdw *hdw)
{}

void pvr2_hdw_set_v4l2_dev(struct pvr2_hdw *hdw, struct video_device *vdev)
{}

/* Destroy hardware interaction structure */
void pvr2_hdw_destroy(struct pvr2_hdw *hdw)
{}


int pvr2_hdw_dev_ok(struct pvr2_hdw *hdw)
{}


/* Called when hardware has been unplugged */
void pvr2_hdw_disconnect(struct pvr2_hdw *hdw)
{}


/* Get the number of defined controls */
unsigned int pvr2_hdw_get_ctrl_count(struct pvr2_hdw *hdw)
{}


/* Retrieve a control handle given its index (0..count-1) */
struct pvr2_ctrl *pvr2_hdw_get_ctrl_by_index(struct pvr2_hdw *hdw,
					     unsigned int idx)
{}


/* Retrieve a control handle given its index (0..count-1) */
struct pvr2_ctrl *pvr2_hdw_get_ctrl_by_id(struct pvr2_hdw *hdw,
					  unsigned int ctl_id)
{}


/* Given a V4L ID, retrieve the control structure associated with it. */
struct pvr2_ctrl *pvr2_hdw_get_ctrl_v4l(struct pvr2_hdw *hdw,unsigned int ctl_id)
{}


/* Given a V4L ID for its immediate predecessor, retrieve the control
   structure associated with it. */
struct pvr2_ctrl *pvr2_hdw_get_ctrl_nextv4l(struct pvr2_hdw *hdw,
					    unsigned int ctl_id)
{}


static const char *get_ctrl_typename(enum pvr2_ctl_type tp)
{}


static void pvr2_subdev_set_control(struct pvr2_hdw *hdw, int id,
				    const char *name, int val)
{}

#define PVR2_SUBDEV_SET_CONTROL(hdw, id, lab)

static v4l2_std_id pvr2_hdw_get_detected_std(struct pvr2_hdw *hdw)
{}

/* Execute whatever commands are required to update the state of all the
   sub-devices so that they match our current control values. */
static void pvr2_subdev_update(struct pvr2_hdw *hdw)
{}


/* Figure out if we need to commit control changes.  If so, mark internal
   state flags to indicate this fact and return true.  Otherwise do nothing
   else and return false. */
static int pvr2_hdw_commit_setup(struct pvr2_hdw *hdw)
{}


/* Perform all operations needed to commit all control changes.  This must
   be performed in synchronization with the pipeline state and is thus
   expected to be called as part of the driver's worker thread.  Return
   true if commit successful, otherwise return false to indicate that
   commit isn't possible at this time. */
static int pvr2_hdw_commit_execute(struct pvr2_hdw *hdw)
{}


int pvr2_hdw_commit_ctl(struct pvr2_hdw *hdw)
{}


static void pvr2_hdw_worker_poll(struct work_struct *work)
{}


static int pvr2_hdw_wait(struct pvr2_hdw *hdw,int state)
{}


/* Return name for this driver instance */
const char *pvr2_hdw_get_driver_name(struct pvr2_hdw *hdw)
{}


const char *pvr2_hdw_get_desc(struct pvr2_hdw *hdw)
{}


const char *pvr2_hdw_get_type(struct pvr2_hdw *hdw)
{}


int pvr2_hdw_is_hsm(struct pvr2_hdw *hdw)
{}


/* Execute poll of tuner status */
void pvr2_hdw_execute_tuner_poll(struct pvr2_hdw *hdw)
{}


static int pvr2_hdw_check_cropcap(struct pvr2_hdw *hdw)
{}


/* Return information about cropping capabilities */
int pvr2_hdw_get_cropcap(struct pvr2_hdw *hdw, struct v4l2_cropcap *pp)
{}


/* Return information about the tuner */
int pvr2_hdw_get_tuner_status(struct pvr2_hdw *hdw,struct v4l2_tuner *vtp)
{}


/* Get handle to video output stream */
struct pvr2_stream *pvr2_hdw_get_video_stream(struct pvr2_hdw *hp)
{}


void pvr2_hdw_trigger_module_log(struct pvr2_hdw *hdw)
{}


/* Grab EEPROM contents, needed for direct method. */
#define EEPROM_SIZE
#define trace_eeprom(...)
static u8 *pvr2_full_eeprom_fetch(struct pvr2_hdw *hdw)
{}


void pvr2_hdw_cpufw_set_enabled(struct pvr2_hdw *hdw,
				int mode,
				int enable_flag)
{}


/* Return true if we're in a mode for retrieval CPU firmware */
int pvr2_hdw_cpufw_get_enabled(struct pvr2_hdw *hdw)
{}


int pvr2_hdw_cpufw_get(struct pvr2_hdw *hdw,unsigned int offs,
		       char *buf,unsigned int cnt)
{}


int pvr2_hdw_v4l_get_minor_number(struct pvr2_hdw *hdw,
				  enum pvr2_v4l_type index)
{}


/* Store a v4l minor device number */
void pvr2_hdw_v4l_store_minor_number(struct pvr2_hdw *hdw,
				     enum pvr2_v4l_type index,int v)
{}


static void pvr2_ctl_write_complete(struct urb *urb)
{}


static void pvr2_ctl_read_complete(struct urb *urb)
{}

struct hdw_timer {};

static void pvr2_ctl_timeout(struct timer_list *t)
{}


/* Issue a command and get a response from the device.  This extended
   version includes a probe flag (which if set means that device errors
   should not be logged or treated as fatal) and a timeout in jiffies.
   This can be used to non-lethally probe the health of endpoint 1. */
static int pvr2_send_request_ex(struct pvr2_hdw *hdw,
				unsigned int timeout,int probe_fl,
				void *write_data,unsigned int write_len,
				void *read_data,unsigned int read_len)
{}


int pvr2_send_request(struct pvr2_hdw *hdw,
		      void *write_data,unsigned int write_len,
		      void *read_data,unsigned int read_len)
{}


static int pvr2_issue_simple_cmd(struct pvr2_hdw *hdw,u32 cmdcode)
{}


int pvr2_write_register(struct pvr2_hdw *hdw, u16 reg, u32 data)
{}


static int pvr2_read_register(struct pvr2_hdw *hdw, u16 reg, u32 *data)
{}


void pvr2_hdw_render_useless(struct pvr2_hdw *hdw)
{}


void pvr2_hdw_device_reset(struct pvr2_hdw *hdw)
{}


void pvr2_hdw_cpureset_assert(struct pvr2_hdw *hdw,int val)
{}


int pvr2_hdw_cmd_deep_reset(struct pvr2_hdw *hdw)
{}


int pvr2_hdw_cmd_powerup(struct pvr2_hdw *hdw)
{}



int pvr2_hdw_cmd_decoder_reset(struct pvr2_hdw *hdw)
{}


static int pvr2_hdw_cmd_hcw_demod_reset(struct pvr2_hdw *hdw, int onoff)
{}


static int pvr2_hdw_cmd_onair_fe_power_ctrl(struct pvr2_hdw *hdw, int onoff)
{}


static int pvr2_hdw_cmd_onair_digital_path_ctrl(struct pvr2_hdw *hdw,
						int onoff)
{}


static void pvr2_hdw_cmd_modeswitch(struct pvr2_hdw *hdw,int digitalFl)
{}


static void pvr2_led_ctrl_hauppauge(struct pvr2_hdw *hdw, int onoff)
{}


led_method_func;

static led_method_func led_methods[] =;


/* Toggle LED */
static void pvr2_led_ctrl(struct pvr2_hdw *hdw,int onoff)
{}


/* Stop / start video stream transport */
static int pvr2_hdw_cmd_usbstream(struct pvr2_hdw *hdw,int runFl)
{}


/* Evaluate whether or not state_pathway_ok can change */
static int state_eval_pathway_ok(struct pvr2_hdw *hdw)
{}


/* Evaluate whether or not state_encoder_ok can change */
static int state_eval_encoder_ok(struct pvr2_hdw *hdw)
{}


/* Evaluate whether or not state_encoder_config can change */
static int state_eval_encoder_config(struct pvr2_hdw *hdw)
{}


/* Return true if the encoder should not be running. */
static int state_check_disable_encoder_run(struct pvr2_hdw *hdw)
{}


/* Return true if the encoder should be running. */
static int state_check_enable_encoder_run(struct pvr2_hdw *hdw)
{}


/* Evaluate whether or not state_encoder_run can change */
static int state_eval_encoder_run(struct pvr2_hdw *hdw)
{}


/* Timeout function for quiescent timer. */
static void pvr2_hdw_quiescent_timeout(struct timer_list *t)
{}


/* Timeout function for decoder stabilization timer. */
static void pvr2_hdw_decoder_stabilization_timeout(struct timer_list *t)
{}


/* Timeout function for encoder wait timer. */
static void pvr2_hdw_encoder_wait_timeout(struct timer_list *t)
{}


/* Timeout function for encoder run timer. */
static void pvr2_hdw_encoder_run_timeout(struct timer_list *t)
{}


/* Evaluate whether or not state_decoder_run can change */
static int state_eval_decoder_run(struct pvr2_hdw *hdw)
{}


/* Evaluate whether or not state_usbstream_run can change */
static int state_eval_usbstream_run(struct pvr2_hdw *hdw)
{}


/* Attempt to configure pipeline, if needed */
static int state_eval_pipeline_config(struct pvr2_hdw *hdw)
{}


/* Update pipeline idle and pipeline pause tracking states based on other
   inputs.  This must be called whenever the other relevant inputs have
   changed. */
static int state_update_pipeline_state(struct pvr2_hdw *hdw)
{}


state_eval_func;

/* Set of functions to be run to evaluate various states in the driver. */
static const state_eval_func eval_funcs[] =;


/* Process various states and return true if we did anything interesting. */
static int pvr2_hdw_state_update(struct pvr2_hdw *hdw)
{}


static unsigned int print_input_mask(unsigned int msk,
				     char *buf,unsigned int acnt)
{}


static const char *pvr2_pathway_state_name(int id)
{}


static unsigned int pvr2_hdw_report_unlocked(struct pvr2_hdw *hdw,int which,
					     char *buf,unsigned int acnt)
{}


/* Generate report containing info about attached sub-devices and attached
   i2c clients, including an indication of which attached i2c clients are
   actually sub-devices. */
static unsigned int pvr2_hdw_report_clients(struct pvr2_hdw *hdw,
					    char *buf, unsigned int acnt)
{}


unsigned int pvr2_hdw_state_report(struct pvr2_hdw *hdw,
				   char *buf,unsigned int acnt)
{}


static void pvr2_hdw_state_log_state(struct pvr2_hdw *hdw)
{}


/* Evaluate and update the driver's current state, taking various actions
   as appropriate for the update. */
static int pvr2_hdw_state_eval(struct pvr2_hdw *hdw)
{}


/* Cause kernel thread to check / update driver state */
static void pvr2_hdw_state_sched(struct pvr2_hdw *hdw)
{}


int pvr2_hdw_gpio_get_dir(struct pvr2_hdw *hdw,u32 *dp)
{}


int pvr2_hdw_gpio_get_out(struct pvr2_hdw *hdw,u32 *dp)
{}


int pvr2_hdw_gpio_get_in(struct pvr2_hdw *hdw,u32 *dp)
{}


int pvr2_hdw_gpio_chg_dir(struct pvr2_hdw *hdw,u32 msk,u32 val)
{}


int pvr2_hdw_gpio_chg_out(struct pvr2_hdw *hdw,u32 msk,u32 val)
{}


void pvr2_hdw_status_poll(struct pvr2_hdw *hdw)
{}


unsigned int pvr2_hdw_get_input_available(struct pvr2_hdw *hdw)
{}


unsigned int pvr2_hdw_get_input_allowed(struct pvr2_hdw *hdw)
{}


static int pvr2_hdw_set_input(struct pvr2_hdw *hdw,int v)
{}


int pvr2_hdw_set_input_allowed(struct pvr2_hdw *hdw,
			       unsigned int change_mask,
			       unsigned int change_val)
{}


/* Find I2C address of eeprom */
static int pvr2_hdw_get_eeprom_addr(struct pvr2_hdw *hdw)
{}