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. |
Steven Toth | d19770e | 2007-03-11 20:44:05 -0300 | [diff] [blame] | 16 | */ |
| 17 | |
| 18 | #include <linux/module.h> |
| 19 | #include <linux/init.h> |
| 20 | #include <linux/device.h> |
| 21 | #include <linux/fs.h> |
| 22 | #include <linux/kthread.h> |
| 23 | #include <linux/file.h> |
| 24 | #include <linux/suspend.h> |
| 25 | |
| 26 | #include "cx23885.h" |
Steven Toth | d19770e | 2007-03-11 20:44:05 -0300 | [diff] [blame] | 27 | #include <media/v4l2-common.h> |
| 28 | |
Igor M. Liplianin | 5a23b07 | 2009-03-03 12:06:09 -0300 | [diff] [blame] | 29 | #include "dvb_ca_en50221.h" |
Steven Toth | d19770e | 2007-03-11 20:44:05 -0300 | [diff] [blame] | 30 | #include "s5h1409.h" |
Michael Krufky | 52b5045 | 2008-07-09 02:18:49 -0300 | [diff] [blame] | 31 | #include "s5h1411.h" |
Steven Toth | d19770e | 2007-03-11 20:44:05 -0300 | [diff] [blame] | 32 | #include "mt2131.h" |
Michael Krufky | 3ba71d2 | 2007-12-07 01:40:36 -0300 | [diff] [blame] | 33 | #include "tda8290.h" |
Michael Krufky | 4041f1a | 2007-12-24 04:52:08 -0300 | [diff] [blame] | 34 | #include "tda18271.h" |
Michael Krufky | 9bc37ca | 2007-09-08 15:17:13 -0300 | [diff] [blame] | 35 | #include "lgdt330x.h" |
istvan_v@mailbox.hu | 0cf8af5 | 2011-07-11 10:58:35 -0300 | [diff] [blame] | 36 | #include "xc4000.h" |
Steven Toth | d1987d5 | 2007-12-18 01:57:06 -0300 | [diff] [blame] | 37 | #include "xc5000.h" |
David T. L. Wong | ea5697f | 2009-10-26 08:54:04 -0300 | [diff] [blame] | 38 | #include "max2165.h" |
Steven Toth | b3ea016 | 2008-04-19 01:14:19 -0300 | [diff] [blame] | 39 | #include "tda10048.h" |
Michael Krufky | 07b4a83 | 2007-12-18 01:09:11 -0300 | [diff] [blame] | 40 | #include "tuner-xc2028.h" |
Michael Krufky | 827855d | 2008-04-22 14:46:16 -0300 | [diff] [blame] | 41 | #include "tuner-simple.h" |
Steven Toth | 6676237 | 2008-04-22 15:38:26 -0300 | [diff] [blame] | 42 | #include "dib7000p.h" |
James Harper | 46b21bb | 2014-06-12 07:12:24 -0300 | [diff] [blame] | 43 | #include "dib0070.h" |
Steven Toth | 6676237 | 2008-04-22 15:38:26 -0300 | [diff] [blame] | 44 | #include "dibx000_common.h" |
Steven Toth | aef2d18 | 2008-08-04 21:39:53 -0300 | [diff] [blame] | 45 | #include "zl10353.h" |
Igor M. Liplianin | 5a23b07 | 2009-03-03 12:06:09 -0300 | [diff] [blame] | 46 | #include "stv0900.h" |
Igor M. Liplianin | f867c3f | 2009-06-19 05:45:23 -0300 | [diff] [blame] | 47 | #include "stv0900_reg.h" |
Igor M. Liplianin | 5a23b07 | 2009-03-03 12:06:09 -0300 | [diff] [blame] | 48 | #include "stv6110.h" |
| 49 | #include "lnbh24.h" |
Igor M. Liplianin | 96318d0 | 2009-01-17 12:11:20 -0300 | [diff] [blame] | 50 | #include "cx24116.h" |
Luis Alves | e600148 | 2013-10-01 22:11:35 -0300 | [diff] [blame] | 51 | #include "cx24117.h" |
Igor M. Liplianin | 5a23b07 | 2009-03-03 12:06:09 -0300 | [diff] [blame] | 52 | #include "cimax2.h" |
David Wong | 493b712 | 2009-05-18 05:25:49 -0300 | [diff] [blame] | 53 | #include "lgs8gxx.h" |
Igor M. Liplianin | 5a23b07 | 2009-03-03 12:06:09 -0300 | [diff] [blame] | 54 | #include "netup-eeprom.h" |
| 55 | #include "netup-init.h" |
Michael Krufky | a5dbf45 | 2009-05-03 23:27:02 -0300 | [diff] [blame] | 56 | #include "lgdt3305.h" |
David T. L. Wong | ea5697f | 2009-10-26 08:54:04 -0300 | [diff] [blame] | 57 | #include "atbm8830.h" |
Konstantin Dimitrov | 73f0af4 | 2012-12-23 19:25:38 -0300 | [diff] [blame] | 58 | #include "ts2020.h" |
Igor M. Liplianin | 09ea33e | 2009-11-24 20:16:04 -0300 | [diff] [blame] | 59 | #include "ds3000.h" |
| 60 | #include "cx23885-f300.h" |
Igor M. Liplianin | 78db854 | 2011-01-25 17:04:00 -0300 | [diff] [blame] | 61 | #include "altera-ci.h" |
| 62 | #include "stv0367.h" |
Stefan Ringel | 722c90e | 2012-01-07 09:20:48 -0300 | [diff] [blame] | 63 | #include "drxk.h" |
| 64 | #include "mt2063.h" |
Mariusz Bia?o?czyk | f667190 | 2012-09-12 07:59:18 -0300 | [diff] [blame] | 65 | #include "stv090x.h" |
| 66 | #include "stb6100.h" |
| 67 | #include "stb6100_cfg.h" |
Michael Krufky | 7c62f5a | 2012-12-15 23:34:09 -0300 | [diff] [blame] | 68 | #include "tda10071.h" |
| 69 | #include "a8293.h" |
Mauro Carvalho Chehab | 0d1b526 | 2013-08-09 08:53:27 -0300 | [diff] [blame] | 70 | #include "mb86a20s.h" |
Matthias Schwarzott | 36efec4 | 2014-07-22 17:12:13 -0300 | [diff] [blame] | 71 | #include "si2165.h" |
Olli Salonen | 2944226 | 2014-08-11 16:58:15 -0300 | [diff] [blame] | 72 | #include "si2168.h" |
| 73 | #include "si2157.h" |
Olli Salonen | 24e7740 | 2014-10-04 03:59:30 -0300 | [diff] [blame] | 74 | #include "sp2.h" |
Olli Salonen | 2944226 | 2014-08-11 16:58:15 -0300 | [diff] [blame] | 75 | #include "m88ds3103.h" |
Antti Palosaari | 1fc77d0 | 2014-12-11 16:12:46 -0300 | [diff] [blame] | 76 | #include "m88rs6000t.h" |
Steven Toth | d19770e | 2007-03-11 20:44:05 -0300 | [diff] [blame] | 77 | |
Steven Toth | 4513fc69 | 2008-01-12 11:36:36 -0300 | [diff] [blame] | 78 | static unsigned int debug; |
Steven Toth | d19770e | 2007-03-11 20:44:05 -0300 | [diff] [blame] | 79 | |
Steven Toth | 4513fc69 | 2008-01-12 11:36:36 -0300 | [diff] [blame] | 80 | #define dprintk(level, fmt, arg...)\ |
| 81 | do { if (debug >= level)\ |
| 82 | printk(KERN_DEBUG "%s/0: " fmt, dev->name, ## arg);\ |
| 83 | } while (0) |
Steven Toth | d19770e | 2007-03-11 20:44:05 -0300 | [diff] [blame] | 84 | |
| 85 | /* ------------------------------------------------------------------ */ |
| 86 | |
Michael Krufky | 3ba71d2 | 2007-12-07 01:40:36 -0300 | [diff] [blame] | 87 | static unsigned int alt_tuner; |
| 88 | module_param(alt_tuner, int, 0644); |
| 89 | MODULE_PARM_DESC(alt_tuner, "Enable alternate tuner configuration"); |
| 90 | |
Janne Grunau | 78e9200 | 2008-04-09 19:13:13 -0300 | [diff] [blame] | 91 | DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); |
| 92 | |
Michael Krufky | 3ba71d2 | 2007-12-07 01:40:36 -0300 | [diff] [blame] | 93 | /* ------------------------------------------------------------------ */ |
| 94 | |
Hans Verkuil | 453afdd | 2014-08-14 06:43:01 -0300 | [diff] [blame] | 95 | static int queue_setup(struct vb2_queue *q, const struct v4l2_format *fmt, |
| 96 | unsigned int *num_buffers, unsigned int *num_planes, |
| 97 | unsigned int sizes[], void *alloc_ctxs[]) |
Steven Toth | d19770e | 2007-03-11 20:44:05 -0300 | [diff] [blame] | 98 | { |
Hans Verkuil | 453afdd | 2014-08-14 06:43:01 -0300 | [diff] [blame] | 99 | struct cx23885_tsport *port = q->drv_priv; |
Steven Toth | d19770e | 2007-03-11 20:44:05 -0300 | [diff] [blame] | 100 | |
| 101 | port->ts_packet_size = 188 * 4; |
| 102 | port->ts_packet_count = 32; |
Hans Verkuil | 453afdd | 2014-08-14 06:43:01 -0300 | [diff] [blame] | 103 | *num_planes = 1; |
| 104 | sizes[0] = port->ts_packet_size * port->ts_packet_count; |
Hans Verkuil | 0c3a14c | 2014-11-18 09:51:01 -0300 | [diff] [blame] | 105 | alloc_ctxs[0] = port->dev->alloc_ctx; |
Hans Verkuil | 453afdd | 2014-08-14 06:43:01 -0300 | [diff] [blame] | 106 | *num_buffers = 32; |
Steven Toth | d19770e | 2007-03-11 20:44:05 -0300 | [diff] [blame] | 107 | return 0; |
| 108 | } |
| 109 | |
Hans Verkuil | 453afdd | 2014-08-14 06:43:01 -0300 | [diff] [blame] | 110 | |
| 111 | static int buffer_prepare(struct vb2_buffer *vb) |
Steven Toth | d19770e | 2007-03-11 20:44:05 -0300 | [diff] [blame] | 112 | { |
Hans Verkuil | 453afdd | 2014-08-14 06:43:01 -0300 | [diff] [blame] | 113 | struct cx23885_tsport *port = vb->vb2_queue->drv_priv; |
| 114 | struct cx23885_buffer *buf = |
| 115 | container_of(vb, struct cx23885_buffer, vb); |
| 116 | |
| 117 | return cx23885_buf_prepare(buf, port); |
Steven Toth | d19770e | 2007-03-11 20:44:05 -0300 | [diff] [blame] | 118 | } |
| 119 | |
Hans Verkuil | 453afdd | 2014-08-14 06:43:01 -0300 | [diff] [blame] | 120 | static void buffer_finish(struct vb2_buffer *vb) |
Steven Toth | d19770e | 2007-03-11 20:44:05 -0300 | [diff] [blame] | 121 | { |
Hans Verkuil | 453afdd | 2014-08-14 06:43:01 -0300 | [diff] [blame] | 122 | struct cx23885_tsport *port = vb->vb2_queue->drv_priv; |
| 123 | struct cx23885_dev *dev = port->dev; |
| 124 | struct cx23885_buffer *buf = container_of(vb, |
| 125 | struct cx23885_buffer, vb); |
Hans Verkuil | 453afdd | 2014-08-14 06:43:01 -0300 | [diff] [blame] | 126 | |
| 127 | cx23885_free_buffer(dev, buf); |
Steven Toth | d19770e | 2007-03-11 20:44:05 -0300 | [diff] [blame] | 128 | } |
| 129 | |
Hans Verkuil | 453afdd | 2014-08-14 06:43:01 -0300 | [diff] [blame] | 130 | static void buffer_queue(struct vb2_buffer *vb) |
Steven Toth | d19770e | 2007-03-11 20:44:05 -0300 | [diff] [blame] | 131 | { |
Hans Verkuil | 453afdd | 2014-08-14 06:43:01 -0300 | [diff] [blame] | 132 | struct cx23885_tsport *port = vb->vb2_queue->drv_priv; |
| 133 | struct cx23885_buffer *buf = container_of(vb, |
| 134 | struct cx23885_buffer, vb); |
| 135 | |
| 136 | cx23885_buf_queue(port, buf); |
Steven Toth | d19770e | 2007-03-11 20:44:05 -0300 | [diff] [blame] | 137 | } |
| 138 | |
Igor M. Liplianin | 78db854 | 2011-01-25 17:04:00 -0300 | [diff] [blame] | 139 | static void cx23885_dvb_gate_ctrl(struct cx23885_tsport *port, int open) |
| 140 | { |
Hans Verkuil | 453afdd | 2014-08-14 06:43:01 -0300 | [diff] [blame] | 141 | struct vb2_dvb_frontends *f; |
| 142 | struct vb2_dvb_frontend *fe; |
Igor M. Liplianin | 78db854 | 2011-01-25 17:04:00 -0300 | [diff] [blame] | 143 | |
| 144 | f = &port->frontends; |
| 145 | |
| 146 | if (f->gate <= 1) /* undefined or fe0 */ |
Hans Verkuil | 453afdd | 2014-08-14 06:43:01 -0300 | [diff] [blame] | 147 | fe = vb2_dvb_get_frontend(f, 1); |
Igor M. Liplianin | 78db854 | 2011-01-25 17:04:00 -0300 | [diff] [blame] | 148 | else |
Hans Verkuil | 453afdd | 2014-08-14 06:43:01 -0300 | [diff] [blame] | 149 | fe = vb2_dvb_get_frontend(f, f->gate); |
Igor M. Liplianin | 78db854 | 2011-01-25 17:04:00 -0300 | [diff] [blame] | 150 | |
| 151 | if (fe && fe->dvb.frontend && fe->dvb.frontend->ops.i2c_gate_ctrl) |
| 152 | fe->dvb.frontend->ops.i2c_gate_ctrl(fe->dvb.frontend, open); |
| 153 | } |
| 154 | |
Hans Verkuil | 453afdd | 2014-08-14 06:43:01 -0300 | [diff] [blame] | 155 | static int cx23885_start_streaming(struct vb2_queue *q, unsigned int count) |
| 156 | { |
| 157 | struct cx23885_tsport *port = q->drv_priv; |
| 158 | struct cx23885_dmaqueue *dmaq = &port->mpegq; |
| 159 | struct cx23885_buffer *buf = list_entry(dmaq->active.next, |
| 160 | struct cx23885_buffer, queue); |
| 161 | |
| 162 | cx23885_start_dma(port, dmaq, buf); |
| 163 | return 0; |
| 164 | } |
| 165 | |
| 166 | static void cx23885_stop_streaming(struct vb2_queue *q) |
| 167 | { |
| 168 | struct cx23885_tsport *port = q->drv_priv; |
| 169 | |
| 170 | cx23885_cancel_buffers(port); |
| 171 | } |
| 172 | |
| 173 | static struct vb2_ops dvb_qops = { |
| 174 | .queue_setup = queue_setup, |
| 175 | .buf_prepare = buffer_prepare, |
| 176 | .buf_finish = buffer_finish, |
| 177 | .buf_queue = buffer_queue, |
| 178 | .wait_prepare = vb2_ops_wait_prepare, |
| 179 | .wait_finish = vb2_ops_wait_finish, |
| 180 | .start_streaming = cx23885_start_streaming, |
| 181 | .stop_streaming = cx23885_stop_streaming, |
Steven Toth | d19770e | 2007-03-11 20:44:05 -0300 | [diff] [blame] | 182 | }; |
| 183 | |
Steven Toth | 86184e0 | 2007-09-04 21:40:47 -0300 | [diff] [blame] | 184 | static struct s5h1409_config hauppauge_generic_config = { |
Steven Toth | d19770e | 2007-03-11 20:44:05 -0300 | [diff] [blame] | 185 | .demod_address = 0x32 >> 1, |
| 186 | .output_mode = S5H1409_SERIAL_OUTPUT, |
Steven Toth | fc959be | 2007-09-08 19:08:17 -0300 | [diff] [blame] | 187 | .gpio = S5H1409_GPIO_ON, |
Michael Krufky | 2b03238 | 2007-12-13 10:04:10 -0300 | [diff] [blame] | 188 | .qam_if = 44000, |
Steven Toth | fc959be | 2007-09-08 19:08:17 -0300 | [diff] [blame] | 189 | .inversion = S5H1409_INVERSION_OFF, |
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, |
Steven Toth | fc959be | 2007-09-08 19:08:17 -0300 | [diff] [blame] | 192 | }; |
| 193 | |
Steven Toth | b3ea016 | 2008-04-19 01:14:19 -0300 | [diff] [blame] | 194 | static struct tda10048_config hauppauge_hvr1200_config = { |
| 195 | .demod_address = 0x10 >> 1, |
| 196 | .output_mode = TDA10048_SERIAL_OUTPUT, |
| 197 | .fwbulkwritelen = TDA10048_BULKWRITE_200, |
Steven Toth | 484d9e0 | 2009-05-02 11:08:23 -0300 | [diff] [blame] | 198 | .inversion = TDA10048_INVERSION_ON, |
Steven Toth | 8816bef | 2009-05-15 21:04:18 -0300 | [diff] [blame] | 199 | .dtv6_if_freq_khz = TDA10048_IF_3300, |
| 200 | .dtv7_if_freq_khz = TDA10048_IF_3800, |
| 201 | .dtv8_if_freq_khz = TDA10048_IF_4300, |
Steven Toth | 484d9e0 | 2009-05-02 11:08:23 -0300 | [diff] [blame] | 202 | .clk_freq_khz = TDA10048_CLK_16000, |
Steven Toth | b3ea016 | 2008-04-19 01:14:19 -0300 | [diff] [blame] | 203 | }; |
| 204 | |
Michael Krufky | 6b926ec | 2009-05-12 17:32:17 -0300 | [diff] [blame] | 205 | static struct tda10048_config hauppauge_hvr1210_config = { |
| 206 | .demod_address = 0x10 >> 1, |
| 207 | .output_mode = TDA10048_SERIAL_OUTPUT, |
| 208 | .fwbulkwritelen = TDA10048_BULKWRITE_200, |
| 209 | .inversion = TDA10048_INVERSION_ON, |
Michael Krufky | c27586e | 2009-05-16 11:00:23 -0300 | [diff] [blame] | 210 | .dtv6_if_freq_khz = TDA10048_IF_3300, |
| 211 | .dtv7_if_freq_khz = TDA10048_IF_3500, |
| 212 | .dtv8_if_freq_khz = TDA10048_IF_4000, |
Michael Krufky | 6b926ec | 2009-05-12 17:32:17 -0300 | [diff] [blame] | 213 | .clk_freq_khz = TDA10048_CLK_16000, |
| 214 | }; |
| 215 | |
Michael Krufky | 3ba71d2 | 2007-12-07 01:40:36 -0300 | [diff] [blame] | 216 | static struct s5h1409_config hauppauge_ezqam_config = { |
| 217 | .demod_address = 0x32 >> 1, |
| 218 | .output_mode = S5H1409_SERIAL_OUTPUT, |
| 219 | .gpio = S5H1409_GPIO_OFF, |
| 220 | .qam_if = 4000, |
| 221 | .inversion = S5H1409_INVERSION_ON, |
Steven Toth | dfc1c08 | 2008-01-15 21:35:22 -0300 | [diff] [blame] | 222 | .status_mode = S5H1409_DEMODLOCKING, |
| 223 | .mpeg_timing = S5H1409_MPEGTIMING_CONTINOUS_NONINVERTING_CLOCK, |
Michael Krufky | 3ba71d2 | 2007-12-07 01:40:36 -0300 | [diff] [blame] | 224 | }; |
| 225 | |
Steven Toth | fc959be | 2007-09-08 19:08:17 -0300 | [diff] [blame] | 226 | static struct s5h1409_config hauppauge_hvr1800lp_config = { |
| 227 | .demod_address = 0x32 >> 1, |
| 228 | .output_mode = S5H1409_SERIAL_OUTPUT, |
Steven Toth | d19770e | 2007-03-11 20:44:05 -0300 | [diff] [blame] | 229 | .gpio = S5H1409_GPIO_OFF, |
Michael Krufky | 2b03238 | 2007-12-13 10:04:10 -0300 | [diff] [blame] | 230 | .qam_if = 44000, |
Steven Toth | fe475163 | 2007-03-20 15:27:53 -0300 | [diff] [blame] | 231 | .inversion = S5H1409_INVERSION_OFF, |
Steven Toth | dfc1c08 | 2008-01-15 21:35:22 -0300 | [diff] [blame] | 232 | .status_mode = S5H1409_DEMODLOCKING, |
| 233 | .mpeg_timing = S5H1409_MPEGTIMING_CONTINOUS_NONINVERTING_CLOCK, |
Steven Toth | d19770e | 2007-03-11 20:44:05 -0300 | [diff] [blame] | 234 | }; |
| 235 | |
Michael Krufky | 07b4a83 | 2007-12-18 01:09:11 -0300 | [diff] [blame] | 236 | static struct s5h1409_config hauppauge_hvr1500_config = { |
| 237 | .demod_address = 0x32 >> 1, |
| 238 | .output_mode = S5H1409_SERIAL_OUTPUT, |
| 239 | .gpio = S5H1409_GPIO_OFF, |
| 240 | .inversion = S5H1409_INVERSION_OFF, |
Steven Toth | dfc1c08 | 2008-01-15 21:35:22 -0300 | [diff] [blame] | 241 | .status_mode = S5H1409_DEMODLOCKING, |
| 242 | .mpeg_timing = S5H1409_MPEGTIMING_CONTINOUS_NONINVERTING_CLOCK, |
Michael Krufky | 07b4a83 | 2007-12-18 01:09:11 -0300 | [diff] [blame] | 243 | }; |
| 244 | |
Steven Toth | 86184e0 | 2007-09-04 21:40:47 -0300 | [diff] [blame] | 245 | static struct mt2131_config hauppauge_generic_tunerconfig = { |
Steven Toth | a77743b | 2007-08-22 21:01:20 -0300 | [diff] [blame] | 246 | 0x61 |
| 247 | }; |
| 248 | |
Michael Krufky | 9bc37ca | 2007-09-08 15:17:13 -0300 | [diff] [blame] | 249 | static struct lgdt330x_config fusionhdtv_5_express = { |
| 250 | .demod_address = 0x0e, |
| 251 | .demod_chip = LGDT3303, |
| 252 | .serial_mpeg = 0x40, |
| 253 | }; |
| 254 | |
Steven Toth | d1987d5 | 2007-12-18 01:57:06 -0300 | [diff] [blame] | 255 | static struct s5h1409_config hauppauge_hvr1500q_config = { |
| 256 | .demod_address = 0x32 >> 1, |
| 257 | .output_mode = S5H1409_SERIAL_OUTPUT, |
| 258 | .gpio = S5H1409_GPIO_ON, |
| 259 | .qam_if = 44000, |
| 260 | .inversion = S5H1409_INVERSION_OFF, |
Steven Toth | dfc1c08 | 2008-01-15 21:35:22 -0300 | [diff] [blame] | 261 | .status_mode = S5H1409_DEMODLOCKING, |
| 262 | .mpeg_timing = S5H1409_MPEGTIMING_CONTINOUS_NONINVERTING_CLOCK, |
Steven Toth | d1987d5 | 2007-12-18 01:57:06 -0300 | [diff] [blame] | 263 | }; |
| 264 | |
Michael Krufky | 335377b | 2008-05-07 01:43:10 -0300 | [diff] [blame] | 265 | static struct s5h1409_config dvico_s5h1409_config = { |
| 266 | .demod_address = 0x32 >> 1, |
| 267 | .output_mode = S5H1409_SERIAL_OUTPUT, |
| 268 | .gpio = S5H1409_GPIO_ON, |
| 269 | .qam_if = 44000, |
| 270 | .inversion = S5H1409_INVERSION_OFF, |
| 271 | .status_mode = S5H1409_DEMODLOCKING, |
| 272 | .mpeg_timing = S5H1409_MPEGTIMING_CONTINOUS_NONINVERTING_CLOCK, |
| 273 | }; |
| 274 | |
Michael Krufky | 52b5045 | 2008-07-09 02:18:49 -0300 | [diff] [blame] | 275 | static struct s5h1411_config dvico_s5h1411_config = { |
| 276 | .output_mode = S5H1411_SERIAL_OUTPUT, |
| 277 | .gpio = S5H1411_GPIO_ON, |
| 278 | .qam_if = S5H1411_IF_44000, |
| 279 | .vsb_if = S5H1411_IF_44000, |
| 280 | .inversion = S5H1411_INVERSION_OFF, |
| 281 | .status_mode = S5H1411_DEMODLOCKING, |
| 282 | .mpeg_timing = S5H1411_MPEGTIMING_CONTINOUS_NONINVERTING_CLOCK, |
| 283 | }; |
| 284 | |
Michael Krufky | 19bc579 | 2009-05-08 16:05:29 -0300 | [diff] [blame] | 285 | static struct s5h1411_config hcw_s5h1411_config = { |
| 286 | .output_mode = S5H1411_SERIAL_OUTPUT, |
| 287 | .gpio = S5H1411_GPIO_OFF, |
| 288 | .vsb_if = S5H1411_IF_44000, |
| 289 | .qam_if = S5H1411_IF_4000, |
| 290 | .inversion = S5H1411_INVERSION_ON, |
| 291 | .status_mode = S5H1411_DEMODLOCKING, |
| 292 | .mpeg_timing = S5H1411_MPEGTIMING_CONTINOUS_NONINVERTING_CLOCK, |
| 293 | }; |
| 294 | |
Steven Toth | d1987d5 | 2007-12-18 01:57:06 -0300 | [diff] [blame] | 295 | static struct xc5000_config hauppauge_hvr1500q_tunerconfig = { |
Steven Toth | e12671c | 2007-12-20 01:14:43 -0300 | [diff] [blame] | 296 | .i2c_address = 0x61, |
| 297 | .if_khz = 5380, |
Steven Toth | d1987d5 | 2007-12-18 01:57:06 -0300 | [diff] [blame] | 298 | }; |
| 299 | |
Michael Krufky | 335377b | 2008-05-07 01:43:10 -0300 | [diff] [blame] | 300 | static struct xc5000_config dvico_xc5000_tunerconfig = { |
| 301 | .i2c_address = 0x64, |
| 302 | .if_khz = 5380, |
Michael Krufky | 335377b | 2008-05-07 01:43:10 -0300 | [diff] [blame] | 303 | }; |
| 304 | |
Michael Krufky | 4041f1a | 2007-12-24 04:52:08 -0300 | [diff] [blame] | 305 | static struct tda829x_config tda829x_no_probe = { |
| 306 | .probe_tuner = TDA829X_DONT_PROBE, |
| 307 | }; |
| 308 | |
Michael Krufky | f21e0d7 | 2008-01-02 03:01:54 -0300 | [diff] [blame] | 309 | static struct tda18271_std_map hauppauge_tda18271_std_map = { |
Michael Krufky | c0dc0c1 | 2008-04-22 14:46:22 -0300 | [diff] [blame] | 310 | .atsc_6 = { .if_freq = 5380, .agc_mode = 3, .std = 3, |
| 311 | .if_lvl = 6, .rfagc_top = 0x37 }, |
| 312 | .qam_6 = { .if_freq = 4000, .agc_mode = 3, .std = 0, |
| 313 | .if_lvl = 6, .rfagc_top = 0x37 }, |
Michael Krufky | f21e0d7 | 2008-01-02 03:01:54 -0300 | [diff] [blame] | 314 | }; |
| 315 | |
Michael Krufky | b34cdc3 | 2009-05-21 12:49:28 -0300 | [diff] [blame] | 316 | static struct tda18271_std_map hauppauge_hvr1200_tda18271_std_map = { |
| 317 | .dvbt_6 = { .if_freq = 3300, .agc_mode = 3, .std = 4, |
| 318 | .if_lvl = 1, .rfagc_top = 0x37, }, |
| 319 | .dvbt_7 = { .if_freq = 3800, .agc_mode = 3, .std = 5, |
| 320 | .if_lvl = 1, .rfagc_top = 0x37, }, |
| 321 | .dvbt_8 = { .if_freq = 4300, .agc_mode = 3, .std = 6, |
| 322 | .if_lvl = 1, .rfagc_top = 0x37, }, |
| 323 | }; |
| 324 | |
Michael Krufky | f21e0d7 | 2008-01-02 03:01:54 -0300 | [diff] [blame] | 325 | static struct tda18271_config hauppauge_tda18271_config = { |
| 326 | .std_map = &hauppauge_tda18271_std_map, |
| 327 | .gate = TDA18271_GATE_ANALOG, |
Michael Krufky | 04a68ba | 2009-09-06 14:11:09 -0300 | [diff] [blame] | 328 | .output_opt = TDA18271_OUTPUT_LT_OFF, |
Michael Krufky | f21e0d7 | 2008-01-02 03:01:54 -0300 | [diff] [blame] | 329 | }; |
| 330 | |
Steven Toth | b3ea016 | 2008-04-19 01:14:19 -0300 | [diff] [blame] | 331 | static struct tda18271_config hauppauge_hvr1200_tuner_config = { |
Michael Krufky | b34cdc3 | 2009-05-21 12:49:28 -0300 | [diff] [blame] | 332 | .std_map = &hauppauge_hvr1200_tda18271_std_map, |
Steven Toth | b3ea016 | 2008-04-19 01:14:19 -0300 | [diff] [blame] | 333 | .gate = TDA18271_GATE_ANALOG, |
Michael Krufky | 04a68ba | 2009-09-06 14:11:09 -0300 | [diff] [blame] | 334 | .output_opt = TDA18271_OUTPUT_LT_OFF, |
Steven Toth | b3ea016 | 2008-04-19 01:14:19 -0300 | [diff] [blame] | 335 | }; |
| 336 | |
Michael Krufky | 6b926ec | 2009-05-12 17:32:17 -0300 | [diff] [blame] | 337 | static struct tda18271_config hauppauge_hvr1210_tuner_config = { |
| 338 | .gate = TDA18271_GATE_DIGITAL, |
Michael Krufky | 04a68ba | 2009-09-06 14:11:09 -0300 | [diff] [blame] | 339 | .output_opt = TDA18271_OUTPUT_LT_OFF, |
Michael Krufky | 6b926ec | 2009-05-12 17:32:17 -0300 | [diff] [blame] | 340 | }; |
| 341 | |
Matthias Schwarzott | 36efec4 | 2014-07-22 17:12:13 -0300 | [diff] [blame] | 342 | static struct tda18271_config hauppauge_hvr4400_tuner_config = { |
| 343 | .gate = TDA18271_GATE_DIGITAL, |
| 344 | .output_opt = TDA18271_OUTPUT_LT_OFF, |
| 345 | }; |
| 346 | |
Michael Krufky | 247bc54 | 2009-05-12 18:53:47 -0300 | [diff] [blame] | 347 | static struct tda18271_std_map hauppauge_hvr127x_std_map = { |
Michael Krufky | a5dbf45 | 2009-05-03 23:27:02 -0300 | [diff] [blame] | 348 | .atsc_6 = { .if_freq = 3250, .agc_mode = 3, .std = 4, |
| 349 | .if_lvl = 1, .rfagc_top = 0x58 }, |
| 350 | .qam_6 = { .if_freq = 4000, .agc_mode = 3, .std = 5, |
| 351 | .if_lvl = 1, .rfagc_top = 0x58 }, |
| 352 | }; |
| 353 | |
Michael Krufky | 247bc54 | 2009-05-12 18:53:47 -0300 | [diff] [blame] | 354 | static struct tda18271_config hauppauge_hvr127x_config = { |
| 355 | .std_map = &hauppauge_hvr127x_std_map, |
Michael Krufky | 04a68ba | 2009-09-06 14:11:09 -0300 | [diff] [blame] | 356 | .output_opt = TDA18271_OUTPUT_LT_OFF, |
Michael Krufky | a5dbf45 | 2009-05-03 23:27:02 -0300 | [diff] [blame] | 357 | }; |
| 358 | |
Michael Krufky | 247bc54 | 2009-05-12 18:53:47 -0300 | [diff] [blame] | 359 | static struct lgdt3305_config hauppauge_lgdt3305_config = { |
Michael Krufky | a5dbf45 | 2009-05-03 23:27:02 -0300 | [diff] [blame] | 360 | .i2c_addr = 0x0e, |
| 361 | .mpeg_mode = LGDT3305_MPEG_SERIAL, |
| 362 | .tpclk_edge = LGDT3305_TPCLK_FALLING_EDGE, |
| 363 | .tpvalid_polarity = LGDT3305_TP_VALID_HIGH, |
| 364 | .deny_i2c_rptr = 1, |
| 365 | .spectral_inversion = 1, |
| 366 | .qam_if_khz = 4000, |
| 367 | .vsb_if_khz = 3250, |
| 368 | }; |
| 369 | |
Harvey Harrison | b1721d0 | 2008-04-25 19:03:08 -0700 | [diff] [blame] | 370 | static struct dibx000_agc_config xc3028_agc_config = { |
Steven Toth | 6676237 | 2008-04-22 15:38:26 -0300 | [diff] [blame] | 371 | BAND_VHF | BAND_UHF, /* band_caps */ |
| 372 | |
| 373 | /* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0, P_agc_freq_pwm_div=0, |
| 374 | * P_agc_inv_pwm1=0, P_agc_inv_pwm2=0, |
| 375 | * P_agc_inh_dc_rv_est=0, P_agc_time_est=3, P_agc_freeze=0, |
| 376 | * P_agc_nb_est=2, P_agc_write=0 |
| 377 | */ |
| 378 | (0 << 15) | (0 << 14) | (0 << 11) | (0 << 10) | (0 << 9) | (0 << 8) | |
| 379 | (3 << 5) | (0 << 4) | (2 << 1) | (0 << 0), /* setup */ |
| 380 | |
| 381 | 712, /* inv_gain */ |
| 382 | 21, /* time_stabiliz */ |
| 383 | |
| 384 | 0, /* alpha_level */ |
| 385 | 118, /* thlock */ |
| 386 | |
| 387 | 0, /* wbd_inv */ |
| 388 | 2867, /* wbd_ref */ |
| 389 | 0, /* wbd_sel */ |
| 390 | 2, /* wbd_alpha */ |
| 391 | |
| 392 | 0, /* agc1_max */ |
| 393 | 0, /* agc1_min */ |
| 394 | 39718, /* agc2_max */ |
| 395 | 9930, /* agc2_min */ |
| 396 | 0, /* agc1_pt1 */ |
| 397 | 0, /* agc1_pt2 */ |
| 398 | 0, /* agc1_pt3 */ |
| 399 | 0, /* agc1_slope1 */ |
| 400 | 0, /* agc1_slope2 */ |
| 401 | 0, /* agc2_pt1 */ |
| 402 | 128, /* agc2_pt2 */ |
| 403 | 29, /* agc2_slope1 */ |
| 404 | 29, /* agc2_slope2 */ |
| 405 | |
| 406 | 17, /* alpha_mant */ |
| 407 | 27, /* alpha_exp */ |
| 408 | 23, /* beta_mant */ |
| 409 | 51, /* beta_exp */ |
| 410 | |
| 411 | 1, /* perform_agc_softsplit */ |
| 412 | }; |
| 413 | |
| 414 | /* PLL Configuration for COFDM BW_MHz = 8.000000 |
| 415 | * With external clock = 30.000000 */ |
Harvey Harrison | b1721d0 | 2008-04-25 19:03:08 -0700 | [diff] [blame] | 416 | static struct dibx000_bandwidth_config xc3028_bw_config = { |
Steven Toth | 6676237 | 2008-04-22 15:38:26 -0300 | [diff] [blame] | 417 | 60000, /* internal */ |
| 418 | 30000, /* sampling */ |
| 419 | 1, /* pll_cfg: prediv */ |
| 420 | 8, /* pll_cfg: ratio */ |
| 421 | 3, /* pll_cfg: range */ |
| 422 | 1, /* pll_cfg: reset */ |
| 423 | 0, /* pll_cfg: bypass */ |
| 424 | 0, /* misc: refdiv */ |
| 425 | 0, /* misc: bypclk_div */ |
| 426 | 1, /* misc: IO_CLK_en_core */ |
| 427 | 1, /* misc: ADClkSrc */ |
| 428 | 0, /* misc: modulo */ |
| 429 | (3 << 14) | (1 << 12) | (524 << 0), /* sad_cfg: refsel, sel, freq_15k */ |
| 430 | (1 << 25) | 5816102, /* ifreq = 5.200000 MHz */ |
| 431 | 20452225, /* timf */ |
| 432 | 30000000 /* xtal_hz */ |
| 433 | }; |
| 434 | |
| 435 | static struct dib7000p_config hauppauge_hvr1400_dib7000_config = { |
| 436 | .output_mpeg2_in_188_bytes = 1, |
| 437 | .hostbus_diversity = 1, |
| 438 | .tuner_is_baseband = 0, |
| 439 | .update_lna = NULL, |
| 440 | |
| 441 | .agc_config_count = 1, |
| 442 | .agc = &xc3028_agc_config, |
| 443 | .bw = &xc3028_bw_config, |
| 444 | |
| 445 | .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS, |
| 446 | .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES, |
| 447 | .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS, |
| 448 | |
| 449 | .pwm_freq_div = 0, |
| 450 | .agc_control = NULL, |
| 451 | .spur_protect = 0, |
| 452 | |
| 453 | .output_mode = OUTMODE_MPEG2_SERIAL, |
| 454 | }; |
| 455 | |
Steven Toth | aef2d18 | 2008-08-04 21:39:53 -0300 | [diff] [blame] | 456 | static struct zl10353_config dvico_fusionhdtv_xc3028 = { |
| 457 | .demod_address = 0x0f, |
| 458 | .if2 = 45600, |
| 459 | .no_tuner = 1, |
Christopher Pascoe | d4dc673 | 2009-04-27 11:27:04 -0300 | [diff] [blame] | 460 | .disable_i2c_gate_ctrl = 1, |
Steven Toth | aef2d18 | 2008-08-04 21:39:53 -0300 | [diff] [blame] | 461 | }; |
| 462 | |
Igor M. Liplianin | f867c3f | 2009-06-19 05:45:23 -0300 | [diff] [blame] | 463 | static struct stv0900_reg stv0900_ts_regs[] = { |
| 464 | { R0900_TSGENERAL, 0x00 }, |
| 465 | { R0900_P1_TSSPEED, 0x40 }, |
| 466 | { R0900_P2_TSSPEED, 0x40 }, |
| 467 | { R0900_P1_TSCFGM, 0xc0 }, |
| 468 | { R0900_P2_TSCFGM, 0xc0 }, |
| 469 | { R0900_P1_TSCFGH, 0xe0 }, |
| 470 | { R0900_P2_TSCFGH, 0xe0 }, |
| 471 | { R0900_P1_TSCFGL, 0x20 }, |
| 472 | { R0900_P2_TSCFGL, 0x20 }, |
| 473 | { 0xffff, 0xff }, /* terminate */ |
| 474 | }; |
| 475 | |
Igor M. Liplianin | 5a23b07 | 2009-03-03 12:06:09 -0300 | [diff] [blame] | 476 | static struct stv0900_config netup_stv0900_config = { |
| 477 | .demod_address = 0x68, |
Igor M. Liplianin | 29372a8 | 2009-10-17 08:58:26 -0300 | [diff] [blame] | 478 | .demod_mode = 1, /* dual */ |
Abylay Ospan | 644c7ef0 | 2009-07-19 18:06:00 -0300 | [diff] [blame] | 479 | .xtal = 8000000, |
Igor M. Liplianin | 5a23b07 | 2009-03-03 12:06:09 -0300 | [diff] [blame] | 480 | .clkmode = 3,/* 0-CLKI, 2-XTALI, else AUTO */ |
| 481 | .diseqc_mode = 2,/* 2/3 PWM */ |
Igor M. Liplianin | f867c3f | 2009-06-19 05:45:23 -0300 | [diff] [blame] | 482 | .ts_config_regs = stv0900_ts_regs, |
Igor M. Liplianin | 5a23b07 | 2009-03-03 12:06:09 -0300 | [diff] [blame] | 483 | .tun1_maddress = 0,/* 0x60 */ |
| 484 | .tun2_maddress = 3,/* 0x63 */ |
| 485 | .tun1_adc = 1,/* 1 Vpp */ |
| 486 | .tun2_adc = 1,/* 1 Vpp */ |
| 487 | }; |
| 488 | |
| 489 | static struct stv6110_config netup_stv6110_tunerconfig_a = { |
| 490 | .i2c_address = 0x60, |
Abylay Ospan | 644c7ef0 | 2009-07-19 18:06:00 -0300 | [diff] [blame] | 491 | .mclk = 16000000, |
| 492 | .clk_div = 1, |
Abylay Ospan | 873688c | 2009-10-17 08:23:00 -0300 | [diff] [blame] | 493 | .gain = 8, /* +16 dB - maximum gain */ |
Igor M. Liplianin | 5a23b07 | 2009-03-03 12:06:09 -0300 | [diff] [blame] | 494 | }; |
| 495 | |
| 496 | static struct stv6110_config netup_stv6110_tunerconfig_b = { |
| 497 | .i2c_address = 0x63, |
Abylay Ospan | 644c7ef0 | 2009-07-19 18:06:00 -0300 | [diff] [blame] | 498 | .mclk = 16000000, |
| 499 | .clk_div = 1, |
Abylay Ospan | 873688c | 2009-10-17 08:23:00 -0300 | [diff] [blame] | 500 | .gain = 8, /* +16 dB - maximum gain */ |
Igor M. Liplianin | 5a23b07 | 2009-03-03 12:06:09 -0300 | [diff] [blame] | 501 | }; |
| 502 | |
Igor M. Liplianin | 96318d0 | 2009-01-17 12:11:20 -0300 | [diff] [blame] | 503 | static struct cx24116_config tbs_cx24116_config = { |
Igor M. Liplianin | 09ea33e | 2009-11-24 20:16:04 -0300 | [diff] [blame] | 504 | .demod_address = 0x55, |
Igor M. Liplianin | 96318d0 | 2009-01-17 12:11:20 -0300 | [diff] [blame] | 505 | }; |
| 506 | |
Luis Alves | e600148 | 2013-10-01 22:11:35 -0300 | [diff] [blame] | 507 | static struct cx24117_config tbs_cx24117_config = { |
| 508 | .demod_address = 0x55, |
| 509 | }; |
| 510 | |
Igor M. Liplianin | 09ea33e | 2009-11-24 20:16:04 -0300 | [diff] [blame] | 511 | static struct ds3000_config tevii_ds3000_config = { |
| 512 | .demod_address = 0x68, |
Igor M. Liplianin | 579943f | 2009-01-17 12:18:26 -0300 | [diff] [blame] | 513 | }; |
| 514 | |
Konstantin Dimitrov | 73f0af4 | 2012-12-23 19:25:38 -0300 | [diff] [blame] | 515 | static struct ts2020_config tevii_ts2020_config = { |
| 516 | .tuner_address = 0x60, |
Igor M. Liplianin | b858c33 | 2012-12-28 19:40:33 -0300 | [diff] [blame] | 517 | .clk_out_div = 1, |
Joakim Hernberg | 8d2b022 | 2014-01-31 07:15:48 -0300 | [diff] [blame] | 518 | .frequency_div = 1146000, |
Konstantin Dimitrov | 73f0af4 | 2012-12-23 19:25:38 -0300 | [diff] [blame] | 519 | }; |
| 520 | |
Igor M. Liplianin | c9b8b04 | 2009-01-17 12:23:31 -0300 | [diff] [blame] | 521 | static struct cx24116_config dvbworld_cx24116_config = { |
| 522 | .demod_address = 0x05, |
| 523 | }; |
| 524 | |
David Wong | 493b712 | 2009-05-18 05:25:49 -0300 | [diff] [blame] | 525 | static struct lgs8gxx_config mygica_x8506_lgs8gl5_config = { |
| 526 | .prod = LGS8GXX_PROD_LGS8GL5, |
| 527 | .demod_address = 0x19, |
| 528 | .serial_ts = 0, |
| 529 | .ts_clk_pol = 1, |
| 530 | .ts_clk_gated = 1, |
| 531 | .if_clk_freq = 30400, /* 30.4 MHz */ |
| 532 | .if_freq = 5380, /* 5.38 MHz */ |
| 533 | .if_neg_center = 1, |
| 534 | .ext_adc = 0, |
| 535 | .adc_signed = 0, |
| 536 | .if_neg_edge = 0, |
| 537 | }; |
| 538 | |
| 539 | static struct xc5000_config mygica_x8506_xc5000_config = { |
| 540 | .i2c_address = 0x61, |
| 541 | .if_khz = 5380, |
| 542 | }; |
| 543 | |
Mauro Carvalho Chehab | 0d1b526 | 2013-08-09 08:53:27 -0300 | [diff] [blame] | 544 | static struct mb86a20s_config mygica_x8507_mb86a20s_config = { |
| 545 | .demod_address = 0x10, |
| 546 | }; |
| 547 | |
| 548 | static struct xc5000_config mygica_x8507_xc5000_config = { |
| 549 | .i2c_address = 0x61, |
| 550 | .if_khz = 4000, |
| 551 | }; |
| 552 | |
Mariusz Bia?o?czyk | f667190 | 2012-09-12 07:59:18 -0300 | [diff] [blame] | 553 | static struct stv090x_config prof_8000_stv090x_config = { |
Igor M. Liplianin | b858c33 | 2012-12-28 19:40:33 -0300 | [diff] [blame] | 554 | .device = STV0903, |
| 555 | .demod_mode = STV090x_SINGLE, |
| 556 | .clk_mode = STV090x_CLK_EXT, |
| 557 | .xtal = 27000000, |
| 558 | .address = 0x6A, |
| 559 | .ts1_mode = STV090x_TSMODE_PARALLEL_PUNCTURED, |
| 560 | .repeater_level = STV090x_RPTLEVEL_64, |
| 561 | .adc1_range = STV090x_ADC_2Vpp, |
| 562 | .diseqc_envelope_mode = false, |
Mariusz Bia?o?czyk | f667190 | 2012-09-12 07:59:18 -0300 | [diff] [blame] | 563 | |
Igor M. Liplianin | b858c33 | 2012-12-28 19:40:33 -0300 | [diff] [blame] | 564 | .tuner_get_frequency = stb6100_get_frequency, |
| 565 | .tuner_set_frequency = stb6100_set_frequency, |
| 566 | .tuner_set_bandwidth = stb6100_set_bandwidth, |
| 567 | .tuner_get_bandwidth = stb6100_get_bandwidth, |
Mariusz Bia?o?czyk | f667190 | 2012-09-12 07:59:18 -0300 | [diff] [blame] | 568 | }; |
| 569 | |
| 570 | static struct stb6100_config prof_8000_stb6100_config = { |
| 571 | .tuner_address = 0x60, |
| 572 | .refclock = 27000000, |
| 573 | }; |
| 574 | |
| 575 | static int p8000_set_voltage(struct dvb_frontend *fe, fe_sec_voltage_t voltage) |
| 576 | { |
| 577 | struct cx23885_tsport *port = fe->dvb->priv; |
| 578 | struct cx23885_dev *dev = port->dev; |
| 579 | |
| 580 | if (voltage == SEC_VOLTAGE_18) |
| 581 | cx_write(MC417_RWD, 0x00001e00); |
| 582 | else if (voltage == SEC_VOLTAGE_13) |
| 583 | cx_write(MC417_RWD, 0x00001a00); |
| 584 | else |
| 585 | cx_write(MC417_RWD, 0x00001800); |
| 586 | return 0; |
| 587 | } |
| 588 | |
Olli Salonen | 2944226 | 2014-08-11 16:58:15 -0300 | [diff] [blame] | 589 | static int dvbsky_t9580_set_voltage(struct dvb_frontend *fe, |
| 590 | fe_sec_voltage_t voltage) |
| 591 | { |
| 592 | struct cx23885_tsport *port = fe->dvb->priv; |
| 593 | struct cx23885_dev *dev = port->dev; |
| 594 | |
| 595 | cx23885_gpio_enable(dev, GPIO_0 | GPIO_1, 1); |
| 596 | |
| 597 | switch (voltage) { |
| 598 | case SEC_VOLTAGE_13: |
| 599 | cx23885_gpio_set(dev, GPIO_1); |
| 600 | cx23885_gpio_clear(dev, GPIO_0); |
| 601 | break; |
| 602 | case SEC_VOLTAGE_18: |
| 603 | cx23885_gpio_set(dev, GPIO_1); |
| 604 | cx23885_gpio_set(dev, GPIO_0); |
| 605 | break; |
| 606 | case SEC_VOLTAGE_OFF: |
| 607 | cx23885_gpio_clear(dev, GPIO_1); |
| 608 | cx23885_gpio_clear(dev, GPIO_0); |
| 609 | break; |
| 610 | } |
| 611 | |
| 612 | /* call the frontend set_voltage function */ |
| 613 | port->fe_set_voltage(fe, voltage); |
| 614 | |
| 615 | return 0; |
| 616 | } |
| 617 | |
nibble.max | c29d6a8 | 2014-11-05 11:58:38 -0300 | [diff] [blame] | 618 | static int dvbsky_s952_portc_set_voltage(struct dvb_frontend *fe, |
| 619 | fe_sec_voltage_t voltage) |
| 620 | { |
| 621 | struct cx23885_tsport *port = fe->dvb->priv; |
| 622 | struct cx23885_dev *dev = port->dev; |
| 623 | |
| 624 | cx23885_gpio_enable(dev, GPIO_12 | GPIO_13, 1); |
| 625 | |
| 626 | switch (voltage) { |
| 627 | case SEC_VOLTAGE_13: |
| 628 | cx23885_gpio_set(dev, GPIO_13); |
| 629 | cx23885_gpio_clear(dev, GPIO_12); |
| 630 | break; |
| 631 | case SEC_VOLTAGE_18: |
| 632 | cx23885_gpio_set(dev, GPIO_13); |
| 633 | cx23885_gpio_set(dev, GPIO_12); |
| 634 | break; |
| 635 | case SEC_VOLTAGE_OFF: |
| 636 | cx23885_gpio_clear(dev, GPIO_13); |
| 637 | cx23885_gpio_clear(dev, GPIO_12); |
| 638 | break; |
| 639 | } |
| 640 | /* call the frontend set_voltage function */ |
| 641 | return port->fe_set_voltage(fe, voltage); |
| 642 | } |
| 643 | |
Olli Salonen | 24e7740 | 2014-10-04 03:59:30 -0300 | [diff] [blame] | 644 | static int cx23885_sp2_ci_ctrl(void *priv, u8 read, int addr, |
| 645 | u8 data, int *mem) |
| 646 | { |
| 647 | /* MC417 */ |
| 648 | #define SP2_DATA 0x000000ff |
| 649 | #define SP2_WR 0x00008000 |
| 650 | #define SP2_RD 0x00004000 |
| 651 | #define SP2_ACK 0x00001000 |
| 652 | #define SP2_ADHI 0x00000800 |
| 653 | #define SP2_ADLO 0x00000400 |
| 654 | #define SP2_CS1 0x00000200 |
| 655 | #define SP2_CS0 0x00000100 |
| 656 | #define SP2_EN_ALL 0x00001000 |
| 657 | #define SP2_CTRL_OFF (SP2_CS1 | SP2_CS0 | SP2_WR | SP2_RD) |
| 658 | |
| 659 | struct cx23885_tsport *port = priv; |
| 660 | struct cx23885_dev *dev = port->dev; |
| 661 | int ret; |
nibble.max | 0e6c7b0 | 2014-10-23 07:01:44 -0300 | [diff] [blame] | 662 | int tmp = 0; |
Olli Salonen | 24e7740 | 2014-10-04 03:59:30 -0300 | [diff] [blame] | 663 | unsigned long timeout; |
| 664 | |
| 665 | mutex_lock(&dev->gpio_lock); |
| 666 | |
| 667 | /* write addr */ |
| 668 | cx_write(MC417_OEN, SP2_EN_ALL); |
| 669 | cx_write(MC417_RWD, SP2_CTRL_OFF | |
| 670 | SP2_ADLO | (0xff & addr)); |
| 671 | cx_clear(MC417_RWD, SP2_ADLO); |
| 672 | cx_write(MC417_RWD, SP2_CTRL_OFF | |
| 673 | SP2_ADHI | (0xff & (addr >> 8))); |
| 674 | cx_clear(MC417_RWD, SP2_ADHI); |
| 675 | |
| 676 | if (read) |
| 677 | /* data in */ |
| 678 | cx_write(MC417_OEN, SP2_EN_ALL | SP2_DATA); |
| 679 | else |
| 680 | /* data out */ |
| 681 | cx_write(MC417_RWD, SP2_CTRL_OFF | data); |
| 682 | |
| 683 | /* chip select 0 */ |
| 684 | cx_clear(MC417_RWD, SP2_CS0); |
| 685 | |
| 686 | /* read/write */ |
| 687 | cx_clear(MC417_RWD, (read) ? SP2_RD : SP2_WR); |
| 688 | |
| 689 | /* wait for a maximum of 1 msec */ |
| 690 | timeout = jiffies + msecs_to_jiffies(1); |
| 691 | while (!time_after(jiffies, timeout)) { |
| 692 | tmp = cx_read(MC417_RWD); |
| 693 | if ((tmp & SP2_ACK) == 0) |
| 694 | break; |
| 695 | usleep_range(50, 100); |
| 696 | } |
| 697 | |
| 698 | cx_set(MC417_RWD, SP2_CTRL_OFF); |
| 699 | *mem = tmp & 0xff; |
| 700 | |
| 701 | mutex_unlock(&dev->gpio_lock); |
| 702 | |
| 703 | if (!read) { |
| 704 | if (*mem < 0) { |
| 705 | ret = -EREMOTEIO; |
| 706 | goto err; |
| 707 | } |
| 708 | } |
| 709 | |
| 710 | return 0; |
| 711 | err: |
| 712 | return ret; |
| 713 | } |
| 714 | |
Mauro Carvalho Chehab | a7d44ba | 2011-12-26 20:48:54 -0300 | [diff] [blame] | 715 | static int cx23885_dvb_set_frontend(struct dvb_frontend *fe) |
Michael Krufky | f35b9e8 | 2009-05-08 22:39:24 -0300 | [diff] [blame] | 716 | { |
Mauro Carvalho Chehab | a7d44ba | 2011-12-26 20:48:54 -0300 | [diff] [blame] | 717 | struct dtv_frontend_properties *p = &fe->dtv_property_cache; |
Michael Krufky | f35b9e8 | 2009-05-08 22:39:24 -0300 | [diff] [blame] | 718 | struct cx23885_tsport *port = fe->dvb->priv; |
| 719 | struct cx23885_dev *dev = port->dev; |
| 720 | |
| 721 | switch (dev->board) { |
| 722 | case CX23885_BOARD_HAUPPAUGE_HVR1275: |
Mauro Carvalho Chehab | a7d44ba | 2011-12-26 20:48:54 -0300 | [diff] [blame] | 723 | switch (p->modulation) { |
Michael Krufky | f35b9e8 | 2009-05-08 22:39:24 -0300 | [diff] [blame] | 724 | case VSB_8: |
| 725 | cx23885_gpio_clear(dev, GPIO_5); |
| 726 | break; |
| 727 | case QAM_64: |
| 728 | case QAM_256: |
| 729 | default: |
| 730 | cx23885_gpio_set(dev, GPIO_5); |
| 731 | break; |
| 732 | } |
| 733 | break; |
David T.L. Wong | 6f0d8c0 | 2009-10-21 13:15:30 -0300 | [diff] [blame] | 734 | case CX23885_BOARD_MYGICA_X8506: |
Mauro Carvalho Chehab | 0d1b526 | 2013-08-09 08:53:27 -0300 | [diff] [blame] | 735 | case CX23885_BOARD_MYGICA_X8507: |
David T.L. Wong | 6f0d8c0 | 2009-10-21 13:15:30 -0300 | [diff] [blame] | 736 | case CX23885_BOARD_MAGICPRO_PROHDTVE2: |
| 737 | /* Select Digital TV */ |
| 738 | cx23885_gpio_set(dev, GPIO_0); |
| 739 | break; |
Michael Krufky | f35b9e8 | 2009-05-08 22:39:24 -0300 | [diff] [blame] | 740 | } |
Mauro Carvalho Chehab | 15472fa | 2013-08-09 08:53:25 -0300 | [diff] [blame] | 741 | |
| 742 | /* Call the real set_frontend */ |
| 743 | if (port->set_frontend) |
| 744 | return port->set_frontend(fe); |
| 745 | |
Michael Krufky | 5bdd396 | 2009-05-08 22:39:24 -0300 | [diff] [blame] | 746 | return 0; |
Michael Krufky | f35b9e8 | 2009-05-08 22:39:24 -0300 | [diff] [blame] | 747 | } |
| 748 | |
Mauro Carvalho Chehab | 15472fa | 2013-08-09 08:53:25 -0300 | [diff] [blame] | 749 | static void cx23885_set_frontend_hook(struct cx23885_tsport *port, |
| 750 | struct dvb_frontend *fe) |
| 751 | { |
| 752 | port->set_frontend = fe->ops.set_frontend; |
| 753 | fe->ops.set_frontend = cx23885_dvb_set_frontend; |
| 754 | } |
| 755 | |
David Wong | 2365b2d | 2009-06-17 01:38:12 -0300 | [diff] [blame] | 756 | static struct lgs8gxx_config magicpro_prohdtve2_lgs8g75_config = { |
| 757 | .prod = LGS8GXX_PROD_LGS8G75, |
| 758 | .demod_address = 0x19, |
| 759 | .serial_ts = 0, |
| 760 | .ts_clk_pol = 1, |
| 761 | .ts_clk_gated = 1, |
| 762 | .if_clk_freq = 30400, /* 30.4 MHz */ |
| 763 | .if_freq = 6500, /* 6.50 MHz */ |
| 764 | .if_neg_center = 1, |
| 765 | .ext_adc = 0, |
| 766 | .adc_signed = 1, |
| 767 | .adc_vpp = 2, /* 1.6 Vpp */ |
| 768 | .if_neg_edge = 1, |
| 769 | }; |
| 770 | |
| 771 | static struct xc5000_config magicpro_prohdtve2_xc5000_config = { |
| 772 | .i2c_address = 0x61, |
| 773 | .if_khz = 6500, |
| 774 | }; |
| 775 | |
David T. L. Wong | ea5697f | 2009-10-26 08:54:04 -0300 | [diff] [blame] | 776 | static struct atbm8830_config mygica_x8558pro_atbm8830_cfg1 = { |
| 777 | .prod = ATBM8830_PROD_8830, |
| 778 | .demod_address = 0x44, |
| 779 | .serial_ts = 0, |
| 780 | .ts_sampling_edge = 1, |
| 781 | .ts_clk_gated = 0, |
| 782 | .osc_clk_freq = 30400, /* in kHz */ |
| 783 | .if_freq = 0, /* zero IF */ |
| 784 | .zif_swap_iq = 1, |
David Wong | c245c75 | 2009-11-28 08:36:31 -0300 | [diff] [blame] | 785 | .agc_min = 0x2E, |
| 786 | .agc_max = 0xFF, |
| 787 | .agc_hold_loop = 0, |
David T. L. Wong | ea5697f | 2009-10-26 08:54:04 -0300 | [diff] [blame] | 788 | }; |
| 789 | |
| 790 | static struct max2165_config mygic_x8558pro_max2165_cfg1 = { |
| 791 | .i2c_address = 0x60, |
| 792 | .osc_clk = 20 |
| 793 | }; |
| 794 | |
| 795 | static struct atbm8830_config mygica_x8558pro_atbm8830_cfg2 = { |
| 796 | .prod = ATBM8830_PROD_8830, |
| 797 | .demod_address = 0x44, |
| 798 | .serial_ts = 1, |
| 799 | .ts_sampling_edge = 1, |
| 800 | .ts_clk_gated = 0, |
| 801 | .osc_clk_freq = 30400, /* in kHz */ |
| 802 | .if_freq = 0, /* zero IF */ |
| 803 | .zif_swap_iq = 1, |
David Wong | c245c75 | 2009-11-28 08:36:31 -0300 | [diff] [blame] | 804 | .agc_min = 0x2E, |
| 805 | .agc_max = 0xFF, |
| 806 | .agc_hold_loop = 0, |
David T. L. Wong | ea5697f | 2009-10-26 08:54:04 -0300 | [diff] [blame] | 807 | }; |
| 808 | |
| 809 | static struct max2165_config mygic_x8558pro_max2165_cfg2 = { |
| 810 | .i2c_address = 0x60, |
| 811 | .osc_clk = 20 |
| 812 | }; |
Igor M. Liplianin | 78db854 | 2011-01-25 17:04:00 -0300 | [diff] [blame] | 813 | static struct stv0367_config netup_stv0367_config[] = { |
| 814 | { |
| 815 | .demod_address = 0x1c, |
| 816 | .xtal = 27000000, |
| 817 | .if_khz = 4500, |
| 818 | .if_iq_mode = 0, |
| 819 | .ts_mode = 1, |
| 820 | .clk_pol = 0, |
| 821 | }, { |
| 822 | .demod_address = 0x1d, |
| 823 | .xtal = 27000000, |
| 824 | .if_khz = 4500, |
| 825 | .if_iq_mode = 0, |
| 826 | .ts_mode = 1, |
| 827 | .clk_pol = 0, |
| 828 | }, |
| 829 | }; |
| 830 | |
| 831 | static struct xc5000_config netup_xc5000_config[] = { |
| 832 | { |
| 833 | .i2c_address = 0x61, |
| 834 | .if_khz = 4500, |
| 835 | }, { |
| 836 | .i2c_address = 0x64, |
| 837 | .if_khz = 4500, |
| 838 | }, |
| 839 | }; |
| 840 | |
Stefan Ringel | 722c90e | 2012-01-07 09:20:48 -0300 | [diff] [blame] | 841 | static struct drxk_config terratec_drxk_config[] = { |
| 842 | { |
| 843 | .adr = 0x29, |
| 844 | .no_i2c_bridge = 1, |
| 845 | }, { |
| 846 | .adr = 0x2a, |
| 847 | .no_i2c_bridge = 1, |
| 848 | }, |
| 849 | }; |
| 850 | |
| 851 | static struct mt2063_config terratec_mt2063_config[] = { |
| 852 | { |
| 853 | .tuner_address = 0x60, |
| 854 | }, { |
| 855 | .tuner_address = 0x67, |
| 856 | }, |
| 857 | }; |
| 858 | |
Antti Palosaari | 49bf0e6 | 2015-04-20 14:48:33 -0300 | [diff] [blame] | 859 | static const struct tda10071_platform_data hauppauge_tda10071_pdata = { |
| 860 | .clk = 40444000, /* 40.444 MHz */ |
| 861 | .i2c_wr_max = 64, |
| 862 | .ts_mode = TDA10071_TS_SERIAL, |
| 863 | .pll_multiplier = 20, |
| 864 | .tuner_i2c_addr = 0x54, |
| 865 | }; |
| 866 | |
Michael Krufky | 7c62f5a | 2012-12-15 23:34:09 -0300 | [diff] [blame] | 867 | static const struct a8293_config hauppauge_a8293_config = { |
| 868 | .i2c_addr = 0x0b, |
| 869 | }; |
| 870 | |
Matthias Schwarzott | 36efec4 | 2014-07-22 17:12:13 -0300 | [diff] [blame] | 871 | static const struct si2165_config hauppauge_hvr4400_si2165_config = { |
| 872 | .i2c_addr = 0x64, |
| 873 | .chip_mode = SI2165_MODE_PLL_XTAL, |
| 874 | .ref_freq_Hz = 16000000, |
| 875 | }; |
| 876 | |
Olli Salonen | 2944226 | 2014-08-11 16:58:15 -0300 | [diff] [blame] | 877 | static const struct m88ds3103_config dvbsky_t9580_m88ds3103_config = { |
| 878 | .i2c_addr = 0x68, |
| 879 | .clock = 27000000, |
| 880 | .i2c_wr_max = 33, |
| 881 | .clock_out = 0, |
| 882 | .ts_mode = M88DS3103_TS_PARALLEL, |
| 883 | .ts_clk = 16000, |
| 884 | .ts_clk_pol = 1, |
| 885 | .lnb_en_pol = 1, |
| 886 | .lnb_hv_pol = 0, |
| 887 | .agc = 0x99, |
| 888 | }; |
| 889 | |
nibble.max | 0e6c7b0 | 2014-10-23 07:01:44 -0300 | [diff] [blame] | 890 | static const struct m88ds3103_config dvbsky_s950c_m88ds3103_config = { |
| 891 | .i2c_addr = 0x68, |
| 892 | .clock = 27000000, |
| 893 | .i2c_wr_max = 33, |
| 894 | .clock_out = 0, |
| 895 | .ts_mode = M88DS3103_TS_CI, |
| 896 | .ts_clk = 10000, |
| 897 | .ts_clk_pol = 1, |
| 898 | .lnb_en_pol = 1, |
| 899 | .lnb_hv_pol = 0, |
| 900 | .agc = 0x99, |
| 901 | }; |
| 902 | |
nibble.max | c29d6a8 | 2014-11-05 11:58:38 -0300 | [diff] [blame] | 903 | static const struct m88ds3103_config dvbsky_s952_portc_m88ds3103_config = { |
| 904 | .i2c_addr = 0x68, |
| 905 | .clock = 27000000, |
| 906 | .i2c_wr_max = 33, |
| 907 | .clock_out = 0, |
| 908 | .ts_mode = M88DS3103_TS_SERIAL, |
| 909 | .ts_clk = 96000, |
| 910 | .ts_clk_pol = 0, |
| 911 | .lnb_en_pol = 1, |
| 912 | .lnb_hv_pol = 0, |
| 913 | .agc = 0x99, |
| 914 | }; |
| 915 | |
Antti Palosaari | 1fc77d0 | 2014-12-11 16:12:46 -0300 | [diff] [blame] | 916 | static const struct m88ds3103_config hauppauge_hvr5525_m88ds3103_config = { |
| 917 | .i2c_addr = 0x69, |
| 918 | .clock = 27000000, |
| 919 | .i2c_wr_max = 33, |
| 920 | .ts_mode = M88DS3103_TS_PARALLEL, |
| 921 | .ts_clk = 16000, |
| 922 | .ts_clk_pol = 1, |
| 923 | .agc = 0x99, |
| 924 | }; |
| 925 | |
Mauro Carvalho Chehab | ada73ee | 2012-10-27 11:29:23 -0300 | [diff] [blame] | 926 | 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] | 927 | { |
| 928 | struct cx23885_dev *dev = (struct cx23885_dev *)device; |
| 929 | unsigned long timeout = jiffies + msecs_to_jiffies(1); |
Abylay Ospan | d164460 | 2011-01-02 09:10:00 -0300 | [diff] [blame] | 930 | uint32_t mem = 0; |
Igor M. Liplianin | 78db854 | 2011-01-25 17:04:00 -0300 | [diff] [blame] | 931 | |
Abylay Ospan | d164460 | 2011-01-02 09:10:00 -0300 | [diff] [blame] | 932 | mem = cx_read(MC417_RWD); |
Igor M. Liplianin | 78db854 | 2011-01-25 17:04:00 -0300 | [diff] [blame] | 933 | if (read) |
| 934 | cx_set(MC417_OEN, ALT_DATA); |
| 935 | else { |
| 936 | cx_clear(MC417_OEN, ALT_DATA);/* D0-D7 out */ |
Igor M. Liplianin | 78db854 | 2011-01-25 17:04:00 -0300 | [diff] [blame] | 937 | mem &= ~ALT_DATA; |
| 938 | mem |= (data & ALT_DATA); |
Igor M. Liplianin | 78db854 | 2011-01-25 17:04:00 -0300 | [diff] [blame] | 939 | } |
| 940 | |
| 941 | if (flag) |
Abylay Ospan | d164460 | 2011-01-02 09:10:00 -0300 | [diff] [blame] | 942 | mem |= ALT_AD_RG; |
Igor M. Liplianin | 78db854 | 2011-01-25 17:04:00 -0300 | [diff] [blame] | 943 | else |
Abylay Ospan | d164460 | 2011-01-02 09:10:00 -0300 | [diff] [blame] | 944 | mem &= ~ALT_AD_RG; |
Igor M. Liplianin | 78db854 | 2011-01-25 17:04:00 -0300 | [diff] [blame] | 945 | |
Abylay Ospan | d164460 | 2011-01-02 09:10:00 -0300 | [diff] [blame] | 946 | mem &= ~ALT_CS; |
Igor M. Liplianin | 78db854 | 2011-01-25 17:04:00 -0300 | [diff] [blame] | 947 | if (read) |
Abylay Ospan | d164460 | 2011-01-02 09:10:00 -0300 | [diff] [blame] | 948 | mem = (mem & ~ALT_RD) | ALT_WR; |
Igor M. Liplianin | 78db854 | 2011-01-25 17:04:00 -0300 | [diff] [blame] | 949 | else |
Abylay Ospan | d164460 | 2011-01-02 09:10:00 -0300 | [diff] [blame] | 950 | mem = (mem & ~ALT_WR) | ALT_RD; |
| 951 | |
| 952 | cx_write(MC417_RWD, mem); /* start RW cycle */ |
Igor M. Liplianin | 78db854 | 2011-01-25 17:04:00 -0300 | [diff] [blame] | 953 | |
| 954 | for (;;) { |
| 955 | mem = cx_read(MC417_RWD); |
| 956 | if ((mem & ALT_RDY) == 0) |
| 957 | break; |
| 958 | if (time_after(jiffies, timeout)) |
| 959 | break; |
| 960 | udelay(1); |
| 961 | } |
| 962 | |
| 963 | cx_set(MC417_RWD, ALT_RD | ALT_WR | ALT_CS); |
| 964 | if (read) |
| 965 | return mem & ALT_DATA; |
| 966 | |
| 967 | return 0; |
| 968 | }; |
David T. L. Wong | ea5697f | 2009-10-26 08:54:04 -0300 | [diff] [blame] | 969 | |
James Harper | 46b21bb | 2014-06-12 07:12:24 -0300 | [diff] [blame] | 970 | static int dib7070_tuner_reset(struct dvb_frontend *fe, int onoff) |
| 971 | { |
| 972 | struct dib7000p_ops *dib7000p_ops = fe->sec_priv; |
| 973 | |
| 974 | return dib7000p_ops->set_gpio(fe, 8, 0, !onoff); |
| 975 | } |
| 976 | |
| 977 | static int dib7070_tuner_sleep(struct dvb_frontend *fe, int onoff) |
| 978 | { |
| 979 | return 0; |
| 980 | } |
| 981 | |
| 982 | static struct dib0070_config dib7070p_dib0070_config = { |
| 983 | .i2c_address = DEFAULT_DIB0070_I2C_ADDRESS, |
| 984 | .reset = dib7070_tuner_reset, |
| 985 | .sleep = dib7070_tuner_sleep, |
| 986 | .clock_khz = 12000, |
James Harper | 46b21bb | 2014-06-12 07:12:24 -0300 | [diff] [blame] | 987 | .freq_offset_khz_vhf = 550, |
| 988 | /* .flip_chip = 1, */ |
| 989 | }; |
| 990 | |
| 991 | /* DIB7070 generic */ |
| 992 | static struct dibx000_agc_config dib7070_agc_config = { |
| 993 | .band_caps = BAND_UHF | BAND_VHF | BAND_LBAND | BAND_SBAND, |
| 994 | |
| 995 | /* |
| 996 | * P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0, P_agc_freq_pwm_div=5, |
| 997 | * P_agc_inv_pwm1=0, P_agc_inv_pwm2=0, P_agc_inh_dc_rv_est=0, |
| 998 | * P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=5, P_agc_write=0 |
| 999 | */ |
| 1000 | .setup = (0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) | |
| 1001 | (0 << 8) | (3 << 5) | (0 << 4) | (5 << 1) | (0 << 0), |
| 1002 | .inv_gain = 600, |
| 1003 | .time_stabiliz = 10, |
| 1004 | .alpha_level = 0, |
| 1005 | .thlock = 118, |
| 1006 | .wbd_inv = 0, |
| 1007 | .wbd_ref = 3530, |
| 1008 | .wbd_sel = 1, |
| 1009 | .wbd_alpha = 5, |
| 1010 | .agc1_max = 65535, |
| 1011 | .agc1_min = 0, |
| 1012 | .agc2_max = 65535, |
| 1013 | .agc2_min = 0, |
| 1014 | .agc1_pt1 = 0, |
| 1015 | .agc1_pt2 = 40, |
| 1016 | .agc1_pt3 = 183, |
| 1017 | .agc1_slope1 = 206, |
| 1018 | .agc1_slope2 = 255, |
| 1019 | .agc2_pt1 = 72, |
| 1020 | .agc2_pt2 = 152, |
| 1021 | .agc2_slope1 = 88, |
| 1022 | .agc2_slope2 = 90, |
| 1023 | .alpha_mant = 17, |
| 1024 | .alpha_exp = 27, |
| 1025 | .beta_mant = 23, |
| 1026 | .beta_exp = 51, |
| 1027 | .perform_agc_softsplit = 0, |
| 1028 | }; |
| 1029 | |
| 1030 | static struct dibx000_bandwidth_config dib7070_bw_config_12_mhz = { |
| 1031 | .internal = 60000, |
| 1032 | .sampling = 15000, |
| 1033 | .pll_prediv = 1, |
| 1034 | .pll_ratio = 20, |
| 1035 | .pll_range = 3, |
| 1036 | .pll_reset = 1, |
| 1037 | .pll_bypass = 0, |
| 1038 | .enable_refdiv = 0, |
| 1039 | .bypclk_div = 0, |
| 1040 | .IO_CLK_en_core = 1, |
| 1041 | .ADClkSrc = 1, |
| 1042 | .modulo = 2, |
| 1043 | /* refsel, sel, freq_15k */ |
| 1044 | .sad_cfg = (3 << 14) | (1 << 12) | (524 << 0), |
| 1045 | .ifreq = (0 << 25) | 0, |
| 1046 | .timf = 20452225, |
| 1047 | .xtal_hz = 12000000, |
| 1048 | }; |
| 1049 | |
| 1050 | static struct dib7000p_config dib7070p_dib7000p_config = { |
| 1051 | /* .output_mode = OUTMODE_MPEG2_FIFO, */ |
| 1052 | .output_mode = OUTMODE_MPEG2_SERIAL, |
| 1053 | /* .output_mode = OUTMODE_MPEG2_PAR_GATED_CLK, */ |
| 1054 | .output_mpeg2_in_188_bytes = 1, |
| 1055 | |
| 1056 | .agc_config_count = 1, |
| 1057 | .agc = &dib7070_agc_config, |
| 1058 | .bw = &dib7070_bw_config_12_mhz, |
| 1059 | .tuner_is_baseband = 1, |
| 1060 | .spur_protect = 1, |
| 1061 | |
| 1062 | .gpio_dir = 0xfcef, /* DIB7000P_GPIO_DEFAULT_DIRECTIONS, */ |
| 1063 | .gpio_val = 0x0110, /* DIB7000P_GPIO_DEFAULT_VALUES, */ |
| 1064 | .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS, |
| 1065 | |
| 1066 | .hostbus_diversity = 1, |
| 1067 | }; |
| 1068 | |
Mauro Carvalho Chehab | 2b0aac3 | 2014-12-23 13:48:07 -0200 | [diff] [blame] | 1069 | static int dvb_register_ci_mac(struct cx23885_tsport *port) |
| 1070 | { |
| 1071 | struct cx23885_dev *dev = port->dev; |
| 1072 | struct i2c_client *client_ci = NULL; |
| 1073 | struct vb2_dvb_frontend *fe0; |
| 1074 | |
| 1075 | fe0 = vb2_dvb_get_frontend(&port->frontends, 1); |
| 1076 | if (!fe0) |
| 1077 | return -EINVAL; |
| 1078 | |
| 1079 | switch (dev->board) { |
| 1080 | case CX23885_BOARD_NETUP_DUAL_DVBS2_CI: { |
| 1081 | static struct netup_card_info cinfo; |
| 1082 | |
| 1083 | netup_get_card_info(&dev->i2c_bus[0].i2c_adap, &cinfo); |
| 1084 | memcpy(port->frontends.adapter.proposed_mac, |
| 1085 | cinfo.port[port->nr - 1].mac, 6); |
| 1086 | printk(KERN_INFO "NetUP Dual DVB-S2 CI card port%d MAC=%pM\n", |
| 1087 | port->nr, port->frontends.adapter.proposed_mac); |
| 1088 | |
| 1089 | netup_ci_init(port); |
| 1090 | return 0; |
| 1091 | } |
| 1092 | case CX23885_BOARD_NETUP_DUAL_DVB_T_C_CI_RF: { |
| 1093 | struct altera_ci_config netup_ci_cfg = { |
| 1094 | .dev = dev,/* magic number to identify*/ |
| 1095 | .adapter = &port->frontends.adapter,/* for CI */ |
| 1096 | .demux = &fe0->dvb.demux,/* for hw pid filter */ |
| 1097 | .fpga_rw = netup_altera_fpga_rw, |
| 1098 | }; |
| 1099 | |
| 1100 | altera_ci_init(&netup_ci_cfg, port->nr); |
| 1101 | return 0; |
| 1102 | } |
| 1103 | case CX23885_BOARD_TEVII_S470: { |
| 1104 | u8 eeprom[256]; /* 24C02 i2c eeprom */ |
| 1105 | |
| 1106 | if (port->nr != 1) |
| 1107 | return 0; |
| 1108 | |
| 1109 | /* Read entire EEPROM */ |
| 1110 | dev->i2c_bus[0].i2c_client.addr = 0xa0 >> 1; |
| 1111 | tveeprom_read(&dev->i2c_bus[0].i2c_client, eeprom, sizeof(eeprom)); |
| 1112 | printk(KERN_INFO "TeVii S470 MAC= %pM\n", eeprom + 0xa0); |
| 1113 | memcpy(port->frontends.adapter.proposed_mac, eeprom + 0xa0, 6); |
| 1114 | return 0; |
| 1115 | } |
| 1116 | case CX23885_BOARD_DVBSKY_T9580: |
| 1117 | case CX23885_BOARD_DVBSKY_S950: |
| 1118 | case CX23885_BOARD_DVBSKY_S952: |
| 1119 | case CX23885_BOARD_DVBSKY_T982: { |
| 1120 | u8 eeprom[256]; /* 24C02 i2c eeprom */ |
| 1121 | |
| 1122 | if (port->nr > 2) |
| 1123 | return 0; |
| 1124 | |
| 1125 | /* Read entire EEPROM */ |
| 1126 | dev->i2c_bus[0].i2c_client.addr = 0xa0 >> 1; |
| 1127 | tveeprom_read(&dev->i2c_bus[0].i2c_client, eeprom, |
| 1128 | sizeof(eeprom)); |
| 1129 | printk(KERN_INFO "%s port %d MAC address: %pM\n", |
| 1130 | cx23885_boards[dev->board].name, port->nr, |
| 1131 | eeprom + 0xc0 + (port->nr-1) * 8); |
| 1132 | memcpy(port->frontends.adapter.proposed_mac, eeprom + 0xc0 + |
| 1133 | (port->nr-1) * 8, 6); |
| 1134 | return 0; |
| 1135 | } |
| 1136 | case CX23885_BOARD_DVBSKY_S950C: |
| 1137 | case CX23885_BOARD_DVBSKY_T980C: |
| 1138 | case CX23885_BOARD_TT_CT2_4500_CI: { |
| 1139 | u8 eeprom[256]; /* 24C02 i2c eeprom */ |
| 1140 | struct sp2_config sp2_config; |
| 1141 | struct i2c_board_info info; |
| 1142 | struct cx23885_i2c *i2c_bus2 = &dev->i2c_bus[1]; |
| 1143 | |
| 1144 | /* attach CI */ |
| 1145 | memset(&sp2_config, 0, sizeof(sp2_config)); |
| 1146 | sp2_config.dvb_adap = &port->frontends.adapter; |
| 1147 | sp2_config.priv = port; |
| 1148 | sp2_config.ci_control = cx23885_sp2_ci_ctrl; |
| 1149 | memset(&info, 0, sizeof(struct i2c_board_info)); |
| 1150 | strlcpy(info.type, "sp2", I2C_NAME_SIZE); |
| 1151 | info.addr = 0x40; |
| 1152 | info.platform_data = &sp2_config; |
| 1153 | request_module(info.type); |
| 1154 | client_ci = i2c_new_device(&i2c_bus2->i2c_adap, &info); |
| 1155 | if (client_ci == NULL || client_ci->dev.driver == NULL) |
| 1156 | return -ENODEV; |
| 1157 | if (!try_module_get(client_ci->dev.driver->owner)) { |
| 1158 | i2c_unregister_device(client_ci); |
| 1159 | return -ENODEV; |
| 1160 | } |
| 1161 | port->i2c_client_ci = client_ci; |
| 1162 | |
| 1163 | if (port->nr != 1) |
| 1164 | return 0; |
| 1165 | |
| 1166 | /* Read entire EEPROM */ |
| 1167 | dev->i2c_bus[0].i2c_client.addr = 0xa0 >> 1; |
| 1168 | tveeprom_read(&dev->i2c_bus[0].i2c_client, eeprom, |
| 1169 | sizeof(eeprom)); |
| 1170 | printk(KERN_INFO "%s MAC address: %pM\n", |
| 1171 | cx23885_boards[dev->board].name, eeprom + 0xc0); |
| 1172 | memcpy(port->frontends.adapter.proposed_mac, eeprom + 0xc0, 6); |
| 1173 | return 0; |
| 1174 | } |
| 1175 | } |
| 1176 | return 0; |
| 1177 | } |
| 1178 | |
Steven Toth | d19770e | 2007-03-11 20:44:05 -0300 | [diff] [blame] | 1179 | static int dvb_register(struct cx23885_tsport *port) |
| 1180 | { |
Mauro Carvalho Chehab | 8abe4a0 | 2014-05-29 09:20:15 -0300 | [diff] [blame] | 1181 | struct dib7000p_ops dib7000p_ops; |
Steven Toth | d19770e | 2007-03-11 20:44:05 -0300 | [diff] [blame] | 1182 | struct cx23885_dev *dev = port->dev; |
David Wong | 493b712 | 2009-05-18 05:25:49 -0300 | [diff] [blame] | 1183 | struct cx23885_i2c *i2c_bus = NULL, *i2c_bus2 = NULL; |
Hans Verkuil | 453afdd | 2014-08-14 06:43:01 -0300 | [diff] [blame] | 1184 | struct vb2_dvb_frontend *fe0, *fe1 = NULL; |
Olli Salonen | 2944226 | 2014-08-11 16:58:15 -0300 | [diff] [blame] | 1185 | struct si2168_config si2168_config; |
| 1186 | struct si2157_config si2157_config; |
Antti Palosaari | d76e087 | 2015-03-23 18:52:46 -0300 | [diff] [blame] | 1187 | struct ts2020_config ts2020_config; |
Olli Salonen | 2944226 | 2014-08-11 16:58:15 -0300 | [diff] [blame] | 1188 | struct i2c_board_info info; |
| 1189 | struct i2c_adapter *adapter; |
Mauro Carvalho Chehab | 2b0aac3 | 2014-12-23 13:48:07 -0200 | [diff] [blame] | 1190 | struct i2c_client *client_demod = NULL, *client_tuner = NULL; |
Antti Palosaari | bf5e3ef | 2015-04-16 13:59:46 -0300 | [diff] [blame] | 1191 | struct i2c_client *client_sec = NULL; |
nibble.max | c29d6a8 | 2014-11-05 11:58:38 -0300 | [diff] [blame] | 1192 | const struct m88ds3103_config *p_m88ds3103_config = NULL; |
| 1193 | int (*p_set_voltage)(struct dvb_frontend *fe, fe_sec_voltage_t voltage) = NULL; |
Igor M. Liplianin | 78db854 | 2011-01-25 17:04:00 -0300 | [diff] [blame] | 1194 | int mfe_shared = 0; /* bus not shared by default */ |
Igor M. Liplianin | 5a23b07 | 2009-03-03 12:06:09 -0300 | [diff] [blame] | 1195 | int ret; |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 1196 | |
Darron Broad | f972e0bd | 2008-10-11 11:24:30 -0300 | [diff] [blame] | 1197 | /* Get the first frontend */ |
Hans Verkuil | 453afdd | 2014-08-14 06:43:01 -0300 | [diff] [blame] | 1198 | fe0 = vb2_dvb_get_frontend(&port->frontends, 1); |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 1199 | if (!fe0) |
| 1200 | return -EINVAL; |
Steven Toth | d19770e | 2007-03-11 20:44:05 -0300 | [diff] [blame] | 1201 | |
Hans Verkuil | 453afdd | 2014-08-14 06:43:01 -0300 | [diff] [blame] | 1202 | /* init struct vb2_dvb */ |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 1203 | fe0->dvb.name = dev->name; |
Steven Toth | d19770e | 2007-03-11 20:44:05 -0300 | [diff] [blame] | 1204 | |
Igor M. Liplianin | 78db854 | 2011-01-25 17:04:00 -0300 | [diff] [blame] | 1205 | /* multi-frontend gate control is undefined or defaults to fe0 */ |
| 1206 | port->frontends.gate = 0; |
| 1207 | |
| 1208 | /* Sets the gate control callback to be used by i2c command calls */ |
| 1209 | port->gate_ctrl = cx23885_dvb_gate_ctrl; |
| 1210 | |
Steven Toth | d19770e | 2007-03-11 20:44:05 -0300 | [diff] [blame] | 1211 | /* init frontend */ |
| 1212 | switch (dev->board) { |
Steven Toth | a77743b | 2007-08-22 21:01:20 -0300 | [diff] [blame] | 1213 | case CX23885_BOARD_HAUPPAUGE_HVR1250: |
Michael Krufky | f139fa7 | 2007-09-09 03:55:34 -0300 | [diff] [blame] | 1214 | i2c_bus = &dev->i2c_bus[0]; |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 1215 | fe0->dvb.frontend = dvb_attach(s5h1409_attach, |
Steven Toth | 86184e0 | 2007-09-04 21:40:47 -0300 | [diff] [blame] | 1216 | &hauppauge_generic_config, |
Michael Krufky | f139fa7 | 2007-09-09 03:55:34 -0300 | [diff] [blame] | 1217 | &i2c_bus->i2c_adap); |
Mauro Carvalho Chehab | ed3da2b | 2014-10-30 11:15:53 -0300 | [diff] [blame] | 1218 | if (fe0->dvb.frontend == NULL) |
| 1219 | break; |
| 1220 | dvb_attach(mt2131_attach, fe0->dvb.frontend, |
| 1221 | &i2c_bus->i2c_adap, |
| 1222 | &hauppauge_generic_tunerconfig, 0); |
Steven Toth | d19770e | 2007-03-11 20:44:05 -0300 | [diff] [blame] | 1223 | break; |
Michael Krufky | a5dbf45 | 2009-05-03 23:27:02 -0300 | [diff] [blame] | 1224 | case CX23885_BOARD_HAUPPAUGE_HVR1270: |
Michael Krufky | d099bec | 2009-05-08 22:39:24 -0300 | [diff] [blame] | 1225 | case CX23885_BOARD_HAUPPAUGE_HVR1275: |
Michael Krufky | a5dbf45 | 2009-05-03 23:27:02 -0300 | [diff] [blame] | 1226 | i2c_bus = &dev->i2c_bus[0]; |
| 1227 | fe0->dvb.frontend = dvb_attach(lgdt3305_attach, |
Michael Krufky | 247bc54 | 2009-05-12 18:53:47 -0300 | [diff] [blame] | 1228 | &hauppauge_lgdt3305_config, |
Michael Krufky | a5dbf45 | 2009-05-03 23:27:02 -0300 | [diff] [blame] | 1229 | &i2c_bus->i2c_adap); |
Mauro Carvalho Chehab | ed3da2b | 2014-10-30 11:15:53 -0300 | [diff] [blame] | 1230 | if (fe0->dvb.frontend == NULL) |
| 1231 | break; |
| 1232 | dvb_attach(tda18271_attach, fe0->dvb.frontend, |
| 1233 | 0x60, &dev->i2c_bus[1].i2c_adap, |
| 1234 | &hauppauge_hvr127x_config); |
Mauro Carvalho Chehab | 15472fa | 2013-08-09 08:53:25 -0300 | [diff] [blame] | 1235 | if (dev->board == CX23885_BOARD_HAUPPAUGE_HVR1275) |
| 1236 | cx23885_set_frontend_hook(port, fe0->dvb.frontend); |
Michael Krufky | a5dbf45 | 2009-05-03 23:27:02 -0300 | [diff] [blame] | 1237 | break; |
Michael Krufky | 19bc579 | 2009-05-08 16:05:29 -0300 | [diff] [blame] | 1238 | case CX23885_BOARD_HAUPPAUGE_HVR1255: |
Devin Heitmueller | 0ac60ac | 2012-07-01 16:15:14 -0300 | [diff] [blame] | 1239 | case CX23885_BOARD_HAUPPAUGE_HVR1255_22111: |
Michael Krufky | 19bc579 | 2009-05-08 16:05:29 -0300 | [diff] [blame] | 1240 | i2c_bus = &dev->i2c_bus[0]; |
| 1241 | fe0->dvb.frontend = dvb_attach(s5h1411_attach, |
| 1242 | &hcw_s5h1411_config, |
| 1243 | &i2c_bus->i2c_adap); |
Mauro Carvalho Chehab | ed3da2b | 2014-10-30 11:15:53 -0300 | [diff] [blame] | 1244 | if (fe0->dvb.frontend == NULL) |
| 1245 | break; |
| 1246 | |
| 1247 | dvb_attach(tda18271_attach, fe0->dvb.frontend, |
| 1248 | 0x60, &dev->i2c_bus[1].i2c_adap, |
| 1249 | &hauppauge_tda18271_config); |
Devin Heitmueller | 0ac60ac | 2012-07-01 16:15:14 -0300 | [diff] [blame] | 1250 | |
| 1251 | tda18271_attach(&dev->ts1.analog_fe, |
| 1252 | 0x60, &dev->i2c_bus[1].i2c_adap, |
| 1253 | &hauppauge_tda18271_config); |
| 1254 | |
Michael Krufky | 19bc579 | 2009-05-08 16:05:29 -0300 | [diff] [blame] | 1255 | break; |
Michael Krufky | 3ba71d2 | 2007-12-07 01:40:36 -0300 | [diff] [blame] | 1256 | case CX23885_BOARD_HAUPPAUGE_HVR1800: |
| 1257 | i2c_bus = &dev->i2c_bus[0]; |
Darron Broad | 92abe9e | 2008-10-11 11:18:53 -0300 | [diff] [blame] | 1258 | switch (alt_tuner) { |
Michael Krufky | 3ba71d2 | 2007-12-07 01:40:36 -0300 | [diff] [blame] | 1259 | case 1: |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 1260 | fe0->dvb.frontend = |
Michael Krufky | 3ba71d2 | 2007-12-07 01:40:36 -0300 | [diff] [blame] | 1261 | dvb_attach(s5h1409_attach, |
| 1262 | &hauppauge_ezqam_config, |
| 1263 | &i2c_bus->i2c_adap); |
Mauro Carvalho Chehab | ed3da2b | 2014-10-30 11:15:53 -0300 | [diff] [blame] | 1264 | if (fe0->dvb.frontend == NULL) |
| 1265 | break; |
| 1266 | |
| 1267 | dvb_attach(tda829x_attach, fe0->dvb.frontend, |
| 1268 | &dev->i2c_bus[1].i2c_adap, 0x42, |
| 1269 | &tda829x_no_probe); |
| 1270 | dvb_attach(tda18271_attach, fe0->dvb.frontend, |
| 1271 | 0x60, &dev->i2c_bus[1].i2c_adap, |
| 1272 | &hauppauge_tda18271_config); |
Michael Krufky | 3ba71d2 | 2007-12-07 01:40:36 -0300 | [diff] [blame] | 1273 | break; |
| 1274 | case 0: |
| 1275 | default: |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 1276 | fe0->dvb.frontend = |
Michael Krufky | 3ba71d2 | 2007-12-07 01:40:36 -0300 | [diff] [blame] | 1277 | dvb_attach(s5h1409_attach, |
| 1278 | &hauppauge_generic_config, |
| 1279 | &i2c_bus->i2c_adap); |
Mauro Carvalho Chehab | ed3da2b | 2014-10-30 11:15:53 -0300 | [diff] [blame] | 1280 | if (fe0->dvb.frontend == NULL) |
| 1281 | break; |
| 1282 | dvb_attach(mt2131_attach, fe0->dvb.frontend, |
| 1283 | &i2c_bus->i2c_adap, |
| 1284 | &hauppauge_generic_tunerconfig, 0); |
Michael Krufky | 3ba71d2 | 2007-12-07 01:40:36 -0300 | [diff] [blame] | 1285 | } |
| 1286 | break; |
Steven Toth | fc959be | 2007-09-08 19:08:17 -0300 | [diff] [blame] | 1287 | case CX23885_BOARD_HAUPPAUGE_HVR1800lp: |
Michael Krufky | f139fa7 | 2007-09-09 03:55:34 -0300 | [diff] [blame] | 1288 | i2c_bus = &dev->i2c_bus[0]; |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 1289 | fe0->dvb.frontend = dvb_attach(s5h1409_attach, |
Steven Toth | fc959be | 2007-09-08 19:08:17 -0300 | [diff] [blame] | 1290 | &hauppauge_hvr1800lp_config, |
Michael Krufky | f139fa7 | 2007-09-09 03:55:34 -0300 | [diff] [blame] | 1291 | &i2c_bus->i2c_adap); |
Mauro Carvalho Chehab | ed3da2b | 2014-10-30 11:15:53 -0300 | [diff] [blame] | 1292 | if (fe0->dvb.frontend == NULL) |
| 1293 | break; |
| 1294 | dvb_attach(mt2131_attach, fe0->dvb.frontend, |
| 1295 | &i2c_bus->i2c_adap, |
| 1296 | &hauppauge_generic_tunerconfig, 0); |
Steven Toth | fc959be | 2007-09-08 19:08:17 -0300 | [diff] [blame] | 1297 | break; |
Michael Krufky | 9bc37ca | 2007-09-08 15:17:13 -0300 | [diff] [blame] | 1298 | case CX23885_BOARD_DVICO_FUSIONHDTV_5_EXP: |
Michael Krufky | f139fa7 | 2007-09-09 03:55:34 -0300 | [diff] [blame] | 1299 | i2c_bus = &dev->i2c_bus[0]; |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 1300 | fe0->dvb.frontend = dvb_attach(lgdt330x_attach, |
Michael Krufky | 9bc37ca | 2007-09-08 15:17:13 -0300 | [diff] [blame] | 1301 | &fusionhdtv_5_express, |
Michael Krufky | f139fa7 | 2007-09-09 03:55:34 -0300 | [diff] [blame] | 1302 | &i2c_bus->i2c_adap); |
Mauro Carvalho Chehab | ed3da2b | 2014-10-30 11:15:53 -0300 | [diff] [blame] | 1303 | if (fe0->dvb.frontend == NULL) |
| 1304 | break; |
| 1305 | dvb_attach(simple_tuner_attach, fe0->dvb.frontend, |
| 1306 | &i2c_bus->i2c_adap, 0x61, |
| 1307 | TUNER_LG_TDVS_H06XF); |
Michael Krufky | 9bc37ca | 2007-09-08 15:17:13 -0300 | [diff] [blame] | 1308 | break; |
Steven Toth | d1987d5 | 2007-12-18 01:57:06 -0300 | [diff] [blame] | 1309 | case CX23885_BOARD_HAUPPAUGE_HVR1500Q: |
| 1310 | i2c_bus = &dev->i2c_bus[1]; |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 1311 | fe0->dvb.frontend = dvb_attach(s5h1409_attach, |
Steven Toth | d1987d5 | 2007-12-18 01:57:06 -0300 | [diff] [blame] | 1312 | &hauppauge_hvr1500q_config, |
| 1313 | &dev->i2c_bus[0].i2c_adap); |
Mauro Carvalho Chehab | ed3da2b | 2014-10-30 11:15:53 -0300 | [diff] [blame] | 1314 | if (fe0->dvb.frontend == NULL) |
| 1315 | break; |
| 1316 | dvb_attach(xc5000_attach, fe0->dvb.frontend, |
| 1317 | &i2c_bus->i2c_adap, |
| 1318 | &hauppauge_hvr1500q_tunerconfig); |
Steven Toth | d1987d5 | 2007-12-18 01:57:06 -0300 | [diff] [blame] | 1319 | break; |
Michael Krufky | 07b4a83 | 2007-12-18 01:09:11 -0300 | [diff] [blame] | 1320 | case CX23885_BOARD_HAUPPAUGE_HVR1500: |
| 1321 | i2c_bus = &dev->i2c_bus[1]; |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 1322 | fe0->dvb.frontend = dvb_attach(s5h1409_attach, |
Michael Krufky | 07b4a83 | 2007-12-18 01:09:11 -0300 | [diff] [blame] | 1323 | &hauppauge_hvr1500_config, |
| 1324 | &dev->i2c_bus[0].i2c_adap); |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 1325 | if (fe0->dvb.frontend != NULL) { |
Michael Krufky | 07b4a83 | 2007-12-18 01:09:11 -0300 | [diff] [blame] | 1326 | struct dvb_frontend *fe; |
| 1327 | struct xc2028_config cfg = { |
| 1328 | .i2c_adap = &i2c_bus->i2c_adap, |
| 1329 | .i2c_addr = 0x61, |
Michael Krufky | 07b4a83 | 2007-12-18 01:09:11 -0300 | [diff] [blame] | 1330 | }; |
| 1331 | static struct xc2028_ctrl ctl = { |
Michael Krufky | ef80bfe | 2008-09-16 02:15:30 -0300 | [diff] [blame] | 1332 | .fname = XC2028_DEFAULT_FIRMWARE, |
Michael Krufky | 07b4a83 | 2007-12-18 01:09:11 -0300 | [diff] [blame] | 1333 | .max_len = 64, |
Steven Toth | 52c3d29 | 2009-04-20 22:42:00 -0300 | [diff] [blame] | 1334 | .demod = XC3028_FE_OREN538, |
Michael Krufky | 07b4a83 | 2007-12-18 01:09:11 -0300 | [diff] [blame] | 1335 | }; |
| 1336 | |
| 1337 | fe = dvb_attach(xc2028_attach, |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 1338 | fe0->dvb.frontend, &cfg); |
Michael Krufky | 07b4a83 | 2007-12-18 01:09:11 -0300 | [diff] [blame] | 1339 | if (fe != NULL && fe->ops.tuner_ops.set_config != NULL) |
| 1340 | fe->ops.tuner_ops.set_config(fe, &ctl); |
| 1341 | } |
| 1342 | break; |
Steven Toth | b3ea016 | 2008-04-19 01:14:19 -0300 | [diff] [blame] | 1343 | case CX23885_BOARD_HAUPPAUGE_HVR1200: |
Steven Toth | a780a31 | 2008-04-19 01:25:52 -0300 | [diff] [blame] | 1344 | case CX23885_BOARD_HAUPPAUGE_HVR1700: |
Steven Toth | b3ea016 | 2008-04-19 01:14:19 -0300 | [diff] [blame] | 1345 | i2c_bus = &dev->i2c_bus[0]; |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 1346 | fe0->dvb.frontend = dvb_attach(tda10048_attach, |
Steven Toth | b3ea016 | 2008-04-19 01:14:19 -0300 | [diff] [blame] | 1347 | &hauppauge_hvr1200_config, |
| 1348 | &i2c_bus->i2c_adap); |
Mauro Carvalho Chehab | ed3da2b | 2014-10-30 11:15:53 -0300 | [diff] [blame] | 1349 | if (fe0->dvb.frontend == NULL) |
| 1350 | break; |
| 1351 | dvb_attach(tda829x_attach, fe0->dvb.frontend, |
| 1352 | &dev->i2c_bus[1].i2c_adap, 0x42, |
| 1353 | &tda829x_no_probe); |
| 1354 | dvb_attach(tda18271_attach, fe0->dvb.frontend, |
| 1355 | 0x60, &dev->i2c_bus[1].i2c_adap, |
| 1356 | &hauppauge_hvr1200_tuner_config); |
Steven Toth | b3ea016 | 2008-04-19 01:14:19 -0300 | [diff] [blame] | 1357 | break; |
Michael Krufky | 6b926ec | 2009-05-12 17:32:17 -0300 | [diff] [blame] | 1358 | case CX23885_BOARD_HAUPPAUGE_HVR1210: |
| 1359 | i2c_bus = &dev->i2c_bus[0]; |
| 1360 | fe0->dvb.frontend = dvb_attach(tda10048_attach, |
| 1361 | &hauppauge_hvr1210_config, |
| 1362 | &i2c_bus->i2c_adap); |
| 1363 | if (fe0->dvb.frontend != NULL) { |
| 1364 | dvb_attach(tda18271_attach, fe0->dvb.frontend, |
| 1365 | 0x60, &dev->i2c_bus[1].i2c_adap, |
| 1366 | &hauppauge_hvr1210_tuner_config); |
| 1367 | } |
| 1368 | break; |
Steven Toth | 6676237 | 2008-04-22 15:38:26 -0300 | [diff] [blame] | 1369 | case CX23885_BOARD_HAUPPAUGE_HVR1400: |
| 1370 | i2c_bus = &dev->i2c_bus[0]; |
Mauro Carvalho Chehab | 8abe4a0 | 2014-05-29 09:20:15 -0300 | [diff] [blame] | 1371 | |
| 1372 | if (!dvb_attach(dib7000p_attach, &dib7000p_ops)) |
| 1373 | return -ENODEV; |
| 1374 | |
| 1375 | fe0->dvb.frontend = dib7000p_ops.init(&i2c_bus->i2c_adap, |
Steven Toth | 6676237 | 2008-04-22 15:38:26 -0300 | [diff] [blame] | 1376 | 0x12, &hauppauge_hvr1400_dib7000_config); |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 1377 | if (fe0->dvb.frontend != NULL) { |
Steven Toth | 6676237 | 2008-04-22 15:38:26 -0300 | [diff] [blame] | 1378 | struct dvb_frontend *fe; |
| 1379 | struct xc2028_config cfg = { |
| 1380 | .i2c_adap = &dev->i2c_bus[1].i2c_adap, |
| 1381 | .i2c_addr = 0x64, |
Steven Toth | 6676237 | 2008-04-22 15:38:26 -0300 | [diff] [blame] | 1382 | }; |
| 1383 | static struct xc2028_ctrl ctl = { |
Michael Krufky | ef80bfe | 2008-09-16 02:15:30 -0300 | [diff] [blame] | 1384 | .fname = XC3028L_DEFAULT_FIRMWARE, |
Steven Toth | 6676237 | 2008-04-22 15:38:26 -0300 | [diff] [blame] | 1385 | .max_len = 64, |
Mauro Carvalho Chehab | 9bed77e | 2011-07-28 16:38:54 -0300 | [diff] [blame] | 1386 | .demod = XC3028_FE_DIBCOM52, |
Steven Toth | 9c8ced5 | 2008-10-16 20:18:44 -0300 | [diff] [blame] | 1387 | /* This is true for all demods with |
| 1388 | v36 firmware? */ |
Mauro Carvalho Chehab | 0975fc6 | 2008-09-28 02:24:44 -0300 | [diff] [blame] | 1389 | .type = XC2028_D2633, |
Steven Toth | 6676237 | 2008-04-22 15:38:26 -0300 | [diff] [blame] | 1390 | }; |
| 1391 | |
| 1392 | fe = dvb_attach(xc2028_attach, |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 1393 | fe0->dvb.frontend, &cfg); |
Steven Toth | 6676237 | 2008-04-22 15:38:26 -0300 | [diff] [blame] | 1394 | if (fe != NULL && fe->ops.tuner_ops.set_config != NULL) |
| 1395 | fe->ops.tuner_ops.set_config(fe, &ctl); |
| 1396 | } |
| 1397 | break; |
Michael Krufky | 335377b | 2008-05-07 01:43:10 -0300 | [diff] [blame] | 1398 | case CX23885_BOARD_DVICO_FUSIONHDTV_7_DUAL_EXP: |
| 1399 | i2c_bus = &dev->i2c_bus[port->nr - 1]; |
| 1400 | |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 1401 | fe0->dvb.frontend = dvb_attach(s5h1409_attach, |
Michael Krufky | 335377b | 2008-05-07 01:43:10 -0300 | [diff] [blame] | 1402 | &dvico_s5h1409_config, |
| 1403 | &i2c_bus->i2c_adap); |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 1404 | if (fe0->dvb.frontend == NULL) |
| 1405 | fe0->dvb.frontend = dvb_attach(s5h1411_attach, |
Michael Krufky | 52b5045 | 2008-07-09 02:18:49 -0300 | [diff] [blame] | 1406 | &dvico_s5h1411_config, |
| 1407 | &i2c_bus->i2c_adap); |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 1408 | if (fe0->dvb.frontend != NULL) |
| 1409 | dvb_attach(xc5000_attach, fe0->dvb.frontend, |
Michael Krufky | 3065096 | 2008-09-06 14:56:58 -0300 | [diff] [blame] | 1410 | &i2c_bus->i2c_adap, |
| 1411 | &dvico_xc5000_tunerconfig); |
Michael Krufky | 335377b | 2008-05-07 01:43:10 -0300 | [diff] [blame] | 1412 | break; |
Steven Toth | aef2d18 | 2008-08-04 21:39:53 -0300 | [diff] [blame] | 1413 | case CX23885_BOARD_DVICO_FUSIONHDTV_DVB_T_DUAL_EXP: { |
| 1414 | i2c_bus = &dev->i2c_bus[port->nr - 1]; |
| 1415 | |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 1416 | fe0->dvb.frontend = dvb_attach(zl10353_attach, |
Steven Toth | aef2d18 | 2008-08-04 21:39:53 -0300 | [diff] [blame] | 1417 | &dvico_fusionhdtv_xc3028, |
| 1418 | &i2c_bus->i2c_adap); |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 1419 | if (fe0->dvb.frontend != NULL) { |
Steven Toth | aef2d18 | 2008-08-04 21:39:53 -0300 | [diff] [blame] | 1420 | struct dvb_frontend *fe; |
| 1421 | struct xc2028_config cfg = { |
| 1422 | .i2c_adap = &i2c_bus->i2c_adap, |
| 1423 | .i2c_addr = 0x61, |
Steven Toth | aef2d18 | 2008-08-04 21:39:53 -0300 | [diff] [blame] | 1424 | }; |
| 1425 | static struct xc2028_ctrl ctl = { |
Michael Krufky | ef80bfe | 2008-09-16 02:15:30 -0300 | [diff] [blame] | 1426 | .fname = XC2028_DEFAULT_FIRMWARE, |
Steven Toth | aef2d18 | 2008-08-04 21:39:53 -0300 | [diff] [blame] | 1427 | .max_len = 64, |
| 1428 | .demod = XC3028_FE_ZARLINK456, |
| 1429 | }; |
| 1430 | |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 1431 | fe = dvb_attach(xc2028_attach, fe0->dvb.frontend, |
Steven Toth | aef2d18 | 2008-08-04 21:39:53 -0300 | [diff] [blame] | 1432 | &cfg); |
| 1433 | if (fe != NULL && fe->ops.tuner_ops.set_config != NULL) |
| 1434 | fe->ops.tuner_ops.set_config(fe, &ctl); |
| 1435 | } |
| 1436 | break; |
| 1437 | } |
James Harper | 46b21bb | 2014-06-12 07:12:24 -0300 | [diff] [blame] | 1438 | case CX23885_BOARD_DVICO_FUSIONHDTV_DVB_T_DUAL_EXP2: { |
| 1439 | i2c_bus = &dev->i2c_bus[port->nr - 1]; |
| 1440 | /* cxusb_ctrl_msg(adap->dev, CMD_DIGITAL, NULL, 0, NULL, 0); */ |
| 1441 | /* cxusb_bluebird_gpio_pulse(adap->dev, 0x02, 1); */ |
| 1442 | |
| 1443 | if (!dvb_attach(dib7000p_attach, &dib7000p_ops)) |
| 1444 | return -ENODEV; |
| 1445 | |
| 1446 | if (dib7000p_ops.i2c_enumeration(&i2c_bus->i2c_adap, 1, 0x12, &dib7070p_dib7000p_config) < 0) { |
| 1447 | printk(KERN_WARNING "Unable to enumerate dib7000p\n"); |
| 1448 | return -ENODEV; |
| 1449 | } |
| 1450 | fe0->dvb.frontend = dib7000p_ops.init(&i2c_bus->i2c_adap, 0x80, &dib7070p_dib7000p_config); |
| 1451 | if (fe0->dvb.frontend != NULL) { |
| 1452 | struct i2c_adapter *tun_i2c; |
| 1453 | |
| 1454 | fe0->dvb.frontend->sec_priv = kmalloc(sizeof(dib7000p_ops), GFP_KERNEL); |
| 1455 | memcpy(fe0->dvb.frontend->sec_priv, &dib7000p_ops, sizeof(dib7000p_ops)); |
| 1456 | tun_i2c = dib7000p_ops.get_i2c_master(fe0->dvb.frontend, DIBX000_I2C_INTERFACE_TUNER, 1); |
| 1457 | if (!dvb_attach(dib0070_attach, fe0->dvb.frontend, tun_i2c, &dib7070p_dib0070_config)) |
| 1458 | return -ENODEV; |
| 1459 | } |
| 1460 | break; |
| 1461 | } |
Steven Toth | 4c56b04 | 2008-08-12 13:30:03 -0300 | [diff] [blame] | 1462 | case CX23885_BOARD_LEADTEK_WINFAST_PXDVR3200_H: |
Igor M. Liplianin | 9bb1b7e | 2008-11-23 14:11:16 -0300 | [diff] [blame] | 1463 | case CX23885_BOARD_COMPRO_VIDEOMATE_E650F: |
Vladimir Geroy | 34e383d | 2009-09-18 18:55:47 -0300 | [diff] [blame] | 1464 | case CX23885_BOARD_COMPRO_VIDEOMATE_E800: |
Steven Toth | 4c56b04 | 2008-08-12 13:30:03 -0300 | [diff] [blame] | 1465 | i2c_bus = &dev->i2c_bus[0]; |
| 1466 | |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 1467 | fe0->dvb.frontend = dvb_attach(zl10353_attach, |
Steven Toth | 4c56b04 | 2008-08-12 13:30:03 -0300 | [diff] [blame] | 1468 | &dvico_fusionhdtv_xc3028, |
| 1469 | &i2c_bus->i2c_adap); |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 1470 | if (fe0->dvb.frontend != NULL) { |
Steven Toth | 4c56b04 | 2008-08-12 13:30:03 -0300 | [diff] [blame] | 1471 | struct dvb_frontend *fe; |
| 1472 | struct xc2028_config cfg = { |
| 1473 | .i2c_adap = &dev->i2c_bus[1].i2c_adap, |
| 1474 | .i2c_addr = 0x61, |
Steven Toth | 4c56b04 | 2008-08-12 13:30:03 -0300 | [diff] [blame] | 1475 | }; |
| 1476 | static struct xc2028_ctrl ctl = { |
Michael Krufky | ef80bfe | 2008-09-16 02:15:30 -0300 | [diff] [blame] | 1477 | .fname = XC2028_DEFAULT_FIRMWARE, |
Steven Toth | 4c56b04 | 2008-08-12 13:30:03 -0300 | [diff] [blame] | 1478 | .max_len = 64, |
| 1479 | .demod = XC3028_FE_ZARLINK456, |
| 1480 | }; |
| 1481 | |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 1482 | fe = dvb_attach(xc2028_attach, fe0->dvb.frontend, |
Steven Toth | 4c56b04 | 2008-08-12 13:30:03 -0300 | [diff] [blame] | 1483 | &cfg); |
| 1484 | if (fe != NULL && fe->ops.tuner_ops.set_config != NULL) |
| 1485 | fe->ops.tuner_ops.set_config(fe, &ctl); |
| 1486 | } |
| 1487 | break; |
istvan_v@mailbox.hu | 0cf8af5 | 2011-07-11 10:58:35 -0300 | [diff] [blame] | 1488 | case CX23885_BOARD_LEADTEK_WINFAST_PXDVR3200_H_XC4000: |
| 1489 | i2c_bus = &dev->i2c_bus[0]; |
| 1490 | |
| 1491 | fe0->dvb.frontend = dvb_attach(zl10353_attach, |
| 1492 | &dvico_fusionhdtv_xc3028, |
| 1493 | &i2c_bus->i2c_adap); |
| 1494 | if (fe0->dvb.frontend != NULL) { |
| 1495 | struct dvb_frontend *fe; |
| 1496 | struct xc4000_config cfg = { |
| 1497 | .i2c_address = 0x61, |
| 1498 | .default_pm = 0, |
| 1499 | .dvb_amplitude = 134, |
| 1500 | .set_smoothedcvbs = 1, |
| 1501 | .if_khz = 4560 |
| 1502 | }; |
| 1503 | |
| 1504 | fe = dvb_attach(xc4000_attach, fe0->dvb.frontend, |
| 1505 | &dev->i2c_bus[1].i2c_adap, &cfg); |
Miroslav Slugen | a7c8aad | 2011-12-11 18:57:58 -0300 | [diff] [blame] | 1506 | if (!fe) { |
| 1507 | printk(KERN_ERR "%s/2: xc4000 attach failed\n", |
| 1508 | dev->name); |
| 1509 | goto frontend_detach; |
| 1510 | } |
istvan_v@mailbox.hu | 0cf8af5 | 2011-07-11 10:58:35 -0300 | [diff] [blame] | 1511 | } |
| 1512 | break; |
Igor M. Liplianin | 96318d0 | 2009-01-17 12:11:20 -0300 | [diff] [blame] | 1513 | case CX23885_BOARD_TBS_6920: |
Igor M. Liplianin | 09ea33e | 2009-11-24 20:16:04 -0300 | [diff] [blame] | 1514 | i2c_bus = &dev->i2c_bus[1]; |
Igor M. Liplianin | 96318d0 | 2009-01-17 12:11:20 -0300 | [diff] [blame] | 1515 | |
| 1516 | fe0->dvb.frontend = dvb_attach(cx24116_attach, |
Igor M. Liplianin | 09ea33e | 2009-11-24 20:16:04 -0300 | [diff] [blame] | 1517 | &tbs_cx24116_config, |
| 1518 | &i2c_bus->i2c_adap); |
Igor M. Liplianin | 96318d0 | 2009-01-17 12:11:20 -0300 | [diff] [blame] | 1519 | if (fe0->dvb.frontend != NULL) |
Igor M. Liplianin | 09ea33e | 2009-11-24 20:16:04 -0300 | [diff] [blame] | 1520 | fe0->dvb.frontend->ops.set_voltage = f300_set_voltage; |
Igor M. Liplianin | 96318d0 | 2009-01-17 12:11:20 -0300 | [diff] [blame] | 1521 | |
| 1522 | break; |
Luis Alves | e600148 | 2013-10-01 22:11:35 -0300 | [diff] [blame] | 1523 | case CX23885_BOARD_TBS_6980: |
| 1524 | case CX23885_BOARD_TBS_6981: |
| 1525 | i2c_bus = &dev->i2c_bus[1]; |
| 1526 | |
| 1527 | switch (port->nr) { |
| 1528 | /* PORT B */ |
| 1529 | case 1: |
| 1530 | fe0->dvb.frontend = dvb_attach(cx24117_attach, |
| 1531 | &tbs_cx24117_config, |
Luis Alves | d10e828 | 2013-10-03 08:33:47 -0300 | [diff] [blame] | 1532 | &i2c_bus->i2c_adap); |
Luis Alves | e600148 | 2013-10-01 22:11:35 -0300 | [diff] [blame] | 1533 | break; |
| 1534 | /* PORT C */ |
| 1535 | case 2: |
Luis Alves | e600148 | 2013-10-01 22:11:35 -0300 | [diff] [blame] | 1536 | fe0->dvb.frontend = dvb_attach(cx24117_attach, |
| 1537 | &tbs_cx24117_config, |
Luis Alves | d10e828 | 2013-10-03 08:33:47 -0300 | [diff] [blame] | 1538 | &i2c_bus->i2c_adap); |
Luis Alves | e600148 | 2013-10-01 22:11:35 -0300 | [diff] [blame] | 1539 | break; |
| 1540 | } |
| 1541 | break; |
Igor M. Liplianin | 579943f | 2009-01-17 12:18:26 -0300 | [diff] [blame] | 1542 | case CX23885_BOARD_TEVII_S470: |
| 1543 | i2c_bus = &dev->i2c_bus[1]; |
| 1544 | |
Igor M. Liplianin | 09ea33e | 2009-11-24 20:16:04 -0300 | [diff] [blame] | 1545 | fe0->dvb.frontend = dvb_attach(ds3000_attach, |
| 1546 | &tevii_ds3000_config, |
| 1547 | &i2c_bus->i2c_adap); |
Konstantin Dimitrov | 73f0af4 | 2012-12-23 19:25:38 -0300 | [diff] [blame] | 1548 | if (fe0->dvb.frontend != NULL) { |
| 1549 | dvb_attach(ts2020_attach, fe0->dvb.frontend, |
| 1550 | &tevii_ts2020_config, &i2c_bus->i2c_adap); |
Igor M. Liplianin | 09ea33e | 2009-11-24 20:16:04 -0300 | [diff] [blame] | 1551 | fe0->dvb.frontend->ops.set_voltage = f300_set_voltage; |
Konstantin Dimitrov | 73f0af4 | 2012-12-23 19:25:38 -0300 | [diff] [blame] | 1552 | } |
Igor M. Liplianin | 579943f | 2009-01-17 12:18:26 -0300 | [diff] [blame] | 1553 | |
| 1554 | break; |
Igor M. Liplianin | c9b8b04 | 2009-01-17 12:23:31 -0300 | [diff] [blame] | 1555 | case CX23885_BOARD_DVBWORLD_2005: |
| 1556 | i2c_bus = &dev->i2c_bus[1]; |
| 1557 | |
| 1558 | fe0->dvb.frontend = dvb_attach(cx24116_attach, |
| 1559 | &dvbworld_cx24116_config, |
| 1560 | &i2c_bus->i2c_adap); |
| 1561 | break; |
Igor M. Liplianin | 5a23b07 | 2009-03-03 12:06:09 -0300 | [diff] [blame] | 1562 | case CX23885_BOARD_NETUP_DUAL_DVBS2_CI: |
| 1563 | i2c_bus = &dev->i2c_bus[0]; |
| 1564 | switch (port->nr) { |
| 1565 | /* port B */ |
| 1566 | case 1: |
| 1567 | fe0->dvb.frontend = dvb_attach(stv0900_attach, |
| 1568 | &netup_stv0900_config, |
| 1569 | &i2c_bus->i2c_adap, 0); |
| 1570 | if (fe0->dvb.frontend != NULL) { |
| 1571 | if (dvb_attach(stv6110_attach, |
| 1572 | fe0->dvb.frontend, |
| 1573 | &netup_stv6110_tunerconfig_a, |
| 1574 | &i2c_bus->i2c_adap)) { |
| 1575 | if (!dvb_attach(lnbh24_attach, |
| 1576 | fe0->dvb.frontend, |
| 1577 | &i2c_bus->i2c_adap, |
Abylay Ospan | 9329fb5 | 2009-10-17 08:38:45 -0300 | [diff] [blame] | 1578 | LNBH24_PCL | LNBH24_TTX, |
| 1579 | LNBH24_TEN, 0x09)) |
Igor M. Liplianin | 5a23b07 | 2009-03-03 12:06:09 -0300 | [diff] [blame] | 1580 | printk(KERN_ERR |
| 1581 | "No LNBH24 found!\n"); |
| 1582 | |
| 1583 | } |
| 1584 | } |
| 1585 | break; |
| 1586 | /* port C */ |
| 1587 | case 2: |
| 1588 | fe0->dvb.frontend = dvb_attach(stv0900_attach, |
| 1589 | &netup_stv0900_config, |
| 1590 | &i2c_bus->i2c_adap, 1); |
| 1591 | if (fe0->dvb.frontend != NULL) { |
| 1592 | if (dvb_attach(stv6110_attach, |
| 1593 | fe0->dvb.frontend, |
| 1594 | &netup_stv6110_tunerconfig_b, |
| 1595 | &i2c_bus->i2c_adap)) { |
| 1596 | if (!dvb_attach(lnbh24_attach, |
| 1597 | fe0->dvb.frontend, |
| 1598 | &i2c_bus->i2c_adap, |
Abylay Ospan | 9329fb5 | 2009-10-17 08:38:45 -0300 | [diff] [blame] | 1599 | LNBH24_PCL | LNBH24_TTX, |
| 1600 | LNBH24_TEN, 0x0a)) |
Igor M. Liplianin | 5a23b07 | 2009-03-03 12:06:09 -0300 | [diff] [blame] | 1601 | printk(KERN_ERR |
| 1602 | "No LNBH24 found!\n"); |
| 1603 | |
| 1604 | } |
| 1605 | } |
| 1606 | break; |
| 1607 | } |
| 1608 | break; |
David Wong | 493b712 | 2009-05-18 05:25:49 -0300 | [diff] [blame] | 1609 | case CX23885_BOARD_MYGICA_X8506: |
| 1610 | i2c_bus = &dev->i2c_bus[0]; |
| 1611 | i2c_bus2 = &dev->i2c_bus[1]; |
| 1612 | fe0->dvb.frontend = dvb_attach(lgs8gxx_attach, |
| 1613 | &mygica_x8506_lgs8gl5_config, |
| 1614 | &i2c_bus->i2c_adap); |
Mauro Carvalho Chehab | ed3da2b | 2014-10-30 11:15:53 -0300 | [diff] [blame] | 1615 | if (fe0->dvb.frontend == NULL) |
| 1616 | break; |
| 1617 | dvb_attach(xc5000_attach, fe0->dvb.frontend, |
| 1618 | &i2c_bus2->i2c_adap, &mygica_x8506_xc5000_config); |
Mauro Carvalho Chehab | 15472fa | 2013-08-09 08:53:25 -0300 | [diff] [blame] | 1619 | cx23885_set_frontend_hook(port, fe0->dvb.frontend); |
David Wong | 493b712 | 2009-05-18 05:25:49 -0300 | [diff] [blame] | 1620 | break; |
Mauro Carvalho Chehab | 0d1b526 | 2013-08-09 08:53:27 -0300 | [diff] [blame] | 1621 | case CX23885_BOARD_MYGICA_X8507: |
| 1622 | i2c_bus = &dev->i2c_bus[0]; |
| 1623 | i2c_bus2 = &dev->i2c_bus[1]; |
| 1624 | fe0->dvb.frontend = dvb_attach(mb86a20s_attach, |
| 1625 | &mygica_x8507_mb86a20s_config, |
| 1626 | &i2c_bus->i2c_adap); |
Mauro Carvalho Chehab | ed3da2b | 2014-10-30 11:15:53 -0300 | [diff] [blame] | 1627 | if (fe0->dvb.frontend == NULL) |
| 1628 | break; |
| 1629 | |
| 1630 | dvb_attach(xc5000_attach, fe0->dvb.frontend, |
| 1631 | &i2c_bus2->i2c_adap, |
| 1632 | &mygica_x8507_xc5000_config); |
Mauro Carvalho Chehab | 0d1b526 | 2013-08-09 08:53:27 -0300 | [diff] [blame] | 1633 | cx23885_set_frontend_hook(port, fe0->dvb.frontend); |
| 1634 | break; |
David Wong | 2365b2d | 2009-06-17 01:38:12 -0300 | [diff] [blame] | 1635 | case CX23885_BOARD_MAGICPRO_PROHDTVE2: |
| 1636 | i2c_bus = &dev->i2c_bus[0]; |
| 1637 | i2c_bus2 = &dev->i2c_bus[1]; |
| 1638 | fe0->dvb.frontend = dvb_attach(lgs8gxx_attach, |
| 1639 | &magicpro_prohdtve2_lgs8g75_config, |
| 1640 | &i2c_bus->i2c_adap); |
Mauro Carvalho Chehab | ed3da2b | 2014-10-30 11:15:53 -0300 | [diff] [blame] | 1641 | if (fe0->dvb.frontend == NULL) |
| 1642 | break; |
| 1643 | dvb_attach(xc5000_attach, fe0->dvb.frontend, |
| 1644 | &i2c_bus2->i2c_adap, |
| 1645 | &magicpro_prohdtve2_xc5000_config); |
Mauro Carvalho Chehab | 15472fa | 2013-08-09 08:53:25 -0300 | [diff] [blame] | 1646 | cx23885_set_frontend_hook(port, fe0->dvb.frontend); |
David Wong | 2365b2d | 2009-06-17 01:38:12 -0300 | [diff] [blame] | 1647 | break; |
Steven Toth | 13697380 | 2009-07-20 15:37:25 -0300 | [diff] [blame] | 1648 | case CX23885_BOARD_HAUPPAUGE_HVR1850: |
Steven Toth | 3504513 | 2012-01-04 21:08:35 -0300 | [diff] [blame] | 1649 | i2c_bus = &dev->i2c_bus[0]; |
| 1650 | fe0->dvb.frontend = dvb_attach(s5h1411_attach, |
| 1651 | &hcw_s5h1411_config, |
| 1652 | &i2c_bus->i2c_adap); |
Mauro Carvalho Chehab | ed3da2b | 2014-10-30 11:15:53 -0300 | [diff] [blame] | 1653 | if (fe0->dvb.frontend == NULL) |
| 1654 | break; |
| 1655 | dvb_attach(tda18271_attach, fe0->dvb.frontend, |
| 1656 | 0x60, &dev->i2c_bus[0].i2c_adap, |
| 1657 | &hauppauge_tda18271_config); |
Steven Toth | 3504513 | 2012-01-04 21:08:35 -0300 | [diff] [blame] | 1658 | |
| 1659 | tda18271_attach(&dev->ts1.analog_fe, |
| 1660 | 0x60, &dev->i2c_bus[1].i2c_adap, |
| 1661 | &hauppauge_tda18271_config); |
| 1662 | |
| 1663 | break; |
Michael Krufky | aee0b24 | 2009-11-11 01:52:45 -0300 | [diff] [blame] | 1664 | case CX23885_BOARD_HAUPPAUGE_HVR1290: |
Steven Toth | 13697380 | 2009-07-20 15:37:25 -0300 | [diff] [blame] | 1665 | i2c_bus = &dev->i2c_bus[0]; |
| 1666 | fe0->dvb.frontend = dvb_attach(s5h1411_attach, |
| 1667 | &hcw_s5h1411_config, |
| 1668 | &i2c_bus->i2c_adap); |
Mauro Carvalho Chehab | ed3da2b | 2014-10-30 11:15:53 -0300 | [diff] [blame] | 1669 | if (fe0->dvb.frontend == NULL) |
| 1670 | break; |
| 1671 | dvb_attach(tda18271_attach, fe0->dvb.frontend, |
| 1672 | 0x60, &dev->i2c_bus[0].i2c_adap, |
| 1673 | &hauppauge_tda18271_config); |
Steven Toth | 13697380 | 2009-07-20 15:37:25 -0300 | [diff] [blame] | 1674 | break; |
David T. L. Wong | ea5697f | 2009-10-26 08:54:04 -0300 | [diff] [blame] | 1675 | case CX23885_BOARD_MYGICA_X8558PRO: |
| 1676 | switch (port->nr) { |
| 1677 | /* port B */ |
| 1678 | case 1: |
| 1679 | i2c_bus = &dev->i2c_bus[0]; |
| 1680 | fe0->dvb.frontend = dvb_attach(atbm8830_attach, |
| 1681 | &mygica_x8558pro_atbm8830_cfg1, |
| 1682 | &i2c_bus->i2c_adap); |
Mauro Carvalho Chehab | ed3da2b | 2014-10-30 11:15:53 -0300 | [diff] [blame] | 1683 | if (fe0->dvb.frontend == NULL) |
| 1684 | break; |
| 1685 | dvb_attach(max2165_attach, fe0->dvb.frontend, |
| 1686 | &i2c_bus->i2c_adap, |
| 1687 | &mygic_x8558pro_max2165_cfg1); |
David T. L. Wong | ea5697f | 2009-10-26 08:54:04 -0300 | [diff] [blame] | 1688 | break; |
| 1689 | /* port C */ |
| 1690 | case 2: |
| 1691 | i2c_bus = &dev->i2c_bus[1]; |
| 1692 | fe0->dvb.frontend = dvb_attach(atbm8830_attach, |
| 1693 | &mygica_x8558pro_atbm8830_cfg2, |
| 1694 | &i2c_bus->i2c_adap); |
Mauro Carvalho Chehab | ed3da2b | 2014-10-30 11:15:53 -0300 | [diff] [blame] | 1695 | if (fe0->dvb.frontend == NULL) |
| 1696 | break; |
| 1697 | dvb_attach(max2165_attach, fe0->dvb.frontend, |
| 1698 | &i2c_bus->i2c_adap, |
| 1699 | &mygic_x8558pro_max2165_cfg2); |
David T. L. Wong | ea5697f | 2009-10-26 08:54:04 -0300 | [diff] [blame] | 1700 | } |
| 1701 | break; |
Igor M. Liplianin | 78db854 | 2011-01-25 17:04:00 -0300 | [diff] [blame] | 1702 | case CX23885_BOARD_NETUP_DUAL_DVB_T_C_CI_RF: |
| 1703 | i2c_bus = &dev->i2c_bus[0]; |
| 1704 | mfe_shared = 1;/* MFE */ |
| 1705 | port->frontends.gate = 0;/* not clear for me yet */ |
| 1706 | /* ports B, C */ |
| 1707 | /* MFE frontend 1 DVB-T */ |
| 1708 | fe0->dvb.frontend = dvb_attach(stv0367ter_attach, |
| 1709 | &netup_stv0367_config[port->nr - 1], |
| 1710 | &i2c_bus->i2c_adap); |
Mauro Carvalho Chehab | ed3da2b | 2014-10-30 11:15:53 -0300 | [diff] [blame] | 1711 | if (fe0->dvb.frontend == NULL) |
| 1712 | break; |
| 1713 | if (NULL == dvb_attach(xc5000_attach, fe0->dvb.frontend, |
Igor M. Liplianin | 78db854 | 2011-01-25 17:04:00 -0300 | [diff] [blame] | 1714 | &i2c_bus->i2c_adap, |
| 1715 | &netup_xc5000_config[port->nr - 1])) |
Mauro Carvalho Chehab | ed3da2b | 2014-10-30 11:15:53 -0300 | [diff] [blame] | 1716 | goto frontend_detach; |
| 1717 | /* load xc5000 firmware */ |
| 1718 | fe0->dvb.frontend->ops.tuner_ops.init(fe0->dvb.frontend); |
| 1719 | |
Igor M. Liplianin | 78db854 | 2011-01-25 17:04:00 -0300 | [diff] [blame] | 1720 | /* MFE frontend 2 */ |
Hans Verkuil | 453afdd | 2014-08-14 06:43:01 -0300 | [diff] [blame] | 1721 | fe1 = vb2_dvb_get_frontend(&port->frontends, 2); |
Igor M. Liplianin | 78db854 | 2011-01-25 17:04:00 -0300 | [diff] [blame] | 1722 | if (fe1 == NULL) |
| 1723 | goto frontend_detach; |
| 1724 | /* DVB-C init */ |
| 1725 | fe1->dvb.frontend = dvb_attach(stv0367cab_attach, |
| 1726 | &netup_stv0367_config[port->nr - 1], |
| 1727 | &i2c_bus->i2c_adap); |
Mauro Carvalho Chehab | ed3da2b | 2014-10-30 11:15:53 -0300 | [diff] [blame] | 1728 | if (fe1->dvb.frontend == NULL) |
| 1729 | break; |
| 1730 | |
| 1731 | fe1->dvb.frontend->id = 1; |
| 1732 | if (NULL == dvb_attach(xc5000_attach, |
| 1733 | fe1->dvb.frontend, |
| 1734 | &i2c_bus->i2c_adap, |
| 1735 | &netup_xc5000_config[port->nr - 1])) |
| 1736 | goto frontend_detach; |
Igor M. Liplianin | 78db854 | 2011-01-25 17:04:00 -0300 | [diff] [blame] | 1737 | break; |
Stefan Ringel | 722c90e | 2012-01-07 09:20:48 -0300 | [diff] [blame] | 1738 | case CX23885_BOARD_TERRATEC_CINERGY_T_PCIE_DUAL: |
| 1739 | i2c_bus = &dev->i2c_bus[0]; |
| 1740 | i2c_bus2 = &dev->i2c_bus[1]; |
| 1741 | |
| 1742 | switch (port->nr) { |
| 1743 | /* port b */ |
| 1744 | case 1: |
| 1745 | fe0->dvb.frontend = dvb_attach(drxk_attach, |
| 1746 | &terratec_drxk_config[0], |
| 1747 | &i2c_bus->i2c_adap); |
Mauro Carvalho Chehab | ed3da2b | 2014-10-30 11:15:53 -0300 | [diff] [blame] | 1748 | if (fe0->dvb.frontend == NULL) |
| 1749 | break; |
| 1750 | if (!dvb_attach(mt2063_attach, |
| 1751 | fe0->dvb.frontend, |
| 1752 | &terratec_mt2063_config[0], |
| 1753 | &i2c_bus2->i2c_adap)) |
| 1754 | goto frontend_detach; |
Stefan Ringel | 722c90e | 2012-01-07 09:20:48 -0300 | [diff] [blame] | 1755 | break; |
| 1756 | /* port c */ |
| 1757 | case 2: |
| 1758 | fe0->dvb.frontend = dvb_attach(drxk_attach, |
| 1759 | &terratec_drxk_config[1], |
| 1760 | &i2c_bus->i2c_adap); |
Mauro Carvalho Chehab | ed3da2b | 2014-10-30 11:15:53 -0300 | [diff] [blame] | 1761 | if (fe0->dvb.frontend == NULL) |
| 1762 | break; |
| 1763 | if (!dvb_attach(mt2063_attach, |
| 1764 | fe0->dvb.frontend, |
| 1765 | &terratec_mt2063_config[1], |
| 1766 | &i2c_bus2->i2c_adap)) |
| 1767 | goto frontend_detach; |
Stefan Ringel | 722c90e | 2012-01-07 09:20:48 -0300 | [diff] [blame] | 1768 | break; |
| 1769 | } |
| 1770 | break; |
Igor M. Liplianin | 7b134e8 | 2012-05-11 11:45:42 -0300 | [diff] [blame] | 1771 | case CX23885_BOARD_TEVII_S471: |
| 1772 | i2c_bus = &dev->i2c_bus[1]; |
| 1773 | |
| 1774 | fe0->dvb.frontend = dvb_attach(ds3000_attach, |
| 1775 | &tevii_ds3000_config, |
| 1776 | &i2c_bus->i2c_adap); |
Mauro Carvalho Chehab | ed3da2b | 2014-10-30 11:15:53 -0300 | [diff] [blame] | 1777 | if (fe0->dvb.frontend == NULL) |
| 1778 | break; |
| 1779 | dvb_attach(ts2020_attach, fe0->dvb.frontend, |
| 1780 | &tevii_ts2020_config, &i2c_bus->i2c_adap); |
Igor M. Liplianin | 7b134e8 | 2012-05-11 11:45:42 -0300 | [diff] [blame] | 1781 | break; |
Mariusz Bia?o?czyk | f667190 | 2012-09-12 07:59:18 -0300 | [diff] [blame] | 1782 | case CX23885_BOARD_PROF_8000: |
| 1783 | i2c_bus = &dev->i2c_bus[0]; |
| 1784 | |
| 1785 | fe0->dvb.frontend = dvb_attach(stv090x_attach, |
| 1786 | &prof_8000_stv090x_config, |
| 1787 | &i2c_bus->i2c_adap, |
| 1788 | STV090x_DEMODULATOR_0); |
Mauro Carvalho Chehab | ed3da2b | 2014-10-30 11:15:53 -0300 | [diff] [blame] | 1789 | if (fe0->dvb.frontend == NULL) |
| 1790 | break; |
| 1791 | if (!dvb_attach(stb6100_attach, |
| 1792 | fe0->dvb.frontend, |
| 1793 | &prof_8000_stb6100_config, |
| 1794 | &i2c_bus->i2c_adap)) |
| 1795 | goto frontend_detach; |
Mariusz Bia?o?czyk | f667190 | 2012-09-12 07:59:18 -0300 | [diff] [blame] | 1796 | |
Mauro Carvalho Chehab | ed3da2b | 2014-10-30 11:15:53 -0300 | [diff] [blame] | 1797 | fe0->dvb.frontend->ops.set_voltage = p8000_set_voltage; |
Mariusz Bia?o?czyk | f667190 | 2012-09-12 07:59:18 -0300 | [diff] [blame] | 1798 | break; |
Antti Palosaari | a4569507 | 2015-04-20 15:01:51 -0300 | [diff] [blame^] | 1799 | case CX23885_BOARD_HAUPPAUGE_HVR4400: { |
| 1800 | struct tda10071_platform_data tda10071_pdata = hauppauge_tda10071_pdata; |
| 1801 | struct a8293_platform_data a8293_pdata = {}; |
| 1802 | |
Michael Krufky | 7c62f5a | 2012-12-15 23:34:09 -0300 | [diff] [blame] | 1803 | i2c_bus = &dev->i2c_bus[0]; |
Matthias Schwarzott | 36efec4 | 2014-07-22 17:12:13 -0300 | [diff] [blame] | 1804 | i2c_bus2 = &dev->i2c_bus[1]; |
| 1805 | switch (port->nr) { |
| 1806 | /* port b */ |
| 1807 | case 1: |
Antti Palosaari | a4569507 | 2015-04-20 15:01:51 -0300 | [diff] [blame^] | 1808 | /* attach demod + tuner combo */ |
| 1809 | memset(&info, 0, sizeof(info)); |
| 1810 | strlcpy(info.type, "tda10071_cx24118", I2C_NAME_SIZE); |
| 1811 | info.addr = 0x05; |
| 1812 | info.platform_data = &tda10071_pdata; |
| 1813 | request_module("tda10071"); |
| 1814 | client_demod = i2c_new_device(&i2c_bus->i2c_adap, &info); |
| 1815 | if (!client_demod || !client_demod->dev.driver) |
Mauro Carvalho Chehab | ed3da2b | 2014-10-30 11:15:53 -0300 | [diff] [blame] | 1816 | goto frontend_detach; |
Antti Palosaari | a4569507 | 2015-04-20 15:01:51 -0300 | [diff] [blame^] | 1817 | if (!try_module_get(client_demod->dev.driver->owner)) { |
| 1818 | i2c_unregister_device(client_demod); |
| 1819 | goto frontend_detach; |
| 1820 | } |
| 1821 | fe0->dvb.frontend = tda10071_pdata.get_dvb_frontend(client_demod); |
| 1822 | port->i2c_client_demod = client_demod; |
| 1823 | |
| 1824 | /* attach SEC */ |
| 1825 | a8293_pdata.dvb_frontend = fe0->dvb.frontend; |
| 1826 | memset(&info, 0, sizeof(info)); |
| 1827 | strlcpy(info.type, "a8293", I2C_NAME_SIZE); |
| 1828 | info.addr = 0x0b; |
| 1829 | info.platform_data = &a8293_pdata; |
| 1830 | request_module("a8293"); |
| 1831 | client_sec = i2c_new_device(&i2c_bus->i2c_adap, &info); |
| 1832 | if (!client_sec || !client_sec->dev.driver) |
| 1833 | goto frontend_detach; |
| 1834 | if (!try_module_get(client_sec->dev.driver->owner)) { |
| 1835 | i2c_unregister_device(client_sec); |
| 1836 | goto frontend_detach; |
| 1837 | } |
| 1838 | port->i2c_client_sec = client_sec; |
Matthias Schwarzott | 36efec4 | 2014-07-22 17:12:13 -0300 | [diff] [blame] | 1839 | break; |
| 1840 | /* port c */ |
| 1841 | case 2: |
| 1842 | fe0->dvb.frontend = dvb_attach(si2165_attach, |
| 1843 | &hauppauge_hvr4400_si2165_config, |
| 1844 | &i2c_bus->i2c_adap); |
Mauro Carvalho Chehab | ed3da2b | 2014-10-30 11:15:53 -0300 | [diff] [blame] | 1845 | if (fe0->dvb.frontend == NULL) |
| 1846 | break; |
| 1847 | fe0->dvb.frontend->ops.i2c_gate_ctrl = NULL; |
| 1848 | if (!dvb_attach(tda18271_attach, |
| 1849 | fe0->dvb.frontend, |
| 1850 | 0x60, &i2c_bus2->i2c_adap, |
| 1851 | &hauppauge_hvr4400_tuner_config)) |
| 1852 | goto frontend_detach; |
Matthias Schwarzott | 36efec4 | 2014-07-22 17:12:13 -0300 | [diff] [blame] | 1853 | break; |
Michael Krufky | 7c62f5a | 2012-12-15 23:34:09 -0300 | [diff] [blame] | 1854 | } |
| 1855 | break; |
Antti Palosaari | a4569507 | 2015-04-20 15:01:51 -0300 | [diff] [blame^] | 1856 | } |
Antti Palosaari | 49bf0e6 | 2015-04-20 14:48:33 -0300 | [diff] [blame] | 1857 | case CX23885_BOARD_HAUPPAUGE_STARBURST: { |
| 1858 | struct tda10071_platform_data tda10071_pdata = hauppauge_tda10071_pdata; |
| 1859 | struct a8293_platform_data a8293_pdata = {}; |
| 1860 | |
Matthias Schwarzott | 721f322 | 2014-12-22 19:51:39 -0300 | [diff] [blame] | 1861 | i2c_bus = &dev->i2c_bus[0]; |
Antti Palosaari | 49bf0e6 | 2015-04-20 14:48:33 -0300 | [diff] [blame] | 1862 | |
| 1863 | /* attach demod + tuner combo */ |
| 1864 | memset(&info, 0, sizeof(info)); |
| 1865 | strlcpy(info.type, "tda10071_cx24118", I2C_NAME_SIZE); |
| 1866 | info.addr = 0x05; |
| 1867 | info.platform_data = &tda10071_pdata; |
| 1868 | request_module("tda10071"); |
| 1869 | client_demod = i2c_new_device(&i2c_bus->i2c_adap, &info); |
| 1870 | if (!client_demod || !client_demod->dev.driver) |
| 1871 | goto frontend_detach; |
| 1872 | if (!try_module_get(client_demod->dev.driver->owner)) { |
| 1873 | i2c_unregister_device(client_demod); |
| 1874 | goto frontend_detach; |
Matthias Schwarzott | 721f322 | 2014-12-22 19:51:39 -0300 | [diff] [blame] | 1875 | } |
Antti Palosaari | 49bf0e6 | 2015-04-20 14:48:33 -0300 | [diff] [blame] | 1876 | fe0->dvb.frontend = tda10071_pdata.get_dvb_frontend(client_demod); |
| 1877 | port->i2c_client_demod = client_demod; |
| 1878 | |
| 1879 | /* attach SEC */ |
| 1880 | a8293_pdata.dvb_frontend = fe0->dvb.frontend; |
| 1881 | memset(&info, 0, sizeof(info)); |
| 1882 | strlcpy(info.type, "a8293", I2C_NAME_SIZE); |
| 1883 | info.addr = 0x0b; |
| 1884 | info.platform_data = &a8293_pdata; |
| 1885 | request_module("a8293"); |
| 1886 | client_sec = i2c_new_device(&i2c_bus->i2c_adap, &info); |
| 1887 | if (!client_sec || !client_sec->dev.driver) |
| 1888 | goto frontend_detach; |
| 1889 | if (!try_module_get(client_sec->dev.driver->owner)) { |
| 1890 | i2c_unregister_device(client_sec); |
| 1891 | goto frontend_detach; |
| 1892 | } |
| 1893 | port->i2c_client_sec = client_sec; |
Matthias Schwarzott | 721f322 | 2014-12-22 19:51:39 -0300 | [diff] [blame] | 1894 | break; |
Antti Palosaari | 49bf0e6 | 2015-04-20 14:48:33 -0300 | [diff] [blame] | 1895 | } |
Olli Salonen | 2944226 | 2014-08-11 16:58:15 -0300 | [diff] [blame] | 1896 | case CX23885_BOARD_DVBSKY_T9580: |
nibble.max | cba5480 | 2014-11-05 11:58:07 -0300 | [diff] [blame] | 1897 | case CX23885_BOARD_DVBSKY_S950: |
Olli Salonen | 2944226 | 2014-08-11 16:58:15 -0300 | [diff] [blame] | 1898 | i2c_bus = &dev->i2c_bus[0]; |
| 1899 | i2c_bus2 = &dev->i2c_bus[1]; |
| 1900 | switch (port->nr) { |
| 1901 | /* port b - satellite */ |
| 1902 | case 1: |
| 1903 | /* attach frontend */ |
| 1904 | fe0->dvb.frontend = dvb_attach(m88ds3103_attach, |
| 1905 | &dvbsky_t9580_m88ds3103_config, |
| 1906 | &i2c_bus2->i2c_adap, &adapter); |
| 1907 | if (fe0->dvb.frontend == NULL) |
| 1908 | break; |
| 1909 | |
| 1910 | /* attach tuner */ |
Antti Palosaari | d76e087 | 2015-03-23 18:52:46 -0300 | [diff] [blame] | 1911 | memset(&ts2020_config, 0, sizeof(ts2020_config)); |
| 1912 | ts2020_config.fe = fe0->dvb.frontend; |
Olli Salonen | 2944226 | 2014-08-11 16:58:15 -0300 | [diff] [blame] | 1913 | memset(&info, 0, sizeof(struct i2c_board_info)); |
Antti Palosaari | d76e087 | 2015-03-23 18:52:46 -0300 | [diff] [blame] | 1914 | strlcpy(info.type, "ts2020", I2C_NAME_SIZE); |
Olli Salonen | 2944226 | 2014-08-11 16:58:15 -0300 | [diff] [blame] | 1915 | info.addr = 0x60; |
Antti Palosaari | d76e087 | 2015-03-23 18:52:46 -0300 | [diff] [blame] | 1916 | info.platform_data = &ts2020_config; |
Olli Salonen | 2944226 | 2014-08-11 16:58:15 -0300 | [diff] [blame] | 1917 | request_module(info.type); |
| 1918 | client_tuner = i2c_new_device(adapter, &info); |
| 1919 | if (client_tuner == NULL || |
| 1920 | client_tuner->dev.driver == NULL) |
| 1921 | goto frontend_detach; |
| 1922 | if (!try_module_get(client_tuner->dev.driver->owner)) { |
| 1923 | i2c_unregister_device(client_tuner); |
| 1924 | goto frontend_detach; |
| 1925 | } |
| 1926 | |
| 1927 | /* delegate signal strength measurement to tuner */ |
| 1928 | fe0->dvb.frontend->ops.read_signal_strength = |
| 1929 | fe0->dvb.frontend->ops.tuner_ops.get_rf_strength; |
| 1930 | |
| 1931 | /* |
| 1932 | * for setting the voltage we need to set GPIOs on |
| 1933 | * the card. |
| 1934 | */ |
| 1935 | port->fe_set_voltage = |
| 1936 | fe0->dvb.frontend->ops.set_voltage; |
| 1937 | fe0->dvb.frontend->ops.set_voltage = |
| 1938 | dvbsky_t9580_set_voltage; |
| 1939 | |
| 1940 | port->i2c_client_tuner = client_tuner; |
| 1941 | |
| 1942 | break; |
| 1943 | /* port c - terrestrial/cable */ |
| 1944 | case 2: |
| 1945 | /* attach frontend */ |
Olli Salonen | 143800a | 2014-09-24 00:06:54 -0300 | [diff] [blame] | 1946 | memset(&si2168_config, 0, sizeof(si2168_config)); |
Olli Salonen | 2944226 | 2014-08-11 16:58:15 -0300 | [diff] [blame] | 1947 | si2168_config.i2c_adapter = &adapter; |
| 1948 | si2168_config.fe = &fe0->dvb.frontend; |
| 1949 | si2168_config.ts_mode = SI2168_TS_SERIAL; |
| 1950 | memset(&info, 0, sizeof(struct i2c_board_info)); |
| 1951 | strlcpy(info.type, "si2168", I2C_NAME_SIZE); |
| 1952 | info.addr = 0x64; |
| 1953 | info.platform_data = &si2168_config; |
| 1954 | request_module(info.type); |
| 1955 | client_demod = i2c_new_device(&i2c_bus->i2c_adap, &info); |
| 1956 | if (client_demod == NULL || |
| 1957 | client_demod->dev.driver == NULL) |
| 1958 | goto frontend_detach; |
| 1959 | if (!try_module_get(client_demod->dev.driver->owner)) { |
| 1960 | i2c_unregister_device(client_demod); |
| 1961 | goto frontend_detach; |
| 1962 | } |
| 1963 | port->i2c_client_demod = client_demod; |
| 1964 | |
| 1965 | /* attach tuner */ |
Olli Salonen | 143800a | 2014-09-24 00:06:54 -0300 | [diff] [blame] | 1966 | memset(&si2157_config, 0, sizeof(si2157_config)); |
Olli Salonen | 2944226 | 2014-08-11 16:58:15 -0300 | [diff] [blame] | 1967 | si2157_config.fe = fe0->dvb.frontend; |
Olli Salonen | ee3c3e4 | 2015-05-05 13:54:17 -0300 | [diff] [blame] | 1968 | si2157_config.if_port = 1; |
Olli Salonen | 2944226 | 2014-08-11 16:58:15 -0300 | [diff] [blame] | 1969 | memset(&info, 0, sizeof(struct i2c_board_info)); |
| 1970 | strlcpy(info.type, "si2157", I2C_NAME_SIZE); |
| 1971 | info.addr = 0x60; |
| 1972 | info.platform_data = &si2157_config; |
| 1973 | request_module(info.type); |
| 1974 | client_tuner = i2c_new_device(adapter, &info); |
| 1975 | if (client_tuner == NULL || |
Mauro Carvalho Chehab | 2b0aac3 | 2014-12-23 13:48:07 -0200 | [diff] [blame] | 1976 | client_tuner->dev.driver == NULL) |
Olli Salonen | 2944226 | 2014-08-11 16:58:15 -0300 | [diff] [blame] | 1977 | goto frontend_detach; |
Mauro Carvalho Chehab | 2b0aac3 | 2014-12-23 13:48:07 -0200 | [diff] [blame] | 1978 | |
Olli Salonen | 2944226 | 2014-08-11 16:58:15 -0300 | [diff] [blame] | 1979 | if (!try_module_get(client_tuner->dev.driver->owner)) { |
| 1980 | i2c_unregister_device(client_tuner); |
Olli Salonen | 2944226 | 2014-08-11 16:58:15 -0300 | [diff] [blame] | 1981 | goto frontend_detach; |
| 1982 | } |
| 1983 | port->i2c_client_tuner = client_tuner; |
| 1984 | break; |
| 1985 | } |
| 1986 | break; |
Olli Salonen | 82c1027 | 2014-09-29 04:44:16 -0300 | [diff] [blame] | 1987 | case CX23885_BOARD_DVBSKY_T980C: |
Olli Salonen | 61b103e | 2014-10-30 17:48:27 -0300 | [diff] [blame] | 1988 | case CX23885_BOARD_TT_CT2_4500_CI: |
Olli Salonen | 82c1027 | 2014-09-29 04:44:16 -0300 | [diff] [blame] | 1989 | i2c_bus = &dev->i2c_bus[1]; |
Olli Salonen | 24e7740 | 2014-10-04 03:59:30 -0300 | [diff] [blame] | 1990 | i2c_bus2 = &dev->i2c_bus[0]; |
Olli Salonen | 82c1027 | 2014-09-29 04:44:16 -0300 | [diff] [blame] | 1991 | |
| 1992 | /* attach frontend */ |
| 1993 | memset(&si2168_config, 0, sizeof(si2168_config)); |
| 1994 | si2168_config.i2c_adapter = &adapter; |
| 1995 | si2168_config.fe = &fe0->dvb.frontend; |
| 1996 | si2168_config.ts_mode = SI2168_TS_PARALLEL; |
| 1997 | memset(&info, 0, sizeof(struct i2c_board_info)); |
| 1998 | strlcpy(info.type, "si2168", I2C_NAME_SIZE); |
| 1999 | info.addr = 0x64; |
| 2000 | info.platform_data = &si2168_config; |
| 2001 | request_module(info.type); |
| 2002 | client_demod = i2c_new_device(&i2c_bus->i2c_adap, &info); |
Antti Palosaari | a593f2c | 2014-12-10 11:05:59 -0300 | [diff] [blame] | 2003 | if (client_demod == NULL || client_demod->dev.driver == NULL) |
Olli Salonen | 82c1027 | 2014-09-29 04:44:16 -0300 | [diff] [blame] | 2004 | goto frontend_detach; |
| 2005 | if (!try_module_get(client_demod->dev.driver->owner)) { |
| 2006 | i2c_unregister_device(client_demod); |
| 2007 | goto frontend_detach; |
| 2008 | } |
| 2009 | port->i2c_client_demod = client_demod; |
| 2010 | |
| 2011 | /* attach tuner */ |
| 2012 | memset(&si2157_config, 0, sizeof(si2157_config)); |
| 2013 | si2157_config.fe = fe0->dvb.frontend; |
Olli Salonen | ee3c3e4 | 2015-05-05 13:54:17 -0300 | [diff] [blame] | 2014 | si2157_config.if_port = 1; |
Olli Salonen | 82c1027 | 2014-09-29 04:44:16 -0300 | [diff] [blame] | 2015 | memset(&info, 0, sizeof(struct i2c_board_info)); |
| 2016 | strlcpy(info.type, "si2157", I2C_NAME_SIZE); |
| 2017 | info.addr = 0x60; |
| 2018 | info.platform_data = &si2157_config; |
| 2019 | request_module(info.type); |
| 2020 | client_tuner = i2c_new_device(adapter, &info); |
Mauro Carvalho Chehab | 2b0aac3 | 2014-12-23 13:48:07 -0200 | [diff] [blame] | 2021 | if (client_tuner == NULL || |
| 2022 | client_tuner->dev.driver == NULL) |
Olli Salonen | 82c1027 | 2014-09-29 04:44:16 -0300 | [diff] [blame] | 2023 | goto frontend_detach; |
Olli Salonen | 82c1027 | 2014-09-29 04:44:16 -0300 | [diff] [blame] | 2024 | if (!try_module_get(client_tuner->dev.driver->owner)) { |
| 2025 | i2c_unregister_device(client_tuner); |
Olli Salonen | 82c1027 | 2014-09-29 04:44:16 -0300 | [diff] [blame] | 2026 | goto frontend_detach; |
| 2027 | } |
| 2028 | port->i2c_client_tuner = client_tuner; |
| 2029 | break; |
nibble.max | 0e6c7b0 | 2014-10-23 07:01:44 -0300 | [diff] [blame] | 2030 | case CX23885_BOARD_DVBSKY_S950C: |
| 2031 | i2c_bus = &dev->i2c_bus[1]; |
| 2032 | i2c_bus2 = &dev->i2c_bus[0]; |
| 2033 | |
| 2034 | /* attach frontend */ |
| 2035 | fe0->dvb.frontend = dvb_attach(m88ds3103_attach, |
| 2036 | &dvbsky_s950c_m88ds3103_config, |
| 2037 | &i2c_bus->i2c_adap, &adapter); |
| 2038 | if (fe0->dvb.frontend == NULL) |
| 2039 | break; |
| 2040 | |
| 2041 | /* attach tuner */ |
Antti Palosaari | d76e087 | 2015-03-23 18:52:46 -0300 | [diff] [blame] | 2042 | memset(&ts2020_config, 0, sizeof(ts2020_config)); |
| 2043 | ts2020_config.fe = fe0->dvb.frontend; |
nibble.max | 0e6c7b0 | 2014-10-23 07:01:44 -0300 | [diff] [blame] | 2044 | memset(&info, 0, sizeof(struct i2c_board_info)); |
Antti Palosaari | d76e087 | 2015-03-23 18:52:46 -0300 | [diff] [blame] | 2045 | strlcpy(info.type, "ts2020", I2C_NAME_SIZE); |
nibble.max | 0e6c7b0 | 2014-10-23 07:01:44 -0300 | [diff] [blame] | 2046 | info.addr = 0x60; |
Antti Palosaari | d76e087 | 2015-03-23 18:52:46 -0300 | [diff] [blame] | 2047 | info.platform_data = &ts2020_config; |
nibble.max | 0e6c7b0 | 2014-10-23 07:01:44 -0300 | [diff] [blame] | 2048 | request_module(info.type); |
| 2049 | client_tuner = i2c_new_device(adapter, &info); |
Antti Palosaari | a593f2c | 2014-12-10 11:05:59 -0300 | [diff] [blame] | 2050 | if (client_tuner == NULL || client_tuner->dev.driver == NULL) |
nibble.max | 0e6c7b0 | 2014-10-23 07:01:44 -0300 | [diff] [blame] | 2051 | goto frontend_detach; |
| 2052 | if (!try_module_get(client_tuner->dev.driver->owner)) { |
| 2053 | i2c_unregister_device(client_tuner); |
| 2054 | goto frontend_detach; |
| 2055 | } |
| 2056 | |
| 2057 | /* delegate signal strength measurement to tuner */ |
| 2058 | fe0->dvb.frontend->ops.read_signal_strength = |
| 2059 | fe0->dvb.frontend->ops.tuner_ops.get_rf_strength; |
| 2060 | |
| 2061 | port->i2c_client_tuner = client_tuner; |
| 2062 | break; |
nibble.max | c29d6a8 | 2014-11-05 11:58:38 -0300 | [diff] [blame] | 2063 | case CX23885_BOARD_DVBSKY_S952: |
| 2064 | switch (port->nr) { |
| 2065 | /* port b */ |
| 2066 | case 1: |
| 2067 | i2c_bus = &dev->i2c_bus[1]; |
| 2068 | p_m88ds3103_config = &dvbsky_t9580_m88ds3103_config; |
| 2069 | p_set_voltage = dvbsky_t9580_set_voltage; |
| 2070 | break; |
| 2071 | /* port c */ |
| 2072 | case 2: |
| 2073 | i2c_bus = &dev->i2c_bus[0]; |
| 2074 | p_m88ds3103_config = &dvbsky_s952_portc_m88ds3103_config; |
| 2075 | p_set_voltage = dvbsky_s952_portc_set_voltage; |
| 2076 | break; |
| 2077 | } |
| 2078 | |
| 2079 | /* attach frontend */ |
| 2080 | fe0->dvb.frontend = dvb_attach(m88ds3103_attach, |
| 2081 | p_m88ds3103_config, |
| 2082 | &i2c_bus->i2c_adap, &adapter); |
| 2083 | if (fe0->dvb.frontend == NULL) |
| 2084 | break; |
| 2085 | |
| 2086 | /* attach tuner */ |
Antti Palosaari | d76e087 | 2015-03-23 18:52:46 -0300 | [diff] [blame] | 2087 | memset(&ts2020_config, 0, sizeof(ts2020_config)); |
| 2088 | ts2020_config.fe = fe0->dvb.frontend; |
nibble.max | c29d6a8 | 2014-11-05 11:58:38 -0300 | [diff] [blame] | 2089 | memset(&info, 0, sizeof(struct i2c_board_info)); |
Antti Palosaari | d76e087 | 2015-03-23 18:52:46 -0300 | [diff] [blame] | 2090 | strlcpy(info.type, "ts2020", I2C_NAME_SIZE); |
nibble.max | c29d6a8 | 2014-11-05 11:58:38 -0300 | [diff] [blame] | 2091 | info.addr = 0x60; |
Antti Palosaari | d76e087 | 2015-03-23 18:52:46 -0300 | [diff] [blame] | 2092 | info.platform_data = &ts2020_config; |
nibble.max | c29d6a8 | 2014-11-05 11:58:38 -0300 | [diff] [blame] | 2093 | request_module(info.type); |
| 2094 | client_tuner = i2c_new_device(adapter, &info); |
Antti Palosaari | a593f2c | 2014-12-10 11:05:59 -0300 | [diff] [blame] | 2095 | if (client_tuner == NULL || client_tuner->dev.driver == NULL) |
nibble.max | c29d6a8 | 2014-11-05 11:58:38 -0300 | [diff] [blame] | 2096 | goto frontend_detach; |
| 2097 | if (!try_module_get(client_tuner->dev.driver->owner)) { |
| 2098 | i2c_unregister_device(client_tuner); |
| 2099 | goto frontend_detach; |
| 2100 | } |
| 2101 | |
| 2102 | /* delegate signal strength measurement to tuner */ |
| 2103 | fe0->dvb.frontend->ops.read_signal_strength = |
| 2104 | fe0->dvb.frontend->ops.tuner_ops.get_rf_strength; |
| 2105 | |
| 2106 | /* |
| 2107 | * for setting the voltage we need to set GPIOs on |
| 2108 | * the card. |
| 2109 | */ |
| 2110 | port->fe_set_voltage = |
| 2111 | fe0->dvb.frontend->ops.set_voltage; |
| 2112 | fe0->dvb.frontend->ops.set_voltage = p_set_voltage; |
| 2113 | |
| 2114 | port->i2c_client_tuner = client_tuner; |
| 2115 | break; |
Nibble Max | c02ef64 | 2014-11-12 01:23:12 -0300 | [diff] [blame] | 2116 | case CX23885_BOARD_DVBSKY_T982: |
| 2117 | memset(&si2168_config, 0, sizeof(si2168_config)); |
| 2118 | switch (port->nr) { |
| 2119 | /* port b */ |
| 2120 | case 1: |
| 2121 | i2c_bus = &dev->i2c_bus[1]; |
| 2122 | si2168_config.ts_mode = SI2168_TS_PARALLEL; |
| 2123 | break; |
| 2124 | /* port c */ |
| 2125 | case 2: |
| 2126 | i2c_bus = &dev->i2c_bus[0]; |
| 2127 | si2168_config.ts_mode = SI2168_TS_SERIAL; |
| 2128 | break; |
| 2129 | } |
| 2130 | |
| 2131 | /* attach frontend */ |
| 2132 | si2168_config.i2c_adapter = &adapter; |
| 2133 | si2168_config.fe = &fe0->dvb.frontend; |
| 2134 | memset(&info, 0, sizeof(struct i2c_board_info)); |
| 2135 | strlcpy(info.type, "si2168", I2C_NAME_SIZE); |
| 2136 | info.addr = 0x64; |
| 2137 | info.platform_data = &si2168_config; |
| 2138 | request_module(info.type); |
| 2139 | client_demod = i2c_new_device(&i2c_bus->i2c_adap, &info); |
Antti Palosaari | a593f2c | 2014-12-10 11:05:59 -0300 | [diff] [blame] | 2140 | if (client_demod == NULL || client_demod->dev.driver == NULL) |
Nibble Max | c02ef64 | 2014-11-12 01:23:12 -0300 | [diff] [blame] | 2141 | goto frontend_detach; |
| 2142 | if (!try_module_get(client_demod->dev.driver->owner)) { |
| 2143 | i2c_unregister_device(client_demod); |
| 2144 | goto frontend_detach; |
| 2145 | } |
| 2146 | port->i2c_client_demod = client_demod; |
| 2147 | |
| 2148 | /* attach tuner */ |
| 2149 | memset(&si2157_config, 0, sizeof(si2157_config)); |
| 2150 | si2157_config.fe = fe0->dvb.frontend; |
Olli Salonen | ee3c3e4 | 2015-05-05 13:54:17 -0300 | [diff] [blame] | 2151 | si2157_config.if_port = 1; |
Nibble Max | c02ef64 | 2014-11-12 01:23:12 -0300 | [diff] [blame] | 2152 | memset(&info, 0, sizeof(struct i2c_board_info)); |
| 2153 | strlcpy(info.type, "si2157", I2C_NAME_SIZE); |
| 2154 | info.addr = 0x60; |
| 2155 | info.platform_data = &si2157_config; |
| 2156 | request_module(info.type); |
| 2157 | client_tuner = i2c_new_device(adapter, &info); |
Mauro Carvalho Chehab | 2b0aac3 | 2014-12-23 13:48:07 -0200 | [diff] [blame] | 2158 | if (client_tuner == NULL || |
| 2159 | client_tuner->dev.driver == NULL) |
Nibble Max | c02ef64 | 2014-11-12 01:23:12 -0300 | [diff] [blame] | 2160 | goto frontend_detach; |
Nibble Max | c02ef64 | 2014-11-12 01:23:12 -0300 | [diff] [blame] | 2161 | if (!try_module_get(client_tuner->dev.driver->owner)) { |
| 2162 | i2c_unregister_device(client_tuner); |
Nibble Max | c02ef64 | 2014-11-12 01:23:12 -0300 | [diff] [blame] | 2163 | goto frontend_detach; |
| 2164 | } |
| 2165 | port->i2c_client_tuner = client_tuner; |
| 2166 | break; |
Antti Palosaari | 1fc77d0 | 2014-12-11 16:12:46 -0300 | [diff] [blame] | 2167 | case CX23885_BOARD_HAUPPAUGE_HVR5525: |
| 2168 | switch (port->nr) { |
| 2169 | struct m88rs6000t_config m88rs6000t_config; |
| 2170 | |
| 2171 | /* port b - satellite */ |
| 2172 | case 1: |
| 2173 | /* attach frontend */ |
| 2174 | fe0->dvb.frontend = dvb_attach(m88ds3103_attach, |
| 2175 | &hauppauge_hvr5525_m88ds3103_config, |
| 2176 | &dev->i2c_bus[0].i2c_adap, &adapter); |
| 2177 | if (fe0->dvb.frontend == NULL) |
| 2178 | break; |
| 2179 | |
| 2180 | /* attach SEC */ |
| 2181 | if (!dvb_attach(a8293_attach, fe0->dvb.frontend, |
| 2182 | &dev->i2c_bus[0].i2c_adap, |
| 2183 | &hauppauge_a8293_config)) |
| 2184 | goto frontend_detach; |
| 2185 | |
| 2186 | /* attach tuner */ |
| 2187 | memset(&m88rs6000t_config, 0, sizeof(m88rs6000t_config)); |
| 2188 | m88rs6000t_config.fe = fe0->dvb.frontend; |
| 2189 | memset(&info, 0, sizeof(struct i2c_board_info)); |
| 2190 | strlcpy(info.type, "m88rs6000t", I2C_NAME_SIZE); |
| 2191 | info.addr = 0x21; |
| 2192 | info.platform_data = &m88rs6000t_config; |
| 2193 | request_module("%s", info.type); |
| 2194 | client_tuner = i2c_new_device(adapter, &info); |
| 2195 | if (!client_tuner || !client_tuner->dev.driver) |
| 2196 | goto frontend_detach; |
| 2197 | if (!try_module_get(client_tuner->dev.driver->owner)) { |
| 2198 | i2c_unregister_device(client_tuner); |
| 2199 | goto frontend_detach; |
| 2200 | } |
| 2201 | port->i2c_client_tuner = client_tuner; |
| 2202 | |
| 2203 | /* delegate signal strength measurement to tuner */ |
| 2204 | fe0->dvb.frontend->ops.read_signal_strength = |
| 2205 | fe0->dvb.frontend->ops.tuner_ops.get_rf_strength; |
| 2206 | break; |
| 2207 | /* port c - terrestrial/cable */ |
| 2208 | case 2: |
| 2209 | /* attach frontend */ |
| 2210 | memset(&si2168_config, 0, sizeof(si2168_config)); |
| 2211 | si2168_config.i2c_adapter = &adapter; |
| 2212 | si2168_config.fe = &fe0->dvb.frontend; |
| 2213 | si2168_config.ts_mode = SI2168_TS_SERIAL; |
| 2214 | memset(&info, 0, sizeof(struct i2c_board_info)); |
| 2215 | strlcpy(info.type, "si2168", I2C_NAME_SIZE); |
| 2216 | info.addr = 0x64; |
| 2217 | info.platform_data = &si2168_config; |
| 2218 | request_module("%s", info.type); |
| 2219 | client_demod = i2c_new_device(&dev->i2c_bus[0].i2c_adap, &info); |
| 2220 | if (!client_demod || !client_demod->dev.driver) |
| 2221 | goto frontend_detach; |
| 2222 | if (!try_module_get(client_demod->dev.driver->owner)) { |
| 2223 | i2c_unregister_device(client_demod); |
| 2224 | goto frontend_detach; |
| 2225 | } |
| 2226 | port->i2c_client_demod = client_demod; |
| 2227 | |
| 2228 | /* attach tuner */ |
| 2229 | memset(&si2157_config, 0, sizeof(si2157_config)); |
| 2230 | si2157_config.fe = fe0->dvb.frontend; |
Olli Salonen | ee3c3e4 | 2015-05-05 13:54:17 -0300 | [diff] [blame] | 2231 | si2157_config.if_port = 1; |
Antti Palosaari | 1fc77d0 | 2014-12-11 16:12:46 -0300 | [diff] [blame] | 2232 | memset(&info, 0, sizeof(struct i2c_board_info)); |
| 2233 | strlcpy(info.type, "si2157", I2C_NAME_SIZE); |
| 2234 | info.addr = 0x60; |
| 2235 | info.platform_data = &si2157_config; |
| 2236 | request_module("%s", info.type); |
| 2237 | client_tuner = i2c_new_device(&dev->i2c_bus[1].i2c_adap, &info); |
| 2238 | if (!client_tuner || !client_tuner->dev.driver) { |
| 2239 | module_put(client_demod->dev.driver->owner); |
| 2240 | i2c_unregister_device(client_demod); |
| 2241 | port->i2c_client_demod = NULL; |
| 2242 | goto frontend_detach; |
| 2243 | } |
| 2244 | if (!try_module_get(client_tuner->dev.driver->owner)) { |
| 2245 | i2c_unregister_device(client_tuner); |
| 2246 | module_put(client_demod->dev.driver->owner); |
| 2247 | i2c_unregister_device(client_demod); |
| 2248 | port->i2c_client_demod = NULL; |
| 2249 | goto frontend_detach; |
| 2250 | } |
| 2251 | port->i2c_client_tuner = client_tuner; |
| 2252 | break; |
| 2253 | } |
| 2254 | break; |
Steven Toth | d19770e | 2007-03-11 20:44:05 -0300 | [diff] [blame] | 2255 | default: |
Steven Toth | 9c8ced5 | 2008-10-16 20:18:44 -0300 | [diff] [blame] | 2256 | printk(KERN_INFO "%s: The frontend of your DVB/ATSC card " |
| 2257 | " isn't supported yet\n", |
Steven Toth | d19770e | 2007-03-11 20:44:05 -0300 | [diff] [blame] | 2258 | dev->name); |
| 2259 | break; |
| 2260 | } |
Igor M. Liplianin | 78db854 | 2011-01-25 17:04:00 -0300 | [diff] [blame] | 2261 | |
| 2262 | if ((NULL == fe0->dvb.frontend) || (fe1 && NULL == fe1->dvb.frontend)) { |
Steven Toth | 9c8ced5 | 2008-10-16 20:18:44 -0300 | [diff] [blame] | 2263 | printk(KERN_ERR "%s: frontend initialization failed\n", |
Igor M. Liplianin | 78db854 | 2011-01-25 17:04:00 -0300 | [diff] [blame] | 2264 | dev->name); |
| 2265 | goto frontend_detach; |
Steven Toth | d19770e | 2007-03-11 20:44:05 -0300 | [diff] [blame] | 2266 | } |
Igor M. Liplianin | 78db854 | 2011-01-25 17:04:00 -0300 | [diff] [blame] | 2267 | |
Michael Krufky | d7cba04 | 2008-09-12 13:31:45 -0300 | [diff] [blame] | 2268 | /* define general-purpose callback pointer */ |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 2269 | fe0->dvb.frontend->callback = cx23885_tuner_callback; |
Igor M. Liplianin | 78db854 | 2011-01-25 17:04:00 -0300 | [diff] [blame] | 2270 | if (fe1) |
| 2271 | fe1->dvb.frontend->callback = cx23885_tuner_callback; |
| 2272 | #if 0 |
| 2273 | /* Ensure all frontends negotiate bus access */ |
| 2274 | fe0->dvb.frontend->ops.ts_bus_ctrl = cx23885_dvb_bus_ctrl; |
| 2275 | if (fe1) |
| 2276 | fe1->dvb.frontend->ops.ts_bus_ctrl = cx23885_dvb_bus_ctrl; |
| 2277 | #endif |
Steven Toth | d19770e | 2007-03-11 20:44:05 -0300 | [diff] [blame] | 2278 | |
| 2279 | /* Put the analog decoder in standby to keep it quiet */ |
Laurent Pinchart | 622b828 | 2009-10-05 10:48:17 -0300 | [diff] [blame] | 2280 | call_all(dev, core, s_power, 0); |
Steven Toth | d19770e | 2007-03-11 20:44:05 -0300 | [diff] [blame] | 2281 | |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 2282 | if (fe0->dvb.frontend->ops.analog_ops.standby) |
| 2283 | fe0->dvb.frontend->ops.analog_ops.standby(fe0->dvb.frontend); |
Michael Krufky | 3ba71d2 | 2007-12-07 01:40:36 -0300 | [diff] [blame] | 2284 | |
Steven Toth | d19770e | 2007-03-11 20:44:05 -0300 | [diff] [blame] | 2285 | /* register everything */ |
Hans Verkuil | 453afdd | 2014-08-14 06:43:01 -0300 | [diff] [blame] | 2286 | ret = vb2_dvb_register_bus(&port->frontends, THIS_MODULE, port, |
Mauro Carvalho Chehab | 9adf613 | 2012-08-05 14:16:30 -0300 | [diff] [blame] | 2287 | &dev->pci->dev, adapter_nr, mfe_shared); |
Abylay Ospan | bee3019 | 2010-06-25 08:01:28 -0300 | [diff] [blame] | 2288 | if (ret) |
Igor M. Liplianin | 78db854 | 2011-01-25 17:04:00 -0300 | [diff] [blame] | 2289 | goto frontend_detach; |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 2290 | |
Mauro Carvalho Chehab | 2b0aac3 | 2014-12-23 13:48:07 -0200 | [diff] [blame] | 2291 | ret = dvb_register_ci_mac(port); |
| 2292 | if (ret) |
| 2293 | goto frontend_detach; |
Igor M. Liplianin | 5a23b07 | 2009-03-03 12:06:09 -0300 | [diff] [blame] | 2294 | |
Mauro Carvalho Chehab | 2b0aac3 | 2014-12-23 13:48:07 -0200 | [diff] [blame] | 2295 | return 0; |
Igor M. Liplianin | 78db854 | 2011-01-25 17:04:00 -0300 | [diff] [blame] | 2296 | |
| 2297 | frontend_detach: |
Antti Palosaari | bf5e3ef | 2015-04-16 13:59:46 -0300 | [diff] [blame] | 2298 | /* remove I2C client for SEC */ |
| 2299 | client_sec = port->i2c_client_sec; |
| 2300 | if (client_sec) { |
| 2301 | module_put(client_sec->dev.driver->owner); |
| 2302 | i2c_unregister_device(client_sec); |
| 2303 | port->i2c_client_sec = NULL; |
| 2304 | } |
| 2305 | |
Mauro Carvalho Chehab | 2b0aac3 | 2014-12-23 13:48:07 -0200 | [diff] [blame] | 2306 | /* remove I2C client for tuner */ |
| 2307 | client_tuner = port->i2c_client_tuner; |
| 2308 | if (client_tuner) { |
| 2309 | module_put(client_tuner->dev.driver->owner); |
| 2310 | i2c_unregister_device(client_tuner); |
| 2311 | port->i2c_client_tuner = NULL; |
| 2312 | } |
| 2313 | |
| 2314 | /* remove I2C client for demodulator */ |
| 2315 | client_demod = port->i2c_client_demod; |
| 2316 | if (client_demod) { |
| 2317 | module_put(client_demod->dev.driver->owner); |
| 2318 | i2c_unregister_device(client_demod); |
| 2319 | port->i2c_client_demod = NULL; |
| 2320 | } |
| 2321 | |
Igor M. Liplianin | 78db854 | 2011-01-25 17:04:00 -0300 | [diff] [blame] | 2322 | port->gate_ctrl = NULL; |
Hans Verkuil | 453afdd | 2014-08-14 06:43:01 -0300 | [diff] [blame] | 2323 | vb2_dvb_dealloc_frontends(&port->frontends); |
Igor M. Liplianin | 78db854 | 2011-01-25 17:04:00 -0300 | [diff] [blame] | 2324 | return -EINVAL; |
Steven Toth | d19770e | 2007-03-11 20:44:05 -0300 | [diff] [blame] | 2325 | } |
| 2326 | |
| 2327 | int cx23885_dvb_register(struct cx23885_tsport *port) |
| 2328 | { |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 2329 | |
Hans Verkuil | 453afdd | 2014-08-14 06:43:01 -0300 | [diff] [blame] | 2330 | struct vb2_dvb_frontend *fe0; |
Steven Toth | d19770e | 2007-03-11 20:44:05 -0300 | [diff] [blame] | 2331 | struct cx23885_dev *dev = port->dev; |
Steven Toth | eb0c58b | 2008-10-11 12:34:39 -0300 | [diff] [blame] | 2332 | int err, i; |
Steven Toth | d19770e | 2007-03-11 20:44:05 -0300 | [diff] [blame] | 2333 | |
Steven Toth | eb0c58b | 2008-10-11 12:34:39 -0300 | [diff] [blame] | 2334 | /* Here we need to allocate the correct number of frontends, |
André Goddard Rosa | af901ca | 2009-11-14 13:09:05 -0200 | [diff] [blame] | 2335 | * as reflected in the cards struct. The reality is that currently |
Steven Toth | eb0c58b | 2008-10-11 12:34:39 -0300 | [diff] [blame] | 2336 | * no cx23885 boards support this - yet. But, if we don't modify this |
| 2337 | * code then the second frontend would never be allocated (later) |
| 2338 | * and fail with error before the attach in dvb_register(). |
| 2339 | * Without these changes we risk an OOPS later. The changes here |
| 2340 | * are for safety, and should provide a good foundation for the |
| 2341 | * future addition of any multi-frontend cx23885 based boards. |
| 2342 | */ |
| 2343 | printk(KERN_INFO "%s() allocating %d frontend(s)\n", __func__, |
| 2344 | port->num_frontends); |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 2345 | |
Steven Toth | eb0c58b | 2008-10-11 12:34:39 -0300 | [diff] [blame] | 2346 | for (i = 1; i <= port->num_frontends; i++) { |
Hans Verkuil | 453afdd | 2014-08-14 06:43:01 -0300 | [diff] [blame] | 2347 | struct vb2_queue *q; |
| 2348 | |
| 2349 | if (vb2_dvb_alloc_frontend( |
Steven Toth | 9c8ced5 | 2008-10-16 20:18:44 -0300 | [diff] [blame] | 2350 | &port->frontends, i) == NULL) { |
Steven Toth | eb0c58b | 2008-10-11 12:34:39 -0300 | [diff] [blame] | 2351 | printk(KERN_ERR "%s() failed to alloc\n", __func__); |
| 2352 | return -ENOMEM; |
| 2353 | } |
Steven Toth | d19770e | 2007-03-11 20:44:05 -0300 | [diff] [blame] | 2354 | |
Hans Verkuil | 453afdd | 2014-08-14 06:43:01 -0300 | [diff] [blame] | 2355 | fe0 = vb2_dvb_get_frontend(&port->frontends, i); |
Steven Toth | eb0c58b | 2008-10-11 12:34:39 -0300 | [diff] [blame] | 2356 | if (!fe0) |
Mauro Carvalho Chehab | ed3da2b | 2014-10-30 11:15:53 -0300 | [diff] [blame] | 2357 | return -EINVAL; |
Steven Toth | d19770e | 2007-03-11 20:44:05 -0300 | [diff] [blame] | 2358 | |
Steven Toth | eb0c58b | 2008-10-11 12:34:39 -0300 | [diff] [blame] | 2359 | dprintk(1, "%s\n", __func__); |
Steven Toth | 9c8ced5 | 2008-10-16 20:18:44 -0300 | [diff] [blame] | 2360 | dprintk(1, " ->probed by Card=%d Name=%s, PCI %02x:%02x\n", |
Steven Toth | eb0c58b | 2008-10-11 12:34:39 -0300 | [diff] [blame] | 2361 | dev->board, |
| 2362 | dev->name, |
| 2363 | dev->pci_bus, |
| 2364 | dev->pci_slot); |
| 2365 | |
| 2366 | err = -ENODEV; |
| 2367 | |
| 2368 | /* dvb stuff */ |
| 2369 | /* We have to init the queue for each frontend on a port. */ |
Steven Toth | 9c8ced5 | 2008-10-16 20:18:44 -0300 | [diff] [blame] | 2370 | printk(KERN_INFO "%s: cx23885 based dvb card\n", dev->name); |
Hans Verkuil | 453afdd | 2014-08-14 06:43:01 -0300 | [diff] [blame] | 2371 | q = &fe0->dvb.dvbq; |
| 2372 | q->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; |
| 2373 | q->io_modes = VB2_MMAP | VB2_USERPTR | VB2_DMABUF | VB2_READ; |
| 2374 | q->gfp_flags = GFP_DMA32; |
| 2375 | q->min_buffers_needed = 2; |
| 2376 | q->drv_priv = port; |
| 2377 | q->buf_struct_size = sizeof(struct cx23885_buffer); |
| 2378 | q->ops = &dvb_qops; |
| 2379 | q->mem_ops = &vb2_dma_sg_memops; |
| 2380 | q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC; |
| 2381 | q->lock = &dev->lock; |
| 2382 | |
| 2383 | err = vb2_queue_init(q); |
| 2384 | if (err < 0) |
| 2385 | return err; |
Steven Toth | eb0c58b | 2008-10-11 12:34:39 -0300 | [diff] [blame] | 2386 | } |
Steven Toth | d19770e | 2007-03-11 20:44:05 -0300 | [diff] [blame] | 2387 | err = dvb_register(port); |
| 2388 | if (err != 0) |
Steven Toth | 9c8ced5 | 2008-10-16 20:18:44 -0300 | [diff] [blame] | 2389 | printk(KERN_ERR "%s() dvb_register failed err = %d\n", |
| 2390 | __func__, err); |
Steven Toth | d19770e | 2007-03-11 20:44:05 -0300 | [diff] [blame] | 2391 | |
Steven Toth | d19770e | 2007-03-11 20:44:05 -0300 | [diff] [blame] | 2392 | return err; |
| 2393 | } |
| 2394 | |
| 2395 | int cx23885_dvb_unregister(struct cx23885_tsport *port) |
| 2396 | { |
Hans Verkuil | 453afdd | 2014-08-14 06:43:01 -0300 | [diff] [blame] | 2397 | struct vb2_dvb_frontend *fe0; |
Olli Salonen | b0b12e6 | 2014-08-11 16:58:13 -0300 | [diff] [blame] | 2398 | struct i2c_client *client; |
Steven Toth | 363c35f | 2008-10-11 11:05:50 -0300 | [diff] [blame] | 2399 | |
Olli Salonen | e450de4 | 2014-09-29 04:44:19 -0300 | [diff] [blame] | 2400 | /* remove I2C client for CI */ |
| 2401 | client = port->i2c_client_ci; |
| 2402 | if (client) { |
| 2403 | module_put(client->dev.driver->owner); |
| 2404 | i2c_unregister_device(client); |
| 2405 | } |
| 2406 | |
Antti Palosaari | bf5e3ef | 2015-04-16 13:59:46 -0300 | [diff] [blame] | 2407 | /* remove I2C client for SEC */ |
| 2408 | client = port->i2c_client_sec; |
| 2409 | if (client) { |
| 2410 | module_put(client->dev.driver->owner); |
| 2411 | i2c_unregister_device(client); |
| 2412 | } |
| 2413 | |
Olli Salonen | b0b12e6 | 2014-08-11 16:58:13 -0300 | [diff] [blame] | 2414 | /* remove I2C client for tuner */ |
| 2415 | client = port->i2c_client_tuner; |
| 2416 | if (client) { |
| 2417 | module_put(client->dev.driver->owner); |
| 2418 | i2c_unregister_device(client); |
| 2419 | } |
| 2420 | |
| 2421 | /* remove I2C client for demodulator */ |
| 2422 | client = port->i2c_client_demod; |
| 2423 | if (client) { |
| 2424 | module_put(client->dev.driver->owner); |
| 2425 | i2c_unregister_device(client); |
| 2426 | } |
| 2427 | |
Hans Verkuil | 453afdd | 2014-08-14 06:43:01 -0300 | [diff] [blame] | 2428 | fe0 = vb2_dvb_get_frontend(&port->frontends, 1); |
Olli Salonen | b0b12e6 | 2014-08-11 16:58:13 -0300 | [diff] [blame] | 2429 | |
Abylay Ospan | e66131c | 2011-07-15 15:01:07 -0300 | [diff] [blame] | 2430 | if (fe0 && fe0->dvb.frontend) |
Hans Verkuil | 453afdd | 2014-08-14 06:43:01 -0300 | [diff] [blame] | 2431 | vb2_dvb_unregister_bus(&port->frontends); |
Steven Toth | d19770e | 2007-03-11 20:44:05 -0300 | [diff] [blame] | 2432 | |
Hans Verkuil | afd9666 | 2009-03-13 13:24:19 -0300 | [diff] [blame] | 2433 | switch (port->dev->board) { |
| 2434 | case CX23885_BOARD_NETUP_DUAL_DVBS2_CI: |
| 2435 | netup_ci_exit(port); |
| 2436 | break; |
Igor M. Liplianin | 78db854 | 2011-01-25 17:04:00 -0300 | [diff] [blame] | 2437 | case CX23885_BOARD_NETUP_DUAL_DVB_T_C_CI_RF: |
| 2438 | altera_ci_release(port->dev, port->nr); |
| 2439 | break; |
Hans Verkuil | afd9666 | 2009-03-13 13:24:19 -0300 | [diff] [blame] | 2440 | } |
Igor M. Liplianin | 5a23b07 | 2009-03-03 12:06:09 -0300 | [diff] [blame] | 2441 | |
Igor M. Liplianin | 78db854 | 2011-01-25 17:04:00 -0300 | [diff] [blame] | 2442 | port->gate_ctrl = NULL; |
| 2443 | |
Steven Toth | d19770e | 2007-03-11 20:44:05 -0300 | [diff] [blame] | 2444 | return 0; |
| 2445 | } |