summaryrefslogtreecommitdiffstats
path: root/drivers/media/video/tuner-driver.h
blob: 0334a9125077939d859989649491487e90391f42 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
/*
    tuner-driver.h - interface for different tuners

    Copyright (C) 1997 Markus Schroeder (schroedm@uni-duesseldorf.de)
    minor modifications by Ralph Metzler (rjkm@thp.uni-koeln.de)

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/

#ifndef __TUNER_HW_H__
#define __TUNER_HW_H__

#include <linux/videodev2.h>
#include <linux/i2c.h>

extern unsigned const int tuner_count;

struct tuner_operations {
	void (*set_tv_freq)(struct i2c_client *c, unsigned int freq);
	void (*set_radio_freq)(struct i2c_client *c, unsigned int freq);
	int  (*has_signal)(struct i2c_client *c);
	int  (*is_stereo)(struct i2c_client *c);
	int  (*get_afc)(struct i2c_client *c);
	void (*tuner_status)(struct i2c_client *c);
	void (*standby)(struct i2c_client *c);
	void (*release)(struct i2c_client *c);
};

struct tuner {
	/* device */
	struct i2c_client i2c;

	unsigned int type;	/* chip type */

	unsigned int mode;
	unsigned int mode_mask;	/* Combination of allowable modes */

	unsigned int tv_freq;	/* keep track of the current settings */
	unsigned int radio_freq;
	u16 	     last_div;
	unsigned int audmode;
	v4l2_std_id  std;

	int          using_v4l2;
	void *priv;

	/* used by tda9887 */
	unsigned int       tda9887_config;

	unsigned int config;
	int (*tuner_callback) (void *dev, int command,int arg);

	struct tuner_operations ops;
};

/* ------------------------------------------------------------------------ */

extern int default_tuner_init(struct i2c_client *c);

extern int tda9887_tuner_init(struct i2c_client *c);

extern int microtune_init(struct i2c_client *c);

extern int tda8290_init(struct i2c_client *c);
extern int tda8290_probe(struct i2c_client *c);

extern int tea5761_tuner_init(struct i2c_client *c);
extern int tea5761_autodetection(struct i2c_client *c);

extern int tea5767_autodetection(struct i2c_client *c);
extern int tea5767_tuner_init(struct i2c_client *c);

/* ------------------------------------------------------------------------ */

#define tuner_warn(fmt, arg...) do {\
	printk(KERN_WARNING "%s %d-%04x: " fmt, t->i2c.driver->driver.name, \
			i2c_adapter_id(t->i2c.adapter), t->i2c.addr , ##arg); } while (0)
#define tuner_info(fmt, arg...) do {\
	printk(KERN_INFO "%s %d-%04x: " fmt, t->i2c.driver->driver.name, \
			i2c_adapter_id(t->i2c.adapter), t->i2c.addr , ##arg); } while (0)
#define tuner_dbg(fmt, arg...) do {\
	extern int tuner_debug; \
	if (tuner_debug) \
		printk(KERN_DEBUG "%s %d-%04x: " fmt, t->i2c.driver->driver.name, \
			i2c_adapter_id(t->i2c.adapter), t->i2c.addr , ##arg); } while (0)

#endif /* __TUNER_HW_H__ */

/*
 * Overrides for Emacs so that we follow Linus's tabbing style.
 * ---------------------------------------------------------------------------
 * Local variables:
 * c-basic-offset: 8
 * End:
 */
OpenPOWER on IntegriCloud