Commit a158f355 authored by Hans Verkuil's avatar Hans Verkuil Committed by Mauro Carvalho Chehab

V4L/DVB (6094): ivtv: more ivtv-driver.h cleanups

Signed-off-by: default avatarHans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@infradead.org>
parent fd8b281a
...@@ -180,11 +180,11 @@ extern int ivtv_debug; ...@@ -180,11 +180,11 @@ extern int ivtv_debug;
#define IVTV_MAX_PGM_INDEX (400) #define IVTV_MAX_PGM_INDEX (400)
struct ivtv_options { struct ivtv_options {
int kilobytes[IVTV_MAX_STREAMS]; /* Size in kilobytes of each stream */ int kilobytes[IVTV_MAX_STREAMS]; /* size in kilobytes of each stream */
int cardtype; /* force card type on load */ int cardtype; /* force card type on load */
int tuner; /* set tuner on load */ int tuner; /* set tuner on load */
int radio; /* enable/disable radio */ int radio; /* enable/disable radio */
int newi2c; /* New I2C algorithm */ int newi2c; /* new I2C algorithm */
}; };
/* ivtv-specific mailbox template */ /* ivtv-specific mailbox template */
...@@ -231,10 +231,10 @@ struct ivtv_mailbox_data { ...@@ -231,10 +231,10 @@ struct ivtv_mailbox_data {
#define IVTV_F_I_DMA 0 /* DMA in progress */ #define IVTV_F_I_DMA 0 /* DMA in progress */
#define IVTV_F_I_UDMA 1 /* UDMA in progress */ #define IVTV_F_I_UDMA 1 /* UDMA in progress */
#define IVTV_F_I_UDMA_PENDING 2 /* UDMA pending */ #define IVTV_F_I_UDMA_PENDING 2 /* UDMA pending */
#define IVTV_F_I_SPEED_CHANGE 3 /* A speed change is in progress */ #define IVTV_F_I_SPEED_CHANGE 3 /* a speed change is in progress */
#define IVTV_F_I_EOS 4 /* End of encoder stream reached */ #define IVTV_F_I_EOS 4 /* end of encoder stream reached */
#define IVTV_F_I_RADIO_USER 5 /* The radio tuner is selected */ #define IVTV_F_I_RADIO_USER 5 /* the radio tuner is selected */
#define IVTV_F_I_DIG_RST 6 /* Reset digitizer */ #define IVTV_F_I_DIG_RST 6 /* reset digitizer */
#define IVTV_F_I_DEC_YUV 7 /* YUV instead of MPG is being decoded */ #define IVTV_F_I_DEC_YUV 7 /* YUV instead of MPG is being decoded */
#define IVTV_F_I_UPDATE_CC 9 /* CC should be updated */ #define IVTV_F_I_UPDATE_CC 9 /* CC should be updated */
#define IVTV_F_I_UPDATE_WSS 10 /* WSS should be updated */ #define IVTV_F_I_UPDATE_WSS 10 /* WSS should be updated */
...@@ -242,7 +242,7 @@ struct ivtv_mailbox_data { ...@@ -242,7 +242,7 @@ struct ivtv_mailbox_data {
#define IVTV_F_I_DECODING_YUV 12 /* this stream is YUV frame decoding */ #define IVTV_F_I_DECODING_YUV 12 /* this stream is YUV frame decoding */
#define IVTV_F_I_ENC_PAUSED 13 /* the encoder is paused */ #define IVTV_F_I_ENC_PAUSED 13 /* the encoder is paused */
#define IVTV_F_I_VALID_DEC_TIMINGS 14 /* last_dec_timing is valid */ #define IVTV_F_I_VALID_DEC_TIMINGS 14 /* last_dec_timing is valid */
#define IVTV_F_I_HAVE_WORK 15 /* Used in the interrupt handler: there is work to be done */ #define IVTV_F_I_HAVE_WORK 15 /* used in the interrupt handler: there is work to be done */
#define IVTV_F_I_WORK_HANDLER_VBI 16 /* there is work to be done for VBI */ #define IVTV_F_I_WORK_HANDLER_VBI 16 /* there is work to be done for VBI */
#define IVTV_F_I_WORK_HANDLER_YUV 17 /* there is work to be done for YUV */ #define IVTV_F_I_WORK_HANDLER_YUV 17 /* there is work to be done for YUV */
#define IVTV_F_I_WORK_HANDLER_PIO 18 /* there is work to be done for PIO */ #define IVTV_F_I_WORK_HANDLER_PIO 18 /* there is work to be done for PIO */
...@@ -295,19 +295,18 @@ struct ivtv_buffer { ...@@ -295,19 +295,18 @@ struct ivtv_buffer {
unsigned short b_flags; unsigned short b_flags;
unsigned short dma_xfer_cnt; unsigned short dma_xfer_cnt;
char *buf; char *buf;
u32 bytesused; u32 bytesused;
u32 readpos; u32 readpos;
}; };
struct ivtv_queue { struct ivtv_queue {
struct list_head list; struct list_head list; /* the list of buffers in this queue */
u32 buffers; u32 buffers; /* number of buffers in this queue */
u32 length; u32 length; /* total number of bytes of available buffer space */
u32 bytesused; u32 bytesused; /* total number of bytes used in this queue */
}; };
struct ivtv; /* forward reference */ struct ivtv; /* forward reference */
struct ivtv_stream { struct ivtv_stream {
/* These first four fields are always set, even if the stream /* These first four fields are always set, even if the stream
...@@ -318,11 +317,9 @@ struct ivtv_stream { ...@@ -318,11 +317,9 @@ struct ivtv_stream {
int type; /* stream type */ int type; /* stream type */
u32 id; u32 id;
spinlock_t qlock; /* locks access to the queues */ spinlock_t qlock; /* locks access to the queues */
unsigned long s_flags; /* status flags, see above */ unsigned long s_flags; /* status flags, see above */
int dma; /* can be PCI_DMA_TODEVICE, int dma; /* can be PCI_DMA_TODEVICE, PCI_DMA_FROMDEVICE or PCI_DMA_NONE */
PCI_DMA_FROMDEVICE or
PCI_DMA_NONE */
u32 pending_offset; u32 pending_offset;
u32 pending_backup; u32 pending_backup;
u64 pending_pts; u64 pending_pts;
...@@ -365,10 +362,10 @@ struct ivtv_stream { ...@@ -365,10 +362,10 @@ struct ivtv_stream {
}; };
struct ivtv_open_id { struct ivtv_open_id {
u32 open_id; u32 open_id; /* unique ID for this file descriptor */
int type; int type; /* stream type */
int yuv_frames; int yuv_frames; /* 1: started OUT_UDMA_YUV output mode */
enum v4l2_priority prio; enum v4l2_priority prio; /* priority */
struct ivtv *itv; struct ivtv *itv;
}; };
...@@ -493,6 +490,14 @@ struct yuv_playback_info ...@@ -493,6 +490,14 @@ struct yuv_playback_info
/* VBI data */ /* VBI data */
struct vbi_info { struct vbi_info {
/* VBI general fixed card data */
u32 raw_decoder_line_size; /* raw VBI line size from digitizer */
u8 raw_decoder_sav_odd_field; /* raw VBI Start Active Video digitizer code of odd field */
u8 raw_decoder_sav_even_field; /* raw VBI Start Active Video digitizer code of even field */
u32 sliced_decoder_line_size; /* sliced VBI line size from digitizer */
u8 sliced_decoder_sav_odd_field; /* sliced VBI Start Active Video digitizer code of odd field */
u8 sliced_decoder_sav_even_field; /* sliced VBI Start Active Video digitizer code of even field */
u32 dec_start; u32 dec_start;
u32 enc_start, enc_size; u32 enc_start, enc_size;
int fpi; int fpi;
...@@ -506,12 +511,6 @@ struct vbi_info { ...@@ -506,12 +511,6 @@ struct vbi_info {
int wss; int wss;
u8 wss_found; u8 wss_found;
u8 wss_no_update; u8 wss_no_update;
u32 raw_decoder_line_size;
u8 raw_decoder_sav_odd_field;
u8 raw_decoder_sav_even_field;
u32 sliced_decoder_line_size;
u8 sliced_decoder_sav_odd_field;
u8 sliced_decoder_sav_even_field;
struct v4l2_format in; struct v4l2_format in;
/* convenience pointer to sliced struct in vbi_in union */ /* convenience pointer to sliced struct in vbi_in union */
struct v4l2_sliced_vbi_format *sliced_in; struct v4l2_sliced_vbi_format *sliced_in;
...@@ -592,8 +591,7 @@ struct ivtv { ...@@ -592,8 +591,7 @@ struct ivtv {
/* Locking */ /* Locking */
spinlock_t lock; /* lock access to this struct */ spinlock_t lock; /* lock access to this struct */
/* mutex used to serialize open/close/start/stop/ioctl operations */ struct mutex serialize_lock; /* mutex used to serialize open/close/start/stop/ioctl operations */
struct mutex serialize_lock;
/* Streams */ /* Streams */
...@@ -616,7 +614,7 @@ struct ivtv { ...@@ -616,7 +614,7 @@ struct ivtv {
int dma_retries; /* current DMA retry attempt */ int dma_retries; /* current DMA retry attempt */
struct ivtv_user_dma udma; /* user based DMA for OSD */ struct ivtv_user_dma udma; /* user based DMA for OSD */
struct timer_list dma_timer; /* timer used to catch unfinished DMAs */ struct timer_list dma_timer; /* timer used to catch unfinished DMAs */
u32 last_vsync_frame; /* last seen vsync field */ u32 last_vsync_field; /* last seen vsync field */
wait_queue_head_t dma_waitq; /* wake up when the current DMA is finished */ wait_queue_head_t dma_waitq; /* wake up when the current DMA is finished */
wait_queue_head_t eos_waitq; /* wake up when EOS arrives */ wait_queue_head_t eos_waitq; /* wake up when EOS arrives */
wait_queue_head_t event_waitq; /* wake up when the next decoder event arrives */ wait_queue_head_t event_waitq; /* wake up when the next decoder event arrives */
......
...@@ -405,7 +405,7 @@ static int ivtvfb_ioctl(struct fb_info *info, unsigned int cmd, unsigned long ar ...@@ -405,7 +405,7 @@ static int ivtvfb_ioctl(struct fb_info *info, unsigned int cmd, unsigned long ar
if (itv->is_50hz && trace > 312) trace -= 312; if (itv->is_50hz && trace > 312) trace -= 312;
else if (itv->is_60hz && trace > 262) trace -= 262; else if (itv->is_60hz && trace > 262) trace -= 262;
if (trace == 1) vblank.flags |= FB_VBLANK_VSYNCING; if (trace == 1) vblank.flags |= FB_VBLANK_VSYNCING;
vblank.count = itv->last_vsync_frame; vblank.count = itv->last_vsync_field;
vblank.vcount = trace; vblank.vcount = trace;
vblank.hcount = 0; vblank.hcount = 0;
if (copy_to_user((void __user *)arg, &vblank, sizeof(vblank))) if (copy_to_user((void __user *)arg, &vblank, sizeof(vblank)))
......
...@@ -750,8 +750,8 @@ static void ivtv_irq_vsync(struct ivtv *itv) ...@@ -750,8 +750,8 @@ static void ivtv_irq_vsync(struct ivtv *itv)
if (0) IVTV_DEBUG_IRQ("DEC VSYNC\n"); if (0) IVTV_DEBUG_IRQ("DEC VSYNC\n");
if (((frame ^ itv->yuv_info.sync_field[last_dma_frame]) == 0 && if (((frame ^ itv->yuv_info.sync_field[last_dma_frame]) == 0 &&
((itv->last_vsync_frame & 1) ^ itv->yuv_info.sync_field[last_dma_frame])) || ((itv->last_vsync_field & 1) ^ itv->yuv_info.sync_field[last_dma_frame])) ||
(frame != (itv->last_vsync_frame & 1) && !itv->yuv_info.frame_interlaced)) { (frame != (itv->last_vsync_field & 1) && !itv->yuv_info.frame_interlaced)) {
int next_dma_frame = last_dma_frame; int next_dma_frame = last_dma_frame;
if (!(itv->yuv_info.frame_interlaced && itv->yuv_info.field_delay[next_dma_frame] && itv->yuv_info.fields_lapsed < 1)) { if (!(itv->yuv_info.frame_interlaced && itv->yuv_info.field_delay[next_dma_frame] && itv->yuv_info.fields_lapsed < 1)) {
...@@ -766,10 +766,10 @@ static void ivtv_irq_vsync(struct ivtv *itv) ...@@ -766,10 +766,10 @@ static void ivtv_irq_vsync(struct ivtv *itv)
} }
} }
} }
if (frame != (itv->last_vsync_frame & 1)) { if (frame != (itv->last_vsync_field & 1)) {
struct ivtv_stream *s = ivtv_get_output_stream(itv); struct ivtv_stream *s = ivtv_get_output_stream(itv);
itv->last_vsync_frame += 1; itv->last_vsync_field += 1;
if (frame == 0) { if (frame == 0) {
clear_bit(IVTV_F_I_VALID_DEC_TIMINGS, &itv->i_flags); clear_bit(IVTV_F_I_VALID_DEC_TIMINGS, &itv->i_flags);
clear_bit(IVTV_F_I_EV_VSYNC_FIELD, &itv->i_flags); clear_bit(IVTV_F_I_EV_VSYNC_FIELD, &itv->i_flags);
...@@ -834,7 +834,7 @@ irqreturn_t ivtv_irq_handler(int irq, void *dev_id) ...@@ -834,7 +834,7 @@ irqreturn_t ivtv_irq_handler(int irq, void *dev_id)
*/ */
if (~itv->irqmask & IVTV_IRQ_DEC_VSYNC) { if (~itv->irqmask & IVTV_IRQ_DEC_VSYNC) {
/* vsync is enabled, see if we're in a new field */ /* vsync is enabled, see if we're in a new field */
if ((itv->last_vsync_frame & 1) != (read_reg(0x28c0) & 1)) { if ((itv->last_vsync_field & 1) != (read_reg(0x28c0) & 1)) {
/* New field, looks like we missed it */ /* New field, looks like we missed it */
IVTV_DEBUG_YUV("VSync interrupt missed %d\n",read_reg(0x28c0)>>16); IVTV_DEBUG_YUV("VSync interrupt missed %d\n",read_reg(0x28c0)>>16);
vsync_force = 1; vsync_force = 1;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment