Commit effdd2b7 authored by Gerd Knorr's avatar Gerd Knorr Committed by Linus Torvalds

[PATCH] bttv driver update

This patch updates the bttv driver.  Changes:

 * moved much code to the generic video-buf.c helper module
   (bttv-driver.c, bttv-vbi.c, videobuf.c).
 * a number of changes in the card list and the card-specific code
   (bttv-cards.c).
 * misc small fixes here and there.
parent 76f0c877
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
#ifndef _BTTVP_H_ #ifndef _BTTVP_H_
#define _BTTVP_H_ #define _BTTVP_H_
#define BTTV_VERSION_CODE KERNEL_VERSION(0,8,38) #define BTTV_VERSION_CODE KERNEL_VERSION(0,8,42)
#include <linux/types.h> #include <linux/types.h>
#include <linux/wait.h> #include <linux/wait.h>
...@@ -127,40 +127,20 @@ struct bttv_overlay { ...@@ -127,40 +127,20 @@ struct bttv_overlay {
}; };
struct bttv_vbi { struct bttv_vbi {
struct semaphore lock; int users;
int users; int lines;
int lines; struct videobuf_queue q;
/* mmap */
int streaming;
struct bttv_buffer *bufs[VIDEO_MAX_FRAME];
struct list_head stream;
/* read */
int reading;
int read_off;
struct bttv_buffer *read_buf;
}; };
struct bttv_fh { struct bttv_fh {
struct bttv *btv; struct bttv *btv;
struct videobuf_queue q;
/* locking */
int resources; int resources;
struct semaphore lock;
/* current settings */
/* keep current driver settings */
const struct bttv_format *ovfmt; const struct bttv_format *ovfmt;
struct bttv_overlay ov; struct bttv_overlay ov;
struct bttv_buffer buf; struct bttv_buffer buf;
/* for read() capture */
struct bttv_buffer read_buf;
int read_off;
/* mmap()'ed buffers */
struct bttv_buffer *bufs[VIDEO_MAX_FRAME];
struct list_head stream; /* v4l2 QBUF/DQBUF */
}; };
/* ---------------------------------------------------------- */ /* ---------------------------------------------------------- */
...@@ -221,6 +201,8 @@ int bttv_overlay_risc(struct bttv *btv, struct bttv_overlay *ov, ...@@ -221,6 +201,8 @@ int bttv_overlay_risc(struct bttv *btv, struct bttv_overlay *ov,
/* bttv-vbi.c */ /* bttv-vbi.c */
extern struct video_device bttv_vbi_template; extern struct video_device bttv_vbi_template;
extern struct videobuf_queue_ops vbi_qops;
/* ---------------------------------------------------------- */ /* ---------------------------------------------------------- */
/* bttv-driver.c */ /* bttv-driver.c */
...@@ -277,7 +259,8 @@ struct bttv { ...@@ -277,7 +259,8 @@ struct bttv {
/* gpio interface */ /* gpio interface */
wait_queue_head_t gpioq; wait_queue_head_t gpioq;
int shutdown; int shutdown;
void (*audio_hook)(struct bttv *btv, struct video_audio *v, int set);
/* i2c layer */ /* i2c layer */
struct i2c_adapter i2c_adap; struct i2c_adapter i2c_adap;
struct i2c_algo_bit_data i2c_algo; struct i2c_algo_bit_data i2c_algo;
......
This diff is collapsed.
...@@ -103,15 +103,14 @@ int videobuf_dma_free(struct videobuf_dmabuf *dma); ...@@ -103,15 +103,14 @@ int videobuf_dma_free(struct videobuf_dmabuf *dma);
*/ */
struct videobuf_buffer; struct videobuf_buffer;
typedef void (*videobuf_buffer_free)(struct file *file, struct videobuf_queue;
struct videobuf_buffer *vb);
struct videobuf_mapping { struct videobuf_mapping {
int count; int count;
int highmem_ok; int highmem_ok;
unsigned long start; unsigned long start;
unsigned long end; unsigned long end;
struct videobuf_buffer **buflist; struct videobuf_queue *q;
}; };
#define VBUF_FIELD_EVEN 1 #define VBUF_FIELD_EVEN 1
...@@ -132,7 +131,6 @@ struct videobuf_buffer { ...@@ -132,7 +131,6 @@ struct videobuf_buffer {
int i; int i;
/* info about the buffer */ /* info about the buffer */
int type;
int width; int width;
int height; int height;
long size; long size;
...@@ -146,7 +144,6 @@ struct videobuf_buffer { ...@@ -146,7 +144,6 @@ struct videobuf_buffer {
unsigned long bsize; /* buffer size */ unsigned long bsize; /* buffer size */
unsigned long baddr; /* buffer addr (userland ptr!) */ unsigned long baddr; /* buffer addr (userland ptr!) */
struct videobuf_mapping *map; struct videobuf_mapping *map;
videobuf_buffer_free free;
/* touched by irq handler */ /* touched by irq handler */
struct list_head queue; struct list_head queue;
...@@ -157,19 +154,76 @@ struct videobuf_buffer { ...@@ -157,19 +154,76 @@ struct videobuf_buffer {
#endif #endif
}; };
void* videobuf_alloc(int size, int type); struct videobuf_queue_ops {
int (*buf_setup)(struct file *file, int *count, int *size);
int (*buf_prepare)(struct file *file,struct videobuf_buffer *vb,
int field);
void (*buf_queue)(struct file *file,struct videobuf_buffer *vb);
void (*buf_release)(struct file *file,struct videobuf_buffer *vb);
};
struct videobuf_queue {
struct semaphore lock;
spinlock_t *irqlock;
struct pci_dev *pci;
int type;
int msize;
struct videobuf_buffer *bufs[VIDEO_MAX_FRAME];
struct videobuf_queue_ops *ops;
/* capture via mmap() + ioctl(QBUF/DQBUF) */
int streaming;
struct list_head stream;
/* capture via read() */
int reading;
int read_off;
struct videobuf_buffer *read_buf;
};
void* videobuf_alloc(int size);
int videobuf_waiton(struct videobuf_buffer *vb, int non_blocking, int intr); int videobuf_waiton(struct videobuf_buffer *vb, int non_blocking, int intr);
int videobuf_iolock(struct pci_dev *pci, struct videobuf_buffer *vb); int videobuf_iolock(struct pci_dev *pci, struct videobuf_buffer *vb);
void videobuf_queue_init(struct videobuf_queue *q,
struct videobuf_queue_ops *ops,
struct pci_dev *pci, spinlock_t *irqlock,
int type, int msize);
void videobuf_queue_cancel(struct file *file, struct videobuf_queue *q);
#ifdef HAVE_V4L2 #ifdef HAVE_V4L2
void videobuf_status(struct v4l2_buffer *b, struct videobuf_buffer *vb); void videobuf_status(struct v4l2_buffer *b, struct videobuf_buffer *vb,
int type);
int videobuf_reqbufs(struct file *file, struct videobuf_queue *q,
struct v4l2_requestbuffers *req);
int videobuf_querybuf(struct videobuf_queue *q, struct v4l2_buffer *b);
int videobuf_qbuf(struct file *file, struct videobuf_queue *q,
struct v4l2_buffer *b);
int videobuf_dqbuf(struct file *file, struct videobuf_queue *q,
struct v4l2_buffer *b);
#endif #endif
int videobuf_streamon(struct file *file, struct videobuf_queue *q);
int videobuf_mmap_setup(struct file *file, struct videobuf_buffer **buflist, int videobuf_streamoff(struct file *file, struct videobuf_queue *q);
int msize, int bcount, int bsize, int type,
videobuf_buffer_free free); int videobuf_read_start(struct file *file, struct videobuf_queue *q);
int videobuf_mmap_free(struct file *file, struct videobuf_buffer **buflist); void videobuf_read_stop(struct file *file, struct videobuf_queue *q);
ssize_t videobuf_read_stream(struct file *file, struct videobuf_queue *q,
char *data, size_t count, loff_t *ppos,
int vbihack);
ssize_t videobuf_read_one(struct file *file, struct videobuf_queue *q,
char *data, size_t count, loff_t *ppos);
unsigned int videobuf_poll_stream(struct file *file,
struct videobuf_queue *q,
poll_table *wait);
int videobuf_mmap_setup(struct file *file, struct videobuf_queue *q,
int bcount, int bsize);
int videobuf_mmap_free(struct file *file, struct videobuf_queue *q);
int videobuf_mmap_mapper(struct vm_area_struct *vma, int videobuf_mmap_mapper(struct vm_area_struct *vma,
struct videobuf_buffer **buflist); struct videobuf_queue *q);
/* --------------------------------------------------------------------- */
/* /*
* Local variables: * Local variables:
......
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