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