]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/media/video/pvrusb2/pvrusb2-hdw-internal.h
V4L/DVB (5058): Pvrusb2: bug fix involving switch into radio mode
[linux-2.6-omap-h63xx.git] / drivers / media / video / pvrusb2 / pvrusb2-hdw-internal.h
index 4fd5ca2f6fc9865db2b54f845e7fee5bd8948b58..b9df52c882a82ff47dae29a954e550bd6497e372 100644 (file)
@@ -33,7 +33,6 @@
 
 */
 
-#include <linux/config.h>
 #include <linux/videodev2.h>
 #include <linux/i2c.h>
 #include <linux/mutex.h>
 #include "pvrusb2-io.h"
 #include <media/cx2341x.h>
 
-/* Legal values for the SRATE state variable */
-#define PVR2_CVAL_SRATE_48 0
-#define PVR2_CVAL_SRATE_44_1 1
-
-/* Legal values for the AUDIOBITRATE state variable */
-#define PVR2_CVAL_AUDIOBITRATE_384 0
-#define PVR2_CVAL_AUDIOBITRATE_320 1
-#define PVR2_CVAL_AUDIOBITRATE_256 2
-#define PVR2_CVAL_AUDIOBITRATE_224 3
-#define PVR2_CVAL_AUDIOBITRATE_192 4
-#define PVR2_CVAL_AUDIOBITRATE_160 5
-#define PVR2_CVAL_AUDIOBITRATE_128 6
-#define PVR2_CVAL_AUDIOBITRATE_112 7
-#define PVR2_CVAL_AUDIOBITRATE_96 8
-#define PVR2_CVAL_AUDIOBITRATE_80 9
-#define PVR2_CVAL_AUDIOBITRATE_64 10
-#define PVR2_CVAL_AUDIOBITRATE_56 11
-#define PVR2_CVAL_AUDIOBITRATE_48 12
-#define PVR2_CVAL_AUDIOBITRATE_32 13
-#define PVR2_CVAL_AUDIOBITRATE_VBR 14
-
-/* Legal values for the AUDIOEMPHASIS state variable */
-#define PVR2_CVAL_AUDIOEMPHASIS_NONE 0
-#define PVR2_CVAL_AUDIOEMPHASIS_50_15 1
-#define PVR2_CVAL_AUDIOEMPHASIS_CCITT 2
-
 /* Legal values for PVR2_CID_HSM */
 #define PVR2_CVAL_HSM_FAIL 0
 #define PVR2_CVAL_HSM_FULL 1
