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