bttvp.h (7df8d5cffa87c0976df5d2e4e9aa6a52fe6c0f50) bttvp.h (b7ec3212a73abc987e8f33aa42988e6c39c38c92)
1/* SPDX-License-Identifier: GPL-2.0-or-later */
2/*
3
4 bttv - Bt848 frame grabber driver
5
6 bttv's *private* header file -- nobody other than bttv itself
7 should ever include this file.
8

--- 12 unchanged lines hidden (view full) ---

21#include <linux/input.h>
22#include <linux/mutex.h>
23#include <linux/scatterlist.h>
24#include <linux/device.h>
25#include <asm/io.h>
26#include <media/v4l2-common.h>
27#include <media/v4l2-ctrls.h>
28#include <media/v4l2-fh.h>
1/* SPDX-License-Identifier: GPL-2.0-or-later */
2/*
3
4 bttv - Bt848 frame grabber driver
5
6 bttv's *private* header file -- nobody other than bttv itself
7 should ever include this file.
8

--- 12 unchanged lines hidden (view full) ---

21#include <linux/input.h>
22#include <linux/mutex.h>
23#include <linux/scatterlist.h>
24#include <linux/device.h>
25#include <asm/io.h>
26#include <media/v4l2-common.h>
27#include <media/v4l2-ctrls.h>
28#include <media/v4l2-fh.h>
29#include <media/videobuf-dma-sg.h>
29#include <media/videobuf2-dma-sg.h>
30#include <media/tveeprom.h>
31#include <media/rc-core.h>
32#include <media/i2c/ir-kbd-i2c.h>
33#include <media/drv-intf/tea575x.h>
34
35#include "bt848.h"
36#include "bttv.h"
37#include "btcx-risc.h"

--- 99 unchanged lines hidden (view full) ---

137struct bttv_geometry {
138 u8 vtc,crop,comb;
139 u16 width,hscale,hdelay;
140 u16 sheight,vscale,vdelay,vtotal;
141};
142
143struct bttv_buffer {
144 /* common v4l buffer stuff -- must be first */
30#include <media/tveeprom.h>
31#include <media/rc-core.h>
32#include <media/i2c/ir-kbd-i2c.h>
33#include <media/drv-intf/tea575x.h>
34
35#include "bt848.h"
36#include "bttv.h"
37#include "btcx-risc.h"

--- 99 unchanged lines hidden (view full) ---

137struct bttv_geometry {
138 u8 vtc,crop,comb;
139 u16 width,hscale,hdelay;
140 u16 sheight,vscale,vdelay,vtotal;
141};
142
143struct bttv_buffer {
144 /* common v4l buffer stuff -- must be first */
145 struct videobuf_buffer vb;
145 struct vb2_v4l2_buffer vbuf;
146 struct list_head list;
146
147 /* bttv specific */
148 int btformat;
149 int btswap;
150 struct bttv_geometry geo;
151 struct btcx_riscmem top;
152 struct btcx_riscmem bottom;
153};

--- 12 unchanged lines hidden (view full) ---

166 const struct bttv_tvnorm *tvnorm;
167
168 /* Earliest possible start of video capturing with this
169 v4l2_vbi_format, in struct bttv_crop.rect units. */
170 __s32 end;
171};
172
173/* bttv-vbi.c */
147
148 /* bttv specific */
149 int btformat;
150 int btswap;
151 struct bttv_geometry geo;
152 struct btcx_riscmem top;
153 struct btcx_riscmem bottom;
154};

--- 12 unchanged lines hidden (view full) ---

