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

[media] cx25821: make lots of externals static

A lot of functions and variables were external when they really can be
declared as static.
Signed-off-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 6b1dce25
...@@ -46,15 +46,13 @@ static unsigned int irq_debug; ...@@ -46,15 +46,13 @@ static unsigned int irq_debug;
module_param(irq_debug, int, 0644); module_param(irq_debug, int, 0644);
MODULE_PARM_DESC(irq_debug, "enable debug messages [IRQ handler]"); MODULE_PARM_DESC(irq_debug, "enable debug messages [IRQ handler]");
unsigned int vid_limit = 16; static unsigned int vid_limit = 16;
module_param(vid_limit, int, 0644); module_param(vid_limit, int, 0644);
MODULE_PARM_DESC(vid_limit, "capture memory limit in megabytes"); MODULE_PARM_DESC(vid_limit, "capture memory limit in megabytes");
static void cx25821_init_controls(struct cx25821_dev *dev, int chan_num);
#define FORMAT_FLAGS_PACKED 0x01 #define FORMAT_FLAGS_PACKED 0x01
struct cx25821_fmt formats[] = { static const struct cx25821_fmt formats[] = {
{ {
.name = "8 bpp, gray", .name = "8 bpp, gray",
.fourcc = V4L2_PIX_FMT_GREY, .fourcc = V4L2_PIX_FMT_GREY,
...@@ -83,12 +81,7 @@ struct cx25821_fmt formats[] = { ...@@ -83,12 +81,7 @@ struct cx25821_fmt formats[] = {
}, },
}; };
int cx25821_get_format_size(void) static const struct cx25821_fmt *cx25821_format_by_fourcc(unsigned int fourcc)
{
return ARRAY_SIZE(formats);
}
struct cx25821_fmt *cx25821_format_by_fourcc(unsigned int fourcc)
{ {
unsigned int i; unsigned int i;
...@@ -138,7 +131,7 @@ void cx25821_video_wakeup(struct cx25821_dev *dev, struct cx25821_dmaqueue *q, ...@@ -138,7 +131,7 @@ void cx25821_video_wakeup(struct cx25821_dev *dev, struct cx25821_dmaqueue *q,
pr_err("%s: %d buffers handled (should be 1)\n", __func__, bc); pr_err("%s: %d buffers handled (should be 1)\n", __func__, bc);
} }
int cx25821_set_tvnorm(struct cx25821_dev *dev, v4l2_std_id norm) static int cx25821_set_tvnorm(struct cx25821_dev *dev, v4l2_std_id norm)
{ {
dprintk(1, "%s(norm = 0x%08x) name: [%s]\n", dprintk(1, "%s(norm = 0x%08x) name: [%s]\n",
__func__, (unsigned int)norm, v4l2_norm_to_name(norm)); __func__, (unsigned int)norm, v4l2_norm_to_name(norm));
...@@ -151,7 +144,7 @@ int cx25821_set_tvnorm(struct cx25821_dev *dev, v4l2_std_id norm) ...@@ -151,7 +144,7 @@ int cx25821_set_tvnorm(struct cx25821_dev *dev, v4l2_std_id norm)
return 0; return 0;
} }
struct video_device *cx25821_vdev_init(struct cx25821_dev *dev, static struct video_device *cx25821_vdev_init(struct cx25821_dev *dev,
struct pci_dev *pci, struct pci_dev *pci,
const struct video_device *template, const struct video_device *template,
char *type) char *type)
...@@ -237,7 +230,7 @@ void cx25821_res_free(struct cx25821_dev *dev, struct cx25821_fh *fh, ...@@ -237,7 +230,7 @@ void cx25821_res_free(struct cx25821_dev *dev, struct cx25821_fh *fh,
mutex_unlock(&dev->lock); mutex_unlock(&dev->lock);
} }
int cx25821_video_mux(struct cx25821_dev *dev, unsigned int input) static int cx25821_video_mux(struct cx25821_dev *dev, unsigned int input)
{ {
struct v4l2_routing route; struct v4l2_routing route;
memset(&route, 0, sizeof(route)); memset(&route, 0, sizeof(route));
...@@ -403,7 +396,7 @@ int cx25821_video_irq(struct cx25821_dev *dev, int chan_num, u32 status) ...@@ -403,7 +396,7 @@ int cx25821_video_irq(struct cx25821_dev *dev, int chan_num, u32 status)
return handled; return handled;
} }
int cx25821_buffer_setup(struct videobuf_queue *q, unsigned int *count, static int cx25821_buffer_setup(struct videobuf_queue *q, unsigned int *count,
unsigned int *size) unsigned int *size)
{ {
struct cx25821_fh *fh = q->priv_data; struct cx25821_fh *fh = q->priv_data;
...@@ -419,7 +412,7 @@ int cx25821_buffer_setup(struct videobuf_queue *q, unsigned int *count, ...@@ -419,7 +412,7 @@ int cx25821_buffer_setup(struct videobuf_queue *q, unsigned int *count,
return 0; return 0;
} }
int cx25821_buffer_prepare(struct videobuf_queue *q, struct videobuf_buffer *vb, static int cx25821_buffer_prepare(struct videobuf_queue *q, struct videobuf_buffer *vb,
enum v4l2_field field) enum v4l2_field field)
{ {
struct cx25821_fh *fh = q->priv_data; struct cx25821_fh *fh = q->priv_data;
...@@ -546,7 +539,7 @@ int cx25821_buffer_prepare(struct videobuf_queue *q, struct videobuf_buffer *vb, ...@@ -546,7 +539,7 @@ int cx25821_buffer_prepare(struct videobuf_queue *q, struct videobuf_buffer *vb,
return rc; return rc;
} }
void cx25821_buffer_release(struct videobuf_queue *q, static void cx25821_buffer_release(struct videobuf_queue *q,
struct videobuf_buffer *vb) struct videobuf_buffer *vb)
{ {
struct cx25821_buffer *buf = struct cx25821_buffer *buf =
...@@ -555,7 +548,7 @@ void cx25821_buffer_release(struct videobuf_queue *q, ...@@ -555,7 +548,7 @@ void cx25821_buffer_release(struct videobuf_queue *q,
cx25821_free_buffer(q, buf); cx25821_free_buffer(q, buf);
} }
struct videobuf_queue *get_queue(struct cx25821_fh *fh) static struct videobuf_queue *get_queue(struct cx25821_fh *fh)
{ {
switch (fh->type) { switch (fh->type) {
case V4L2_BUF_TYPE_VIDEO_CAPTURE: case V4L2_BUF_TYPE_VIDEO_CAPTURE:
...@@ -566,7 +559,7 @@ struct videobuf_queue *get_queue(struct cx25821_fh *fh) ...@@ -566,7 +559,7 @@ struct videobuf_queue *get_queue(struct cx25821_fh *fh)
} }
} }
int cx25821_get_resource(struct cx25821_fh *fh, int resource) static int cx25821_get_resource(struct cx25821_fh *fh, int resource)
{ {
switch (fh->type) { switch (fh->type) {
case V4L2_BUF_TYPE_VIDEO_CAPTURE: case V4L2_BUF_TYPE_VIDEO_CAPTURE:
...@@ -577,7 +570,7 @@ int cx25821_get_resource(struct cx25821_fh *fh, int resource) ...@@ -577,7 +570,7 @@ int cx25821_get_resource(struct cx25821_fh *fh, int resource)
} }
} }
int cx25821_video_mmap(struct file *file, struct vm_area_struct *vma) static int cx25821_video_mmap(struct file *file, struct vm_area_struct *vma)
{ {
struct cx25821_fh *fh = file->private_data; struct cx25821_fh *fh = file->private_data;
...@@ -795,6 +788,70 @@ static int video_release(struct file *file) ...@@ -795,6 +788,70 @@ static int video_release(struct file *file)
return 0; return 0;
} }
/* VIDEO IOCTLS */
static int cx25821_vidioc_g_fmt_vid_cap(struct file *file, void *priv,
struct v4l2_format *f)
{
struct cx25821_fh *fh = priv;
f->fmt.pix.width = fh->width;
f->fmt.pix.height = fh->height;
f->fmt.pix.field = fh->vidq.field;
f->fmt.pix.pixelformat = fh->fmt->fourcc;
f->fmt.pix.bytesperline = (f->fmt.pix.width * fh->fmt->depth) >> 3;
f->fmt.pix.sizeimage = f->fmt.pix.height * f->fmt.pix.bytesperline;
return 0;
}
static int cx25821_vidioc_try_fmt_vid_cap(struct file *file, void *priv,
struct v4l2_format *f)
{
const struct cx25821_fmt *fmt;
enum v4l2_field field;
unsigned int maxw, maxh;
fmt = cx25821_format_by_fourcc(f->fmt.pix.pixelformat);
if (NULL == fmt)
return -EINVAL;
field = f->fmt.pix.field;
maxw = 720;
maxh = 576;
if (V4L2_FIELD_ANY == field) {
if (f->fmt.pix.height > maxh / 2)
field = V4L2_FIELD_INTERLACED;
else
field = V4L2_FIELD_TOP;
}
switch (field) {
case V4L2_FIELD_TOP:
case V4L2_FIELD_BOTTOM:
maxh = maxh / 2;
break;
case V4L2_FIELD_INTERLACED:
break;
default:
return -EINVAL;
}
f->fmt.pix.field = field;
if (f->fmt.pix.height < 32)
f->fmt.pix.height = 32;
if (f->fmt.pix.height > maxh)
f->fmt.pix.height = maxh;
if (f->fmt.pix.width < 48)
f->fmt.pix.width = 48;
if (f->fmt.pix.width > maxw)
f->fmt.pix.width = maxw;
f->fmt.pix.width &= ~0x03;
f->fmt.pix.bytesperline = (f->fmt.pix.width * fmt->depth) >> 3;
f->fmt.pix.sizeimage = f->fmt.pix.height * f->fmt.pix.bytesperline;
return 0;
}
static int vidioc_streamon(struct file *file, void *priv, enum v4l2_buf_type i) static int vidioc_streamon(struct file *file, void *priv, enum v4l2_buf_type i)
{ {
struct cx25821_fh *fh = priv; struct cx25821_fh *fh = priv;
...@@ -832,6 +889,43 @@ static int vidioc_streamoff(struct file *file, void *priv, enum v4l2_buf_type i) ...@@ -832,6 +889,43 @@ static int vidioc_streamoff(struct file *file, void *priv, enum v4l2_buf_type i)
return 0; return 0;
} }
static int cx25821_is_valid_width(u32 width, v4l2_std_id tvnorm)
{
if (tvnorm == V4L2_STD_PAL_BG) {
if (width == 352 || width == 720)
return 1;
else
return 0;
}
if (tvnorm == V4L2_STD_NTSC_M) {
if (width == 320 || width == 352 || width == 720)
return 1;
else
return 0;
}
return 0;
}
static int cx25821_is_valid_height(u32 height, v4l2_std_id tvnorm)
{
if (tvnorm == V4L2_STD_PAL_BG) {
if (height == 576 || height == 288)
return 1;
else
return 0;
}
if (tvnorm == V4L2_STD_NTSC_M) {
if (height == 480 || height == 240)
return 1;
else
return 0;
}
return 0;
}
static int vidioc_s_fmt_vid_cap(struct file *file, void *priv, static int vidioc_s_fmt_vid_cap(struct file *file, void *priv,
struct v4l2_format *f) struct v4l2_format *f)
{ {
...@@ -918,89 +1012,8 @@ static int vidioc_log_status(struct file *file, void *priv) ...@@ -918,89 +1012,8 @@ static int vidioc_log_status(struct file *file, void *priv)
return 0; return 0;
} }
static int vidioc_s_ctrl(struct file *file, void *priv,
struct v4l2_control *ctl)
{
struct cx25821_fh *fh = priv;
struct cx25821_dev *dev = ((struct cx25821_fh *)priv)->dev;
int err;
if (fh) {
err = v4l2_prio_check(&dev->channels[fh->channel_id].prio,
fh->prio);
if (0 != err)
return err;
}
return cx25821_set_control(dev, ctl, fh->channel_id);
}
/* VIDEO IOCTLS */
int cx25821_vidioc_g_fmt_vid_cap(struct file *file, void *priv,
struct v4l2_format *f)
{
struct cx25821_fh *fh = priv;
f->fmt.pix.width = fh->width;
f->fmt.pix.height = fh->height;
f->fmt.pix.field = fh->vidq.field;
f->fmt.pix.pixelformat = fh->fmt->fourcc;
f->fmt.pix.bytesperline = (f->fmt.pix.width * fh->fmt->depth) >> 3;
f->fmt.pix.sizeimage = f->fmt.pix.height * f->fmt.pix.bytesperline;
return 0;
}
int cx25821_vidioc_try_fmt_vid_cap(struct file *file, void *priv,
struct v4l2_format *f)
{
struct cx25821_fmt *fmt;
enum v4l2_field field;
unsigned int maxw, maxh;
fmt = cx25821_format_by_fourcc(f->fmt.pix.pixelformat);
if (NULL == fmt)
return -EINVAL;
field = f->fmt.pix.field;
maxw = 720;
maxh = 576;
if (V4L2_FIELD_ANY == field) {
if (f->fmt.pix.height > maxh / 2)
field = V4L2_FIELD_INTERLACED;
else
field = V4L2_FIELD_TOP;
}
switch (field) {
case V4L2_FIELD_TOP:
case V4L2_FIELD_BOTTOM:
maxh = maxh / 2;
break;
case V4L2_FIELD_INTERLACED:
break;
default:
return -EINVAL;
}
f->fmt.pix.field = field;
if (f->fmt.pix.height < 32)
f->fmt.pix.height = 32;
if (f->fmt.pix.height > maxh)
f->fmt.pix.height = maxh;
if (f->fmt.pix.width < 48)
f->fmt.pix.width = 48;
if (f->fmt.pix.width > maxw)
f->fmt.pix.width = maxw;
f->fmt.pix.width &= ~0x03;
f->fmt.pix.bytesperline = (f->fmt.pix.width * fmt->depth) >> 3;
f->fmt.pix.sizeimage = f->fmt.pix.height * f->fmt.pix.bytesperline;
return 0;
}
int cx25821_vidioc_querycap(struct file *file, void *priv, static int cx25821_vidioc_querycap(struct file *file, void *priv,
struct v4l2_capability *cap) struct v4l2_capability *cap)
{ {
struct cx25821_dev *dev = ((struct cx25821_fh *)priv)->dev; struct cx25821_dev *dev = ((struct cx25821_fh *)priv)->dev;
...@@ -1020,7 +1033,7 @@ int cx25821_vidioc_querycap(struct file *file, void *priv, ...@@ -1020,7 +1033,7 @@ int cx25821_vidioc_querycap(struct file *file, void *priv,
return 0; return 0;
} }
int cx25821_vidioc_enum_fmt_vid_cap(struct file *file, void *priv, static int cx25821_vidioc_enum_fmt_vid_cap(struct file *file, void *priv,
struct v4l2_fmtdesc *f) struct v4l2_fmtdesc *f)
{ {
if (unlikely(f->index >= ARRAY_SIZE(formats))) if (unlikely(f->index >= ARRAY_SIZE(formats)))
...@@ -1032,27 +1045,27 @@ int cx25821_vidioc_enum_fmt_vid_cap(struct file *file, void *priv, ...@@ -1032,27 +1045,27 @@ int cx25821_vidioc_enum_fmt_vid_cap(struct file *file, void *priv,
return 0; return 0;
} }
int cx25821_vidioc_reqbufs(struct file *file, void *priv, static int cx25821_vidioc_reqbufs(struct file *file, void *priv,
struct v4l2_requestbuffers *p) struct v4l2_requestbuffers *p)
{ {
struct cx25821_fh *fh = priv; struct cx25821_fh *fh = priv;
return videobuf_reqbufs(get_queue(fh), p); return videobuf_reqbufs(get_queue(fh), p);
} }
int cx25821_vidioc_querybuf(struct file *file, void *priv, static int cx25821_vidioc_querybuf(struct file *file, void *priv,
struct v4l2_buffer *p) struct v4l2_buffer *p)
{ {
struct cx25821_fh *fh = priv; struct cx25821_fh *fh = priv;
return videobuf_querybuf(get_queue(fh), p); return videobuf_querybuf(get_queue(fh), p);
} }
int cx25821_vidioc_qbuf(struct file *file, void *priv, struct v4l2_buffer *p) static int cx25821_vidioc_qbuf(struct file *file, void *priv, struct v4l2_buffer *p)
{ {
struct cx25821_fh *fh = priv; struct cx25821_fh *fh = priv;
return videobuf_qbuf(get_queue(fh), p); return videobuf_qbuf(get_queue(fh), p);
} }
int cx25821_vidioc_g_priority(struct file *file, void *f, enum v4l2_priority *p) static int cx25821_vidioc_g_priority(struct file *file, void *f, enum v4l2_priority *p)
{ {
struct cx25821_dev *dev = ((struct cx25821_fh *)f)->dev; struct cx25821_dev *dev = ((struct cx25821_fh *)f)->dev;
struct cx25821_fh *fh = f; struct cx25821_fh *fh = f;
...@@ -1062,7 +1075,7 @@ int cx25821_vidioc_g_priority(struct file *file, void *f, enum v4l2_priority *p) ...@@ -1062,7 +1075,7 @@ int cx25821_vidioc_g_priority(struct file *file, void *f, enum v4l2_priority *p)
return 0; return 0;
} }
int cx25821_vidioc_s_priority(struct file *file, void *f, static int cx25821_vidioc_s_priority(struct file *file, void *f,
enum v4l2_priority prio) enum v4l2_priority prio)
{ {
struct cx25821_fh *fh = f; struct cx25821_fh *fh = f;
...@@ -1072,7 +1085,7 @@ int cx25821_vidioc_s_priority(struct file *file, void *f, ...@@ -1072,7 +1085,7 @@ int cx25821_vidioc_s_priority(struct file *file, void *f,
prio); prio);
} }
int cx25821_vidioc_g_std(struct file *file, void *priv, v4l2_std_id *tvnorms) static int cx25821_vidioc_g_std(struct file *file, void *priv, v4l2_std_id *tvnorms)
{ {
struct cx25821_dev *dev = ((struct cx25821_fh *)priv)->dev; struct cx25821_dev *dev = ((struct cx25821_fh *)priv)->dev;
...@@ -1107,18 +1120,20 @@ int cx25821_vidioc_s_std(struct file *file, void *priv, v4l2_std_id tvnorms) ...@@ -1107,18 +1120,20 @@ int cx25821_vidioc_s_std(struct file *file, void *priv, v4l2_std_id tvnorms)
return 0; return 0;
} }
int cx25821_enum_input(struct cx25821_dev *dev, struct v4l2_input *i) static int cx25821_vidioc_enum_input(struct file *file, void *priv,
struct v4l2_input *i)
{ {
static const char * const iname[] = { static const char * const iname[] = {
[CX25821_VMUX_COMPOSITE] = "Composite", [CX25821_VMUX_COMPOSITE] = "Composite",
[CX25821_VMUX_SVIDEO] = "S-Video", [CX25821_VMUX_SVIDEO] = "S-Video",
[CX25821_VMUX_DEBUG] = "for debug only", [CX25821_VMUX_DEBUG] = "for debug only",
}; };
struct cx25821_dev *dev = ((struct cx25821_fh *)priv)->dev;
unsigned int n; unsigned int n;
dprintk(1, "%s()\n", __func__); dprintk(1, "%s()\n", __func__);
n = i->index; n = i->index;
if (n >= 2) if (n >= CX25821_NR_INPUT)
return -EINVAL; return -EINVAL;
if (0 == INPUT(n)->type) if (0 == INPUT(n)->type)
...@@ -1131,15 +1146,7 @@ int cx25821_enum_input(struct cx25821_dev *dev, struct v4l2_input *i) ...@@ -1131,15 +1146,7 @@ int cx25821_enum_input(struct cx25821_dev *dev, struct v4l2_input *i)
return 0; return 0;
} }
int cx25821_vidioc_enum_input(struct file *file, void *priv, static int cx25821_vidioc_g_input(struct file *file, void *priv, unsigned int *i)
struct v4l2_input *i)
{
struct cx25821_dev *dev = ((struct cx25821_fh *)priv)->dev;
dprintk(1, "%s()\n", __func__);
return cx25821_enum_input(dev, i);
}
int cx25821_vidioc_g_input(struct file *file, void *priv, unsigned int *i)
{ {
struct cx25821_dev *dev = ((struct cx25821_fh *)priv)->dev; struct cx25821_dev *dev = ((struct cx25821_fh *)priv)->dev;
...@@ -1148,7 +1155,7 @@ int cx25821_vidioc_g_input(struct file *file, void *priv, unsigned int *i) ...@@ -1148,7 +1155,7 @@ int cx25821_vidioc_g_input(struct file *file, void *priv, unsigned int *i)
return 0; return 0;
} }
int cx25821_vidioc_s_input(struct file *file, void *priv, unsigned int i) static int cx25821_vidioc_s_input(struct file *file, void *priv, unsigned int i)
{ {
struct cx25821_fh *fh = priv; struct cx25821_fh *fh = priv;
struct cx25821_dev *dev = ((struct cx25821_fh *)priv)->dev; struct cx25821_dev *dev = ((struct cx25821_fh *)priv)->dev;
...@@ -1262,7 +1269,7 @@ static int cx25821_ctrl_query(struct v4l2_queryctrl *qctrl) ...@@ -1262,7 +1269,7 @@ static int cx25821_ctrl_query(struct v4l2_queryctrl *qctrl)
return 0; return 0;
} }
int cx25821_vidioc_queryctrl(struct file *file, void *priv, static int cx25821_vidioc_queryctrl(struct file *file, void *priv,
struct v4l2_queryctrl *qctrl) struct v4l2_queryctrl *qctrl)
{ {
return cx25821_ctrl_query(qctrl); return cx25821_ctrl_query(qctrl);
...@@ -1281,7 +1288,7 @@ static const struct v4l2_queryctrl *ctrl_by_id(unsigned int id) ...@@ -1281,7 +1288,7 @@ static const struct v4l2_queryctrl *ctrl_by_id(unsigned int id)
return NULL; return NULL;
} }
int cx25821_vidioc_g_ctrl(struct file *file, void *priv, static int cx25821_vidioc_g_ctrl(struct file *file, void *priv,
struct v4l2_control *ctl) struct v4l2_control *ctl)
{ {
struct cx25821_dev *dev = ((struct cx25821_fh *)priv)->dev; struct cx25821_dev *dev = ((struct cx25821_fh *)priv)->dev;
...@@ -1310,7 +1317,7 @@ int cx25821_vidioc_g_ctrl(struct file *file, void *priv, ...@@ -1310,7 +1317,7 @@ int cx25821_vidioc_g_ctrl(struct file *file, void *priv,
return 0; return 0;
} }
int cx25821_set_control(struct cx25821_dev *dev, static int cx25821_set_control(struct cx25821_dev *dev,
struct v4l2_control *ctl, int chan_num) struct v4l2_control *ctl, int chan_num)
{ {
int err; int err;
...@@ -1360,6 +1367,23 @@ int cx25821_set_control(struct cx25821_dev *dev, ...@@ -1360,6 +1367,23 @@ int cx25821_set_control(struct cx25821_dev *dev,
return err; return err;
} }
static int vidioc_s_ctrl(struct file *file, void *priv,
struct v4l2_control *ctl)
{
struct cx25821_fh *fh = priv;
struct cx25821_dev *dev = ((struct cx25821_fh *)priv)->dev;
int err;
if (fh) {
err = v4l2_prio_check(&dev->channels[fh->channel_id].prio,
fh->prio);
if (0 != err)
return err;
}
return cx25821_set_control(dev, ctl, fh->channel_id);
}
static void cx25821_init_controls(struct cx25821_dev *dev, int chan_num) static void cx25821_init_controls(struct cx25821_dev *dev, int chan_num)
{ {
struct v4l2_control ctrl; struct v4l2_control ctrl;
...@@ -1372,7 +1396,7 @@ static void cx25821_init_controls(struct cx25821_dev *dev, int chan_num) ...@@ -1372,7 +1396,7 @@ static void cx25821_init_controls(struct cx25821_dev *dev, int chan_num)
} }
} }
int cx25821_vidioc_cropcap(struct file *file, void *priv, static int cx25821_vidioc_cropcap(struct file *file, void *priv,
struct v4l2_cropcap *cropcap) struct v4l2_cropcap *cropcap)
{ {
struct cx25821_dev *dev = ((struct cx25821_fh *)priv)->dev; struct cx25821_dev *dev = ((struct cx25821_fh *)priv)->dev;
...@@ -1391,7 +1415,7 @@ int cx25821_vidioc_cropcap(struct file *file, void *priv, ...@@ -1391,7 +1415,7 @@ int cx25821_vidioc_cropcap(struct file *file, void *priv,
return 0; return 0;
} }
int cx25821_vidioc_s_crop(struct file *file, void *priv, const struct v4l2_crop *crop) static int cx25821_vidioc_s_crop(struct file *file, void *priv, const struct v4l2_crop *crop)
{ {
struct cx25821_dev *dev = ((struct cx25821_fh *)priv)->dev; struct cx25821_dev *dev = ((struct cx25821_fh *)priv)->dev;
struct cx25821_fh *fh = priv; struct cx25821_fh *fh = priv;
...@@ -1407,49 +1431,12 @@ int cx25821_vidioc_s_crop(struct file *file, void *priv, const struct v4l2_crop ...@@ -1407,49 +1431,12 @@ int cx25821_vidioc_s_crop(struct file *file, void *priv, const struct v4l2_crop
return -EINVAL; return -EINVAL;
} }
int cx25821_vidioc_g_crop(struct file *file, void *priv, struct v4l2_crop *crop) static int cx25821_vidioc_g_crop(struct file *file, void *priv, struct v4l2_crop *crop)
{ {
/* cx25821_vidioc_g_crop not supported */ /* cx25821_vidioc_g_crop not supported */
return -EINVAL; return -EINVAL;
} }
int cx25821_is_valid_width(u32 width, v4l2_std_id tvnorm)
{
if (tvnorm == V4L2_STD_PAL_BG) {
if (width == 352 || width == 720)
return 1;
else
return 0;
}
if (tvnorm == V4L2_STD_NTSC_M) {
if (width == 320 || width == 352 || width == 720)
return 1;
else
return 0;
}
return 0;
}
int cx25821_is_valid_height(u32 height, v4l2_std_id tvnorm)
{
if (tvnorm == V4L2_STD_PAL_BG) {
if (height == 576 || height == 288)
return 1;
else
return 0;
}
if (tvnorm == V4L2_STD_NTSC_M) {
if (height == 480 || height == 240)
return 1;
else
return 0;
}
return 0;
}
static long video_ioctl_upstream9(struct file *file, unsigned int cmd, static long video_ioctl_upstream9(struct file *file, unsigned int cmd,
unsigned long arg) unsigned long arg)
{ {
......
...@@ -63,97 +63,23 @@ do { \ ...@@ -63,97 +63,23 @@ do { \
#define MEDUSA_READ 910 #define MEDUSA_READ 910
#define MEDUSA_WRITE 911 #define MEDUSA_WRITE 911
extern unsigned int vid_limit;
#define FORMAT_FLAGS_PACKED 0x01 #define FORMAT_FLAGS_PACKED 0x01
extern struct cx25821_fmt formats[];
extern struct cx25821_fmt *cx25821_format_by_fourcc(unsigned int fourcc);
extern struct cx25821_data timeout_data[MAX_VID_CHANNEL_NUM];
extern void cx25821_video_wakeup(struct cx25821_dev *dev, extern void cx25821_video_wakeup(struct cx25821_dev *dev,
struct cx25821_dmaqueue *q, u32 count); struct cx25821_dmaqueue *q, u32 count);
extern int cx25821_set_tvnorm(struct cx25821_dev *dev, v4l2_std_id norm);
extern int cx25821_res_get(struct cx25821_dev *dev, struct cx25821_fh *fh, extern int cx25821_res_get(struct cx25821_dev *dev, struct cx25821_fh *fh,
unsigned int bit); unsigned int bit);
extern int cx25821_res_check(struct cx25821_fh *fh, unsigned int bit); extern int cx25821_res_check(struct cx25821_fh *fh, unsigned int bit);
extern int cx25821_res_locked(struct cx25821_fh *fh, unsigned int bit); extern int cx25821_res_locked(struct cx25821_fh *fh, unsigned int bit);
extern void cx25821_res_free(struct cx25821_dev *dev, struct cx25821_fh *fh, extern void cx25821_res_free(struct cx25821_dev *dev, struct cx25821_fh *fh,
unsigned int bits); unsigned int bits);
extern int cx25821_video_mux(struct cx25821_dev *dev, unsigned int input);
extern int cx25821_start_video_dma(struct cx25821_dev *dev, extern int cx25821_start_video_dma(struct cx25821_dev *dev,
struct cx25821_dmaqueue *q, struct cx25821_dmaqueue *q,
struct cx25821_buffer *buf, struct cx25821_buffer *buf,
const struct sram_channel *channel); const struct sram_channel *channel);
extern int cx25821_set_scale(struct cx25821_dev *dev, unsigned int width,
unsigned int height, enum v4l2_field field);
extern int cx25821_video_irq(struct cx25821_dev *dev, int chan_num, u32 status); extern int cx25821_video_irq(struct cx25821_dev *dev, int chan_num, u32 status);
extern void cx25821_video_unregister(struct cx25821_dev *dev, int chan_num); extern void cx25821_video_unregister(struct cx25821_dev *dev, int chan_num);
extern int cx25821_video_register(struct cx25821_dev *dev); extern int cx25821_video_register(struct cx25821_dev *dev);
extern int cx25821_get_format_size(void);
extern int cx25821_buffer_setup(struct videobuf_queue *q, unsigned int *count,
unsigned int *size);
extern int cx25821_buffer_prepare(struct videobuf_queue *q,
struct videobuf_buffer *vb,
enum v4l2_field field);
extern void cx25821_buffer_release(struct videobuf_queue *q,
struct videobuf_buffer *vb);
extern struct videobuf_queue *get_queue(struct cx25821_fh *fh);
extern int cx25821_get_resource(struct cx25821_fh *fh, int resource);
extern int cx25821_video_mmap(struct file *file, struct vm_area_struct *vma);
extern int cx25821_vidioc_try_fmt_vid_cap(struct file *file, void *priv,
struct v4l2_format *f);
extern int cx25821_vidioc_querycap(struct file *file, void *priv,
struct v4l2_capability *cap);
extern int cx25821_vidioc_enum_fmt_vid_cap(struct file *file, void *priv,
struct v4l2_fmtdesc *f);
extern int cx25821_vidioc_reqbufs(struct file *file, void *priv,
struct v4l2_requestbuffers *p);
extern int cx25821_vidioc_querybuf(struct file *file, void *priv,
struct v4l2_buffer *p);
extern int cx25821_vidioc_qbuf(struct file *file, void *priv,
struct v4l2_buffer *p);
extern int cx25821_vidioc_s_std(struct file *file, void *priv,
v4l2_std_id tvnorms);
extern int cx25821_enum_input(struct cx25821_dev *dev, struct v4l2_input *i);
extern int cx25821_vidioc_enum_input(struct file *file, void *priv,
struct v4l2_input *i);
extern int cx25821_vidioc_g_input(struct file *file, void *priv,
unsigned int *i);
extern int cx25821_vidioc_s_input(struct file *file, void *priv,
unsigned int i);
extern int cx25821_vidioc_g_ctrl(struct file *file, void *priv,
struct v4l2_control *ctl);
extern int cx25821_vidioc_g_fmt_vid_cap(struct file *file, void *priv,
struct v4l2_format *f);
extern int cx25821_vidioc_g_register(struct file *file, void *fh,
struct v4l2_dbg_register *reg);
extern int cx25821_vidioc_s_register(struct file *file, void *fh,
const struct v4l2_dbg_register *reg);
extern int cx25821_is_valid_width(u32 width, v4l2_std_id tvnorm);
extern int cx25821_is_valid_height(u32 height, v4l2_std_id tvnorm);
extern int cx25821_vidioc_g_priority(struct file *file, void *f,
enum v4l2_priority *p);
extern int cx25821_vidioc_s_priority(struct file *file, void *f,
enum v4l2_priority prio);
extern int cx25821_vidioc_queryctrl(struct file *file, void *priv,
struct v4l2_queryctrl *qctrl);
extern int cx25821_set_control(struct cx25821_dev *dev,
struct v4l2_control *ctrl, int chan_num);
extern int cx25821_vidioc_cropcap(struct file *file, void *fh,
struct v4l2_cropcap *cropcap);
extern int cx25821_vidioc_s_crop(struct file *file, void *priv,
const struct v4l2_crop *crop);
extern int cx25821_vidioc_g_crop(struct file *file, void *priv,
struct v4l2_crop *crop);
extern int cx25821_vidioc_querystd(struct file *file, void *priv,
v4l2_std_id *norm);
#endif #endif
...@@ -127,7 +127,7 @@ struct cx25821_fh { ...@@ -127,7 +127,7 @@ struct cx25821_fh {
enum v4l2_priority prio; enum v4l2_priority prio;
/* video capture */ /* video capture */
struct cx25821_fmt *fmt; const struct cx25821_fmt *fmt;
unsigned int width, height; unsigned int width, height;
int channel_id; int channel_id;
struct videobuf_queue vidq; struct videobuf_queue vidq;
...@@ -152,7 +152,7 @@ struct cx25821_buffer { ...@@ -152,7 +152,7 @@ struct cx25821_buffer {
/* cx25821 specific */ /* cx25821 specific */
unsigned int bpl; unsigned int bpl;
struct btcx_riscmem risc; struct btcx_riscmem risc;
struct cx25821_fmt *fmt; const struct cx25821_fmt *fmt;
u32 count; u32 count;
}; };
...@@ -565,8 +565,5 @@ extern int cx25821_sram_channel_setup_upstream(struct cx25821_dev *dev, ...@@ -565,8 +565,5 @@ extern int cx25821_sram_channel_setup_upstream(struct cx25821_dev *dev,
unsigned int bpl, u32 risc); unsigned int bpl, u32 risc);
extern void cx25821_set_pixel_format(struct cx25821_dev *dev, int channel, extern void cx25821_set_pixel_format(struct cx25821_dev *dev, int channel,
u32 format); u32 format);
extern struct video_device *cx25821_vdev_init(struct cx25821_dev *dev,
struct pci_dev *pci,
const struct video_device *template,
char *type);
#endif #endif
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