tree-wide: fix assorted typos all over the place
[safe/jmp/linux-2.6] / drivers / media / video / pvrusb2 / pvrusb2-hdw-internal.h
index c79d3a6..5fcad28 100644 (file)
@@ -1,6 +1,5 @@
 /*
  *
- *  $Id$
  *
  *  Copyright (C) 2005 Mike Isely <isely@pobox.com>
  *
@@ -39,6 +38,7 @@
 #include <linux/mutex.h>
 #include "pvrusb2-hdw.h"
 #include "pvrusb2-io.h"
+#include <media/v4l2-device.h>
 #include <media/cx2341x.h>
 #include "pvrusb2-devattr.h"
 
@@ -58,8 +58,6 @@
 #define LOCK_TAKE(x) do { mutex_lock(&x##_mutex); x##_held = !0; } while (0)
 #define LOCK_GIVE(x) do { x##_held = 0; mutex_unlock(&x##_mutex); } while (0)
 
-struct pvr2_decoder;
-
 typedef int (*pvr2_ctlf_is_dirty)(struct pvr2_ctrl *);
 typedef void (*pvr2_ctlf_clear_dirty)(struct pvr2_ctrl *);
 typedef int (*pvr2_ctlf_check_value)(struct pvr2_ctrl *,int);
@@ -83,6 +81,7 @@ struct pvr2_ctl_info {
 
        /* Control's implementation */
        pvr2_ctlf_get_value get_value;      /* Get its value */
+       pvr2_ctlf_get_value get_def_value;  /* Get its default value */
        pvr2_ctlf_get_value get_min_value;  /* Get minimum allowed value */
        pvr2_ctlf_get_value get_max_value;  /* Get maximum allowed value */
        pvr2_ctlf_set_value set_value;      /* Set its value */
@@ -139,22 +138,6 @@ struct pvr2_ctrl {
 };
 
 
-struct pvr2_decoder_ctrl {
-       void *ctxt;
-       void (*detach)(void *);
-       void (*enable)(void *,int);
-       void (*force_reset)(void *);
-};
-
-#define PVR2_I2C_PEND_DETECT  0x01  /* Need to detect a client type */
-#define PVR2_I2C_PEND_CLIENT  0x02  /* Client needs a specific update */
-#define PVR2_I2C_PEND_REFRESH 0x04  /* Client has specific pending bits */
-#define PVR2_I2C_PEND_STALE   0x08  /* Broadcast pending bits */
-
-#define PVR2_I2C_PEND_ALL (PVR2_I2C_PEND_DETECT |\
-                          PVR2_I2C_PEND_CLIENT |\
-                          PVR2_I2C_PEND_REFRESH |\
-                          PVR2_I2C_PEND_STALE)
 
 /* Disposition of firmware1 loading situation */
 #define FW1_STATE_UNKNOWN 0
@@ -163,6 +146,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,6 +162,8 @@ struct pvr2_hdw {
        struct usb_device *usb_dev;
        struct usb_interface *usb_intf;
 
+       /* Our handle into the v4l2 sub-device architecture */
+       struct v4l2_device v4l2_dev;
        /* Device description, anything that must adjust behavior based on
           device specific info will use information held here. */
        const struct pvr2_device_desc *hdw_desc;
@@ -181,8 +171,6 @@ struct pvr2_hdw {
        /* 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;
@@ -191,20 +179,29 @@ struct pvr2_hdw {
        struct mutex big_lock_mutex;
        int big_lock_held;  /* For debugging */
 
+       /* This is a simple string which identifies the instance of this
+          driver.  It is unique within the set of existing devices, but
+          there is no attempt to keep the name consistent with the same
+          physical device each time. */
        char name[32];
 
+       /* This is a simple string which identifies the physical device
+          instance itself - if possible.  (If not possible, then it is
+          based on the specific driver instance, similar to name above.)
+          The idea here is that userspace might hopefully be able to use
+          this recognize specific tuners.  It will encode a serial number,
+          if available. */
+       char identifier[32];
+
        /* I2C stuff */
        struct i2c_adapter i2c_adap;
        struct i2c_algorithm i2c_algo;
        pvr2_i2c_func i2c_func[PVR2_I2C_FUNC_CNT];
        int i2c_cx25840_hack_state;
        int i2c_linked;
-       unsigned int i2c_pend_types;    /* Which types of update are needed */
-       unsigned long i2c_pend_mask;    /* Change bits we need to scan */
-       unsigned long i2c_stale_mask;   /* Pending broadcast change bits */
-       unsigned long i2c_active_mask;  /* All change bits currently in use */
-       struct list_head i2c_clients;
-       struct mutex i2c_list_lock;
+
+       /* IR related */
+       unsigned int ir_scheme_active; /* IR scheme as seen from the outside */
 
        /* Frequency table */
        unsigned int freqTable[FREQTABLE_SIZE];
@@ -229,17 +226,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 +246,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,28 +261,29 @@ 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;
 
 
+       int force_dirty;        /* consider all controls dirty if true */
        int flag_ok;            /* device in known good state */
        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 */
 
-       struct pvr2_decoder_ctrl *decoder_ctrl;
+       unsigned int decoder_client_id;
 
        // CPU firmware info (used to help find / save firmware data)
        char *fw_buffer;
        unsigned int fw_size;
        int fw_cpu_flag; /* True if we are dealing with the CPU */
 
-       // True if there is a request to trigger logging of state in each
-       // module.
-       int log_requested;
-
        /* Tuner / frequency control stuff */
        unsigned int tuner_type;
        int tuner_updated;
@@ -295,6 +298,10 @@ struct pvr2_hdw {
        struct v4l2_tuner tuner_signal_info;
        int tuner_signal_stale;
 
+       /* Cropping capability info */
+       struct v4l2_cropcap cropcap_info;
+       int cropcap_stale;
+
        /* Video standard handling */
        v4l2_std_id std_mask_eeprom; // Hardware supported selections
        v4l2_std_id std_mask_avail;  // Which standards we may select from
@@ -323,6 +330,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 currently allowed */
+       unsigned int input_allowed_mask;
+
        /* Location of eeprom or a negative number if none */
        int eeprom_addr;
 
@@ -350,6 +362,10 @@ struct pvr2_hdw {
        VCREATE_DATA(bass);
        VCREATE_DATA(treble);
        VCREATE_DATA(mute);
+       VCREATE_DATA(cropl);
+       VCREATE_DATA(cropt);
+       VCREATE_DATA(cropw);
+       VCREATE_DATA(croph);
        VCREATE_DATA(input);
        VCREATE_DATA(audiomode);
        VCREATE_DATA(res_hor);
@@ -365,7 +381,8 @@ struct pvr2_hdw {
 
 /* This function gets the current frequency */
 unsigned long pvr2_hdw_get_cur_freq(struct pvr2_hdw *);
-void pvr2_hdw_set_decoder(struct pvr2_hdw *,struct pvr2_decoder_ctrl *);
+
+void pvr2_hdw_status_poll(struct pvr2_hdw *);
 
 #endif /* __PVRUSB2_HDW_INTERNAL_H */