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