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