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" |
Andrew de Quincey | 1f10c7a | 2006-08-08 09:10:09 -0300 | [diff] [blame] | 43 | #include "nxt200x.h" |
| 44 | #include "cx24123.h" |
Andrew de Quincey | cd20ca9 | 2006-05-12 20:31:51 -0300 | [diff] [blame] | 45 | #include "isl6421.h" |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 46 | |
| 47 | MODULE_DESCRIPTION("driver for cx2388x based DVB cards"); |
| 48 | MODULE_AUTHOR("Chris Pascoe <c.pascoe@itee.uq.edu.au>"); |
| 49 | MODULE_AUTHOR("Gerd Knorr <kraxel@bytesex.org> [SuSE Labs]"); |
| 50 | MODULE_LICENSE("GPL"); |
| 51 | |
| 52 | static unsigned int debug = 0; |
| 53 | module_param(debug, int, 0644); |
| 54 | MODULE_PARM_DESC(debug,"enable debug messages [dvb]"); |
| 55 | |
| 56 | #define dprintk(level,fmt, arg...) if (debug >= level) \ |
Steven Toth | 6c5be74 | 2006-12-02 21:15:51 -0200 | [diff] [blame] | 57 | printk(KERN_DEBUG "%s/2-dvb: " fmt, core->name, ## arg) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 58 | |
| 59 | /* ------------------------------------------------------------------ */ |
| 60 | |
| 61 | static int dvb_buf_setup(struct videobuf_queue *q, |
| 62 | unsigned int *count, unsigned int *size) |
| 63 | { |
| 64 | struct cx8802_dev *dev = q->priv_data; |
| 65 | |
| 66 | dev->ts_packet_size = 188 * 4; |
| 67 | dev->ts_packet_count = 32; |
| 68 | |
| 69 | *size = dev->ts_packet_size * dev->ts_packet_count; |
| 70 | *count = 32; |
| 71 | return 0; |
| 72 | } |
| 73 | |
Michael Krufky | 4a39055 | 2006-12-05 02:00:53 -0300 | [diff] [blame] | 74 | static int dvb_buf_prepare(struct videobuf_queue *q, |
| 75 | struct videobuf_buffer *vb, enum v4l2_field field) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 76 | { |
| 77 | struct cx8802_dev *dev = q->priv_data; |
Mauro Carvalho Chehab | c7b0ac0 | 2006-03-10 12:29:15 -0300 | [diff] [blame] | 78 | return cx8802_buf_prepare(q, dev, (struct cx88_buffer*)vb,field); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 79 | } |
| 80 | |
| 81 | static void dvb_buf_queue(struct videobuf_queue *q, struct videobuf_buffer *vb) |
| 82 | { |
| 83 | struct cx8802_dev *dev = q->priv_data; |
| 84 | cx8802_buf_queue(dev, (struct cx88_buffer*)vb); |
| 85 | } |
| 86 | |
Michael Krufky | 4a39055 | 2006-12-05 02:00:53 -0300 | [diff] [blame] | 87 | static void dvb_buf_release(struct videobuf_queue *q, |
| 88 | struct videobuf_buffer *vb) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 89 | { |
Mauro Carvalho Chehab | c7b0ac0 | 2006-03-10 12:29:15 -0300 | [diff] [blame] | 90 | cx88_free_buffer(q, (struct cx88_buffer*)vb); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 91 | } |
| 92 | |
Adrian Bunk | 408b664 | 2005-05-01 08:59:29 -0700 | [diff] [blame] | 93 | static struct videobuf_queue_ops dvb_qops = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 94 | .buf_setup = dvb_buf_setup, |
| 95 | .buf_prepare = dvb_buf_prepare, |
| 96 | .buf_queue = dvb_buf_queue, |
| 97 | .buf_release = dvb_buf_release, |
| 98 | }; |
| 99 | |
| 100 | /* ------------------------------------------------------------------ */ |
Michael Krufky | 22f3f17 | 2006-12-05 01:38:58 -0300 | [diff] [blame] | 101 | |
| 102 | static int cx88_dvb_bus_ctrl(struct dvb_frontend* fe, int acquire) |
| 103 | { |
| 104 | struct cx8802_dev *dev= fe->dvb->priv; |
| 105 | struct cx8802_driver *drv = NULL; |
| 106 | int ret = 0; |
| 107 | |
| 108 | drv = cx8802_get_driver(dev, CX88_MPEG_DVB); |
| 109 | if (drv) { |
Michael Krufky | 4a39055 | 2006-12-05 02:00:53 -0300 | [diff] [blame] | 110 | if (acquire) |
Michael Krufky | 22f3f17 | 2006-12-05 01:38:58 -0300 | [diff] [blame] | 111 | ret = drv->request_acquire(drv); |
| 112 | else |
| 113 | ret = drv->request_release(drv); |
| 114 | } |
| 115 | |
| 116 | return ret; |
| 117 | } |
| 118 | |
| 119 | /* ------------------------------------------------------------------ */ |
| 120 | |
Chris Pascoe | 3d7d027 | 2006-01-09 18:21:31 -0200 | [diff] [blame] | 121 | static int dvico_fusionhdtv_demod_init(struct dvb_frontend* fe) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 122 | { |
| 123 | static u8 clock_config [] = { CLOCK_CTL, 0x38, 0x39 }; |
| 124 | static u8 reset [] = { RESET, 0x80 }; |
| 125 | static u8 adc_ctl_1_cfg [] = { ADC_CTL_1, 0x40 }; |
| 126 | static u8 agc_cfg [] = { AGC_TARGET, 0x24, 0x20 }; |
| 127 | static u8 gpp_ctl_cfg [] = { GPP_CTL, 0x33 }; |
| 128 | static u8 capt_range_cfg[] = { CAPT_RANGE, 0x32 }; |
| 129 | |
| 130 | mt352_write(fe, clock_config, sizeof(clock_config)); |
| 131 | udelay(200); |
| 132 | mt352_write(fe, reset, sizeof(reset)); |
| 133 | mt352_write(fe, adc_ctl_1_cfg, sizeof(adc_ctl_1_cfg)); |
| 134 | |
| 135 | mt352_write(fe, agc_cfg, sizeof(agc_cfg)); |
| 136 | mt352_write(fe, gpp_ctl_cfg, sizeof(gpp_ctl_cfg)); |
| 137 | mt352_write(fe, capt_range_cfg, sizeof(capt_range_cfg)); |
| 138 | return 0; |
| 139 | } |
| 140 | |
Chris Pascoe | 43eabb4 | 2006-01-09 18:21:28 -0200 | [diff] [blame] | 141 | static int dvico_dual_demod_init(struct dvb_frontend *fe) |
| 142 | { |
| 143 | static u8 clock_config [] = { CLOCK_CTL, 0x38, 0x38 }; |
| 144 | static u8 reset [] = { RESET, 0x80 }; |
| 145 | static u8 adc_ctl_1_cfg [] = { ADC_CTL_1, 0x40 }; |
| 146 | static u8 agc_cfg [] = { AGC_TARGET, 0x28, 0x20 }; |
| 147 | static u8 gpp_ctl_cfg [] = { GPP_CTL, 0x33 }; |
| 148 | static u8 capt_range_cfg[] = { CAPT_RANGE, 0x32 }; |
| 149 | |
| 150 | mt352_write(fe, clock_config, sizeof(clock_config)); |
| 151 | udelay(200); |
| 152 | mt352_write(fe, reset, sizeof(reset)); |
| 153 | mt352_write(fe, adc_ctl_1_cfg, sizeof(adc_ctl_1_cfg)); |
| 154 | |
| 155 | mt352_write(fe, agc_cfg, sizeof(agc_cfg)); |
| 156 | mt352_write(fe, gpp_ctl_cfg, sizeof(gpp_ctl_cfg)); |
| 157 | mt352_write(fe, capt_range_cfg, sizeof(capt_range_cfg)); |
| 158 | |
| 159 | return 0; |
| 160 | } |
| 161 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 162 | static int dntv_live_dvbt_demod_init(struct dvb_frontend* fe) |
| 163 | { |
| 164 | static u8 clock_config [] = { 0x89, 0x38, 0x39 }; |
| 165 | static u8 reset [] = { 0x50, 0x80 }; |
| 166 | static u8 adc_ctl_1_cfg [] = { 0x8E, 0x40 }; |
| 167 | static u8 agc_cfg [] = { 0x67, 0x10, 0x23, 0x00, 0xFF, 0xFF, |
Mauro Carvalho Chehab | f2421ca | 2005-11-08 21:37:45 -0800 | [diff] [blame] | 168 | 0x00, 0xFF, 0x00, 0x40, 0x40 }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 169 | static u8 dntv_extra[] = { 0xB5, 0x7A }; |
| 170 | static u8 capt_range_cfg[] = { 0x75, 0x32 }; |
| 171 | |
| 172 | mt352_write(fe, clock_config, sizeof(clock_config)); |
| 173 | udelay(2000); |
| 174 | mt352_write(fe, reset, sizeof(reset)); |
| 175 | mt352_write(fe, adc_ctl_1_cfg, sizeof(adc_ctl_1_cfg)); |
| 176 | |
| 177 | mt352_write(fe, agc_cfg, sizeof(agc_cfg)); |
| 178 | udelay(2000); |
| 179 | mt352_write(fe, dntv_extra, sizeof(dntv_extra)); |
| 180 | mt352_write(fe, capt_range_cfg, sizeof(capt_range_cfg)); |
| 181 | |
| 182 | return 0; |
| 183 | } |
| 184 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 185 | static struct mt352_config dvico_fusionhdtv = { |
Michael Krufky | f7b54b1 | 2006-08-08 15:48:08 -0300 | [diff] [blame] | 186 | .demod_address = 0x0f, |
Chris Pascoe | 3d7d027 | 2006-01-09 18:21:31 -0200 | [diff] [blame] | 187 | .demod_init = dvico_fusionhdtv_demod_init, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 188 | }; |
| 189 | |
| 190 | static struct mt352_config dntv_live_dvbt_config = { |
| 191 | .demod_address = 0x0f, |
| 192 | .demod_init = dntv_live_dvbt_demod_init, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 193 | }; |
Chris Pascoe | fc40b26 | 2006-01-09 15:25:35 -0200 | [diff] [blame] | 194 | |
Chris Pascoe | 43eabb4 | 2006-01-09 18:21:28 -0200 | [diff] [blame] | 195 | static struct mt352_config dvico_fusionhdtv_dual = { |
Michael Krufky | f7b54b1 | 2006-08-08 15:48:08 -0300 | [diff] [blame] | 196 | .demod_address = 0x0f, |
Chris Pascoe | 43eabb4 | 2006-01-09 18:21:28 -0200 | [diff] [blame] | 197 | .demod_init = dvico_dual_demod_init, |
Chris Pascoe | 43eabb4 | 2006-01-09 18:21:28 -0200 | [diff] [blame] | 198 | }; |
| 199 | |
Trent Piepho | ecf854d | 2007-05-05 20:11:32 -0300 | [diff] [blame] | 200 | #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] | 201 | static int dntv_live_dvbt_pro_demod_init(struct dvb_frontend* fe) |
| 202 | { |
| 203 | static u8 clock_config [] = { 0x89, 0x38, 0x38 }; |
| 204 | static u8 reset [] = { 0x50, 0x80 }; |
| 205 | static u8 adc_ctl_1_cfg [] = { 0x8E, 0x40 }; |
| 206 | static u8 agc_cfg [] = { 0x67, 0x10, 0x20, 0x00, 0xFF, 0xFF, |
| 207 | 0x00, 0xFF, 0x00, 0x40, 0x40 }; |
| 208 | static u8 dntv_extra[] = { 0xB5, 0x7A }; |
| 209 | static u8 capt_range_cfg[] = { 0x75, 0x32 }; |
| 210 | |
| 211 | mt352_write(fe, clock_config, sizeof(clock_config)); |
| 212 | udelay(2000); |
| 213 | mt352_write(fe, reset, sizeof(reset)); |
| 214 | mt352_write(fe, adc_ctl_1_cfg, sizeof(adc_ctl_1_cfg)); |
| 215 | |
| 216 | mt352_write(fe, agc_cfg, sizeof(agc_cfg)); |
| 217 | udelay(2000); |
| 218 | mt352_write(fe, dntv_extra, sizeof(dntv_extra)); |
| 219 | mt352_write(fe, capt_range_cfg, sizeof(capt_range_cfg)); |
| 220 | |
| 221 | return 0; |
| 222 | } |
| 223 | |
Chris Pascoe | fc40b26 | 2006-01-09 15:25:35 -0200 | [diff] [blame] | 224 | static struct mt352_config dntv_live_dvbt_pro_config = { |
| 225 | .demod_address = 0x0f, |
| 226 | .no_tuner = 1, |
Chris Pascoe | 3d7d027 | 2006-01-09 18:21:31 -0200 | [diff] [blame] | 227 | .demod_init = dntv_live_dvbt_pro_demod_init, |
Chris Pascoe | fc40b26 | 2006-01-09 15:25:35 -0200 | [diff] [blame] | 228 | }; |
| 229 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 230 | |
Chris Pascoe | 780dfef | 2006-02-28 08:34:59 -0300 | [diff] [blame] | 231 | static struct zl10353_config dvico_fusionhdtv_hybrid = { |
Michael Krufky | f7b54b1 | 2006-08-08 15:48:08 -0300 | [diff] [blame] | 232 | .demod_address = 0x0f, |
Andrew de Quincey | f54376e | 2006-04-18 17:56:10 -0300 | [diff] [blame] | 233 | .no_tuner = 1, |
Chris Pascoe | 780dfef | 2006-02-28 08:34:59 -0300 | [diff] [blame] | 234 | }; |
| 235 | |
| 236 | static struct zl10353_config dvico_fusionhdtv_plus_v1_1 = { |
Michael Krufky | f7b54b1 | 2006-08-08 15:48:08 -0300 | [diff] [blame] | 237 | .demod_address = 0x0f, |
Chris Pascoe | 780dfef | 2006-02-28 08:34:59 -0300 | [diff] [blame] | 238 | }; |
Chris Pascoe | 780dfef | 2006-02-28 08:34:59 -0300 | [diff] [blame] | 239 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 240 | static struct cx22702_config connexant_refboard_config = { |
| 241 | .demod_address = 0x43, |
Patrick Boettcher | 38d84c3 | 2005-07-15 12:20:26 -0700 | [diff] [blame] | 242 | .output_mode = CX22702_SERIAL_OUTPUT, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 243 | }; |
| 244 | |
Michael Krufky | ed35526 | 2006-12-05 01:34:56 -0300 | [diff] [blame] | 245 | static struct cx22702_config hauppauge_hvr_config = { |
Steven Toth | aa481a6 | 2006-09-14 15:41:13 -0300 | [diff] [blame] | 246 | .demod_address = 0x63, |
| 247 | .output_mode = CX22702_SERIAL_OUTPUT, |
| 248 | }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 249 | |
Michael Krufky | 4a39055 | 2006-12-05 02:00:53 -0300 | [diff] [blame] | 250 | 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] | 251 | { |
| 252 | struct cx8802_dev *dev= fe->dvb->priv; |
| 253 | dev->ts_gen_cntrl = is_punctured ? 0x04 : 0x00; |
| 254 | return 0; |
| 255 | } |
| 256 | |
Adrian Bunk | 408b664 | 2005-05-01 08:59:29 -0700 | [diff] [blame] | 257 | static struct or51132_config pchdtv_hd3000 = { |
Michael Krufky | f7b54b1 | 2006-08-08 15:48:08 -0300 | [diff] [blame] | 258 | .demod_address = 0x15, |
| 259 | .set_ts_params = or51132_set_ts_param, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 260 | }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 261 | |
Michael Krufky | 6ddcc91 | 2005-07-27 11:46:00 -0700 | [diff] [blame] | 262 | static int lgdt330x_pll_rf_set(struct dvb_frontend* fe, int index) |
Michael Krufky | 0ccef6d | 2005-07-27 11:45:55 -0700 | [diff] [blame] | 263 | { |
| 264 | struct cx8802_dev *dev= fe->dvb->priv; |
| 265 | struct cx88_core *core = dev->core; |
| 266 | |
| 267 | dprintk(1, "%s: index = %d\n", __FUNCTION__, index); |
| 268 | if (index == 0) |
| 269 | cx_clear(MO_GP0_IO, 8); |
| 270 | else |
| 271 | cx_set(MO_GP0_IO, 8); |
| 272 | return 0; |
| 273 | } |
| 274 | |
Michael Krufky | 6ddcc91 | 2005-07-27 11:46:00 -0700 | [diff] [blame] | 275 | 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] | 276 | { |
| 277 | struct cx8802_dev *dev= fe->dvb->priv; |
| 278 | if (is_punctured) |
| 279 | dev->ts_gen_cntrl |= 0x04; |
| 280 | else |
| 281 | dev->ts_gen_cntrl &= ~0x04; |
| 282 | return 0; |
| 283 | } |
| 284 | |
Michael Krufky | 6ddcc91 | 2005-07-27 11:46:00 -0700 | [diff] [blame] | 285 | static struct lgdt330x_config fusionhdtv_3_gold = { |
Michael Krufky | f7b54b1 | 2006-08-08 15:48:08 -0300 | [diff] [blame] | 286 | .demod_address = 0x0e, |
| 287 | .demod_chip = LGDT3302, |
| 288 | .serial_mpeg = 0x04, /* TPSERIAL for 3302 in TOP_CONTROL */ |
| 289 | .set_ts_params = lgdt330x_set_ts_param, |
Michael Krufky | 0d723c0 | 2005-07-07 17:58:42 -0700 | [diff] [blame] | 290 | }; |
Mauro Carvalho Chehab | e52e98a | 2005-09-09 13:03:41 -0700 | [diff] [blame] | 291 | |
| 292 | static struct lgdt330x_config fusionhdtv_5_gold = { |
Michael Krufky | f7b54b1 | 2006-08-08 15:48:08 -0300 | [diff] [blame] | 293 | .demod_address = 0x0e, |
| 294 | .demod_chip = LGDT3303, |
| 295 | .serial_mpeg = 0x40, /* TPSERIAL for 3303 in TOP_CONTROL */ |
| 296 | .set_ts_params = lgdt330x_set_ts_param, |
Mauro Carvalho Chehab | e52e98a | 2005-09-09 13:03:41 -0700 | [diff] [blame] | 297 | }; |
Rusty Scott | da215d2 | 2006-04-07 02:21:31 -0300 | [diff] [blame] | 298 | |
| 299 | static struct lgdt330x_config pchdtv_hd5500 = { |
Michael Krufky | f7b54b1 | 2006-08-08 15:48:08 -0300 | [diff] [blame] | 300 | .demod_address = 0x59, |
| 301 | .demod_chip = LGDT3303, |
| 302 | .serial_mpeg = 0x40, /* TPSERIAL for 3303 in TOP_CONTROL */ |
| 303 | .set_ts_params = lgdt330x_set_ts_param, |
Rusty Scott | da215d2 | 2006-04-07 02:21:31 -0300 | [diff] [blame] | 304 | }; |
Michael Krufky | f179849 | 2005-07-07 17:58:39 -0700 | [diff] [blame] | 305 | |
Michael Krufky | 4a39055 | 2006-12-05 02:00:53 -0300 | [diff] [blame] | 306 | 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] | 307 | { |
| 308 | struct cx8802_dev *dev= fe->dvb->priv; |
| 309 | dev->ts_gen_cntrl = is_punctured ? 0x04 : 0x00; |
| 310 | return 0; |
| 311 | } |
| 312 | |
| 313 | static struct nxt200x_config ati_hdtvwonder = { |
Michael Krufky | f7b54b1 | 2006-08-08 15:48:08 -0300 | [diff] [blame] | 314 | .demod_address = 0x0a, |
Michael Krufky | f7b54b1 | 2006-08-08 15:48:08 -0300 | [diff] [blame] | 315 | .set_ts_params = nxt200x_set_ts_param, |
Kirk Lapray | fde6d31 | 2005-11-08 21:38:18 -0800 | [diff] [blame] | 316 | }; |
Kirk Lapray | fde6d31 | 2005-11-08 21:38:18 -0800 | [diff] [blame] | 317 | |
Steven Toth | 0fa14aa | 2006-01-09 15:25:02 -0200 | [diff] [blame] | 318 | static int cx24123_set_ts_param(struct dvb_frontend* fe, |
| 319 | int is_punctured) |
| 320 | { |
| 321 | struct cx8802_dev *dev= fe->dvb->priv; |
Michael Krufky | f7b54b1 | 2006-08-08 15:48:08 -0300 | [diff] [blame] | 322 | dev->ts_gen_cntrl = 0x02; |
Steven Toth | 0fa14aa | 2006-01-09 15:25:02 -0200 | [diff] [blame] | 323 | return 0; |
| 324 | } |
| 325 | |
Michael Krufky | f7b54b1 | 2006-08-08 15:48:08 -0300 | [diff] [blame] | 326 | static int kworld_dvbs_100_set_voltage(struct dvb_frontend* fe, |
| 327 | fe_sec_voltage_t voltage) |
Vadim Catana | 0e0351e | 2006-01-09 15:25:02 -0200 | [diff] [blame] | 328 | { |
| 329 | struct cx8802_dev *dev= fe->dvb->priv; |
| 330 | struct cx88_core *core = dev->core; |
| 331 | |
Michael Krufky | 4a39055 | 2006-12-05 02:00:53 -0300 | [diff] [blame] | 332 | if (voltage == SEC_VOLTAGE_OFF) |
Michael Krufky | f7b54b1 | 2006-08-08 15:48:08 -0300 | [diff] [blame] | 333 | cx_write(MO_GP0_IO, 0x000006fb); |
Michael Krufky | 4a39055 | 2006-12-05 02:00:53 -0300 | [diff] [blame] | 334 | else |
Andrew de Quincey | cd20ca9 | 2006-05-12 20:31:51 -0300 | [diff] [blame] | 335 | cx_write(MO_GP0_IO, 0x000006f9); |
Andrew de Quincey | cd20ca9 | 2006-05-12 20:31:51 -0300 | [diff] [blame] | 336 | |
| 337 | if (core->prev_set_voltage) |
| 338 | return core->prev_set_voltage(fe, voltage); |
| 339 | return 0; |
Vadim Catana | 0e0351e | 2006-01-09 15:25:02 -0200 | [diff] [blame] | 340 | } |
| 341 | |
Michael Krufky | f7b54b1 | 2006-08-08 15:48:08 -0300 | [diff] [blame] | 342 | static int geniatech_dvbs_set_voltage(struct dvb_frontend *fe, |
| 343 | fe_sec_voltage_t voltage) |
Saqeb Akhter | c02a34f | 2006-06-29 20:29:33 -0300 | [diff] [blame] | 344 | { |
| 345 | struct cx8802_dev *dev= fe->dvb->priv; |
| 346 | struct cx88_core *core = dev->core; |
| 347 | |
| 348 | if (voltage == SEC_VOLTAGE_OFF) { |
| 349 | dprintk(1,"LNB Voltage OFF\n"); |
| 350 | cx_write(MO_GP0_IO, 0x0000efff); |
| 351 | } |
| 352 | |
| 353 | if (core->prev_set_voltage) |
| 354 | return core->prev_set_voltage(fe, voltage); |
| 355 | return 0; |
| 356 | } |
| 357 | |
| 358 | static struct cx24123_config geniatech_dvbs_config = { |
Michael Krufky | f7b54b1 | 2006-08-08 15:48:08 -0300 | [diff] [blame] | 359 | .demod_address = 0x55, |
| 360 | .set_ts_params = cx24123_set_ts_param, |
Saqeb Akhter | c02a34f | 2006-06-29 20:29:33 -0300 | [diff] [blame] | 361 | }; |
| 362 | |
Steven Toth | 0fa14aa | 2006-01-09 15:25:02 -0200 | [diff] [blame] | 363 | static struct cx24123_config hauppauge_novas_config = { |
Michael Krufky | f7b54b1 | 2006-08-08 15:48:08 -0300 | [diff] [blame] | 364 | .demod_address = 0x55, |
| 365 | .set_ts_params = cx24123_set_ts_param, |
Vadim Catana | 0e0351e | 2006-01-09 15:25:02 -0200 | [diff] [blame] | 366 | }; |
| 367 | |
| 368 | static struct cx24123_config kworld_dvbs_100_config = { |
Michael Krufky | f7b54b1 | 2006-08-08 15:48:08 -0300 | [diff] [blame] | 369 | .demod_address = 0x15, |
| 370 | .set_ts_params = cx24123_set_ts_param, |
Yeasah Pell | ef76856 | 2006-09-26 12:30:14 -0300 | [diff] [blame] | 371 | .lnb_polarity = 1, |
Steven Toth | 0fa14aa | 2006-01-09 15:25:02 -0200 | [diff] [blame] | 372 | }; |
Steven Toth | 0fa14aa | 2006-01-09 15:25:02 -0200 | [diff] [blame] | 373 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 374 | static int dvb_register(struct cx8802_dev *dev) |
| 375 | { |
| 376 | /* init struct videobuf_dvb */ |
| 377 | dev->dvb.name = dev->core->name; |
| 378 | dev->ts_gen_cntrl = 0x0c; |
| 379 | |
| 380 | /* init frontend */ |
| 381 | switch (dev->core->board) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 382 | case CX88_BOARD_HAUPPAUGE_DVB_T1: |
Michael Krufky | f7b54b1 | 2006-08-08 15:48:08 -0300 | [diff] [blame] | 383 | dev->dvb.frontend = dvb_attach(cx22702_attach, |
Michael Krufky | ed35526 | 2006-12-05 01:34:56 -0300 | [diff] [blame] | 384 | &connexant_refboard_config, |
Michael Krufky | f7b54b1 | 2006-08-08 15:48:08 -0300 | [diff] [blame] | 385 | &dev->core->i2c_adap); |
Andrew de Quincey | f54376e | 2006-04-18 17:56:10 -0300 | [diff] [blame] | 386 | if (dev->dvb.frontend != NULL) { |
Andrew de Quincey | 2bfe031 | 2006-08-08 09:10:08 -0300 | [diff] [blame] | 387 | dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x61, |
Michael Krufky | f7b54b1 | 2006-08-08 15:48:08 -0300 | [diff] [blame] | 388 | &dev->core->i2c_adap, |
| 389 | &dvb_pll_thomson_dtt759x); |
Andrew de Quincey | f54376e | 2006-04-18 17:56:10 -0300 | [diff] [blame] | 390 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 391 | break; |
Michael Krufky | e057ee1 | 2005-07-07 17:58:40 -0700 | [diff] [blame] | 392 | case CX88_BOARD_TERRATEC_CINERGY_1400_DVB_T1: |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 393 | case CX88_BOARD_CONEXANT_DVB_T1: |
Manenti Marco | f39624f | 2006-01-09 15:32:45 -0200 | [diff] [blame] | 394 | case CX88_BOARD_KWORLD_DVB_T_CX22702: |
David Shirley | 2b5200a | 2005-11-08 21:37:22 -0800 | [diff] [blame] | 395 | case CX88_BOARD_WINFAST_DTV1000: |
Michael Krufky | f7b54b1 | 2006-08-08 15:48:08 -0300 | [diff] [blame] | 396 | dev->dvb.frontend = dvb_attach(cx22702_attach, |
| 397 | &connexant_refboard_config, |
| 398 | &dev->core->i2c_adap); |
Andrew de Quincey | f54376e | 2006-04-18 17:56:10 -0300 | [diff] [blame] | 399 | if (dev->dvb.frontend != NULL) { |
Andrew de Quincey | 2bfe031 | 2006-08-08 09:10:08 -0300 | [diff] [blame] | 400 | dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x60, |
Michael Krufky | f7b54b1 | 2006-08-08 15:48:08 -0300 | [diff] [blame] | 401 | &dev->core->i2c_adap, |
| 402 | &dvb_pll_thomson_dtt7579); |
Andrew de Quincey | f54376e | 2006-04-18 17:56:10 -0300 | [diff] [blame] | 403 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 404 | break; |
Malcolm Valentine | 4bd6e9d | 2006-05-29 13:51:59 -0300 | [diff] [blame] | 405 | case CX88_BOARD_WINFAST_DTV2000H: |
Steven Toth | 611900c | 2006-01-09 15:25:12 -0200 | [diff] [blame] | 406 | case CX88_BOARD_HAUPPAUGE_HVR1100: |
| 407 | case CX88_BOARD_HAUPPAUGE_HVR1100LP: |
Trent Piepho | a5a2ecf | 2007-03-09 15:07:07 -0300 | [diff] [blame] | 408 | case CX88_BOARD_HAUPPAUGE_HVR1300: |
| 409 | case CX88_BOARD_HAUPPAUGE_HVR3000: |
Michael Krufky | f7b54b1 | 2006-08-08 15:48:08 -0300 | [diff] [blame] | 410 | dev->dvb.frontend = dvb_attach(cx22702_attach, |
Michael Krufky | ed35526 | 2006-12-05 01:34:56 -0300 | [diff] [blame] | 411 | &hauppauge_hvr_config, |
Michael Krufky | f7b54b1 | 2006-08-08 15:48:08 -0300 | [diff] [blame] | 412 | &dev->core->i2c_adap); |
Andrew de Quincey | f54376e | 2006-04-18 17:56:10 -0300 | [diff] [blame] | 413 | if (dev->dvb.frontend != NULL) { |
Andrew de Quincey | 2bfe031 | 2006-08-08 09:10:08 -0300 | [diff] [blame] | 414 | dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x61, |
Michael Krufky | 4a39055 | 2006-12-05 02:00:53 -0300 | [diff] [blame] | 415 | &dev->core->i2c_adap, &dvb_pll_fmd1216me); |
Andrew de Quincey | f54376e | 2006-04-18 17:56:10 -0300 | [diff] [blame] | 416 | } |
Steven Toth | 611900c | 2006-01-09 15:25:12 -0200 | [diff] [blame] | 417 | break; |
Chris Pascoe | 780dfef | 2006-02-28 08:34:59 -0300 | [diff] [blame] | 418 | case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_PLUS: |
Michael Krufky | f7b54b1 | 2006-08-08 15:48:08 -0300 | [diff] [blame] | 419 | dev->dvb.frontend = dvb_attach(mt352_attach, |
| 420 | &dvico_fusionhdtv, |
| 421 | &dev->core->i2c_adap); |
Andrew de Quincey | f54376e | 2006-04-18 17:56:10 -0300 | [diff] [blame] | 422 | if (dev->dvb.frontend != NULL) { |
Andrew de Quincey | 2bfe031 | 2006-08-08 09:10:08 -0300 | [diff] [blame] | 423 | dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x60, |
Chris Pascoe | c162dff | 2006-08-08 15:48:08 -0300 | [diff] [blame] | 424 | NULL, &dvb_pll_thomson_dtt7579); |
Chris Pascoe | 780dfef | 2006-02-28 08:34:59 -0300 | [diff] [blame] | 425 | break; |
Andrew de Quincey | f54376e | 2006-04-18 17:56:10 -0300 | [diff] [blame] | 426 | } |
Chris Pascoe | 780dfef | 2006-02-28 08:34:59 -0300 | [diff] [blame] | 427 | /* ZL10353 replaces MT352 on later cards */ |
Michael Krufky | f7b54b1 | 2006-08-08 15:48:08 -0300 | [diff] [blame] | 428 | dev->dvb.frontend = dvb_attach(zl10353_attach, |
| 429 | &dvico_fusionhdtv_plus_v1_1, |
| 430 | &dev->core->i2c_adap); |
Andrew de Quincey | f54376e | 2006-04-18 17:56:10 -0300 | [diff] [blame] | 431 | if (dev->dvb.frontend != NULL) { |
Andrew de Quincey | 2bfe031 | 2006-08-08 09:10:08 -0300 | [diff] [blame] | 432 | dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x60, |
Chris Pascoe | c162dff | 2006-08-08 15:48:08 -0300 | [diff] [blame] | 433 | NULL, &dvb_pll_thomson_dtt7579); |
Andrew de Quincey | f54376e | 2006-04-18 17:56:10 -0300 | [diff] [blame] | 434 | } |
Chris Pascoe | 780dfef | 2006-02-28 08:34:59 -0300 | [diff] [blame] | 435 | break; |
Michael Krufky | c2af3cd | 2006-06-12 14:06:22 -0300 | [diff] [blame] | 436 | case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_DUAL: |
Michael Krufky | c2af3cd | 2006-06-12 14:06:22 -0300 | [diff] [blame] | 437 | /* The tin box says DEE1601, but it seems to be DTT7579 |
| 438 | * compatible, with a slightly different MT352 AGC gain. */ |
Michael Krufky | f7b54b1 | 2006-08-08 15:48:08 -0300 | [diff] [blame] | 439 | dev->dvb.frontend = dvb_attach(mt352_attach, |
| 440 | &dvico_fusionhdtv_dual, |
| 441 | &dev->core->i2c_adap); |
Michael Krufky | c2af3cd | 2006-06-12 14:06:22 -0300 | [diff] [blame] | 442 | if (dev->dvb.frontend != NULL) { |
Andrew de Quincey | 2bfe031 | 2006-08-08 09:10:08 -0300 | [diff] [blame] | 443 | dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x61, |
Chris Pascoe | c162dff | 2006-08-08 15:48:08 -0300 | [diff] [blame] | 444 | NULL, &dvb_pll_thomson_dtt7579); |
Michael Krufky | c2af3cd | 2006-06-12 14:06:22 -0300 | [diff] [blame] | 445 | break; |
| 446 | } |
Michael Krufky | c2af3cd | 2006-06-12 14:06:22 -0300 | [diff] [blame] | 447 | /* ZL10353 replaces MT352 on later cards */ |
Michael Krufky | f7b54b1 | 2006-08-08 15:48:08 -0300 | [diff] [blame] | 448 | dev->dvb.frontend = dvb_attach(zl10353_attach, |
| 449 | &dvico_fusionhdtv_plus_v1_1, |
| 450 | &dev->core->i2c_adap); |
Michael Krufky | c2af3cd | 2006-06-12 14:06:22 -0300 | [diff] [blame] | 451 | if (dev->dvb.frontend != NULL) { |
Andrew de Quincey | 2bfe031 | 2006-08-08 09:10:08 -0300 | [diff] [blame] | 452 | dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x61, |
Chris Pascoe | c162dff | 2006-08-08 15:48:08 -0300 | [diff] [blame] | 453 | NULL, &dvb_pll_thomson_dtt7579); |
Michael Krufky | c2af3cd | 2006-06-12 14:06:22 -0300 | [diff] [blame] | 454 | } |
Michael Krufky | c2af3cd | 2006-06-12 14:06:22 -0300 | [diff] [blame] | 455 | break; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 456 | case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T1: |
Michael Krufky | f7b54b1 | 2006-08-08 15:48:08 -0300 | [diff] [blame] | 457 | dev->dvb.frontend = dvb_attach(mt352_attach, |
| 458 | &dvico_fusionhdtv, |
| 459 | &dev->core->i2c_adap); |
Andrew de Quincey | f54376e | 2006-04-18 17:56:10 -0300 | [diff] [blame] | 460 | if (dev->dvb.frontend != NULL) { |
Andrew de Quincey | 2bfe031 | 2006-08-08 09:10:08 -0300 | [diff] [blame] | 461 | dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x61, |
Chris Pascoe | c162dff | 2006-08-08 15:48:08 -0300 | [diff] [blame] | 462 | NULL, &dvb_pll_lg_z201); |
Andrew de Quincey | f54376e | 2006-04-18 17:56:10 -0300 | [diff] [blame] | 463 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 464 | break; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 465 | case CX88_BOARD_KWORLD_DVB_T: |
| 466 | case CX88_BOARD_DNTV_LIVE_DVB_T: |
Mauro Carvalho Chehab | a82decf | 2005-07-07 17:58:36 -0700 | [diff] [blame] | 467 | case CX88_BOARD_ADSTECH_DVB_T_PCI: |
Michael Krufky | f7b54b1 | 2006-08-08 15:48:08 -0300 | [diff] [blame] | 468 | dev->dvb.frontend = dvb_attach(mt352_attach, |
| 469 | &dntv_live_dvbt_config, |
| 470 | &dev->core->i2c_adap); |
Andrew de Quincey | f54376e | 2006-04-18 17:56:10 -0300 | [diff] [blame] | 471 | if (dev->dvb.frontend != NULL) { |
Andrew de Quincey | 2bfe031 | 2006-08-08 09:10:08 -0300 | [diff] [blame] | 472 | dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x61, |
Chris Pascoe | c162dff | 2006-08-08 15:48:08 -0300 | [diff] [blame] | 473 | NULL, &dvb_pll_unknown_1); |
Andrew de Quincey | f54376e | 2006-04-18 17:56:10 -0300 | [diff] [blame] | 474 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 475 | break; |
Chris Pascoe | fc40b26 | 2006-01-09 15:25:35 -0200 | [diff] [blame] | 476 | case CX88_BOARD_DNTV_LIVE_DVB_T_PRO: |
Trent Piepho | ecf854d | 2007-05-05 20:11:32 -0300 | [diff] [blame] | 477 | #if defined(CONFIG_VIDEO_CX88_VP3054) || (defined(CONFIG_VIDEO_CX88_VP3054_MODULE) && defined(MODULE)) |
Andrew de Quincey | 2bfe031 | 2006-08-08 09:10:08 -0300 | [diff] [blame] | 478 | dev->dvb.frontend = dvb_attach(mt352_attach, &dntv_live_dvbt_pro_config, |
Chris Pascoe | fc40b26 | 2006-01-09 15:25:35 -0200 | [diff] [blame] | 479 | &((struct vp3054_i2c_state *)dev->card_priv)->adap); |
Andrew de Quincey | f54376e | 2006-04-18 17:56:10 -0300 | [diff] [blame] | 480 | if (dev->dvb.frontend != NULL) { |
Trent Piepho | b7754d7 | 2007-05-08 18:05:16 -0300 | [diff] [blame^] | 481 | dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x61, |
| 482 | &dev->core->i2c_adap, &dvb_pll_fmd1216me); |
Andrew de Quincey | f54376e | 2006-04-18 17:56:10 -0300 | [diff] [blame] | 483 | } |
Chris Pascoe | fc40b26 | 2006-01-09 15:25:35 -0200 | [diff] [blame] | 484 | #else |
| 485 | printk("%s: built without vp3054 support\n", dev->core->name); |
| 486 | #endif |
| 487 | break; |
Chris Pascoe | 780dfef | 2006-02-28 08:34:59 -0300 | [diff] [blame] | 488 | case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_HYBRID: |
Michael Krufky | f7b54b1 | 2006-08-08 15:48:08 -0300 | [diff] [blame] | 489 | dev->dvb.frontend = dvb_attach(zl10353_attach, |
| 490 | &dvico_fusionhdtv_hybrid, |
| 491 | &dev->core->i2c_adap); |
Andrew de Quincey | f54376e | 2006-04-18 17:56:10 -0300 | [diff] [blame] | 492 | if (dev->dvb.frontend != NULL) { |
Michael Krufky | 5786a34 | 2006-12-05 01:21:19 -0300 | [diff] [blame] | 493 | dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x61, |
| 494 | &dev->core->i2c_adap, |
| 495 | &dvb_pll_thomson_fe6600); |
Andrew de Quincey | f54376e | 2006-04-18 17:56:10 -0300 | [diff] [blame] | 496 | } |
Chris Pascoe | 780dfef | 2006-02-28 08:34:59 -0300 | [diff] [blame] | 497 | break; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 498 | case CX88_BOARD_PCHDTV_HD3000: |
Michael Krufky | 4a39055 | 2006-12-05 02:00:53 -0300 | [diff] [blame] | 499 | dev->dvb.frontend = dvb_attach(or51132_attach, &pchdtv_hd3000, |
Michael Krufky | f7b54b1 | 2006-08-08 15:48:08 -0300 | [diff] [blame] | 500 | &dev->core->i2c_adap); |
Andrew de Quincey | f54376e | 2006-04-18 17:56:10 -0300 | [diff] [blame] | 501 | if (dev->dvb.frontend != NULL) { |
Andrew de Quincey | 2bfe031 | 2006-08-08 09:10:08 -0300 | [diff] [blame] | 502 | dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x61, |
Michael Krufky | f7b54b1 | 2006-08-08 15:48:08 -0300 | [diff] [blame] | 503 | &dev->core->i2c_adap, |
| 504 | &dvb_pll_thomson_dtt761x); |
Andrew de Quincey | f54376e | 2006-04-18 17:56:10 -0300 | [diff] [blame] | 505 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 506 | break; |
Michael Krufky | f179849 | 2005-07-07 17:58:39 -0700 | [diff] [blame] | 507 | case CX88_BOARD_DVICO_FUSIONHDTV_3_GOLD_Q: |
| 508 | dev->ts_gen_cntrl = 0x08; |
| 509 | { |
| 510 | /* Do a hardware reset of chip before using it. */ |
| 511 | struct cx88_core *core = dev->core; |
| 512 | |
| 513 | cx_clear(MO_GP0_IO, 1); |
| 514 | mdelay(100); |
Michael Krufky | 0ccef6d | 2005-07-27 11:45:55 -0700 | [diff] [blame] | 515 | cx_set(MO_GP0_IO, 1); |
Michael Krufky | f179849 | 2005-07-07 17:58:39 -0700 | [diff] [blame] | 516 | mdelay(200); |
Michael Krufky | 0ccef6d | 2005-07-27 11:45:55 -0700 | [diff] [blame] | 517 | |
| 518 | /* Select RF connector callback */ |
Michael Krufky | 6ddcc91 | 2005-07-27 11:46:00 -0700 | [diff] [blame] | 519 | fusionhdtv_3_gold.pll_rf_set = lgdt330x_pll_rf_set; |
Michael Krufky | f7b54b1 | 2006-08-08 15:48:08 -0300 | [diff] [blame] | 520 | dev->dvb.frontend = dvb_attach(lgdt330x_attach, |
| 521 | &fusionhdtv_3_gold, |
| 522 | &dev->core->i2c_adap); |
Andrew de Quincey | f54376e | 2006-04-18 17:56:10 -0300 | [diff] [blame] | 523 | if (dev->dvb.frontend != NULL) { |
Michael Krufky | 1d4bb7d | 2006-12-05 01:01:39 -0300 | [diff] [blame] | 524 | dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x61, |
| 525 | &dev->core->i2c_adap, |
| 526 | &dvb_pll_microtune_4042); |
Andrew de Quincey | f54376e | 2006-04-18 17:56:10 -0300 | [diff] [blame] | 527 | } |
Michael Krufky | f179849 | 2005-07-07 17:58:39 -0700 | [diff] [blame] | 528 | } |
| 529 | break; |
Michael Krufky | 0d723c0 | 2005-07-07 17:58:42 -0700 | [diff] [blame] | 530 | case CX88_BOARD_DVICO_FUSIONHDTV_3_GOLD_T: |
| 531 | dev->ts_gen_cntrl = 0x08; |
| 532 | { |
| 533 | /* Do a hardware reset of chip before using it. */ |
| 534 | struct cx88_core *core = dev->core; |
| 535 | |
| 536 | cx_clear(MO_GP0_IO, 1); |
| 537 | mdelay(100); |
Michael Krufky | d975872 | 2005-07-27 11:45:56 -0700 | [diff] [blame] | 538 | cx_set(MO_GP0_IO, 9); |
Michael Krufky | 0d723c0 | 2005-07-07 17:58:42 -0700 | [diff] [blame] | 539 | mdelay(200); |
Michael Krufky | f7b54b1 | 2006-08-08 15:48:08 -0300 | [diff] [blame] | 540 | dev->dvb.frontend = dvb_attach(lgdt330x_attach, |
| 541 | &fusionhdtv_3_gold, |
| 542 | &dev->core->i2c_adap); |
Andrew de Quincey | f54376e | 2006-04-18 17:56:10 -0300 | [diff] [blame] | 543 | if (dev->dvb.frontend != NULL) { |
Michael Krufky | 1d4bb7d | 2006-12-05 01:01:39 -0300 | [diff] [blame] | 544 | dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x61, |
| 545 | &dev->core->i2c_adap, |
| 546 | &dvb_pll_thomson_dtt761x); |
Andrew de Quincey | f54376e | 2006-04-18 17:56:10 -0300 | [diff] [blame] | 547 | } |
Michael Krufky | 0d723c0 | 2005-07-07 17:58:42 -0700 | [diff] [blame] | 548 | } |
| 549 | break; |
Mauro Carvalho Chehab | e52e98a | 2005-09-09 13:03:41 -0700 | [diff] [blame] | 550 | case CX88_BOARD_DVICO_FUSIONHDTV_5_GOLD: |
| 551 | dev->ts_gen_cntrl = 0x08; |
| 552 | { |
| 553 | /* Do a hardware reset of chip before using it. */ |
| 554 | struct cx88_core *core = dev->core; |
| 555 | |
| 556 | cx_clear(MO_GP0_IO, 1); |
| 557 | mdelay(100); |
| 558 | cx_set(MO_GP0_IO, 1); |
| 559 | mdelay(200); |
Michael Krufky | f7b54b1 | 2006-08-08 15:48:08 -0300 | [diff] [blame] | 560 | dev->dvb.frontend = dvb_attach(lgdt330x_attach, |
| 561 | &fusionhdtv_5_gold, |
| 562 | &dev->core->i2c_adap); |
Andrew de Quincey | f54376e | 2006-04-18 17:56:10 -0300 | [diff] [blame] | 563 | if (dev->dvb.frontend != NULL) { |
Trent Piepho | 6bdcc6e | 2007-04-27 12:31:30 -0300 | [diff] [blame] | 564 | dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x61, |
| 565 | &dev->core->i2c_adap, |
| 566 | &dvb_pll_lg_tdvs_h06xf); |
Andrew de Quincey | f54376e | 2006-04-18 17:56:10 -0300 | [diff] [blame] | 567 | } |
Mauro Carvalho Chehab | e52e98a | 2005-09-09 13:03:41 -0700 | [diff] [blame] | 568 | } |
| 569 | break; |
Rusty Scott | da215d2 | 2006-04-07 02:21:31 -0300 | [diff] [blame] | 570 | case CX88_BOARD_PCHDTV_HD5500: |
| 571 | dev->ts_gen_cntrl = 0x08; |
| 572 | { |
| 573 | /* Do a hardware reset of chip before using it. */ |
| 574 | struct cx88_core *core = dev->core; |
| 575 | |
| 576 | cx_clear(MO_GP0_IO, 1); |
| 577 | mdelay(100); |
| 578 | cx_set(MO_GP0_IO, 1); |
| 579 | mdelay(200); |
Michael Krufky | f7b54b1 | 2006-08-08 15:48:08 -0300 | [diff] [blame] | 580 | dev->dvb.frontend = dvb_attach(lgdt330x_attach, |
| 581 | &pchdtv_hd5500, |
| 582 | &dev->core->i2c_adap); |
Andrew de Quincey | f54376e | 2006-04-18 17:56:10 -0300 | [diff] [blame] | 583 | if (dev->dvb.frontend != NULL) { |
Trent Piepho | 6bdcc6e | 2007-04-27 12:31:30 -0300 | [diff] [blame] | 584 | dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x61, |
| 585 | &dev->core->i2c_adap, |
| 586 | &dvb_pll_lg_tdvs_h06xf); |
Andrew de Quincey | f54376e | 2006-04-18 17:56:10 -0300 | [diff] [blame] | 587 | } |
Rusty Scott | da215d2 | 2006-04-07 02:21:31 -0300 | [diff] [blame] | 588 | } |
| 589 | break; |
Kirk Lapray | fde6d31 | 2005-11-08 21:38:18 -0800 | [diff] [blame] | 590 | case CX88_BOARD_ATI_HDTVWONDER: |
Michael Krufky | f7b54b1 | 2006-08-08 15:48:08 -0300 | [diff] [blame] | 591 | dev->dvb.frontend = dvb_attach(nxt200x_attach, |
| 592 | &ati_hdtvwonder, |
| 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 | 4ad8eee5 | 2006-08-08 15:48:08 -0300 | [diff] [blame] | 596 | NULL, &dvb_pll_tuv1236d); |
Andrew de Quincey | f54376e | 2006-04-18 17:56:10 -0300 | [diff] [blame] | 597 | } |
Kirk Lapray | fde6d31 | 2005-11-08 21:38:18 -0800 | [diff] [blame] | 598 | break; |
Steven Toth | 0fa14aa | 2006-01-09 15:25:02 -0200 | [diff] [blame] | 599 | case CX88_BOARD_HAUPPAUGE_NOVASPLUS_S1: |
| 600 | case CX88_BOARD_HAUPPAUGE_NOVASE2_S1: |
Michael Krufky | f7b54b1 | 2006-08-08 15:48:08 -0300 | [diff] [blame] | 601 | dev->dvb.frontend = dvb_attach(cx24123_attach, |
| 602 | &hauppauge_novas_config, |
| 603 | &dev->core->i2c_adap); |
Andrew de Quincey | cd20ca9 | 2006-05-12 20:31:51 -0300 | [diff] [blame] | 604 | if (dev->dvb.frontend) { |
Michael Krufky | f7b54b1 | 2006-08-08 15:48:08 -0300 | [diff] [blame] | 605 | dvb_attach(isl6421_attach, dev->dvb.frontend, |
| 606 | &dev->core->i2c_adap, 0x08, 0x00, 0x00); |
Andrew de Quincey | cd20ca9 | 2006-05-12 20:31:51 -0300 | [diff] [blame] | 607 | } |
Steven Toth | 0fa14aa | 2006-01-09 15:25:02 -0200 | [diff] [blame] | 608 | break; |
Vadim Catana | 0e0351e | 2006-01-09 15:25:02 -0200 | [diff] [blame] | 609 | case CX88_BOARD_KWORLD_DVBS_100: |
Michael Krufky | f7b54b1 | 2006-08-08 15:48:08 -0300 | [diff] [blame] | 610 | dev->dvb.frontend = dvb_attach(cx24123_attach, |
| 611 | &kworld_dvbs_100_config, |
| 612 | &dev->core->i2c_adap); |
Andrew de Quincey | cd20ca9 | 2006-05-12 20:31:51 -0300 | [diff] [blame] | 613 | if (dev->dvb.frontend) { |
Patrick Boettcher | dea7486 | 2006-05-14 05:01:31 -0300 | [diff] [blame] | 614 | dev->core->prev_set_voltage = dev->dvb.frontend->ops.set_voltage; |
| 615 | dev->dvb.frontend->ops.set_voltage = kworld_dvbs_100_set_voltage; |
Andrew de Quincey | cd20ca9 | 2006-05-12 20:31:51 -0300 | [diff] [blame] | 616 | } |
Vadim Catana | 0e0351e | 2006-01-09 15:25:02 -0200 | [diff] [blame] | 617 | break; |
Saqeb Akhter | c02a34f | 2006-06-29 20:29:33 -0300 | [diff] [blame] | 618 | case CX88_BOARD_GENIATECH_DVBS: |
Michael Krufky | f7b54b1 | 2006-08-08 15:48:08 -0300 | [diff] [blame] | 619 | dev->dvb.frontend = dvb_attach(cx24123_attach, |
| 620 | &geniatech_dvbs_config, |
| 621 | &dev->core->i2c_adap); |
Saqeb Akhter | c02a34f | 2006-06-29 20:29:33 -0300 | [diff] [blame] | 622 | if (dev->dvb.frontend) { |
| 623 | dev->core->prev_set_voltage = dev->dvb.frontend->ops.set_voltage; |
| 624 | dev->dvb.frontend->ops.set_voltage = geniatech_dvbs_set_voltage; |
| 625 | } |
| 626 | break; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 627 | default: |
Gerd Knorr | 1622c3f | 2005-05-01 08:59:19 -0700 | [diff] [blame] | 628 | printk("%s: The frontend of your DVB/ATSC card isn't supported yet\n", |
| 629 | dev->core->name); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 630 | break; |
| 631 | } |
| 632 | if (NULL == dev->dvb.frontend) { |
| 633 | printk("%s: frontend initialization failed\n",dev->core->name); |
| 634 | return -1; |
| 635 | } |
| 636 | |
| 637 | if (dev->core->pll_desc) { |
Patrick Boettcher | dea7486 | 2006-05-14 05:01:31 -0300 | [diff] [blame] | 638 | dev->dvb.frontend->ops.info.frequency_min = dev->core->pll_desc->min; |
| 639 | dev->dvb.frontend->ops.info.frequency_max = dev->core->pll_desc->max; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 640 | } |
Steven Toth | 6c5be74 | 2006-12-02 21:15:51 -0200 | [diff] [blame] | 641 | /* Ensure all frontends negotiate bus access */ |
| 642 | dev->dvb.frontend->ops.ts_bus_ctrl = cx88_dvb_bus_ctrl; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 643 | |
Mauro Carvalho Chehab | 93352f5 | 2005-09-13 01:25:42 -0700 | [diff] [blame] | 644 | /* Put the analog decoder in standby to keep it quiet */ |
| 645 | cx88_call_i2c_clients (dev->core, TUNER_SET_STANDBY, NULL); |
| 646 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 647 | /* register everything */ |
Andrew de Quincey | d09dbf9 | 2006-04-10 09:27:37 -0300 | [diff] [blame] | 648 | return videobuf_dvb_register(&dev->dvb, THIS_MODULE, dev, &dev->pci->dev); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 649 | } |
| 650 | |
| 651 | /* ----------------------------------------------------------- */ |
| 652 | |
Steven Toth | 6c5be74 | 2006-12-02 21:15:51 -0200 | [diff] [blame] | 653 | /* CX8802 MPEG -> mini driver - We have been given the hardware */ |
| 654 | static int cx8802_dvb_advise_acquire(struct cx8802_driver *drv) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 655 | { |
Steven Toth | 6c5be74 | 2006-12-02 21:15:51 -0200 | [diff] [blame] | 656 | struct cx88_core *core = drv->core; |
| 657 | int err = 0; |
| 658 | dprintk( 1, "%s\n", __FUNCTION__); |
| 659 | |
| 660 | switch (core->board) { |
| 661 | case CX88_BOARD_HAUPPAUGE_HVR1300: |
| 662 | /* We arrive here with either the cx23416 or the cx22702 |
| 663 | * on the bus. Take the bus from the cx23416 and enable the |
| 664 | * cx22702 demod |
| 665 | */ |
| 666 | cx_set(MO_GP0_IO, 0x00000080); /* cx22702 out of reset and enable */ |
| 667 | cx_clear(MO_GP0_IO, 0x00000004); |
| 668 | udelay(1000); |
| 669 | break; |
| 670 | default: |
| 671 | err = -ENODEV; |
| 672 | } |
| 673 | return err; |
| 674 | } |
| 675 | |
| 676 | /* CX8802 MPEG -> mini driver - We no longer have the hardware */ |
| 677 | static int cx8802_dvb_advise_release(struct cx8802_driver *drv) |
| 678 | { |
| 679 | struct cx88_core *core = drv->core; |
| 680 | int err = 0; |
| 681 | dprintk( 1, "%s\n", __FUNCTION__); |
| 682 | |
| 683 | switch (core->board) { |
| 684 | case CX88_BOARD_HAUPPAUGE_HVR1300: |
| 685 | /* Do Nothing, leave the cx22702 on the bus. */ |
| 686 | break; |
| 687 | default: |
| 688 | err = -ENODEV; |
| 689 | } |
| 690 | return err; |
| 691 | } |
| 692 | |
| 693 | static int cx8802_dvb_probe(struct cx8802_driver *drv) |
| 694 | { |
| 695 | struct cx88_core *core = drv->core; |
| 696 | struct cx8802_dev *dev = drv->core->dvbdev; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 697 | int err; |
| 698 | |
Steven Toth | 6c5be74 | 2006-12-02 21:15:51 -0200 | [diff] [blame] | 699 | dprintk( 1, "%s\n", __FUNCTION__); |
| 700 | dprintk( 1, " ->being probed by Card=%d Name=%s, PCI %02x:%02x\n", |
| 701 | core->board, |
| 702 | core->name, |
| 703 | core->pci_bus, |
| 704 | core->pci_slot); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 705 | |
| 706 | err = -ENODEV; |
Michael Krufky | 48d5e80 | 2006-09-25 14:09:10 -0300 | [diff] [blame] | 707 | if (!(cx88_boards[core->board].mpeg & CX88_MPEG_DVB)) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 708 | goto fail_core; |
| 709 | |
Trent Piepho | ecf854d | 2007-05-05 20:11:32 -0300 | [diff] [blame] | 710 | /* If vp3054 isn't enabled, a stub will just return 0 */ |
Chris Pascoe | fc40b26 | 2006-01-09 15:25:35 -0200 | [diff] [blame] | 711 | err = vp3054_i2c_probe(dev); |
| 712 | if (0 != err) |
Steven Toth | 6c5be74 | 2006-12-02 21:15:51 -0200 | [diff] [blame] | 713 | goto fail_core; |
Chris Pascoe | fc40b26 | 2006-01-09 15:25:35 -0200 | [diff] [blame] | 714 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 715 | /* dvb stuff */ |
| 716 | printk("%s/2: cx2388x based dvb card\n", core->name); |
| 717 | videobuf_queue_init(&dev->dvb.dvbq, &dvb_qops, |
| 718 | dev->pci, &dev->slock, |
| 719 | V4L2_BUF_TYPE_VIDEO_CAPTURE, |
| 720 | V4L2_FIELD_TOP, |
| 721 | sizeof(struct cx88_buffer), |
| 722 | dev); |
| 723 | err = dvb_register(dev); |
Steven Toth | 6c5be74 | 2006-12-02 21:15:51 -0200 | [diff] [blame] | 724 | if (err != 0) |
| 725 | printk("%s dvb_register failed err = %d\n", __FUNCTION__, err); |
Steven Toth | 611900c | 2006-01-09 15:25:12 -0200 | [diff] [blame] | 726 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 727 | fail_core: |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 728 | return err; |
| 729 | } |
| 730 | |
Steven Toth | 6c5be74 | 2006-12-02 21:15:51 -0200 | [diff] [blame] | 731 | static int cx8802_dvb_remove(struct cx8802_driver *drv) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 732 | { |
Steven Toth | 6c5be74 | 2006-12-02 21:15:51 -0200 | [diff] [blame] | 733 | struct cx8802_dev *dev = drv->core->dvbdev; |
Steven Toth | 611900c | 2006-01-09 15:25:12 -0200 | [diff] [blame] | 734 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 735 | /* dvb */ |
| 736 | videobuf_dvb_unregister(&dev->dvb); |
| 737 | |
Chris Pascoe | fc40b26 | 2006-01-09 15:25:35 -0200 | [diff] [blame] | 738 | vp3054_i2c_remove(dev); |
Chris Pascoe | fc40b26 | 2006-01-09 15:25:35 -0200 | [diff] [blame] | 739 | |
Steven Toth | 6c5be74 | 2006-12-02 21:15:51 -0200 | [diff] [blame] | 740 | return 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 741 | } |
| 742 | |
Steven Toth | 6c5be74 | 2006-12-02 21:15:51 -0200 | [diff] [blame] | 743 | static struct cx8802_driver cx8802_dvb_driver = { |
| 744 | .type_id = CX88_MPEG_DVB, |
| 745 | .hw_access = CX8802_DRVCTL_SHARED, |
| 746 | .probe = cx8802_dvb_probe, |
| 747 | .remove = cx8802_dvb_remove, |
| 748 | .advise_acquire = cx8802_dvb_advise_acquire, |
| 749 | .advise_release = cx8802_dvb_advise_release, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 750 | }; |
| 751 | |
| 752 | static int dvb_init(void) |
| 753 | { |
| 754 | printk(KERN_INFO "cx2388x dvb driver version %d.%d.%d loaded\n", |
| 755 | (CX88_VERSION_CODE >> 16) & 0xff, |
| 756 | (CX88_VERSION_CODE >> 8) & 0xff, |
| 757 | CX88_VERSION_CODE & 0xff); |
| 758 | #ifdef SNAPSHOT |
| 759 | printk(KERN_INFO "cx2388x: snapshot date %04d-%02d-%02d\n", |
| 760 | SNAPSHOT/10000, (SNAPSHOT/100)%100, SNAPSHOT%100); |
| 761 | #endif |
Steven Toth | 6c5be74 | 2006-12-02 21:15:51 -0200 | [diff] [blame] | 762 | return cx8802_register_driver(&cx8802_dvb_driver); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 763 | } |
| 764 | |
| 765 | static void dvb_fini(void) |
| 766 | { |
Steven Toth | 6c5be74 | 2006-12-02 21:15:51 -0200 | [diff] [blame] | 767 | cx8802_unregister_driver(&cx8802_dvb_driver); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 768 | } |
| 769 | |
| 770 | module_init(dvb_init); |
| 771 | module_exit(dvb_fini); |
| 772 | |
| 773 | /* |
| 774 | * Local variables: |
| 775 | * c-basic-offset: 8 |
| 776 | * compile-command: "make DVB=1" |
| 777 | * End: |
| 778 | */ |