mwl8k: change maintenance status
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / drivers / staging / cx25821 / cx25821-video.h
blob0bddc02be57d6df2a77acd0b47019db477c8e600
1 /*
2 * Driver for the Conexant CX25821 PCIe bridge
4 * Copyright (C) 2009 Conexant Systems Inc.
5 * Authors <shu.lin@conexant.com>, <hiep.huynh@conexant.com>
6 * Based on Steven Toth <stoth@linuxtv.org> cx23885 driver
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24 #ifndef CX25821_VIDEO_H_
25 #define CX25821_VIDEO_H_
27 #include <linux/init.h>
28 #include <linux/list.h>
29 #include <linux/module.h>
30 #include <linux/moduleparam.h>
31 #include <linux/kmod.h>
32 #include <linux/kernel.h>
33 #include <linux/slab.h>
34 #include <linux/interrupt.h>
35 #include <linux/delay.h>
36 #include <linux/kthread.h>
37 #include <asm/div64.h>
39 #include "cx25821.h"
40 #include <media/v4l2-common.h>
41 #include <media/v4l2-ioctl.h>
43 #ifdef CONFIG_VIDEO_V4L1_COMPAT
44 /* Include V4L1 specific functions. Should be removed soon */
45 #include <linux/videodev.h>
46 #endif
48 #define TUNER_FLAG
50 #define VIDEO_DEBUG 0
52 #define dprintk(level, fmt, arg...)\
53 do { if (VIDEO_DEBUG >= level)\
54 printk(KERN_DEBUG "%s/0: " fmt, dev->name, ## arg);\
55 } while (0)
57 //For IOCTL to identify running upstream
58 #define UPSTREAM_START_VIDEO 700
59 #define UPSTREAM_STOP_VIDEO 701
60 #define UPSTREAM_START_AUDIO 702
61 #define UPSTREAM_STOP_AUDIO 703
62 #define UPSTREAM_DUMP_REGISTERS 702
63 #define SET_VIDEO_STD 800
64 #define SET_PIXEL_FORMAT 1000
65 #define ENABLE_CIF_RESOLUTION 1001
67 #define REG_READ 900
68 #define REG_WRITE 901
69 #define MEDUSA_READ 910
70 #define MEDUSA_WRITE 911
72 extern struct sram_channel *channel0;
73 extern struct sram_channel *channel1;
74 extern struct sram_channel *channel2;
75 extern struct sram_channel *channel3;
76 extern struct sram_channel *channel4;
77 extern struct sram_channel *channel5;
78 extern struct sram_channel *channel6;
79 extern struct sram_channel *channel7;
80 extern struct sram_channel *channel9;
81 extern struct sram_channel *channel10;
82 extern struct sram_channel *channel11;
83 extern struct video_device cx25821_video_template0;
84 extern struct video_device cx25821_video_template1;
85 extern struct video_device cx25821_video_template2;
86 extern struct video_device cx25821_video_template3;
87 extern struct video_device cx25821_video_template4;
88 extern struct video_device cx25821_video_template5;
89 extern struct video_device cx25821_video_template6;
90 extern struct video_device cx25821_video_template7;
91 extern struct video_device cx25821_video_template9;
92 extern struct video_device cx25821_video_template10;
93 extern struct video_device cx25821_video_template11;
94 extern struct video_device cx25821_videoioctl_template;
95 //extern const u32 *ctrl_classes[];
97 extern unsigned int vid_limit;
99 #define FORMAT_FLAGS_PACKED 0x01
100 extern struct cx25821_fmt formats[];
101 extern struct cx25821_fmt *format_by_fourcc(unsigned int fourcc);
102 extern struct cx25821_data timeout_data[MAX_VID_CHANNEL_NUM];
104 extern void cx25821_dump_video_queue(struct cx25821_dev *dev,
105 struct cx25821_dmaqueue *q);
106 extern void cx25821_video_wakeup(struct cx25821_dev *dev,
107 struct cx25821_dmaqueue *q, u32 count);
109 #ifdef TUNER_FLAG
110 extern int cx25821_set_tvnorm(struct cx25821_dev *dev, v4l2_std_id norm);
111 #endif
113 extern int cx25821_res_get(struct cx25821_dev *dev, struct cx25821_fh *fh,
114 unsigned int bit);
115 extern int cx25821_res_check(struct cx25821_fh *fh, unsigned int bit);
116 extern int cx25821_res_locked(struct cx25821_dev *dev, unsigned int bit);
117 extern void cx25821_res_free(struct cx25821_dev *dev, struct cx25821_fh *fh,
118 unsigned int bits);
119 extern int cx25821_video_mux(struct cx25821_dev *dev, unsigned int input);
120 extern int cx25821_start_video_dma(struct cx25821_dev *dev,
121 struct cx25821_dmaqueue *q,
122 struct cx25821_buffer *buf,
123 struct sram_channel *channel);
125 extern int cx25821_set_scale(struct cx25821_dev *dev, unsigned int width,
126 unsigned int height, enum v4l2_field field);
127 extern int cx25821_video_irq(struct cx25821_dev *dev, int chan_num, u32 status);
128 extern void cx25821_video_unregister(struct cx25821_dev *dev, int chan_num);
129 extern int cx25821_video_register(struct cx25821_dev *dev, int chan_num,
130 struct video_device *video_template);
131 extern int cx25821_get_format_size(void);
133 extern int cx25821_buffer_setup(struct videobuf_queue *q, unsigned int *count,
134 unsigned int *size);
135 extern int cx25821_buffer_prepare(struct videobuf_queue *q, struct videobuf_buffer *vb,
136 enum v4l2_field field);
137 extern void cx25821_buffer_release(struct videobuf_queue *q,
138 struct videobuf_buffer *vb);
139 extern struct videobuf_queue *get_queue(struct cx25821_fh *fh);
140 extern int cx25821_get_resource(struct cx25821_fh *fh, int resource);
141 extern int cx25821_video_mmap(struct file *file, struct vm_area_struct *vma);
142 extern int cx25821_vidioc_try_fmt_vid_cap(struct file *file, void *priv,
143 struct v4l2_format *f);
144 extern int cx25821_vidioc_querycap(struct file *file, void *priv,
145 struct v4l2_capability *cap);
146 extern int cx25821_vidioc_enum_fmt_vid_cap(struct file *file, void *priv,
147 struct v4l2_fmtdesc *f);
148 extern int cx25821_vidiocgmbuf(struct file *file, void *priv, struct video_mbuf *mbuf);
149 extern int cx25821_vidioc_reqbufs(struct file *file, void *priv,
150 struct v4l2_requestbuffers *p);
151 extern int cx25821_vidioc_querybuf(struct file *file, void *priv,
152 struct v4l2_buffer *p);
153 extern int cx25821_vidioc_qbuf(struct file *file, void *priv, struct v4l2_buffer *p);
154 extern int cx25821_vidioc_s_std(struct file *file, void *priv, v4l2_std_id * tvnorms);
155 extern int cx25821_enum_input(struct cx25821_dev *dev, struct v4l2_input *i);
156 extern int cx25821_vidioc_enum_input(struct file *file, void *priv,
157 struct v4l2_input *i);
158 extern int cx25821_vidioc_g_input(struct file *file, void *priv, unsigned int *i);
159 extern int cx25821_vidioc_s_input(struct file *file, void *priv, unsigned int i);
160 extern int cx25821_vidioc_g_ctrl(struct file *file, void *priv,
161 struct v4l2_control *ctl);
162 extern int cx25821_vidioc_g_fmt_vid_cap(struct file *file, void *priv,
163 struct v4l2_format *f);
164 extern int cx25821_vidioc_g_frequency(struct file *file, void *priv,
165 struct v4l2_frequency *f);
166 extern int cx25821_set_freq(struct cx25821_dev *dev, struct v4l2_frequency *f);
167 extern int cx25821_vidioc_s_frequency(struct file *file, void *priv,
168 struct v4l2_frequency *f);
169 extern int cx25821_vidioc_g_register(struct file *file, void *fh,
170 struct v4l2_dbg_register *reg);
171 extern int cx25821_vidioc_s_register(struct file *file, void *fh,
172 struct v4l2_dbg_register *reg);
173 extern int cx25821_vidioc_g_tuner(struct file *file, void *priv, struct v4l2_tuner *t);
174 extern int cx25821_vidioc_s_tuner(struct file *file, void *priv, struct v4l2_tuner *t);
176 extern int cx25821_is_valid_width(u32 width, v4l2_std_id tvnorm);
177 extern int cx25821_is_valid_height(u32 height, v4l2_std_id tvnorm);
179 extern int cx25821_vidioc_g_priority(struct file *file, void *f, enum v4l2_priority *p);
180 extern int cx25821_vidioc_s_priority(struct file *file, void *f,
181 enum v4l2_priority prio);
183 extern int cx25821_vidioc_queryctrl(struct file *file, void *priv,
184 struct v4l2_queryctrl *qctrl);
185 extern int cx25821_set_control(struct cx25821_dev *dev,
186 struct v4l2_control *ctrl, int chan_num);
188 extern int cx25821_vidioc_cropcap(struct file *file, void *fh,
189 struct v4l2_cropcap *cropcap);
190 extern int cx25821_vidioc_s_crop(struct file *file, void *priv, struct v4l2_crop *crop);
191 extern int cx25821_vidioc_g_crop(struct file *file, void *priv, struct v4l2_crop *crop);
193 extern int cx25821_vidioc_querystd(struct file *file, void *priv, v4l2_std_id * norm);
194 #endif