Steven Toth | d19770e | 2007-03-11 20:44:05 -0300 | [diff] [blame] | 1 | /* |
| 2 | * Driver for the Conexant CX23885 PCIe bridge |
| 3 | * |
Steven Toth | 6d89761 | 2008-09-03 17:12:12 -0300 | [diff] [blame] | 4 | * Copyright (c) 2006 Steven Toth <stoth@linuxtv.org> |
Steven Toth | d19770e | 2007-03-11 20:44:05 -0300 | [diff] [blame] | 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License as published by |
| 8 | * the Free Software Foundation; either version 2 of the License, or |
| 9 | * (at your option) any later version. |
| 10 | * |
| 11 | * This program is distributed in the hope that it will be useful, |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | * |
| 15 | * GNU General Public License for more details. |
| 16 | * |
| 17 | * You should have received a copy of the GNU General Public License |
| 18 | * along with this program; if not, write to the Free Software |
| 19 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
| 20 | */ |
| 21 | |
| 22 | #include <linux/module.h> |
| 23 | #include <linux/init.h> |
| 24 | #include <linux/device.h> |
| 25 | #include <linux/fs.h> |
| 26 | #include <linux/kthread.h> |
| 27 | #include <linux/file.h> |
| 28 | #include <linux/suspend.h> |
| 29 | |
| 30 | #include "cx23885.h" |
Steven Toth | d19770e | 2007-03-11 20:44:05 -0300 | [diff] [blame] | 31 | #include <media/v4l2-common.h> |
| 32 | |
Igor M. Liplianin | 5a23b07 | 2009-03-03 12:06:09 -0300 | [diff] [blame] | 33 | #include "dvb_ca_en50221.h" |
Steven Toth | d19770e | 2007-03-11 20:44:05 -0300 | [diff] [blame] | 34 | #include "s5h1409.h" |
Michael Krufky | 52b5045 | 2008-07-09 02:18:49 -0300 | [diff] [blame] | 35 | #include "s5h1411.h" |
Steven Toth | d19770e | 2007-03-11 20:44:05 -0300 | [diff] [blame] | 36 | #include "mt2131.h" |
Michael Krufky | 3ba71d2 | 2007-12-07 01:40:36 -0300 | [diff] [blame] | 37 | #include "tda8290.h" |
Michael Krufky | 4041f1a | 2007-12-24 04:52:08 -0300 | [diff] [blame] | 38 | #include "tda18271.h" |
Michael Krufky | 9bc37ca | 2007-09-08 15:17:13 -0300 | [diff] [blame] | 39 | #include "lgdt330x.h" |
istvan_v@mailbox.hu | 0cf8af5 | 2011-07-11 10:58:35 -0300 | [diff] [blame] | 40 | #include "xc4000.h" |
Steven Toth | d1987d5 | 2007-12-18 01:57:06 -0300 | [diff] [blame] | 41 | #include "xc5000.h" |
David T. L. Wong | ea5697f | 2009-10-26 08:54:04 -0300 | [diff] [blame] | 42 | #include "max2165.h" |
Steven Toth | b3ea016 | 2008-04-19 01:14:19 -0300 | [diff] [blame] | 43 | #include "tda10048.h" |
Michael Krufky | 07b4a83 | 2007-12-18 01:09:11 -0300 | [diff] [blame] | 44 | #include "tuner-xc2028.h" |
Michael Krufky | 827855d | 2008-04-22 14:46:16 -0300 | [diff] [blame] | 45 | #include "tuner-simple.h" |
Steven Toth | 6676237 | 2008-04-22 15:38:26 -0300 | [diff] [blame] | 46 | #include "dib7000p.h" |
| 47 | #include "dibx000_common.h" |
Steven Toth | aef2d18 | 2008-08-04 21:39:53 -0300 | [diff] [blame] | 48 | #include "zl10353.h" |
Igor M. Liplianin | 5a23b07 | 2009-03-03 12:06:09 -0300 | [diff] [blame] | 49 | #include "stv0900.h" |
Igor M. Liplianin | f867c3f | 2009-06-19 05:45:23 -0300 | [diff] [blame] | 50 | #include "stv0900_reg.h" |
Igor M. Liplianin | 5a23b07 | 2009-03-03 12:06:09 -0300 | [diff] [blame] | 51 | #include "stv6110.h" |
| 52 | #include "lnbh24.h" |
Igor M. Liplianin | 96318d0 | 2009-01-17 12:11:20 -0300 | [diff] [blame] | 53 | #include "cx24116.h" |
Igor M. Liplianin | 5a23b07 | 2009-03-03 12:06:09 -0300 | [diff] [blame] | 54 | #include "cimax2.h" |
David Wong | 493b712 | 2009-05-18 05:25:49 -0300 | [diff] [blame] | 55 | #include "lgs8gxx.h" |
Igor M. Liplianin | 5a23b07 | 2009-03-03 12:06:09 -0300 | [diff] [blame] | 56 | #include "netup-eeprom.h" |
| 57 | #include "netup-init.h" |
Michael Krufky | a5dbf45 | 2009-05-03 23:27:02 -0300 | [diff] [blame] | 58 | #include "lgdt3305.h" |
David T. L. Wong | ea5697f | 2009-10-26 08:54:04 -0300 | [diff] [blame] | 59 | #include "atbm8830.h" |
Igor M. Liplianin | 09ea33e | 2009-11-24 20:16:04 -0300 | [diff] [blame] | 60 | #include "ds3000.h" |
| 61 | #include "cx23885-f300.h" |
Igor M. Liplianin | 78db854 | 2011-01-25 17:04:00 -0300 | [diff] [blame] | 62 | #include "altera-ci.h" |
| 63 | #include "stv0367.h" |
Stefan Ringel | 722c90e | 2012-01-07 09:20:48 -0300 | [diff] [blame] | 64 | #include "drxk.h" |
| 65 | #include "mt2063.h" |
Mariusz Bia?o?czyk | f667190 | 2012-09-12 07:59:18 -0300 | [diff] [blame] | 66 | #include "stv090x.h" |
| 67 | #include "stb6100.h" |
| 68 | #include "stb6100_cfg.h" |
Michael Krufky | 7c62f5a | 2012-12-15 23:34:09 -0300 | [diff] [blame] | 69 | #include "tda10071.h" |
| 70 | #include "a8293.h" |
Steven Toth | d19770e | 2007-03-11 20:44:05 -0300 | [diff] [blame] | 71 | |
Steven Toth | 4513fc69 | 2008-01-12 11:36:36 -0300 | [diff] [blame] | 72 | static unsigned int debug; |
Steven Toth | d19770e | 2007-03-11 20:44:05 -0300 | [diff] [blame] | 73 | |
Steven Toth | 4513fc69 | 2008-01-12 11:36:36 -0300 | [diff] [blame] | 74 | #define dprintk(level, fmt, arg...)\ |
| 75 | do { if (debug >= level)\ |
| 76 | printk(KERN_DEBUG "%s/0: " fmt, dev->name, ## arg);\ |
| 77 | } while (0) |
Steven Toth | d19770e | 2007-03-11 20:44:05 -0300 | [diff] [blame] | 78 | |
| 79 | /* ------------------------------------------------------------------ */ |
| 80 | |
Michael Krufky | 3ba71d2 | 2007-12-07 01:40:36 -0300 | [diff] [blame] | 81 | static unsigned int alt_tuner; |
| 82 | module_param(alt_tuner, int, 0644); |
| 83 | MODULE_PARM_DESC(alt_tuner, "Enable alternate tuner configuration"); |
| 84 | |
Janne Grunau | 78e9200 | 2008-04-09 19:13:13 -0300 | [diff] [blame] | 85 | DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); |
| 86 | |
Michael Krufky | 3ba71d2 | 2007-12-07 01:40:36 -0300 | [diff] [blame] | 87 | /* ------------------------------------------------------------------ */ |
| 88 | |
Steven Toth | d19770e | 2007-03-11 20:44:05 -0300 | [diff] [blame] | 89 | static int dvb_buf_setup(struct videobuf_queue *q, |
| 90 | unsigned int *count, unsigned int *size) |
| 91 | { |
| 92 | struct cx23885_tsport *port = q->priv_data; |
| 93 | |
| 94 | port->ts_packet_size = 188 * 4; |
| 95 | port->ts_packet_count = 32; |
| 96 | |
| 97 | *size = port->ts_packet_size * port->ts_packet_count; |
| 98 | *count = 32; |
| 99 | return 0; |
| 100 | } |
| 101 | |
Michael Krufky | 44a6481 | 2007-03-20 23:00:18 -0300 | [diff] [blame] | 102 | static int dvb_buf_prepare(struct videobuf_queue *q, |
| 103 | struct videobuf_buffer *vb, enum v4l2_field field) |
Steven Toth | d19770e | 2007-03-11 20:44:05 -0300 | [diff] [blame] | 104 | { |
| 105 | struct cx23885_tsport *port = q->priv_data; |
Steven Toth | 9c8ced5 | 2008-10-16 20:18:44 -0300 | [diff] [blame] | 106 | return cx23885_buf_prepare(q, port, (struct cx23885_buffer *)vb, field); |
Steven Toth | d19770e | 2007-03-11 20:44:05 -0300 | [diff] [blame] | 107 | } |
| 108 | |
| 109 | static void dvb_buf_queue(struct videobuf_queue *q, struct videobuf_buffer *vb) |
| 110 | { |
| 111 | struct cx23885_tsport *port = q->priv_data; |
Steven Toth | 9c8ced5 | 2008-10-16 20:18:44 -0300 | [diff] [blame] | 112 | cx23885_buf_queue(port, (struct cx23885_buffer *)vb); |
Steven Toth | d19770e | 2007-03-11 20:44:05 -0300 | [diff] [blame] | 113 | } |
| 114 | |
Michael Krufky | 44a6481 | 2007-03-20 23:00:18 -0300 | [diff] [blame] | 115 | static void dvb_buf_release(struct videobuf_queue *q, |
| 116 | struct videobuf_buffer *vb) |
Steven Toth | d19770e | 2007-03-11 20:44:05 -0300 | [diff] [blame] | 117 | { |
Steven Toth | 9c8ced5 | 2008-10-16 20:18:44 -0300 | [diff] [blame] | 118 | cx23885_free_buffer(q, (struct cx23885_buffer *)vb); |
Steven Toth | d19770e | 2007-03-11 20:44:05 -0300 | [diff] [blame] | 119 | } |
| 120 | |
Mauro Carvalho Chehab | a7d44ba | 2011-12-26 20:48:54 -0300 | [diff] [blame] | 121 | static int cx23885_dvb_set_frontend(struct dvb_frontend *fe); |
| 122 | |
Igor M. Liplianin | 78db854 | 2011-01-25 17:04:00 -0300 | [diff] [blame] | 123 | static void cx23885_dvb_gate_ctrl(struct cx23885_tsport *port, int open) |
| 124 | { |
| 125 | struct videobuf_dvb_frontends *f; |
| 126 | struct videobuf_dvb_frontend *fe; |
| 127 | |
| 128 | f = &port->frontends; |
| 129 | |
| 130 | if (f->gate <= 1) /* undefined or fe0 */ |
| 131 | fe = videobuf_dvb_get_frontend(f, 1); |
| 132 | else |
| 133 | fe = videobuf_dvb_get_frontend(f, f->gate); |
| 134 | |
| 135 | if (fe && fe->dvb.frontend && fe->dvb.frontend->ops.i2c_gate_ctrl) |
| 136 | fe->dvb.frontend->ops.i2c_gate_ctrl(fe->dvb.frontend, open); |
Mauro Carvalho Chehab | a7d44ba | 2011-12-26 20:48:54 -0300 | [diff] [blame] | 137 | |
| 138 | /* |
| 139 | * FIXME: Improve this path to avoid calling the |
| 140 | * cx23885_dvb_set_frontend() every time it passes here. |
| 141 | */ |
| 142 | cx23885_dvb_set_frontend(fe->dvb.frontend); |
Igor M. Liplianin | 78db854 | 2011-01-25 17:04:00 -0300 | [diff] [blame] | 143 | } |
| 144 | |
Steven Toth | d19770e | 2007-03-11 20:44:05 -0300 | [diff] [blame] | 145 | static struct videobuf_queue_ops dvb_qops = { |
| 146 | .buf_setup = dvb_buf_setup, |
| 147 | .buf_prepare = dvb_buf_prepare, |
| 148 | .buf_queue = dvb_buf_queue, |
| 149 | .buf_release = dvb_buf_release, |
| 150 | }; |
| 151 | |
Steven Toth | 86184e0 | 2007-09-04 21:40:47 -0300 | [diff] [blame] | 152 | static struct s5h1409_config hauppauge_generic_config = { |
Steven Toth | d19770e | 2007-03-11 20:44:05 -0300 | [diff] [blame] | 153 | .demod_address = 0x32 >> 1, |
| 154 | .output_mode = S5H1409_SERIAL_OUTPUT, |
Steven Toth | fc959be | 2007-09-08 19:08:17 -0300 | [diff] [blame] | 155 | .gpio = S5H1409_GPIO_ON, |
Michael Krufky | 2b03238 | 2007-12-13 10:04:10 -0300 | [diff] [blame] | 156 | .qam_if = 44000, |
Steven Toth | fc959be | 2007-09-08 19:08:17 -0300 | [diff] [blame] | 157 | .inversion = S5H1409_INVERSION_OFF, |
Steven Toth | dfc1c08 | 2008-01-15 21:35:22 -0300 | [diff] [blame] | 158 | .status_mode = S5H1409_DEMODLOCKING, |
| 159 | .mpeg_timing = S5H1409_MPEGTIMING_CONTINOUS_NONINVERTING_CLOCK, |
Steven Toth | fc959be | 2007-09-08 19:08:17 -0300 | [diff] [blame] | 160 | }; |
| 161 | |
Steven Toth | b3ea016 | 2008-04-19 01:14:19 -0300 | [diff] [blame] | 162 | static struct tda10048_config hauppauge_hvr1200_config = { |
| 163 | .demod_address = 0x10 >> 1, |
| 164 | .output_mode = TDA10048_SERIAL_OUTPUT, |
| 165 | .fwbulkwritelen = TDA10048_BULKWRITE_200, |
Steven Toth | 484d9e0 | 2009-05-02 11:08:23 -0300 | [diff] [blame] | 166 | .inversion = TDA10048_INVERSION_ON, |
Steven Toth | 8816bef | 2009-05-15 21:04:18 -0300 | [diff] [blame] | 167 | .dtv6_if_freq_khz = TDA10048_IF_3300, |
| 168 | .dtv7_if_freq_khz = TDA10048_IF_3800, |
| 169 | .dtv8_if_freq_khz = TDA10048_IF_4300, |
Steven Toth | 484d9e0 | 2009-05-02 11:08:23 -0300 | [diff] [blame] | 170 | .clk_freq_khz = TDA10048_CLK_16000, |
Steven Toth | b3ea016 | 2008-04-19 01:14:19 -0300 | [diff] [blame] | 171 | }; |
| 172 | |
Michael Krufky | 6b926ec | 2009-05-12 17:32:17 -0300 | [diff] [blame] | 173 | static struct tda10048_config hauppauge_hvr1210_config = { |
| 174 | .demod_address = 0x10 >> 1, |
| 175 | .output_mode = TDA10048_SERIAL_OUTPUT, |
| 176 | .fwbulkwritelen = TDA10048_BULKWRITE_200, |
| 177 | .inversion = TDA10048_INVERSION_ON, |
Michael Krufky | c27586e | 2009-05-16 11:00:23 -0300 | [diff] [blame] | 178 | .dtv6_if_freq_khz = TDA10048_IF_3300, |
| 179 | .dtv7_if_freq_khz = TDA10048_IF_3500, |
| 180 | .dtv8_if_freq_khz = TDA10048_IF_4000, |
Michael Krufky | 6b926ec | 2009-05-12 17:32:17 -0300 | [diff] [blame] | 181 | .clk_freq_khz = TDA10048_CLK_16000, |
| 182 | }; |
| 183 | |
Michael Krufky | 3ba71d2 | 2007-12-07 01:40:36 -0300 | [diff] [blame] | 184 | static struct s5h1409_config hauppauge_ezqam_config = { |
| 185 | .demod_address = 0x32 >> 1, |
| 186 | .output_mode = S5H1409_SERIAL_OUTPUT, |
| 187 | .gpio = S5H1409_GPIO_OFF, |
| 188 | .qam_if = 4000, |
| 189 | .inversion = S5H1409_INVERSION_ON, |
Steven Toth | dfc1c08 | 2008-01-15 21:35:22 -0300 | [diff] [blame] | 190 | .status_mode = S5H1409_DEMODLOCKING, |
| 191 | .mpeg_timing = S5H1409_MPEGTIMING_CONTINOUS_NONINVERTING_CLOCK, |
Michael Krufky | 3ba71d2 | 2007-12-07 01:40:36 -0300 | [diff] [blame] | 192 | }; |
| 193 | |
Steven Toth | fc959be | 2007-09-08 19:08:17 -0300 | [diff] [blame] | 194 | static struct s5h1409_config hauppauge_hvr1800lp_config = { |
| 195 | .demod_address = 0x32 >> 1, |
| 196 | .output_mode = S5H1409_SERIAL_OUTPUT, |
Steven Toth | d19770e | 2007-03-11 20:44:05 -0300 | [diff] [blame] | 197 | .gpio = S5H1409_GPIO_OFF, |
Michael Krufky | 2b03238 | 2007-12-13 10:04:10 -0300 | [diff] [blame] | 198 | .qam_if = 44000, |
Steven Toth | fe47516 | 2007-03-20 15:27:53 -0300 | [diff] [blame] | 199 | .inversion = S5H1409_INVERSION_OFF, |
Steven Toth | dfc1c08 | 2008-01-15 21:35:22 -0300 | [diff] [blame] | 200 | .status_mode = S5H1409_DEMODLOCKING, |
| 201 | .mpeg_timing = S5H1409_MPEGTIMING_CONTINOUS_NONINVERTING_CLOCK, |
Steven Toth | d19770e | 2007-03-11 20:44:05 -0300 | [diff] [blame] | 202 | }; |
| 203 | |
Michael Krufky | 07b4a83 | 2007-12-18 01:09:11 -0300 | [diff] [blame] | 204 | static struct s5h1409_config hauppauge_hvr1500_config = { |
| 205 | .demod_address = 0x32 >> 1, |
| 206 | .output_mode = S5H1409_SERIAL_OUTPUT, |
| 207 | .gpio = S5H1409_GPIO_OFF, |
| 208 | .inversion = S5H1409_INVERSION_OFF, |
Steven Toth | dfc1c08 | 2008-01-15 21:35:22 -0300 | [diff] [blame] | 209 | .status_mode = S5H1409_DEMODLOCKING, |
| 210 | .mpeg_timing = S5H1409_MPEGTIMING_CONTINOUS_NONINVERTING_CLOCK, |
Michael Krufky | 07b4a83 | 2007-12-18 01:09:11 -0300 | [diff] [blame] | 211 | }; |
| 212 | |
Steven Toth | 86184e0 | 2007-09-04 21:40:47 -0300 | [diff] [blame] | 213 | static struct mt2131_config hauppauge_generic_tunerconfig = { |
Steven Toth | a77743b | 2007-08-22 21:01:20 -0300 | [diff] [blame] | 214 | 0x61 |
| 215 | }; |
| 216 | |
Michael Krufky | 9bc37ca | 2007-09-08 15:17:13 -0300 | [diff] [blame] | 217 | static struct lgdt330x_config fusionhdtv_5_express = { |
| 218 | .demod_address = 0x0e, |
| 219 | .demod_chip = LGDT3303, |
| 220 | .serial_mpeg = 0x40, |
| 221 | }; |
| 222 | |
Steven Toth | d1987d5 | 2007-12-18 01:57:06 -0300 | [diff] [blame] | 223 | static struct s5h1409_config hauppauge_hvr1500q_config = { |
| 224 | .demod_address = 0x32 >> 1, |
| 225 | .output_mode = S5H1409_SERIAL_OUTPUT, |
| 226 | .gpio = S5H1409_GPIO_ON, |
| 227 | .qam_if = 44000, |
| 228 | .inversion = S5H1409_INVERSION_OFF, |
Steven Toth | dfc1c08 | 2008-01-15 21:35:22 -0300 | [diff] [blame] | 229 | .status_mode = S5H1409_DEMODLOCKING, |
| 230 | .mpeg_timing = S5H1409_MPEGTIMING_CONTINOUS_NONINVERTING_CLOCK, |
Steven Toth | d1987d5 | 2007-12-18 01:57:06 -0300 | [diff] [blame] | 231 | }; |
| 232 | |
Michael Krufky | 335377b | 2008-05-07 01:43:10 -0300 | [diff] [blame] | 233 | static struct s5h1409_config dvico_s5h1409_config = { |
| 234 | .demod_address = 0x32 >> 1, |
| 235 | .output_mode = S5H1409_SERIAL_OUTPUT, |
| 236 | .gpio = S5H1409_GPIO_ON, |
| 237 | .qam_if = 44000, |
| 238 | .inversion = S5H1409_INVERSION_OFF, |
| 239 | .status_mode = S5H1409_DEMODLOCKING, |
| 240 | .mpeg_timing = S5H1409_MPEGTIMING_CONTINOUS_NONINVERTING_CLOCK, |
| 241 | }; |
| 242 | |
Michael Krufky | 52b5045 | 2008-07-09 02:18:49 -0300 | [diff] [blame] | 243 | static struct s5h1411_config dvico_s5h1411_config = { |
| 244 | .output_mode = S5H1411_SERIAL_OUTPUT, |
| 245 | .gpio = S5H1411_GPIO_ON, |
| 246 | .qam_if = S5H1411_IF_44000, |
| 247 | .vsb_if = S5H1411_IF_44000, |
| 248 | .inversion = S5H1411_INVERSION_OFF, |
| 249 | .status_mode = S5H1411_DEMODLOCKING, |
| 250 | .mpeg_timing = S5H1411_MPEGTIMING_CONTINOUS_NONINVERTING_CLOCK, |
| 251 | }; |
| 252 | |
Michael Krufky | 19bc579 | 2009-05-08 16:05:29 -0300 | [diff] [blame] | 253 | static struct s5h1411_config hcw_s5h1411_config = { |
| 254 | .output_mode = S5H1411_SERIAL_OUTPUT, |
| 255 | .gpio = S5H1411_GPIO_OFF, |
| 256 | .vsb_if = S5H1411_IF_44000, |
| 257 | .qam_if = S5H1411_IF_4000, |
| 258 | .inversion = S5H1411_INVERSION_ON, |
| 259 | .status_mode = S5H1411_DEMODLOCKING, |
| 260 | .mpeg_timing = S5H1411_MPEGTIMING_CONTINOUS_NONINVERTING_CLOCK, |
| 261 | }; |
| 262 | |
Steven Toth | d1987d5 | 2007-12-18 01:57:06 -0300 | [diff] [blame] | 263 | static struct xc5000_config hauppauge_hvr1500q_tunerconfig = { |
Steven Toth | e12671c | 2007-12-20 01:14:43 -0300 | [diff] [blame] | 264 | .i2c_address = 0x61, |
| 265 | .if_khz = 5380, |
Steven Toth | d1987d5 | 2007-12-18 01:57:06 -0300 | [diff] [blame] | 266 | }; |
| 267 | |
Michael Krufky | 335377b | 2008-05-07 01:43:10 -0300 | [diff] [blame] | 268 | static struct xc5000_config dvico_xc5000_tunerconfig = { |
| 269 | .i2c_address = 0x64, |
| 270 | .if_khz = 5380, |
Michael Krufky | 335377b | 2008-05-07 01:43:10 -0300 | [diff] [blame] | 271 | }; |
| 272 | |
Michael Krufky | 4041f1a | 2007-12-24 04:52:08 -0300 | [diff] [blame] | 273 | static struct tda829x_config tda829x_no_probe = { |
| 274 | .probe_tuner = TDA829X_DONT_PROBE, |
| 275 | }; |
| 276 | |
Michael Krufky | f21e0d7 | 2008-01-02 03:01:54 -0300 | [diff] [blame] | 277 | static struct tda18271_std_map hauppauge_tda18271_std_map = { |
Michael Krufky | c0dc0c1 | 2008-04-22 14:46:22 -0300 | [diff] [blame] | 278 | .atsc_6 = { .if_freq = 5380, .agc_mode = 3, .std = 3, |
| 279 | .if_lvl = 6, .rfagc_top = 0x37 }, |
| 280 | .qam_6 = { .if_freq = 4000, .agc_mode = 3, .std = 0, |
| 281 | .if_lvl = 6, .rfagc_top = 0x37 }, |
Michael Krufky | f21e0d7 | 2008-01-02 03:01:54 -0300 | [diff] [blame] | 282 | }; |
| 283 | |
Michael Krufky | b34cdc3 | 2009-05-21 12:49:28 -0300 | [diff] [blame] | 284 | static struct tda18271_std_map hauppauge_hvr1200_tda18271_std_map = { |
| 285 | .dvbt_6 = { .if_freq = 3300, .agc_mode = 3, .std = 4, |
| 286 | .if_lvl = 1, .rfagc_top = 0x37, }, |
| 287 | .dvbt_7 = { .if_freq = 3800, .agc_mode = 3, .std = 5, |
| 288 | .if_lvl = 1, .rfagc_top = 0x37, }, |
| 289 | .dvbt_8 = { .if_freq = 4300, .agc_mode = 3, .std = 6, |
| 290 | .if_lvl = 1, .rfagc_top = 0x37, }, |
| 291 | }; |
| 292 | |
Michael Krufky | f21e0d7 | 2008-01-02 03:01:54 -0300 | [diff] [blame] | 293 | static struct tda18271_config hauppauge_tda18271_config = { |
| 294 | .std_map = &hauppauge_tda18271_std_map, |
| 295 | .gate = TDA18271_GATE_ANALOG, |
Michael Krufky | 04a68ba | 2009-09-06 14:11:09 -0300 | [diff] [blame] | 296 | .output_opt = TDA18271_OUTPUT_LT_OFF, |
Michael Krufky | f21e0d7 | 2008-01-02 03:01:54 -0300 | [diff] [blame] | 297 | }; |
| 298 | |
Steven Toth | b3ea016 | 2008-04-19 01:14:19 -0300 | [diff] [blame] | 299 | static struct tda18271_config hauppauge_hvr1200_tuner_config = { |
Michael Krufky | b34cdc3 | 2009-05-21 12:49:28 -0300 | [diff] [blame] | 300 | .std_map = &hauppauge_hvr1200_tda18271_std_map, |
Steven Toth | b3ea016 | 2008-04-19 01:14:19 -0300 | [diff] [blame] | 301 | .gate = TDA18271_GATE_ANALOG, |
Michael Krufky | 04a68ba | 2009-09-06 14:11:09 -0300 | [diff] [blame] | 302 | .output_opt = TDA18271_OUTPUT_LT_OFF, |
Steven Toth | b3ea016 | 2008-04-19 01:14:19 -0300 | [diff] [blame] | 303 | }; |
| 304 | |
Michael Krufky | 6b926ec | 2009-05-12 17:32:17 -0300 | [diff] [blame] | 305 | static struct tda18271_config hauppauge_hvr1210_tuner_config = { |
| 306 | .gate = TDA18271_GATE_DIGITAL, |
Michael Krufky | 04a68ba | 2009-09-06 14:11:09 -0300 | [diff] [blame] | 307 | .output_opt = TDA18271_OUTPUT_LT_OFF, |
Michael Krufky | 6b926ec | 2009-05-12 17:32:17 -0300 | [diff] [blame] | 308 | }; |
| 309 | |
Michael Krufky | 247bc54 | 2009-05-12 18:53:47 -0300 | [diff] [blame] | 310 | static struct tda18271_std_map hauppauge_hvr127x_std_map = { |
Michael Krufky | a5dbf45 | 2009-05-03 23:27:02 -0300 | [diff] [blame] | 311 | .atsc_6 = { .if_freq = 3250, .agc_mode = 3, .std = 4, |
| 312 | .if_lvl = 1, .rfagc_top = 0x58 }, |
| 313 | .qam_6 = { .if_freq = 4000, .agc_mode = 3, .std = 5, |
| 314 | .if_lvl = 1, .rfagc_top = 0x58 }, |
| 315 | }; |
| 316 | |
Michael Krufky | 247bc54 | 2009-05-12 18:53:47 -0300 | [diff] [blame] | 317 | static struct tda18271_config hauppauge_hvr127x_config = { |
| 318 | .std_map = &hauppauge_hvr127x_std_map, |
Michael Krufky | 04a68ba | 2009-09-06 14:11:09 -0300 | [diff] [blame] | 319 | .output_opt = TDA18271_OUTPUT_LT_OFF, |
Michael Krufky | a5dbf45 | 2009-05-03 23:27:02 -0300 | [diff] [blame] | 320 | }; |
| 321 | |
Michael Krufky | 247bc54 | 2009-05-12 18:53:47 -0300 | [diff] [blame] | 322 | static struct lgdt3305_config hauppauge_lgdt3305_config = { |
Michael Krufky | a5dbf45 | 2009-05-03 23:27:02 -0300 | [diff] [blame] | 323 | .i2c_addr = 0x0e, |
| 324 | .mpeg_mode = LGDT3305_MPEG_SERIAL, |
| 325 | .tpclk_edge = LGDT3305_TPCLK_FALLING_EDGE, |
| 326 | .tpvalid_polarity = LGDT3305_TP_VALID_HIGH, |
| 327 | .deny_i2c_rptr = 1, |
| 328 | .spectral_inversion = 1, |
| 329 | .qam_if_khz = 4000, |
| 330 | .vsb_if_khz = 3250, |
| 331 | }; |
| 332 | |
Harvey Harrison | b1721d0 | 2008-04-25 19:03:08 -0700 | [diff] [blame] | 333 | static struct dibx000_agc_config xc3028_agc_config = { |
Steven Toth | 6676237 | 2008-04-22 15:38:26 -0300 | [diff] [blame] | 334 | BAND_VHF | BAND_UHF, /* band_caps */ |
| 335 | |
| 336 | /* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0, P_agc_freq_pwm_div=0, |
| 337 | * P_agc_inv_pwm1=0, P_agc_inv_pwm2=0, |
| 338 | * P_agc_inh_dc_rv_est=0, P_agc_time_est=3, P_agc_freeze=0, |
| 339 | * P_agc_nb_est=2, P_agc_write=0 |
| 340 | */ |
| 341 | (0 << 15) | (0 << 14) | (0 << 11) | (0 << 10) | (0 << 9) | (0 << 8) | |
| 342 | (3 << 5) | (0 << 4) | (2 << 1) | (0 << 0), /* setup */ |
| 343 | |
| 344 | 712, /* inv_gain */ |
| 345 | 21, /* time_stabiliz */ |
| 346 | |
| 347 | 0, /* alpha_level */ |
| 348 | 118, /* thlock */ |
| 349 | |
| 350 | 0, /* wbd_inv */ |
| 351 | 2867, /* wbd_ref */ |
| 352 | 0, /* wbd_sel */ |
| 353 | 2, /* wbd_alpha */ |
| 354 | |
| 355 | 0, /* agc1_max */ |
| 356 | 0, /* agc1_min */ |
| 357 | 39718, /* agc2_max */ |
| 358 | 9930, /* agc2_min */ |
| 359 | 0, /* agc1_pt1 */ |
| 360 | 0, /* agc1_pt2 */ |
| 361 | 0, /* agc1_pt3 */ |
| 362 | 0, /* agc1_slope1 */ |
| 363 | 0, /* agc1_slope2 */ |
| 364 | 0, /* agc2_pt1 */ |
| 365 | 128, /* agc2_pt2 */ |
| 366 | 29, /* agc2_slope1 */ |
| 367 | 29, /* agc2_slope2 */ |
| 368 | |
| 369 | 17, /* alpha_mant */ |
| 370 | 27, /* alpha_exp */ |
| 371 | 23, /* beta_mant */ |
| 372 | 51, /* beta_exp */ |
| 373 | |
| 374 | 1, /* perform_agc_softsplit */ |
| 375 | }; |
| 376 | |
| 377 | /* PLL Configuration for COFDM BW_MHz = 8.000000 |
| 378 | * With external clock = 30.000000 */ |
Harvey Harrison | b1721d0 | 2008-04-25 19:03:08 -0700 | [diff] [blame] | 379 | static struct dibx000_bandwidth_config xc3028_bw_config = { |
Steven Toth | 6676237 | 2008-04-22 15:38:26 -0300 | [diff] [blame] | 380 | 60000, /* internal */ |
| 381 | 30000, /* sampling */ |
| 382 | 1, /* pll_cfg: prediv */ |
| 383 | 8, /* pll_cfg: ratio */ |
| 384 | 3, /* pll_cfg: range */ |
| 385 | 1, /* pll_cfg: reset */ |
| 386 | 0, /* pll_cfg: bypass */ |
| 387 | 0, /* misc: refdiv */ |
| 388 | 0, /* misc: bypclk_div */ |
| 389 | 1, /* misc: IO_CLK_en_core */ |
| 390 | 1, /* misc: ADClkSrc */ |
| 391 | 0, /* misc: modulo */ |
| 392 | (3 << 14) | (1 << 12) | (524 << 0), /* sad_cfg: refsel, sel, freq_15k */ |
| 393 | (1 << 25) | 5816102, /* ifreq = 5.200000 MHz */ |
| 394 | 20452225, /* timf */ |
| 395 | 30000000 /* xtal_hz */ |
| 396 | }; |
| 397 | |
| 398 | static struct dib7000p_config hauppauge_hvr1400_dib7000_config = { |
| 399 | .output_mpeg2_in_188_bytes = 1, |
| 400 | .hostbus_diversity = 1, |
| 401 | .tuner_is_baseband = 0, |
| 402 | .update_lna = NULL, |
| 403 | |
| 404 | .agc_config_count = 1, |
| 405 | .agc = &xc3028_agc_config, |
| 406 | .bw = &xc3028_bw_config, |
| 407 | |
| 408 | .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS, |
| 409 | .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES, |
| 410 | .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS, |
| 411 | |
| 412 | .pwm_freq_div = 0, |
| 413 | .agc_control = NULL, |
| 414 | .spur_protect = 0, |
| 415 | |
| 416 | .output_mode = OUTMODE_MPEG2_SERIAL, |
| 417 | }; |
| 418 | |
Steven Toth | aef2d18 | 2008-08-04 21:39:53 -0300 | [diff] [blame] | 419 | static struct zl10353_config dvico_fusionhdtv_xc3028 = { |
| 420 | .demod_address = 0x0f, |
| 421 | .if2 = 45600, |
| 422 | .no_tuner = 1, |
Christopher Pascoe | d4dc673 | 2009-04-27 11:27:04 -0300 | [diff] [blame] | 423 | .disable_i2c_gate_ctrl = 1, |
Steven Toth | aef2d18 | 2008-08-04 21:39:53 -0300 | [diff] [blame] | 424 | }; |
| 425 | |
Igor M. Liplianin | f867c3f | 2009-06-19 05:45:23 -0300 | [diff] [blame] | 426 | static struct stv0900_reg stv0900_ts_regs[] = { |
| 427 | { R0900_TSGENERAL, 0x00 }, |
| 428 | { R0900_P1_TSSPEED, 0x40 }, |
| 429 | { R0900_P2_TSSPEED, 0x40 }, |
| 430 | { R0900_P1_TSCFGM, 0xc0 }, |
| 431 | { R0900_P2_TSCFGM, 0xc0 }, |
| 432 | { R0900_P1_TSCFGH, 0xe0 }, |
| 433 | { R0900_P2_TSCFGH, 0xe0 }, |
| 434 | { R0900_P1_TSCFGL, 0x20 }, |
| 435 | { R0900_P2_TSCFGL, 0x20 }, |
| 436 | { 0xffff, 0xff }, /* terminate */ |
| 437 | }; |
| 438 | |
Igor M. Liplianin | 5a23b07 | 2009-03-03 12:06:09 -0300 | [diff] [blame] | 439 | static struct stv0900_config netup_stv0900_config = { |
| 440 | .demod_address = 0x68, |
Igor M. Liplianin | 29372a8 | 2009-10-17 08:58:26 -0300 | [diff] [blame] | 441 | .demod_mode = 1, /* dual */ |
Abylay Ospan | 644c7ef0 | 2009-07-19 18:06:00 -0300 | [diff] [blame] | 442 | .xtal = 8000000, |
Igor M. Liplianin | 5a23b07 | 2009-03-03 12:06:09 -0300 | [diff] [blame] | 443 | .clkmode = 3,/* 0-CLKI, 2-XTALI, else AUTO */ |
| 444 | .diseqc_mode = 2,/* 2/3 PWM */ |
Igor M. Liplianin | f867c3f | 2009-06-19 05:45:23 -0300 | [diff] [blame] | 445 | .ts_config_regs = stv0900_ts_regs, |
Igor M. Liplianin | 5a23b07 | 2009-03-03 12:06:09 -0300 | [diff] [blame] | 446 | .tun1_maddress = 0,/* 0x60 */ |
| 447 | .tun2_maddress = 3,/* 0x63 */ |
| 448 | .tun1_adc = 1,/* 1 Vpp */ |
| 449 | .tun2_adc = 1,/* 1 Vpp */ |
| 450 | }; |
| 451 | |
| 452 | static struct stv6110_config netup_stv6110_tunerconfig_a = { |
| 453 | .i2c_address = 0x60, |
Abylay Ospan | 644c7ef0 | 2009-07-19 18:06:00 -0300 | [diff] [blame] | 454 | .mclk = 16000000, |
| 455 | .clk_div = 1, |
Abylay Ospan | 873688c | 2009-10-17 08:23:00 -0300 | [diff] [blame] | 456 | .gain = 8, /* +16 dB - maximum gain */ |
Igor M. Liplianin | 5a23b07 | 2009-03-03 12:06:09 -0300 | [diff] [blame] | 457 | }; |
| 458 | |
| 459 | static struct stv6110_config netup_stv6110_tunerconfig_b = { |
| 460 | .i2c_address = 0x63, |
Abylay Ospan | 644c7ef0 | 2009-07-19 18:06:00 -0300 | [diff] [blame] | 461 | .mclk = 16000000, |
| 462 | .clk_div = 1, |
Abylay Ospan | 873688c | 2009-10-17 08:23:00 -0300 | [diff] [blame] | 463 | .gain = 8, /* +16 dB - maximum gain */ |
Igor M. Liplianin | 5a23b07 | 2009-03-03 12:06:09 -0300 | [diff] [blame] | 464 | }; |
| 465 | |
Igor M. Liplianin | 96318d0 | 2009-01-17 12:11:20 -0300 | [diff] [blame] | 466 | static struct cx24116_config tbs_cx24116_config = { |
Igor M. Liplianin | 09ea33e | 2009-11-24 20:16:04 -0300 | [diff] [blame] | 467 | .demod_address = 0x55, |
Igor M. Liplianin | 96318d0 | 2009-01-17 12:11:20 -0300 | [diff] [blame] | 468 | }; |
| 469 | |
Igor M. Liplianin | 09ea33e | 2009-11-24 20:16:04 -0300 | [diff] [blame] | 470 | static struct ds3000_config tevii_ds3000_config = { |
| 471 | .demod_address = 0x68, |
Igor M. Liplianin | 579943f | 2009-01-17 12:18:26 -0300 | [diff] [blame] | 472 | }; |
| 473 | |
Igor M. Liplianin | c9b8b04 | 2009-01-17 12:23:31 -0300 | [diff] [blame] | 474 | static struct cx24116_config dvbworld_cx24116_config = { |
| 475 | .demod_address = 0x05, |
| 476 | }; |
| 477 | |
David Wong | 493b712 | 2009-05-18 05:25:49 -0300 | [diff] [blame] | 478 | static struct lgs8gxx_config mygica_x8506_lgs8gl5_config = { |
| 479 | .prod = LGS8GXX_PROD_LGS8GL5, |
| 480 | .demod_address = 0x19, |
| 481 | .serial_ts = 0, |
| 482 | .ts_clk_pol = 1, |
| 483 | .ts_clk_gated = 1, |
| 484 | .if_clk_freq = 30400, /* 30.4 MHz */ |
| 485 | .if_freq = 5380, /* 5.38 MHz */ |
| 486 | .if_neg_center = 1, |
| 487 | .ext_adc = 0, |
| 488 | .adc_signed = 0, |
| 489 | .if_neg_edge = 0, |
| 490 | }; |
| 491 | |
| 492 | static struct xc5000_config mygica_x8506_xc5000_config = { |
| 493 | .i2c_address = 0x61, |
| 494 | .if_khz = 5380, |
| 495 | }; |
| 496 | |
Mariusz Bia?o?czyk | f667190 | 2012-09-12 07:59:18 -0300 | [diff] [blame] | 497 | static struct stv090x_config prof_8000_stv090x_config = { |
| 498 | .device = STV0903, |
| 499 | .demod_mode = STV090x_SINGLE, |
| 500 | .clk_mode = STV090x_CLK_EXT, |
| 501 | .xtal = 27000000, |
| 502 | .address = 0x6A, |
| 503 | .ts1_mode = STV090x_TSMODE_PARALLEL_PUNCTURED, |
| 504 | .repeater_level = STV090x_RPTLEVEL_64, |
| 505 | .adc1_range = STV090x_ADC_2Vpp, |
| 506 | .diseqc_envelope_mode = false, |
| 507 | |
| 508 | .tuner_get_frequency = stb6100_get_frequency, |
| 509 | .tuner_set_frequency = stb6100_set_frequency, |
| 510 | .tuner_set_bandwidth = stb6100_set_bandwidth, |
| 511 | .tuner_get_bandwidth = stb6100_get_bandwidth, |
| 512 | }; |
| 513 | |
| 514 | static struct stb6100_config prof_8000_stb6100_config = { |
| 515 | .tuner_address = 0x60, |
| 516 | .refclock = 27000000, |
| 517 | }; |
| 518 | |
| 519 | static int p8000_set_voltage(struct dvb_frontend *fe, fe_sec_voltage_t voltage) |
| 520 | { |
| 521 | struct cx23885_tsport *port = fe->dvb->priv; |
| 522 | struct cx23885_dev *dev = port->dev; |
| 523 | |
| 524 | if (voltage == SEC_VOLTAGE_18) |
| 525 | cx_write(MC417_RWD, 0x00001e00); |
| 526 | else if (voltage == SEC_VOLTAGE_13) |
| 527 | cx_write(MC417_RWD, 0x00001a00); |
| 528 | else |
| 529 | cx_write(MC417_RWD, 0x00001800); |
| 530 | return 0; |
| 531 | } |
| 532 | |
Mauro Carvalho Chehab | a7d44ba | 2011-12-26 20:48:54 -0300 | [diff] [blame] | 533 | static int cx23885_dvb_set_frontend(struct dvb_frontend *fe) |
Michael Krufky | f35b9e8 | 2009-05-08 22:39:24 -0300 | [diff] [blame] | 534 | { |
Mauro Carvalho Chehab | a7d44ba | 2011-12-26 20:48:54 -0300 | [diff] [blame] | 535 | struct dtv_frontend_properties *p = &fe->dtv_property_cache; |
Michael Krufky | f35b9e8 | 2009-05-08 22:39:24 -0300 | [diff] [blame] | 536 | struct cx23885_tsport *port = fe->dvb->priv; |
| 537 | struct cx23885_dev *dev = port->dev; |
| 538 | |
| 539 | switch (dev->board) { |
| 540 | case CX23885_BOARD_HAUPPAUGE_HVR1275: |
Mauro Carvalho Chehab | a7d44ba | 2011-12-26 20:48:54 -0300 | [diff] [blame] | 541 | switch (p->modulation) { |
Michael Krufky | f35b9e8 | 2009-05-08 22:39:24 -0300 | [diff] [blame] | 542 | case VSB_8: |
| 543 | cx23885_gpio_clear(dev, GPIO_5); |
| 544 | break; |
| 545 | case QAM_64: |
| 546 | case QAM_256: |
| 547 | default: |
| 548 | cx23885_gpio_set(dev, GPIO_5); |
| 549 | break; |
| 550 | } |
| 551 | break; |
David T.L. Wong | 6f0d8c0 | 2009-10-21 13:15:30 -0300 | [diff] [blame] | 552 | case CX23885_BOARD_MYGICA_X8506: |
| 553 | case CX23885_BOARD_MAGICPRO_PROHDTVE2: |
| 554 | /* Select Digital TV */ |
| 555 | cx23885_gpio_set(dev, GPIO_0); |
| 556 | break; |
Michael Krufky | f35b9e8 | 2009-05-08 22:39:24 -0300 | [diff] [blame] | 557 | } |
Michael Krufky | 5bdd396 | 2009-05-08 22:39:24 -0300 | [diff] [blame] | 558 | return 0; |
Michael Krufky | f35b9e8 | 2009-05-08 22:39:24 -0300 | [diff] [blame] | 559 | } |
| 560 | |
David Wong | 2365b2d | 2009-06-17 01:38:12 -0300 | [diff] [blame] | 561 | static struct lgs8gxx_config magicpro_prohdtve2_lgs8g75_config = { |
| 562 | .prod = LGS8GXX_PROD_LGS8G75, |
| 563 | .demod_address = 0x19, |
| 564 | .serial_ts = 0, |
| 565 | .ts_clk_pol = 1, |
| 566 | .ts_clk_gated = 1, |
| 567 | .if_clk_freq = 30400, /* 30.4 MHz */ |
| 568 | .if_freq = 6500, /* 6.50 MHz */ |
| 569 | .if_neg_center = 1, |
| 570 | .ext_adc = 0, |
| 571 | .adc_signed = 1, |
| 572 | .adc_vpp = 2, /* 1.6 Vpp */ |
| 573 | .if_neg_edge = 1, |
| 574 | }; |
| 575 | |
| 576 | static struct xc5000_config magicpro_prohdtve2_xc5000_config = { |
| 577 | .i2c_address = 0x61, |
| 578 | .if_khz = 6500, |
| 579 | }; |
| 580 | |
David T. L. Wong | ea5697f | 2009-10-26 08:54:04 -0300 | [diff] [blame] | 581 | static struct atbm8830_config mygica_x8558pro_atbm8830_cfg1 = { |
| 582 | .prod = ATBM8830_PROD_8830, |
| 583 | .demod_address = 0x44, |
| 584 | .serial_ts = 0, |
| 585 | .ts_sampling_edge = 1, |
| 586 | .ts_clk_gated = 0, |
| 587 | .osc_clk_freq = 30400, /* in kHz */ |
| 588 | .if_freq = 0, /* zero IF */ |
| 589 | .zif_swap_iq = 1, |
David Wong | c245c75 | 2009-11-28 08:36:31 -0300 | [diff] [blame] | 590 | .agc_min = 0x2E, |
| 591 | .agc_max = 0xFF, |
| 592 | .agc_hold_loop = 0, |
David T. L. Wong | ea5697f | 2009-10-26 08:54:04 -0300 | [diff] [blame] | 593 | }; |
| 594 | |
| 595 | static struct max2165_config mygic_x8558pro_max2165_cfg1 = { |
| 596 | .i2c_address = 0x60, |
| 597 | .osc_clk = 20 |
| 598 | }; |
| 599 | |
| 600 | static struct atbm8830_config mygica_x8558pro_atbm8830_cfg2 = { |
| 601 | .prod = ATBM8830_PROD_8830, |
| 602 | .demod_address = 0x44, |
| 603 | .serial_ts = 1, |
| 604 | .ts_sampling_edge = 1, |
| 605 | .ts_clk_gated = 0, |
| 606 | .osc_clk_freq = 30400, /* in kHz */ |
| 607 | .if_freq = 0, /* zero IF */ |
| 608 | .zif_swap_iq = 1, |
David Wong | c245c75 | 2009-11-28 08:36:31 -0300 | [diff] [blame] | 609 | .agc_min = 0x2E, |
| 610 | .agc_max = 0xFF, |
| 611 | .agc_hold_loop = 0, |
David T. L. Wong | ea5697f | 2009-10-26 08:54:04 -0300 | [diff] [blame] | 612 | }; |
| 613 | |
| 614 | static struct max2165_config mygic_x8558pro_max2165_cfg2 = { |
| 615 | .i2c_address = 0x60, |
| 616 | .osc_clk = 20 |
| 617 | }; |
Igor M. Liplianin | 78db854 | 2011-01-25 17:04:00 -0300 | [diff] [blame] | 618 | static struct stv0367_config netup_stv0367_config[] = { |
| 619 | { |
| 620 | .demod_address = 0x1c, |
| 621 | .xtal = 27000000, |
| 622 | .if_khz = 4500, |
| 623 | .if_iq_mode = 0, |
| 624 | .ts_mode = 1, |
| 625 | .clk_pol = 0, |
| 626 | }, { |
| 627 | .demod_address = 0x1d, |
| 628 | .xtal = 27000000, |
| 629 | .if_khz = 4500, |
| 630 | .if_iq_mode = 0, |
| 631 | .ts_mode = 1, |
| 632 | .clk_pol = 0, |
| 633 | }, |
| 634 | }; |
| 635 | |
| 636 | static struct xc5000_config netup_xc5000_config[] = { |
| 637 | { |
| 638 | .i2c_address = 0x61, |
| 639 | .if_khz = 4500, |
| 640 | }, { |
| 641 | .i2c_address = 0x64, |
| 642 | .if_khz = 4500, |
| 643 | }, |
| 644 | }; |
| 645 | |
Stefan Ringel | 722c90e | 2012-01-07 09:20:48 -0300 | [diff] [blame] | 646 | static struct drxk_config terratec_drxk_config[] = { |
| 647 | { |
| 648 | .adr = 0x29, |
| 649 | .no_i2c_bridge = 1, |
| 650 | }, { |
| 651 | .adr = 0x2a, |
| 652 | .no_i2c_bridge = 1, |
| 653 | }, |
| 654 | }; |
| 655 | |
| 656 | static struct mt2063_config terratec_mt2063_config[] = { |
| 657 | { |
| 658 | .tuner_address = 0x60, |
| 659 | }, { |
| 660 | .tuner_address = 0x67, |
| 661 | }, |
| 662 | }; |
| 663 | |
Michael Krufky | 7c62f5a | 2012-12-15 23:34:09 -0300 | [diff] [blame] | 664 | static const struct tda10071_config hauppauge_tda10071_config = { |
Michael Krufky | 41f55d5 | 2012-12-16 19:37:11 -0300 | [diff] [blame^] | 665 | .demod_i2c_addr = 0x05, |
Michael Krufky | 7c62f5a | 2012-12-15 23:34:09 -0300 | [diff] [blame] | 666 | .tuner_i2c_addr = 0x54, |
| 667 | .i2c_wr_max = 64, |
| 668 | .ts_mode = TDA10071_TS_SERIAL, |
| 669 | .spec_inv = 0, |
| 670 | .xtal = 40444000, /* 40.444 MHz */ |
| 671 | .pll_multiplier = 20, |
| 672 | }; |
| 673 | |
| 674 | static const struct a8293_config hauppauge_a8293_config = { |
| 675 | .i2c_addr = 0x0b, |
| 676 | }; |
| 677 | |
Mauro Carvalho Chehab | ada73ee | 2012-10-27 11:29:23 -0300 | [diff] [blame] | 678 | static int netup_altera_fpga_rw(void *device, int flag, int data, int read) |
Igor M. Liplianin | 78db854 | 2011-01-25 17:04:00 -0300 | [diff] [blame] | 679 | { |
| 680 | struct cx23885_dev *dev = (struct cx23885_dev *)device; |
| 681 | unsigned long timeout = jiffies + msecs_to_jiffies(1); |
Abylay Ospan | d164460 | 2011-01-02 09:10:00 -0300 | [diff] [blame] | 682 | uint32_t mem = 0; |
Igor M. Liplianin | 78db854 | 2011-01-25 17:04:00 -0300 | [diff] [blame] | 683 | |
Abylay Ospan | d164460 | 2011-01-02 09:10:00 -0300 | [diff] [blame] | 684 | mem = cx_read(MC417_RWD); |
Igor M. Liplianin | 78db854 | 2011-01-25 17:04:00 -0300 | [diff] [blame] | 685 | if (read) |
| 686 | cx_set(MC417_OEN, ALT_DATA); |
| 687 | else { |
| 688 | cx_clear(MC417_OEN, ALT_DATA);/* D0-D7 out */ |
Igor M. Liplianin | 78db854 | 2011-01-25 17:04:00 -0300 | [diff] [blame] | 689 | mem &= ~ALT_DATA; |
| 690 | mem |= (data & ALT_DATA); |
Igor M. Liplianin | 78db854 | 2011-01-25 17:04:00 -0300 | [diff] [blame] | 691 | } |
| 692 | |
| 693 | if (flag) |
Abylay Ospan | d164460 | 2011-01-02 09:10:00 -0300 | [diff] [blame] | 694 | mem |= ALT_AD_RG; |
Igor M. Liplianin | 78db854 | 2011-01-25 17:04:00 -0300 | [diff] [blame] | 695 | else |
Abylay Ospan | d164460 | 2011-01-02 09:10:00 -0300 | [diff] [blame] | 696 | mem &= ~ALT_AD_RG; |
Igor M. Liplianin | 78db854 | 2011-01-25 17:04:00 -0300 | [diff] [blame] | 697 | |
Abylay Ospan | d164460 | 2011-01-02 09:10:00 -0300 | [diff] [blame] | 698 | mem &= ~ALT_CS; |
Igor M. Liplianin | 78db854 | 2011-01-25 17:04:00 -0300 | [diff] [blame] | 699 | if (read) |
Abylay Ospan | d164460 | 2011-01-02 09:10:00 -0300 | [diff] [blame] | 700 | mem = (mem & ~ALT_RD) | ALT_WR; |
Igor M. Liplianin | 78db854 | 2011-01-25 17:04:00 -0300 | [diff] [blame] | 701 | else |
Abylay Ospan | d164460 | 2011-01-02 09:10:00 -0300 | [diff] [blame] | 702 | mem = (mem & ~ALT_WR) | ALT_RD; |
| 703 | |
| 704 | cx_write(MC417_RWD, mem); /* start RW cycle */ |
Igor M. Liplianin | 78db854 | 2011-01-25 17:04:00 -0300 | [diff] [blame] | 705 | |
| 706 | for (;;) { |
| 707 | mem = cx_read(MC417_RWD); |
| 708 | if ((mem & ALT_RDY) == 0) |
| 709 | break; |
| 710 | if (time_after(jiffies, timeout)) |
| 711 | break; |
| 712 | udelay(1); |
| 713 | } |
| 714 | |
| 715 | cx_set(MC417_RWD, ALT_RD | ALT_WR | ALT_CS); |
| 716 | if (read) |
| 717 | return mem & ALT_DATA; |
| 718 | |
| 719 | return 0; |
| 720 | }; |
David T. L. Wong | ea5697f | 2009-10-26 08:54:04 -0300 | [diff] [blame] | 721 | |
Steven Toth | d19770e | 2007-03-11 20:44:05 -0300 | [diff] [blame] | 722 | static int dvb_register(struct cx23885_tsport *port) |
| 723 | { |
| 724 | struct cx23885_dev *dev = port->dev; |
David Wong | 493b712 | 2009-05-18 05:25:49 -0300 | [diff] [blame] | 725 | struct cx23885_i2c *i2c_bus = NULL, *i2c_bus2 = NULL; |
Igor M. Liplianin | 78db854 | 2011-01-25 17:04:00 -0300 | [diff] [blame] | 726 | struct videobuf_dvb_frontend *fe0, *fe1 = NULL; |
| 727 | int mfe_shared = 0; /* bus not shared by default */ |
Igor M. Liplianin | 5a23b07 | 2009-03-03 12:06:09 -0300 | [diff] [blame] | 728 | int ret; |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 729 | |
Darron Broad | f972e0b | 2008-10-11 11:24:30 -0300 | [diff] [blame] | 730 | /* Get the first frontend */ |
Darron Broad | 92abe9e | 2008-10-11 11:18:53 -0300 | [diff] [blame] | 731 | fe0 = videobuf_dvb_get_frontend(&port->frontends, 1); |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 732 | if (!fe0) |
| 733 | return -EINVAL; |
Steven Toth | d19770e | 2007-03-11 20:44:05 -0300 | [diff] [blame] | 734 | |
| 735 | /* init struct videobuf_dvb */ |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 736 | fe0->dvb.name = dev->name; |
Steven Toth | d19770e | 2007-03-11 20:44:05 -0300 | [diff] [blame] | 737 | |
Igor M. Liplianin | 78db854 | 2011-01-25 17:04:00 -0300 | [diff] [blame] | 738 | /* multi-frontend gate control is undefined or defaults to fe0 */ |
| 739 | port->frontends.gate = 0; |
| 740 | |
| 741 | /* Sets the gate control callback to be used by i2c command calls */ |
| 742 | port->gate_ctrl = cx23885_dvb_gate_ctrl; |
| 743 | |
Steven Toth | d19770e | 2007-03-11 20:44:05 -0300 | [diff] [blame] | 744 | /* init frontend */ |
| 745 | switch (dev->board) { |
Steven Toth | a77743b | 2007-08-22 21:01:20 -0300 | [diff] [blame] | 746 | case CX23885_BOARD_HAUPPAUGE_HVR1250: |
Michael Krufky | f139fa7 | 2007-09-09 03:55:34 -0300 | [diff] [blame] | 747 | i2c_bus = &dev->i2c_bus[0]; |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 748 | fe0->dvb.frontend = dvb_attach(s5h1409_attach, |
Steven Toth | 86184e0 | 2007-09-04 21:40:47 -0300 | [diff] [blame] | 749 | &hauppauge_generic_config, |
Michael Krufky | f139fa7 | 2007-09-09 03:55:34 -0300 | [diff] [blame] | 750 | &i2c_bus->i2c_adap); |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 751 | if (fe0->dvb.frontend != NULL) { |
| 752 | dvb_attach(mt2131_attach, fe0->dvb.frontend, |
Michael Krufky | f139fa7 | 2007-09-09 03:55:34 -0300 | [diff] [blame] | 753 | &i2c_bus->i2c_adap, |
Steven Toth | 86184e0 | 2007-09-04 21:40:47 -0300 | [diff] [blame] | 754 | &hauppauge_generic_tunerconfig, 0); |
Steven Toth | d19770e | 2007-03-11 20:44:05 -0300 | [diff] [blame] | 755 | } |
| 756 | break; |
Michael Krufky | a5dbf45 | 2009-05-03 23:27:02 -0300 | [diff] [blame] | 757 | case CX23885_BOARD_HAUPPAUGE_HVR1270: |
Michael Krufky | d099bec | 2009-05-08 22:39:24 -0300 | [diff] [blame] | 758 | case CX23885_BOARD_HAUPPAUGE_HVR1275: |
Michael Krufky | a5dbf45 | 2009-05-03 23:27:02 -0300 | [diff] [blame] | 759 | i2c_bus = &dev->i2c_bus[0]; |
| 760 | fe0->dvb.frontend = dvb_attach(lgdt3305_attach, |
Michael Krufky | 247bc54 | 2009-05-12 18:53:47 -0300 | [diff] [blame] | 761 | &hauppauge_lgdt3305_config, |
Michael Krufky | a5dbf45 | 2009-05-03 23:27:02 -0300 | [diff] [blame] | 762 | &i2c_bus->i2c_adap); |
| 763 | if (fe0->dvb.frontend != NULL) { |
| 764 | dvb_attach(tda18271_attach, fe0->dvb.frontend, |
| 765 | 0x60, &dev->i2c_bus[1].i2c_adap, |
Michael Krufky | 247bc54 | 2009-05-12 18:53:47 -0300 | [diff] [blame] | 766 | &hauppauge_hvr127x_config); |
Michael Krufky | a5dbf45 | 2009-05-03 23:27:02 -0300 | [diff] [blame] | 767 | } |
| 768 | break; |
Michael Krufky | 19bc579 | 2009-05-08 16:05:29 -0300 | [diff] [blame] | 769 | case CX23885_BOARD_HAUPPAUGE_HVR1255: |
Devin Heitmueller | 0ac60ac | 2012-07-01 16:15:14 -0300 | [diff] [blame] | 770 | case CX23885_BOARD_HAUPPAUGE_HVR1255_22111: |
Michael Krufky | 19bc579 | 2009-05-08 16:05:29 -0300 | [diff] [blame] | 771 | i2c_bus = &dev->i2c_bus[0]; |
| 772 | fe0->dvb.frontend = dvb_attach(s5h1411_attach, |
| 773 | &hcw_s5h1411_config, |
| 774 | &i2c_bus->i2c_adap); |
| 775 | if (fe0->dvb.frontend != NULL) { |
| 776 | dvb_attach(tda18271_attach, fe0->dvb.frontend, |
| 777 | 0x60, &dev->i2c_bus[1].i2c_adap, |
| 778 | &hauppauge_tda18271_config); |
| 779 | } |
Devin Heitmueller | 0ac60ac | 2012-07-01 16:15:14 -0300 | [diff] [blame] | 780 | |
| 781 | tda18271_attach(&dev->ts1.analog_fe, |
| 782 | 0x60, &dev->i2c_bus[1].i2c_adap, |
| 783 | &hauppauge_tda18271_config); |
| 784 | |
Michael Krufky | 19bc579 | 2009-05-08 16:05:29 -0300 | [diff] [blame] | 785 | break; |
Michael Krufky | 3ba71d2 | 2007-12-07 01:40:36 -0300 | [diff] [blame] | 786 | case CX23885_BOARD_HAUPPAUGE_HVR1800: |
| 787 | i2c_bus = &dev->i2c_bus[0]; |
Darron Broad | 92abe9e | 2008-10-11 11:18:53 -0300 | [diff] [blame] | 788 | switch (alt_tuner) { |
Michael Krufky | 3ba71d2 | 2007-12-07 01:40:36 -0300 | [diff] [blame] | 789 | case 1: |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 790 | fe0->dvb.frontend = |
Michael Krufky | 3ba71d2 | 2007-12-07 01:40:36 -0300 | [diff] [blame] | 791 | dvb_attach(s5h1409_attach, |
| 792 | &hauppauge_ezqam_config, |
| 793 | &i2c_bus->i2c_adap); |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 794 | if (fe0->dvb.frontend != NULL) { |
| 795 | dvb_attach(tda829x_attach, fe0->dvb.frontend, |
Michael Krufky | 3ba71d2 | 2007-12-07 01:40:36 -0300 | [diff] [blame] | 796 | &dev->i2c_bus[1].i2c_adap, 0x42, |
Michael Krufky | 4041f1a | 2007-12-24 04:52:08 -0300 | [diff] [blame] | 797 | &tda829x_no_probe); |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 798 | dvb_attach(tda18271_attach, fe0->dvb.frontend, |
Michael Krufky | 4041f1a | 2007-12-24 04:52:08 -0300 | [diff] [blame] | 799 | 0x60, &dev->i2c_bus[1].i2c_adap, |
Michael Krufky | f21e0d7 | 2008-01-02 03:01:54 -0300 | [diff] [blame] | 800 | &hauppauge_tda18271_config); |
Michael Krufky | 3ba71d2 | 2007-12-07 01:40:36 -0300 | [diff] [blame] | 801 | } |
| 802 | break; |
| 803 | case 0: |
| 804 | default: |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 805 | fe0->dvb.frontend = |
Michael Krufky | 3ba71d2 | 2007-12-07 01:40:36 -0300 | [diff] [blame] | 806 | dvb_attach(s5h1409_attach, |
| 807 | &hauppauge_generic_config, |
| 808 | &i2c_bus->i2c_adap); |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 809 | if (fe0->dvb.frontend != NULL) |
| 810 | dvb_attach(mt2131_attach, fe0->dvb.frontend, |
Michael Krufky | 3ba71d2 | 2007-12-07 01:40:36 -0300 | [diff] [blame] | 811 | &i2c_bus->i2c_adap, |
| 812 | &hauppauge_generic_tunerconfig, 0); |
| 813 | break; |
| 814 | } |
| 815 | break; |
Steven Toth | fc959be | 2007-09-08 19:08:17 -0300 | [diff] [blame] | 816 | case CX23885_BOARD_HAUPPAUGE_HVR1800lp: |
Michael Krufky | f139fa7 | 2007-09-09 03:55:34 -0300 | [diff] [blame] | 817 | i2c_bus = &dev->i2c_bus[0]; |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 818 | fe0->dvb.frontend = dvb_attach(s5h1409_attach, |
Steven Toth | fc959be | 2007-09-08 19:08:17 -0300 | [diff] [blame] | 819 | &hauppauge_hvr1800lp_config, |
Michael Krufky | f139fa7 | 2007-09-09 03:55:34 -0300 | [diff] [blame] | 820 | &i2c_bus->i2c_adap); |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 821 | if (fe0->dvb.frontend != NULL) { |
| 822 | dvb_attach(mt2131_attach, fe0->dvb.frontend, |
Michael Krufky | f139fa7 | 2007-09-09 03:55:34 -0300 | [diff] [blame] | 823 | &i2c_bus->i2c_adap, |
Steven Toth | fc959be | 2007-09-08 19:08:17 -0300 | [diff] [blame] | 824 | &hauppauge_generic_tunerconfig, 0); |
| 825 | } |
| 826 | break; |
Michael Krufky | 9bc37ca | 2007-09-08 15:17:13 -0300 | [diff] [blame] | 827 | case CX23885_BOARD_DVICO_FUSIONHDTV_5_EXP: |
Michael Krufky | f139fa7 | 2007-09-09 03:55:34 -0300 | [diff] [blame] | 828 | i2c_bus = &dev->i2c_bus[0]; |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 829 | fe0->dvb.frontend = dvb_attach(lgdt330x_attach, |
Michael Krufky | 9bc37ca | 2007-09-08 15:17:13 -0300 | [diff] [blame] | 830 | &fusionhdtv_5_express, |
Michael Krufky | f139fa7 | 2007-09-09 03:55:34 -0300 | [diff] [blame] | 831 | &i2c_bus->i2c_adap); |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 832 | if (fe0->dvb.frontend != NULL) { |
| 833 | dvb_attach(simple_tuner_attach, fe0->dvb.frontend, |
Michael Krufky | 827855d | 2008-04-22 14:46:16 -0300 | [diff] [blame] | 834 | &i2c_bus->i2c_adap, 0x61, |
| 835 | TUNER_LG_TDVS_H06XF); |
Michael Krufky | 9bc37ca | 2007-09-08 15:17:13 -0300 | [diff] [blame] | 836 | } |
| 837 | break; |
Steven Toth | d1987d5 | 2007-12-18 01:57:06 -0300 | [diff] [blame] | 838 | case CX23885_BOARD_HAUPPAUGE_HVR1500Q: |
| 839 | i2c_bus = &dev->i2c_bus[1]; |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 840 | fe0->dvb.frontend = dvb_attach(s5h1409_attach, |
Steven Toth | d1987d5 | 2007-12-18 01:57:06 -0300 | [diff] [blame] | 841 | &hauppauge_hvr1500q_config, |
| 842 | &dev->i2c_bus[0].i2c_adap); |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 843 | if (fe0->dvb.frontend != NULL) |
| 844 | dvb_attach(xc5000_attach, fe0->dvb.frontend, |
Michael Krufky | 3065096 | 2008-09-06 14:56:58 -0300 | [diff] [blame] | 845 | &i2c_bus->i2c_adap, |
| 846 | &hauppauge_hvr1500q_tunerconfig); |
Steven Toth | d1987d5 | 2007-12-18 01:57:06 -0300 | [diff] [blame] | 847 | break; |
Michael Krufky | 07b4a83 | 2007-12-18 01:09:11 -0300 | [diff] [blame] | 848 | case CX23885_BOARD_HAUPPAUGE_HVR1500: |
| 849 | i2c_bus = &dev->i2c_bus[1]; |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 850 | fe0->dvb.frontend = dvb_attach(s5h1409_attach, |
Michael Krufky | 07b4a83 | 2007-12-18 01:09:11 -0300 | [diff] [blame] | 851 | &hauppauge_hvr1500_config, |
| 852 | &dev->i2c_bus[0].i2c_adap); |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 853 | if (fe0->dvb.frontend != NULL) { |
Michael Krufky | 07b4a83 | 2007-12-18 01:09:11 -0300 | [diff] [blame] | 854 | struct dvb_frontend *fe; |
| 855 | struct xc2028_config cfg = { |
| 856 | .i2c_adap = &i2c_bus->i2c_adap, |
| 857 | .i2c_addr = 0x61, |
Michael Krufky | 07b4a83 | 2007-12-18 01:09:11 -0300 | [diff] [blame] | 858 | }; |
| 859 | static struct xc2028_ctrl ctl = { |
Michael Krufky | ef80bfe | 2008-09-16 02:15:30 -0300 | [diff] [blame] | 860 | .fname = XC2028_DEFAULT_FIRMWARE, |
Michael Krufky | 07b4a83 | 2007-12-18 01:09:11 -0300 | [diff] [blame] | 861 | .max_len = 64, |
Steven Toth | 52c3d29 | 2009-04-20 22:42:00 -0300 | [diff] [blame] | 862 | .demod = XC3028_FE_OREN538, |
Michael Krufky | 07b4a83 | 2007-12-18 01:09:11 -0300 | [diff] [blame] | 863 | }; |
| 864 | |
| 865 | fe = dvb_attach(xc2028_attach, |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 866 | fe0->dvb.frontend, &cfg); |
Michael Krufky | 07b4a83 | 2007-12-18 01:09:11 -0300 | [diff] [blame] | 867 | if (fe != NULL && fe->ops.tuner_ops.set_config != NULL) |
| 868 | fe->ops.tuner_ops.set_config(fe, &ctl); |
| 869 | } |
| 870 | break; |
Steven Toth | b3ea016 | 2008-04-19 01:14:19 -0300 | [diff] [blame] | 871 | case CX23885_BOARD_HAUPPAUGE_HVR1200: |
Steven Toth | a780a31 | 2008-04-19 01:25:52 -0300 | [diff] [blame] | 872 | case CX23885_BOARD_HAUPPAUGE_HVR1700: |
Steven Toth | b3ea016 | 2008-04-19 01:14:19 -0300 | [diff] [blame] | 873 | i2c_bus = &dev->i2c_bus[0]; |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 874 | fe0->dvb.frontend = dvb_attach(tda10048_attach, |
Steven Toth | b3ea016 | 2008-04-19 01:14:19 -0300 | [diff] [blame] | 875 | &hauppauge_hvr1200_config, |
| 876 | &i2c_bus->i2c_adap); |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 877 | if (fe0->dvb.frontend != NULL) { |
| 878 | dvb_attach(tda829x_attach, fe0->dvb.frontend, |
Steven Toth | b3ea016 | 2008-04-19 01:14:19 -0300 | [diff] [blame] | 879 | &dev->i2c_bus[1].i2c_adap, 0x42, |
| 880 | &tda829x_no_probe); |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 881 | dvb_attach(tda18271_attach, fe0->dvb.frontend, |
Steven Toth | b3ea016 | 2008-04-19 01:14:19 -0300 | [diff] [blame] | 882 | 0x60, &dev->i2c_bus[1].i2c_adap, |
| 883 | &hauppauge_hvr1200_tuner_config); |
| 884 | } |
| 885 | break; |
Michael Krufky | 6b926ec | 2009-05-12 17:32:17 -0300 | [diff] [blame] | 886 | case CX23885_BOARD_HAUPPAUGE_HVR1210: |
| 887 | i2c_bus = &dev->i2c_bus[0]; |
| 888 | fe0->dvb.frontend = dvb_attach(tda10048_attach, |
| 889 | &hauppauge_hvr1210_config, |
| 890 | &i2c_bus->i2c_adap); |
| 891 | if (fe0->dvb.frontend != NULL) { |
| 892 | dvb_attach(tda18271_attach, fe0->dvb.frontend, |
| 893 | 0x60, &dev->i2c_bus[1].i2c_adap, |
| 894 | &hauppauge_hvr1210_tuner_config); |
| 895 | } |
| 896 | break; |
Steven Toth | 6676237 | 2008-04-22 15:38:26 -0300 | [diff] [blame] | 897 | case CX23885_BOARD_HAUPPAUGE_HVR1400: |
| 898 | i2c_bus = &dev->i2c_bus[0]; |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 899 | fe0->dvb.frontend = dvb_attach(dib7000p_attach, |
Steven Toth | 6676237 | 2008-04-22 15:38:26 -0300 | [diff] [blame] | 900 | &i2c_bus->i2c_adap, |
| 901 | 0x12, &hauppauge_hvr1400_dib7000_config); |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 902 | if (fe0->dvb.frontend != NULL) { |
Steven Toth | 6676237 | 2008-04-22 15:38:26 -0300 | [diff] [blame] | 903 | struct dvb_frontend *fe; |
| 904 | struct xc2028_config cfg = { |
| 905 | .i2c_adap = &dev->i2c_bus[1].i2c_adap, |
| 906 | .i2c_addr = 0x64, |
Steven Toth | 6676237 | 2008-04-22 15:38:26 -0300 | [diff] [blame] | 907 | }; |
| 908 | static struct xc2028_ctrl ctl = { |
Michael Krufky | ef80bfe | 2008-09-16 02:15:30 -0300 | [diff] [blame] | 909 | .fname = XC3028L_DEFAULT_FIRMWARE, |
Steven Toth | 6676237 | 2008-04-22 15:38:26 -0300 | [diff] [blame] | 910 | .max_len = 64, |
Mauro Carvalho Chehab | 9bed77e | 2011-07-28 16:38:54 -0300 | [diff] [blame] | 911 | .demod = XC3028_FE_DIBCOM52, |
Steven Toth | 9c8ced5 | 2008-10-16 20:18:44 -0300 | [diff] [blame] | 912 | /* This is true for all demods with |
| 913 | v36 firmware? */ |
Mauro Carvalho Chehab | 0975fc6 | 2008-09-28 02:24:44 -0300 | [diff] [blame] | 914 | .type = XC2028_D2633, |
Steven Toth | 6676237 | 2008-04-22 15:38:26 -0300 | [diff] [blame] | 915 | }; |
| 916 | |
| 917 | fe = dvb_attach(xc2028_attach, |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 918 | fe0->dvb.frontend, &cfg); |
Steven Toth | 6676237 | 2008-04-22 15:38:26 -0300 | [diff] [blame] | 919 | if (fe != NULL && fe->ops.tuner_ops.set_config != NULL) |
| 920 | fe->ops.tuner_ops.set_config(fe, &ctl); |
| 921 | } |
| 922 | break; |
Michael Krufky | 335377b | 2008-05-07 01:43:10 -0300 | [diff] [blame] | 923 | case CX23885_BOARD_DVICO_FUSIONHDTV_7_DUAL_EXP: |
| 924 | i2c_bus = &dev->i2c_bus[port->nr - 1]; |
| 925 | |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 926 | fe0->dvb.frontend = dvb_attach(s5h1409_attach, |
Michael Krufky | 335377b | 2008-05-07 01:43:10 -0300 | [diff] [blame] | 927 | &dvico_s5h1409_config, |
| 928 | &i2c_bus->i2c_adap); |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 929 | if (fe0->dvb.frontend == NULL) |
| 930 | fe0->dvb.frontend = dvb_attach(s5h1411_attach, |
Michael Krufky | 52b5045 | 2008-07-09 02:18:49 -0300 | [diff] [blame] | 931 | &dvico_s5h1411_config, |
| 932 | &i2c_bus->i2c_adap); |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 933 | if (fe0->dvb.frontend != NULL) |
| 934 | dvb_attach(xc5000_attach, fe0->dvb.frontend, |
Michael Krufky | 3065096 | 2008-09-06 14:56:58 -0300 | [diff] [blame] | 935 | &i2c_bus->i2c_adap, |
| 936 | &dvico_xc5000_tunerconfig); |
Michael Krufky | 335377b | 2008-05-07 01:43:10 -0300 | [diff] [blame] | 937 | break; |
Steven Toth | aef2d18 | 2008-08-04 21:39:53 -0300 | [diff] [blame] | 938 | case CX23885_BOARD_DVICO_FUSIONHDTV_DVB_T_DUAL_EXP: { |
| 939 | i2c_bus = &dev->i2c_bus[port->nr - 1]; |
| 940 | |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 941 | fe0->dvb.frontend = dvb_attach(zl10353_attach, |
Steven Toth | aef2d18 | 2008-08-04 21:39:53 -0300 | [diff] [blame] | 942 | &dvico_fusionhdtv_xc3028, |
| 943 | &i2c_bus->i2c_adap); |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 944 | if (fe0->dvb.frontend != NULL) { |
Steven Toth | aef2d18 | 2008-08-04 21:39:53 -0300 | [diff] [blame] | 945 | struct dvb_frontend *fe; |
| 946 | struct xc2028_config cfg = { |
| 947 | .i2c_adap = &i2c_bus->i2c_adap, |
| 948 | .i2c_addr = 0x61, |
Steven Toth | aef2d18 | 2008-08-04 21:39:53 -0300 | [diff] [blame] | 949 | }; |
| 950 | static struct xc2028_ctrl ctl = { |
Michael Krufky | ef80bfe | 2008-09-16 02:15:30 -0300 | [diff] [blame] | 951 | .fname = XC2028_DEFAULT_FIRMWARE, |
Steven Toth | aef2d18 | 2008-08-04 21:39:53 -0300 | [diff] [blame] | 952 | .max_len = 64, |
| 953 | .demod = XC3028_FE_ZARLINK456, |
| 954 | }; |
| 955 | |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 956 | fe = dvb_attach(xc2028_attach, fe0->dvb.frontend, |
Steven Toth | aef2d18 | 2008-08-04 21:39:53 -0300 | [diff] [blame] | 957 | &cfg); |
| 958 | if (fe != NULL && fe->ops.tuner_ops.set_config != NULL) |
| 959 | fe->ops.tuner_ops.set_config(fe, &ctl); |
| 960 | } |
| 961 | break; |
| 962 | } |
Steven Toth | 4c56b04 | 2008-08-12 13:30:03 -0300 | [diff] [blame] | 963 | case CX23885_BOARD_LEADTEK_WINFAST_PXDVR3200_H: |
Igor M. Liplianin | 9bb1b7e | 2008-11-23 14:11:16 -0300 | [diff] [blame] | 964 | case CX23885_BOARD_COMPRO_VIDEOMATE_E650F: |
Vladimir Geroy | 34e383d | 2009-09-18 18:55:47 -0300 | [diff] [blame] | 965 | case CX23885_BOARD_COMPRO_VIDEOMATE_E800: |
Steven Toth | 4c56b04 | 2008-08-12 13:30:03 -0300 | [diff] [blame] | 966 | i2c_bus = &dev->i2c_bus[0]; |
| 967 | |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 968 | fe0->dvb.frontend = dvb_attach(zl10353_attach, |
Steven Toth | 4c56b04 | 2008-08-12 13:30:03 -0300 | [diff] [blame] | 969 | &dvico_fusionhdtv_xc3028, |
| 970 | &i2c_bus->i2c_adap); |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 971 | if (fe0->dvb.frontend != NULL) { |
Steven Toth | 4c56b04 | 2008-08-12 13:30:03 -0300 | [diff] [blame] | 972 | struct dvb_frontend *fe; |
| 973 | struct xc2028_config cfg = { |
| 974 | .i2c_adap = &dev->i2c_bus[1].i2c_adap, |
| 975 | .i2c_addr = 0x61, |
Steven Toth | 4c56b04 | 2008-08-12 13:30:03 -0300 | [diff] [blame] | 976 | }; |
| 977 | static struct xc2028_ctrl ctl = { |
Michael Krufky | ef80bfe | 2008-09-16 02:15:30 -0300 | [diff] [blame] | 978 | .fname = XC2028_DEFAULT_FIRMWARE, |
Steven Toth | 4c56b04 | 2008-08-12 13:30:03 -0300 | [diff] [blame] | 979 | .max_len = 64, |
| 980 | .demod = XC3028_FE_ZARLINK456, |
| 981 | }; |
| 982 | |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 983 | fe = dvb_attach(xc2028_attach, fe0->dvb.frontend, |
Steven Toth | 4c56b04 | 2008-08-12 13:30:03 -0300 | [diff] [blame] | 984 | &cfg); |
| 985 | if (fe != NULL && fe->ops.tuner_ops.set_config != NULL) |
| 986 | fe->ops.tuner_ops.set_config(fe, &ctl); |
| 987 | } |
| 988 | break; |
istvan_v@mailbox.hu | 0cf8af5 | 2011-07-11 10:58:35 -0300 | [diff] [blame] | 989 | case CX23885_BOARD_LEADTEK_WINFAST_PXDVR3200_H_XC4000: |
| 990 | i2c_bus = &dev->i2c_bus[0]; |
| 991 | |
| 992 | fe0->dvb.frontend = dvb_attach(zl10353_attach, |
| 993 | &dvico_fusionhdtv_xc3028, |
| 994 | &i2c_bus->i2c_adap); |
| 995 | if (fe0->dvb.frontend != NULL) { |
| 996 | struct dvb_frontend *fe; |
| 997 | struct xc4000_config cfg = { |
| 998 | .i2c_address = 0x61, |
| 999 | .default_pm = 0, |
| 1000 | .dvb_amplitude = 134, |
| 1001 | .set_smoothedcvbs = 1, |
| 1002 | .if_khz = 4560 |
| 1003 | }; |
| 1004 | |
| 1005 | fe = dvb_attach(xc4000_attach, fe0->dvb.frontend, |
| 1006 | &dev->i2c_bus[1].i2c_adap, &cfg); |
Miroslav Slugen | a7c8aad | 2011-12-11 18:57:58 -0300 | [diff] [blame] | 1007 | if (!fe) { |
| 1008 | printk(KERN_ERR "%s/2: xc4000 attach failed\n", |
| 1009 | dev->name); |
| 1010 | goto frontend_detach; |
| 1011 | } |
istvan_v@mailbox.hu | 0cf8af5 | 2011-07-11 10:58:35 -0300 | [diff] [blame] | 1012 | } |
| 1013 | break; |
Igor M. Liplianin | 96318d0 | 2009-01-17 12:11:20 -0300 | [diff] [blame] | 1014 | case CX23885_BOARD_TBS_6920: |
Igor M. Liplianin | 09ea33e | 2009-11-24 20:16:04 -0300 | [diff] [blame] | 1015 | i2c_bus = &dev->i2c_bus[1]; |
Igor M. Liplianin | 96318d0 | 2009-01-17 12:11:20 -0300 | [diff] [blame] | 1016 | |
| 1017 | fe0->dvb.frontend = dvb_attach(cx24116_attach, |
Igor M. Liplianin | 09ea33e | 2009-11-24 20:16:04 -0300 | [diff] [blame] | 1018 | &tbs_cx24116_config, |
| 1019 | &i2c_bus->i2c_adap); |
Igor M. Liplianin | 96318d0 | 2009-01-17 12:11:20 -0300 | [diff] [blame] | 1020 | if (fe0->dvb.frontend != NULL) |
Igor M. Liplianin | 09ea33e | 2009-11-24 20:16:04 -0300 | [diff] [blame] | 1021 | fe0->dvb.frontend->ops.set_voltage = f300_set_voltage; |
Igor M. Liplianin | 96318d0 | 2009-01-17 12:11:20 -0300 | [diff] [blame] | 1022 | |
| 1023 | break; |
Igor M. Liplianin | 579943f | 2009-01-17 12:18:26 -0300 | [diff] [blame] | 1024 | case CX23885_BOARD_TEVII_S470: |
| 1025 | i2c_bus = &dev->i2c_bus[1]; |
| 1026 | |
Igor M. Liplianin | 09ea33e | 2009-11-24 20:16:04 -0300 | [diff] [blame] | 1027 | fe0->dvb.frontend = dvb_attach(ds3000_attach, |
| 1028 | &tevii_ds3000_config, |
| 1029 | &i2c_bus->i2c_adap); |
Igor M. Liplianin | 579943f | 2009-01-17 12:18:26 -0300 | [diff] [blame] | 1030 | if (fe0->dvb.frontend != NULL) |
Igor M. Liplianin | 09ea33e | 2009-11-24 20:16:04 -0300 | [diff] [blame] | 1031 | fe0->dvb.frontend->ops.set_voltage = f300_set_voltage; |
Igor M. Liplianin | 579943f | 2009-01-17 12:18:26 -0300 | [diff] [blame] | 1032 | |
| 1033 | break; |
Igor M. Liplianin | c9b8b04 | 2009-01-17 12:23:31 -0300 | [diff] [blame] | 1034 | case CX23885_BOARD_DVBWORLD_2005: |
| 1035 | i2c_bus = &dev->i2c_bus[1]; |
| 1036 | |
| 1037 | fe0->dvb.frontend = dvb_attach(cx24116_attach, |
| 1038 | &dvbworld_cx24116_config, |
| 1039 | &i2c_bus->i2c_adap); |
| 1040 | break; |
Igor M. Liplianin | 5a23b07 | 2009-03-03 12:06:09 -0300 | [diff] [blame] | 1041 | case CX23885_BOARD_NETUP_DUAL_DVBS2_CI: |
| 1042 | i2c_bus = &dev->i2c_bus[0]; |
| 1043 | switch (port->nr) { |
| 1044 | /* port B */ |
| 1045 | case 1: |
| 1046 | fe0->dvb.frontend = dvb_attach(stv0900_attach, |
| 1047 | &netup_stv0900_config, |
| 1048 | &i2c_bus->i2c_adap, 0); |
| 1049 | if (fe0->dvb.frontend != NULL) { |
| 1050 | if (dvb_attach(stv6110_attach, |
| 1051 | fe0->dvb.frontend, |
| 1052 | &netup_stv6110_tunerconfig_a, |
| 1053 | &i2c_bus->i2c_adap)) { |
| 1054 | if (!dvb_attach(lnbh24_attach, |
| 1055 | fe0->dvb.frontend, |
| 1056 | &i2c_bus->i2c_adap, |
Abylay Ospan | 9329fb5 | 2009-10-17 08:38:45 -0300 | [diff] [blame] | 1057 | LNBH24_PCL | LNBH24_TTX, |
| 1058 | LNBH24_TEN, 0x09)) |
Igor M. Liplianin | 5a23b07 | 2009-03-03 12:06:09 -0300 | [diff] [blame] | 1059 | printk(KERN_ERR |
| 1060 | "No LNBH24 found!\n"); |
| 1061 | |
| 1062 | } |
| 1063 | } |
| 1064 | break; |
| 1065 | /* port C */ |
| 1066 | case 2: |
| 1067 | fe0->dvb.frontend = dvb_attach(stv0900_attach, |
| 1068 | &netup_stv0900_config, |
| 1069 | &i2c_bus->i2c_adap, 1); |
| 1070 | if (fe0->dvb.frontend != NULL) { |
| 1071 | if (dvb_attach(stv6110_attach, |
| 1072 | fe0->dvb.frontend, |
| 1073 | &netup_stv6110_tunerconfig_b, |
| 1074 | &i2c_bus->i2c_adap)) { |
| 1075 | if (!dvb_attach(lnbh24_attach, |
| 1076 | fe0->dvb.frontend, |
| 1077 | &i2c_bus->i2c_adap, |
Abylay Ospan | 9329fb5 | 2009-10-17 08:38:45 -0300 | [diff] [blame] | 1078 | LNBH24_PCL | LNBH24_TTX, |
| 1079 | LNBH24_TEN, 0x0a)) |
Igor M. Liplianin | 5a23b07 | 2009-03-03 12:06:09 -0300 | [diff] [blame] | 1080 | printk(KERN_ERR |
| 1081 | "No LNBH24 found!\n"); |
| 1082 | |
| 1083 | } |
| 1084 | } |
| 1085 | break; |
| 1086 | } |
| 1087 | break; |
David Wong | 493b712 | 2009-05-18 05:25:49 -0300 | [diff] [blame] | 1088 | case CX23885_BOARD_MYGICA_X8506: |
| 1089 | i2c_bus = &dev->i2c_bus[0]; |
| 1090 | i2c_bus2 = &dev->i2c_bus[1]; |
| 1091 | fe0->dvb.frontend = dvb_attach(lgs8gxx_attach, |
| 1092 | &mygica_x8506_lgs8gl5_config, |
| 1093 | &i2c_bus->i2c_adap); |
| 1094 | if (fe0->dvb.frontend != NULL) { |
| 1095 | dvb_attach(xc5000_attach, |
| 1096 | fe0->dvb.frontend, |
| 1097 | &i2c_bus2->i2c_adap, |
| 1098 | &mygica_x8506_xc5000_config); |
| 1099 | } |
| 1100 | break; |
David Wong | 2365b2d | 2009-06-17 01:38:12 -0300 | [diff] [blame] | 1101 | case CX23885_BOARD_MAGICPRO_PROHDTVE2: |
| 1102 | i2c_bus = &dev->i2c_bus[0]; |
| 1103 | i2c_bus2 = &dev->i2c_bus[1]; |
| 1104 | fe0->dvb.frontend = dvb_attach(lgs8gxx_attach, |
| 1105 | &magicpro_prohdtve2_lgs8g75_config, |
| 1106 | &i2c_bus->i2c_adap); |
| 1107 | if (fe0->dvb.frontend != NULL) { |
| 1108 | dvb_attach(xc5000_attach, |
| 1109 | fe0->dvb.frontend, |
| 1110 | &i2c_bus2->i2c_adap, |
| 1111 | &magicpro_prohdtve2_xc5000_config); |
| 1112 | } |
| 1113 | break; |
Steven Toth | 13697380 | 2009-07-20 15:37:25 -0300 | [diff] [blame] | 1114 | case CX23885_BOARD_HAUPPAUGE_HVR1850: |
Steven Toth | 3504513 | 2012-01-04 21:08:35 -0300 | [diff] [blame] | 1115 | i2c_bus = &dev->i2c_bus[0]; |
| 1116 | fe0->dvb.frontend = dvb_attach(s5h1411_attach, |
| 1117 | &hcw_s5h1411_config, |
| 1118 | &i2c_bus->i2c_adap); |
| 1119 | if (fe0->dvb.frontend != NULL) |
| 1120 | dvb_attach(tda18271_attach, fe0->dvb.frontend, |
| 1121 | 0x60, &dev->i2c_bus[0].i2c_adap, |
| 1122 | &hauppauge_tda18271_config); |
| 1123 | |
| 1124 | tda18271_attach(&dev->ts1.analog_fe, |
| 1125 | 0x60, &dev->i2c_bus[1].i2c_adap, |
| 1126 | &hauppauge_tda18271_config); |
| 1127 | |
| 1128 | break; |
Michael Krufky | aee0b24 | 2009-11-11 01:52:45 -0300 | [diff] [blame] | 1129 | case CX23885_BOARD_HAUPPAUGE_HVR1290: |
Steven Toth | 13697380 | 2009-07-20 15:37:25 -0300 | [diff] [blame] | 1130 | i2c_bus = &dev->i2c_bus[0]; |
| 1131 | fe0->dvb.frontend = dvb_attach(s5h1411_attach, |
| 1132 | &hcw_s5h1411_config, |
| 1133 | &i2c_bus->i2c_adap); |
| 1134 | if (fe0->dvb.frontend != NULL) |
| 1135 | dvb_attach(tda18271_attach, fe0->dvb.frontend, |
| 1136 | 0x60, &dev->i2c_bus[0].i2c_adap, |
| 1137 | &hauppauge_tda18271_config); |
| 1138 | break; |
David T. L. Wong | ea5697f | 2009-10-26 08:54:04 -0300 | [diff] [blame] | 1139 | case CX23885_BOARD_MYGICA_X8558PRO: |
| 1140 | switch (port->nr) { |
| 1141 | /* port B */ |
| 1142 | case 1: |
| 1143 | i2c_bus = &dev->i2c_bus[0]; |
| 1144 | fe0->dvb.frontend = dvb_attach(atbm8830_attach, |
| 1145 | &mygica_x8558pro_atbm8830_cfg1, |
| 1146 | &i2c_bus->i2c_adap); |
| 1147 | if (fe0->dvb.frontend != NULL) { |
| 1148 | dvb_attach(max2165_attach, |
| 1149 | fe0->dvb.frontend, |
| 1150 | &i2c_bus->i2c_adap, |
| 1151 | &mygic_x8558pro_max2165_cfg1); |
| 1152 | } |
| 1153 | break; |
| 1154 | /* port C */ |
| 1155 | case 2: |
| 1156 | i2c_bus = &dev->i2c_bus[1]; |
| 1157 | fe0->dvb.frontend = dvb_attach(atbm8830_attach, |
| 1158 | &mygica_x8558pro_atbm8830_cfg2, |
| 1159 | &i2c_bus->i2c_adap); |
| 1160 | if (fe0->dvb.frontend != NULL) { |
| 1161 | dvb_attach(max2165_attach, |
| 1162 | fe0->dvb.frontend, |
| 1163 | &i2c_bus->i2c_adap, |
| 1164 | &mygic_x8558pro_max2165_cfg2); |
| 1165 | } |
| 1166 | break; |
| 1167 | } |
| 1168 | break; |
Igor M. Liplianin | 78db854 | 2011-01-25 17:04:00 -0300 | [diff] [blame] | 1169 | case CX23885_BOARD_NETUP_DUAL_DVB_T_C_CI_RF: |
| 1170 | i2c_bus = &dev->i2c_bus[0]; |
| 1171 | mfe_shared = 1;/* MFE */ |
| 1172 | port->frontends.gate = 0;/* not clear for me yet */ |
| 1173 | /* ports B, C */ |
| 1174 | /* MFE frontend 1 DVB-T */ |
| 1175 | fe0->dvb.frontend = dvb_attach(stv0367ter_attach, |
| 1176 | &netup_stv0367_config[port->nr - 1], |
| 1177 | &i2c_bus->i2c_adap); |
Abylay Ospan | 4174ebf | 2011-01-02 09:15:00 -0300 | [diff] [blame] | 1178 | if (fe0->dvb.frontend != NULL) { |
Igor M. Liplianin | 78db854 | 2011-01-25 17:04:00 -0300 | [diff] [blame] | 1179 | if (NULL == dvb_attach(xc5000_attach, |
| 1180 | fe0->dvb.frontend, |
| 1181 | &i2c_bus->i2c_adap, |
| 1182 | &netup_xc5000_config[port->nr - 1])) |
| 1183 | goto frontend_detach; |
Abylay Ospan | 4174ebf | 2011-01-02 09:15:00 -0300 | [diff] [blame] | 1184 | /* load xc5000 firmware */ |
| 1185 | fe0->dvb.frontend->ops.tuner_ops.init(fe0->dvb.frontend); |
| 1186 | } |
Igor M. Liplianin | 78db854 | 2011-01-25 17:04:00 -0300 | [diff] [blame] | 1187 | /* MFE frontend 2 */ |
| 1188 | fe1 = videobuf_dvb_get_frontend(&port->frontends, 2); |
| 1189 | if (fe1 == NULL) |
| 1190 | goto frontend_detach; |
| 1191 | /* DVB-C init */ |
| 1192 | fe1->dvb.frontend = dvb_attach(stv0367cab_attach, |
| 1193 | &netup_stv0367_config[port->nr - 1], |
| 1194 | &i2c_bus->i2c_adap); |
| 1195 | if (fe1->dvb.frontend != NULL) { |
| 1196 | fe1->dvb.frontend->id = 1; |
| 1197 | if (NULL == dvb_attach(xc5000_attach, |
| 1198 | fe1->dvb.frontend, |
| 1199 | &i2c_bus->i2c_adap, |
| 1200 | &netup_xc5000_config[port->nr - 1])) |
| 1201 | goto frontend_detach; |
| 1202 | } |
| 1203 | break; |
Stefan Ringel | 722c90e | 2012-01-07 09:20:48 -0300 | [diff] [blame] | 1204 | case CX23885_BOARD_TERRATEC_CINERGY_T_PCIE_DUAL: |
| 1205 | i2c_bus = &dev->i2c_bus[0]; |
| 1206 | i2c_bus2 = &dev->i2c_bus[1]; |
| 1207 | |
| 1208 | switch (port->nr) { |
| 1209 | /* port b */ |
| 1210 | case 1: |
| 1211 | fe0->dvb.frontend = dvb_attach(drxk_attach, |
| 1212 | &terratec_drxk_config[0], |
| 1213 | &i2c_bus->i2c_adap); |
| 1214 | if (fe0->dvb.frontend != NULL) { |
| 1215 | if (!dvb_attach(mt2063_attach, |
| 1216 | fe0->dvb.frontend, |
| 1217 | &terratec_mt2063_config[0], |
| 1218 | &i2c_bus2->i2c_adap)) |
| 1219 | goto frontend_detach; |
| 1220 | } |
| 1221 | break; |
| 1222 | /* port c */ |
| 1223 | case 2: |
| 1224 | fe0->dvb.frontend = dvb_attach(drxk_attach, |
| 1225 | &terratec_drxk_config[1], |
| 1226 | &i2c_bus->i2c_adap); |
| 1227 | if (fe0->dvb.frontend != NULL) { |
| 1228 | if (!dvb_attach(mt2063_attach, |
| 1229 | fe0->dvb.frontend, |
| 1230 | &terratec_mt2063_config[1], |
| 1231 | &i2c_bus2->i2c_adap)) |
| 1232 | goto frontend_detach; |
| 1233 | } |
| 1234 | break; |
| 1235 | } |
| 1236 | break; |
Igor M. Liplianin | 7b134e8 | 2012-05-11 11:45:42 -0300 | [diff] [blame] | 1237 | case CX23885_BOARD_TEVII_S471: |
| 1238 | i2c_bus = &dev->i2c_bus[1]; |
| 1239 | |
| 1240 | fe0->dvb.frontend = dvb_attach(ds3000_attach, |
| 1241 | &tevii_ds3000_config, |
| 1242 | &i2c_bus->i2c_adap); |
| 1243 | break; |
Mariusz Bia?o?czyk | f667190 | 2012-09-12 07:59:18 -0300 | [diff] [blame] | 1244 | case CX23885_BOARD_PROF_8000: |
| 1245 | i2c_bus = &dev->i2c_bus[0]; |
| 1246 | |
| 1247 | fe0->dvb.frontend = dvb_attach(stv090x_attach, |
| 1248 | &prof_8000_stv090x_config, |
| 1249 | &i2c_bus->i2c_adap, |
| 1250 | STV090x_DEMODULATOR_0); |
| 1251 | if (fe0->dvb.frontend != NULL) { |
| 1252 | if (!dvb_attach(stb6100_attach, |
| 1253 | fe0->dvb.frontend, |
| 1254 | &prof_8000_stb6100_config, |
| 1255 | &i2c_bus->i2c_adap)) |
| 1256 | goto frontend_detach; |
| 1257 | |
| 1258 | fe0->dvb.frontend->ops.set_voltage = p8000_set_voltage; |
| 1259 | } |
| 1260 | break; |
Michael Krufky | 7c62f5a | 2012-12-15 23:34:09 -0300 | [diff] [blame] | 1261 | case CX23885_BOARD_HAUPPAUGE_HVR4400: |
| 1262 | i2c_bus = &dev->i2c_bus[0]; |
| 1263 | fe0->dvb.frontend = dvb_attach(tda10071_attach, |
| 1264 | &hauppauge_tda10071_config, |
| 1265 | &i2c_bus->i2c_adap); |
| 1266 | if (fe0->dvb.frontend != NULL) { |
| 1267 | dvb_attach(a8293_attach, fe0->dvb.frontend, |
| 1268 | &i2c_bus->i2c_adap, |
| 1269 | &hauppauge_a8293_config); |
| 1270 | } |
| 1271 | break; |
Steven Toth | d19770e | 2007-03-11 20:44:05 -0300 | [diff] [blame] | 1272 | default: |
Steven Toth | 9c8ced5 | 2008-10-16 20:18:44 -0300 | [diff] [blame] | 1273 | printk(KERN_INFO "%s: The frontend of your DVB/ATSC card " |
| 1274 | " isn't supported yet\n", |
Steven Toth | d19770e | 2007-03-11 20:44:05 -0300 | [diff] [blame] | 1275 | dev->name); |
| 1276 | break; |
| 1277 | } |
Igor M. Liplianin | 78db854 | 2011-01-25 17:04:00 -0300 | [diff] [blame] | 1278 | |
| 1279 | if ((NULL == fe0->dvb.frontend) || (fe1 && NULL == fe1->dvb.frontend)) { |
Steven Toth | 9c8ced5 | 2008-10-16 20:18:44 -0300 | [diff] [blame] | 1280 | printk(KERN_ERR "%s: frontend initialization failed\n", |
Igor M. Liplianin | 78db854 | 2011-01-25 17:04:00 -0300 | [diff] [blame] | 1281 | dev->name); |
| 1282 | goto frontend_detach; |
Steven Toth | d19770e | 2007-03-11 20:44:05 -0300 | [diff] [blame] | 1283 | } |
Igor M. Liplianin | 78db854 | 2011-01-25 17:04:00 -0300 | [diff] [blame] | 1284 | |
Michael Krufky | d7cba04 | 2008-09-12 13:31:45 -0300 | [diff] [blame] | 1285 | /* define general-purpose callback pointer */ |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 1286 | fe0->dvb.frontend->callback = cx23885_tuner_callback; |
Igor M. Liplianin | 78db854 | 2011-01-25 17:04:00 -0300 | [diff] [blame] | 1287 | if (fe1) |
| 1288 | fe1->dvb.frontend->callback = cx23885_tuner_callback; |
| 1289 | #if 0 |
| 1290 | /* Ensure all frontends negotiate bus access */ |
| 1291 | fe0->dvb.frontend->ops.ts_bus_ctrl = cx23885_dvb_bus_ctrl; |
| 1292 | if (fe1) |
| 1293 | fe1->dvb.frontend->ops.ts_bus_ctrl = cx23885_dvb_bus_ctrl; |
| 1294 | #endif |
Steven Toth | d19770e | 2007-03-11 20:44:05 -0300 | [diff] [blame] | 1295 | |
| 1296 | /* Put the analog decoder in standby to keep it quiet */ |
Laurent Pinchart | 622b828 | 2009-10-05 10:48:17 -0300 | [diff] [blame] | 1297 | call_all(dev, core, s_power, 0); |
Steven Toth | d19770e | 2007-03-11 20:44:05 -0300 | [diff] [blame] | 1298 | |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 1299 | if (fe0->dvb.frontend->ops.analog_ops.standby) |
| 1300 | fe0->dvb.frontend->ops.analog_ops.standby(fe0->dvb.frontend); |
Michael Krufky | 3ba71d2 | 2007-12-07 01:40:36 -0300 | [diff] [blame] | 1301 | |
Steven Toth | d19770e | 2007-03-11 20:44:05 -0300 | [diff] [blame] | 1302 | /* register everything */ |
Igor M. Liplianin | 5a23b07 | 2009-03-03 12:06:09 -0300 | [diff] [blame] | 1303 | ret = videobuf_dvb_register_bus(&port->frontends, THIS_MODULE, port, |
Mauro Carvalho Chehab | 9adf613 | 2012-08-05 14:16:30 -0300 | [diff] [blame] | 1304 | &dev->pci->dev, adapter_nr, mfe_shared); |
Abylay Ospan | bee3019 | 2010-06-25 08:01:28 -0300 | [diff] [blame] | 1305 | if (ret) |
Igor M. Liplianin | 78db854 | 2011-01-25 17:04:00 -0300 | [diff] [blame] | 1306 | goto frontend_detach; |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 1307 | |
Igor M. Liplianin | 5a23b07 | 2009-03-03 12:06:09 -0300 | [diff] [blame] | 1308 | /* init CI & MAC */ |
| 1309 | switch (dev->board) { |
| 1310 | case CX23885_BOARD_NETUP_DUAL_DVBS2_CI: { |
| 1311 | static struct netup_card_info cinfo; |
| 1312 | |
| 1313 | netup_get_card_info(&dev->i2c_bus[0].i2c_adap, &cinfo); |
| 1314 | memcpy(port->frontends.adapter.proposed_mac, |
| 1315 | cinfo.port[port->nr - 1].mac, 6); |
hartleys | be39515 | 2009-12-30 16:08:57 -0300 | [diff] [blame] | 1316 | printk(KERN_INFO "NetUP Dual DVB-S2 CI card port%d MAC=%pM\n", |
| 1317 | port->nr, port->frontends.adapter.proposed_mac); |
Igor M. Liplianin | 5a23b07 | 2009-03-03 12:06:09 -0300 | [diff] [blame] | 1318 | |
| 1319 | netup_ci_init(port); |
| 1320 | break; |
| 1321 | } |
Igor M. Liplianin | 78db854 | 2011-01-25 17:04:00 -0300 | [diff] [blame] | 1322 | case CX23885_BOARD_NETUP_DUAL_DVB_T_C_CI_RF: { |
| 1323 | struct altera_ci_config netup_ci_cfg = { |
| 1324 | .dev = dev,/* magic number to identify*/ |
| 1325 | .adapter = &port->frontends.adapter,/* for CI */ |
| 1326 | .demux = &fe0->dvb.demux,/* for hw pid filter */ |
| 1327 | .fpga_rw = netup_altera_fpga_rw, |
| 1328 | }; |
| 1329 | |
| 1330 | altera_ci_init(&netup_ci_cfg, port->nr); |
| 1331 | break; |
| 1332 | } |
Pierre Gronlier | 16bfdaa4 | 2010-04-26 13:26:29 -0300 | [diff] [blame] | 1333 | case CX23885_BOARD_TEVII_S470: { |
| 1334 | u8 eeprom[256]; /* 24C02 i2c eeprom */ |
| 1335 | |
| 1336 | if (port->nr != 1) |
| 1337 | break; |
| 1338 | |
| 1339 | /* Read entire EEPROM */ |
| 1340 | dev->i2c_bus[0].i2c_client.addr = 0xa0 >> 1; |
| 1341 | tveeprom_read(&dev->i2c_bus[0].i2c_client, eeprom, sizeof(eeprom)); |
Andy Shevchenko | 5cac1f6 | 2010-09-11 14:33:28 -0300 | [diff] [blame] | 1342 | printk(KERN_INFO "TeVii S470 MAC= %pM\n", eeprom + 0xa0); |
Pierre Gronlier | 16bfdaa4 | 2010-04-26 13:26:29 -0300 | [diff] [blame] | 1343 | memcpy(port->frontends.adapter.proposed_mac, eeprom + 0xa0, 6); |
| 1344 | break; |
| 1345 | } |
Igor M. Liplianin | 5a23b07 | 2009-03-03 12:06:09 -0300 | [diff] [blame] | 1346 | } |
| 1347 | |
| 1348 | return ret; |
Igor M. Liplianin | 78db854 | 2011-01-25 17:04:00 -0300 | [diff] [blame] | 1349 | |
| 1350 | frontend_detach: |
| 1351 | port->gate_ctrl = NULL; |
| 1352 | videobuf_dvb_dealloc_frontends(&port->frontends); |
| 1353 | return -EINVAL; |
Steven Toth | d19770e | 2007-03-11 20:44:05 -0300 | [diff] [blame] | 1354 | } |
| 1355 | |
| 1356 | int cx23885_dvb_register(struct cx23885_tsport *port) |
| 1357 | { |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 1358 | |
| 1359 | struct videobuf_dvb_frontend *fe0; |
Steven Toth | d19770e | 2007-03-11 20:44:05 -0300 | [diff] [blame] | 1360 | struct cx23885_dev *dev = port->dev; |
Steven Toth | eb0c58b | 2008-10-11 12:34:39 -0300 | [diff] [blame] | 1361 | int err, i; |
Steven Toth | d19770e | 2007-03-11 20:44:05 -0300 | [diff] [blame] | 1362 | |
Steven Toth | eb0c58b | 2008-10-11 12:34:39 -0300 | [diff] [blame] | 1363 | /* Here we need to allocate the correct number of frontends, |
André Goddard Rosa | af901ca | 2009-11-14 13:09:05 -0200 | [diff] [blame] | 1364 | * as reflected in the cards struct. The reality is that currently |
Steven Toth | eb0c58b | 2008-10-11 12:34:39 -0300 | [diff] [blame] | 1365 | * no cx23885 boards support this - yet. But, if we don't modify this |
| 1366 | * code then the second frontend would never be allocated (later) |
| 1367 | * and fail with error before the attach in dvb_register(). |
| 1368 | * Without these changes we risk an OOPS later. The changes here |
| 1369 | * are for safety, and should provide a good foundation for the |
| 1370 | * future addition of any multi-frontend cx23885 based boards. |
| 1371 | */ |
| 1372 | printk(KERN_INFO "%s() allocating %d frontend(s)\n", __func__, |
| 1373 | port->num_frontends); |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 1374 | |
Steven Toth | eb0c58b | 2008-10-11 12:34:39 -0300 | [diff] [blame] | 1375 | for (i = 1; i <= port->num_frontends; i++) { |
Darron Broad | 96b7a1a | 2008-10-15 20:26:34 -0300 | [diff] [blame] | 1376 | if (videobuf_dvb_alloc_frontend( |
Steven Toth | 9c8ced5 | 2008-10-16 20:18:44 -0300 | [diff] [blame] | 1377 | &port->frontends, i) == NULL) { |
Steven Toth | eb0c58b | 2008-10-11 12:34:39 -0300 | [diff] [blame] | 1378 | printk(KERN_ERR "%s() failed to alloc\n", __func__); |
| 1379 | return -ENOMEM; |
| 1380 | } |
Steven Toth | d19770e | 2007-03-11 20:44:05 -0300 | [diff] [blame] | 1381 | |
Steven Toth | eb0c58b | 2008-10-11 12:34:39 -0300 | [diff] [blame] | 1382 | fe0 = videobuf_dvb_get_frontend(&port->frontends, i); |
| 1383 | if (!fe0) |
| 1384 | err = -EINVAL; |
Steven Toth | d19770e | 2007-03-11 20:44:05 -0300 | [diff] [blame] | 1385 | |
Steven Toth | eb0c58b | 2008-10-11 12:34:39 -0300 | [diff] [blame] | 1386 | dprintk(1, "%s\n", __func__); |
Steven Toth | 9c8ced5 | 2008-10-16 20:18:44 -0300 | [diff] [blame] | 1387 | dprintk(1, " ->probed by Card=%d Name=%s, PCI %02x:%02x\n", |
Steven Toth | eb0c58b | 2008-10-11 12:34:39 -0300 | [diff] [blame] | 1388 | dev->board, |
| 1389 | dev->name, |
| 1390 | dev->pci_bus, |
| 1391 | dev->pci_slot); |
| 1392 | |
| 1393 | err = -ENODEV; |
| 1394 | |
| 1395 | /* dvb stuff */ |
| 1396 | /* We have to init the queue for each frontend on a port. */ |
Steven Toth | 9c8ced5 | 2008-10-16 20:18:44 -0300 | [diff] [blame] | 1397 | printk(KERN_INFO "%s: cx23885 based dvb card\n", dev->name); |
| 1398 | videobuf_queue_sg_init(&fe0->dvb.dvbq, &dvb_qops, |
| 1399 | &dev->pci->dev, &port->slock, |
Michael Krufky | 44a6481 | 2007-03-20 23:00:18 -0300 | [diff] [blame] | 1400 | V4L2_BUF_TYPE_VIDEO_CAPTURE, V4L2_FIELD_TOP, |
Hans Verkuil | 08bff03 | 2010-09-20 17:39:46 -0300 | [diff] [blame] | 1401 | sizeof(struct cx23885_buffer), port, NULL); |
Steven Toth | eb0c58b | 2008-10-11 12:34:39 -0300 | [diff] [blame] | 1402 | } |
Steven Toth | d19770e | 2007-03-11 20:44:05 -0300 | [diff] [blame] | 1403 | err = dvb_register(port); |
| 1404 | if (err != 0) |
Steven Toth | 9c8ced5 | 2008-10-16 20:18:44 -0300 | [diff] [blame] | 1405 | printk(KERN_ERR "%s() dvb_register failed err = %d\n", |
| 1406 | __func__, err); |
Steven Toth | d19770e | 2007-03-11 20:44:05 -0300 | [diff] [blame] | 1407 | |
Steven Toth | d19770e | 2007-03-11 20:44:05 -0300 | [diff] [blame] | 1408 | return err; |
| 1409 | } |
| 1410 | |
| 1411 | int cx23885_dvb_unregister(struct cx23885_tsport *port) |
| 1412 | { |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 1413 | struct videobuf_dvb_frontend *fe0; |
| 1414 | |
Steven Toth | eb0c58b | 2008-10-11 12:34:39 -0300 | [diff] [blame] | 1415 | /* FIXME: in an error condition where the we have |
| 1416 | * an expected number of frontends (attach problem) |
| 1417 | * then this might not clean up correctly, if 1 |
| 1418 | * is invalid. |
| 1419 | * This comment only applies to future boards IF they |
| 1420 | * implement MFE support. |
| 1421 | */ |
Darron Broad | 92abe9e | 2008-10-11 11:18:53 -0300 | [diff] [blame] | 1422 | fe0 = videobuf_dvb_get_frontend(&port->frontends, 1); |
Abylay Ospan | e66131c | 2011-07-15 15:01:07 -0300 | [diff] [blame] | 1423 | if (fe0 && fe0->dvb.frontend) |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 1424 | videobuf_dvb_unregister_bus(&port->frontends); |
Steven Toth | d19770e | 2007-03-11 20:44:05 -0300 | [diff] [blame] | 1425 | |
Hans Verkuil | afd9666 | 2009-03-13 13:24:19 -0300 | [diff] [blame] | 1426 | switch (port->dev->board) { |
| 1427 | case CX23885_BOARD_NETUP_DUAL_DVBS2_CI: |
| 1428 | netup_ci_exit(port); |
| 1429 | break; |
Igor M. Liplianin | 78db854 | 2011-01-25 17:04:00 -0300 | [diff] [blame] | 1430 | case CX23885_BOARD_NETUP_DUAL_DVB_T_C_CI_RF: |
| 1431 | altera_ci_release(port->dev, port->nr); |
| 1432 | break; |
Hans Verkuil | afd9666 | 2009-03-13 13:24:19 -0300 | [diff] [blame] | 1433 | } |
Igor M. Liplianin | 5a23b07 | 2009-03-03 12:06:09 -0300 | [diff] [blame] | 1434 | |
Igor M. Liplianin | 78db854 | 2011-01-25 17:04:00 -0300 | [diff] [blame] | 1435 | port->gate_ctrl = NULL; |
| 1436 | |
Steven Toth | d19770e | 2007-03-11 20:44:05 -0300 | [diff] [blame] | 1437 | return 0; |
| 1438 | } |
Michael Krufky | 44a6481 | 2007-03-20 23:00:18 -0300 | [diff] [blame] | 1439 | |