[PATCH] i2c: Drop i2c_driver.{owner,name}, 5 of 11
[deliverable/linux.git] / drivers / media / video / saa5249.c
CommitLineData
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>
59
60#include <asm/io.h>
61#include <asm/uaccess.h>
62
63#define VTX_VER_MAJ 1
64#define VTX_VER_MIN 8
65
66
67
68#define NUM_DAUS 4
69#define NUM_BUFS 8
70#define IF_NAME "SAA5249"
71
72static const int disp_modes[8][3] =
73{
74 { 0x46, 0x03, 0x03 }, /* DISPOFF */
75 { 0x46, 0xcc, 0xcc }, /* DISPNORM */
76 { 0x44, 0x0f, 0x0f }, /* DISPTRANS */
77 { 0x46, 0xcc, 0x46 }, /* DISPINS */
78 { 0x44, 0x03, 0x03 }, /* DISPOFF, interlaced */
79 { 0x44, 0xcc, 0xcc }, /* DISPNORM, interlaced */
80 { 0x44, 0x0f, 0x0f }, /* DISPTRANS, interlaced */
81 { 0x44, 0xcc, 0x46 } /* DISPINS, interlaced */
82};
83
84
85
86#define PAGE_WAIT (300*HZ/1000) /* Time between requesting page and */
87 /* checking status bits */
88#define PGBUF_EXPIRE (15*HZ) /* Time to wait before retransmitting */
89 /* page regardless of infobits */
90typedef struct {
91 u8 pgbuf[VTX_VIRTUALSIZE]; /* Page-buffer */
92 u8 laststat[10]; /* Last value of infobits for DAU */
93 u8 sregs[7]; /* Page-request registers */
94 unsigned long expire; /* Time when page will be expired */
95 unsigned clrfound : 1; /* VTXIOCCLRFOUND has been called */
96 unsigned stopped : 1; /* VTXIOCSTOPDAU has been called */
97} vdau_t;
98
99struct saa5249_device
100{
101 vdau_t vdau[NUM_DAUS]; /* Data for virtual DAUs (the 5249 only has one */
102 /* real DAU, so we have to simulate some more) */
103 int vtx_use_count;
104 int is_searching[NUM_DAUS];
105 int disp_mode;
106 int virtual_mode;
107 struct i2c_client *client;
108 struct semaphore lock;
109};
110
111