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