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