Commit | Line | Data |
---|---|---|
02b20b0b MCC |
1 | /* |
2 | * Driver for the Conexant CX25821 PCIe bridge | |
3 | * | |
bb4c9a74 | 4 | * Copyright (C) 2009 Conexant Systems Inc. |
02b20b0b MCC |
5 | * Authors <shu.lin@conexant.com>, <hiep.huynh@conexant.com> |
6 | * Based on Steven Toth <stoth@linuxtv.org> cx23885 driver | |
7 | * | |
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. | |
12 | * | |
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 | |
16 | * | |
17 | * GNU General Public License for more details. | |
18 | * | |
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. | |
22 | */ | |
23 | ||
24 | #ifndef CX25821_VIDEO_H_ | |
25 | #define CX25821_VIDEO_H_ | |
26 | ||
02b20b0b MCC |
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> | |
38 | ||
39 | #include "cx25821.h" | |
40 | #include <media/v4l2-common.h> | |
41 | #include <media/v4l2-ioctl.h> | |
42 | ||
02b20b0b MCC |
43 | #define TUNER_FLAG |
44 | ||
45 | #define VIDEO_DEBUG 0 | |
46 | ||
36d89f7d JP |
47 | #define dprintk(level, fmt, arg...) \ |
48 | do { \ | |
49 | if (VIDEO_DEBUG >= level) \ | |
50 | printk(KERN_DEBUG "%s/0: " fmt, dev->name, ##arg); \ | |
51 | } while (0) | |
02b20b0b | 52 | |
1852a1bf | 53 | /* For IOCTL to identify running upstream */ |
02b20b0b MCC |
54 | #define UPSTREAM_START_VIDEO 700 |
55 | #define UPSTREAM_STOP_VIDEO 701 | |
56 | #define UPSTREAM_START_AUDIO 702 | |
57 | #define UPSTREAM_STOP_AUDIO 703 | |
58 | #define UPSTREAM_DUMP_REGISTERS 702 | |
59 | #define SET_VIDEO_STD 800 | |
60 | #define SET_PIXEL_FORMAT 1000 | |
61 | #define ENABLE_CIF_RESOLUTION 1001 | |
62 | ||
63 | #define REG_READ 900 | |
64 | #define REG_WRITE 901 | |
65 | #define MEDUSA_READ 910 | |
9ad6902d | 66 | #define MEDUSA_WRITE 911 |
02b20b0b MCC |
67 | |
68 | extern struct sram_channel *channel0; | |
69 | extern struct sram_channel *channel1; | |
70 | extern struct sram_channel *channel2; | |
71 | extern struct sram_channel *channel3; | |
72 | extern struct sram_channel *channel4; | |
73 | extern struct sram_channel *channel5; | |
74 | extern struct sram_channel *channel6; | |
75 | extern struct sram_channel *channel7; | |
76 | extern struct sram_channel *channel9; | |
77 | extern struct sram_channel *channel10; | |
78 | extern struct sram_channel *channel11; | |
02b20b0b | 79 | extern struct video_device cx25821_videoioctl_template; |
1852a1bf | 80 | /* extern const u32 *ctrl_classes[]; */ |
02b20b0b | 81 | |
1a9fc855 | 82 | extern unsigned int vid_limit; |
02b20b0b MCC |
83 | |
84 | #define FORMAT_FLAGS_PACKED 0x01 | |
85 | extern struct cx25821_fmt formats[]; | |
a757ee22 | 86 | extern struct cx25821_fmt *cx25821_format_by_fourcc(unsigned int fourcc); |
02b20b0b MCC |
87 | extern struct cx25821_data timeout_data[MAX_VID_CHANNEL_NUM]; |
88 | ||
1a9fc855 MCC |
89 | extern void cx25821_video_wakeup(struct cx25821_dev *dev, |
90 | struct cx25821_dmaqueue *q, u32 count); | |
02b20b0b MCC |
91 | |
92 | #ifdef TUNER_FLAG | |
93 | extern int cx25821_set_tvnorm(struct cx25821_dev *dev, v4l2_std_id norm); | |
94 | #endif | |
95 | ||
f2466d63 | 96 | extern int cx25821_res_get(struct cx25821_dev *dev, struct cx25821_fh *fh, |
64eb3244 | 97 | unsigned int bit); |
f2466d63 | 98 | extern int cx25821_res_check(struct cx25821_fh *fh, unsigned int bit); |
6d8c2ba1 | 99 | extern int cx25821_res_locked(struct cx25821_fh *fh, unsigned int bit); |
f2466d63 | 100 | extern void cx25821_res_free(struct cx25821_dev *dev, struct cx25821_fh *fh, |
64eb3244 | 101 | unsigned int bits); |
02b20b0b MCC |
102 | extern int cx25821_video_mux(struct cx25821_dev *dev, unsigned int input); |
103 | extern int cx25821_start_video_dma(struct cx25821_dev *dev, | |
1a9fc855 MCC |
104 | struct cx25821_dmaqueue *q, |
105 | struct cx25821_buffer *buf, | |
106 | struct sram_channel *channel); | |
02b20b0b | 107 | |
1a9fc855 MCC |
108 | extern int cx25821_set_scale(struct cx25821_dev *dev, unsigned int width, |
109 | unsigned int height, enum v4l2_field field); | |
02b20b0b MCC |
110 | extern int cx25821_video_irq(struct cx25821_dev *dev, int chan_num, u32 status); |
111 | extern void cx25821_video_unregister(struct cx25821_dev *dev, int chan_num); | |
6d8c2ba1 | 112 | extern int cx25821_video_register(struct cx25821_dev *dev); |
f2466d63 | 113 | extern int cx25821_get_format_size(void); |
02b20b0b | 114 | |
f2466d63 | 115 | extern int cx25821_buffer_setup(struct videobuf_queue *q, unsigned int *count, |
661d3bf6 LF |
116 | unsigned int *size); |
117 | extern int cx25821_buffer_prepare(struct videobuf_queue *q, | |
118 | struct videobuf_buffer *vb, | |
119 | enum v4l2_field field); | |
f2466d63 | 120 | extern void cx25821_buffer_release(struct videobuf_queue *q, |
64eb3244 | 121 | struct videobuf_buffer *vb); |
02b20b0b | 122 | extern struct videobuf_queue *get_queue(struct cx25821_fh *fh); |
f2466d63 MCC |
123 | extern int cx25821_get_resource(struct cx25821_fh *fh, int resource); |
124 | extern int cx25821_video_mmap(struct file *file, struct vm_area_struct *vma); | |
125 | extern int cx25821_vidioc_try_fmt_vid_cap(struct file *file, void *priv, | |
64eb3244 | 126 | struct v4l2_format *f); |
f2466d63 | 127 | extern int cx25821_vidioc_querycap(struct file *file, void *priv, |
64eb3244 | 128 | struct v4l2_capability *cap); |
f2466d63 | 129 | extern int cx25821_vidioc_enum_fmt_vid_cap(struct file *file, void *priv, |
64eb3244 | 130 | struct v4l2_fmtdesc *f); |
f2466d63 | 131 | extern int cx25821_vidioc_reqbufs(struct file *file, void *priv, |
64eb3244 | 132 | struct v4l2_requestbuffers *p); |
f2466d63 | 133 | extern int cx25821_vidioc_querybuf(struct file *file, void *priv, |
661d3bf6 LF |
134 | struct v4l2_buffer *p); |
135 | extern int cx25821_vidioc_qbuf(struct file *file, void *priv, | |
136 | struct v4l2_buffer *p); | |
137 | extern int cx25821_vidioc_s_std(struct file *file, void *priv, | |
314527ac | 138 | v4l2_std_id tvnorms); |
02b20b0b | 139 | extern int cx25821_enum_input(struct cx25821_dev *dev, struct v4l2_input *i); |
f2466d63 | 140 | extern int cx25821_vidioc_enum_input(struct file *file, void *priv, |
661d3bf6 LF |
141 | struct v4l2_input *i); |
142 | extern int cx25821_vidioc_g_input(struct file *file, void *priv, | |
143 | unsigned int *i); | |
144 | extern int cx25821_vidioc_s_input(struct file *file, void *priv, | |
145 | unsigned int i); | |
f2466d63 | 146 | extern int cx25821_vidioc_g_ctrl(struct file *file, void *priv, |
64eb3244 | 147 | struct v4l2_control *ctl); |
f2466d63 | 148 | extern int cx25821_vidioc_g_fmt_vid_cap(struct file *file, void *priv, |
64eb3244 | 149 | struct v4l2_format *f); |
f2466d63 | 150 | extern int cx25821_vidioc_g_frequency(struct file *file, void *priv, |
64eb3244 | 151 | struct v4l2_frequency *f); |
b530a447 | 152 | extern int cx25821_set_freq(struct cx25821_dev *dev, const struct v4l2_frequency *f); |
f2466d63 | 153 | extern int cx25821_vidioc_s_frequency(struct file *file, void *priv, |
b530a447 | 154 | const struct v4l2_frequency *f); |
f2466d63 | 155 | extern int cx25821_vidioc_g_register(struct file *file, void *fh, |
64eb3244 | 156 | struct v4l2_dbg_register *reg); |
f2466d63 | 157 | extern int cx25821_vidioc_s_register(struct file *file, void *fh, |
977ba3b1 | 158 | const struct v4l2_dbg_register *reg); |
661d3bf6 LF |
159 | extern int cx25821_vidioc_g_tuner(struct file *file, void *priv, |
160 | struct v4l2_tuner *t); | |
161 | extern int cx25821_vidioc_s_tuner(struct file *file, void *priv, | |
2f73c7c5 | 162 | const struct v4l2_tuner *t); |
02b20b0b | 163 | |
f2466d63 MCC |
164 | extern int cx25821_is_valid_width(u32 width, v4l2_std_id tvnorm); |
165 | extern int cx25821_is_valid_height(u32 height, v4l2_std_id tvnorm); | |
02b20b0b | 166 | |
661d3bf6 LF |
167 | extern int cx25821_vidioc_g_priority(struct file *file, void *f, |
168 | enum v4l2_priority *p); | |
f2466d63 | 169 | extern int cx25821_vidioc_s_priority(struct file *file, void *f, |
64eb3244 | 170 | enum v4l2_priority prio); |
02b20b0b | 171 | |
f2466d63 | 172 | extern int cx25821_vidioc_queryctrl(struct file *file, void *priv, |
64eb3244 | 173 | struct v4l2_queryctrl *qctrl); |
1a9fc855 MCC |
174 | extern int cx25821_set_control(struct cx25821_dev *dev, |
175 | struct v4l2_control *ctrl, int chan_num); | |
02b20b0b | 176 | |
f2466d63 | 177 | extern int cx25821_vidioc_cropcap(struct file *file, void *fh, |
661d3bf6 LF |
178 | struct v4l2_cropcap *cropcap); |
179 | extern int cx25821_vidioc_s_crop(struct file *file, void *priv, | |
4f996594 | 180 | const struct v4l2_crop *crop); |
661d3bf6 LF |
181 | extern int cx25821_vidioc_g_crop(struct file *file, void *priv, |
182 | struct v4l2_crop *crop); | |
183 | ||
184 | extern int cx25821_vidioc_querystd(struct file *file, void *priv, | |
185 | v4l2_std_id *norm); | |
02b20b0b | 186 | #endif |