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