Michael Krufky | 8218b0b | 2007-06-26 13:12:08 -0300 | [diff] [blame] | 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 | |
Michael Krufky | c996899 | 2007-08-20 21:04:44 -0300 | [diff] [blame] | 22 | #ifndef __TUNER_DRIVER_H__ |
| 23 | #define __TUNER_DRIVER_H__ |
Michael Krufky | 8218b0b | 2007-06-26 13:12:08 -0300 | [diff] [blame] | 24 | |
| 25 | #include <linux/videodev2.h> |
| 26 | #include <linux/i2c.h> |
Michael Krufky | db8a695 | 2007-08-21 01:24:42 -0300 | [diff] [blame] | 27 | #include "tuner-i2c.h" |
Michael Krufky | e18f944 | 2007-08-21 01:25:48 -0300 | [diff] [blame] | 28 | #include "dvb_frontend.h" |
Michael Krufky | 8218b0b | 2007-06-26 13:12:08 -0300 | [diff] [blame] | 29 | |
| 30 | extern unsigned const int tuner_count; |
| 31 | |
Michael Krufky | db8a695 | 2007-08-21 01:24:42 -0300 | [diff] [blame] | 32 | struct tuner; |
| 33 | |
Michael Krufky | 8218b0b | 2007-06-26 13:12:08 -0300 | [diff] [blame] | 34 | struct tuner_operations { |
Michael Krufky | db8a695 | 2007-08-21 01:24:42 -0300 | [diff] [blame] | 35 | void (*set_tv_freq)(struct tuner *t, unsigned int freq); |
| 36 | void (*set_radio_freq)(struct tuner *t, unsigned int freq); |
| 37 | int (*has_signal)(struct tuner *t); |
| 38 | int (*is_stereo)(struct tuner *t); |
| 39 | int (*get_afc)(struct tuner *t); |
| 40 | void (*tuner_status)(struct tuner *t); |
| 41 | void (*standby)(struct tuner *t); |
| 42 | void (*release)(struct tuner *t); |
Michael Krufky | 8218b0b | 2007-06-26 13:12:08 -0300 | [diff] [blame] | 43 | }; |
| 44 | |
| 45 | struct tuner { |
| 46 | /* device */ |
| 47 | struct i2c_client i2c; |
| 48 | |
| 49 | unsigned int type; /* chip type */ |
| 50 | |
| 51 | unsigned int mode; |
| 52 | unsigned int mode_mask; /* Combination of allowable modes */ |
| 53 | |
| 54 | unsigned int tv_freq; /* keep track of the current settings */ |
| 55 | unsigned int radio_freq; |
Michael Krufky | 8218b0b | 2007-06-26 13:12:08 -0300 | [diff] [blame] | 56 | unsigned int audmode; |
| 57 | v4l2_std_id std; |
| 58 | |
| 59 | int using_v4l2; |
| 60 | void *priv; |
| 61 | |
Michael Krufky | e18f944 | 2007-08-21 01:25:48 -0300 | [diff] [blame] | 62 | struct dvb_frontend fe; |
| 63 | |
Michael Krufky | 8218b0b | 2007-06-26 13:12:08 -0300 | [diff] [blame] | 64 | /* used by tda9887 */ |
| 65 | unsigned int tda9887_config; |
| 66 | |
| 67 | unsigned int config; |
| 68 | int (*tuner_callback) (void *dev, int command,int arg); |
| 69 | |
| 70 | struct tuner_operations ops; |
| 71 | }; |
| 72 | |
Mauro Carvalho Chehab | 6cb4587 | 2007-10-02 11:57:03 -0300 | [diff] [blame^] | 73 | extern int xc2028_tuner_init(struct i2c_client *c); |
| 74 | |
Michael Krufky | 8218b0b | 2007-06-26 13:12:08 -0300 | [diff] [blame] | 75 | /* ------------------------------------------------------------------------ */ |
| 76 | |
Michael Krufky | db8a695 | 2007-08-21 01:24:42 -0300 | [diff] [blame] | 77 | extern int tda9887_tuner_init(struct tuner *t); |
Michael Krufky | 8218b0b | 2007-06-26 13:12:08 -0300 | [diff] [blame] | 78 | |
Michael Krufky | 8218b0b | 2007-06-26 13:12:08 -0300 | [diff] [blame] | 79 | /* ------------------------------------------------------------------------ */ |
| 80 | |
| 81 | #define tuner_warn(fmt, arg...) do {\ |
| 82 | printk(KERN_WARNING "%s %d-%04x: " fmt, t->i2c.driver->driver.name, \ |
| 83 | i2c_adapter_id(t->i2c.adapter), t->i2c.addr , ##arg); } while (0) |
| 84 | #define tuner_info(fmt, arg...) do {\ |
| 85 | printk(KERN_INFO "%s %d-%04x: " fmt, t->i2c.driver->driver.name, \ |
| 86 | i2c_adapter_id(t->i2c.adapter), t->i2c.addr , ##arg); } while (0) |
| 87 | #define tuner_dbg(fmt, arg...) do {\ |
| 88 | extern int tuner_debug; \ |
| 89 | if (tuner_debug) \ |
| 90 | printk(KERN_DEBUG "%s %d-%04x: " fmt, t->i2c.driver->driver.name, \ |
| 91 | i2c_adapter_id(t->i2c.adapter), t->i2c.addr , ##arg); } while (0) |
| 92 | |
Michael Krufky | c996899 | 2007-08-20 21:04:44 -0300 | [diff] [blame] | 93 | #endif /* __TUNER_DRIVER_H__ */ |
Michael Krufky | 8218b0b | 2007-06-26 13:12:08 -0300 | [diff] [blame] | 94 | |
| 95 | /* |
| 96 | * Overrides for Emacs so that we follow Linus's tabbing style. |
| 97 | * --------------------------------------------------------------------------- |
| 98 | * Local variables: |
| 99 | * c-basic-offset: 8 |
| 100 | * End: |
| 101 | */ |