Merge branches 'msm-fixes' and 'msm-video' of git://codeaurora.org/quic/kernel/dwalke...
[pandora-kernel.git] / drivers / media / video / ivtv / ivtv-driver.h
index 5b45fd2..04bacdb 100644 (file)
@@ -51,7 +51,7 @@
 #include <linux/unistd.h>
 #include <linux/pagemap.h>
 #include <linux/scatterlist.h>
-#include <linux/workqueue.h>
+#include <linux/kthread.h>
 #include <linux/mutex.h>
 #include <linux/slab.h>
 #include <asm/uaccess.h>
@@ -62,6 +62,7 @@
 #include <linux/dvb/audio.h>
 #include <media/v4l2-common.h>
 #include <media/v4l2-ioctl.h>
+#include <media/v4l2-ctrls.h>
 #include <media/v4l2-device.h>
 #include <media/v4l2-fh.h>
 #include <media/tuner.h>
 
 /* debugging */
 extern int ivtv_debug;
+#ifdef CONFIG_VIDEO_ADV_DEBUG
+extern int ivtv_fw_debug;
+#endif
 
 #define IVTV_DBGFLG_WARN    (1 << 0)
 #define IVTV_DBGFLG_INFO    (1 << 1)
@@ -257,7 +261,6 @@ struct ivtv_mailbox_data {
 #define IVTV_F_I_DEC_PAUSED       20   /* the decoder is paused */
 #define IVTV_F_I_INITED                   21   /* set after first open */
 #define IVTV_F_I_FAILED                   22   /* set if first open failed */
-#define IVTV_F_I_WORK_INITED       23  /* worker thread was initialized */
 
 /* Event notifications */
 #define IVTV_F_I_EV_DEC_STOPPED           28   /* decoder stopped event */
@@ -629,6 +632,8 @@ struct ivtv {
        struct ivtv_options options;    /* user options */
 
        struct v4l2_device v4l2_dev;
+       struct cx2341x_handler cxhdl;
+       struct v4l2_ctrl_handler hdl_gpio;
        struct v4l2_subdev sd_gpio;     /* GPIO sub-device */
        u16 instance;
 
@@ -646,7 +651,6 @@ struct ivtv {
        v4l2_std_id std_out;            /* current TV output standard */
        u8 audio_stereo_mode;           /* decoder setting how to handle stereo MPEG audio */
        u8 audio_bilingual_mode;        /* decoder setting how to handle bilingual MPEG audio */
-       struct cx2341x_mpeg_params params;              /* current encoder parameters */
 
 
        /* Locking */
@@ -663,8 +667,9 @@ struct ivtv {
        /* Interrupts & DMA */
        u32 irqmask;                    /* active interrupts */
        u32 irq_rr_idx;                 /* round-robin stream index */
-       struct workqueue_struct *irq_work_queues;       /* workqueue for PIO/YUV/VBI actions */
-       struct work_struct irq_work_queue;              /* work entry */
+       struct kthread_worker irq_worker;               /* kthread worker for PIO/YUV/VBI actions */
+       struct task_struct *irq_worker_task;            /* task for irq_worker */
+       struct kthread_work irq_work;   /* kthread work entry */
        spinlock_t dma_reg_lock;        /* lock access to DMA engine registers */
        int cur_dma_stream;             /* index of current stream doing DMA (-1 if none) */
        int cur_pio_stream;             /* index of current stream doing PIO (-1 if none) */
@@ -734,6 +739,7 @@ struct ivtv {
        struct v4l2_rect osd_rect;      /* current OSD position and size */
        struct v4l2_rect main_rect;     /* current Main window position and size */
        struct osd_info *osd_info;      /* ivtvfb private OSD info */
+       void (*ivtvfb_restore)(struct ivtv *itv); /* Used for a warm start */
 };
 
 static inline struct ivtv *to_ivtv(struct v4l2_device *v4l2_dev)
@@ -805,15 +811,23 @@ static inline int ivtv_raw_vbi(const struct ivtv *itv)
 /* Call the specified callback for all subdevs matching hw (if 0, then
    match them all). Ignore any errors. */
 #define ivtv_call_hw(itv, hw, o, f, args...)                           \
-       __v4l2_device_call_subdevs(&(itv)->v4l2_dev, !(hw) || (sd->grp_id & (hw)), o, f , ##args)
+       do {                                                            \
+               struct v4l2_subdev *__sd;                               \
+               __v4l2_device_call_subdevs_p(&(itv)->v4l2_dev, __sd,    \
+                       !(hw) || (__sd->grp_id & (hw)), o, f , ##args); \
+       } while (0)
 
 #define ivtv_call_all(itv, o, f, args...) ivtv_call_hw(itv, 0, o, f , ##args)
 
 /* Call the specified callback for all subdevs matching hw (if 0, then
    match them all). If the callback returns an error other than 0 or
    -ENOIOCTLCMD, then return with that error code. */
-#define ivtv_call_hw_err(itv, hw, o, f, args...)               \
-       __v4l2_device_call_subdevs_until_err(&(itv)->v4l2_dev, !(hw) || (sd->grp_id & (hw)), o, f , ##args)
+#define ivtv_call_hw_err(itv, hw, o, f, args...)                       \
+({                                                                     \
+       struct v4l2_subdev *__sd;                                       \
+       __v4l2_device_call_subdevs_until_err_p(&(itv)->v4l2_dev, __sd,  \
+               !(hw) || (__sd->grp_id & (hw)), o, f , ##args);         \
+})
 
 #define ivtv_call_all_err(itv, o, f, args...) ivtv_call_hw_err(itv, 0, o, f , ##args)