Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2 | * |
| 3 | * device driver for Conexant 2388x based TV cards |
| 4 | * MPEG Transport Stream (DVB) routines |
| 5 | * |
Chris Pascoe | fc40b26 | 2006-01-09 15:25:35 -0200 | [diff] [blame] | 6 | * (c) 2004, 2005 Chris Pascoe <c.pascoe@itee.uq.edu.au> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7 | * (c) 2004 Gerd Knorr <kraxel@bytesex.org> [SuSE Labs] |
| 8 | * |
| 9 | * This program is free software; you can redistribute it and/or modify |
| 10 | * it under the terms of the GNU General Public License as published by |
| 11 | * the Free Software Foundation; either version 2 of the License, or |
| 12 | * (at your option) any later version. |
| 13 | * |
| 14 | * This program is distributed in the hope that it will be useful, |
| 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 17 | * GNU General Public License for more details. |
| 18 | * |
| 19 | * You should have received a copy of the GNU General Public License |
| 20 | * along with this program; if not, write to the Free Software |
| 21 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
| 22 | */ |
| 23 | |
| 24 | #include <linux/module.h> |
| 25 | #include <linux/init.h> |
| 26 | #include <linux/device.h> |
| 27 | #include <linux/fs.h> |
| 28 | #include <linux/kthread.h> |
| 29 | #include <linux/file.h> |
| 30 | #include <linux/suspend.h> |
| 31 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 32 | #include "cx88.h" |
| 33 | #include "dvb-pll.h" |
Michael Krufky | 5e453dc | 2006-01-09 15:32:31 -0200 | [diff] [blame] | 34 | #include <media/v4l2-common.h> |
Mauro Carvalho Chehab | 41ef7c1 | 2005-07-12 13:58:44 -0700 | [diff] [blame] | 35 | |
Andrew de Quincey | 1f10c7a | 2006-08-08 09:10:09 -0300 | [diff] [blame] | 36 | #include "mt352.h" |
| 37 | #include "mt352_priv.h" |
Trent Piepho | ecf854d | 2007-05-05 20:11:32 -0300 | [diff] [blame] | 38 | #include "cx88-vp3054-i2c.h" |
Andrew de Quincey | 1f10c7a | 2006-08-08 09:10:09 -0300 | [diff] [blame] | 39 | #include "zl10353.h" |
| 40 | #include "cx22702.h" |
| 41 | #include "or51132.h" |
| 42 | #include "lgdt330x.h" |
Steven Toth | 60464da | 2008-01-05 16:53:01 -0300 | [diff] [blame] | 43 | #include "s5h1409.h" |
| 44 | #include "xc5000.h" |
Andrew de Quincey | 1f10c7a | 2006-08-08 09:10:09 -0300 | [diff] [blame] | 45 | #include "nxt200x.h" |
| 46 | #include "cx24123.h" |
Andrew de Quincey | cd20ca9 | 2006-05-12 20:31:51 -0300 | [diff] [blame] | 47 | #include "isl6421.h" |
Michael Krufky | 0df31f8 | 2008-04-22 14:46:13 -0300 | [diff] [blame] | 48 | #include "tuner-simple.h" |
Michael Krufky | 827855d | 2008-04-22 14:46:16 -0300 | [diff] [blame] | 49 | #include "tda9887.h" |
Steven Toth | d893d5d | 2008-04-25 03:46:43 -0300 | [diff] [blame] | 50 | #include "s5h1411.h" |
Steven Toth | 5bd1b66 | 2008-09-04 01:17:33 -0300 | [diff] [blame] | 51 | #include "cx24116.h" |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 52 | |
| 53 | MODULE_DESCRIPTION("driver for cx2388x based DVB cards"); |
| 54 | MODULE_AUTHOR("Chris Pascoe <c.pascoe@itee.uq.edu.au>"); |
| 55 | MODULE_AUTHOR("Gerd Knorr <kraxel@bytesex.org> [SuSE Labs]"); |
| 56 | MODULE_LICENSE("GPL"); |
| 57 | |
Douglas Schilling Landgraf | ff699e6 | 2008-04-22 14:41:48 -0300 | [diff] [blame] | 58 | static unsigned int debug; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 59 | module_param(debug, int, 0644); |
| 60 | MODULE_PARM_DESC(debug,"enable debug messages [dvb]"); |
| 61 | |
Janne Grunau | 78e9200 | 2008-04-09 19:13:13 -0300 | [diff] [blame] | 62 | DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); |
| 63 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 64 | #define dprintk(level,fmt, arg...) if (debug >= level) \ |
Steven Toth | 6c5be74 | 2006-12-02 21:15:51 -0200 | [diff] [blame] | 65 | printk(KERN_DEBUG "%s/2-dvb: " fmt, core->name, ## arg) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 66 | |
| 67 | /* ------------------------------------------------------------------ */ |
| 68 | |
| 69 | static int dvb_buf_setup(struct videobuf_queue *q, |
| 70 | unsigned int *count, unsigned int *size) |
| 71 | { |
| 72 | struct cx8802_dev *dev = q->priv_data; |
| 73 | |
| 74 | dev->ts_packet_size = 188 * 4; |
| 75 | dev->ts_packet_count = 32; |
| 76 | |
| 77 | *size = dev->ts_packet_size * dev->ts_packet_count; |
| 78 | *count = 32; |
| 79 | return 0; |
| 80 | } |
| 81 | |
Michael Krufky | 4a39055 | 2006-12-05 02:00:53 -0300 | [diff] [blame] | 82 | static int dvb_buf_prepare(struct videobuf_queue *q, |
| 83 | struct videobuf_buffer *vb, enum v4l2_field field) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 84 | { |
| 85 | struct cx8802_dev *dev = q->priv_data; |
Mauro Carvalho Chehab | c7b0ac0 | 2006-03-10 12:29:15 -0300 | [diff] [blame] | 86 | return cx8802_buf_prepare(q, dev, (struct cx88_buffer*)vb,field); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 87 | } |
| 88 | |
| 89 | static void dvb_buf_queue(struct videobuf_queue *q, struct videobuf_buffer *vb) |
| 90 | { |
| 91 | struct cx8802_dev *dev = q->priv_data; |
| 92 | cx8802_buf_queue(dev, (struct cx88_buffer*)vb); |
| 93 | } |
| 94 | |
Michael Krufky | 4a39055 | 2006-12-05 02:00:53 -0300 | [diff] [blame] | 95 | static void dvb_buf_release(struct videobuf_queue *q, |
| 96 | struct videobuf_buffer *vb) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 97 | { |
Mauro Carvalho Chehab | c7b0ac0 | 2006-03-10 12:29:15 -0300 | [diff] [blame] | 98 | cx88_free_buffer(q, (struct cx88_buffer*)vb); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 99 | } |
| 100 | |
Adrian Bunk | 408b664 | 2005-05-01 08:59:29 -0700 | [diff] [blame] | 101 | static struct videobuf_queue_ops dvb_qops = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 102 | .buf_setup = dvb_buf_setup, |
| 103 | .buf_prepare = dvb_buf_prepare, |
| 104 | .buf_queue = dvb_buf_queue, |
| 105 | .buf_release = dvb_buf_release, |
| 106 | }; |
| 107 | |
| 108 | /* ------------------------------------------------------------------ */ |
Michael Krufky | 22f3f17 | 2006-12-05 01:38:58 -0300 | [diff] [blame] | 109 | |
| 110 | static int cx88_dvb_bus_ctrl(struct dvb_frontend* fe, int acquire) |
| 111 | { |
| 112 | struct cx8802_dev *dev= fe->dvb->priv; |
| 113 | struct cx8802_driver *drv = NULL; |
| 114 | int ret = 0; |
| 115 | |
| 116 | drv = cx8802_get_driver(dev, CX88_MPEG_DVB); |
| 117 | if (drv) { |
Michael Krufky | 4a39055 | 2006-12-05 02:00:53 -0300 | [diff] [blame] | 118 | if (acquire) |
Michael Krufky | 22f3f17 | 2006-12-05 01:38:58 -0300 | [diff] [blame] | 119 | ret = drv->request_acquire(drv); |
| 120 | else |
| 121 | ret = drv->request_release(drv); |
| 122 | } |
| 123 | |
| 124 | return ret; |
| 125 | } |
| 126 | |
| 127 | /* ------------------------------------------------------------------ */ |
| 128 | |
Chris Pascoe | 3d7d027 | 2006-01-09 18:21:31 -0200 | [diff] [blame] | 129 | static int dvico_fusionhdtv_demod_init(struct dvb_frontend* fe) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 130 | { |
| 131 | static u8 clock_config [] = { CLOCK_CTL, 0x38, 0x39 }; |
| 132 | static u8 reset [] = { RESET, 0x80 }; |
| 133 | static u8 adc_ctl_1_cfg [] = { ADC_CTL_1, 0x40 }; |
| 134 | static u8 agc_cfg [] = { AGC_TARGET, 0x24, 0x20 }; |
| 135 | static u8 gpp_ctl_cfg [] = { GPP_CTL, 0x33 }; |
| 136 | static u8 capt_range_cfg[] = { CAPT_RANGE, 0x32 }; |
| 137 | |
| 138 | mt352_write(fe, clock_config, sizeof(clock_config)); |
| 139 | udelay(200); |
| 140 | mt352_write(fe, reset, sizeof(reset)); |
| 141 | mt352_write(fe, adc_ctl_1_cfg, sizeof(adc_ctl_1_cfg)); |
| 142 | |
| 143 | mt352_write(fe, agc_cfg, sizeof(agc_cfg)); |
| 144 | mt352_write(fe, gpp_ctl_cfg, sizeof(gpp_ctl_cfg)); |
| 145 | mt352_write(fe, capt_range_cfg, sizeof(capt_range_cfg)); |
| 146 | return 0; |
| 147 | } |
| 148 | |
Chris Pascoe | 43eabb4 | 2006-01-09 18:21:28 -0200 | [diff] [blame] | 149 | static int dvico_dual_demod_init(struct dvb_frontend *fe) |
| 150 | { |
| 151 | static u8 clock_config [] = { CLOCK_CTL, 0x38, 0x38 }; |
| 152 | static u8 reset [] = { RESET, 0x80 }; |
| 153 | static u8 adc_ctl_1_cfg [] = { ADC_CTL_1, 0x40 }; |
| 154 | static u8 agc_cfg [] = { AGC_TARGET, 0x28, 0x20 }; |
| 155 | static u8 gpp_ctl_cfg [] = { GPP_CTL, 0x33 }; |
| 156 | static u8 capt_range_cfg[] = { CAPT_RANGE, 0x32 }; |
| 157 | |
| 158 | mt352_write(fe, clock_config, sizeof(clock_config)); |
| 159 | udelay(200); |
| 160 | mt352_write(fe, reset, sizeof(reset)); |
| 161 | mt352_write(fe, adc_ctl_1_cfg, sizeof(adc_ctl_1_cfg)); |
| 162 | |
| 163 | mt352_write(fe, agc_cfg, sizeof(agc_cfg)); |
| 164 | mt352_write(fe, gpp_ctl_cfg, sizeof(gpp_ctl_cfg)); |
| 165 | mt352_write(fe, capt_range_cfg, sizeof(capt_range_cfg)); |
| 166 | |
| 167 | return 0; |
| 168 | } |
| 169 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 170 | static int dntv_live_dvbt_demod_init(struct dvb_frontend* fe) |
| 171 | { |
| 172 | static u8 clock_config [] = { 0x89, 0x38, 0x39 }; |
| 173 | static u8 reset [] = { 0x50, 0x80 }; |
| 174 | static u8 adc_ctl_1_cfg [] = { 0x8E, 0x40 }; |
| 175 | static u8 agc_cfg [] = { 0x67, 0x10, 0x23, 0x00, 0xFF, 0xFF, |
Mauro Carvalho Chehab | f2421ca | 2005-11-08 21:37:45 -0800 | [diff] [blame] | 176 | 0x00, 0xFF, 0x00, 0x40, 0x40 }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 177 | static u8 dntv_extra[] = { 0xB5, 0x7A }; |
| 178 | static u8 capt_range_cfg[] = { 0x75, 0x32 }; |
| 179 | |
| 180 | mt352_write(fe, clock_config, sizeof(clock_config)); |
| 181 | udelay(2000); |
| 182 | mt352_write(fe, reset, sizeof(reset)); |
| 183 | mt352_write(fe, adc_ctl_1_cfg, sizeof(adc_ctl_1_cfg)); |
| 184 | |
| 185 | mt352_write(fe, agc_cfg, sizeof(agc_cfg)); |
| 186 | udelay(2000); |
| 187 | mt352_write(fe, dntv_extra, sizeof(dntv_extra)); |
| 188 | mt352_write(fe, capt_range_cfg, sizeof(capt_range_cfg)); |
| 189 | |
| 190 | return 0; |
| 191 | } |
| 192 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 193 | static struct mt352_config dvico_fusionhdtv = { |
Michael Krufky | f7b54b1 | 2006-08-08 15:48:08 -0300 | [diff] [blame] | 194 | .demod_address = 0x0f, |
Chris Pascoe | 3d7d027 | 2006-01-09 18:21:31 -0200 | [diff] [blame] | 195 | .demod_init = dvico_fusionhdtv_demod_init, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 196 | }; |
| 197 | |
| 198 | static struct mt352_config dntv_live_dvbt_config = { |
| 199 | .demod_address = 0x0f, |
| 200 | .demod_init = dntv_live_dvbt_demod_init, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 201 | }; |
Chris Pascoe | fc40b26 | 2006-01-09 15:25:35 -0200 | [diff] [blame] | 202 | |
Chris Pascoe | 43eabb4 | 2006-01-09 18:21:28 -0200 | [diff] [blame] | 203 | static struct mt352_config dvico_fusionhdtv_dual = { |
Michael Krufky | f7b54b1 | 2006-08-08 15:48:08 -0300 | [diff] [blame] | 204 | .demod_address = 0x0f, |
Chris Pascoe | 43eabb4 | 2006-01-09 18:21:28 -0200 | [diff] [blame] | 205 | .demod_init = dvico_dual_demod_init, |
Chris Pascoe | 43eabb4 | 2006-01-09 18:21:28 -0200 | [diff] [blame] | 206 | }; |
| 207 | |
Trent Piepho | ecf854d | 2007-05-05 20:11:32 -0300 | [diff] [blame] | 208 | #if defined(CONFIG_VIDEO_CX88_VP3054) || (defined(CONFIG_VIDEO_CX88_VP3054_MODULE) && defined(MODULE)) |
Chris Pascoe | 3d7d027 | 2006-01-09 18:21:31 -0200 | [diff] [blame] | 209 | static int dntv_live_dvbt_pro_demod_init(struct dvb_frontend* fe) |
| 210 | { |
| 211 | static u8 clock_config [] = { 0x89, 0x38, 0x38 }; |
| 212 | static u8 reset [] = { 0x50, 0x80 }; |
| 213 | static u8 adc_ctl_1_cfg [] = { 0x8E, 0x40 }; |
| 214 | static u8 agc_cfg [] = { 0x67, 0x10, 0x20, 0x00, 0xFF, 0xFF, |
| 215 | 0x00, 0xFF, 0x00, 0x40, 0x40 }; |
| 216 | static u8 dntv_extra[] = { 0xB5, 0x7A }; |
| 217 | static u8 capt_range_cfg[] = { 0x75, 0x32 }; |
| 218 | |
| 219 | mt352_write(fe, clock_config, sizeof(clock_config)); |
| 220 | udelay(2000); |
| 221 | mt352_write(fe, reset, sizeof(reset)); |
| 222 | mt352_write(fe, adc_ctl_1_cfg, sizeof(adc_ctl_1_cfg)); |
| 223 | |
| 224 | mt352_write(fe, agc_cfg, sizeof(agc_cfg)); |
| 225 | udelay(2000); |
| 226 | mt352_write(fe, dntv_extra, sizeof(dntv_extra)); |
| 227 | mt352_write(fe, capt_range_cfg, sizeof(capt_range_cfg)); |
| 228 | |
| 229 | return 0; |
| 230 | } |
| 231 | |
Chris Pascoe | fc40b26 | 2006-01-09 15:25:35 -0200 | [diff] [blame] | 232 | static struct mt352_config dntv_live_dvbt_pro_config = { |
| 233 | .demod_address = 0x0f, |
| 234 | .no_tuner = 1, |
Chris Pascoe | 3d7d027 | 2006-01-09 18:21:31 -0200 | [diff] [blame] | 235 | .demod_init = dntv_live_dvbt_pro_demod_init, |
Chris Pascoe | fc40b26 | 2006-01-09 15:25:35 -0200 | [diff] [blame] | 236 | }; |
| 237 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 238 | |
Chris Pascoe | 780dfef | 2006-02-28 08:34:59 -0300 | [diff] [blame] | 239 | static struct zl10353_config dvico_fusionhdtv_hybrid = { |
Michael Krufky | f7b54b1 | 2006-08-08 15:48:08 -0300 | [diff] [blame] | 240 | .demod_address = 0x0f, |
Andrew de Quincey | f54376e | 2006-04-18 17:56:10 -0300 | [diff] [blame] | 241 | .no_tuner = 1, |
Chris Pascoe | 780dfef | 2006-02-28 08:34:59 -0300 | [diff] [blame] | 242 | }; |
| 243 | |
Chris Pascoe | b3fb91d | 2008-04-22 14:45:15 -0300 | [diff] [blame] | 244 | static struct zl10353_config dvico_fusionhdtv_xc3028 = { |
| 245 | .demod_address = 0x0f, |
| 246 | .if2 = 45600, |
| 247 | .no_tuner = 1, |
| 248 | }; |
| 249 | |
| 250 | static struct mt352_config dvico_fusionhdtv_mt352_xc3028 = { |
| 251 | .demod_address = 0x0f, |
| 252 | .if2 = 4560, |
| 253 | .no_tuner = 1, |
| 254 | .demod_init = dvico_fusionhdtv_demod_init, |
| 255 | }; |
| 256 | |
Chris Pascoe | 780dfef | 2006-02-28 08:34:59 -0300 | [diff] [blame] | 257 | static struct zl10353_config dvico_fusionhdtv_plus_v1_1 = { |
Michael Krufky | f7b54b1 | 2006-08-08 15:48:08 -0300 | [diff] [blame] | 258 | .demod_address = 0x0f, |
Chris Pascoe | 780dfef | 2006-02-28 08:34:59 -0300 | [diff] [blame] | 259 | }; |
Chris Pascoe | 780dfef | 2006-02-28 08:34:59 -0300 | [diff] [blame] | 260 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 261 | static struct cx22702_config connexant_refboard_config = { |
| 262 | .demod_address = 0x43, |
Patrick Boettcher | 38d84c3 | 2005-07-15 12:20:26 -0700 | [diff] [blame] | 263 | .output_mode = CX22702_SERIAL_OUTPUT, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 264 | }; |
| 265 | |
Michael Krufky | ed35526 | 2006-12-05 01:34:56 -0300 | [diff] [blame] | 266 | static struct cx22702_config hauppauge_hvr_config = { |
Steven Toth | aa481a6 | 2006-09-14 15:41:13 -0300 | [diff] [blame] | 267 | .demod_address = 0x63, |
| 268 | .output_mode = CX22702_SERIAL_OUTPUT, |
| 269 | }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 270 | |
Michael Krufky | 4a39055 | 2006-12-05 02:00:53 -0300 | [diff] [blame] | 271 | static int or51132_set_ts_param(struct dvb_frontend* fe, int is_punctured) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 272 | { |
| 273 | struct cx8802_dev *dev= fe->dvb->priv; |
| 274 | dev->ts_gen_cntrl = is_punctured ? 0x04 : 0x00; |
| 275 | return 0; |
| 276 | } |
| 277 | |
Adrian Bunk | 408b664 | 2005-05-01 08:59:29 -0700 | [diff] [blame] | 278 | static struct or51132_config pchdtv_hd3000 = { |
Michael Krufky | f7b54b1 | 2006-08-08 15:48:08 -0300 | [diff] [blame] | 279 | .demod_address = 0x15, |
| 280 | .set_ts_params = or51132_set_ts_param, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 281 | }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 282 | |
Michael Krufky | 6ddcc91 | 2005-07-27 11:46:00 -0700 | [diff] [blame] | 283 | static int lgdt330x_pll_rf_set(struct dvb_frontend* fe, int index) |
Michael Krufky | 0ccef6d | 2005-07-27 11:45:55 -0700 | [diff] [blame] | 284 | { |
| 285 | struct cx8802_dev *dev= fe->dvb->priv; |
| 286 | struct cx88_core *core = dev->core; |
| 287 | |
Harvey Harrison | 32d83ef | 2008-04-08 23:20:00 -0300 | [diff] [blame] | 288 | dprintk(1, "%s: index = %d\n", __func__, index); |
Michael Krufky | 0ccef6d | 2005-07-27 11:45:55 -0700 | [diff] [blame] | 289 | if (index == 0) |
| 290 | cx_clear(MO_GP0_IO, 8); |
| 291 | else |
| 292 | cx_set(MO_GP0_IO, 8); |
| 293 | return 0; |
| 294 | } |
| 295 | |
Michael Krufky | 6ddcc91 | 2005-07-27 11:46:00 -0700 | [diff] [blame] | 296 | static int lgdt330x_set_ts_param(struct dvb_frontend* fe, int is_punctured) |
Michael Krufky | f179849 | 2005-07-07 17:58:39 -0700 | [diff] [blame] | 297 | { |
| 298 | struct cx8802_dev *dev= fe->dvb->priv; |
| 299 | if (is_punctured) |
| 300 | dev->ts_gen_cntrl |= 0x04; |
| 301 | else |
| 302 | dev->ts_gen_cntrl &= ~0x04; |
| 303 | return 0; |
| 304 | } |
| 305 | |
Michael Krufky | 6ddcc91 | 2005-07-27 11:46:00 -0700 | [diff] [blame] | 306 | static struct lgdt330x_config fusionhdtv_3_gold = { |
Michael Krufky | f7b54b1 | 2006-08-08 15:48:08 -0300 | [diff] [blame] | 307 | .demod_address = 0x0e, |
| 308 | .demod_chip = LGDT3302, |
| 309 | .serial_mpeg = 0x04, /* TPSERIAL for 3302 in TOP_CONTROL */ |
| 310 | .set_ts_params = lgdt330x_set_ts_param, |
Michael Krufky | 0d723c0 | 2005-07-07 17:58:42 -0700 | [diff] [blame] | 311 | }; |
Mauro Carvalho Chehab | e52e98a | 2005-09-09 13:03:41 -0700 | [diff] [blame] | 312 | |
| 313 | static struct lgdt330x_config fusionhdtv_5_gold = { |
Michael Krufky | f7b54b1 | 2006-08-08 15:48:08 -0300 | [diff] [blame] | 314 | .demod_address = 0x0e, |
| 315 | .demod_chip = LGDT3303, |
| 316 | .serial_mpeg = 0x40, /* TPSERIAL for 3303 in TOP_CONTROL */ |
| 317 | .set_ts_params = lgdt330x_set_ts_param, |
Mauro Carvalho Chehab | e52e98a | 2005-09-09 13:03:41 -0700 | [diff] [blame] | 318 | }; |
Rusty Scott | da215d2 | 2006-04-07 02:21:31 -0300 | [diff] [blame] | 319 | |
| 320 | static struct lgdt330x_config pchdtv_hd5500 = { |
Michael Krufky | f7b54b1 | 2006-08-08 15:48:08 -0300 | [diff] [blame] | 321 | .demod_address = 0x59, |
| 322 | .demod_chip = LGDT3303, |
| 323 | .serial_mpeg = 0x40, /* TPSERIAL for 3303 in TOP_CONTROL */ |
| 324 | .set_ts_params = lgdt330x_set_ts_param, |
Rusty Scott | da215d2 | 2006-04-07 02:21:31 -0300 | [diff] [blame] | 325 | }; |
Michael Krufky | f179849 | 2005-07-07 17:58:39 -0700 | [diff] [blame] | 326 | |
Michael Krufky | 4a39055 | 2006-12-05 02:00:53 -0300 | [diff] [blame] | 327 | static int nxt200x_set_ts_param(struct dvb_frontend* fe, int is_punctured) |
Kirk Lapray | fde6d31 | 2005-11-08 21:38:18 -0800 | [diff] [blame] | 328 | { |
| 329 | struct cx8802_dev *dev= fe->dvb->priv; |
| 330 | dev->ts_gen_cntrl = is_punctured ? 0x04 : 0x00; |
| 331 | return 0; |
| 332 | } |
| 333 | |
| 334 | static struct nxt200x_config ati_hdtvwonder = { |
Michael Krufky | f7b54b1 | 2006-08-08 15:48:08 -0300 | [diff] [blame] | 335 | .demod_address = 0x0a, |
Michael Krufky | f7b54b1 | 2006-08-08 15:48:08 -0300 | [diff] [blame] | 336 | .set_ts_params = nxt200x_set_ts_param, |
Kirk Lapray | fde6d31 | 2005-11-08 21:38:18 -0800 | [diff] [blame] | 337 | }; |
Kirk Lapray | fde6d31 | 2005-11-08 21:38:18 -0800 | [diff] [blame] | 338 | |
Steven Toth | 0fa14aa | 2006-01-09 15:25:02 -0200 | [diff] [blame] | 339 | static int cx24123_set_ts_param(struct dvb_frontend* fe, |
| 340 | int is_punctured) |
| 341 | { |
| 342 | struct cx8802_dev *dev= fe->dvb->priv; |
Michael Krufky | f7b54b1 | 2006-08-08 15:48:08 -0300 | [diff] [blame] | 343 | dev->ts_gen_cntrl = 0x02; |
Steven Toth | 0fa14aa | 2006-01-09 15:25:02 -0200 | [diff] [blame] | 344 | return 0; |
| 345 | } |
| 346 | |
Michael Krufky | f7b54b1 | 2006-08-08 15:48:08 -0300 | [diff] [blame] | 347 | static int kworld_dvbs_100_set_voltage(struct dvb_frontend* fe, |
| 348 | fe_sec_voltage_t voltage) |
Vadim Catana | 0e0351e | 2006-01-09 15:25:02 -0200 | [diff] [blame] | 349 | { |
| 350 | struct cx8802_dev *dev= fe->dvb->priv; |
| 351 | struct cx88_core *core = dev->core; |
| 352 | |
Michael Krufky | 4a39055 | 2006-12-05 02:00:53 -0300 | [diff] [blame] | 353 | if (voltage == SEC_VOLTAGE_OFF) |
Michael Krufky | f7b54b1 | 2006-08-08 15:48:08 -0300 | [diff] [blame] | 354 | cx_write(MO_GP0_IO, 0x000006fb); |
Michael Krufky | 4a39055 | 2006-12-05 02:00:53 -0300 | [diff] [blame] | 355 | else |
Andrew de Quincey | cd20ca9 | 2006-05-12 20:31:51 -0300 | [diff] [blame] | 356 | cx_write(MO_GP0_IO, 0x000006f9); |
Andrew de Quincey | cd20ca9 | 2006-05-12 20:31:51 -0300 | [diff] [blame] | 357 | |
| 358 | if (core->prev_set_voltage) |
| 359 | return core->prev_set_voltage(fe, voltage); |
| 360 | return 0; |
Vadim Catana | 0e0351e | 2006-01-09 15:25:02 -0200 | [diff] [blame] | 361 | } |
| 362 | |
Michael Krufky | f7b54b1 | 2006-08-08 15:48:08 -0300 | [diff] [blame] | 363 | static int geniatech_dvbs_set_voltage(struct dvb_frontend *fe, |
| 364 | fe_sec_voltage_t voltage) |
Saqeb Akhter | c02a34f | 2006-06-29 20:29:33 -0300 | [diff] [blame] | 365 | { |
| 366 | struct cx8802_dev *dev= fe->dvb->priv; |
| 367 | struct cx88_core *core = dev->core; |
| 368 | |
| 369 | if (voltage == SEC_VOLTAGE_OFF) { |
| 370 | dprintk(1,"LNB Voltage OFF\n"); |
| 371 | cx_write(MO_GP0_IO, 0x0000efff); |
| 372 | } |
| 373 | |
| 374 | if (core->prev_set_voltage) |
| 375 | return core->prev_set_voltage(fe, voltage); |
| 376 | return 0; |
| 377 | } |
| 378 | |
Igor M. Liplianin | af83262 | 2008-09-04 17:24:14 -0300 | [diff] [blame] | 379 | static int tevii_dvbs_set_voltage(struct dvb_frontend *fe, |
| 380 | fe_sec_voltage_t voltage) |
| 381 | { |
| 382 | struct cx8802_dev *dev= fe->dvb->priv; |
| 383 | struct cx88_core *core = dev->core; |
| 384 | |
| 385 | switch (voltage) { |
| 386 | case SEC_VOLTAGE_13: |
| 387 | printk("LNB Voltage SEC_VOLTAGE_13\n"); |
| 388 | cx_write(MO_GP0_IO, 0x00006040); |
| 389 | break; |
| 390 | case SEC_VOLTAGE_18: |
| 391 | printk("LNB Voltage SEC_VOLTAGE_18\n"); |
| 392 | cx_write(MO_GP0_IO, 0x00006060); |
| 393 | break; |
| 394 | case SEC_VOLTAGE_OFF: |
| 395 | printk("LNB Voltage SEC_VOLTAGE_off\n"); |
| 396 | break; |
| 397 | } |
| 398 | |
| 399 | if (core->prev_set_voltage) |
| 400 | return core->prev_set_voltage(fe, voltage); |
| 401 | return 0; |
| 402 | } |
| 403 | |
Mauro Carvalho Chehab | c4a3ce1 | 2008-04-22 14:45:31 -0300 | [diff] [blame] | 404 | static int cx88_pci_nano_callback(void *ptr, int command, int arg) |
Steven Toth | 5c00fac | 2008-04-22 14:45:14 -0300 | [diff] [blame] | 405 | { |
| 406 | struct cx88_core *core = ptr; |
| 407 | |
| 408 | switch (command) { |
| 409 | case XC2028_TUNER_RESET: |
| 410 | /* Send the tuner in then out of reset */ |
Harvey Harrison | 32d83ef | 2008-04-08 23:20:00 -0300 | [diff] [blame] | 411 | dprintk(1, "%s: XC2028_TUNER_RESET %d\n", __func__, arg); |
Steven Toth | 5c00fac | 2008-04-22 14:45:14 -0300 | [diff] [blame] | 412 | |
| 413 | switch (core->boardnr) { |
| 414 | case CX88_BOARD_DVICO_FUSIONHDTV_5_PCI_NANO: |
| 415 | /* GPIO-4 xc3028 tuner */ |
| 416 | |
| 417 | cx_set(MO_GP0_IO, 0x00001000); |
| 418 | cx_clear(MO_GP0_IO, 0x00000010); |
| 419 | msleep(100); |
| 420 | cx_set(MO_GP0_IO, 0x00000010); |
| 421 | msleep(100); |
| 422 | break; |
| 423 | } |
| 424 | |
| 425 | break; |
| 426 | case XC2028_RESET_CLK: |
Harvey Harrison | 32d83ef | 2008-04-08 23:20:00 -0300 | [diff] [blame] | 427 | dprintk(1, "%s: XC2028_RESET_CLK %d\n", __func__, arg); |
Steven Toth | 5c00fac | 2008-04-22 14:45:14 -0300 | [diff] [blame] | 428 | break; |
| 429 | default: |
Harvey Harrison | 32d83ef | 2008-04-08 23:20:00 -0300 | [diff] [blame] | 430 | dprintk(1, "%s: unknown command %d, arg %d\n", __func__, |
Steven Toth | 5c00fac | 2008-04-22 14:45:14 -0300 | [diff] [blame] | 431 | command, arg); |
| 432 | return -EINVAL; |
| 433 | } |
| 434 | |
| 435 | return 0; |
| 436 | } |
| 437 | |
Saqeb Akhter | c02a34f | 2006-06-29 20:29:33 -0300 | [diff] [blame] | 438 | static struct cx24123_config geniatech_dvbs_config = { |
Michael Krufky | f7b54b1 | 2006-08-08 15:48:08 -0300 | [diff] [blame] | 439 | .demod_address = 0x55, |
| 440 | .set_ts_params = cx24123_set_ts_param, |
Saqeb Akhter | c02a34f | 2006-06-29 20:29:33 -0300 | [diff] [blame] | 441 | }; |
| 442 | |
Steven Toth | 0fa14aa | 2006-01-09 15:25:02 -0200 | [diff] [blame] | 443 | static struct cx24123_config hauppauge_novas_config = { |
Michael Krufky | f7b54b1 | 2006-08-08 15:48:08 -0300 | [diff] [blame] | 444 | .demod_address = 0x55, |
| 445 | .set_ts_params = cx24123_set_ts_param, |
Vadim Catana | 0e0351e | 2006-01-09 15:25:02 -0200 | [diff] [blame] | 446 | }; |
| 447 | |
| 448 | static struct cx24123_config kworld_dvbs_100_config = { |
Michael Krufky | f7b54b1 | 2006-08-08 15:48:08 -0300 | [diff] [blame] | 449 | .demod_address = 0x15, |
| 450 | .set_ts_params = cx24123_set_ts_param, |
Yeasah Pell | ef76856 | 2006-09-26 12:30:14 -0300 | [diff] [blame] | 451 | .lnb_polarity = 1, |
Steven Toth | 0fa14aa | 2006-01-09 15:25:02 -0200 | [diff] [blame] | 452 | }; |
Steven Toth | 0fa14aa | 2006-01-09 15:25:02 -0200 | [diff] [blame] | 453 | |
Steven Toth | 60464da | 2008-01-05 16:53:01 -0300 | [diff] [blame] | 454 | static struct s5h1409_config pinnacle_pctv_hd_800i_config = { |
| 455 | .demod_address = 0x32 >> 1, |
| 456 | .output_mode = S5H1409_PARALLEL_OUTPUT, |
| 457 | .gpio = S5H1409_GPIO_ON, |
| 458 | .qam_if = 44000, |
| 459 | .inversion = S5H1409_INVERSION_OFF, |
| 460 | .status_mode = S5H1409_DEMODLOCKING, |
Steven Toth | 4917019 | 2008-01-15 21:57:14 -0300 | [diff] [blame] | 461 | .mpeg_timing = S5H1409_MPEGTIMING_NONCONTINOUS_NONINVERTING_CLOCK, |
Steven Toth | 60464da | 2008-01-05 16:53:01 -0300 | [diff] [blame] | 462 | }; |
| 463 | |
Steven Toth | 5c00fac | 2008-04-22 14:45:14 -0300 | [diff] [blame] | 464 | static struct s5h1409_config dvico_hdtv5_pci_nano_config = { |
| 465 | .demod_address = 0x32 >> 1, |
| 466 | .output_mode = S5H1409_SERIAL_OUTPUT, |
| 467 | .gpio = S5H1409_GPIO_OFF, |
| 468 | .inversion = S5H1409_INVERSION_OFF, |
| 469 | .status_mode = S5H1409_DEMODLOCKING, |
| 470 | .mpeg_timing = S5H1409_MPEGTIMING_CONTINOUS_NONINVERTING_CLOCK, |
| 471 | }; |
| 472 | |
Mauro Carvalho Chehab | 99e09ea | 2008-03-27 23:18:30 -0300 | [diff] [blame] | 473 | static struct s5h1409_config kworld_atsc_120_config = { |
| 474 | .demod_address = 0x32 >> 1, |
Mauro Carvalho Chehab | 99e09ea | 2008-03-27 23:18:30 -0300 | [diff] [blame] | 475 | .output_mode = S5H1409_SERIAL_OUTPUT, |
| 476 | .gpio = S5H1409_GPIO_OFF, |
| 477 | .inversion = S5H1409_INVERSION_OFF, |
| 478 | .status_mode = S5H1409_DEMODLOCKING, |
| 479 | .mpeg_timing = S5H1409_MPEGTIMING_CONTINOUS_NONINVERTING_CLOCK, |
| 480 | }; |
| 481 | |
Steven Toth | 60464da | 2008-01-05 16:53:01 -0300 | [diff] [blame] | 482 | static struct xc5000_config pinnacle_pctv_hd_800i_tuner_config = { |
| 483 | .i2c_address = 0x64, |
| 484 | .if_khz = 5380, |
Steven Toth | 60464da | 2008-01-05 16:53:01 -0300 | [diff] [blame] | 485 | .tuner_callback = cx88_tuner_callback, |
| 486 | }; |
| 487 | |
Mauro Carvalho Chehab | 9507901 | 2008-04-22 14:45:15 -0300 | [diff] [blame] | 488 | static struct zl10353_config cx88_geniatech_x8000_mt = { |
| 489 | .demod_address = (0x1e >> 1), |
| 490 | .no_tuner = 1, |
| 491 | }; |
| 492 | |
Steven Toth | d893d5d | 2008-04-25 03:46:43 -0300 | [diff] [blame] | 493 | static struct s5h1411_config dvico_fusionhdtv7_config = { |
| 494 | .output_mode = S5H1411_SERIAL_OUTPUT, |
| 495 | .gpio = S5H1411_GPIO_ON, |
| 496 | .mpeg_timing = S5H1411_MPEGTIMING_CONTINOUS_NONINVERTING_CLOCK, |
| 497 | .qam_if = S5H1411_IF_44000, |
| 498 | .vsb_if = S5H1411_IF_44000, |
| 499 | .inversion = S5H1411_INVERSION_OFF, |
| 500 | .status_mode = S5H1411_DEMODLOCKING |
| 501 | }; |
| 502 | |
| 503 | static struct xc5000_config dvico_fusionhdtv7_tuner_config = { |
| 504 | .i2c_address = 0xc2 >> 1, |
| 505 | .if_khz = 5380, |
| 506 | .tuner_callback = cx88_tuner_callback, |
| 507 | }; |
| 508 | |
Mauro Carvalho Chehab | 23fb348 | 2008-04-22 14:45:30 -0300 | [diff] [blame] | 509 | static int attach_xc3028(u8 addr, struct cx8802_dev *dev) |
| 510 | { |
| 511 | struct dvb_frontend *fe; |
Mauro Carvalho Chehab | 99e09ea | 2008-03-27 23:18:30 -0300 | [diff] [blame] | 512 | struct xc2028_ctrl ctl; |
Mauro Carvalho Chehab | 23fb348 | 2008-04-22 14:45:30 -0300 | [diff] [blame] | 513 | struct xc2028_config cfg = { |
| 514 | .i2c_adap = &dev->core->i2c_adap, |
| 515 | .i2c_addr = addr, |
Mauro Carvalho Chehab | 99e09ea | 2008-03-27 23:18:30 -0300 | [diff] [blame] | 516 | .ctrl = &ctl, |
| 517 | .callback = cx88_tuner_callback, |
Mauro Carvalho Chehab | 23fb348 | 2008-04-22 14:45:30 -0300 | [diff] [blame] | 518 | }; |
| 519 | |
Mauro Carvalho Chehab | ddd5441 | 2008-04-22 14:45:46 -0300 | [diff] [blame] | 520 | if (!dev->dvb.frontend) { |
| 521 | printk(KERN_ERR "%s/2: dvb frontend not attached. " |
| 522 | "Can't attach xc3028\n", |
| 523 | dev->core->name); |
| 524 | return -EINVAL; |
| 525 | } |
| 526 | |
Mauro Carvalho Chehab | 99e09ea | 2008-03-27 23:18:30 -0300 | [diff] [blame] | 527 | /* |
| 528 | * Some xc3028 devices may be hidden by an I2C gate. This is known |
| 529 | * to happen with some s5h1409-based devices. |
| 530 | * Now that I2C gate is open, sets up xc3028 configuration |
| 531 | */ |
| 532 | cx88_setup_xc3028(dev->core, &ctl); |
| 533 | |
Mauro Carvalho Chehab | 23fb348 | 2008-04-22 14:45:30 -0300 | [diff] [blame] | 534 | fe = dvb_attach(xc2028_attach, dev->dvb.frontend, &cfg); |
| 535 | if (!fe) { |
| 536 | printk(KERN_ERR "%s/2: xc3028 attach failed\n", |
| 537 | dev->core->name); |
Mauro Carvalho Chehab | 23fb348 | 2008-04-22 14:45:30 -0300 | [diff] [blame] | 538 | return -EINVAL; |
| 539 | } |
| 540 | |
| 541 | printk(KERN_INFO "%s/2: xc3028 attached\n", |
| 542 | dev->core->name); |
| 543 | |
| 544 | return 0; |
| 545 | } |
Mauro Carvalho Chehab | 9507901 | 2008-04-22 14:45:15 -0300 | [diff] [blame] | 546 | |
Steven Toth | 5bd1b66 | 2008-09-04 01:17:33 -0300 | [diff] [blame] | 547 | static int cx24116_set_ts_param(struct dvb_frontend *fe, |
| 548 | int is_punctured) |
| 549 | { |
| 550 | struct cx8802_dev *dev = fe->dvb->priv; |
| 551 | dev->ts_gen_cntrl = 0x2; |
| 552 | |
| 553 | return 0; |
| 554 | } |
| 555 | |
| 556 | static int cx24116_reset_device(struct dvb_frontend *fe) |
| 557 | { |
| 558 | struct cx8802_dev *dev = fe->dvb->priv; |
| 559 | struct cx88_core *core = dev->core; |
| 560 | |
| 561 | /* Reset the part */ |
| 562 | cx_write(MO_SRST_IO, 0); |
| 563 | msleep(10); |
| 564 | cx_write(MO_SRST_IO, 1); |
| 565 | msleep(10); |
| 566 | |
| 567 | return 0; |
| 568 | } |
| 569 | |
| 570 | static struct cx24116_config hauppauge_hvr4000_config = { |
| 571 | .demod_address = 0x05, |
| 572 | .set_ts_params = cx24116_set_ts_param, |
| 573 | .reset_device = cx24116_reset_device, |
| 574 | }; |
| 575 | |
Igor M. Liplianin | af83262 | 2008-09-04 17:24:14 -0300 | [diff] [blame] | 576 | static struct cx24116_config tevii_s460_config = { |
| 577 | .demod_address = 0x55, |
| 578 | .set_ts_params = cx24116_set_ts_param, |
| 579 | .reset_device = cx24116_reset_device, |
| 580 | }; |
| 581 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 582 | static int dvb_register(struct cx8802_dev *dev) |
| 583 | { |
Mauro Carvalho Chehab | 0590d91 | 2008-04-30 18:14:36 -0300 | [diff] [blame] | 584 | struct cx88_core *core = dev->core; |
| 585 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 586 | /* init struct videobuf_dvb */ |
Mauro Carvalho Chehab | 0590d91 | 2008-04-30 18:14:36 -0300 | [diff] [blame] | 587 | dev->dvb.name = core->name; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 588 | dev->ts_gen_cntrl = 0x0c; |
| 589 | |
| 590 | /* init frontend */ |
Mauro Carvalho Chehab | 0590d91 | 2008-04-30 18:14:36 -0300 | [diff] [blame] | 591 | switch (core->boardnr) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 592 | case CX88_BOARD_HAUPPAUGE_DVB_T1: |
Michael Krufky | f7b54b1 | 2006-08-08 15:48:08 -0300 | [diff] [blame] | 593 | dev->dvb.frontend = dvb_attach(cx22702_attach, |
Michael Krufky | ed35526 | 2006-12-05 01:34:56 -0300 | [diff] [blame] | 594 | &connexant_refboard_config, |
Mauro Carvalho Chehab | 0590d91 | 2008-04-30 18:14:36 -0300 | [diff] [blame] | 595 | &core->i2c_adap); |
Andrew de Quincey | f54376e | 2006-04-18 17:56:10 -0300 | [diff] [blame] | 596 | if (dev->dvb.frontend != NULL) { |
Mauro Carvalho Chehab | 0590d91 | 2008-04-30 18:14:36 -0300 | [diff] [blame] | 597 | if (!dvb_attach(dvb_pll_attach, dev->dvb.frontend, |
| 598 | 0x61, &core->i2c_adap, |
| 599 | DVB_PLL_THOMSON_DTT759X)) |
| 600 | goto frontend_detach; |
Andrew de Quincey | f54376e | 2006-04-18 17:56:10 -0300 | [diff] [blame] | 601 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 602 | break; |
Michael Krufky | e057ee1 | 2005-07-07 17:58:40 -0700 | [diff] [blame] | 603 | case CX88_BOARD_TERRATEC_CINERGY_1400_DVB_T1: |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 604 | case CX88_BOARD_CONEXANT_DVB_T1: |
Manenti Marco | f39624f | 2006-01-09 15:32:45 -0200 | [diff] [blame] | 605 | case CX88_BOARD_KWORLD_DVB_T_CX22702: |
David Shirley | 2b5200a | 2005-11-08 21:37:22 -0800 | [diff] [blame] | 606 | case CX88_BOARD_WINFAST_DTV1000: |
Michael Krufky | f7b54b1 | 2006-08-08 15:48:08 -0300 | [diff] [blame] | 607 | dev->dvb.frontend = dvb_attach(cx22702_attach, |
| 608 | &connexant_refboard_config, |
Mauro Carvalho Chehab | 0590d91 | 2008-04-30 18:14:36 -0300 | [diff] [blame] | 609 | &core->i2c_adap); |
Andrew de Quincey | f54376e | 2006-04-18 17:56:10 -0300 | [diff] [blame] | 610 | if (dev->dvb.frontend != NULL) { |
Mauro Carvalho Chehab | 0590d91 | 2008-04-30 18:14:36 -0300 | [diff] [blame] | 611 | if (!dvb_attach(dvb_pll_attach, dev->dvb.frontend, |
| 612 | 0x60, &core->i2c_adap, |
| 613 | DVB_PLL_THOMSON_DTT7579)) |
| 614 | goto frontend_detach; |
Andrew de Quincey | f54376e | 2006-04-18 17:56:10 -0300 | [diff] [blame] | 615 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 616 | break; |
Malcolm Valentine | 4bd6e9d | 2006-05-29 13:51:59 -0300 | [diff] [blame] | 617 | case CX88_BOARD_WINFAST_DTV2000H: |
Steven Toth | 611900c | 2006-01-09 15:25:12 -0200 | [diff] [blame] | 618 | case CX88_BOARD_HAUPPAUGE_HVR1100: |
| 619 | case CX88_BOARD_HAUPPAUGE_HVR1100LP: |
Trent Piepho | a5a2ecf | 2007-03-09 15:07:07 -0300 | [diff] [blame] | 620 | case CX88_BOARD_HAUPPAUGE_HVR1300: |
| 621 | case CX88_BOARD_HAUPPAUGE_HVR3000: |
Michael Krufky | f7b54b1 | 2006-08-08 15:48:08 -0300 | [diff] [blame] | 622 | dev->dvb.frontend = dvb_attach(cx22702_attach, |
Michael Krufky | ed35526 | 2006-12-05 01:34:56 -0300 | [diff] [blame] | 623 | &hauppauge_hvr_config, |
Mauro Carvalho Chehab | 0590d91 | 2008-04-30 18:14:36 -0300 | [diff] [blame] | 624 | &core->i2c_adap); |
Andrew de Quincey | f54376e | 2006-04-18 17:56:10 -0300 | [diff] [blame] | 625 | if (dev->dvb.frontend != NULL) { |
Mauro Carvalho Chehab | 0590d91 | 2008-04-30 18:14:36 -0300 | [diff] [blame] | 626 | if (!dvb_attach(simple_tuner_attach, dev->dvb.frontend, |
| 627 | &core->i2c_adap, 0x61, |
| 628 | TUNER_PHILIPS_FMD1216ME_MK3)) |
| 629 | goto frontend_detach; |
Andrew de Quincey | f54376e | 2006-04-18 17:56:10 -0300 | [diff] [blame] | 630 | } |
Steven Toth | 611900c | 2006-01-09 15:25:12 -0200 | [diff] [blame] | 631 | break; |
Chris Pascoe | 780dfef | 2006-02-28 08:34:59 -0300 | [diff] [blame] | 632 | case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_PLUS: |
Michael Krufky | f7b54b1 | 2006-08-08 15:48:08 -0300 | [diff] [blame] | 633 | dev->dvb.frontend = dvb_attach(mt352_attach, |
| 634 | &dvico_fusionhdtv, |
Mauro Carvalho Chehab | 0590d91 | 2008-04-30 18:14:36 -0300 | [diff] [blame] | 635 | &core->i2c_adap); |
Andrew de Quincey | f54376e | 2006-04-18 17:56:10 -0300 | [diff] [blame] | 636 | if (dev->dvb.frontend != NULL) { |
Mauro Carvalho Chehab | 0590d91 | 2008-04-30 18:14:36 -0300 | [diff] [blame] | 637 | if (!dvb_attach(dvb_pll_attach, dev->dvb.frontend, |
| 638 | 0x60, NULL, DVB_PLL_THOMSON_DTT7579)) |
| 639 | goto frontend_detach; |
Chris Pascoe | 780dfef | 2006-02-28 08:34:59 -0300 | [diff] [blame] | 640 | break; |
Andrew de Quincey | f54376e | 2006-04-18 17:56:10 -0300 | [diff] [blame] | 641 | } |
Chris Pascoe | 780dfef | 2006-02-28 08:34:59 -0300 | [diff] [blame] | 642 | /* ZL10353 replaces MT352 on later cards */ |
Michael Krufky | f7b54b1 | 2006-08-08 15:48:08 -0300 | [diff] [blame] | 643 | dev->dvb.frontend = dvb_attach(zl10353_attach, |
| 644 | &dvico_fusionhdtv_plus_v1_1, |
Mauro Carvalho Chehab | 0590d91 | 2008-04-30 18:14:36 -0300 | [diff] [blame] | 645 | &core->i2c_adap); |
Andrew de Quincey | f54376e | 2006-04-18 17:56:10 -0300 | [diff] [blame] | 646 | if (dev->dvb.frontend != NULL) { |
Mauro Carvalho Chehab | 0590d91 | 2008-04-30 18:14:36 -0300 | [diff] [blame] | 647 | if (!dvb_attach(dvb_pll_attach, dev->dvb.frontend, |
| 648 | 0x60, NULL, DVB_PLL_THOMSON_DTT7579)) |
| 649 | goto frontend_detach; |
Andrew de Quincey | f54376e | 2006-04-18 17:56:10 -0300 | [diff] [blame] | 650 | } |
Chris Pascoe | 780dfef | 2006-02-28 08:34:59 -0300 | [diff] [blame] | 651 | break; |
Michael Krufky | c2af3cd | 2006-06-12 14:06:22 -0300 | [diff] [blame] | 652 | case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_DUAL: |
Michael Krufky | c2af3cd | 2006-06-12 14:06:22 -0300 | [diff] [blame] | 653 | /* The tin box says DEE1601, but it seems to be DTT7579 |
| 654 | * compatible, with a slightly different MT352 AGC gain. */ |
Michael Krufky | f7b54b1 | 2006-08-08 15:48:08 -0300 | [diff] [blame] | 655 | dev->dvb.frontend = dvb_attach(mt352_attach, |
| 656 | &dvico_fusionhdtv_dual, |
Mauro Carvalho Chehab | 0590d91 | 2008-04-30 18:14:36 -0300 | [diff] [blame] | 657 | &core->i2c_adap); |
Michael Krufky | c2af3cd | 2006-06-12 14:06:22 -0300 | [diff] [blame] | 658 | if (dev->dvb.frontend != NULL) { |
Mauro Carvalho Chehab | 0590d91 | 2008-04-30 18:14:36 -0300 | [diff] [blame] | 659 | if (!dvb_attach(dvb_pll_attach, dev->dvb.frontend, |
| 660 | 0x61, NULL, DVB_PLL_THOMSON_DTT7579)) |
| 661 | goto frontend_detach; |
Michael Krufky | c2af3cd | 2006-06-12 14:06:22 -0300 | [diff] [blame] | 662 | break; |
| 663 | } |
Michael Krufky | c2af3cd | 2006-06-12 14:06:22 -0300 | [diff] [blame] | 664 | /* ZL10353 replaces MT352 on later cards */ |
Michael Krufky | f7b54b1 | 2006-08-08 15:48:08 -0300 | [diff] [blame] | 665 | dev->dvb.frontend = dvb_attach(zl10353_attach, |
| 666 | &dvico_fusionhdtv_plus_v1_1, |
Mauro Carvalho Chehab | 0590d91 | 2008-04-30 18:14:36 -0300 | [diff] [blame] | 667 | &core->i2c_adap); |
Michael Krufky | c2af3cd | 2006-06-12 14:06:22 -0300 | [diff] [blame] | 668 | if (dev->dvb.frontend != NULL) { |
Mauro Carvalho Chehab | 0590d91 | 2008-04-30 18:14:36 -0300 | [diff] [blame] | 669 | if (!dvb_attach(dvb_pll_attach, dev->dvb.frontend, |
| 670 | 0x61, NULL, DVB_PLL_THOMSON_DTT7579)) |
| 671 | goto frontend_detach; |
Michael Krufky | c2af3cd | 2006-06-12 14:06:22 -0300 | [diff] [blame] | 672 | } |
Michael Krufky | c2af3cd | 2006-06-12 14:06:22 -0300 | [diff] [blame] | 673 | break; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 674 | case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T1: |
Michael Krufky | f7b54b1 | 2006-08-08 15:48:08 -0300 | [diff] [blame] | 675 | dev->dvb.frontend = dvb_attach(mt352_attach, |
| 676 | &dvico_fusionhdtv, |
Mauro Carvalho Chehab | 0590d91 | 2008-04-30 18:14:36 -0300 | [diff] [blame] | 677 | &core->i2c_adap); |
Andrew de Quincey | f54376e | 2006-04-18 17:56:10 -0300 | [diff] [blame] | 678 | if (dev->dvb.frontend != NULL) { |
Mauro Carvalho Chehab | 0590d91 | 2008-04-30 18:14:36 -0300 | [diff] [blame] | 679 | if (!dvb_attach(dvb_pll_attach, dev->dvb.frontend, |
| 680 | 0x61, NULL, DVB_PLL_LG_Z201)) |
| 681 | goto frontend_detach; |
Andrew de Quincey | f54376e | 2006-04-18 17:56:10 -0300 | [diff] [blame] | 682 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 683 | break; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 684 | case CX88_BOARD_KWORLD_DVB_T: |
| 685 | case CX88_BOARD_DNTV_LIVE_DVB_T: |
Mauro Carvalho Chehab | a82decf | 2005-07-07 17:58:36 -0700 | [diff] [blame] | 686 | case CX88_BOARD_ADSTECH_DVB_T_PCI: |
Michael Krufky | f7b54b1 | 2006-08-08 15:48:08 -0300 | [diff] [blame] | 687 | dev->dvb.frontend = dvb_attach(mt352_attach, |
| 688 | &dntv_live_dvbt_config, |
Mauro Carvalho Chehab | 0590d91 | 2008-04-30 18:14:36 -0300 | [diff] [blame] | 689 | &core->i2c_adap); |
Andrew de Quincey | f54376e | 2006-04-18 17:56:10 -0300 | [diff] [blame] | 690 | if (dev->dvb.frontend != NULL) { |
Mauro Carvalho Chehab | 0590d91 | 2008-04-30 18:14:36 -0300 | [diff] [blame] | 691 | if (!dvb_attach(dvb_pll_attach, dev->dvb.frontend, |
| 692 | 0x61, NULL, DVB_PLL_UNKNOWN_1)) |
| 693 | goto frontend_detach; |
Andrew de Quincey | f54376e | 2006-04-18 17:56:10 -0300 | [diff] [blame] | 694 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 695 | break; |
Chris Pascoe | fc40b26 | 2006-01-09 15:25:35 -0200 | [diff] [blame] | 696 | case CX88_BOARD_DNTV_LIVE_DVB_T_PRO: |
Trent Piepho | ecf854d | 2007-05-05 20:11:32 -0300 | [diff] [blame] | 697 | #if defined(CONFIG_VIDEO_CX88_VP3054) || (defined(CONFIG_VIDEO_CX88_VP3054_MODULE) && defined(MODULE)) |
Trent Piepho | f0ad909 | 2007-10-14 02:52:16 -0300 | [diff] [blame] | 698 | /* MT352 is on a secondary I2C bus made from some GPIO lines */ |
Andrew de Quincey | 2bfe031 | 2006-08-08 09:10:08 -0300 | [diff] [blame] | 699 | dev->dvb.frontend = dvb_attach(mt352_attach, &dntv_live_dvbt_pro_config, |
Trent Piepho | f0ad909 | 2007-10-14 02:52:16 -0300 | [diff] [blame] | 700 | &dev->vp3054->adap); |
Andrew de Quincey | f54376e | 2006-04-18 17:56:10 -0300 | [diff] [blame] | 701 | if (dev->dvb.frontend != NULL) { |
Mauro Carvalho Chehab | 0590d91 | 2008-04-30 18:14:36 -0300 | [diff] [blame] | 702 | if (!dvb_attach(simple_tuner_attach, dev->dvb.frontend, |
| 703 | &core->i2c_adap, 0x61, |
| 704 | TUNER_PHILIPS_FMD1216ME_MK3)) |
| 705 | goto frontend_detach; |
Andrew de Quincey | f54376e | 2006-04-18 17:56:10 -0300 | [diff] [blame] | 706 | } |
Chris Pascoe | fc40b26 | 2006-01-09 15:25:35 -0200 | [diff] [blame] | 707 | #else |
Mauro Carvalho Chehab | 0590d91 | 2008-04-30 18:14:36 -0300 | [diff] [blame] | 708 | printk(KERN_ERR "%s/2: built without vp3054 support\n", |
| 709 | core->name); |
Chris Pascoe | fc40b26 | 2006-01-09 15:25:35 -0200 | [diff] [blame] | 710 | #endif |
| 711 | break; |
Chris Pascoe | 780dfef | 2006-02-28 08:34:59 -0300 | [diff] [blame] | 712 | case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_HYBRID: |
Michael Krufky | f7b54b1 | 2006-08-08 15:48:08 -0300 | [diff] [blame] | 713 | dev->dvb.frontend = dvb_attach(zl10353_attach, |
| 714 | &dvico_fusionhdtv_hybrid, |
Mauro Carvalho Chehab | 0590d91 | 2008-04-30 18:14:36 -0300 | [diff] [blame] | 715 | &core->i2c_adap); |
Andrew de Quincey | f54376e | 2006-04-18 17:56:10 -0300 | [diff] [blame] | 716 | if (dev->dvb.frontend != NULL) { |
Mauro Carvalho Chehab | 0590d91 | 2008-04-30 18:14:36 -0300 | [diff] [blame] | 717 | if (!dvb_attach(simple_tuner_attach, dev->dvb.frontend, |
| 718 | &core->i2c_adap, 0x61, |
| 719 | TUNER_THOMSON_FE6600)) |
| 720 | goto frontend_detach; |
Andrew de Quincey | f54376e | 2006-04-18 17:56:10 -0300 | [diff] [blame] | 721 | } |
Chris Pascoe | 780dfef | 2006-02-28 08:34:59 -0300 | [diff] [blame] | 722 | break; |
Chris Pascoe | b3fb91d | 2008-04-22 14:45:15 -0300 | [diff] [blame] | 723 | case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_PRO: |
| 724 | dev->dvb.frontend = dvb_attach(zl10353_attach, |
| 725 | &dvico_fusionhdtv_xc3028, |
Mauro Carvalho Chehab | 0590d91 | 2008-04-30 18:14:36 -0300 | [diff] [blame] | 726 | &core->i2c_adap); |
Chris Pascoe | b3fb91d | 2008-04-22 14:45:15 -0300 | [diff] [blame] | 727 | if (dev->dvb.frontend == NULL) |
| 728 | dev->dvb.frontend = dvb_attach(mt352_attach, |
| 729 | &dvico_fusionhdtv_mt352_xc3028, |
Mauro Carvalho Chehab | 0590d91 | 2008-04-30 18:14:36 -0300 | [diff] [blame] | 730 | &core->i2c_adap); |
Chris Pascoe | 8765561 | 2008-04-22 14:45:15 -0300 | [diff] [blame] | 731 | /* |
| 732 | * On this board, the demod provides the I2C bus pullup. |
| 733 | * We must not permit gate_ctrl to be performed, or |
| 734 | * the xc3028 cannot communicate on the bus. |
| 735 | */ |
| 736 | if (dev->dvb.frontend) |
| 737 | dev->dvb.frontend->ops.i2c_gate_ctrl = NULL; |
Mauro Carvalho Chehab | 23fb348 | 2008-04-22 14:45:30 -0300 | [diff] [blame] | 738 | if (attach_xc3028(0x61, dev) < 0) |
| 739 | return -EINVAL; |
Chris Pascoe | b3fb91d | 2008-04-22 14:45:15 -0300 | [diff] [blame] | 740 | break; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 741 | case CX88_BOARD_PCHDTV_HD3000: |
Michael Krufky | 4a39055 | 2006-12-05 02:00:53 -0300 | [diff] [blame] | 742 | dev->dvb.frontend = dvb_attach(or51132_attach, &pchdtv_hd3000, |
Mauro Carvalho Chehab | 0590d91 | 2008-04-30 18:14:36 -0300 | [diff] [blame] | 743 | &core->i2c_adap); |
Andrew de Quincey | f54376e | 2006-04-18 17:56:10 -0300 | [diff] [blame] | 744 | if (dev->dvb.frontend != NULL) { |
Mauro Carvalho Chehab | 0590d91 | 2008-04-30 18:14:36 -0300 | [diff] [blame] | 745 | if (!dvb_attach(simple_tuner_attach, dev->dvb.frontend, |
| 746 | &core->i2c_adap, 0x61, |
| 747 | TUNER_THOMSON_DTT761X)) |
| 748 | goto frontend_detach; |
Andrew de Quincey | f54376e | 2006-04-18 17:56:10 -0300 | [diff] [blame] | 749 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 750 | break; |
Michael Krufky | f179849 | 2005-07-07 17:58:39 -0700 | [diff] [blame] | 751 | case CX88_BOARD_DVICO_FUSIONHDTV_3_GOLD_Q: |
| 752 | dev->ts_gen_cntrl = 0x08; |
Michael Krufky | f179849 | 2005-07-07 17:58:39 -0700 | [diff] [blame] | 753 | |
Mauro Carvalho Chehab | 0590d91 | 2008-04-30 18:14:36 -0300 | [diff] [blame] | 754 | /* Do a hardware reset of chip before using it. */ |
Michael Krufky | f179849 | 2005-07-07 17:58:39 -0700 | [diff] [blame] | 755 | cx_clear(MO_GP0_IO, 1); |
| 756 | mdelay(100); |
Michael Krufky | 0ccef6d | 2005-07-27 11:45:55 -0700 | [diff] [blame] | 757 | cx_set(MO_GP0_IO, 1); |
Michael Krufky | f179849 | 2005-07-07 17:58:39 -0700 | [diff] [blame] | 758 | mdelay(200); |
Michael Krufky | 0ccef6d | 2005-07-27 11:45:55 -0700 | [diff] [blame] | 759 | |
| 760 | /* Select RF connector callback */ |
Michael Krufky | 6ddcc91 | 2005-07-27 11:46:00 -0700 | [diff] [blame] | 761 | fusionhdtv_3_gold.pll_rf_set = lgdt330x_pll_rf_set; |
Michael Krufky | f7b54b1 | 2006-08-08 15:48:08 -0300 | [diff] [blame] | 762 | dev->dvb.frontend = dvb_attach(lgdt330x_attach, |
| 763 | &fusionhdtv_3_gold, |
Mauro Carvalho Chehab | 0590d91 | 2008-04-30 18:14:36 -0300 | [diff] [blame] | 764 | &core->i2c_adap); |
Andrew de Quincey | f54376e | 2006-04-18 17:56:10 -0300 | [diff] [blame] | 765 | if (dev->dvb.frontend != NULL) { |
Mauro Carvalho Chehab | 0590d91 | 2008-04-30 18:14:36 -0300 | [diff] [blame] | 766 | if (!dvb_attach(simple_tuner_attach, dev->dvb.frontend, |
| 767 | &core->i2c_adap, 0x61, |
| 768 | TUNER_MICROTUNE_4042FI5)) |
| 769 | goto frontend_detach; |
Michael Krufky | f179849 | 2005-07-07 17:58:39 -0700 | [diff] [blame] | 770 | } |
| 771 | break; |
Michael Krufky | 0d723c0 | 2005-07-07 17:58:42 -0700 | [diff] [blame] | 772 | case CX88_BOARD_DVICO_FUSIONHDTV_3_GOLD_T: |
| 773 | dev->ts_gen_cntrl = 0x08; |
Michael Krufky | 0d723c0 | 2005-07-07 17:58:42 -0700 | [diff] [blame] | 774 | |
Mauro Carvalho Chehab | 0590d91 | 2008-04-30 18:14:36 -0300 | [diff] [blame] | 775 | /* Do a hardware reset of chip before using it. */ |
Michael Krufky | 0d723c0 | 2005-07-07 17:58:42 -0700 | [diff] [blame] | 776 | cx_clear(MO_GP0_IO, 1); |
| 777 | mdelay(100); |
Michael Krufky | d975872 | 2005-07-27 11:45:56 -0700 | [diff] [blame] | 778 | cx_set(MO_GP0_IO, 9); |
Michael Krufky | 0d723c0 | 2005-07-07 17:58:42 -0700 | [diff] [blame] | 779 | mdelay(200); |
Michael Krufky | f7b54b1 | 2006-08-08 15:48:08 -0300 | [diff] [blame] | 780 | dev->dvb.frontend = dvb_attach(lgdt330x_attach, |
| 781 | &fusionhdtv_3_gold, |
Mauro Carvalho Chehab | 0590d91 | 2008-04-30 18:14:36 -0300 | [diff] [blame] | 782 | &core->i2c_adap); |
Andrew de Quincey | f54376e | 2006-04-18 17:56:10 -0300 | [diff] [blame] | 783 | if (dev->dvb.frontend != NULL) { |
Mauro Carvalho Chehab | 0590d91 | 2008-04-30 18:14:36 -0300 | [diff] [blame] | 784 | if (!dvb_attach(simple_tuner_attach, dev->dvb.frontend, |
| 785 | &core->i2c_adap, 0x61, |
| 786 | TUNER_THOMSON_DTT761X)) |
| 787 | goto frontend_detach; |
Michael Krufky | 0d723c0 | 2005-07-07 17:58:42 -0700 | [diff] [blame] | 788 | } |
| 789 | break; |
Mauro Carvalho Chehab | e52e98a | 2005-09-09 13:03:41 -0700 | [diff] [blame] | 790 | case CX88_BOARD_DVICO_FUSIONHDTV_5_GOLD: |
| 791 | dev->ts_gen_cntrl = 0x08; |
Mauro Carvalho Chehab | e52e98a | 2005-09-09 13:03:41 -0700 | [diff] [blame] | 792 | |
Mauro Carvalho Chehab | 0590d91 | 2008-04-30 18:14:36 -0300 | [diff] [blame] | 793 | /* Do a hardware reset of chip before using it. */ |
Mauro Carvalho Chehab | e52e98a | 2005-09-09 13:03:41 -0700 | [diff] [blame] | 794 | cx_clear(MO_GP0_IO, 1); |
| 795 | mdelay(100); |
| 796 | cx_set(MO_GP0_IO, 1); |
| 797 | mdelay(200); |
Michael Krufky | f7b54b1 | 2006-08-08 15:48:08 -0300 | [diff] [blame] | 798 | dev->dvb.frontend = dvb_attach(lgdt330x_attach, |
| 799 | &fusionhdtv_5_gold, |
Mauro Carvalho Chehab | 0590d91 | 2008-04-30 18:14:36 -0300 | [diff] [blame] | 800 | &core->i2c_adap); |
Andrew de Quincey | f54376e | 2006-04-18 17:56:10 -0300 | [diff] [blame] | 801 | if (dev->dvb.frontend != NULL) { |
Mauro Carvalho Chehab | 0590d91 | 2008-04-30 18:14:36 -0300 | [diff] [blame] | 802 | if (!dvb_attach(simple_tuner_attach, dev->dvb.frontend, |
| 803 | &core->i2c_adap, 0x61, |
| 804 | TUNER_LG_TDVS_H06XF)) |
| 805 | goto frontend_detach; |
| 806 | if (!dvb_attach(tda9887_attach, dev->dvb.frontend, |
| 807 | &core->i2c_adap, 0x43)) |
| 808 | goto frontend_detach; |
Mauro Carvalho Chehab | e52e98a | 2005-09-09 13:03:41 -0700 | [diff] [blame] | 809 | } |
| 810 | break; |
Rusty Scott | da215d2 | 2006-04-07 02:21:31 -0300 | [diff] [blame] | 811 | case CX88_BOARD_PCHDTV_HD5500: |
| 812 | dev->ts_gen_cntrl = 0x08; |
Rusty Scott | da215d2 | 2006-04-07 02:21:31 -0300 | [diff] [blame] | 813 | |
Mauro Carvalho Chehab | 0590d91 | 2008-04-30 18:14:36 -0300 | [diff] [blame] | 814 | /* Do a hardware reset of chip before using it. */ |
Rusty Scott | da215d2 | 2006-04-07 02:21:31 -0300 | [diff] [blame] | 815 | cx_clear(MO_GP0_IO, 1); |
| 816 | mdelay(100); |
| 817 | cx_set(MO_GP0_IO, 1); |
| 818 | mdelay(200); |
Michael Krufky | f7b54b1 | 2006-08-08 15:48:08 -0300 | [diff] [blame] | 819 | dev->dvb.frontend = dvb_attach(lgdt330x_attach, |
| 820 | &pchdtv_hd5500, |
Mauro Carvalho Chehab | 0590d91 | 2008-04-30 18:14:36 -0300 | [diff] [blame] | 821 | &core->i2c_adap); |
Andrew de Quincey | f54376e | 2006-04-18 17:56:10 -0300 | [diff] [blame] | 822 | if (dev->dvb.frontend != NULL) { |
Mauro Carvalho Chehab | 0590d91 | 2008-04-30 18:14:36 -0300 | [diff] [blame] | 823 | if (!dvb_attach(simple_tuner_attach, dev->dvb.frontend, |
| 824 | &core->i2c_adap, 0x61, |
| 825 | TUNER_LG_TDVS_H06XF)) |
| 826 | goto frontend_detach; |
| 827 | if (!dvb_attach(tda9887_attach, dev->dvb.frontend, |
| 828 | &core->i2c_adap, 0x43)) |
| 829 | goto frontend_detach; |
Rusty Scott | da215d2 | 2006-04-07 02:21:31 -0300 | [diff] [blame] | 830 | } |
| 831 | break; |
Kirk Lapray | fde6d31 | 2005-11-08 21:38:18 -0800 | [diff] [blame] | 832 | case CX88_BOARD_ATI_HDTVWONDER: |
Michael Krufky | f7b54b1 | 2006-08-08 15:48:08 -0300 | [diff] [blame] | 833 | dev->dvb.frontend = dvb_attach(nxt200x_attach, |
| 834 | &ati_hdtvwonder, |
Mauro Carvalho Chehab | 0590d91 | 2008-04-30 18:14:36 -0300 | [diff] [blame] | 835 | &core->i2c_adap); |
Andrew de Quincey | f54376e | 2006-04-18 17:56:10 -0300 | [diff] [blame] | 836 | if (dev->dvb.frontend != NULL) { |
Mauro Carvalho Chehab | 0590d91 | 2008-04-30 18:14:36 -0300 | [diff] [blame] | 837 | if (!dvb_attach(simple_tuner_attach, dev->dvb.frontend, |
| 838 | &core->i2c_adap, 0x61, |
| 839 | TUNER_PHILIPS_TUV1236D)) |
| 840 | goto frontend_detach; |
Andrew de Quincey | f54376e | 2006-04-18 17:56:10 -0300 | [diff] [blame] | 841 | } |
Kirk Lapray | fde6d31 | 2005-11-08 21:38:18 -0800 | [diff] [blame] | 842 | break; |
Steven Toth | 0fa14aa | 2006-01-09 15:25:02 -0200 | [diff] [blame] | 843 | case CX88_BOARD_HAUPPAUGE_NOVASPLUS_S1: |
| 844 | case CX88_BOARD_HAUPPAUGE_NOVASE2_S1: |
Michael Krufky | f7b54b1 | 2006-08-08 15:48:08 -0300 | [diff] [blame] | 845 | dev->dvb.frontend = dvb_attach(cx24123_attach, |
| 846 | &hauppauge_novas_config, |
Mauro Carvalho Chehab | 0590d91 | 2008-04-30 18:14:36 -0300 | [diff] [blame] | 847 | &core->i2c_adap); |
Andrew de Quincey | cd20ca9 | 2006-05-12 20:31:51 -0300 | [diff] [blame] | 848 | if (dev->dvb.frontend) { |
Mauro Carvalho Chehab | 0590d91 | 2008-04-30 18:14:36 -0300 | [diff] [blame] | 849 | if (!dvb_attach(isl6421_attach, dev->dvb.frontend, |
Steven Toth | 83fe92e | 2008-09-13 19:22:15 -0300 | [diff] [blame] | 850 | &core->i2c_adap, 0x08, ISL6421_DCL, 0x00)) |
Mauro Carvalho Chehab | 0590d91 | 2008-04-30 18:14:36 -0300 | [diff] [blame] | 851 | goto frontend_detach; |
Andrew de Quincey | cd20ca9 | 2006-05-12 20:31:51 -0300 | [diff] [blame] | 852 | } |
Steven Toth | 0fa14aa | 2006-01-09 15:25:02 -0200 | [diff] [blame] | 853 | break; |
Vadim Catana | 0e0351e | 2006-01-09 15:25:02 -0200 | [diff] [blame] | 854 | case CX88_BOARD_KWORLD_DVBS_100: |
Michael Krufky | f7b54b1 | 2006-08-08 15:48:08 -0300 | [diff] [blame] | 855 | dev->dvb.frontend = dvb_attach(cx24123_attach, |
| 856 | &kworld_dvbs_100_config, |
Mauro Carvalho Chehab | 0590d91 | 2008-04-30 18:14:36 -0300 | [diff] [blame] | 857 | &core->i2c_adap); |
Andrew de Quincey | cd20ca9 | 2006-05-12 20:31:51 -0300 | [diff] [blame] | 858 | if (dev->dvb.frontend) { |
Mauro Carvalho Chehab | 0590d91 | 2008-04-30 18:14:36 -0300 | [diff] [blame] | 859 | core->prev_set_voltage = dev->dvb.frontend->ops.set_voltage; |
Patrick Boettcher | dea7486 | 2006-05-14 05:01:31 -0300 | [diff] [blame] | 860 | dev->dvb.frontend->ops.set_voltage = kworld_dvbs_100_set_voltage; |
Andrew de Quincey | cd20ca9 | 2006-05-12 20:31:51 -0300 | [diff] [blame] | 861 | } |
Vadim Catana | 0e0351e | 2006-01-09 15:25:02 -0200 | [diff] [blame] | 862 | break; |
Saqeb Akhter | c02a34f | 2006-06-29 20:29:33 -0300 | [diff] [blame] | 863 | case CX88_BOARD_GENIATECH_DVBS: |
Michael Krufky | f7b54b1 | 2006-08-08 15:48:08 -0300 | [diff] [blame] | 864 | dev->dvb.frontend = dvb_attach(cx24123_attach, |
| 865 | &geniatech_dvbs_config, |
Mauro Carvalho Chehab | 0590d91 | 2008-04-30 18:14:36 -0300 | [diff] [blame] | 866 | &core->i2c_adap); |
Saqeb Akhter | c02a34f | 2006-06-29 20:29:33 -0300 | [diff] [blame] | 867 | if (dev->dvb.frontend) { |
Mauro Carvalho Chehab | 0590d91 | 2008-04-30 18:14:36 -0300 | [diff] [blame] | 868 | core->prev_set_voltage = dev->dvb.frontend->ops.set_voltage; |
Saqeb Akhter | c02a34f | 2006-06-29 20:29:33 -0300 | [diff] [blame] | 869 | dev->dvb.frontend->ops.set_voltage = geniatech_dvbs_set_voltage; |
| 870 | } |
| 871 | break; |
Steven Toth | 60464da | 2008-01-05 16:53:01 -0300 | [diff] [blame] | 872 | case CX88_BOARD_PINNACLE_PCTV_HD_800i: |
Steven Toth | 60464da | 2008-01-05 16:53:01 -0300 | [diff] [blame] | 873 | dev->dvb.frontend = dvb_attach(s5h1409_attach, |
| 874 | &pinnacle_pctv_hd_800i_config, |
Mauro Carvalho Chehab | 0590d91 | 2008-04-30 18:14:36 -0300 | [diff] [blame] | 875 | &core->i2c_adap); |
Steven Toth | 60464da | 2008-01-05 16:53:01 -0300 | [diff] [blame] | 876 | if (dev->dvb.frontend != NULL) { |
Mauro Carvalho Chehab | 0590d91 | 2008-04-30 18:14:36 -0300 | [diff] [blame] | 877 | if (!dvb_attach(xc5000_attach, dev->dvb.frontend, |
| 878 | &core->i2c_adap, |
Michael Krufky | 3065096 | 2008-09-06 14:56:58 -0300 | [diff] [blame] | 879 | &pinnacle_pctv_hd_800i_tuner_config)) |
Mauro Carvalho Chehab | 0590d91 | 2008-04-30 18:14:36 -0300 | [diff] [blame] | 880 | goto frontend_detach; |
Steven Toth | 60464da | 2008-01-05 16:53:01 -0300 | [diff] [blame] | 881 | } |
| 882 | break; |
Steven Toth | 5c00fac | 2008-04-22 14:45:14 -0300 | [diff] [blame] | 883 | case CX88_BOARD_DVICO_FUSIONHDTV_5_PCI_NANO: |
| 884 | dev->dvb.frontend = dvb_attach(s5h1409_attach, |
| 885 | &dvico_hdtv5_pci_nano_config, |
Mauro Carvalho Chehab | 0590d91 | 2008-04-30 18:14:36 -0300 | [diff] [blame] | 886 | &core->i2c_adap); |
Steven Toth | 5c00fac | 2008-04-22 14:45:14 -0300 | [diff] [blame] | 887 | if (dev->dvb.frontend != NULL) { |
| 888 | struct dvb_frontend *fe; |
| 889 | struct xc2028_config cfg = { |
Mauro Carvalho Chehab | 0590d91 | 2008-04-30 18:14:36 -0300 | [diff] [blame] | 890 | .i2c_adap = &core->i2c_adap, |
Steven Toth | 5c00fac | 2008-04-22 14:45:14 -0300 | [diff] [blame] | 891 | .i2c_addr = 0x61, |
Mauro Carvalho Chehab | c4a3ce1 | 2008-04-22 14:45:31 -0300 | [diff] [blame] | 892 | .callback = cx88_pci_nano_callback, |
Steven Toth | 5c00fac | 2008-04-22 14:45:14 -0300 | [diff] [blame] | 893 | }; |
| 894 | static struct xc2028_ctrl ctl = { |
Michael Krufky | ef80bfe | 2008-09-16 02:15:30 -0300 | [diff] [blame] | 895 | .fname = XC2028_DEFAULT_FIRMWARE, |
Steven Toth | 5c00fac | 2008-04-22 14:45:14 -0300 | [diff] [blame] | 896 | .max_len = 64, |
Mauro Carvalho Chehab | 33e5316 | 2008-04-21 06:58:48 -0300 | [diff] [blame] | 897 | .scode_table = XC3028_FE_OREN538, |
Steven Toth | 5c00fac | 2008-04-22 14:45:14 -0300 | [diff] [blame] | 898 | }; |
| 899 | |
| 900 | fe = dvb_attach(xc2028_attach, |
| 901 | dev->dvb.frontend, &cfg); |
| 902 | if (fe != NULL && fe->ops.tuner_ops.set_config != NULL) |
| 903 | fe->ops.tuner_ops.set_config(fe, &ctl); |
| 904 | } |
| 905 | break; |
Mauro Carvalho Chehab | 9507901 | 2008-04-22 14:45:15 -0300 | [diff] [blame] | 906 | case CX88_BOARD_PINNACLE_HYBRID_PCTV: |
| 907 | dev->dvb.frontend = dvb_attach(zl10353_attach, |
| 908 | &cx88_geniatech_x8000_mt, |
Mauro Carvalho Chehab | 0590d91 | 2008-04-30 18:14:36 -0300 | [diff] [blame] | 909 | &core->i2c_adap); |
Mauro Carvalho Chehab | 23fb348 | 2008-04-22 14:45:30 -0300 | [diff] [blame] | 910 | if (attach_xc3028(0x61, dev) < 0) |
Mauro Carvalho Chehab | 0590d91 | 2008-04-30 18:14:36 -0300 | [diff] [blame] | 911 | goto frontend_detach; |
Mauro Carvalho Chehab | 9507901 | 2008-04-22 14:45:15 -0300 | [diff] [blame] | 912 | break; |
| 913 | case CX88_BOARD_GENIATECH_X8000_MT: |
Mauro Carvalho Chehab | 99e09ea | 2008-03-27 23:18:30 -0300 | [diff] [blame] | 914 | dev->ts_gen_cntrl = 0x00; |
Mauro Carvalho Chehab | 9507901 | 2008-04-22 14:45:15 -0300 | [diff] [blame] | 915 | |
| 916 | dev->dvb.frontend = dvb_attach(zl10353_attach, |
| 917 | &cx88_geniatech_x8000_mt, |
Mauro Carvalho Chehab | 0590d91 | 2008-04-30 18:14:36 -0300 | [diff] [blame] | 918 | &core->i2c_adap); |
Mauro Carvalho Chehab | 23fb348 | 2008-04-22 14:45:30 -0300 | [diff] [blame] | 919 | if (attach_xc3028(0x61, dev) < 0) |
Mauro Carvalho Chehab | 0590d91 | 2008-04-30 18:14:36 -0300 | [diff] [blame] | 920 | goto frontend_detach; |
Mauro Carvalho Chehab | 9507901 | 2008-04-22 14:45:15 -0300 | [diff] [blame] | 921 | break; |
Mauro Carvalho Chehab | 99e09ea | 2008-03-27 23:18:30 -0300 | [diff] [blame] | 922 | case CX88_BOARD_KWORLD_ATSC_120: |
| 923 | dev->dvb.frontend = dvb_attach(s5h1409_attach, |
| 924 | &kworld_atsc_120_config, |
Mauro Carvalho Chehab | 0590d91 | 2008-04-30 18:14:36 -0300 | [diff] [blame] | 925 | &core->i2c_adap); |
Mauro Carvalho Chehab | 99e09ea | 2008-03-27 23:18:30 -0300 | [diff] [blame] | 926 | if (attach_xc3028(0x61, dev) < 0) |
Mauro Carvalho Chehab | 0590d91 | 2008-04-30 18:14:36 -0300 | [diff] [blame] | 927 | goto frontend_detach; |
Mauro Carvalho Chehab | 99e09ea | 2008-03-27 23:18:30 -0300 | [diff] [blame] | 928 | break; |
Steven Toth | d893d5d | 2008-04-25 03:46:43 -0300 | [diff] [blame] | 929 | case CX88_BOARD_DVICO_FUSIONHDTV_7_GOLD: |
| 930 | dev->dvb.frontend = dvb_attach(s5h1411_attach, |
| 931 | &dvico_fusionhdtv7_config, |
Mauro Carvalho Chehab | 0590d91 | 2008-04-30 18:14:36 -0300 | [diff] [blame] | 932 | &core->i2c_adap); |
Steven Toth | d893d5d | 2008-04-25 03:46:43 -0300 | [diff] [blame] | 933 | if (dev->dvb.frontend != NULL) { |
Mauro Carvalho Chehab | 0590d91 | 2008-04-30 18:14:36 -0300 | [diff] [blame] | 934 | if (!dvb_attach(xc5000_attach, dev->dvb.frontend, |
| 935 | &core->i2c_adap, |
Michael Krufky | 3065096 | 2008-09-06 14:56:58 -0300 | [diff] [blame] | 936 | &dvico_fusionhdtv7_tuner_config)) |
Mauro Carvalho Chehab | 0590d91 | 2008-04-30 18:14:36 -0300 | [diff] [blame] | 937 | goto frontend_detach; |
Steven Toth | d893d5d | 2008-04-25 03:46:43 -0300 | [diff] [blame] | 938 | } |
| 939 | break; |
Steven Toth | 5bd1b66 | 2008-09-04 01:17:33 -0300 | [diff] [blame] | 940 | case CX88_BOARD_HAUPPAUGE_HVR4000: |
| 941 | case CX88_BOARD_HAUPPAUGE_HVR4000LITE: |
| 942 | /* Support for DVB-S only, not DVB-T support */ |
| 943 | dev->dvb.frontend = dvb_attach(cx24116_attach, |
| 944 | &hauppauge_hvr4000_config, |
| 945 | &dev->core->i2c_adap); |
| 946 | if (dev->dvb.frontend) { |
| 947 | dvb_attach(isl6421_attach, dev->dvb.frontend, |
| 948 | &dev->core->i2c_adap, |
Darron Broad | 7396d3e | 2008-09-14 10:45:58 -0300 | [diff] [blame^] | 949 | 0x08, ISL6421_DCL, 0x00); |
Steven Toth | 5bd1b66 | 2008-09-04 01:17:33 -0300 | [diff] [blame] | 950 | } |
| 951 | break; |
Igor M. Liplianin | af83262 | 2008-09-04 17:24:14 -0300 | [diff] [blame] | 952 | case CX88_BOARD_TEVII_S460: |
Steven Toth | 83fe92e | 2008-09-13 19:22:15 -0300 | [diff] [blame] | 953 | dev->dvb.frontend = dvb_attach(cx24116_attach, |
Igor M. Liplianin | af83262 | 2008-09-04 17:24:14 -0300 | [diff] [blame] | 954 | &tevii_s460_config, |
| 955 | &core->i2c_adap); |
| 956 | if (dev->dvb.frontend != NULL) { |
| 957 | core->prev_set_voltage = dev->dvb.frontend->ops.set_voltage; |
| 958 | dev->dvb.frontend->ops.set_voltage = tevii_dvbs_set_voltage; |
| 959 | } |
| 960 | break; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 961 | default: |
Trent Piepho | 5772f81 | 2007-08-15 14:41:59 -0300 | [diff] [blame] | 962 | printk(KERN_ERR "%s/2: The frontend of your DVB/ATSC card isn't supported yet\n", |
Mauro Carvalho Chehab | 0590d91 | 2008-04-30 18:14:36 -0300 | [diff] [blame] | 963 | core->name); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 964 | break; |
| 965 | } |
| 966 | if (NULL == dev->dvb.frontend) { |
Mauro Carvalho Chehab | 9507901 | 2008-04-22 14:45:15 -0300 | [diff] [blame] | 967 | printk(KERN_ERR |
| 968 | "%s/2: frontend initialization failed\n", |
Mauro Carvalho Chehab | 0590d91 | 2008-04-30 18:14:36 -0300 | [diff] [blame] | 969 | core->name); |
Mauro Carvalho Chehab | 23fb348 | 2008-04-22 14:45:30 -0300 | [diff] [blame] | 970 | return -EINVAL; |
Mauro Carvalho Chehab | 9507901 | 2008-04-22 14:45:15 -0300 | [diff] [blame] | 971 | } |
| 972 | |
Steven Toth | 6c5be74 | 2006-12-02 21:15:51 -0200 | [diff] [blame] | 973 | /* Ensure all frontends negotiate bus access */ |
| 974 | dev->dvb.frontend->ops.ts_bus_ctrl = cx88_dvb_bus_ctrl; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 975 | |
Mauro Carvalho Chehab | 93352f5 | 2005-09-13 01:25:42 -0700 | [diff] [blame] | 976 | /* Put the analog decoder in standby to keep it quiet */ |
Mauro Carvalho Chehab | 0590d91 | 2008-04-30 18:14:36 -0300 | [diff] [blame] | 977 | cx88_call_i2c_clients(core, TUNER_SET_STANDBY, NULL); |
Mauro Carvalho Chehab | 93352f5 | 2005-09-13 01:25:42 -0700 | [diff] [blame] | 978 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 979 | /* register everything */ |
Janne Grunau | 78e9200 | 2008-04-09 19:13:13 -0300 | [diff] [blame] | 980 | return videobuf_dvb_register(&dev->dvb, THIS_MODULE, dev, |
| 981 | &dev->pci->dev, adapter_nr); |
Mauro Carvalho Chehab | 0590d91 | 2008-04-30 18:14:36 -0300 | [diff] [blame] | 982 | |
| 983 | frontend_detach: |
| 984 | if (dev->dvb.frontend) { |
| 985 | dvb_frontend_detach(dev->dvb.frontend); |
| 986 | dev->dvb.frontend = NULL; |
| 987 | } |
| 988 | return -EINVAL; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 989 | } |
| 990 | |
| 991 | /* ----------------------------------------------------------- */ |
| 992 | |
Steven Toth | 6c5be74 | 2006-12-02 21:15:51 -0200 | [diff] [blame] | 993 | /* CX8802 MPEG -> mini driver - We have been given the hardware */ |
| 994 | static int cx8802_dvb_advise_acquire(struct cx8802_driver *drv) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 995 | { |
Steven Toth | 6c5be74 | 2006-12-02 21:15:51 -0200 | [diff] [blame] | 996 | struct cx88_core *core = drv->core; |
| 997 | int err = 0; |
Harvey Harrison | 32d83ef | 2008-04-08 23:20:00 -0300 | [diff] [blame] | 998 | dprintk( 1, "%s\n", __func__); |
Steven Toth | 6c5be74 | 2006-12-02 21:15:51 -0200 | [diff] [blame] | 999 | |
Trent Piepho | 6a59d64 | 2007-08-15 14:41:57 -0300 | [diff] [blame] | 1000 | switch (core->boardnr) { |
Steven Toth | 6c5be74 | 2006-12-02 21:15:51 -0200 | [diff] [blame] | 1001 | case CX88_BOARD_HAUPPAUGE_HVR1300: |
| 1002 | /* We arrive here with either the cx23416 or the cx22702 |
| 1003 | * on the bus. Take the bus from the cx23416 and enable the |
| 1004 | * cx22702 demod |
| 1005 | */ |
| 1006 | cx_set(MO_GP0_IO, 0x00000080); /* cx22702 out of reset and enable */ |
| 1007 | cx_clear(MO_GP0_IO, 0x00000004); |
| 1008 | udelay(1000); |
| 1009 | break; |
| 1010 | default: |
| 1011 | err = -ENODEV; |
| 1012 | } |
| 1013 | return err; |
| 1014 | } |
| 1015 | |
| 1016 | /* CX8802 MPEG -> mini driver - We no longer have the hardware */ |
| 1017 | static int cx8802_dvb_advise_release(struct cx8802_driver *drv) |
| 1018 | { |
| 1019 | struct cx88_core *core = drv->core; |
| 1020 | int err = 0; |
Harvey Harrison | 32d83ef | 2008-04-08 23:20:00 -0300 | [diff] [blame] | 1021 | dprintk( 1, "%s\n", __func__); |
Steven Toth | 6c5be74 | 2006-12-02 21:15:51 -0200 | [diff] [blame] | 1022 | |
Trent Piepho | 6a59d64 | 2007-08-15 14:41:57 -0300 | [diff] [blame] | 1023 | switch (core->boardnr) { |
Steven Toth | 6c5be74 | 2006-12-02 21:15:51 -0200 | [diff] [blame] | 1024 | case CX88_BOARD_HAUPPAUGE_HVR1300: |
| 1025 | /* Do Nothing, leave the cx22702 on the bus. */ |
| 1026 | break; |
| 1027 | default: |
| 1028 | err = -ENODEV; |
| 1029 | } |
| 1030 | return err; |
| 1031 | } |
| 1032 | |
| 1033 | static int cx8802_dvb_probe(struct cx8802_driver *drv) |
| 1034 | { |
| 1035 | struct cx88_core *core = drv->core; |
| 1036 | struct cx8802_dev *dev = drv->core->dvbdev; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1037 | int err; |
| 1038 | |
Harvey Harrison | 32d83ef | 2008-04-08 23:20:00 -0300 | [diff] [blame] | 1039 | dprintk( 1, "%s\n", __func__); |
Steven Toth | 6c5be74 | 2006-12-02 21:15:51 -0200 | [diff] [blame] | 1040 | dprintk( 1, " ->being probed by Card=%d Name=%s, PCI %02x:%02x\n", |
Trent Piepho | 6a59d64 | 2007-08-15 14:41:57 -0300 | [diff] [blame] | 1041 | core->boardnr, |
Steven Toth | 6c5be74 | 2006-12-02 21:15:51 -0200 | [diff] [blame] | 1042 | core->name, |
| 1043 | core->pci_bus, |
| 1044 | core->pci_slot); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1045 | |
| 1046 | err = -ENODEV; |
Trent Piepho | 6a59d64 | 2007-08-15 14:41:57 -0300 | [diff] [blame] | 1047 | if (!(core->board.mpeg & CX88_MPEG_DVB)) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1048 | goto fail_core; |
| 1049 | |
Trent Piepho | ecf854d | 2007-05-05 20:11:32 -0300 | [diff] [blame] | 1050 | /* If vp3054 isn't enabled, a stub will just return 0 */ |
Chris Pascoe | fc40b26 | 2006-01-09 15:25:35 -0200 | [diff] [blame] | 1051 | err = vp3054_i2c_probe(dev); |
| 1052 | if (0 != err) |
Steven Toth | 6c5be74 | 2006-12-02 21:15:51 -0200 | [diff] [blame] | 1053 | goto fail_core; |
Chris Pascoe | fc40b26 | 2006-01-09 15:25:35 -0200 | [diff] [blame] | 1054 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1055 | /* dvb stuff */ |
Trent Piepho | 5772f81 | 2007-08-15 14:41:59 -0300 | [diff] [blame] | 1056 | printk(KERN_INFO "%s/2: cx2388x based DVB/ATSC card\n", core->name); |
Guennadi Liakhovetski | 0705135 | 2008-04-22 14:42:13 -0300 | [diff] [blame] | 1057 | videobuf_queue_sg_init(&dev->dvb.dvbq, &dvb_qops, |
| 1058 | &dev->pci->dev, &dev->slock, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1059 | V4L2_BUF_TYPE_VIDEO_CAPTURE, |
| 1060 | V4L2_FIELD_TOP, |
| 1061 | sizeof(struct cx88_buffer), |
| 1062 | dev); |
| 1063 | err = dvb_register(dev); |
Steven Toth | 6c5be74 | 2006-12-02 21:15:51 -0200 | [diff] [blame] | 1064 | if (err != 0) |
Trent Piepho | 5772f81 | 2007-08-15 14:41:59 -0300 | [diff] [blame] | 1065 | printk(KERN_ERR "%s/2: dvb_register failed (err = %d)\n", |
| 1066 | core->name, err); |
Steven Toth | 611900c | 2006-01-09 15:25:12 -0200 | [diff] [blame] | 1067 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1068 | fail_core: |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1069 | return err; |
| 1070 | } |
| 1071 | |
Steven Toth | 6c5be74 | 2006-12-02 21:15:51 -0200 | [diff] [blame] | 1072 | static int cx8802_dvb_remove(struct cx8802_driver *drv) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1073 | { |
Steven Toth | 6c5be74 | 2006-12-02 21:15:51 -0200 | [diff] [blame] | 1074 | struct cx8802_dev *dev = drv->core->dvbdev; |
Steven Toth | 611900c | 2006-01-09 15:25:12 -0200 | [diff] [blame] | 1075 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1076 | /* dvb */ |
Mauro Carvalho Chehab | 9950c1b | 2008-04-11 11:29:44 -0300 | [diff] [blame] | 1077 | if (dev->dvb.frontend) |
| 1078 | videobuf_dvb_unregister(&dev->dvb); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1079 | |
Chris Pascoe | fc40b26 | 2006-01-09 15:25:35 -0200 | [diff] [blame] | 1080 | vp3054_i2c_remove(dev); |
Chris Pascoe | fc40b26 | 2006-01-09 15:25:35 -0200 | [diff] [blame] | 1081 | |
Steven Toth | 6c5be74 | 2006-12-02 21:15:51 -0200 | [diff] [blame] | 1082 | return 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1083 | } |
| 1084 | |
Steven Toth | 6c5be74 | 2006-12-02 21:15:51 -0200 | [diff] [blame] | 1085 | static struct cx8802_driver cx8802_dvb_driver = { |
| 1086 | .type_id = CX88_MPEG_DVB, |
| 1087 | .hw_access = CX8802_DRVCTL_SHARED, |
| 1088 | .probe = cx8802_dvb_probe, |
| 1089 | .remove = cx8802_dvb_remove, |
| 1090 | .advise_acquire = cx8802_dvb_advise_acquire, |
| 1091 | .advise_release = cx8802_dvb_advise_release, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1092 | }; |
| 1093 | |
| 1094 | static int dvb_init(void) |
| 1095 | { |
Trent Piepho | 5772f81 | 2007-08-15 14:41:59 -0300 | [diff] [blame] | 1096 | printk(KERN_INFO "cx88/2: cx2388x dvb driver version %d.%d.%d loaded\n", |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1097 | (CX88_VERSION_CODE >> 16) & 0xff, |
| 1098 | (CX88_VERSION_CODE >> 8) & 0xff, |
| 1099 | CX88_VERSION_CODE & 0xff); |
| 1100 | #ifdef SNAPSHOT |
| 1101 | printk(KERN_INFO "cx2388x: snapshot date %04d-%02d-%02d\n", |
| 1102 | SNAPSHOT/10000, (SNAPSHOT/100)%100, SNAPSHOT%100); |
| 1103 | #endif |
Steven Toth | 6c5be74 | 2006-12-02 21:15:51 -0200 | [diff] [blame] | 1104 | return cx8802_register_driver(&cx8802_dvb_driver); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1105 | } |
| 1106 | |
| 1107 | static void dvb_fini(void) |
| 1108 | { |
Steven Toth | 6c5be74 | 2006-12-02 21:15:51 -0200 | [diff] [blame] | 1109 | cx8802_unregister_driver(&cx8802_dvb_driver); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1110 | } |
| 1111 | |
| 1112 | module_init(dvb_init); |
| 1113 | module_exit(dvb_fini); |
| 1114 | |
| 1115 | /* |
| 1116 | * Local variables: |
| 1117 | * c-basic-offset: 8 |
| 1118 | * compile-command: "make DVB=1" |
| 1119 | * End: |
| 1120 | */ |