]> err.no Git - linux-2.6/blob - drivers/media/video/tuner-driver.h
3cd1d446f2f34173ce2e0df35ca997f1cc425262
[linux-2.6] / drivers / media / video / tuner-driver.h
1 /*
2     tuner-driver.h - interface for different tuners
3
4     Copyright (C) 1997 Markus Schroeder (schroedm@uni-duesseldorf.de)
5     minor modifications by Ralph Metzler (rjkm@thp.uni-koeln.de)
6
7     This program is free software; you can redistribute it and/or modify
8     it under the terms of the GNU General Public License as published by
9     the Free Software Foundation; either version 2 of the License, or
10     (at your option) any later version.
11
12     This program is distributed in the hope that it will be useful,
13     but WITHOUT ANY WARRANTY; without even the implied warranty of
14     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15     GNU General Public License for more details.
16
17     You should have received a copy of the GNU General Public License
18     along with this program; if not, write to the Free Software
19     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 */
21
22 #ifndef __TUNER_DRIVER_H__
23 #define __TUNER_DRIVER_H__
24
25 #include <linux/videodev2.h>
26 #include <linux/i2c.h>
27 #include "tuner-i2c.h"
28
29 extern unsigned const int tuner_count;
30
31 struct tuner;
32
33 struct tuner_operations {
34         void (*set_tv_freq)(struct tuner *t, unsigned int freq);
35         void (*set_radio_freq)(struct tuner *t, unsigned int freq);
36         int  (*has_signal)(struct tuner *t);
37         int  (*is_stereo)(struct tuner *t);
38         int  (*get_afc)(struct tuner *t);
39         void (*tuner_status)(struct tuner *t);
40         void (*standby)(struct tuner *t);
41         void (*release)(struct tuner *t);
42 };
43
44 struct tuner {
45         /* device */
46         struct i2c_client i2c;
47
48         unsigned int type;      /* chip type */
49
50         unsigned int mode;
51         unsigned int mode_mask; /* Combination of allowable modes */
52
53         unsigned int tv_freq;   /* keep track of the current settings */
54         unsigned int radio_freq;
55         unsigned int audmode;
56         v4l2_std_id  std;
57
58         int          using_v4l2;
59         void *priv;
60
61         /* used by tda9887 */
62         unsigned int       tda9887_config;
63
64         unsigned int config;
65         int (*tuner_callback) (void *dev, int command,int arg);
66
67         struct tuner_operations ops;
68 };
69
70 /* ------------------------------------------------------------------------ */
71
72 extern int default_tuner_init(struct tuner *t);
73
74 extern int tda9887_tuner_init(struct tuner *t);
75
76 extern int microtune_init(struct tuner *t);
77
78 extern int tda8290_init(struct tuner *t);
79 extern int tda8290_probe(struct tuner *t);
80
81 extern int tea5761_tuner_init(struct tuner *t);
82 extern int tea5761_autodetection(struct tuner *t);
83
84 extern int tea5767_autodetection(struct tuner *t);
85 extern int tea5767_tuner_init(struct tuner *t);
86
87 /* ------------------------------------------------------------------------ */
88
89 #define tuner_warn(fmt, arg...) do {\
90         printk(KERN_WARNING "%s %d-%04x: " fmt, t->i2c.driver->driver.name, \
91                         i2c_adapter_id(t->i2c.adapter), t->i2c.addr , ##arg); } while (0)
92 #define tuner_info(fmt, arg...) do {\
93         printk(KERN_INFO "%s %d-%04x: " fmt, t->i2c.driver->driver.name, \
94                         i2c_adapter_id(t->i2c.adapter), t->i2c.addr , ##arg); } while (0)
95 #define tuner_dbg(fmt, arg...) do {\
96         extern int tuner_debug; \
97         if (tuner_debug) \
98                 printk(KERN_DEBUG "%s %d-%04x: " fmt, t->i2c.driver->driver.name, \
99                         i2c_adapter_id(t->i2c.adapter), t->i2c.addr , ##arg); } while (0)
100
101 #endif /* __TUNER_DRIVER_H__ */
102
103 /*
104  * Overrides for Emacs so that we follow Linus's tabbing style.
105  * ---------------------------------------------------------------------------
106  * Local variables:
107  * c-basic-offset: 8
108  * End:
109  */