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