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