@@ -87,6 +60,7 @@ 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);
 typedef int (*pvr2_ctlf_get_value)(struct pvr2_ctrl *,int *);
 typedef int (*pvr2_ctlf_set_value)(struct pvr2_ctrl *,int msk,int val);
 typedef int (*pvr2_ctlf_val_to_sym)(struct pvr2_ctrl *,int msk,int val,
@@ -94,6 +68,7 @@ typedef int (*pvr2_ctlf_val_to_sym)(struct pvr2_ctrl *,int msk,int val,
 typedef int (*pvr2_ctlf_sym_to_val)(struct pvr2_ctrl *,
                                    const char *,unsigned int,
                                    int *mskp,int *valp);
+typedef unsigned int (*pvr2_ctlf_get_v4lflags)(struct pvr2_ctrl *);
 
 /* This structure describes a specific control.  A table of these is set up
    in pvrusb2-hdw.c. */
@@ -106,11 +81,15 @@ struct pvr2_ctl_info {
 
        /* Control's implementation */
        pvr2_ctlf_get_value get_value;      /* Get its 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 */
+       pvr2_ctlf_check_value check_value;  /* Check that value is valid */
        pvr2_ctlf_val_to_sym val_to_sym;    /* Custom convert value->symbol */
        pvr2_ctlf_sym_to_val sym_to_val;    /* Custom convert symbol->value */
        pvr2_ctlf_is_dirty is_dirty;        /* Return true if dirty */
        pvr2_ctlf_clear_dirty clear_dirty;  /* Clear dirty state */
+       pvr2_ctlf_get_v4lflags get_v4lflags;/* Retrieve v4l flags */
 
        /* Control's type (int, enum, bitmask) */
        enum pvr2_ctl_type type;
@@ -191,9 +170,7 @@ struct pvr2_decoder_ctrl {
 
 /* Known major hardware variants, keyed from device ID */
 #define PVR2_HDW_TYPE_29XXX 0
-#ifdef CONFIG_VIDEO_PVRUSB2_24XXX
 #define PVR2_HDW_TYPE_24XXX 1
-#endif
 
 typedef int (*pvr2_i2c_func)(struct pvr2_hdw *,u8,u8 *,u16,u8 *, u16);
 #define PVR2_I2C_FUNC_CNT 128
@@ -237,7 +214,6 @@ struct pvr2_hdw {
        /* Frequency table */
        unsigned int freqTable[FREQTABLE_SIZE];
        unsigned int freqProgSlot;
-       unsigned int freqSlot;
 
        /* Stuff for handling low level control interaction with device */
        struct mutex ctl_lock_mutex;
@@ -283,7 +259,11 @@ struct pvr2_hdw {
        /* Tuner / frequency control stuff */
        unsigned int tuner_type;
        int tuner_updated;
-       unsigned int freqVal;
+       unsigned int freqValTelevision;  /* Current freq for tv mode */
+       unsigned int freqValRadio;       /* Current freq for radio mode */
+       unsigned int freqSlotTelevision; /* Current slot for tv mode */
+       unsigned int freqSlotRadio;      /* Current slot for radio mode */
+       unsigned int freqSelector;       /* 0=radio 1=television */
        int freqDirty;
 
        /* Video standard handling */
@@ -306,9 +286,11 @@ struct pvr2_hdw {
        int unit_number;             /* ID for driver instance */
        unsigned long serial_number; /* ID for hardware itself */
 
-       /* Minor number used by v4l logic (yes, this is a hack, as there should
-          be no v4l junk here).  Probably a better way to do this. */
-       int v4l_minor_number;
+       /* Minor numbers used by v4l logic (yes, this is a hack, as there
+          should be no v4l junk here).  Probably a better way to do this. */
+       int v4l_minor_number_video;
+       int v4l_minor_number_vbi;
+       int v4l_minor_number_radio;
 
        /* Location of eeprom or a negative number if none */
        int eeprom_addr;
@@ -320,6 +302,13 @@ struct pvr2_hdw {
        int flag_bilingual;
        struct pvr2_audio_stat *audio_stat;
 
+       /* Control state needed for cx2341x module */
+       struct cx2341x_mpeg_params enc_cur_state;
+       struct cx2341x_mpeg_params enc_ctl_state;
+       /* True if an encoder attribute has changed */
+       int enc_stale;
+       /* True if enc_cur_state is valid */
+       int enc_cur_valid;
 
        /* Control state */
 #define VCREATE_DATA(lab) int lab##_val; int lab##_dirty
@@ -337,37 +326,17 @@ struct pvr2_hdw {
        VCREATE_DATA(res_hor);
        VCREATE_DATA(res_ver);
        VCREATE_DATA(srate);
-       VCREATE_DATA(audiobitrate);
-       VCREATE_DATA(audiocrc);
-       VCREATE_DATA(audioemphasis);
-       VCREATE_DATA(vbr);
-       VCREATE_DATA(videobitrate);
-       VCREATE_DATA(videopeak);
-       VCREATE_DATA(interlace);
-       VCREATE_DATA(audiolayer);
+       VCREATE_DATA(automodeswitch);
 #undef VCREATE_DATA
 
+       struct pvr2_ctld_info *mpeg_ctrl_info;
 
        struct pvr2_ctrl *controls;
        unsigned int control_cnt;
 };
 
-int pvr2_hdw_commit_ctl_internal(struct pvr2_hdw *hdw);
-
-unsigned int pvr2_hdw_get_signal_status_internal(struct pvr2_hdw *);
-
-void pvr2_hdw_subsys_bit_chg_no_lock(struct pvr2_hdw *hdw,
-                                    unsigned long msk,unsigned long val);
-void pvr2_hdw_subsys_stream_bit_chg_no_lock(struct pvr2_hdw *hdw,
-                                           unsigned long msk,
-                                           unsigned long val);
-
-void pvr2_hdw_internal_find_stdenum(struct pvr2_hdw *hdw);
-void pvr2_hdw_internal_set_std_avail(struct pvr2_hdw *hdw);
-
-int pvr2_i2c_basic_op(struct pvr2_hdw *,u8 i2c_addr,
-                     u8 *wdata,u16 wlen,
-                     u8 *rdata,u16 rlen);
+/* This function gets the current frequency */
+unsigned long pvr2_hdw_get_cur_freq(struct pvr2_hdw *);
 
 #endif /* __PVRUSB2_HDW_INTERNAL_H */