]>
Commit | Line | Data |
---|---|---|
1da177e4 LT |
1 | /* |
2 | * Modified in order to keep it compatible both with new and old videotext IOCTLs by | |
3 | * Michael Geng <linux@MichaelGeng.de> | |
4 | * | |
5 | * Cleaned up to use existing videodev interface and allow the idea | |
6 | * of multiple teletext decoders on the video4linux iface. Changed i2c | |
7 | * to cover addressing clashes on device busses. It's also rebuilt so | |
8 | * you can add arbitary multiple teletext devices to Linux video4linux | |
9 | * now (well 32 anyway). | |
10 | * | |
11 | * Alan Cox <Alan.Cox@linux.org> | |
12 | * | |
13 | * The original driver was heavily modified to match the i2c interface | |
14 | * It was truncated to use the WinTV boards, too. | |
15 | * | |
16 | * Copyright (c) 1998 Richard Guenther <richard.guenther@student.uni-tuebingen.de> | |
17 | * | |
18 | * $Id: saa5249.c,v 1.1 1998/03/30 22:23:23 alan Exp $ | |
19 | * | |
20 | * Derived From | |
21 | * | |
22 | * vtx.c: | |
23 | * This is a loadable character-device-driver for videotext-interfaces | |
24 | * (aka teletext). Please check the Makefile/README for a list of supported | |
25 | * interfaces. | |
26 | * | |
27 | * Copyright (c) 1994-97 Martin Buck <martin-2.buck@student.uni-ulm.de> | |
28 | * | |
29 | * | |
30 | * This program is free software; you can redistribute it and/or modify | |
31 | * it under the terms of the GNU General Public License as published by | |
32 | * the Free Software Foundation; either version 2 of the License, or | |
33 | * (at your option) any later version. | |
34 | * | |
35 | * This program is distributed in the hope that it will be useful, | |
36 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
37 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
38 | * GNU General Public License for more details. | |
39 | * | |
40 | * You should have received a copy of the GNU General Public License | |
41 | * along with this program; if not, write to the Free Software | |
42 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, | |
43 | * USA. | |
44 | */ | |
45 | ||
46 | #include <linux/module.h> | |
47 | #include <linux/kernel.h> | |
48 | #include <linux/sched.h> | |
49 | #include <linux/mm.h> | |
50 | #include <linux/errno.h> | |
51 | #include <linux/delay.h> | |
52 | #include <linux/ioport.h> | |
53 | #include <linux/slab.h> | |
54 | #include <linux/init.h> | |
55 | #include <stdarg.h> | |
56 | #include <linux/i2c.h> | |
57 | #include <linux/videotext.h> | |
58 | #include <linux/videodev.h> | |
3593cab5 IM |
59 | #include <linux/mutex.h> |
60 | ||
1da177e4 LT |
61 | |
62 | #include <asm/io.h> | |
63 | #include <asm/uaccess.h> | |
64 | ||
65 | #define VTX_VER_MAJ 1 | |
66 | #define VTX_VER_MIN 8 | |
67 | ||
68 | ||
69 | ||
70 | #define NUM_DAUS 4 | |
71 | #define NUM_BUFS 8 | |
72 | #define IF_NAME "SAA5249" | |
73 | ||
74 | static const int disp_modes[8][3] = | |
75 | { | |
76 | { 0x46, 0x03, 0x03 }, /* DISPOFF */ | |
77 | { 0x46, 0xcc, 0xcc }, /* DISPNORM */ | |
78 | { 0x44, 0x0f, 0x0f }, /* DISPTRANS */ | |
79 | { 0x46, 0xcc, 0x46 }, /* DISPINS */ | |
80 | { 0x44, 0x03, 0x03 }, /* DISPOFF, interlaced */ | |
81 | { 0x44, 0xcc, 0xcc }, /* DISPNORM, interlaced */ | |
82 | { 0x44, 0x0f, 0x0f }, /* DISPTRANS, interlaced */ | |
83 | { 0x44, 0xcc, 0x46 } /* DISPINS, interlaced */ | |
84 | }; | |
85 | ||
86 | ||
87 | ||
88 | #define PAGE_WAIT (300*HZ/1000) /* Time between requesting page and */ | |
89 | /* checking status bits */ | |
90 | #define PGBUF_EXPIRE (15*HZ) /* Time to wait before retransmitting */ | |
91 | /* page regardless of infobits */ | |
92 | typedef struct { | |
93 | u8 pgbuf[VTX_VIRTUALSIZE]; /* Page-buffer */ | |
94 | u8 laststat[10]; /* Last value of infobits for DAU */ | |
95 | u8 sregs[7]; /* Page-request registers */ | |
96 | unsigned long expire; /* Time when page will be expired */ | |
97 | unsigned clrfound : 1; /* VTXIOCCLRFOUND has been called */ | |
98 | unsigned stopped : 1; /* VTXIOCSTOPDAU has been called */ | |
99 | } vdau_t; | |
100 | ||
101 | struct saa5249_device | |
102 | { | |
103 | vdau_t vdau[NUM_DAUS]; /* Data for virtual DAUs (the 5249 only has one */ | |
104 | /* real DAU, so we have to simulate some more) */ | |
105 | int vtx_use_count; | |
106 | int is_searching[NUM_DAUS]; | |
107 | int disp_mode; | |
108 | int virtual_mode; | |
109 | struct i2c_client *client; | |
3593cab5 | 110 | struct mutex lock; |
1da177e4 LT |
111 | }; |
112 | ||
113 | ||
114 |