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" |
istvan_v@mailbox.hu | c21973e | 2011-06-07 13:12:29 -0300 | [diff] [blame] | 44 | #include "xc4000.h" |
Steven Toth | 60464da | 2008-01-05 16:53:01 -0300 | [diff] [blame] | 45 | #include "xc5000.h" |
Andrew de Quincey | 1f10c7a | 2006-08-08 09:10:09 -0300 | [diff] [blame] | 46 | #include "nxt200x.h" |
| 47 | #include "cx24123.h" |
Andrew de Quincey | cd20ca9 | 2006-05-12 20:31:51 -0300 | [diff] [blame] | 48 | #include "isl6421.h" |
Michael Krufky | 0df31f8 | 2008-04-22 14:46:13 -0300 | [diff] [blame] | 49 | #include "tuner-simple.h" |
Michael Krufky | 827855d | 2008-04-22 14:46:16 -0300 | [diff] [blame] | 50 | #include "tda9887.h" |
Steven Toth | d893d5d | 2008-04-25 03:46:43 -0300 | [diff] [blame] | 51 | #include "s5h1411.h" |
Igor M. Liplianin | e4aab64 | 2008-09-23 15:43:57 -0300 | [diff] [blame] | 52 | #include "stv0299.h" |
| 53 | #include "z0194a.h" |
| 54 | #include "stv0288.h" |
| 55 | #include "stb6000.h" |
Steven Toth | 5bd1b66 | 2008-09-04 01:17:33 -0300 | [diff] [blame] | 56 | #include "cx24116.h" |
Igor M. Liplianin | b699c27 | 2009-11-16 22:22:32 -0300 | [diff] [blame] | 57 | #include "stv0900.h" |
| 58 | #include "stb6100.h" |
| 59 | #include "stb6100_proc.h" |
Sergey Ivanov | 111ac84 | 2010-08-09 10:18:32 -0300 | [diff] [blame] | 60 | #include "mb86a16.h" |
Igor M. Liplianin | 0cb7363 | 2011-02-25 18:41:24 -0300 | [diff] [blame] | 61 | #include "ds3000.h" |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 62 | |
| 63 | MODULE_DESCRIPTION("driver for cx2388x based DVB cards"); |
| 64 | MODULE_AUTHOR("Chris Pascoe <c.pascoe@itee.uq.edu.au>"); |
| 65 | MODULE_AUTHOR("Gerd Knorr <kraxel@bytesex.org> [SuSE Labs]"); |
| 66 | MODULE_LICENSE("GPL"); |
| 67 | |
Douglas Schilling Landgraf | ff699e6 | 2008-04-22 14:41:48 -0300 | [diff] [blame] | 68 | static unsigned int debug; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 69 | module_param(debug, int, 0644); |
| 70 | MODULE_PARM_DESC(debug,"enable debug messages [dvb]"); |
| 71 | |
Ang Way Chuang | 44c6e2a7 | 2010-12-24 02:40:46 -0300 | [diff] [blame] | 72 | static unsigned int dvb_buf_tscnt = 32; |
| 73 | module_param(dvb_buf_tscnt, int, 0644); |
| 74 | MODULE_PARM_DESC(dvb_buf_tscnt, "DVB Buffer TS count [dvb]"); |
| 75 | |
Janne Grunau | 78e9200 | 2008-04-09 19:13:13 -0300 | [diff] [blame] | 76 | DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); |
| 77 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 78 | #define dprintk(level,fmt, arg...) if (debug >= level) \ |
Steven Toth | 6c5be74 | 2006-12-02 21:15:51 -0200 | [diff] [blame] | 79 | printk(KERN_DEBUG "%s/2-dvb: " fmt, core->name, ## arg) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 80 | |
| 81 | /* ------------------------------------------------------------------ */ |
| 82 | |
| 83 | static int dvb_buf_setup(struct videobuf_queue *q, |
| 84 | unsigned int *count, unsigned int *size) |
| 85 | { |
| 86 | struct cx8802_dev *dev = q->priv_data; |
| 87 | |
| 88 | dev->ts_packet_size = 188 * 4; |
Ang Way Chuang | 44c6e2a7 | 2010-12-24 02:40:46 -0300 | [diff] [blame] | 89 | dev->ts_packet_count = dvb_buf_tscnt; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 90 | |
| 91 | *size = dev->ts_packet_size * dev->ts_packet_count; |
Ang Way Chuang | 44c6e2a7 | 2010-12-24 02:40:46 -0300 | [diff] [blame] | 92 | *count = dvb_buf_tscnt; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 93 | return 0; |
| 94 | } |
| 95 | |
Michael Krufky | 4a39055 | 2006-12-05 02:00:53 -0300 | [diff] [blame] | 96 | static int dvb_buf_prepare(struct videobuf_queue *q, |
| 97 | struct videobuf_buffer *vb, enum v4l2_field field) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 98 | { |
| 99 | struct cx8802_dev *dev = q->priv_data; |
Mauro Carvalho Chehab | c7b0ac0 | 2006-03-10 12:29:15 -0300 | [diff] [blame] | 100 | return cx8802_buf_prepare(q, dev, (struct cx88_buffer*)vb,field); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 101 | } |
| 102 | |
| 103 | static void dvb_buf_queue(struct videobuf_queue *q, struct videobuf_buffer *vb) |
| 104 | { |
| 105 | struct cx8802_dev *dev = q->priv_data; |
| 106 | cx8802_buf_queue(dev, (struct cx88_buffer*)vb); |
| 107 | } |
| 108 | |
Michael Krufky | 4a39055 | 2006-12-05 02:00:53 -0300 | [diff] [blame] | 109 | static void dvb_buf_release(struct videobuf_queue *q, |
| 110 | struct videobuf_buffer *vb) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 111 | { |
Mauro Carvalho Chehab | c7b0ac0 | 2006-03-10 12:29:15 -0300 | [diff] [blame] | 112 | cx88_free_buffer(q, (struct cx88_buffer*)vb); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 113 | } |
| 114 | |
lawrence rust | 2e4e98e | 2010-08-25 09:50:20 -0300 | [diff] [blame] | 115 | static const struct videobuf_queue_ops dvb_qops = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 116 | .buf_setup = dvb_buf_setup, |
| 117 | .buf_prepare = dvb_buf_prepare, |
| 118 | .buf_queue = dvb_buf_queue, |
| 119 | .buf_release = dvb_buf_release, |
| 120 | }; |
| 121 | |
| 122 | /* ------------------------------------------------------------------ */ |
Michael Krufky | 22f3f17 | 2006-12-05 01:38:58 -0300 | [diff] [blame] | 123 | |
| 124 | static int cx88_dvb_bus_ctrl(struct dvb_frontend* fe, int acquire) |
| 125 | { |
| 126 | struct cx8802_dev *dev= fe->dvb->priv; |
| 127 | struct cx8802_driver *drv = NULL; |
| 128 | int ret = 0; |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 129 | int fe_id; |
| 130 | |
| 131 | fe_id = videobuf_dvb_find_frontend(&dev->frontends, fe); |
| 132 | if (!fe_id) { |
Steven Toth | 2af03ee | 2008-10-16 20:17:31 -0300 | [diff] [blame] | 133 | printk(KERN_ERR "%s() No frontend found\n", __func__); |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 134 | return -EINVAL; |
| 135 | } |
| 136 | |
Jonathan Nieder | 8a317a8 | 2011-05-01 06:29:16 -0300 | [diff] [blame] | 137 | mutex_lock(&dev->core->lock); |
Michael Krufky | 22f3f17 | 2006-12-05 01:38:58 -0300 | [diff] [blame] | 138 | drv = cx8802_get_driver(dev, CX88_MPEG_DVB); |
| 139 | if (drv) { |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 140 | if (acquire){ |
| 141 | dev->frontends.active_fe_id = fe_id; |
Michael Krufky | 22f3f17 | 2006-12-05 01:38:58 -0300 | [diff] [blame] | 142 | ret = drv->request_acquire(drv); |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 143 | } else { |
Michael Krufky | 22f3f17 | 2006-12-05 01:38:58 -0300 | [diff] [blame] | 144 | ret = drv->request_release(drv); |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 145 | dev->frontends.active_fe_id = 0; |
| 146 | } |
Michael Krufky | 22f3f17 | 2006-12-05 01:38:58 -0300 | [diff] [blame] | 147 | } |
Jonathan Nieder | 1fe70e9 | 2011-05-01 06:29:37 -0300 | [diff] [blame] | 148 | mutex_unlock(&dev->core->lock); |
Michael Krufky | 22f3f17 | 2006-12-05 01:38:58 -0300 | [diff] [blame] | 149 | |
| 150 | return ret; |
| 151 | } |
| 152 | |
Mauro Carvalho Chehab | e32fadc | 2009-01-06 16:06:07 -0300 | [diff] [blame] | 153 | static void cx88_dvb_gate_ctrl(struct cx88_core *core, int open) |
| 154 | { |
| 155 | struct videobuf_dvb_frontends *f; |
| 156 | struct videobuf_dvb_frontend *fe; |
| 157 | |
| 158 | if (!core->dvbdev) |
| 159 | return; |
| 160 | |
| 161 | f = &core->dvbdev->frontends; |
| 162 | |
| 163 | if (!f) |
| 164 | return; |
| 165 | |
| 166 | if (f->gate <= 1) /* undefined or fe0 */ |
| 167 | fe = videobuf_dvb_get_frontend(f, 1); |
| 168 | else |
| 169 | fe = videobuf_dvb_get_frontend(f, f->gate); |
| 170 | |
| 171 | if (fe && fe->dvb.frontend && fe->dvb.frontend->ops.i2c_gate_ctrl) |
| 172 | fe->dvb.frontend->ops.i2c_gate_ctrl(fe->dvb.frontend, open); |
| 173 | } |
| 174 | |
Michael Krufky | 22f3f17 | 2006-12-05 01:38:58 -0300 | [diff] [blame] | 175 | /* ------------------------------------------------------------------ */ |
| 176 | |
Chris Pascoe | 3d7d027 | 2006-01-09 18:21:31 -0200 | [diff] [blame] | 177 | static int dvico_fusionhdtv_demod_init(struct dvb_frontend* fe) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 178 | { |
lawrence rust | 2e4e98e | 2010-08-25 09:50:20 -0300 | [diff] [blame] | 179 | static const u8 clock_config [] = { CLOCK_CTL, 0x38, 0x39 }; |
| 180 | static const u8 reset [] = { RESET, 0x80 }; |
| 181 | static const u8 adc_ctl_1_cfg [] = { ADC_CTL_1, 0x40 }; |
| 182 | static const u8 agc_cfg [] = { AGC_TARGET, 0x24, 0x20 }; |
| 183 | static const u8 gpp_ctl_cfg [] = { GPP_CTL, 0x33 }; |
| 184 | static const u8 capt_range_cfg[] = { CAPT_RANGE, 0x32 }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 185 | |
| 186 | mt352_write(fe, clock_config, sizeof(clock_config)); |
| 187 | udelay(200); |
| 188 | mt352_write(fe, reset, sizeof(reset)); |
| 189 | mt352_write(fe, adc_ctl_1_cfg, sizeof(adc_ctl_1_cfg)); |
| 190 | |
| 191 | mt352_write(fe, agc_cfg, sizeof(agc_cfg)); |
| 192 | mt352_write(fe, gpp_ctl_cfg, sizeof(gpp_ctl_cfg)); |
| 193 | mt352_write(fe, capt_range_cfg, sizeof(capt_range_cfg)); |
| 194 | return 0; |
| 195 | } |
| 196 | |
Chris Pascoe | 43eabb4 | 2006-01-09 18:21:28 -0200 | [diff] [blame] | 197 | static int dvico_dual_demod_init(struct dvb_frontend *fe) |
| 198 | { |
lawrence rust | 2e4e98e | 2010-08-25 09:50:20 -0300 | [diff] [blame] | 199 | static const u8 clock_config [] = { CLOCK_CTL, 0x38, 0x38 }; |
| 200 | static const u8 reset [] = { RESET, 0x80 }; |
| 201 | static const u8 adc_ctl_1_cfg [] = { ADC_CTL_1, 0x40 }; |
| 202 | static const u8 agc_cfg [] = { AGC_TARGET, 0x28, 0x20 }; |
| 203 | static const u8 gpp_ctl_cfg [] = { GPP_CTL, 0x33 }; |
| 204 | static const u8 capt_range_cfg[] = { CAPT_RANGE, 0x32 }; |
Chris Pascoe | 43eabb4 | 2006-01-09 18:21:28 -0200 | [diff] [blame] | 205 | |
| 206 | mt352_write(fe, clock_config, sizeof(clock_config)); |
| 207 | udelay(200); |
| 208 | mt352_write(fe, reset, sizeof(reset)); |
| 209 | mt352_write(fe, adc_ctl_1_cfg, sizeof(adc_ctl_1_cfg)); |
| 210 | |
| 211 | mt352_write(fe, agc_cfg, sizeof(agc_cfg)); |
| 212 | mt352_write(fe, gpp_ctl_cfg, sizeof(gpp_ctl_cfg)); |
| 213 | mt352_write(fe, capt_range_cfg, sizeof(capt_range_cfg)); |
| 214 | |
| 215 | return 0; |
| 216 | } |
| 217 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 218 | static int dntv_live_dvbt_demod_init(struct dvb_frontend* fe) |
| 219 | { |
lawrence rust | 2e4e98e | 2010-08-25 09:50:20 -0300 | [diff] [blame] | 220 | static const u8 clock_config [] = { 0x89, 0x38, 0x39 }; |
| 221 | static const u8 reset [] = { 0x50, 0x80 }; |
| 222 | static const u8 adc_ctl_1_cfg [] = { 0x8E, 0x40 }; |
| 223 | static const u8 agc_cfg [] = { 0x67, 0x10, 0x23, 0x00, 0xFF, 0xFF, |
Mauro Carvalho Chehab | f2421ca | 2005-11-08 21:37:45 -0800 | [diff] [blame] | 224 | 0x00, 0xFF, 0x00, 0x40, 0x40 }; |
lawrence rust | 2e4e98e | 2010-08-25 09:50:20 -0300 | [diff] [blame] | 225 | static const u8 dntv_extra[] = { 0xB5, 0x7A }; |
| 226 | static const u8 capt_range_cfg[] = { 0x75, 0x32 }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 227 | |
| 228 | mt352_write(fe, clock_config, sizeof(clock_config)); |
| 229 | udelay(2000); |
| 230 | mt352_write(fe, reset, sizeof(reset)); |
| 231 | mt352_write(fe, adc_ctl_1_cfg, sizeof(adc_ctl_1_cfg)); |
| 232 | |
| 233 | mt352_write(fe, agc_cfg, sizeof(agc_cfg)); |
| 234 | udelay(2000); |
| 235 | mt352_write(fe, dntv_extra, sizeof(dntv_extra)); |
| 236 | mt352_write(fe, capt_range_cfg, sizeof(capt_range_cfg)); |
| 237 | |
| 238 | return 0; |
| 239 | } |
| 240 | |
lawrence rust | 2e4e98e | 2010-08-25 09:50:20 -0300 | [diff] [blame] | 241 | static const struct mt352_config dvico_fusionhdtv = { |
Michael Krufky | f7b54b1 | 2006-08-08 15:48:08 -0300 | [diff] [blame] | 242 | .demod_address = 0x0f, |
Chris Pascoe | 3d7d027 | 2006-01-09 18:21:31 -0200 | [diff] [blame] | 243 | .demod_init = dvico_fusionhdtv_demod_init, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 244 | }; |
| 245 | |
lawrence rust | 2e4e98e | 2010-08-25 09:50:20 -0300 | [diff] [blame] | 246 | static const struct mt352_config dntv_live_dvbt_config = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 247 | .demod_address = 0x0f, |
| 248 | .demod_init = dntv_live_dvbt_demod_init, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 249 | }; |
Chris Pascoe | fc40b26 | 2006-01-09 15:25:35 -0200 | [diff] [blame] | 250 | |
lawrence rust | 2e4e98e | 2010-08-25 09:50:20 -0300 | [diff] [blame] | 251 | static const struct mt352_config dvico_fusionhdtv_dual = { |
Michael Krufky | f7b54b1 | 2006-08-08 15:48:08 -0300 | [diff] [blame] | 252 | .demod_address = 0x0f, |
Chris Pascoe | 43eabb4 | 2006-01-09 18:21:28 -0200 | [diff] [blame] | 253 | .demod_init = dvico_dual_demod_init, |
Chris Pascoe | 43eabb4 | 2006-01-09 18:21:28 -0200 | [diff] [blame] | 254 | }; |
| 255 | |
lawrence rust | 2e4e98e | 2010-08-25 09:50:20 -0300 | [diff] [blame] | 256 | static const struct zl10353_config cx88_terratec_cinergy_ht_pci_mkii_config = { |
Stephan Wienczny | 70101a2 | 2009-03-10 19:08:06 -0300 | [diff] [blame] | 257 | .demod_address = (0x1e >> 1), |
| 258 | .no_tuner = 1, |
| 259 | .if2 = 45600, |
| 260 | }; |
| 261 | |
Sergey Ivanov | 111ac84 | 2010-08-09 10:18:32 -0300 | [diff] [blame] | 262 | static struct mb86a16_config twinhan_vp1027 = { |
| 263 | .demod_address = 0x08, |
| 264 | }; |
| 265 | |
Trent Piepho | ecf854d | 2007-05-05 20:11:32 -0300 | [diff] [blame] | 266 | #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] | 267 | static int dntv_live_dvbt_pro_demod_init(struct dvb_frontend* fe) |
| 268 | { |
lawrence rust | 2e4e98e | 2010-08-25 09:50:20 -0300 | [diff] [blame] | 269 | static const u8 clock_config [] = { 0x89, 0x38, 0x38 }; |
| 270 | static const u8 reset [] = { 0x50, 0x80 }; |
| 271 | static const u8 adc_ctl_1_cfg [] = { 0x8E, 0x40 }; |
| 272 | static const u8 agc_cfg [] = { 0x67, 0x10, 0x20, 0x00, 0xFF, 0xFF, |
Chris Pascoe | 3d7d027 | 2006-01-09 18:21:31 -0200 | [diff] [blame] | 273 | 0x00, 0xFF, 0x00, 0x40, 0x40 }; |
lawrence rust | 2e4e98e | 2010-08-25 09:50:20 -0300 | [diff] [blame] | 274 | static const u8 dntv_extra[] = { 0xB5, 0x7A }; |
| 275 | static const u8 capt_range_cfg[] = { 0x75, 0x32 }; |
Chris Pascoe | 3d7d027 | 2006-01-09 18:21:31 -0200 | [diff] [blame] | 276 | |
| 277 | mt352_write(fe, clock_config, sizeof(clock_config)); |
| 278 | udelay(2000); |
| 279 | mt352_write(fe, reset, sizeof(reset)); |
| 280 | mt352_write(fe, adc_ctl_1_cfg, sizeof(adc_ctl_1_cfg)); |
| 281 | |
| 282 | mt352_write(fe, agc_cfg, sizeof(agc_cfg)); |
| 283 | udelay(2000); |
| 284 | mt352_write(fe, dntv_extra, sizeof(dntv_extra)); |
| 285 | mt352_write(fe, capt_range_cfg, sizeof(capt_range_cfg)); |
| 286 | |
| 287 | return 0; |
| 288 | } |
| 289 | |
lawrence rust | 2e4e98e | 2010-08-25 09:50:20 -0300 | [diff] [blame] | 290 | static const struct mt352_config dntv_live_dvbt_pro_config = { |
Chris Pascoe | fc40b26 | 2006-01-09 15:25:35 -0200 | [diff] [blame] | 291 | .demod_address = 0x0f, |
| 292 | .no_tuner = 1, |
Chris Pascoe | 3d7d027 | 2006-01-09 18:21:31 -0200 | [diff] [blame] | 293 | .demod_init = dntv_live_dvbt_pro_demod_init, |
Chris Pascoe | fc40b26 | 2006-01-09 15:25:35 -0200 | [diff] [blame] | 294 | }; |
| 295 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 296 | |
lawrence rust | 2e4e98e | 2010-08-25 09:50:20 -0300 | [diff] [blame] | 297 | static const struct zl10353_config dvico_fusionhdtv_hybrid = { |
Michael Krufky | f7b54b1 | 2006-08-08 15:48:08 -0300 | [diff] [blame] | 298 | .demod_address = 0x0f, |
Andrew de Quincey | f54376e | 2006-04-18 17:56:10 -0300 | [diff] [blame] | 299 | .no_tuner = 1, |
Chris Pascoe | 780dfef | 2006-02-28 08:34:59 -0300 | [diff] [blame] | 300 | }; |
| 301 | |
lawrence rust | 2e4e98e | 2010-08-25 09:50:20 -0300 | [diff] [blame] | 302 | static const struct zl10353_config dvico_fusionhdtv_xc3028 = { |
Chris Pascoe | b3fb91d | 2008-04-22 14:45:15 -0300 | [diff] [blame] | 303 | .demod_address = 0x0f, |
| 304 | .if2 = 45600, |
| 305 | .no_tuner = 1, |
| 306 | }; |
| 307 | |
lawrence rust | 2e4e98e | 2010-08-25 09:50:20 -0300 | [diff] [blame] | 308 | static const struct mt352_config dvico_fusionhdtv_mt352_xc3028 = { |
Chris Pascoe | b3fb91d | 2008-04-22 14:45:15 -0300 | [diff] [blame] | 309 | .demod_address = 0x0f, |
| 310 | .if2 = 4560, |
| 311 | .no_tuner = 1, |
| 312 | .demod_init = dvico_fusionhdtv_demod_init, |
| 313 | }; |
| 314 | |
lawrence rust | 2e4e98e | 2010-08-25 09:50:20 -0300 | [diff] [blame] | 315 | static const struct zl10353_config dvico_fusionhdtv_plus_v1_1 = { |
Michael Krufky | f7b54b1 | 2006-08-08 15:48:08 -0300 | [diff] [blame] | 316 | .demod_address = 0x0f, |
Chris Pascoe | 780dfef | 2006-02-28 08:34:59 -0300 | [diff] [blame] | 317 | }; |
Chris Pascoe | 780dfef | 2006-02-28 08:34:59 -0300 | [diff] [blame] | 318 | |
lawrence rust | 2e4e98e | 2010-08-25 09:50:20 -0300 | [diff] [blame] | 319 | static const struct cx22702_config connexant_refboard_config = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 320 | .demod_address = 0x43, |
Patrick Boettcher | 38d84c3 | 2005-07-15 12:20:26 -0700 | [diff] [blame] | 321 | .output_mode = CX22702_SERIAL_OUTPUT, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 322 | }; |
| 323 | |
lawrence rust | 2e4e98e | 2010-08-25 09:50:20 -0300 | [diff] [blame] | 324 | static const struct cx22702_config hauppauge_hvr_config = { |
Steven Toth | aa481a6 | 2006-09-14 15:41:13 -0300 | [diff] [blame] | 325 | .demod_address = 0x63, |
| 326 | .output_mode = CX22702_SERIAL_OUTPUT, |
| 327 | }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 328 | |
Michael Krufky | 4a39055 | 2006-12-05 02:00:53 -0300 | [diff] [blame] | 329 | 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] | 330 | { |
| 331 | struct cx8802_dev *dev= fe->dvb->priv; |
| 332 | dev->ts_gen_cntrl = is_punctured ? 0x04 : 0x00; |
| 333 | return 0; |
| 334 | } |
| 335 | |
lawrence rust | 2e4e98e | 2010-08-25 09:50:20 -0300 | [diff] [blame] | 336 | static const struct or51132_config pchdtv_hd3000 = { |
Michael Krufky | f7b54b1 | 2006-08-08 15:48:08 -0300 | [diff] [blame] | 337 | .demod_address = 0x15, |
| 338 | .set_ts_params = or51132_set_ts_param, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 339 | }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 340 | |
Michael Krufky | 6ddcc91 | 2005-07-27 11:46:00 -0700 | [diff] [blame] | 341 | static int lgdt330x_pll_rf_set(struct dvb_frontend* fe, int index) |
Michael Krufky | 0ccef6d | 2005-07-27 11:45:55 -0700 | [diff] [blame] | 342 | { |
| 343 | struct cx8802_dev *dev= fe->dvb->priv; |
| 344 | struct cx88_core *core = dev->core; |
| 345 | |
Harvey Harrison | 32d83ef | 2008-04-08 23:20:00 -0300 | [diff] [blame] | 346 | dprintk(1, "%s: index = %d\n", __func__, index); |
Michael Krufky | 0ccef6d | 2005-07-27 11:45:55 -0700 | [diff] [blame] | 347 | if (index == 0) |
| 348 | cx_clear(MO_GP0_IO, 8); |
| 349 | else |
| 350 | cx_set(MO_GP0_IO, 8); |
| 351 | return 0; |
| 352 | } |
| 353 | |
Michael Krufky | 6ddcc91 | 2005-07-27 11:46:00 -0700 | [diff] [blame] | 354 | 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] | 355 | { |
| 356 | struct cx8802_dev *dev= fe->dvb->priv; |
| 357 | if (is_punctured) |
| 358 | dev->ts_gen_cntrl |= 0x04; |
| 359 | else |
| 360 | dev->ts_gen_cntrl &= ~0x04; |
| 361 | return 0; |
| 362 | } |
| 363 | |
Michael Krufky | 6ddcc91 | 2005-07-27 11:46:00 -0700 | [diff] [blame] | 364 | static struct lgdt330x_config fusionhdtv_3_gold = { |
Michael Krufky | f7b54b1 | 2006-08-08 15:48:08 -0300 | [diff] [blame] | 365 | .demod_address = 0x0e, |
| 366 | .demod_chip = LGDT3302, |
| 367 | .serial_mpeg = 0x04, /* TPSERIAL for 3302 in TOP_CONTROL */ |
| 368 | .set_ts_params = lgdt330x_set_ts_param, |
Michael Krufky | 0d723c0 | 2005-07-07 17:58:42 -0700 | [diff] [blame] | 369 | }; |
Mauro Carvalho Chehab | e52e98a | 2005-09-09 13:03:41 -0700 | [diff] [blame] | 370 | |
lawrence rust | 2e4e98e | 2010-08-25 09:50:20 -0300 | [diff] [blame] | 371 | static const struct lgdt330x_config fusionhdtv_5_gold = { |
Michael Krufky | f7b54b1 | 2006-08-08 15:48:08 -0300 | [diff] [blame] | 372 | .demod_address = 0x0e, |
| 373 | .demod_chip = LGDT3303, |
| 374 | .serial_mpeg = 0x40, /* TPSERIAL for 3303 in TOP_CONTROL */ |
| 375 | .set_ts_params = lgdt330x_set_ts_param, |
Mauro Carvalho Chehab | e52e98a | 2005-09-09 13:03:41 -0700 | [diff] [blame] | 376 | }; |
Rusty Scott | da215d2 | 2006-04-07 02:21:31 -0300 | [diff] [blame] | 377 | |
lawrence rust | 2e4e98e | 2010-08-25 09:50:20 -0300 | [diff] [blame] | 378 | static const struct lgdt330x_config pchdtv_hd5500 = { |
Michael Krufky | f7b54b1 | 2006-08-08 15:48:08 -0300 | [diff] [blame] | 379 | .demod_address = 0x59, |
| 380 | .demod_chip = LGDT3303, |
| 381 | .serial_mpeg = 0x40, /* TPSERIAL for 3303 in TOP_CONTROL */ |
| 382 | .set_ts_params = lgdt330x_set_ts_param, |
Rusty Scott | da215d2 | 2006-04-07 02:21:31 -0300 | [diff] [blame] | 383 | }; |
Michael Krufky | f179849 | 2005-07-07 17:58:39 -0700 | [diff] [blame] | 384 | |
Michael Krufky | 4a39055 | 2006-12-05 02:00:53 -0300 | [diff] [blame] | 385 | 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] | 386 | { |
| 387 | struct cx8802_dev *dev= fe->dvb->priv; |
| 388 | dev->ts_gen_cntrl = is_punctured ? 0x04 : 0x00; |
| 389 | return 0; |
| 390 | } |
| 391 | |
lawrence rust | 2e4e98e | 2010-08-25 09:50:20 -0300 | [diff] [blame] | 392 | static const struct nxt200x_config ati_hdtvwonder = { |
Michael Krufky | f7b54b1 | 2006-08-08 15:48:08 -0300 | [diff] [blame] | 393 | .demod_address = 0x0a, |
Michael Krufky | f7b54b1 | 2006-08-08 15:48:08 -0300 | [diff] [blame] | 394 | .set_ts_params = nxt200x_set_ts_param, |
Kirk Lapray | fde6d31 | 2005-11-08 21:38:18 -0800 | [diff] [blame] | 395 | }; |
Kirk Lapray | fde6d31 | 2005-11-08 21:38:18 -0800 | [diff] [blame] | 396 | |
Steven Toth | 0fa14aa | 2006-01-09 15:25:02 -0200 | [diff] [blame] | 397 | static int cx24123_set_ts_param(struct dvb_frontend* fe, |
| 398 | int is_punctured) |
| 399 | { |
| 400 | struct cx8802_dev *dev= fe->dvb->priv; |
Michael Krufky | f7b54b1 | 2006-08-08 15:48:08 -0300 | [diff] [blame] | 401 | dev->ts_gen_cntrl = 0x02; |
Steven Toth | 0fa14aa | 2006-01-09 15:25:02 -0200 | [diff] [blame] | 402 | return 0; |
| 403 | } |
| 404 | |
Michael Krufky | f7b54b1 | 2006-08-08 15:48:08 -0300 | [diff] [blame] | 405 | static int kworld_dvbs_100_set_voltage(struct dvb_frontend* fe, |
| 406 | fe_sec_voltage_t voltage) |
Vadim Catana | 0e0351e | 2006-01-09 15:25:02 -0200 | [diff] [blame] | 407 | { |
| 408 | struct cx8802_dev *dev= fe->dvb->priv; |
| 409 | struct cx88_core *core = dev->core; |
| 410 | |
Michael Krufky | 4a39055 | 2006-12-05 02:00:53 -0300 | [diff] [blame] | 411 | if (voltage == SEC_VOLTAGE_OFF) |
Michael Krufky | f7b54b1 | 2006-08-08 15:48:08 -0300 | [diff] [blame] | 412 | cx_write(MO_GP0_IO, 0x000006fb); |
Michael Krufky | 4a39055 | 2006-12-05 02:00:53 -0300 | [diff] [blame] | 413 | else |
Andrew de Quincey | cd20ca9 | 2006-05-12 20:31:51 -0300 | [diff] [blame] | 414 | cx_write(MO_GP0_IO, 0x000006f9); |
Andrew de Quincey | cd20ca9 | 2006-05-12 20:31:51 -0300 | [diff] [blame] | 415 | |
| 416 | if (core->prev_set_voltage) |
| 417 | return core->prev_set_voltage(fe, voltage); |
| 418 | return 0; |
Vadim Catana | 0e0351e | 2006-01-09 15:25:02 -0200 | [diff] [blame] | 419 | } |
| 420 | |
Michael Krufky | f7b54b1 | 2006-08-08 15:48:08 -0300 | [diff] [blame] | 421 | static int geniatech_dvbs_set_voltage(struct dvb_frontend *fe, |
| 422 | fe_sec_voltage_t voltage) |
Saqeb Akhter | c02a34f | 2006-06-29 20:29:33 -0300 | [diff] [blame] | 423 | { |
| 424 | struct cx8802_dev *dev= fe->dvb->priv; |
| 425 | struct cx88_core *core = dev->core; |
| 426 | |
| 427 | if (voltage == SEC_VOLTAGE_OFF) { |
| 428 | dprintk(1,"LNB Voltage OFF\n"); |
| 429 | cx_write(MO_GP0_IO, 0x0000efff); |
| 430 | } |
| 431 | |
| 432 | if (core->prev_set_voltage) |
| 433 | return core->prev_set_voltage(fe, voltage); |
| 434 | return 0; |
| 435 | } |
| 436 | |
Igor M. Liplianin | af83262 | 2008-09-04 17:24:14 -0300 | [diff] [blame] | 437 | static int tevii_dvbs_set_voltage(struct dvb_frontend *fe, |
| 438 | fe_sec_voltage_t voltage) |
| 439 | { |
| 440 | struct cx8802_dev *dev= fe->dvb->priv; |
| 441 | struct cx88_core *core = dev->core; |
| 442 | |
Igor M. Liplianin | ad5f74c | 2009-07-29 19:18:28 -0300 | [diff] [blame] | 443 | cx_set(MO_GP0_IO, 0x6040); |
Igor M. Liplianin | af83262 | 2008-09-04 17:24:14 -0300 | [diff] [blame] | 444 | switch (voltage) { |
Sergey Ivanov | 111ac84 | 2010-08-09 10:18:32 -0300 | [diff] [blame] | 445 | case SEC_VOLTAGE_13: |
| 446 | cx_clear(MO_GP0_IO, 0x20); |
| 447 | break; |
| 448 | case SEC_VOLTAGE_18: |
| 449 | cx_set(MO_GP0_IO, 0x20); |
| 450 | break; |
| 451 | case SEC_VOLTAGE_OFF: |
| 452 | cx_clear(MO_GP0_IO, 0x20); |
| 453 | break; |
| 454 | } |
| 455 | |
| 456 | if (core->prev_set_voltage) |
| 457 | return core->prev_set_voltage(fe, voltage); |
| 458 | return 0; |
| 459 | } |
| 460 | |
| 461 | static int vp1027_set_voltage(struct dvb_frontend *fe, |
| 462 | fe_sec_voltage_t voltage) |
| 463 | { |
| 464 | struct cx8802_dev *dev = fe->dvb->priv; |
| 465 | struct cx88_core *core = dev->core; |
| 466 | |
| 467 | switch (voltage) { |
| 468 | case SEC_VOLTAGE_13: |
| 469 | dprintk(1, "LNB SEC Voltage=13\n"); |
| 470 | cx_write(MO_GP0_IO, 0x00001220); |
| 471 | break; |
| 472 | case SEC_VOLTAGE_18: |
| 473 | dprintk(1, "LNB SEC Voltage=18\n"); |
| 474 | cx_write(MO_GP0_IO, 0x00001222); |
| 475 | break; |
| 476 | case SEC_VOLTAGE_OFF: |
| 477 | dprintk(1, "LNB Voltage OFF\n"); |
| 478 | cx_write(MO_GP0_IO, 0x00001230); |
| 479 | break; |
Igor M. Liplianin | af83262 | 2008-09-04 17:24:14 -0300 | [diff] [blame] | 480 | } |
| 481 | |
| 482 | if (core->prev_set_voltage) |
| 483 | return core->prev_set_voltage(fe, voltage); |
| 484 | return 0; |
| 485 | } |
| 486 | |
lawrence rust | 2e4e98e | 2010-08-25 09:50:20 -0300 | [diff] [blame] | 487 | static const struct cx24123_config geniatech_dvbs_config = { |
Michael Krufky | f7b54b1 | 2006-08-08 15:48:08 -0300 | [diff] [blame] | 488 | .demod_address = 0x55, |
| 489 | .set_ts_params = cx24123_set_ts_param, |
Saqeb Akhter | c02a34f | 2006-06-29 20:29:33 -0300 | [diff] [blame] | 490 | }; |
| 491 | |
lawrence rust | 2e4e98e | 2010-08-25 09:50:20 -0300 | [diff] [blame] | 492 | static const struct cx24123_config hauppauge_novas_config = { |
Michael Krufky | f7b54b1 | 2006-08-08 15:48:08 -0300 | [diff] [blame] | 493 | .demod_address = 0x55, |
| 494 | .set_ts_params = cx24123_set_ts_param, |
Vadim Catana | 0e0351e | 2006-01-09 15:25:02 -0200 | [diff] [blame] | 495 | }; |
| 496 | |
lawrence rust | 2e4e98e | 2010-08-25 09:50:20 -0300 | [diff] [blame] | 497 | static const struct cx24123_config kworld_dvbs_100_config = { |
Michael Krufky | f7b54b1 | 2006-08-08 15:48:08 -0300 | [diff] [blame] | 498 | .demod_address = 0x15, |
| 499 | .set_ts_params = cx24123_set_ts_param, |
Yeasah Pell | ef76856 | 2006-09-26 12:30:14 -0300 | [diff] [blame] | 500 | .lnb_polarity = 1, |
Steven Toth | 0fa14aa | 2006-01-09 15:25:02 -0200 | [diff] [blame] | 501 | }; |
Steven Toth | 0fa14aa | 2006-01-09 15:25:02 -0200 | [diff] [blame] | 502 | |
lawrence rust | 2e4e98e | 2010-08-25 09:50:20 -0300 | [diff] [blame] | 503 | static const struct s5h1409_config pinnacle_pctv_hd_800i_config = { |
Steven Toth | 60464da | 2008-01-05 16:53:01 -0300 | [diff] [blame] | 504 | .demod_address = 0x32 >> 1, |
| 505 | .output_mode = S5H1409_PARALLEL_OUTPUT, |
| 506 | .gpio = S5H1409_GPIO_ON, |
| 507 | .qam_if = 44000, |
| 508 | .inversion = S5H1409_INVERSION_OFF, |
| 509 | .status_mode = S5H1409_DEMODLOCKING, |
Steven Toth | 4917019 | 2008-01-15 21:57:14 -0300 | [diff] [blame] | 510 | .mpeg_timing = S5H1409_MPEGTIMING_NONCONTINOUS_NONINVERTING_CLOCK, |
Steven Toth | 60464da | 2008-01-05 16:53:01 -0300 | [diff] [blame] | 511 | }; |
| 512 | |
lawrence rust | 2e4e98e | 2010-08-25 09:50:20 -0300 | [diff] [blame] | 513 | static const struct s5h1409_config dvico_hdtv5_pci_nano_config = { |
Steven Toth | 5c00fac | 2008-04-22 14:45:14 -0300 | [diff] [blame] | 514 | .demod_address = 0x32 >> 1, |
| 515 | .output_mode = S5H1409_SERIAL_OUTPUT, |
| 516 | .gpio = S5H1409_GPIO_OFF, |
| 517 | .inversion = S5H1409_INVERSION_OFF, |
| 518 | .status_mode = S5H1409_DEMODLOCKING, |
| 519 | .mpeg_timing = S5H1409_MPEGTIMING_CONTINOUS_NONINVERTING_CLOCK, |
| 520 | }; |
| 521 | |
lawrence rust | 2e4e98e | 2010-08-25 09:50:20 -0300 | [diff] [blame] | 522 | static const struct s5h1409_config kworld_atsc_120_config = { |
Mauro Carvalho Chehab | 99e09ea | 2008-03-27 23:18:30 -0300 | [diff] [blame] | 523 | .demod_address = 0x32 >> 1, |
Mauro Carvalho Chehab | 99e09ea | 2008-03-27 23:18:30 -0300 | [diff] [blame] | 524 | .output_mode = S5H1409_SERIAL_OUTPUT, |
| 525 | .gpio = S5H1409_GPIO_OFF, |
| 526 | .inversion = S5H1409_INVERSION_OFF, |
| 527 | .status_mode = S5H1409_DEMODLOCKING, |
| 528 | .mpeg_timing = S5H1409_MPEGTIMING_CONTINOUS_NONINVERTING_CLOCK, |
| 529 | }; |
| 530 | |
lawrence rust | 2e4e98e | 2010-08-25 09:50:20 -0300 | [diff] [blame] | 531 | static const struct xc5000_config pinnacle_pctv_hd_800i_tuner_config = { |
Steven Toth | 60464da | 2008-01-05 16:53:01 -0300 | [diff] [blame] | 532 | .i2c_address = 0x64, |
| 533 | .if_khz = 5380, |
Steven Toth | 60464da | 2008-01-05 16:53:01 -0300 | [diff] [blame] | 534 | }; |
| 535 | |
lawrence rust | 2e4e98e | 2010-08-25 09:50:20 -0300 | [diff] [blame] | 536 | static const struct zl10353_config cx88_pinnacle_hybrid_pctv = { |
Stéphane Voltz | 3f6014f | 2008-09-05 14:33:54 -0300 | [diff] [blame] | 537 | .demod_address = (0x1e >> 1), |
| 538 | .no_tuner = 1, |
| 539 | .if2 = 45600, |
| 540 | }; |
| 541 | |
lawrence rust | 2e4e98e | 2010-08-25 09:50:20 -0300 | [diff] [blame] | 542 | static const struct zl10353_config cx88_geniatech_x8000_mt = { |
Mauro Carvalho Chehab | 5706934 | 2009-08-20 10:14:45 -0300 | [diff] [blame] | 543 | .demod_address = (0x1e >> 1), |
| 544 | .no_tuner = 1, |
| 545 | .disable_i2c_gate_ctrl = 1, |
Mauro Carvalho Chehab | 9507901 | 2008-04-22 14:45:15 -0300 | [diff] [blame] | 546 | }; |
| 547 | |
lawrence rust | 2e4e98e | 2010-08-25 09:50:20 -0300 | [diff] [blame] | 548 | static const struct s5h1411_config dvico_fusionhdtv7_config = { |
Steven Toth | d893d5d | 2008-04-25 03:46:43 -0300 | [diff] [blame] | 549 | .output_mode = S5H1411_SERIAL_OUTPUT, |
| 550 | .gpio = S5H1411_GPIO_ON, |
| 551 | .mpeg_timing = S5H1411_MPEGTIMING_CONTINOUS_NONINVERTING_CLOCK, |
| 552 | .qam_if = S5H1411_IF_44000, |
| 553 | .vsb_if = S5H1411_IF_44000, |
| 554 | .inversion = S5H1411_INVERSION_OFF, |
| 555 | .status_mode = S5H1411_DEMODLOCKING |
| 556 | }; |
| 557 | |
lawrence rust | 2e4e98e | 2010-08-25 09:50:20 -0300 | [diff] [blame] | 558 | static const struct xc5000_config dvico_fusionhdtv7_tuner_config = { |
Steven Toth | d893d5d | 2008-04-25 03:46:43 -0300 | [diff] [blame] | 559 | .i2c_address = 0xc2 >> 1, |
| 560 | .if_khz = 5380, |
Steven Toth | d893d5d | 2008-04-25 03:46:43 -0300 | [diff] [blame] | 561 | }; |
| 562 | |
Mauro Carvalho Chehab | 23fb348 | 2008-04-22 14:45:30 -0300 | [diff] [blame] | 563 | static int attach_xc3028(u8 addr, struct cx8802_dev *dev) |
| 564 | { |
| 565 | struct dvb_frontend *fe; |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 566 | struct videobuf_dvb_frontend *fe0 = NULL; |
Mauro Carvalho Chehab | 99e09ea | 2008-03-27 23:18:30 -0300 | [diff] [blame] | 567 | struct xc2028_ctrl ctl; |
Mauro Carvalho Chehab | 23fb348 | 2008-04-22 14:45:30 -0300 | [diff] [blame] | 568 | struct xc2028_config cfg = { |
| 569 | .i2c_adap = &dev->core->i2c_adap, |
| 570 | .i2c_addr = addr, |
Mauro Carvalho Chehab | 99e09ea | 2008-03-27 23:18:30 -0300 | [diff] [blame] | 571 | .ctrl = &ctl, |
Mauro Carvalho Chehab | 23fb348 | 2008-04-22 14:45:30 -0300 | [diff] [blame] | 572 | }; |
| 573 | |
Darron Broad | 92abe9e | 2008-10-11 11:18:53 -0300 | [diff] [blame] | 574 | /* Get the first frontend */ |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 575 | fe0 = videobuf_dvb_get_frontend(&dev->frontends, 1); |
| 576 | if (!fe0) |
| 577 | return -EINVAL; |
| 578 | |
| 579 | if (!fe0->dvb.frontend) { |
Mauro Carvalho Chehab | ddd5441 | 2008-04-22 14:45:46 -0300 | [diff] [blame] | 580 | printk(KERN_ERR "%s/2: dvb frontend not attached. " |
| 581 | "Can't attach xc3028\n", |
| 582 | dev->core->name); |
| 583 | return -EINVAL; |
| 584 | } |
| 585 | |
Mauro Carvalho Chehab | 99e09ea | 2008-03-27 23:18:30 -0300 | [diff] [blame] | 586 | /* |
| 587 | * Some xc3028 devices may be hidden by an I2C gate. This is known |
| 588 | * to happen with some s5h1409-based devices. |
| 589 | * Now that I2C gate is open, sets up xc3028 configuration |
| 590 | */ |
| 591 | cx88_setup_xc3028(dev->core, &ctl); |
| 592 | |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 593 | fe = dvb_attach(xc2028_attach, fe0->dvb.frontend, &cfg); |
Mauro Carvalho Chehab | 23fb348 | 2008-04-22 14:45:30 -0300 | [diff] [blame] | 594 | if (!fe) { |
| 595 | printk(KERN_ERR "%s/2: xc3028 attach failed\n", |
| 596 | dev->core->name); |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 597 | dvb_frontend_detach(fe0->dvb.frontend); |
| 598 | dvb_unregister_frontend(fe0->dvb.frontend); |
| 599 | fe0->dvb.frontend = NULL; |
Mauro Carvalho Chehab | 23fb348 | 2008-04-22 14:45:30 -0300 | [diff] [blame] | 600 | return -EINVAL; |
| 601 | } |
| 602 | |
| 603 | printk(KERN_INFO "%s/2: xc3028 attached\n", |
| 604 | dev->core->name); |
| 605 | |
| 606 | return 0; |
| 607 | } |
Mauro Carvalho Chehab | 9507901 | 2008-04-22 14:45:15 -0300 | [diff] [blame] | 608 | |
istvan_v@mailbox.hu | c21973e | 2011-06-07 13:12:29 -0300 | [diff] [blame] | 609 | static int attach_xc4000(struct cx8802_dev *dev, struct xc4000_config *cfg) |
| 610 | { |
| 611 | struct dvb_frontend *fe; |
| 612 | struct videobuf_dvb_frontend *fe0 = NULL; |
| 613 | |
| 614 | /* Get the first frontend */ |
| 615 | fe0 = videobuf_dvb_get_frontend(&dev->frontends, 1); |
| 616 | if (!fe0) |
| 617 | return -EINVAL; |
| 618 | |
| 619 | if (!fe0->dvb.frontend) { |
| 620 | printk(KERN_ERR "%s/2: dvb frontend not attached. " |
| 621 | "Can't attach xc4000\n", |
| 622 | dev->core->name); |
| 623 | return -EINVAL; |
| 624 | } |
| 625 | |
| 626 | fe = dvb_attach(xc4000_attach, fe0->dvb.frontend, &dev->core->i2c_adap, |
| 627 | cfg); |
| 628 | if (!fe) { |
| 629 | printk(KERN_ERR "%s/2: xc4000 attach failed\n", |
| 630 | dev->core->name); |
| 631 | dvb_frontend_detach(fe0->dvb.frontend); |
| 632 | dvb_unregister_frontend(fe0->dvb.frontend); |
| 633 | fe0->dvb.frontend = NULL; |
| 634 | return -EINVAL; |
| 635 | } |
| 636 | |
| 637 | printk(KERN_INFO "%s/2: xc4000 attached\n", dev->core->name); |
| 638 | |
| 639 | return 0; |
| 640 | } |
| 641 | |
Steven Toth | 5bd1b66 | 2008-09-04 01:17:33 -0300 | [diff] [blame] | 642 | static int cx24116_set_ts_param(struct dvb_frontend *fe, |
| 643 | int is_punctured) |
| 644 | { |
| 645 | struct cx8802_dev *dev = fe->dvb->priv; |
| 646 | dev->ts_gen_cntrl = 0x2; |
| 647 | |
| 648 | return 0; |
| 649 | } |
| 650 | |
Igor M. Liplianin | b699c27 | 2009-11-16 22:22:32 -0300 | [diff] [blame] | 651 | static int stv0900_set_ts_param(struct dvb_frontend *fe, |
| 652 | int is_punctured) |
| 653 | { |
| 654 | struct cx8802_dev *dev = fe->dvb->priv; |
| 655 | dev->ts_gen_cntrl = 0; |
| 656 | |
| 657 | return 0; |
| 658 | } |
| 659 | |
Steven Toth | 5bd1b66 | 2008-09-04 01:17:33 -0300 | [diff] [blame] | 660 | static int cx24116_reset_device(struct dvb_frontend *fe) |
| 661 | { |
| 662 | struct cx8802_dev *dev = fe->dvb->priv; |
| 663 | struct cx88_core *core = dev->core; |
| 664 | |
| 665 | /* Reset the part */ |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 666 | /* Put the cx24116 into reset */ |
Steven Toth | 5bd1b66 | 2008-09-04 01:17:33 -0300 | [diff] [blame] | 667 | cx_write(MO_SRST_IO, 0); |
| 668 | msleep(10); |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 669 | /* Take the cx24116 out of reset */ |
Steven Toth | 5bd1b66 | 2008-09-04 01:17:33 -0300 | [diff] [blame] | 670 | cx_write(MO_SRST_IO, 1); |
| 671 | msleep(10); |
| 672 | |
| 673 | return 0; |
| 674 | } |
| 675 | |
lawrence rust | 2e4e98e | 2010-08-25 09:50:20 -0300 | [diff] [blame] | 676 | static const struct cx24116_config hauppauge_hvr4000_config = { |
Steven Toth | 5bd1b66 | 2008-09-04 01:17:33 -0300 | [diff] [blame] | 677 | .demod_address = 0x05, |
| 678 | .set_ts_params = cx24116_set_ts_param, |
| 679 | .reset_device = cx24116_reset_device, |
| 680 | }; |
| 681 | |
lawrence rust | 2e4e98e | 2010-08-25 09:50:20 -0300 | [diff] [blame] | 682 | static const struct cx24116_config tevii_s460_config = { |
Igor M. Liplianin | af83262 | 2008-09-04 17:24:14 -0300 | [diff] [blame] | 683 | .demod_address = 0x55, |
| 684 | .set_ts_params = cx24116_set_ts_param, |
| 685 | .reset_device = cx24116_reset_device, |
| 686 | }; |
| 687 | |
Igor M. Liplianin | 0cb7363 | 2011-02-25 18:41:24 -0300 | [diff] [blame] | 688 | static int ds3000_set_ts_param(struct dvb_frontend *fe, |
| 689 | int is_punctured) |
| 690 | { |
| 691 | struct cx8802_dev *dev = fe->dvb->priv; |
| 692 | dev->ts_gen_cntrl = 4; |
| 693 | |
| 694 | return 0; |
| 695 | } |
| 696 | |
| 697 | static struct ds3000_config tevii_ds3000_config = { |
| 698 | .demod_address = 0x68, |
| 699 | .set_ts_params = ds3000_set_ts_param, |
| 700 | }; |
| 701 | |
lawrence rust | 2e4e98e | 2010-08-25 09:50:20 -0300 | [diff] [blame] | 702 | static const struct stv0900_config prof_7301_stv0900_config = { |
Igor M. Liplianin | b699c27 | 2009-11-16 22:22:32 -0300 | [diff] [blame] | 703 | .demod_address = 0x6a, |
| 704 | /* demod_mode = 0,*/ |
| 705 | .xtal = 27000000, |
| 706 | .clkmode = 3,/* 0-CLKI, 2-XTALI, else AUTO */ |
| 707 | .diseqc_mode = 2,/* 2/3 PWM */ |
| 708 | .tun1_maddress = 0,/* 0x60 */ |
| 709 | .tun1_adc = 0,/* 2 Vpp */ |
| 710 | .path1_mode = 3, |
| 711 | .set_ts_params = stv0900_set_ts_param, |
| 712 | }; |
| 713 | |
lawrence rust | 2e4e98e | 2010-08-25 09:50:20 -0300 | [diff] [blame] | 714 | static const struct stb6100_config prof_7301_stb6100_config = { |
Igor M. Liplianin | b699c27 | 2009-11-16 22:22:32 -0300 | [diff] [blame] | 715 | .tuner_address = 0x60, |
| 716 | .refclock = 27000000, |
| 717 | }; |
| 718 | |
lawrence rust | 2e4e98e | 2010-08-25 09:50:20 -0300 | [diff] [blame] | 719 | static const struct stv0299_config tevii_tuner_sharp_config = { |
Igor M. Liplianin | e4aab64 | 2008-09-23 15:43:57 -0300 | [diff] [blame] | 720 | .demod_address = 0x68, |
Igor M. Liplianin | d4305c6 | 2008-10-17 13:45:55 -0300 | [diff] [blame] | 721 | .inittab = sharp_z0194a_inittab, |
Igor M. Liplianin | e4aab64 | 2008-09-23 15:43:57 -0300 | [diff] [blame] | 722 | .mclk = 88000000UL, |
| 723 | .invert = 1, |
| 724 | .skip_reinit = 0, |
| 725 | .lock_output = 1, |
| 726 | .volt13_op0_op1 = STV0299_VOLT13_OP1, |
| 727 | .min_delay_ms = 100, |
Igor M. Liplianin | d4305c6 | 2008-10-17 13:45:55 -0300 | [diff] [blame] | 728 | .set_symbol_rate = sharp_z0194a_set_symbol_rate, |
Igor M. Liplianin | e4aab64 | 2008-09-23 15:43:57 -0300 | [diff] [blame] | 729 | .set_ts_params = cx24116_set_ts_param, |
| 730 | }; |
| 731 | |
lawrence rust | 2e4e98e | 2010-08-25 09:50:20 -0300 | [diff] [blame] | 732 | static const struct stv0288_config tevii_tuner_earda_config = { |
Igor M. Liplianin | e4aab64 | 2008-09-23 15:43:57 -0300 | [diff] [blame] | 733 | .demod_address = 0x68, |
| 734 | .min_delay_ms = 100, |
| 735 | .set_ts_params = cx24116_set_ts_param, |
| 736 | }; |
| 737 | |
Andy Walls | 6e0e12f | 2009-01-11 21:18:04 -0300 | [diff] [blame] | 738 | static int cx8802_alloc_frontends(struct cx8802_dev *dev) |
| 739 | { |
| 740 | struct cx88_core *core = dev->core; |
| 741 | struct videobuf_dvb_frontend *fe = NULL; |
| 742 | int i; |
| 743 | |
| 744 | mutex_init(&dev->frontends.lock); |
| 745 | INIT_LIST_HEAD(&dev->frontends.felist); |
| 746 | |
| 747 | if (!core->board.num_frontends) |
| 748 | return -ENODEV; |
| 749 | |
| 750 | printk(KERN_INFO "%s() allocating %d frontend(s)\n", __func__, |
| 751 | core->board.num_frontends); |
| 752 | for (i = 1; i <= core->board.num_frontends; i++) { |
| 753 | fe = videobuf_dvb_alloc_frontend(&dev->frontends, i); |
| 754 | if (!fe) { |
| 755 | printk(KERN_ERR "%s() failed to alloc\n", __func__); |
| 756 | videobuf_dvb_dealloc_frontends(&dev->frontends); |
| 757 | return -ENOMEM; |
| 758 | } |
| 759 | } |
| 760 | return 0; |
| 761 | } |
| 762 | |
Dirk Herrendoerfer | 4f3ca2f1 | 2010-02-11 18:06:34 -0300 | [diff] [blame] | 763 | |
| 764 | |
lawrence rust | 2e4e98e | 2010-08-25 09:50:20 -0300 | [diff] [blame] | 765 | static const u8 samsung_smt_7020_inittab[] = { |
Dirk Herrendoerfer | 4f3ca2f1 | 2010-02-11 18:06:34 -0300 | [diff] [blame] | 766 | 0x01, 0x15, |
| 767 | 0x02, 0x00, |
| 768 | 0x03, 0x00, |
| 769 | 0x04, 0x7D, |
| 770 | 0x05, 0x0F, |
| 771 | 0x06, 0x02, |
| 772 | 0x07, 0x00, |
| 773 | 0x08, 0x60, |
| 774 | |
| 775 | 0x0A, 0xC2, |
| 776 | 0x0B, 0x00, |
| 777 | 0x0C, 0x01, |
| 778 | 0x0D, 0x81, |
| 779 | 0x0E, 0x44, |
| 780 | 0x0F, 0x09, |
| 781 | 0x10, 0x3C, |
| 782 | 0x11, 0x84, |
| 783 | 0x12, 0xDA, |
| 784 | 0x13, 0x99, |
| 785 | 0x14, 0x8D, |
| 786 | 0x15, 0xCE, |
| 787 | 0x16, 0xE8, |
| 788 | 0x17, 0x43, |
| 789 | 0x18, 0x1C, |
| 790 | 0x19, 0x1B, |
| 791 | 0x1A, 0x1D, |
| 792 | |
| 793 | 0x1C, 0x12, |
| 794 | 0x1D, 0x00, |
| 795 | 0x1E, 0x00, |
| 796 | 0x1F, 0x00, |
| 797 | 0x20, 0x00, |
| 798 | 0x21, 0x00, |
| 799 | 0x22, 0x00, |
| 800 | 0x23, 0x00, |
| 801 | |
| 802 | 0x28, 0x02, |
| 803 | 0x29, 0x28, |
| 804 | 0x2A, 0x14, |
| 805 | 0x2B, 0x0F, |
| 806 | 0x2C, 0x09, |
| 807 | 0x2D, 0x05, |
| 808 | |
| 809 | 0x31, 0x1F, |
| 810 | 0x32, 0x19, |
| 811 | 0x33, 0xFC, |
| 812 | 0x34, 0x13, |
| 813 | 0xff, 0xff, |
| 814 | }; |
| 815 | |
| 816 | |
| 817 | static int samsung_smt_7020_tuner_set_params(struct dvb_frontend *fe, |
| 818 | struct dvb_frontend_parameters *params) |
| 819 | { |
| 820 | struct cx8802_dev *dev = fe->dvb->priv; |
| 821 | u8 buf[4]; |
| 822 | u32 div; |
| 823 | struct i2c_msg msg = { |
| 824 | .addr = 0x61, |
| 825 | .flags = 0, |
| 826 | .buf = buf, |
| 827 | .len = sizeof(buf) }; |
| 828 | |
| 829 | div = params->frequency / 125; |
| 830 | |
| 831 | buf[0] = (div >> 8) & 0x7f; |
| 832 | buf[1] = div & 0xff; |
| 833 | buf[2] = 0x84; /* 0xC4 */ |
| 834 | buf[3] = 0x00; |
| 835 | |
| 836 | if (params->frequency < 1500000) |
| 837 | buf[3] |= 0x10; |
| 838 | |
| 839 | if (fe->ops.i2c_gate_ctrl) |
| 840 | fe->ops.i2c_gate_ctrl(fe, 1); |
| 841 | |
| 842 | if (i2c_transfer(&dev->core->i2c_adap, &msg, 1) != 1) |
| 843 | return -EIO; |
| 844 | |
| 845 | return 0; |
| 846 | } |
| 847 | |
| 848 | static int samsung_smt_7020_set_tone(struct dvb_frontend *fe, |
| 849 | fe_sec_tone_mode_t tone) |
| 850 | { |
| 851 | struct cx8802_dev *dev = fe->dvb->priv; |
| 852 | struct cx88_core *core = dev->core; |
| 853 | |
| 854 | cx_set(MO_GP0_IO, 0x0800); |
| 855 | |
| 856 | switch (tone) { |
| 857 | case SEC_TONE_ON: |
| 858 | cx_set(MO_GP0_IO, 0x08); |
| 859 | break; |
| 860 | case SEC_TONE_OFF: |
| 861 | cx_clear(MO_GP0_IO, 0x08); |
| 862 | break; |
| 863 | default: |
| 864 | return -EINVAL; |
| 865 | } |
| 866 | |
| 867 | return 0; |
| 868 | } |
| 869 | |
| 870 | static int samsung_smt_7020_set_voltage(struct dvb_frontend *fe, |
| 871 | fe_sec_voltage_t voltage) |
| 872 | { |
| 873 | struct cx8802_dev *dev = fe->dvb->priv; |
| 874 | struct cx88_core *core = dev->core; |
| 875 | |
| 876 | u8 data; |
| 877 | struct i2c_msg msg = { |
| 878 | .addr = 8, |
| 879 | .flags = 0, |
| 880 | .buf = &data, |
| 881 | .len = sizeof(data) }; |
| 882 | |
| 883 | cx_set(MO_GP0_IO, 0x8000); |
| 884 | |
| 885 | switch (voltage) { |
| 886 | case SEC_VOLTAGE_OFF: |
| 887 | break; |
| 888 | case SEC_VOLTAGE_13: |
| 889 | data = ISL6421_EN1 | ISL6421_LLC1; |
| 890 | cx_clear(MO_GP0_IO, 0x80); |
| 891 | break; |
| 892 | case SEC_VOLTAGE_18: |
| 893 | data = ISL6421_EN1 | ISL6421_LLC1 | ISL6421_VSEL1; |
| 894 | cx_clear(MO_GP0_IO, 0x80); |
| 895 | break; |
| 896 | default: |
| 897 | return -EINVAL; |
| 898 | }; |
| 899 | |
| 900 | return (i2c_transfer(&dev->core->i2c_adap, &msg, 1) == 1) ? 0 : -EIO; |
| 901 | } |
| 902 | |
| 903 | static int samsung_smt_7020_stv0299_set_symbol_rate(struct dvb_frontend *fe, |
| 904 | u32 srate, u32 ratio) |
| 905 | { |
| 906 | u8 aclk = 0; |
| 907 | u8 bclk = 0; |
| 908 | |
| 909 | if (srate < 1500000) { |
| 910 | aclk = 0xb7; |
| 911 | bclk = 0x47; |
| 912 | } else if (srate < 3000000) { |
| 913 | aclk = 0xb7; |
| 914 | bclk = 0x4b; |
| 915 | } else if (srate < 7000000) { |
| 916 | aclk = 0xb7; |
| 917 | bclk = 0x4f; |
| 918 | } else if (srate < 14000000) { |
| 919 | aclk = 0xb7; |
| 920 | bclk = 0x53; |
| 921 | } else if (srate < 30000000) { |
| 922 | aclk = 0xb6; |
| 923 | bclk = 0x53; |
| 924 | } else if (srate < 45000000) { |
| 925 | aclk = 0xb4; |
| 926 | bclk = 0x51; |
| 927 | } |
| 928 | |
| 929 | stv0299_writereg(fe, 0x13, aclk); |
| 930 | stv0299_writereg(fe, 0x14, bclk); |
| 931 | stv0299_writereg(fe, 0x1f, (ratio >> 16) & 0xff); |
| 932 | stv0299_writereg(fe, 0x20, (ratio >> 8) & 0xff); |
| 933 | stv0299_writereg(fe, 0x21, ratio & 0xf0); |
| 934 | |
| 935 | return 0; |
| 936 | } |
| 937 | |
| 938 | |
lawrence rust | 2e4e98e | 2010-08-25 09:50:20 -0300 | [diff] [blame] | 939 | static const struct stv0299_config samsung_stv0299_config = { |
Dirk Herrendoerfer | 4f3ca2f1 | 2010-02-11 18:06:34 -0300 | [diff] [blame] | 940 | .demod_address = 0x68, |
| 941 | .inittab = samsung_smt_7020_inittab, |
| 942 | .mclk = 88000000UL, |
| 943 | .invert = 0, |
| 944 | .skip_reinit = 0, |
| 945 | .lock_output = STV0299_LOCKOUTPUT_LK, |
| 946 | .volt13_op0_op1 = STV0299_VOLT13_OP1, |
| 947 | .min_delay_ms = 100, |
| 948 | .set_symbol_rate = samsung_smt_7020_stv0299_set_symbol_rate, |
| 949 | }; |
| 950 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 951 | static int dvb_register(struct cx8802_dev *dev) |
| 952 | { |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 953 | struct cx88_core *core = dev->core; |
| 954 | struct videobuf_dvb_frontend *fe0, *fe1 = NULL; |
Darron Broad | 59b1842 | 2008-10-11 11:44:05 -0300 | [diff] [blame] | 955 | int mfe_shared = 0; /* bus not shared by default */ |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 956 | |
Matthias Schwarzott | 0e8bac9 | 2008-10-24 10:47:07 -0300 | [diff] [blame] | 957 | if (0 != core->i2c_rc) { |
| 958 | printk(KERN_ERR "%s/2: no i2c-bus available, cannot attach dvb drivers\n", core->name); |
| 959 | goto frontend_detach; |
| 960 | } |
| 961 | |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 962 | /* Get the first frontend */ |
| 963 | fe0 = videobuf_dvb_get_frontend(&dev->frontends, 1); |
| 964 | if (!fe0) |
Darron Broad | 60a5a92 | 2008-11-11 08:48:27 -0300 | [diff] [blame] | 965 | goto frontend_detach; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 966 | |
Darron Broad | 8e73909 | 2008-10-11 11:31:41 -0300 | [diff] [blame] | 967 | /* multi-frontend gate control is undefined or defaults to fe0 */ |
| 968 | dev->frontends.gate = 0; |
| 969 | |
Mauro Carvalho Chehab | e32fadc | 2009-01-06 16:06:07 -0300 | [diff] [blame] | 970 | /* Sets the gate control callback to be used by i2c command calls */ |
| 971 | core->gate_ctrl = cx88_dvb_gate_ctrl; |
| 972 | |
Darron Broad | 8e73909 | 2008-10-11 11:31:41 -0300 | [diff] [blame] | 973 | /* init frontend(s) */ |
Mauro Carvalho Chehab | 0590d91 | 2008-04-30 18:14:36 -0300 | [diff] [blame] | 974 | switch (core->boardnr) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 975 | case CX88_BOARD_HAUPPAUGE_DVB_T1: |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 976 | fe0->dvb.frontend = dvb_attach(cx22702_attach, |
Michael Krufky | ed35526 | 2006-12-05 01:34:56 -0300 | [diff] [blame] | 977 | &connexant_refboard_config, |
Mauro Carvalho Chehab | 0590d91 | 2008-04-30 18:14:36 -0300 | [diff] [blame] | 978 | &core->i2c_adap); |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 979 | if (fe0->dvb.frontend != NULL) { |
| 980 | if (!dvb_attach(dvb_pll_attach, fe0->dvb.frontend, |
Mauro Carvalho Chehab | 0590d91 | 2008-04-30 18:14:36 -0300 | [diff] [blame] | 981 | 0x61, &core->i2c_adap, |
| 982 | DVB_PLL_THOMSON_DTT759X)) |
| 983 | goto frontend_detach; |
Andrew de Quincey | f54376e | 2006-04-18 17:56:10 -0300 | [diff] [blame] | 984 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 985 | break; |
Michael Krufky | e057ee1 | 2005-07-07 17:58:40 -0700 | [diff] [blame] | 986 | case CX88_BOARD_TERRATEC_CINERGY_1400_DVB_T1: |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 987 | case CX88_BOARD_CONEXANT_DVB_T1: |
Manenti Marco | f39624f | 2006-01-09 15:32:45 -0200 | [diff] [blame] | 988 | case CX88_BOARD_KWORLD_DVB_T_CX22702: |
David Shirley | 2b5200a | 2005-11-08 21:37:22 -0800 | [diff] [blame] | 989 | case CX88_BOARD_WINFAST_DTV1000: |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 990 | fe0->dvb.frontend = dvb_attach(cx22702_attach, |
Michael Krufky | f7b54b1 | 2006-08-08 15:48:08 -0300 | [diff] [blame] | 991 | &connexant_refboard_config, |
Mauro Carvalho Chehab | 0590d91 | 2008-04-30 18:14:36 -0300 | [diff] [blame] | 992 | &core->i2c_adap); |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 993 | if (fe0->dvb.frontend != NULL) { |
| 994 | if (!dvb_attach(dvb_pll_attach, fe0->dvb.frontend, |
Mauro Carvalho Chehab | 0590d91 | 2008-04-30 18:14:36 -0300 | [diff] [blame] | 995 | 0x60, &core->i2c_adap, |
| 996 | DVB_PLL_THOMSON_DTT7579)) |
| 997 | goto frontend_detach; |
Andrew de Quincey | f54376e | 2006-04-18 17:56:10 -0300 | [diff] [blame] | 998 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 999 | break; |
Malcolm Valentine | 4bd6e9d | 2006-05-29 13:51:59 -0300 | [diff] [blame] | 1000 | case CX88_BOARD_WINFAST_DTV2000H: |
Vlastimil Labsky | 4d14c83 | 2009-08-10 22:15:54 -0300 | [diff] [blame] | 1001 | case CX88_BOARD_WINFAST_DTV2000H_J: |
Steven Toth | 611900c | 2006-01-09 15:25:12 -0200 | [diff] [blame] | 1002 | case CX88_BOARD_HAUPPAUGE_HVR1100: |
| 1003 | case CX88_BOARD_HAUPPAUGE_HVR1100LP: |
Trent Piepho | a5a2ecf | 2007-03-09 15:07:07 -0300 | [diff] [blame] | 1004 | case CX88_BOARD_HAUPPAUGE_HVR1300: |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 1005 | fe0->dvb.frontend = dvb_attach(cx22702_attach, |
Michael Krufky | ed35526 | 2006-12-05 01:34:56 -0300 | [diff] [blame] | 1006 | &hauppauge_hvr_config, |
Mauro Carvalho Chehab | 0590d91 | 2008-04-30 18:14:36 -0300 | [diff] [blame] | 1007 | &core->i2c_adap); |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 1008 | if (fe0->dvb.frontend != NULL) { |
| 1009 | if (!dvb_attach(simple_tuner_attach, fe0->dvb.frontend, |
Mauro Carvalho Chehab | 0590d91 | 2008-04-30 18:14:36 -0300 | [diff] [blame] | 1010 | &core->i2c_adap, 0x61, |
| 1011 | TUNER_PHILIPS_FMD1216ME_MK3)) |
| 1012 | goto frontend_detach; |
Andrew de Quincey | f54376e | 2006-04-18 17:56:10 -0300 | [diff] [blame] | 1013 | } |
Steven Toth | 611900c | 2006-01-09 15:25:12 -0200 | [diff] [blame] | 1014 | break; |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 1015 | case CX88_BOARD_HAUPPAUGE_HVR3000: |
Darron Broad | 60a5a92 | 2008-11-11 08:48:27 -0300 | [diff] [blame] | 1016 | /* MFE frontend 1 */ |
| 1017 | mfe_shared = 1; |
| 1018 | dev->frontends.gate = 2; |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 1019 | /* DVB-S init */ |
| 1020 | fe0->dvb.frontend = dvb_attach(cx24123_attach, |
Darron Broad | 60a5a92 | 2008-11-11 08:48:27 -0300 | [diff] [blame] | 1021 | &hauppauge_novas_config, |
| 1022 | &dev->core->i2c_adap); |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 1023 | if (fe0->dvb.frontend) { |
Darron Broad | 60a5a92 | 2008-11-11 08:48:27 -0300 | [diff] [blame] | 1024 | if (!dvb_attach(isl6421_attach, |
| 1025 | fe0->dvb.frontend, |
| 1026 | &dev->core->i2c_adap, |
| 1027 | 0x08, ISL6421_DCL, 0x00)) |
| 1028 | goto frontend_detach; |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 1029 | } |
Darron Broad | 60a5a92 | 2008-11-11 08:48:27 -0300 | [diff] [blame] | 1030 | /* MFE frontend 2 */ |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 1031 | fe1 = videobuf_dvb_get_frontend(&dev->frontends, 2); |
Darron Broad | 60a5a92 | 2008-11-11 08:48:27 -0300 | [diff] [blame] | 1032 | if (!fe1) |
| 1033 | goto frontend_detach; |
| 1034 | /* DVB-T init */ |
| 1035 | fe1->dvb.frontend = dvb_attach(cx22702_attach, |
| 1036 | &hauppauge_hvr_config, |
| 1037 | &dev->core->i2c_adap); |
| 1038 | if (fe1->dvb.frontend) { |
| 1039 | fe1->dvb.frontend->id = 1; |
| 1040 | if (!dvb_attach(simple_tuner_attach, |
| 1041 | fe1->dvb.frontend, |
| 1042 | &dev->core->i2c_adap, |
| 1043 | 0x61, TUNER_PHILIPS_FMD1216ME_MK3)) |
| 1044 | goto frontend_detach; |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 1045 | } |
| 1046 | break; |
Chris Pascoe | 780dfef | 2006-02-28 08:34:59 -0300 | [diff] [blame] | 1047 | case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_PLUS: |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 1048 | fe0->dvb.frontend = dvb_attach(mt352_attach, |
Michael Krufky | f7b54b1 | 2006-08-08 15:48:08 -0300 | [diff] [blame] | 1049 | &dvico_fusionhdtv, |
Mauro Carvalho Chehab | 0590d91 | 2008-04-30 18:14:36 -0300 | [diff] [blame] | 1050 | &core->i2c_adap); |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 1051 | if (fe0->dvb.frontend != NULL) { |
| 1052 | if (!dvb_attach(dvb_pll_attach, fe0->dvb.frontend, |
Mauro Carvalho Chehab | 0590d91 | 2008-04-30 18:14:36 -0300 | [diff] [blame] | 1053 | 0x60, NULL, DVB_PLL_THOMSON_DTT7579)) |
| 1054 | goto frontend_detach; |
Chris Pascoe | 780dfef | 2006-02-28 08:34:59 -0300 | [diff] [blame] | 1055 | break; |
Andrew de Quincey | f54376e | 2006-04-18 17:56:10 -0300 | [diff] [blame] | 1056 | } |
Chris Pascoe | 780dfef | 2006-02-28 08:34:59 -0300 | [diff] [blame] | 1057 | /* ZL10353 replaces MT352 on later cards */ |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 1058 | fe0->dvb.frontend = dvb_attach(zl10353_attach, |
Michael Krufky | f7b54b1 | 2006-08-08 15:48:08 -0300 | [diff] [blame] | 1059 | &dvico_fusionhdtv_plus_v1_1, |
Mauro Carvalho Chehab | 0590d91 | 2008-04-30 18:14:36 -0300 | [diff] [blame] | 1060 | &core->i2c_adap); |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 1061 | if (fe0->dvb.frontend != NULL) { |
| 1062 | if (!dvb_attach(dvb_pll_attach, fe0->dvb.frontend, |
Mauro Carvalho Chehab | 0590d91 | 2008-04-30 18:14:36 -0300 | [diff] [blame] | 1063 | 0x60, NULL, DVB_PLL_THOMSON_DTT7579)) |
| 1064 | goto frontend_detach; |
Andrew de Quincey | f54376e | 2006-04-18 17:56:10 -0300 | [diff] [blame] | 1065 | } |
Chris Pascoe | 780dfef | 2006-02-28 08:34:59 -0300 | [diff] [blame] | 1066 | break; |
Michael Krufky | c2af3cd | 2006-06-12 14:06:22 -0300 | [diff] [blame] | 1067 | case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_DUAL: |
Michael Krufky | c2af3cd | 2006-06-12 14:06:22 -0300 | [diff] [blame] | 1068 | /* The tin box says DEE1601, but it seems to be DTT7579 |
| 1069 | * compatible, with a slightly different MT352 AGC gain. */ |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 1070 | fe0->dvb.frontend = dvb_attach(mt352_attach, |
Michael Krufky | f7b54b1 | 2006-08-08 15:48:08 -0300 | [diff] [blame] | 1071 | &dvico_fusionhdtv_dual, |
Mauro Carvalho Chehab | 0590d91 | 2008-04-30 18:14:36 -0300 | [diff] [blame] | 1072 | &core->i2c_adap); |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 1073 | if (fe0->dvb.frontend != NULL) { |
| 1074 | if (!dvb_attach(dvb_pll_attach, fe0->dvb.frontend, |
Mauro Carvalho Chehab | 0590d91 | 2008-04-30 18:14:36 -0300 | [diff] [blame] | 1075 | 0x61, NULL, DVB_PLL_THOMSON_DTT7579)) |
| 1076 | goto frontend_detach; |
Michael Krufky | c2af3cd | 2006-06-12 14:06:22 -0300 | [diff] [blame] | 1077 | break; |
| 1078 | } |
Michael Krufky | c2af3cd | 2006-06-12 14:06:22 -0300 | [diff] [blame] | 1079 | /* ZL10353 replaces MT352 on later cards */ |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 1080 | fe0->dvb.frontend = dvb_attach(zl10353_attach, |
Michael Krufky | f7b54b1 | 2006-08-08 15:48:08 -0300 | [diff] [blame] | 1081 | &dvico_fusionhdtv_plus_v1_1, |
Mauro Carvalho Chehab | 0590d91 | 2008-04-30 18:14:36 -0300 | [diff] [blame] | 1082 | &core->i2c_adap); |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 1083 | if (fe0->dvb.frontend != NULL) { |
| 1084 | if (!dvb_attach(dvb_pll_attach, fe0->dvb.frontend, |
Mauro Carvalho Chehab | 0590d91 | 2008-04-30 18:14:36 -0300 | [diff] [blame] | 1085 | 0x61, NULL, DVB_PLL_THOMSON_DTT7579)) |
| 1086 | goto frontend_detach; |
Michael Krufky | c2af3cd | 2006-06-12 14:06:22 -0300 | [diff] [blame] | 1087 | } |
Michael Krufky | c2af3cd | 2006-06-12 14:06:22 -0300 | [diff] [blame] | 1088 | break; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1089 | case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T1: |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 1090 | fe0->dvb.frontend = dvb_attach(mt352_attach, |
Michael Krufky | f7b54b1 | 2006-08-08 15:48:08 -0300 | [diff] [blame] | 1091 | &dvico_fusionhdtv, |
Mauro Carvalho Chehab | 0590d91 | 2008-04-30 18:14:36 -0300 | [diff] [blame] | 1092 | &core->i2c_adap); |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 1093 | if (fe0->dvb.frontend != NULL) { |
| 1094 | if (!dvb_attach(dvb_pll_attach, fe0->dvb.frontend, |
Mauro Carvalho Chehab | 0590d91 | 2008-04-30 18:14:36 -0300 | [diff] [blame] | 1095 | 0x61, NULL, DVB_PLL_LG_Z201)) |
| 1096 | goto frontend_detach; |
Andrew de Quincey | f54376e | 2006-04-18 17:56:10 -0300 | [diff] [blame] | 1097 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1098 | break; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1099 | case CX88_BOARD_KWORLD_DVB_T: |
| 1100 | case CX88_BOARD_DNTV_LIVE_DVB_T: |
Mauro Carvalho Chehab | a82decf | 2005-07-07 17:58:36 -0700 | [diff] [blame] | 1101 | case CX88_BOARD_ADSTECH_DVB_T_PCI: |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 1102 | fe0->dvb.frontend = dvb_attach(mt352_attach, |
Michael Krufky | f7b54b1 | 2006-08-08 15:48:08 -0300 | [diff] [blame] | 1103 | &dntv_live_dvbt_config, |
Mauro Carvalho Chehab | 0590d91 | 2008-04-30 18:14:36 -0300 | [diff] [blame] | 1104 | &core->i2c_adap); |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 1105 | if (fe0->dvb.frontend != NULL) { |
| 1106 | if (!dvb_attach(dvb_pll_attach, fe0->dvb.frontend, |
Mauro Carvalho Chehab | 0590d91 | 2008-04-30 18:14:36 -0300 | [diff] [blame] | 1107 | 0x61, NULL, DVB_PLL_UNKNOWN_1)) |
| 1108 | goto frontend_detach; |
Andrew de Quincey | f54376e | 2006-04-18 17:56:10 -0300 | [diff] [blame] | 1109 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1110 | break; |
Chris Pascoe | fc40b26 | 2006-01-09 15:25:35 -0200 | [diff] [blame] | 1111 | case CX88_BOARD_DNTV_LIVE_DVB_T_PRO: |
Trent Piepho | ecf854d | 2007-05-05 20:11:32 -0300 | [diff] [blame] | 1112 | #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] | 1113 | /* MT352 is on a secondary I2C bus made from some GPIO lines */ |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 1114 | fe0->dvb.frontend = dvb_attach(mt352_attach, &dntv_live_dvbt_pro_config, |
Trent Piepho | f0ad909 | 2007-10-14 02:52:16 -0300 | [diff] [blame] | 1115 | &dev->vp3054->adap); |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 1116 | if (fe0->dvb.frontend != NULL) { |
| 1117 | if (!dvb_attach(simple_tuner_attach, fe0->dvb.frontend, |
Mauro Carvalho Chehab | 0590d91 | 2008-04-30 18:14:36 -0300 | [diff] [blame] | 1118 | &core->i2c_adap, 0x61, |
| 1119 | TUNER_PHILIPS_FMD1216ME_MK3)) |
| 1120 | goto frontend_detach; |
Andrew de Quincey | f54376e | 2006-04-18 17:56:10 -0300 | [diff] [blame] | 1121 | } |
Chris Pascoe | fc40b26 | 2006-01-09 15:25:35 -0200 | [diff] [blame] | 1122 | #else |
Mauro Carvalho Chehab | 0590d91 | 2008-04-30 18:14:36 -0300 | [diff] [blame] | 1123 | printk(KERN_ERR "%s/2: built without vp3054 support\n", |
| 1124 | core->name); |
Chris Pascoe | fc40b26 | 2006-01-09 15:25:35 -0200 | [diff] [blame] | 1125 | #endif |
| 1126 | break; |
Chris Pascoe | 780dfef | 2006-02-28 08:34:59 -0300 | [diff] [blame] | 1127 | case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_HYBRID: |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 1128 | fe0->dvb.frontend = dvb_attach(zl10353_attach, |
Michael Krufky | f7b54b1 | 2006-08-08 15:48:08 -0300 | [diff] [blame] | 1129 | &dvico_fusionhdtv_hybrid, |
Mauro Carvalho Chehab | 0590d91 | 2008-04-30 18:14:36 -0300 | [diff] [blame] | 1130 | &core->i2c_adap); |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 1131 | if (fe0->dvb.frontend != NULL) { |
| 1132 | if (!dvb_attach(simple_tuner_attach, fe0->dvb.frontend, |
Mauro Carvalho Chehab | 0590d91 | 2008-04-30 18:14:36 -0300 | [diff] [blame] | 1133 | &core->i2c_adap, 0x61, |
| 1134 | TUNER_THOMSON_FE6600)) |
| 1135 | goto frontend_detach; |
Andrew de Quincey | f54376e | 2006-04-18 17:56:10 -0300 | [diff] [blame] | 1136 | } |
Chris Pascoe | 780dfef | 2006-02-28 08:34:59 -0300 | [diff] [blame] | 1137 | break; |
Chris Pascoe | b3fb91d | 2008-04-22 14:45:15 -0300 | [diff] [blame] | 1138 | case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_PRO: |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 1139 | fe0->dvb.frontend = dvb_attach(zl10353_attach, |
Chris Pascoe | b3fb91d | 2008-04-22 14:45:15 -0300 | [diff] [blame] | 1140 | &dvico_fusionhdtv_xc3028, |
Mauro Carvalho Chehab | 0590d91 | 2008-04-30 18:14:36 -0300 | [diff] [blame] | 1141 | &core->i2c_adap); |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 1142 | if (fe0->dvb.frontend == NULL) |
| 1143 | fe0->dvb.frontend = dvb_attach(mt352_attach, |
Chris Pascoe | b3fb91d | 2008-04-22 14:45:15 -0300 | [diff] [blame] | 1144 | &dvico_fusionhdtv_mt352_xc3028, |
Mauro Carvalho Chehab | 0590d91 | 2008-04-30 18:14:36 -0300 | [diff] [blame] | 1145 | &core->i2c_adap); |
Chris Pascoe | 8765561 | 2008-04-22 14:45:15 -0300 | [diff] [blame] | 1146 | /* |
| 1147 | * On this board, the demod provides the I2C bus pullup. |
| 1148 | * We must not permit gate_ctrl to be performed, or |
| 1149 | * the xc3028 cannot communicate on the bus. |
| 1150 | */ |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 1151 | if (fe0->dvb.frontend) |
| 1152 | fe0->dvb.frontend->ops.i2c_gate_ctrl = NULL; |
Mauro Carvalho Chehab | 23fb348 | 2008-04-22 14:45:30 -0300 | [diff] [blame] | 1153 | if (attach_xc3028(0x61, dev) < 0) |
Darron Broad | becd430 | 2008-10-21 11:47:50 -0300 | [diff] [blame] | 1154 | goto frontend_detach; |
Chris Pascoe | b3fb91d | 2008-04-22 14:45:15 -0300 | [diff] [blame] | 1155 | break; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1156 | case CX88_BOARD_PCHDTV_HD3000: |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 1157 | fe0->dvb.frontend = dvb_attach(or51132_attach, &pchdtv_hd3000, |
Mauro Carvalho Chehab | 0590d91 | 2008-04-30 18:14:36 -0300 | [diff] [blame] | 1158 | &core->i2c_adap); |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 1159 | if (fe0->dvb.frontend != NULL) { |
| 1160 | if (!dvb_attach(simple_tuner_attach, fe0->dvb.frontend, |
Mauro Carvalho Chehab | 0590d91 | 2008-04-30 18:14:36 -0300 | [diff] [blame] | 1161 | &core->i2c_adap, 0x61, |
| 1162 | TUNER_THOMSON_DTT761X)) |
| 1163 | goto frontend_detach; |
Andrew de Quincey | f54376e | 2006-04-18 17:56:10 -0300 | [diff] [blame] | 1164 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1165 | break; |
Michael Krufky | f179849 | 2005-07-07 17:58:39 -0700 | [diff] [blame] | 1166 | case CX88_BOARD_DVICO_FUSIONHDTV_3_GOLD_Q: |
| 1167 | dev->ts_gen_cntrl = 0x08; |
Michael Krufky | f179849 | 2005-07-07 17:58:39 -0700 | [diff] [blame] | 1168 | |
Mauro Carvalho Chehab | 0590d91 | 2008-04-30 18:14:36 -0300 | [diff] [blame] | 1169 | /* Do a hardware reset of chip before using it. */ |
Michael Krufky | f179849 | 2005-07-07 17:58:39 -0700 | [diff] [blame] | 1170 | cx_clear(MO_GP0_IO, 1); |
| 1171 | mdelay(100); |
Michael Krufky | 0ccef6d | 2005-07-27 11:45:55 -0700 | [diff] [blame] | 1172 | cx_set(MO_GP0_IO, 1); |
Michael Krufky | f179849 | 2005-07-07 17:58:39 -0700 | [diff] [blame] | 1173 | mdelay(200); |
Michael Krufky | 0ccef6d | 2005-07-27 11:45:55 -0700 | [diff] [blame] | 1174 | |
| 1175 | /* Select RF connector callback */ |
Michael Krufky | 6ddcc91 | 2005-07-27 11:46:00 -0700 | [diff] [blame] | 1176 | fusionhdtv_3_gold.pll_rf_set = lgdt330x_pll_rf_set; |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 1177 | fe0->dvb.frontend = dvb_attach(lgdt330x_attach, |
Michael Krufky | f7b54b1 | 2006-08-08 15:48:08 -0300 | [diff] [blame] | 1178 | &fusionhdtv_3_gold, |
Mauro Carvalho Chehab | 0590d91 | 2008-04-30 18:14:36 -0300 | [diff] [blame] | 1179 | &core->i2c_adap); |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 1180 | if (fe0->dvb.frontend != NULL) { |
| 1181 | if (!dvb_attach(simple_tuner_attach, fe0->dvb.frontend, |
Mauro Carvalho Chehab | 0590d91 | 2008-04-30 18:14:36 -0300 | [diff] [blame] | 1182 | &core->i2c_adap, 0x61, |
| 1183 | TUNER_MICROTUNE_4042FI5)) |
| 1184 | goto frontend_detach; |
Michael Krufky | f179849 | 2005-07-07 17:58:39 -0700 | [diff] [blame] | 1185 | } |
| 1186 | break; |
Michael Krufky | 0d723c0 | 2005-07-07 17:58:42 -0700 | [diff] [blame] | 1187 | case CX88_BOARD_DVICO_FUSIONHDTV_3_GOLD_T: |
| 1188 | dev->ts_gen_cntrl = 0x08; |
Michael Krufky | 0d723c0 | 2005-07-07 17:58:42 -0700 | [diff] [blame] | 1189 | |
Mauro Carvalho Chehab | 0590d91 | 2008-04-30 18:14:36 -0300 | [diff] [blame] | 1190 | /* Do a hardware reset of chip before using it. */ |
Michael Krufky | 0d723c0 | 2005-07-07 17:58:42 -0700 | [diff] [blame] | 1191 | cx_clear(MO_GP0_IO, 1); |
| 1192 | mdelay(100); |
Michael Krufky | d975872 | 2005-07-27 11:45:56 -0700 | [diff] [blame] | 1193 | cx_set(MO_GP0_IO, 9); |
Michael Krufky | 0d723c0 | 2005-07-07 17:58:42 -0700 | [diff] [blame] | 1194 | mdelay(200); |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 1195 | fe0->dvb.frontend = dvb_attach(lgdt330x_attach, |
Michael Krufky | f7b54b1 | 2006-08-08 15:48:08 -0300 | [diff] [blame] | 1196 | &fusionhdtv_3_gold, |
Mauro Carvalho Chehab | 0590d91 | 2008-04-30 18:14:36 -0300 | [diff] [blame] | 1197 | &core->i2c_adap); |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 1198 | if (fe0->dvb.frontend != NULL) { |
| 1199 | if (!dvb_attach(simple_tuner_attach, fe0->dvb.frontend, |
Mauro Carvalho Chehab | 0590d91 | 2008-04-30 18:14:36 -0300 | [diff] [blame] | 1200 | &core->i2c_adap, 0x61, |
| 1201 | TUNER_THOMSON_DTT761X)) |
| 1202 | goto frontend_detach; |
Michael Krufky | 0d723c0 | 2005-07-07 17:58:42 -0700 | [diff] [blame] | 1203 | } |
| 1204 | break; |
Mauro Carvalho Chehab | e52e98a | 2005-09-09 13:03:41 -0700 | [diff] [blame] | 1205 | case CX88_BOARD_DVICO_FUSIONHDTV_5_GOLD: |
| 1206 | dev->ts_gen_cntrl = 0x08; |
Mauro Carvalho Chehab | e52e98a | 2005-09-09 13:03:41 -0700 | [diff] [blame] | 1207 | |
Mauro Carvalho Chehab | 0590d91 | 2008-04-30 18:14:36 -0300 | [diff] [blame] | 1208 | /* Do a hardware reset of chip before using it. */ |
Mauro Carvalho Chehab | e52e98a | 2005-09-09 13:03:41 -0700 | [diff] [blame] | 1209 | cx_clear(MO_GP0_IO, 1); |
| 1210 | mdelay(100); |
| 1211 | cx_set(MO_GP0_IO, 1); |
| 1212 | mdelay(200); |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 1213 | fe0->dvb.frontend = dvb_attach(lgdt330x_attach, |
Michael Krufky | f7b54b1 | 2006-08-08 15:48:08 -0300 | [diff] [blame] | 1214 | &fusionhdtv_5_gold, |
Mauro Carvalho Chehab | 0590d91 | 2008-04-30 18:14:36 -0300 | [diff] [blame] | 1215 | &core->i2c_adap); |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 1216 | if (fe0->dvb.frontend != NULL) { |
| 1217 | if (!dvb_attach(simple_tuner_attach, fe0->dvb.frontend, |
Mauro Carvalho Chehab | 0590d91 | 2008-04-30 18:14:36 -0300 | [diff] [blame] | 1218 | &core->i2c_adap, 0x61, |
| 1219 | TUNER_LG_TDVS_H06XF)) |
| 1220 | goto frontend_detach; |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 1221 | if (!dvb_attach(tda9887_attach, fe0->dvb.frontend, |
Mauro Carvalho Chehab | 0590d91 | 2008-04-30 18:14:36 -0300 | [diff] [blame] | 1222 | &core->i2c_adap, 0x43)) |
| 1223 | goto frontend_detach; |
Mauro Carvalho Chehab | e52e98a | 2005-09-09 13:03:41 -0700 | [diff] [blame] | 1224 | } |
| 1225 | break; |
Rusty Scott | da215d2 | 2006-04-07 02:21:31 -0300 | [diff] [blame] | 1226 | case CX88_BOARD_PCHDTV_HD5500: |
| 1227 | dev->ts_gen_cntrl = 0x08; |
Rusty Scott | da215d2 | 2006-04-07 02:21:31 -0300 | [diff] [blame] | 1228 | |
Mauro Carvalho Chehab | 0590d91 | 2008-04-30 18:14:36 -0300 | [diff] [blame] | 1229 | /* Do a hardware reset of chip before using it. */ |
Rusty Scott | da215d2 | 2006-04-07 02:21:31 -0300 | [diff] [blame] | 1230 | cx_clear(MO_GP0_IO, 1); |
| 1231 | mdelay(100); |
| 1232 | cx_set(MO_GP0_IO, 1); |
| 1233 | mdelay(200); |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 1234 | fe0->dvb.frontend = dvb_attach(lgdt330x_attach, |
Michael Krufky | f7b54b1 | 2006-08-08 15:48:08 -0300 | [diff] [blame] | 1235 | &pchdtv_hd5500, |
Mauro Carvalho Chehab | 0590d91 | 2008-04-30 18:14:36 -0300 | [diff] [blame] | 1236 | &core->i2c_adap); |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 1237 | if (fe0->dvb.frontend != NULL) { |
| 1238 | if (!dvb_attach(simple_tuner_attach, fe0->dvb.frontend, |
Mauro Carvalho Chehab | 0590d91 | 2008-04-30 18:14:36 -0300 | [diff] [blame] | 1239 | &core->i2c_adap, 0x61, |
| 1240 | TUNER_LG_TDVS_H06XF)) |
| 1241 | goto frontend_detach; |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 1242 | if (!dvb_attach(tda9887_attach, fe0->dvb.frontend, |
Mauro Carvalho Chehab | 0590d91 | 2008-04-30 18:14:36 -0300 | [diff] [blame] | 1243 | &core->i2c_adap, 0x43)) |
| 1244 | goto frontend_detach; |
Rusty Scott | da215d2 | 2006-04-07 02:21:31 -0300 | [diff] [blame] | 1245 | } |
| 1246 | break; |
Kirk Lapray | fde6d31 | 2005-11-08 21:38:18 -0800 | [diff] [blame] | 1247 | case CX88_BOARD_ATI_HDTVWONDER: |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 1248 | fe0->dvb.frontend = dvb_attach(nxt200x_attach, |
Michael Krufky | f7b54b1 | 2006-08-08 15:48:08 -0300 | [diff] [blame] | 1249 | &ati_hdtvwonder, |
Mauro Carvalho Chehab | 0590d91 | 2008-04-30 18:14:36 -0300 | [diff] [blame] | 1250 | &core->i2c_adap); |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 1251 | if (fe0->dvb.frontend != NULL) { |
| 1252 | if (!dvb_attach(simple_tuner_attach, fe0->dvb.frontend, |
Mauro Carvalho Chehab | 0590d91 | 2008-04-30 18:14:36 -0300 | [diff] [blame] | 1253 | &core->i2c_adap, 0x61, |
| 1254 | TUNER_PHILIPS_TUV1236D)) |
| 1255 | goto frontend_detach; |
Andrew de Quincey | f54376e | 2006-04-18 17:56:10 -0300 | [diff] [blame] | 1256 | } |
Kirk Lapray | fde6d31 | 2005-11-08 21:38:18 -0800 | [diff] [blame] | 1257 | break; |
Steven Toth | 0fa14aa | 2006-01-09 15:25:02 -0200 | [diff] [blame] | 1258 | case CX88_BOARD_HAUPPAUGE_NOVASPLUS_S1: |
| 1259 | case CX88_BOARD_HAUPPAUGE_NOVASE2_S1: |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 1260 | fe0->dvb.frontend = dvb_attach(cx24123_attach, |
Michael Krufky | f7b54b1 | 2006-08-08 15:48:08 -0300 | [diff] [blame] | 1261 | &hauppauge_novas_config, |
Mauro Carvalho Chehab | 0590d91 | 2008-04-30 18:14:36 -0300 | [diff] [blame] | 1262 | &core->i2c_adap); |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 1263 | if (fe0->dvb.frontend) { |
| 1264 | if (!dvb_attach(isl6421_attach, fe0->dvb.frontend, |
Steven Toth | 83fe92e | 2008-09-13 19:22:15 -0300 | [diff] [blame] | 1265 | &core->i2c_adap, 0x08, ISL6421_DCL, 0x00)) |
Mauro Carvalho Chehab | 0590d91 | 2008-04-30 18:14:36 -0300 | [diff] [blame] | 1266 | goto frontend_detach; |
Andrew de Quincey | cd20ca9 | 2006-05-12 20:31:51 -0300 | [diff] [blame] | 1267 | } |
Steven Toth | 0fa14aa | 2006-01-09 15:25:02 -0200 | [diff] [blame] | 1268 | break; |
Vadim Catana | 0e0351e | 2006-01-09 15:25:02 -0200 | [diff] [blame] | 1269 | case CX88_BOARD_KWORLD_DVBS_100: |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 1270 | fe0->dvb.frontend = dvb_attach(cx24123_attach, |
Michael Krufky | f7b54b1 | 2006-08-08 15:48:08 -0300 | [diff] [blame] | 1271 | &kworld_dvbs_100_config, |
Mauro Carvalho Chehab | 0590d91 | 2008-04-30 18:14:36 -0300 | [diff] [blame] | 1272 | &core->i2c_adap); |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 1273 | if (fe0->dvb.frontend) { |
| 1274 | core->prev_set_voltage = fe0->dvb.frontend->ops.set_voltage; |
| 1275 | fe0->dvb.frontend->ops.set_voltage = kworld_dvbs_100_set_voltage; |
Andrew de Quincey | cd20ca9 | 2006-05-12 20:31:51 -0300 | [diff] [blame] | 1276 | } |
Vadim Catana | 0e0351e | 2006-01-09 15:25:02 -0200 | [diff] [blame] | 1277 | break; |
Saqeb Akhter | c02a34f | 2006-06-29 20:29:33 -0300 | [diff] [blame] | 1278 | case CX88_BOARD_GENIATECH_DVBS: |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 1279 | fe0->dvb.frontend = dvb_attach(cx24123_attach, |
Michael Krufky | f7b54b1 | 2006-08-08 15:48:08 -0300 | [diff] [blame] | 1280 | &geniatech_dvbs_config, |
Mauro Carvalho Chehab | 0590d91 | 2008-04-30 18:14:36 -0300 | [diff] [blame] | 1281 | &core->i2c_adap); |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 1282 | if (fe0->dvb.frontend) { |
| 1283 | core->prev_set_voltage = fe0->dvb.frontend->ops.set_voltage; |
| 1284 | fe0->dvb.frontend->ops.set_voltage = geniatech_dvbs_set_voltage; |
Saqeb Akhter | c02a34f | 2006-06-29 20:29:33 -0300 | [diff] [blame] | 1285 | } |
| 1286 | break; |
Steven Toth | 60464da | 2008-01-05 16:53:01 -0300 | [diff] [blame] | 1287 | case CX88_BOARD_PINNACLE_PCTV_HD_800i: |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 1288 | fe0->dvb.frontend = dvb_attach(s5h1409_attach, |
Steven Toth | 60464da | 2008-01-05 16:53:01 -0300 | [diff] [blame] | 1289 | &pinnacle_pctv_hd_800i_config, |
Mauro Carvalho Chehab | 0590d91 | 2008-04-30 18:14:36 -0300 | [diff] [blame] | 1290 | &core->i2c_adap); |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 1291 | if (fe0->dvb.frontend != NULL) { |
| 1292 | if (!dvb_attach(xc5000_attach, fe0->dvb.frontend, |
Mauro Carvalho Chehab | 0590d91 | 2008-04-30 18:14:36 -0300 | [diff] [blame] | 1293 | &core->i2c_adap, |
Michael Krufky | 3065096 | 2008-09-06 14:56:58 -0300 | [diff] [blame] | 1294 | &pinnacle_pctv_hd_800i_tuner_config)) |
Mauro Carvalho Chehab | 0590d91 | 2008-04-30 18:14:36 -0300 | [diff] [blame] | 1295 | goto frontend_detach; |
Steven Toth | 60464da | 2008-01-05 16:53:01 -0300 | [diff] [blame] | 1296 | } |
| 1297 | break; |
Steven Toth | 5c00fac | 2008-04-22 14:45:14 -0300 | [diff] [blame] | 1298 | case CX88_BOARD_DVICO_FUSIONHDTV_5_PCI_NANO: |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 1299 | fe0->dvb.frontend = dvb_attach(s5h1409_attach, |
Steven Toth | 5c00fac | 2008-04-22 14:45:14 -0300 | [diff] [blame] | 1300 | &dvico_hdtv5_pci_nano_config, |
Mauro Carvalho Chehab | 0590d91 | 2008-04-30 18:14:36 -0300 | [diff] [blame] | 1301 | &core->i2c_adap); |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 1302 | if (fe0->dvb.frontend != NULL) { |
Steven Toth | 5c00fac | 2008-04-22 14:45:14 -0300 | [diff] [blame] | 1303 | struct dvb_frontend *fe; |
| 1304 | struct xc2028_config cfg = { |
Mauro Carvalho Chehab | 0590d91 | 2008-04-30 18:14:36 -0300 | [diff] [blame] | 1305 | .i2c_adap = &core->i2c_adap, |
Steven Toth | 5c00fac | 2008-04-22 14:45:14 -0300 | [diff] [blame] | 1306 | .i2c_addr = 0x61, |
Steven Toth | 5c00fac | 2008-04-22 14:45:14 -0300 | [diff] [blame] | 1307 | }; |
| 1308 | static struct xc2028_ctrl ctl = { |
Michael Krufky | ef80bfe | 2008-09-16 02:15:30 -0300 | [diff] [blame] | 1309 | .fname = XC2028_DEFAULT_FIRMWARE, |
Steven Toth | 5c00fac | 2008-04-22 14:45:14 -0300 | [diff] [blame] | 1310 | .max_len = 64, |
Mauro Carvalho Chehab | 33e5316 | 2008-04-21 06:58:48 -0300 | [diff] [blame] | 1311 | .scode_table = XC3028_FE_OREN538, |
Steven Toth | 5c00fac | 2008-04-22 14:45:14 -0300 | [diff] [blame] | 1312 | }; |
| 1313 | |
| 1314 | fe = dvb_attach(xc2028_attach, |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 1315 | fe0->dvb.frontend, &cfg); |
Steven Toth | 5c00fac | 2008-04-22 14:45:14 -0300 | [diff] [blame] | 1316 | if (fe != NULL && fe->ops.tuner_ops.set_config != NULL) |
| 1317 | fe->ops.tuner_ops.set_config(fe, &ctl); |
| 1318 | } |
| 1319 | break; |
Ricardo Maraschini | d49f7a2 | 2010-04-06 02:40:43 -0300 | [diff] [blame] | 1320 | case CX88_BOARD_PINNACLE_HYBRID_PCTV: |
Miroslav Sustek | 3047a17 | 2009-05-31 16:47:28 -0300 | [diff] [blame] | 1321 | case CX88_BOARD_WINFAST_DTV1800H: |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 1322 | fe0->dvb.frontend = dvb_attach(zl10353_attach, |
Stéphane Voltz | 3f6014f | 2008-09-05 14:33:54 -0300 | [diff] [blame] | 1323 | &cx88_pinnacle_hybrid_pctv, |
Mauro Carvalho Chehab | 0590d91 | 2008-04-30 18:14:36 -0300 | [diff] [blame] | 1324 | &core->i2c_adap); |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 1325 | if (fe0->dvb.frontend) { |
| 1326 | fe0->dvb.frontend->ops.i2c_gate_ctrl = NULL; |
Stéphane Voltz | 3f6014f | 2008-09-05 14:33:54 -0300 | [diff] [blame] | 1327 | if (attach_xc3028(0x61, dev) < 0) |
| 1328 | goto frontend_detach; |
| 1329 | } |
Mauro Carvalho Chehab | 9507901 | 2008-04-22 14:45:15 -0300 | [diff] [blame] | 1330 | break; |
istvan_v@mailbox.hu | 8eb79c0 | 2011-06-07 13:16:56 -0300 | [diff] [blame^] | 1331 | case CX88_BOARD_WINFAST_DTV1800H_XC4000: |
istvan_v@mailbox.hu | f271a3a | 2011-06-07 13:14:53 -0300 | [diff] [blame] | 1332 | case CX88_BOARD_WINFAST_DTV2000H_PLUS: |
| 1333 | fe0->dvb.frontend = dvb_attach(zl10353_attach, |
| 1334 | &cx88_pinnacle_hybrid_pctv, |
| 1335 | &core->i2c_adap); |
| 1336 | if (fe0->dvb.frontend) { |
| 1337 | struct xc4000_config cfg = { |
| 1338 | .i2c_address = 0x61, |
| 1339 | .default_pm = 0, |
| 1340 | .dvb_amplitude = 134, |
| 1341 | .set_smoothedcvbs = 1, |
| 1342 | .if_khz = 4560 |
| 1343 | }; |
| 1344 | fe0->dvb.frontend->ops.i2c_gate_ctrl = NULL; |
| 1345 | if (attach_xc4000(dev, &cfg) < 0) |
| 1346 | goto frontend_detach; |
| 1347 | } |
| 1348 | break; |
| 1349 | case CX88_BOARD_GENIATECH_X8000_MT: |
Mauro Carvalho Chehab | 99e09ea | 2008-03-27 23:18:30 -0300 | [diff] [blame] | 1350 | dev->ts_gen_cntrl = 0x00; |
Mauro Carvalho Chehab | 9507901 | 2008-04-22 14:45:15 -0300 | [diff] [blame] | 1351 | |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 1352 | fe0->dvb.frontend = dvb_attach(zl10353_attach, |
Mauro Carvalho Chehab | 9507901 | 2008-04-22 14:45:15 -0300 | [diff] [blame] | 1353 | &cx88_geniatech_x8000_mt, |
Mauro Carvalho Chehab | 0590d91 | 2008-04-30 18:14:36 -0300 | [diff] [blame] | 1354 | &core->i2c_adap); |
Mauro Carvalho Chehab | 23fb348 | 2008-04-22 14:45:30 -0300 | [diff] [blame] | 1355 | if (attach_xc3028(0x61, dev) < 0) |
Mauro Carvalho Chehab | 0590d91 | 2008-04-30 18:14:36 -0300 | [diff] [blame] | 1356 | goto frontend_detach; |
Mauro Carvalho Chehab | 9507901 | 2008-04-22 14:45:15 -0300 | [diff] [blame] | 1357 | break; |
Mauro Carvalho Chehab | 99e09ea | 2008-03-27 23:18:30 -0300 | [diff] [blame] | 1358 | case CX88_BOARD_KWORLD_ATSC_120: |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 1359 | fe0->dvb.frontend = dvb_attach(s5h1409_attach, |
Mauro Carvalho Chehab | 99e09ea | 2008-03-27 23:18:30 -0300 | [diff] [blame] | 1360 | &kworld_atsc_120_config, |
Mauro Carvalho Chehab | 0590d91 | 2008-04-30 18:14:36 -0300 | [diff] [blame] | 1361 | &core->i2c_adap); |
Mauro Carvalho Chehab | 99e09ea | 2008-03-27 23:18:30 -0300 | [diff] [blame] | 1362 | if (attach_xc3028(0x61, dev) < 0) |
Mauro Carvalho Chehab | 0590d91 | 2008-04-30 18:14:36 -0300 | [diff] [blame] | 1363 | goto frontend_detach; |
Mauro Carvalho Chehab | 99e09ea | 2008-03-27 23:18:30 -0300 | [diff] [blame] | 1364 | break; |
Steven Toth | d893d5d | 2008-04-25 03:46:43 -0300 | [diff] [blame] | 1365 | case CX88_BOARD_DVICO_FUSIONHDTV_7_GOLD: |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 1366 | fe0->dvb.frontend = dvb_attach(s5h1411_attach, |
Steven Toth | d893d5d | 2008-04-25 03:46:43 -0300 | [diff] [blame] | 1367 | &dvico_fusionhdtv7_config, |
Mauro Carvalho Chehab | 0590d91 | 2008-04-30 18:14:36 -0300 | [diff] [blame] | 1368 | &core->i2c_adap); |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 1369 | if (fe0->dvb.frontend != NULL) { |
| 1370 | if (!dvb_attach(xc5000_attach, fe0->dvb.frontend, |
Mauro Carvalho Chehab | 0590d91 | 2008-04-30 18:14:36 -0300 | [diff] [blame] | 1371 | &core->i2c_adap, |
Michael Krufky | 3065096 | 2008-09-06 14:56:58 -0300 | [diff] [blame] | 1372 | &dvico_fusionhdtv7_tuner_config)) |
Mauro Carvalho Chehab | 0590d91 | 2008-04-30 18:14:36 -0300 | [diff] [blame] | 1373 | goto frontend_detach; |
Steven Toth | d893d5d | 2008-04-25 03:46:43 -0300 | [diff] [blame] | 1374 | } |
| 1375 | break; |
Steven Toth | 5bd1b66 | 2008-09-04 01:17:33 -0300 | [diff] [blame] | 1376 | case CX88_BOARD_HAUPPAUGE_HVR4000: |
Darron Broad | 60a5a92 | 2008-11-11 08:48:27 -0300 | [diff] [blame] | 1377 | /* MFE frontend 1 */ |
| 1378 | mfe_shared = 1; |
| 1379 | dev->frontends.gate = 2; |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 1380 | /* DVB-S/S2 Init */ |
| 1381 | fe0->dvb.frontend = dvb_attach(cx24116_attach, |
Darron Broad | 60a5a92 | 2008-11-11 08:48:27 -0300 | [diff] [blame] | 1382 | &hauppauge_hvr4000_config, |
| 1383 | &dev->core->i2c_adap); |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 1384 | if (fe0->dvb.frontend) { |
Darron Broad | 60a5a92 | 2008-11-11 08:48:27 -0300 | [diff] [blame] | 1385 | if (!dvb_attach(isl6421_attach, |
| 1386 | fe0->dvb.frontend, |
| 1387 | &dev->core->i2c_adap, |
| 1388 | 0x08, ISL6421_DCL, 0x00)) |
| 1389 | goto frontend_detach; |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 1390 | } |
Darron Broad | 60a5a92 | 2008-11-11 08:48:27 -0300 | [diff] [blame] | 1391 | /* MFE frontend 2 */ |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 1392 | fe1 = videobuf_dvb_get_frontend(&dev->frontends, 2); |
Darron Broad | 60a5a92 | 2008-11-11 08:48:27 -0300 | [diff] [blame] | 1393 | if (!fe1) |
| 1394 | goto frontend_detach; |
| 1395 | /* DVB-T Init */ |
| 1396 | fe1->dvb.frontend = dvb_attach(cx22702_attach, |
| 1397 | &hauppauge_hvr_config, |
| 1398 | &dev->core->i2c_adap); |
| 1399 | if (fe1->dvb.frontend) { |
| 1400 | fe1->dvb.frontend->id = 1; |
| 1401 | if (!dvb_attach(simple_tuner_attach, |
| 1402 | fe1->dvb.frontend, |
| 1403 | &dev->core->i2c_adap, |
| 1404 | 0x61, TUNER_PHILIPS_FMD1216ME_MK3)) |
| 1405 | goto frontend_detach; |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 1406 | } |
| 1407 | break; |
| 1408 | case CX88_BOARD_HAUPPAUGE_HVR4000LITE: |
| 1409 | fe0->dvb.frontend = dvb_attach(cx24116_attach, |
Darron Broad | 60a5a92 | 2008-11-11 08:48:27 -0300 | [diff] [blame] | 1410 | &hauppauge_hvr4000_config, |
| 1411 | &dev->core->i2c_adap); |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 1412 | if (fe0->dvb.frontend) { |
Darron Broad | 60a5a92 | 2008-11-11 08:48:27 -0300 | [diff] [blame] | 1413 | if (!dvb_attach(isl6421_attach, |
| 1414 | fe0->dvb.frontend, |
| 1415 | &dev->core->i2c_adap, |
| 1416 | 0x08, ISL6421_DCL, 0x00)) |
| 1417 | goto frontend_detach; |
Steven Toth | 5bd1b66 | 2008-09-04 01:17:33 -0300 | [diff] [blame] | 1418 | } |
| 1419 | break; |
Igor M. Liplianin | cd3cde1 | 2008-11-09 15:26:25 -0300 | [diff] [blame] | 1420 | case CX88_BOARD_PROF_6200: |
Igor M. Liplianin | 4b29631 | 2008-11-09 15:25:31 -0300 | [diff] [blame] | 1421 | case CX88_BOARD_TBS_8910: |
Igor M. Liplianin | e4aab64 | 2008-09-23 15:43:57 -0300 | [diff] [blame] | 1422 | case CX88_BOARD_TEVII_S420: |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 1423 | fe0->dvb.frontend = dvb_attach(stv0299_attach, |
Igor M. Liplianin | e4aab64 | 2008-09-23 15:43:57 -0300 | [diff] [blame] | 1424 | &tevii_tuner_sharp_config, |
| 1425 | &core->i2c_adap); |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 1426 | if (fe0->dvb.frontend != NULL) { |
| 1427 | if (!dvb_attach(dvb_pll_attach, fe0->dvb.frontend, 0x60, |
Igor M. Liplianin | e4aab64 | 2008-09-23 15:43:57 -0300 | [diff] [blame] | 1428 | &core->i2c_adap, DVB_PLL_OPERA1)) |
| 1429 | goto frontend_detach; |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 1430 | core->prev_set_voltage = fe0->dvb.frontend->ops.set_voltage; |
| 1431 | fe0->dvb.frontend->ops.set_voltage = tevii_dvbs_set_voltage; |
Igor M. Liplianin | e4aab64 | 2008-09-23 15:43:57 -0300 | [diff] [blame] | 1432 | |
| 1433 | } else { |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 1434 | fe0->dvb.frontend = dvb_attach(stv0288_attach, |
Igor M. Liplianin | e4aab64 | 2008-09-23 15:43:57 -0300 | [diff] [blame] | 1435 | &tevii_tuner_earda_config, |
| 1436 | &core->i2c_adap); |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 1437 | if (fe0->dvb.frontend != NULL) { |
| 1438 | if (!dvb_attach(stb6000_attach, fe0->dvb.frontend, 0x61, |
Igor M. Liplianin | e4aab64 | 2008-09-23 15:43:57 -0300 | [diff] [blame] | 1439 | &core->i2c_adap)) |
| 1440 | goto frontend_detach; |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 1441 | core->prev_set_voltage = fe0->dvb.frontend->ops.set_voltage; |
| 1442 | fe0->dvb.frontend->ops.set_voltage = tevii_dvbs_set_voltage; |
Igor M. Liplianin | e4aab64 | 2008-09-23 15:43:57 -0300 | [diff] [blame] | 1443 | } |
| 1444 | } |
| 1445 | break; |
Igor M. Liplianin | af83262 | 2008-09-04 17:24:14 -0300 | [diff] [blame] | 1446 | case CX88_BOARD_TEVII_S460: |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 1447 | fe0->dvb.frontend = dvb_attach(cx24116_attach, |
Igor M. Liplianin | af83262 | 2008-09-04 17:24:14 -0300 | [diff] [blame] | 1448 | &tevii_s460_config, |
| 1449 | &core->i2c_adap); |
Igor M. Liplianin | 93f26c1 | 2008-11-09 14:59:33 -0300 | [diff] [blame] | 1450 | if (fe0->dvb.frontend != NULL) |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 1451 | fe0->dvb.frontend->ops.set_voltage = tevii_dvbs_set_voltage; |
Igor M. Liplianin | af83262 | 2008-09-04 17:24:14 -0300 | [diff] [blame] | 1452 | break; |
Igor M. Liplianin | 0cb7363 | 2011-02-25 18:41:24 -0300 | [diff] [blame] | 1453 | case CX88_BOARD_TEVII_S464: |
| 1454 | fe0->dvb.frontend = dvb_attach(ds3000_attach, |
| 1455 | &tevii_ds3000_config, |
| 1456 | &core->i2c_adap); |
| 1457 | if (fe0->dvb.frontend != NULL) |
| 1458 | fe0->dvb.frontend->ops.set_voltage = |
| 1459 | tevii_dvbs_set_voltage; |
| 1460 | break; |
Oleg Roitburd | 4cd7fb8 | 2008-09-17 11:30:21 -0300 | [diff] [blame] | 1461 | case CX88_BOARD_OMICOM_SS4_PCI: |
Oleg Roitburd | ee73042 | 2008-09-17 11:58:33 -0300 | [diff] [blame] | 1462 | case CX88_BOARD_TBS_8920: |
Oleg Roitburd | 57f51db | 2008-10-08 06:48:08 -0300 | [diff] [blame] | 1463 | case CX88_BOARD_PROF_7300: |
Igor M. Liplianin | 4b29631 | 2008-11-09 15:25:31 -0300 | [diff] [blame] | 1464 | case CX88_BOARD_SATTRADE_ST4200: |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 1465 | fe0->dvb.frontend = dvb_attach(cx24116_attach, |
Oleg Roitburd | ee73042 | 2008-09-17 11:58:33 -0300 | [diff] [blame] | 1466 | &hauppauge_hvr4000_config, |
| 1467 | &core->i2c_adap); |
Igor M. Liplianin | 93f26c1 | 2008-11-09 14:59:33 -0300 | [diff] [blame] | 1468 | if (fe0->dvb.frontend != NULL) |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 1469 | fe0->dvb.frontend->ops.set_voltage = tevii_dvbs_set_voltage; |
Oleg Roitburd | ee73042 | 2008-09-17 11:58:33 -0300 | [diff] [blame] | 1470 | break; |
Stephan Wienczny | 70101a2 | 2009-03-10 19:08:06 -0300 | [diff] [blame] | 1471 | case CX88_BOARD_TERRATEC_CINERGY_HT_PCI_MKII: |
| 1472 | fe0->dvb.frontend = dvb_attach(zl10353_attach, |
| 1473 | &cx88_terratec_cinergy_ht_pci_mkii_config, |
| 1474 | &core->i2c_adap); |
| 1475 | if (fe0->dvb.frontend) { |
| 1476 | fe0->dvb.frontend->ops.i2c_gate_ctrl = NULL; |
| 1477 | if (attach_xc3028(0x61, dev) < 0) |
| 1478 | goto frontend_detach; |
| 1479 | } |
| 1480 | break; |
Igor M. Liplianin | b699c27 | 2009-11-16 22:22:32 -0300 | [diff] [blame] | 1481 | case CX88_BOARD_PROF_7301:{ |
| 1482 | struct dvb_tuner_ops *tuner_ops = NULL; |
| 1483 | |
| 1484 | fe0->dvb.frontend = dvb_attach(stv0900_attach, |
| 1485 | &prof_7301_stv0900_config, |
| 1486 | &core->i2c_adap, 0); |
| 1487 | if (fe0->dvb.frontend != NULL) { |
| 1488 | if (!dvb_attach(stb6100_attach, fe0->dvb.frontend, |
| 1489 | &prof_7301_stb6100_config, |
| 1490 | &core->i2c_adap)) |
| 1491 | goto frontend_detach; |
| 1492 | |
| 1493 | tuner_ops = &fe0->dvb.frontend->ops.tuner_ops; |
| 1494 | tuner_ops->set_frequency = stb6100_set_freq; |
| 1495 | tuner_ops->get_frequency = stb6100_get_freq; |
| 1496 | tuner_ops->set_bandwidth = stb6100_set_bandw; |
| 1497 | tuner_ops->get_bandwidth = stb6100_get_bandw; |
| 1498 | |
| 1499 | core->prev_set_voltage = |
| 1500 | fe0->dvb.frontend->ops.set_voltage; |
| 1501 | fe0->dvb.frontend->ops.set_voltage = |
| 1502 | tevii_dvbs_set_voltage; |
| 1503 | } |
| 1504 | break; |
| 1505 | } |
Dirk Herrendoerfer | 4f3ca2f1 | 2010-02-11 18:06:34 -0300 | [diff] [blame] | 1506 | case CX88_BOARD_SAMSUNG_SMT_7020: |
| 1507 | dev->ts_gen_cntrl = 0x08; |
| 1508 | |
Dirk Herrendoerfer | 4f3ca2f1 | 2010-02-11 18:06:34 -0300 | [diff] [blame] | 1509 | cx_set(MO_GP0_IO, 0x0101); |
| 1510 | |
| 1511 | cx_clear(MO_GP0_IO, 0x01); |
| 1512 | mdelay(100); |
| 1513 | cx_set(MO_GP0_IO, 0x01); |
| 1514 | mdelay(200); |
| 1515 | |
| 1516 | fe0->dvb.frontend = dvb_attach(stv0299_attach, |
| 1517 | &samsung_stv0299_config, |
| 1518 | &dev->core->i2c_adap); |
| 1519 | if (fe0->dvb.frontend) { |
| 1520 | fe0->dvb.frontend->ops.tuner_ops.set_params = |
| 1521 | samsung_smt_7020_tuner_set_params; |
| 1522 | fe0->dvb.frontend->tuner_priv = |
| 1523 | &dev->core->i2c_adap; |
| 1524 | fe0->dvb.frontend->ops.set_voltage = |
| 1525 | samsung_smt_7020_set_voltage; |
| 1526 | fe0->dvb.frontend->ops.set_tone = |
| 1527 | samsung_smt_7020_set_tone; |
| 1528 | } |
| 1529 | |
| 1530 | break; |
Sergey Ivanov | 111ac84 | 2010-08-09 10:18:32 -0300 | [diff] [blame] | 1531 | case CX88_BOARD_TWINHAN_VP1027_DVBS: |
| 1532 | dev->ts_gen_cntrl = 0x00; |
| 1533 | fe0->dvb.frontend = dvb_attach(mb86a16_attach, |
| 1534 | &twinhan_vp1027, |
| 1535 | &core->i2c_adap); |
| 1536 | if (fe0->dvb.frontend) { |
| 1537 | core->prev_set_voltage = |
| 1538 | fe0->dvb.frontend->ops.set_voltage; |
| 1539 | fe0->dvb.frontend->ops.set_voltage = |
| 1540 | vp1027_set_voltage; |
| 1541 | } |
| 1542 | break; |
Dirk Herrendoerfer | 4f3ca2f1 | 2010-02-11 18:06:34 -0300 | [diff] [blame] | 1543 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1544 | default: |
Trent Piepho | 5772f81 | 2007-08-15 14:41:59 -0300 | [diff] [blame] | 1545 | printk(KERN_ERR "%s/2: The frontend of your DVB/ATSC card isn't supported yet\n", |
Mauro Carvalho Chehab | 0590d91 | 2008-04-30 18:14:36 -0300 | [diff] [blame] | 1546 | core->name); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1547 | break; |
| 1548 | } |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 1549 | |
Mauro Carvalho Chehab | 2c9bcea | 2008-11-10 23:35:00 -0200 | [diff] [blame] | 1550 | if ( (NULL == fe0->dvb.frontend) || (fe1 && NULL == fe1->dvb.frontend) ) { |
Mauro Carvalho Chehab | 9507901 | 2008-04-22 14:45:15 -0300 | [diff] [blame] | 1551 | printk(KERN_ERR |
| 1552 | "%s/2: frontend initialization failed\n", |
Mauro Carvalho Chehab | 0590d91 | 2008-04-30 18:14:36 -0300 | [diff] [blame] | 1553 | core->name); |
Darron Broad | 60a5a92 | 2008-11-11 08:48:27 -0300 | [diff] [blame] | 1554 | goto frontend_detach; |
Mauro Carvalho Chehab | 9507901 | 2008-04-22 14:45:15 -0300 | [diff] [blame] | 1555 | } |
Michael Krufky | d7cba04 | 2008-09-12 13:31:45 -0300 | [diff] [blame] | 1556 | /* define general-purpose callback pointer */ |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 1557 | fe0->dvb.frontend->callback = cx88_tuner_callback; |
Mauro Carvalho Chehab | 9507901 | 2008-04-22 14:45:15 -0300 | [diff] [blame] | 1558 | |
Steven Toth | 6c5be74 | 2006-12-02 21:15:51 -0200 | [diff] [blame] | 1559 | /* Ensure all frontends negotiate bus access */ |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 1560 | fe0->dvb.frontend->ops.ts_bus_ctrl = cx88_dvb_bus_ctrl; |
| 1561 | if (fe1) |
| 1562 | fe1->dvb.frontend->ops.ts_bus_ctrl = cx88_dvb_bus_ctrl; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1563 | |
Mauro Carvalho Chehab | 93352f5 | 2005-09-13 01:25:42 -0700 | [diff] [blame] | 1564 | /* Put the analog decoder in standby to keep it quiet */ |
Laurent Pinchart | 622b828 | 2009-10-05 10:48:17 -0300 | [diff] [blame] | 1565 | call_all(core, core, s_power, 0); |
Mauro Carvalho Chehab | 93352f5 | 2005-09-13 01:25:42 -0700 | [diff] [blame] | 1566 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1567 | /* register everything */ |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 1568 | return videobuf_dvb_register_bus(&dev->frontends, THIS_MODULE, dev, |
Michael Krufky | 9133aee | 2009-05-23 18:00:59 -0300 | [diff] [blame] | 1569 | &dev->pci->dev, adapter_nr, mfe_shared, NULL); |
Mauro Carvalho Chehab | 0590d91 | 2008-04-30 18:14:36 -0300 | [diff] [blame] | 1570 | |
| 1571 | frontend_detach: |
Mauro Carvalho Chehab | e32fadc | 2009-01-06 16:06:07 -0300 | [diff] [blame] | 1572 | core->gate_ctrl = NULL; |
Darron Broad | becd430 | 2008-10-21 11:47:50 -0300 | [diff] [blame] | 1573 | videobuf_dvb_dealloc_frontends(&dev->frontends); |
Mauro Carvalho Chehab | 0590d91 | 2008-04-30 18:14:36 -0300 | [diff] [blame] | 1574 | return -EINVAL; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1575 | } |
| 1576 | |
| 1577 | /* ----------------------------------------------------------- */ |
| 1578 | |
Steven Toth | 6c5be74 | 2006-12-02 21:15:51 -0200 | [diff] [blame] | 1579 | /* CX8802 MPEG -> mini driver - We have been given the hardware */ |
| 1580 | static int cx8802_dvb_advise_acquire(struct cx8802_driver *drv) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1581 | { |
Steven Toth | 6c5be74 | 2006-12-02 21:15:51 -0200 | [diff] [blame] | 1582 | struct cx88_core *core = drv->core; |
| 1583 | int err = 0; |
Harvey Harrison | 32d83ef | 2008-04-08 23:20:00 -0300 | [diff] [blame] | 1584 | dprintk( 1, "%s\n", __func__); |
Steven Toth | 6c5be74 | 2006-12-02 21:15:51 -0200 | [diff] [blame] | 1585 | |
Trent Piepho | 6a59d64 | 2007-08-15 14:41:57 -0300 | [diff] [blame] | 1586 | switch (core->boardnr) { |
Steven Toth | 6c5be74 | 2006-12-02 21:15:51 -0200 | [diff] [blame] | 1587 | case CX88_BOARD_HAUPPAUGE_HVR1300: |
| 1588 | /* We arrive here with either the cx23416 or the cx22702 |
| 1589 | * on the bus. Take the bus from the cx23416 and enable the |
| 1590 | * cx22702 demod |
| 1591 | */ |
Darron Broad | 7939273 | 2008-12-18 06:28:35 -0300 | [diff] [blame] | 1592 | /* Toggle reset on cx22702 leaving i2c active */ |
| 1593 | cx_set(MO_GP0_IO, 0x00000080); |
| 1594 | udelay(1000); |
| 1595 | cx_clear(MO_GP0_IO, 0x00000080); |
| 1596 | udelay(50); |
| 1597 | cx_set(MO_GP0_IO, 0x00000080); |
| 1598 | udelay(1000); |
| 1599 | /* enable the cx22702 pins */ |
Steven Toth | 6c5be74 | 2006-12-02 21:15:51 -0200 | [diff] [blame] | 1600 | cx_clear(MO_GP0_IO, 0x00000004); |
| 1601 | udelay(1000); |
| 1602 | break; |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 1603 | |
Darron Broad | 92abe9e | 2008-10-11 11:18:53 -0300 | [diff] [blame] | 1604 | case CX88_BOARD_HAUPPAUGE_HVR3000: |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 1605 | case CX88_BOARD_HAUPPAUGE_HVR4000: |
Darron Broad | 7939273 | 2008-12-18 06:28:35 -0300 | [diff] [blame] | 1606 | /* Toggle reset on cx22702 leaving i2c active */ |
| 1607 | cx_set(MO_GP0_IO, 0x00000080); |
| 1608 | udelay(1000); |
| 1609 | cx_clear(MO_GP0_IO, 0x00000080); |
| 1610 | udelay(50); |
| 1611 | cx_set(MO_GP0_IO, 0x00000080); |
| 1612 | udelay(1000); |
| 1613 | switch (core->dvbdev->frontends.active_fe_id) { |
| 1614 | case 1: /* DVB-S/S2 Enabled */ |
| 1615 | /* tri-state the cx22702 pins */ |
| 1616 | cx_set(MO_GP0_IO, 0x00000004); |
| 1617 | /* Take the cx24116/cx24123 out of reset */ |
| 1618 | cx_write(MO_SRST_IO, 1); |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 1619 | core->dvbdev->ts_gen_cntrl = 0x02; /* Parallel IO */ |
Darron Broad | 7939273 | 2008-12-18 06:28:35 -0300 | [diff] [blame] | 1620 | break; |
| 1621 | case 2: /* DVB-T Enabled */ |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 1622 | /* Put the cx24116/cx24123 into reset */ |
| 1623 | cx_write(MO_SRST_IO, 0); |
Darron Broad | 7939273 | 2008-12-18 06:28:35 -0300 | [diff] [blame] | 1624 | /* enable the cx22702 pins */ |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 1625 | cx_clear(MO_GP0_IO, 0x00000004); |
| 1626 | core->dvbdev->ts_gen_cntrl = 0x0c; /* Serial IO */ |
Darron Broad | 7939273 | 2008-12-18 06:28:35 -0300 | [diff] [blame] | 1627 | break; |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 1628 | } |
Darron Broad | 7939273 | 2008-12-18 06:28:35 -0300 | [diff] [blame] | 1629 | udelay(1000); |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 1630 | break; |
| 1631 | |
istvan_v@mailbox.hu | f271a3a | 2011-06-07 13:14:53 -0300 | [diff] [blame] | 1632 | case CX88_BOARD_WINFAST_DTV2000H_PLUS: |
| 1633 | /* set RF input to AIR for DVB-T (GPIO 16) */ |
| 1634 | cx_write(MO_GP2_IO, 0x0101); |
| 1635 | break; |
| 1636 | |
Steven Toth | 6c5be74 | 2006-12-02 21:15:51 -0200 | [diff] [blame] | 1637 | default: |
| 1638 | err = -ENODEV; |
| 1639 | } |
| 1640 | return err; |
| 1641 | } |
| 1642 | |
| 1643 | /* CX8802 MPEG -> mini driver - We no longer have the hardware */ |
| 1644 | static int cx8802_dvb_advise_release(struct cx8802_driver *drv) |
| 1645 | { |
| 1646 | struct cx88_core *core = drv->core; |
| 1647 | int err = 0; |
Harvey Harrison | 32d83ef | 2008-04-08 23:20:00 -0300 | [diff] [blame] | 1648 | dprintk( 1, "%s\n", __func__); |
Steven Toth | 6c5be74 | 2006-12-02 21:15:51 -0200 | [diff] [blame] | 1649 | |
Trent Piepho | 6a59d64 | 2007-08-15 14:41:57 -0300 | [diff] [blame] | 1650 | switch (core->boardnr) { |
Steven Toth | 6c5be74 | 2006-12-02 21:15:51 -0200 | [diff] [blame] | 1651 | case CX88_BOARD_HAUPPAUGE_HVR1300: |
| 1652 | /* Do Nothing, leave the cx22702 on the bus. */ |
| 1653 | break; |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 1654 | case CX88_BOARD_HAUPPAUGE_HVR3000: |
| 1655 | case CX88_BOARD_HAUPPAUGE_HVR4000: |
| 1656 | break; |
Steven Toth | 6c5be74 | 2006-12-02 21:15:51 -0200 | [diff] [blame] | 1657 | default: |
| 1658 | err = -ENODEV; |
| 1659 | } |
| 1660 | return err; |
| 1661 | } |
| 1662 | |
| 1663 | static int cx8802_dvb_probe(struct cx8802_driver *drv) |
| 1664 | { |
| 1665 | struct cx88_core *core = drv->core; |
| 1666 | struct cx8802_dev *dev = drv->core->dvbdev; |
Darron Broad | cbd8244 | 2008-10-30 05:07:44 -0300 | [diff] [blame] | 1667 | int err; |
Andy Walls | 6e0e12f | 2009-01-11 21:18:04 -0300 | [diff] [blame] | 1668 | struct videobuf_dvb_frontend *fe; |
| 1669 | int i; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1670 | |
Harvey Harrison | 32d83ef | 2008-04-08 23:20:00 -0300 | [diff] [blame] | 1671 | dprintk( 1, "%s\n", __func__); |
Steven Toth | 6c5be74 | 2006-12-02 21:15:51 -0200 | [diff] [blame] | 1672 | 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] | 1673 | core->boardnr, |
Steven Toth | 6c5be74 | 2006-12-02 21:15:51 -0200 | [diff] [blame] | 1674 | core->name, |
| 1675 | core->pci_bus, |
| 1676 | core->pci_slot); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1677 | |
| 1678 | err = -ENODEV; |
Trent Piepho | 6a59d64 | 2007-08-15 14:41:57 -0300 | [diff] [blame] | 1679 | if (!(core->board.mpeg & CX88_MPEG_DVB)) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1680 | goto fail_core; |
| 1681 | |
Trent Piepho | ecf854d | 2007-05-05 20:11:32 -0300 | [diff] [blame] | 1682 | /* If vp3054 isn't enabled, a stub will just return 0 */ |
Chris Pascoe | fc40b26 | 2006-01-09 15:25:35 -0200 | [diff] [blame] | 1683 | err = vp3054_i2c_probe(dev); |
| 1684 | if (0 != err) |
Andy Walls | 6e0e12f | 2009-01-11 21:18:04 -0300 | [diff] [blame] | 1685 | goto fail_core; |
Chris Pascoe | fc40b26 | 2006-01-09 15:25:35 -0200 | [diff] [blame] | 1686 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1687 | /* dvb stuff */ |
Trent Piepho | 5772f81 | 2007-08-15 14:41:59 -0300 | [diff] [blame] | 1688 | printk(KERN_INFO "%s/2: cx2388x based DVB/ATSC card\n", core->name); |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 1689 | dev->ts_gen_cntrl = 0x0c; |
| 1690 | |
Andy Walls | 6e0e12f | 2009-01-11 21:18:04 -0300 | [diff] [blame] | 1691 | err = cx8802_alloc_frontends(dev); |
| 1692 | if (err) |
| 1693 | goto fail_core; |
Darron Broad | cbd8244 | 2008-10-30 05:07:44 -0300 | [diff] [blame] | 1694 | |
Andy Walls | 6e0e12f | 2009-01-11 21:18:04 -0300 | [diff] [blame] | 1695 | err = -ENODEV; |
| 1696 | for (i = 1; i <= core->board.num_frontends; i++) { |
| 1697 | fe = videobuf_dvb_get_frontend(&core->dvbdev->frontends, i); |
| 1698 | if (fe == NULL) { |
| 1699 | printk(KERN_ERR "%s() failed to get frontend(%d)\n", |
Darron Broad | cbd8244 | 2008-10-30 05:07:44 -0300 | [diff] [blame] | 1700 | __func__, i); |
Andy Walls | 6e0e12f | 2009-01-11 21:18:04 -0300 | [diff] [blame] | 1701 | goto fail_probe; |
| 1702 | } |
| 1703 | videobuf_queue_sg_init(&fe->dvb.dvbq, &dvb_qops, |
Darron Broad | cbd8244 | 2008-10-30 05:07:44 -0300 | [diff] [blame] | 1704 | &dev->pci->dev, &dev->slock, |
| 1705 | V4L2_BUF_TYPE_VIDEO_CAPTURE, |
| 1706 | V4L2_FIELD_TOP, |
| 1707 | sizeof(struct cx88_buffer), |
Hans Verkuil | 08bff03 | 2010-09-20 17:39:46 -0300 | [diff] [blame] | 1708 | dev, NULL); |
Andy Walls | 6e0e12f | 2009-01-11 21:18:04 -0300 | [diff] [blame] | 1709 | /* init struct videobuf_dvb */ |
| 1710 | fe->dvb.name = dev->core->name; |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 1711 | } |
Andy Walls | 6e0e12f | 2009-01-11 21:18:04 -0300 | [diff] [blame] | 1712 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1713 | err = dvb_register(dev); |
Darron Broad | cbd8244 | 2008-10-30 05:07:44 -0300 | [diff] [blame] | 1714 | if (err) |
| 1715 | /* frontends/adapter de-allocated in dvb_register */ |
Trent Piepho | 5772f81 | 2007-08-15 14:41:59 -0300 | [diff] [blame] | 1716 | printk(KERN_ERR "%s/2: dvb_register failed (err = %d)\n", |
| 1717 | core->name, err); |
Darron Broad | cbd8244 | 2008-10-30 05:07:44 -0300 | [diff] [blame] | 1718 | return err; |
| 1719 | fail_probe: |
| 1720 | videobuf_dvb_dealloc_frontends(&core->dvbdev->frontends); |
Darron Broad | 92abe9e | 2008-10-11 11:18:53 -0300 | [diff] [blame] | 1721 | fail_core: |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1722 | return err; |
| 1723 | } |
| 1724 | |
Steven Toth | 6c5be74 | 2006-12-02 21:15:51 -0200 | [diff] [blame] | 1725 | static int cx8802_dvb_remove(struct cx8802_driver *drv) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1726 | { |
Darron Broad | 0fcd488 | 2008-10-21 11:18:47 -0300 | [diff] [blame] | 1727 | struct cx88_core *core = drv->core; |
Steven Toth | 6c5be74 | 2006-12-02 21:15:51 -0200 | [diff] [blame] | 1728 | struct cx8802_dev *dev = drv->core->dvbdev; |
Steven Toth | 611900c | 2006-01-09 15:25:12 -0200 | [diff] [blame] | 1729 | |
Darron Broad | 0fcd488 | 2008-10-21 11:18:47 -0300 | [diff] [blame] | 1730 | dprintk( 1, "%s\n", __func__); |
| 1731 | |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 1732 | videobuf_dvb_unregister_bus(&dev->frontends); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1733 | |
Chris Pascoe | fc40b26 | 2006-01-09 15:25:35 -0200 | [diff] [blame] | 1734 | vp3054_i2c_remove(dev); |
Chris Pascoe | fc40b26 | 2006-01-09 15:25:35 -0200 | [diff] [blame] | 1735 | |
Mauro Carvalho Chehab | e32fadc | 2009-01-06 16:06:07 -0300 | [diff] [blame] | 1736 | core->gate_ctrl = NULL; |
| 1737 | |
Steven Toth | 6c5be74 | 2006-12-02 21:15:51 -0200 | [diff] [blame] | 1738 | return 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1739 | } |
| 1740 | |
Steven Toth | 6c5be74 | 2006-12-02 21:15:51 -0200 | [diff] [blame] | 1741 | static struct cx8802_driver cx8802_dvb_driver = { |
| 1742 | .type_id = CX88_MPEG_DVB, |
| 1743 | .hw_access = CX8802_DRVCTL_SHARED, |
| 1744 | .probe = cx8802_dvb_probe, |
| 1745 | .remove = cx8802_dvb_remove, |
| 1746 | .advise_acquire = cx8802_dvb_advise_acquire, |
| 1747 | .advise_release = cx8802_dvb_advise_release, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1748 | }; |
| 1749 | |
Peter Huewe | 31d0f84 | 2009-07-17 01:00:01 +0200 | [diff] [blame] | 1750 | static int __init dvb_init(void) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1751 | { |
Trent Piepho | 5772f81 | 2007-08-15 14:41:59 -0300 | [diff] [blame] | 1752 | 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] | 1753 | (CX88_VERSION_CODE >> 16) & 0xff, |
| 1754 | (CX88_VERSION_CODE >> 8) & 0xff, |
| 1755 | CX88_VERSION_CODE & 0xff); |
| 1756 | #ifdef SNAPSHOT |
| 1757 | printk(KERN_INFO "cx2388x: snapshot date %04d-%02d-%02d\n", |
| 1758 | SNAPSHOT/10000, (SNAPSHOT/100)%100, SNAPSHOT%100); |
| 1759 | #endif |
Steven Toth | 6c5be74 | 2006-12-02 21:15:51 -0200 | [diff] [blame] | 1760 | return cx8802_register_driver(&cx8802_dvb_driver); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1761 | } |
| 1762 | |
Peter Huewe | 31d0f84 | 2009-07-17 01:00:01 +0200 | [diff] [blame] | 1763 | static void __exit dvb_fini(void) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1764 | { |
Steven Toth | 6c5be74 | 2006-12-02 21:15:51 -0200 | [diff] [blame] | 1765 | cx8802_unregister_driver(&cx8802_dvb_driver); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1766 | } |
| 1767 | |
| 1768 | module_init(dvb_init); |
| 1769 | module_exit(dvb_fini); |
| 1770 | |
| 1771 | /* |
| 1772 | * Local variables: |
| 1773 | * c-basic-offset: 8 |
| 1774 | * compile-command: "make DVB=1" |
| 1775 | * End: |
| 1776 | */ |