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