Merge branch 'sched-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
[pandora-kernel.git] / drivers / media / video / pvrusb2 / pvrusb2-hdw-internal.h
index 8c2d222..657f861 100644 (file)
@@ -1,6 +1,5 @@
 /*
  *
- *  $Id$
  *
  *  Copyright (C) 2005 Mike Isely <isely@pobox.com>
  *
@@ -163,6 +162,11 @@ struct pvr2_decoder_ctrl {
 #define FW1_STATE_RELOAD 3
 #define FW1_STATE_OK 4
 
+/* What state the device is in if it is a hybrid */
+#define PVR2_PATHWAY_UNKNOWN 0
+#define PVR2_PATHWAY_ANALOG 1
+#define PVR2_PATHWAY_DIGITAL 2
+
 typedef int (*pvr2_i2c_func)(struct pvr2_hdw *,u8,u8 *,u16,u8 *, u16);
 #define PVR2_I2C_FUNC_CNT 128
 
@@ -174,15 +178,14 @@ struct pvr2_hdw {
        struct usb_device *usb_dev;
        struct usb_interface *usb_intf;
 
-       /* Device type, one of PVR2_HDW_TYPE_xxxxx */
-       unsigned int hdw_type;
+       /* Device description, anything that must adjust behavior based on
+          device specific info will use information held here. */
        const struct pvr2_device_desc *hdw_desc;
 
        /* Kernel worker thread handling */
        struct workqueue_struct *workqueue;
        struct work_struct workpoll;     /* Update driver state */
        struct work_struct worki2csync;  /* Update i2c clients */
-       struct work_struct workinit;     /* Driver initialization sequence */
 
        /* Video spigot */
        struct pvr2_stream *vid_stream;
@@ -217,9 +220,9 @@ struct pvr2_hdw {
        struct urb *ctl_read_urb;
        unsigned char *ctl_write_buffer;
        unsigned char *ctl_read_buffer;
-       volatile int ctl_write_pend_flag;
-       volatile int ctl_read_pend_flag;
-       volatile int ctl_timeout_flag;
+       int ctl_write_pend_flag;
+       int ctl_read_pend_flag;
+       int ctl_timeout_flag;
        struct completion ctl_done;
        unsigned char cmd_buffer[PVR2_CTL_BUFFSIZE];
        int cmd_debug_state;               // Low level command debugging info
@@ -229,17 +232,19 @@ struct pvr2_hdw {
 
        /* Bits of state that describe what is going on with various parts
           of the driver. */
-       volatile int state_encoder_ok;         /* Encoder is operational */
-       volatile int state_encoder_run;        /* Encoder is running */
-       volatile int state_encoder_config;     /* Encoder is configured */
-       volatile int state_encoder_waitok;     /* Encoder pre-wait done */
-       volatile int state_decoder_run;        /* Decoder is running */
-       volatile int state_usbstream_run;      /* FX2 is streaming */
-       volatile int state_decoder_quiescent;  /* Decoder idle for > 50msec */
-       volatile int state_pipeline_config;    /* Pipeline is configured */
-       int state_pipeline_req;                /* Somebody wants to stream */
-       int state_pipeline_pause;              /* Pipeline must be paused */
-       int state_pipeline_idle;               /* Pipeline not running */
+       int state_pathway_ok;         /* Pathway config is ok */
+       int state_encoder_ok;         /* Encoder is operational */
+       int state_encoder_run;        /* Encoder is running */
+       int state_encoder_config;     /* Encoder is configured */
+       int state_encoder_waitok;     /* Encoder pre-wait done */
+       int state_encoder_runok;      /* Encoder has run for >= .25 sec */
+       int state_decoder_run;        /* Decoder is running */
+       int state_usbstream_run;      /* FX2 is streaming */
+       int state_decoder_quiescent;  /* Decoder idle for > 50msec */
+       int state_pipeline_config;    /* Pipeline is configured */
+       int state_pipeline_req;       /* Somebody wants to stream */
+       int state_pipeline_pause;     /* Pipeline must be paused */
+       int state_pipeline_idle;      /* Pipeline not running */
 
        /* This is the master state of the driver.  It is the combined
           result of other bits of state.  Examining this will indicate the
@@ -247,6 +252,9 @@ struct pvr2_hdw {
           PVR2_STATE_xxxx */
        unsigned int master_state;
 
+       /* True if device led is currently on */
+       int led_on;
+
        /* True if states must be re-evaluated */
        int state_stale;
 
@@ -259,6 +267,9 @@ struct pvr2_hdw {
        /* Timer for measuring encoder pre-wait time */
        struct timer_list encoder_wait_timer;
 
+       /* Timer for measuring encoder minimum run time */
+       struct timer_list encoder_run_timer;
+
        /* Place to block while waiting for state changes */
        wait_queue_head_t state_wait_data;
 
@@ -267,6 +278,7 @@ struct pvr2_hdw {
        int flag_disconnected;  /* flag_ok == 0 due to disconnect */
        int flag_init_ok;       /* true if structure is fully initialized */
        int fw1_state;          /* current situation with fw1 */
+       int pathway_state;      /* one of PVR2_PATHWAY_xxx */
        int flag_decoder_missed;/* We've noticed missing decoder */
        int flag_tripped;       /* Indicates overall failure to start */
 
@@ -323,6 +335,11 @@ struct pvr2_hdw {
        int v4l_minor_number_vbi;
        int v4l_minor_number_radio;
 
+       /* Bit mask of PVR2_CVAL_INPUT choices which are valid for the hardware */
+       unsigned int input_avail_mask;
+       /* Bit mask of PVR2_CVAL_INPUT choices which are currenly allowed */
+       unsigned int input_allowed_mask;
+
        /* Location of eeprom or a negative number if none */
        int eeprom_addr;