167 const struct bttv_tvnorm *tvnorm;
168
169 /* Earliest possible start of video capturing with this
170 v4l2_vbi_format, in struct bttv_crop.rect units. */
171 __s32 end;
172};
173
174/* bttv-vbi.c */
175extern const struct vb2_ops bttv_vbi_qops;
176
174void bttv_vbi_fmt_reset(struct bttv_vbi_fmt *f, unsigned int norm);
175
176struct bttv_crop {
177 /* A cropping rectangle in struct bttv_tvnorm.cropcap units. */
178 struct v4l2_rect rect;
179
180 /* Scaled image size limits with this crop rect. Divide
181 max_height, but not min_height, by two when capturing
182 single fields. See also bttv_crop_reset() and
183 bttv_crop_adjust() in bttv-driver.c. */
184 __s32 min_scaled_width;
185 __s32 min_scaled_height;
186 __s32 max_scaled_width;
187 __s32 max_scaled_height;
188};
189
177void bttv_vbi_fmt_reset(struct bttv_vbi_fmt *f, unsigned int norm);
178
179struct bttv_crop {
180 /* A cropping rectangle in struct bttv_tvnorm.cropcap units. */
181 struct v4l2_rect rect;
182
183 /* Scaled image size limits with this crop rect. Divide
184 max_height, but not min_height, by two when capturing
185 single fields. See also bttv_crop_reset() and
186 bttv_crop_adjust() in bttv-driver.c. */
187 __s32 min_scaled_width;
188 __s32 min_scaled_height;
189 __s32 max_scaled_width;
190 __s32 max_scaled_height;
191};
192
190struct bttv_fh {
191 /* This must be the first field in this struct */
192 struct v4l2_fh fh;
193
194 struct bttv *btv;
195 int resources;
196 enum v4l2_buf_type type;
197
198 /* video capture */
199 struct videobuf_queue cap;
200 const struct bttv_format *fmt;
201 int width;
202 int height;
203
204 /* vbi capture */
205 struct videobuf_queue vbi;
206 /* Current VBI capture window as seen through this fh (cannot
207 be global for compatibility with earlier drivers). Protected
208 by struct bttv.lock and struct bttv_fh.vbi.lock. */
209 struct bttv_vbi_fmt vbi_fmt;
210};
211
212/* ---------------------------------------------------------- */
213/* bttv-risc.c */
214
215/* risc code generators - capture */
216int bttv_risc_packed(struct bttv *btv, struct btcx_riscmem *risc,
217 struct scatterlist *sglist,
218 unsigned int offset, unsigned int bpl,
219 unsigned int pitch, unsigned int skip_lines,

--- 4 unchanged lines hidden (view full) ---

224int bttv_risc_init_main(struct bttv *btv);
225int bttv_risc_hook(struct bttv *btv, int slot, struct btcx_riscmem *risc,
226 int irqflags);
227
228/* capture buffer handling */
229int bttv_buffer_risc(struct bttv *btv, struct bttv_buffer *buf);
230int bttv_buffer_activate_video(struct bttv *btv,
231 struct bttv_buffer_set *set);
193/* ---------------------------------------------------------- */
194/* bttv-risc.c */
195
196/* risc code generators - capture */
197int bttv_risc_packed(struct bttv *btv, struct btcx_riscmem *risc,
198 struct scatterlist *sglist,
199 unsigned int offset, unsigned int bpl,
200 unsigned int pitch, unsigned int skip_lines,

--- 4 unchanged lines hidden (view full) ---

205int bttv_risc_init_main(struct bttv *btv);
206int bttv_risc_hook(struct bttv *btv, int slot, struct btcx_riscmem *risc,
207 int irqflags);
208
209/* capture buffer handling */
210int bttv_buffer_risc(struct bttv *btv, struct bttv_buffer *buf);
211int bttv_buffer_activate_video(struct bttv *btv,
212 struct bttv_buffer_set *set);
213int bttv_buffer_risc_vbi(struct bttv *btv, struct bttv_buffer *buf);
232int bttv_buffer_activate_vbi(struct bttv *btv,
233 struct bttv_buffer *vbi);
214int bttv_buffer_activate_vbi(struct bttv *btv,
215 struct bttv_buffer *vbi);
234void bttv_dma_free(struct videobuf_queue *q, struct bttv *btv,
235 struct bttv_buffer *buf);
236
237/* ---------------------------------------------------------- */
238/* bttv-vbi.c */
239
216
217/* ---------------------------------------------------------- */
218/* bttv-vbi.c */
219
220/*
221 * 2048 for compatibility with earlier driver versions. The driver really
222 * stores 1024 + tvnorm->vbipack * 4 samples per line in the buffer. Note
223 * tvnorm->vbipack is <= 0xFF (limit of VBIPACK_LO + HI is 0x1FF DWORDs) and
224 * VBI read()s store a frame counter in the last four bytes of the VBI image.
225 */
226#define VBI_BPL 2048
227
240#define VBI_DEFLINES 16
241
242int bttv_try_fmt_vbi_cap(struct file *file, void *fh, struct v4l2_format *f);
243int bttv_g_fmt_vbi_cap(struct file *file, void *fh, struct v4l2_format *f);
244int bttv_s_fmt_vbi_cap(struct file *file, void *fh, struct v4l2_format *f);
245
228#define VBI_DEFLINES 16
229
230int bttv_try_fmt_vbi_cap(struct file *file, void *fh, struct v4l2_format *f);
231int bttv_g_fmt_vbi_cap(struct file *file, void *fh, struct v4l2_format *f);
232int bttv_s_fmt_vbi_cap(struct file *file, void *fh, struct v4l2_format *f);
233
246extern const struct videobuf_queue_ops bttv_vbi_qops;
247
248/* ---------------------------------------------------------- */
249/* bttv-gpio.c */
250
251extern struct bus_type bttv_sub_bus_type;
252int bttv_sub_add_device(struct bttv_core *core, char *name);
253int bttv_sub_del_devices(struct bttv_core *core);
254
255/* ---------------------------------------------------------- */

--- 8 unchanged lines hidden (view full) ---

264
265/* ---------------------------------------------------------- */
266/* bttv-driver.c */
267
268/* insmod options */
269extern unsigned int bttv_verbose;
270extern unsigned int bttv_debug;
271extern unsigned int bttv_gpio;
234/* ---------------------------------------------------------- */
235/* bttv-gpio.c */
236
237extern struct bus_type bttv_sub_bus_type;
238int bttv_sub_add_device(struct bttv_core *core, char *name);
239int bttv_sub_del_devices(struct bttv_core *core);
240
241/* ---------------------------------------------------------- */

--- 8 unchanged lines hidden (view full) ---

250
251/* ---------------------------------------------------------- */
252/* bttv-driver.c */
253
254/* insmod options */
255extern unsigned int bttv_verbose;
256extern unsigned int bttv_debug;
257extern unsigned int bttv_gpio;
258int check_alloc_btres_lock(struct bttv *btv, int bit);
259void free_btres_lock(struct bttv *btv, int bits);
272extern void bttv_gpio_tracking(struct bttv *btv, char *comment);
273
274#define dprintk(fmt, ...) \
275do { \
276 if (bttv_debug >= 1) \
277 pr_debug(fmt, ##__VA_ARGS__); \
278} while (0)
279#define dprintk_cont(fmt, ...) \

--- 105 unchanged lines hidden (view full) ---

385 unsigned int input;
386 unsigned int audio_input;
387 unsigned int mute;
388 unsigned long tv_freq;
389 unsigned int tvnorm;
390 v4l2_std_id std;
391 int hue, contrast, bright, saturation;
392 struct v4l2_framebuffer fbuf;
260extern void bttv_gpio_tracking(struct bttv *btv, char *comment);
261
262#define dprintk(fmt, ...) \
263do { \
264 if (bttv_debug >= 1) \
265 pr_debug(fmt, ##__VA_ARGS__); \
266} while (0)
267#define dprintk_cont(fmt, ...) \

--- 105 unchanged lines hidden (view full) ---

373 unsigned int input;
374 unsigned int audio_input;
375 unsigned int mute;
376 unsigned long tv_freq;
377 unsigned int tvnorm;
378 v4l2_std_id std;
379 int hue, contrast, bright, saturation;
380 struct v4l2_framebuffer fbuf;
393 unsigned int field_count;
381 __u32 field_count;
394
395 /* various options */
396 int opt_combfilter;
397 int opt_automute;
398 int opt_vcr_hack;
399 int opt_uv_ratio;
400
401 /* radio data/state */

--- 34 unchanged lines hidden (view full) ---

436
437 /* stats */
438 unsigned int errors;
439 unsigned int framedrop;
440 unsigned int irq_total;
441 unsigned int irq_me;
442
443 unsigned int users;
382
383 /* various options */
384 int opt_combfilter;
385 int opt_automute;
386 int opt_vcr_hack;
387 int opt_uv_ratio;
388
389 /* radio data/state */

--- 34 unchanged lines hidden (view full) ---

424
425 /* stats */
426 unsigned int errors;
427 unsigned int framedrop;
428 unsigned int irq_total;
429 unsigned int irq_me;
430
431 unsigned int users;
444 struct bttv_fh init;
432 struct v4l2_fh fh;
433 enum v4l2_buf_type type;
434
435 enum v4l2_field field;
436 int field_last;
437
438 /* video capture */
439 struct vb2_queue capq;
445 const struct bttv_format *fmt;
446 int width;
447 int height;
440 const struct bttv_format *fmt;
441 int width;
442 int height;
443
444 /* vbi capture */
445 struct vb2_queue vbiq;
448 struct bttv_vbi_fmt vbi_fmt;
446 struct bttv_vbi_fmt vbi_fmt;
449 unsigned int vbi_skip[2];
450 unsigned int vbi_count[2];
451
452 /* Application called VIDIOC_S_SELECTION. */
453 int do_crop;
454
455 /* used to make dvb-bt8xx autoloadable */
456 struct work_struct request_module_wk;
457

--- 26 unchanged lines hidden (view full) ---

484static inline unsigned int bttv_muxsel(const struct bttv *btv,
485 unsigned int input)
486{
487 return (bttv_tvcards[btv->c.type].muxsel >> (input * 2)) & 3;
488}
489
490#endif
491
447 unsigned int vbi_count[2];
448
449 /* Application called VIDIOC_S_SELECTION. */
450 int do_crop;
451
452 /* used to make dvb-bt8xx autoloadable */
453 struct work_struct request_module_wk;
454

--- 26 unchanged lines hidden (view full) ---

481static inline unsigned int bttv_muxsel(const struct bttv *btv,
482 unsigned int input)
483{
484 return (bttv_tvcards[btv->c.type].muxsel >> (input * 2)) & 3;
485}
486
487#endif
488
489void init_irqreg(struct bttv *btv);
490
492#define btwrite(dat,adr) writel((dat), btv->bt848_mmio+(adr))
493#define btread(adr) readl(btv->bt848_mmio+(adr))
494
495#define btand(dat,adr) btwrite((dat) & btread(adr), adr)
496#define btor(dat,adr) btwrite((dat) | btread(adr), adr)
497#define btaor(dat,mask,adr) btwrite((dat) | ((mask) & btread(adr)), adr)
498
499#endif /* _BTTVP_H_ */
491#define btwrite(dat,adr) writel((dat), btv->bt848_mmio+(adr))
492#define btread(adr) readl(btv->bt848_mmio+(adr))
493
494#define btand(dat,adr) btwrite((dat) & btread(adr), adr)
495#define btor(dat,adr) btwrite((dat) | btread(adr), adr)
496#define btaor(dat,mask,adr) btwrite((dat) | ((mask) & btread(adr)), adr)
497
498#endif /* _BTTVP_H_ */