aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb
diff options
context:
space:
mode:
authorHartmut Birr <e9hack@googlemail.com>2007-04-21 18:37:17 -0400
committerMauro Carvalho Chehab <mchehab@infradead.org>2007-04-27 14:45:47 -0400
commitaa323ac89c5724de89656fcf31590d19e74594ec (patch)
treea556247ba3e2d78e14e974105d6a34fc094849e5 /drivers/media/dvb
parentfd9c66e269a44bd3c6c615957c79b21f3dde69af (diff)
V4L/DVB (5543): Tda10023: Add support for frontend TDA10023
Add support for the frontend TDA10023 and add cards that need the tda10023. Signed-off-by: Hartmut Birr <e9hack@googlemail.com> Signed-off-by: Georg Acher <acher@in.tum.de> Signed-off-by: Oliver Endriss <o.endriss@gmx.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/dvb')
-rw-r--r--drivers/media/dvb/frontends/Kconfig7
-rw-r--r--drivers/media/dvb/frontends/Makefile1
-rw-r--r--drivers/media/dvb/frontends/tda10021.c6
-rw-r--r--drivers/media/dvb/frontends/tda10023.c540
-rw-r--r--drivers/media/dvb/frontends/tda1002x.h (renamed from drivers/media/dvb/frontends/tda10021.h)28
-rw-r--r--drivers/media/dvb/ttpci/Kconfig2
-rw-r--r--drivers/media/dvb/ttpci/budget-av.c105
-rw-r--r--drivers/media/dvb/ttpci/budget-core.c16
-rw-r--r--drivers/media/dvb/ttpci/budget.h3
9 files changed, 670 insertions, 38 deletions
diff --git a/drivers/media/dvb/frontends/Kconfig b/drivers/media/dvb/frontends/Kconfig
index 10c4e7bdde78..ff448761dcef 100644
--- a/drivers/media/dvb/frontends/Kconfig
+++ b/drivers/media/dvb/frontends/Kconfig
@@ -205,6 +205,13 @@ config DVB_TDA10021
205 help 205 help
206 A DVB-C tuner module. Say Y when you want to support this frontend. 206 A DVB-C tuner module. Say Y when you want to support this frontend.
207 207
208config DVB_TDA10023
209 tristate "Philips TDA10023 based"
210 depends on DVB_CORE && I2C
211 default m if DVB_FE_CUSTOMISE
212 help
213 A DVB-C tuner module. Say Y when you want to support this frontend.
214
208config DVB_STV0297 215config DVB_STV0297
209 tristate "ST STV0297 based" 216 tristate "ST STV0297 based"
210 depends on DVB_CORE && I2C 217 depends on DVB_CORE && I2C
diff --git a/drivers/media/dvb/frontends/Makefile b/drivers/media/dvb/frontends/Makefile
index 905fcfc8732a..27f386585d43 100644
--- a/drivers/media/dvb/frontends/Makefile
+++ b/drivers/media/dvb/frontends/Makefile
@@ -25,6 +25,7 @@ obj-$(CONFIG_DVB_MT352) += mt352.o
25obj-$(CONFIG_DVB_ZL10353) += zl10353.o 25obj-$(CONFIG_DVB_ZL10353) += zl10353.o
26obj-$(CONFIG_DVB_CX22702) += cx22702.o 26obj-$(CONFIG_DVB_CX22702) += cx22702.o
27obj-$(CONFIG_DVB_TDA10021) += tda10021.o 27obj-$(CONFIG_DVB_TDA10021) += tda10021.o
28obj-$(CONFIG_DVB_TDA10023) += tda10023.o
28obj-$(CONFIG_DVB_STV0297) += stv0297.o 29obj-$(CONFIG_DVB_STV0297) += stv0297.o
29obj-$(CONFIG_DVB_NXT200X) += nxt200x.o 30obj-$(CONFIG_DVB_NXT200X) += nxt200x.o
30obj-$(CONFIG_DVB_OR51211) += or51211.o 31obj-$(CONFIG_DVB_OR51211) += or51211.o
diff --git a/drivers/media/dvb/frontends/tda10021.c b/drivers/media/dvb/frontends/tda10021.c
index ef9159f8c3fa..304f1f9b8008 100644
--- a/drivers/media/dvb/frontends/tda10021.c
+++ b/drivers/media/dvb/frontends/tda10021.c
@@ -30,13 +30,13 @@
30#include <linux/slab.h> 30#include <linux/slab.h>
31 31
32#include "dvb_frontend.h" 32#include "dvb_frontend.h"
33#include "tda10021.h" 33#include "tda1002x.h"
34 34
35 35
36struct tda10021_state { 36struct tda10021_state {
37 struct i2c_adapter* i2c; 37 struct i2c_adapter* i2c;
38 /* configuration settings */ 38 /* configuration settings */
39 const struct tda10021_config* config; 39 const struct tda1002x_config* config;
40 struct dvb_frontend frontend; 40 struct dvb_frontend frontend;
41 41
42 u8 pwm; 42 u8 pwm;
@@ -398,7 +398,7 @@ static void tda10021_release(struct dvb_frontend* fe)
398 398
399static struct dvb_frontend_ops tda10021_ops; 399static struct dvb_frontend_ops tda10021_ops;
400 400
401struct dvb_frontend* tda10021_attach(const struct tda10021_config* config, 401struct dvb_frontend* tda10021_attach(const struct tda1002x_config* config,
402 struct i2c_adapter* i2c, 402 struct i2c_adapter* i2c,
403 u8 pwm) 403 u8 pwm)
404{ 404{
diff --git a/drivers/media/dvb/frontends/tda10023.c b/drivers/media/dvb/frontends/tda10023.c
new file mode 100644
index 000000000000..da796e784be3
--- /dev/null
+++ b/drivers/media/dvb/frontends/tda10023.c
@@ -0,0 +1,540 @@
1/*
2 TDA10023 - DVB-C decoder
3 (as used in Philips CU1216-3 NIM and the Reelbox DVB-C tuner card)
4
5 Copyright (C) 2005 Georg Acher, BayCom GmbH (acher at baycom dot de)
6 Copyright (c) 2006 Hartmut Birr (e9hack at gmail dot com)
7
8 Remotely based on tda10021.c
9 Copyright (C) 1999 Convergence Integrated Media GmbH <ralph@convergence.de>
10 Copyright (C) 2004 Markus Schulz <msc@antzsystem.de>
11 Support for TDA10021
12
13 This program is free software; you can redistribute it and/or modify
14 it under the terms of the GNU General Public License as published by
15 the Free Software Foundation; either version 2 of the License, or
16 (at your option) any later version.
17
18 This program is distributed in the hope that it will be useful,
19 but WITHOUT ANY WARRANTY; without even the implied warranty of
20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 GNU General Public License for more details.
22
23 You should have received a copy of the GNU General Public License
24 along with this program; if not, write to the Free Software
25 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
26*/
27
28#include <linux/delay.h>
29#include <linux/errno.h>
30#include <linux/init.h>
31#include <linux/kernel.h>
32#include <linux/module.h>
33#include <linux/string.h>
34#include <linux/slab.h>
35
36#include <asm/div64.h>
37
38#include "dvb_frontend.h"
39#include "tda1002x.h"
40
41
42struct tda10023_state {
43 struct i2c_adapter* i2c;
44 /* configuration settings */
45 const struct tda1002x_config* config;
46 struct dvb_frontend frontend;
47
48 u8 pwm;
49 u8 reg0;
50};
51
52
53#define dprintk(x...)
54
55static int verbose;
56
57#define XTAL 28920000UL
58#define PLL_M 8UL
59#define PLL_P 4UL
60#define PLL_N 1UL
61#define SYSCLK (XTAL*PLL_M/(PLL_N*PLL_P)) // -> 57840000
62
63static u8 tda10023_inittab[]={
64 // reg mask val
65 0x2a,0xff,0x02, // PLL3, Bypass, Power Down
66 0xff,0x64,0x00, // Sleep 100ms
67 0x2a,0xff,0x03, // PLL3, Bypass, Power Down
68 0xff,0x64,0x00, // Sleep 100ms
69 0x28,0xff,PLL_M-1, // PLL1 M=8
70 0x29,0xff,((PLL_P-1)<<6)|(PLL_N-1), // PLL2
71 0x00,0xff,0x23, // GPR FSAMPLING=1
72 0x2a,0xff,0x08, // PLL3 PSACLK=1
73 0xff,0x64,0x00, // Sleep 100ms
74 0x1f,0xff,0x00, // RESET
75 0xff,0x64,0x00, // Sleep 100ms
76 0xe6,0x0c,0x04, // RSCFG_IND
77 0x10,0xc0,0x80, // DECDVBCFG1 PBER=1
78
79 0x0e,0xff,0x82, // GAIN1
80 0x03,0x08,0x08, // CLKCONF DYN=1
81 0x2e,0xbf,0x30, // AGCCONF2 TRIAGC=0,POSAGC=ENAGCIF=1 PPWMTUN=0 PPWMIF=0
82 0x01,0xff,0x30, // AGCREF
83 0x1e,0x84,0x84, // CONTROL SACLK_ON=1
84 0x1b,0xff,0xc8, // ADC TWOS=1
85 0x3b,0xff,0xff, // IFMAX
86 0x3c,0xff,0x00, // IFMIN
87 0x34,0xff,0x00, // PWMREF
88 0x35,0xff,0xff, // TUNMAX
89 0x36,0xff,0x00, // TUNMIN
90 0x06,0xff,0x7f, // EQCONF1 POSI=7 ENADAPT=ENEQUAL=DFE=1 // 0x77
91 0x1c,0x30,0x30, // EQCONF2 STEPALGO=SGNALGO=1
92 0x37,0xff,0xf6, // DELTAF_LSB
93 0x38,0xff,0xff, // DELTAF_MSB
94 0x02,0xff,0x93, // AGCCONF1 IFS=1 KAGCIF=2 KAGCTUN=3
95 0x2d,0xff,0xf6, // SWEEP SWPOS=1 SWDYN=7 SWSTEP=1 SWLEN=2
96 0x04,0x10,0x00, // SWRAMP=1
97 0x12,0xff,0xa1, // INTP1 POCLKP=1 FEL=1 MFS=0
98 0x2b,0x01,0xa1, // INTS1
99 0x20,0xff,0x04, // INTP2 SWAPP=? MSBFIRSTP=? INTPSEL=?
100 0x2c,0xff,0x0d, // INTP/S TRIP=0 TRIS=0
101 0xc4,0xff,0x00,
102 0xc3,0x30,0x00,
103 0xb5,0xff,0x19, // ERAGC_THD
104 0x00,0x03,0x01, // GPR, CLBS soft reset
105 0x00,0x03,0x03, // GPR, CLBS soft reset
106 0xff,0x64,0x00, // Sleep 100ms
107 0xff,0xff,0xff
108};
109
110static u8 tda10023_readreg (struct tda10023_state* state, u8 reg)
111{
112 u8 b0 [] = { reg };
113 u8 b1 [] = { 0 };
114 struct i2c_msg msg [] = { { .addr = state->config->demod_address, .flags = 0, .buf = b0, .len = 1 },
115 { .addr = state->config->demod_address, .flags = I2C_M_RD, .buf = b1, .len = 1 } };
116 int ret;
117
118 ret = i2c_transfer (state->i2c, msg, 2);
119 if (ret != 2)
120 printk("DVB: TDA10023: %s: readreg error (ret == %i)\n",
121 __FUNCTION__, ret);
122 return b1[0];
123}
124
125static int tda10023_writereg (struct tda10023_state* state, u8 reg, u8 data)
126{
127 u8 buf[] = { reg, data };
128 struct i2c_msg msg = { .addr = state->config->demod_address, .flags = 0, .buf = buf, .len = 2 };
129 int ret;
130
131 ret = i2c_transfer (state->i2c, &msg, 1);
132 if (ret != 1)
133 printk("DVB: TDA10023(%d): %s, writereg error "
134 "(reg == 0x%02x, val == 0x%02x, ret == %i)\n",
135 state->frontend.dvb->num, __FUNCTION__, reg, data, ret);
136
137 return (ret != 1) ? -EREMOTEIO : 0;
138}
139
140
141static int tda10023_writebit (struct tda10023_state* state, u8 reg, u8 mask,u8 data)
142{
143 if (mask==0xff)
144 return tda10023_writereg(state, reg, data);
145 else {
146 u8 val;
147 val=tda10023_readreg(state,reg);
148 val&=~mask;
149 val|=(data&mask);
150 return tda10023_writereg(state, reg, val);
151 }
152}
153
154static void tda10023_writetab(struct tda10023_state* state, u8* tab)
155{
156 u8 r,m,v;
157 while (1) {
158 r=*tab++;
159 m=*tab++;
160 v=*tab++;
161 if (r==0xff) {
162 if (m==0xff)
163 break;
164 else
165 msleep(m);
166 }
167 else
168 tda10023_writebit(state,r,m,v);
169 }
170}
171
172//get access to tuner
173static int lock_tuner(struct tda10023_state* state)
174{
175 u8 buf[2] = { 0x0f, 0xc0 };
176 struct i2c_msg msg = {.addr=state->config->demod_address, .flags=0, .buf=buf, .len=2};
177
178 if(i2c_transfer(state->i2c, &msg, 1) != 1)
179 {
180 printk("tda10023: lock tuner fails\n");
181 return -EREMOTEIO;
182 }
183 return 0;
184}
185
186//release access from tuner
187static int unlock_tuner(struct tda10023_state* state)
188{
189 u8 buf[2] = { 0x0f, 0x40 };
190 struct i2c_msg msg_post={.addr=state->config->demod_address, .flags=0, .buf=buf, .len=2};
191
192 if(i2c_transfer(state->i2c, &msg_post, 1) != 1)
193 {
194 printk("tda10023: unlock tuner fails\n");
195 return -EREMOTEIO;
196 }
197 return 0;
198}
199
200static int tda10023_setup_reg0 (struct tda10023_state* state, u8 reg0)
201{
202 reg0 |= state->reg0 & 0x63;
203
204 tda10023_writereg (state, 0x00, reg0 & 0xfe);
205 tda10023_writereg (state, 0x00, reg0 | 0x01);
206
207 state->reg0 = reg0;
208 return 0;
209}
210
211static int tda10023_set_symbolrate (struct tda10023_state* state, u32 sr)
212{
213 s32 BDR;
214 s32 BDRI;
215 s16 SFIL=0;
216 u16 NDEC = 0;
217
218 if (sr > (SYSCLK/(2*4)))
219 sr=SYSCLK/(2*4);
220
221 if (sr<870000)
222 sr=870000;
223
224 if (sr < (u32)(SYSCLK/98.40)) {
225 NDEC=3;
226 SFIL=1;
227 } else if (sr<(u32)(SYSCLK/64.0)) {
228 NDEC=3;
229 SFIL=0;
230 } else if (sr<(u32)(SYSCLK/49.2)) {
231 NDEC=2;
232 SFIL=1;
233 } else if (sr<(u32)(SYSCLK/32.0)) {
234 NDEC=2;
235 SFIL=0;
236 } else if (sr<(u32)(SYSCLK/24.6)) {
237 NDEC=1;
238 SFIL=1;
239 } else if (sr<(u32)(SYSCLK/16.0)) {
240 NDEC=1;
241 SFIL=0;
242 } else if (sr<(u32)(SYSCLK/12.3)) {
243 NDEC=0;
244 SFIL=1;
245 }
246
247 BDRI=SYSCLK*16;
248 BDRI>>=NDEC;
249 BDRI +=sr/2;
250 BDRI /=sr;
251
252 if (BDRI>255)
253 BDRI=255;
254
255 {
256 u64 BDRX;
257
258 BDRX=1<<(24+NDEC);
259 BDRX*=sr;
260 do_div(BDRX,SYSCLK); // BDRX/=SYSCLK;
261
262 BDR=(s32)BDRX;
263 }
264// printk("Symbolrate %i, BDR %i BDRI %i, NDEC %i\n",sr,BDR,BDRI,NDEC);
265 tda10023_writebit (state, 0x03, 0xc0, NDEC<<6);
266 tda10023_writereg (state, 0x0a, BDR&255);
267 tda10023_writereg (state, 0x0b, (BDR>>8)&255);
268 tda10023_writereg (state, 0x0c, (BDR>>16)&31);
269 tda10023_writereg (state, 0x0d, BDRI);
270 tda10023_writereg (state, 0x3d, (SFIL<<7));
271 return 0;
272}
273
274static int tda10023_init (struct dvb_frontend *fe)
275{
276 struct tda10023_state* state = fe->demodulator_priv;
277
278 dprintk("DVB: TDA10023(%d): init chip\n", fe->adapter->num);
279
280 tda10023_writetab(state, tda10023_inittab);
281
282 return 0;
283}
284
285static int tda10023_set_parameters (struct dvb_frontend *fe,
286 struct dvb_frontend_parameters *p)
287{
288 struct tda10023_state* state = fe->demodulator_priv;
289
290 static int qamvals[6][6] = {
291 // QAM LOCKTHR MSETH AREF AGCREFNYQ ERAGCNYQ_THD
292 { (5<<2), 0x78, 0x8c, 0x96, 0x78, 0x4c }, // 4 QAM
293 { (0<<2), 0x87, 0xa2, 0x91, 0x8c, 0x57 }, // 16 QAM
294 { (1<<2), 0x64, 0x74, 0x96, 0x8c, 0x57 }, // 32 QAM
295 { (2<<2), 0x46, 0x43, 0x6a, 0x6a, 0x44 }, // 64 QAM
296 { (3<<2), 0x36, 0x34, 0x7e, 0x78, 0x4c }, // 128 QAM
297 { (4<<2), 0x26, 0x23, 0x6c, 0x5c, 0x3c }, // 256 QAM
298 };
299
300 int qam = p->u.qam.modulation;
301
302 if (qam < 0 || qam > 5)
303 return -EINVAL;
304
305 if (fe->ops.tuner_ops.set_params) {
306 fe->ops.tuner_ops.set_params(fe, p);
307 if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 0);
308 }
309
310 tda10023_set_symbolrate (state, p->u.qam.symbol_rate);
311 tda10023_writereg (state, 0x05, qamvals[qam][1]);
312 tda10023_writereg (state, 0x08, qamvals[qam][2]);
313 tda10023_writereg (state, 0x09, qamvals[qam][3]);
314 tda10023_writereg (state, 0xb4, qamvals[qam][4]);
315 tda10023_writereg (state, 0xb6, qamvals[qam][5]);
316
317// tda10023_writereg (state, 0x04, (p->inversion?0x12:0x32));
318// tda10023_writebit (state, 0x04, 0x60, (p->inversion?0:0x20));
319 tda10023_writebit (state, 0x04, 0x40, 0x40);
320 tda10023_setup_reg0 (state, qamvals[qam][0]);
321
322 return 0;
323}
324
325static int tda10023_read_status(struct dvb_frontend* fe, fe_status_t* status)
326{
327 struct tda10023_state* state = fe->demodulator_priv;
328 int sync;
329
330 *status = 0;
331
332 //0x11[1] == CARLOCK -> Carrier locked
333 //0x11[2] == FSYNC -> Frame synchronisation
334 //0x11[3] == FEL -> Front End locked
335 //0x11[6] == NODVB -> DVB Mode Information
336 sync = tda10023_readreg (state, 0x11);
337
338 if (sync & 2)
339 *status |= FE_HAS_SIGNAL|FE_HAS_CARRIER;
340
341 if (sync & 4)
342 *status |= FE_HAS_SYNC|FE_HAS_VITERBI;
343
344 if (sync & 8)
345 *status |= FE_HAS_LOCK;
346
347 return 0;
348}
349
350static int tda10023_read_ber(struct dvb_frontend* fe, u32* ber)
351{
352 struct tda10023_state* state = fe->demodulator_priv;
353 u8 a,b,c;
354 a=tda10023_readreg(state, 0x14);
355 b=tda10023_readreg(state, 0x15);
356 c=tda10023_readreg(state, 0x16)&0xf;
357 tda10023_writebit (state, 0x10, 0xc0, 0x00);
358
359 *ber = a | (b<<8)| (c<<16);
360 return 0;
361}
362
363static int tda10023_read_signal_strength(struct dvb_frontend* fe, u16* strength)
364{
365 struct tda10023_state* state = fe->demodulator_priv;
366 u8 ifgain=tda10023_readreg(state, 0x2f);
367
368 u16 gain = ((255-tda10023_readreg(state, 0x17))) + (255-ifgain)/16;
369 // Max raw value is about 0xb0 -> Normalize to >0xf0 after 0x90
370 if (gain>0x90)
371 gain=gain+2*(gain-0x90);
372 if (gain>255)
373 gain=255;
374
375 *strength = (gain<<8)|gain;
376 return 0;
377}
378
379static int tda10023_read_snr(struct dvb_frontend* fe, u16* snr)
380{
381 struct tda10023_state* state = fe->demodulator_priv;
382
383 u8 quality = ~tda10023_readreg(state, 0x18);
384 *snr = (quality << 8) | quality;
385 return 0;
386}
387
388static int tda10023_read_ucblocks(struct dvb_frontend* fe, u32* ucblocks)
389{
390 struct tda10023_state* state = fe->demodulator_priv;
391 u8 a,b,c,d;
392 a= tda10023_readreg (state, 0x74);
393 b= tda10023_readreg (state, 0x75);
394 c= tda10023_readreg (state, 0x76);
395 d= tda10023_readreg (state, 0x77);
396 *ucblocks = a | (b<<8)|(c<<16)|(d<<24);
397
398 tda10023_writebit (state, 0x10, 0x20,0x00);
399 tda10023_writebit (state, 0x10, 0x20,0x20);
400 tda10023_writebit (state, 0x13, 0x01, 0x00);
401
402 return 0;
403}
404
405static int tda10023_get_frontend(struct dvb_frontend* fe, struct dvb_frontend_parameters *p)
406{
407 struct tda10023_state* state = fe->demodulator_priv;
408 int sync,inv;
409 s8 afc = 0;
410
411 sync = tda10023_readreg(state, 0x11);
412 afc = tda10023_readreg(state, 0x19);
413 inv = tda10023_readreg(state, 0x04);
414
415 if (verbose) {
416 /* AFC only valid when carrier has been recovered */
417 printk(sync & 2 ? "DVB: TDA10023(%d): AFC (%d) %dHz\n" :
418 "DVB: TDA10023(%d): [AFC (%d) %dHz]\n",
419 state->frontend.dvb->num, afc,
420 -((s32)p->u.qam.symbol_rate * afc) >> 10);
421 }
422
423 p->inversion = (inv&0x20?0:1);
424 p->u.qam.modulation = ((state->reg0 >> 2) & 7) + QAM_16;
425
426 p->u.qam.fec_inner = FEC_NONE;
427 p->frequency = ((p->frequency + 31250) / 62500) * 62500;
428
429 if (sync & 2)
430 p->frequency -= ((s32)p->u.qam.symbol_rate * afc) >> 10;
431
432 return 0;
433}
434
435static int tda10023_sleep(struct dvb_frontend* fe)
436{
437 struct tda10023_state* state = fe->demodulator_priv;
438
439 tda10023_writereg (state, 0x1b, 0x02); /* pdown ADC */
440 tda10023_writereg (state, 0x00, 0x80); /* standby */
441
442 return 0;
443}
444
445static int tda10023_i2c_gate_ctrl(struct dvb_frontend* fe, int enable)
446{
447 struct tda10023_state* state = fe->demodulator_priv;
448
449 if (enable) {
450 lock_tuner(state);
451 } else {
452 unlock_tuner(state);
453 }
454 return 0;
455}
456
457static void tda10023_release(struct dvb_frontend* fe)
458{
459 struct tda10023_state* state = fe->demodulator_priv;
460 kfree(state);
461}
462
463static struct dvb_frontend_ops tda10023_ops;
464
465struct dvb_frontend* tda10023_attach(const struct tda1002x_config* config,
466 struct i2c_adapter* i2c,
467 u8 pwm)
468{
469 struct tda10023_state* state = NULL;
470 int i;
471
472 /* allocate memory for the internal state */
473 state = kmalloc(sizeof(struct tda10023_state), GFP_KERNEL);
474 if (state == NULL) goto error;
475
476 /* setup the state */
477 state->config = config;
478 state->i2c = i2c;
479 memcpy(&state->frontend.ops, &tda10023_ops, sizeof(struct dvb_frontend_ops));
480 state->pwm = pwm;
481 for (i=0; i < sizeof(tda10023_inittab)/sizeof(*tda10023_inittab);i+=3) {
482 if (tda10023_inittab[i] == 0x00) {
483 state->reg0 = tda10023_inittab[i+2];
484 break;
485 }
486 }
487
488 // Wakeup if in standby
489 tda10023_writereg (state, 0x00, 0x33);
490 /* check if the demod is there */
491 if ((tda10023_readreg(state, 0x1a) & 0xf0) != 0x70) goto error;
492
493 /* create dvb_frontend */
494 memcpy(&state->frontend.ops, &tda10023_ops, sizeof(struct dvb_frontend_ops));
495 state->frontend.demodulator_priv = state;
496 return &state->frontend;
497
498error:
499 kfree(state);
500 return NULL;
501}
502
503static struct dvb_frontend_ops tda10023_ops = {
504
505 .info = {
506 .name = "Philips TDA10023 DVB-C",
507 .type = FE_QAM,
508 .frequency_stepsize = 62500,
509 .frequency_min = 51000000,
510 .frequency_max = 858000000,
511 .symbol_rate_min = (SYSCLK/2)/64, /* SACLK/64 == (SYSCLK/2)/64 */
512 .symbol_rate_max = (SYSCLK/2)/4, /* SACLK/4 */
513 .caps = 0x400 | //FE_CAN_QAM_4
514 FE_CAN_QAM_16 | FE_CAN_QAM_32 | FE_CAN_QAM_64 |
515 FE_CAN_QAM_128 | FE_CAN_QAM_256 |
516 FE_CAN_FEC_AUTO
517 },
518
519 .release = tda10023_release,
520
521 .init = tda10023_init,
522 .sleep = tda10023_sleep,
523 .i2c_gate_ctrl = tda10023_i2c_gate_ctrl,
524
525 .set_frontend = tda10023_set_parameters,
526 .get_frontend = tda10023_get_frontend,
527
528 .read_status = tda10023_read_status,
529 .read_ber = tda10023_read_ber,
530 .read_signal_strength = tda10023_read_signal_strength,
531 .read_snr = tda10023_read_snr,
532 .read_ucblocks = tda10023_read_ucblocks,
533};
534
535
536MODULE_DESCRIPTION("Philips TDA10023 DVB-C demodulator driver");
537MODULE_AUTHOR("Georg Acher, Hartmut Birr");
538MODULE_LICENSE("GPL");
539
540EXPORT_SYMBOL(tda10023_attach);
diff --git a/drivers/media/dvb/frontends/tda10021.h b/drivers/media/dvb/frontends/tda1002x.h
index b8efd498d4bf..484935986c54 100644
--- a/drivers/media/dvb/frontends/tda10021.h
+++ b/drivers/media/dvb/frontends/tda1002x.h
@@ -1,6 +1,6 @@
1/* 1/*
2 TDA10021 - Single Chip Cable Channel Receiver driver module 2 TDA10021/TDA10023 - Single Chip Cable Channel Receiver driver module
3 used on the the Siemens DVB-C cards 3 used on the the Siemens DVB-C cards
4 4
5 Copyright (C) 1999 Convergence Integrated Media GmbH <ralph@convergence.de> 5 Copyright (C) 1999 Convergence Integrated Media GmbH <ralph@convergence.de>
6 Copyright (C) 2004 Markus Schulz <msc@antzsystem.de> 6 Copyright (C) 2004 Markus Schulz <msc@antzsystem.de>
@@ -21,22 +21,22 @@
21 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 21 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22*/ 22*/
23 23
24#ifndef TDA10021_H 24#ifndef TDA1002x_H
25#define TDA10021_H 25#define TDA1002x_H
26 26
27#include <linux/dvb/frontend.h> 27#include <linux/dvb/frontend.h>
28 28
29struct tda10021_config 29struct tda1002x_config
30{ 30{
31 /* the demodulator's i2c address */ 31 /* the demodulator's i2c address */
32 u8 demod_address; 32 u8 demod_address;
33}; 33};
34 34
35#if defined(CONFIG_DVB_TDA10021) || (defined(CONFIG_DVB_TDA10021_MODULE) && defined(MODULE)) 35#if defined(CONFIG_DVB_TDA10021) || (defined(CONFIG_DVB_TDA10021_MODULE) && defined(MODULE))
36extern struct dvb_frontend* tda10021_attach(const struct tda10021_config* config, 36extern struct dvb_frontend* tda10021_attach(const struct tda1002x_config* config,
37 struct i2c_adapter* i2c, u8 pwm); 37 struct i2c_adapter* i2c, u8 pwm);
38#else 38#else
39static inline struct dvb_frontend* tda10021_attach(const struct tda10021_config* config, 39static inline struct dvb_frontend* tda10021_attach(const struct tda1002x_config* config,
40 struct i2c_adapter* i2c, u8 pwm) 40 struct i2c_adapter* i2c, u8 pwm)
41{ 41{
42 printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __FUNCTION__); 42 printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __FUNCTION__);
@@ -44,4 +44,16 @@ static inline struct dvb_frontend* tda10021_attach(const struct tda10021_config*
44} 44}
45#endif // CONFIG_DVB_TDA10021 45#endif // CONFIG_DVB_TDA10021
46 46
47#endif // TDA10021_H 47#if defined(CONFIG_DVB_TDA10023) || (defined(CONFIG_DVB_TDA10023_MODULE) && defined(MODULE))
48extern struct dvb_frontend* tda10023_attach(const struct tda1002x_config* config,
49 struct i2c_adapter* i2c, u8 pwm);
50#else
51static inline struct dvb_frontend* tda10023_attach(const struct tda1002x_config* config,
52 struct i2c_adapter* i2c, u8 pwm)
53{
54 printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __FUNCTION__);
55 return NULL;
56}
57#endif // CONFIG_DVB_TDA10023
58
59#endif // TDA1002x_H
diff --git a/drivers/media/dvb/ttpci/Kconfig b/drivers/media/dvb/ttpci/Kconfig
index 3cd319ff0e68..7751628e1415 100644
--- a/drivers/media/dvb/ttpci/Kconfig
+++ b/drivers/media/dvb/ttpci/Kconfig
@@ -67,6 +67,7 @@ config DVB_BUDGET
67 select DVB_L64781 if !DVB_FE_CUSTOMISE 67 select DVB_L64781 if !DVB_FE_CUSTOMISE
68 select DVB_TDA8083 if !DVB_FE_CUSTOMISE 68 select DVB_TDA8083 if !DVB_FE_CUSTOMISE
69 select DVB_TDA10021 if !DVB_FE_CUSTOMISE 69 select DVB_TDA10021 if !DVB_FE_CUSTOMISE
70 select DVB_TDA10023 if !DVB_FE_CUSTOMISE
70 select DVB_S5H1420 if !DVB_FE_CUSTOMISE 71 select DVB_S5H1420 if !DVB_FE_CUSTOMISE
71 select DVB_TDA10086 if !DVB_FE_CUSTOMISE 72 select DVB_TDA10086 if !DVB_FE_CUSTOMISE
72 select DVB_TDA826X if !DVB_FE_CUSTOMISE 73 select DVB_TDA826X if !DVB_FE_CUSTOMISE
@@ -111,6 +112,7 @@ config DVB_BUDGET_AV
111 select DVB_STV0299 if !DVB_FE_CUSTOMISE 112 select DVB_STV0299 if !DVB_FE_CUSTOMISE
112 select DVB_TDA1004X if !DVB_FE_CUSTOMISE 113 select DVB_TDA1004X if !DVB_FE_CUSTOMISE
113 select DVB_TDA10021 if !DVB_FE_CUSTOMISE 114 select DVB_TDA10021 if !DVB_FE_CUSTOMISE
115 select DVB_TDA10023 if !DVB_FE_CUSTOMISE
114 select DVB_TUA6100 if !DVB_FE_CUSTOMISE 116 select DVB_TUA6100 if !DVB_FE_CUSTOMISE
115 select FW_LOADER 117 select FW_LOADER
116 help 118 help
diff --git a/drivers/media/dvb/ttpci/budget-av.c b/drivers/media/dvb/ttpci/budget-av.c
index 54ca3a3288e7..5680aa57c93e 100644
--- a/drivers/media/dvb/ttpci/budget-av.c
+++ b/drivers/media/dvb/ttpci/budget-av.c
@@ -35,7 +35,7 @@
35 35
36#include "budget.h" 36#include "budget.h"
37#include "stv0299.h" 37#include "stv0299.h"
38#include "tda10021.h" 38#include "tda1002x.h"
39#include "tda1004x.h" 39#include "tda1004x.h"
40#include "tua6100.h" 40#include "tua6100.h"
41#include "dvb-pll.h" 41#include "dvb-pll.h"
@@ -611,37 +611,60 @@ static struct stv0299_config cinergy_1200s_1894_0010_config = {
611static int philips_cu1216_tuner_set_params(struct dvb_frontend *fe, struct dvb_frontend_parameters *params) 611static int philips_cu1216_tuner_set_params(struct dvb_frontend *fe, struct dvb_frontend_parameters *params)
612{ 612{
613 struct budget *budget = (struct budget *) fe->dvb->priv; 613 struct budget *budget = (struct budget *) fe->dvb->priv;
614 u8 buf[4]; 614 u8 buf[6];
615 struct i2c_msg msg = {.addr = 0x60,.flags = 0,.buf = buf,.len = sizeof(buf) }; 615 struct i2c_msg msg = {.addr = 0x60,.flags = 0,.buf = buf,.len = sizeof(buf) };
616 int i;
616 617
618#define CU1216_IF 36125000
617#define TUNER_MUL 62500 619#define TUNER_MUL 62500
618 620
619 u32 div = (params->frequency + 36125000 + TUNER_MUL / 2) / TUNER_MUL; 621 u32 div = (params->frequency + CU1216_IF + TUNER_MUL / 2) / TUNER_MUL;
620 622
621 buf[0] = (div >> 8) & 0x7f; 623 buf[0] = (div >> 8) & 0x7f;
622 buf[1] = div & 0xff; 624 buf[1] = div & 0xff;
623 buf[2] = 0x86; 625 buf[2] = 0xce;
624 buf[3] = (params->frequency < 150000000 ? 0x01 : 626 buf[3] = (params->frequency < 150000000 ? 0x01 :
625 params->frequency < 445000000 ? 0x02 : 0x04); 627 params->frequency < 445000000 ? 0x02 : 0x04);
628 buf[4] = 0xde;
629 buf[5] = 0x20;
626 630
627 if (fe->ops.i2c_gate_ctrl) 631 if (fe->ops.i2c_gate_ctrl)
628 fe->ops.i2c_gate_ctrl(fe, 1); 632 fe->ops.i2c_gate_ctrl(fe, 1);
629 if (i2c_transfer(&budget->i2c_adap, &msg, 1) != 1) 633 if (i2c_transfer(&budget->i2c_adap, &msg, 1) != 1)
630 return -EIO; 634 return -EIO;
635
636 /* wait for the pll lock */
637 msg.flags = I2C_M_RD;
638 msg.len = 1;
639 for (i = 0; i < 20; i++) {
640 if (fe->ops.i2c_gate_ctrl)
641 fe->ops.i2c_gate_ctrl(fe, 1);
642 if (i2c_transfer(&budget->i2c_adap, &msg, 1) == 1 && (buf[0] & 0x40))
643 break;
644 msleep(10);
645 }
646
647 /* switch the charge pump to the lower current */
648 msg.flags = 0;
649 msg.len = 2;
650 msg.buf = &buf[2];
651 buf[2] &= ~0x40;
652 if (fe->ops.i2c_gate_ctrl)
653 fe->ops.i2c_gate_ctrl(fe, 1);
654 if (i2c_transfer(&budget->i2c_adap, &msg, 1) != 1)
655 return -EIO;
656
631 return 0; 657 return 0;
632} 658}
633 659
634static struct tda10021_config philips_cu1216_config = { 660static struct tda1002x_config philips_cu1216_config = {
635 .demod_address = 0x0c, 661 .demod_address = 0x0c,
636}; 662};
637 663
638static struct tda10021_config philips_cu1216_config_altaddress = { 664static struct tda1002x_config philips_cu1216_config_altaddress = {
639 .demod_address = 0x0d, 665 .demod_address = 0x0d,
640}; 666};
641 667
642
643
644
645static int philips_tu1216_tuner_init(struct dvb_frontend *fe) 668static int philips_tu1216_tuner_init(struct dvb_frontend *fe)
646{ 669{
647 struct budget *budget = (struct budget *) fe->dvb->priv; 670 struct budget *budget = (struct budget *) fe->dvb->priv;
@@ -888,24 +911,28 @@ static u8 read_pwm(struct budget_av *budget_av)
888 return pwm; 911 return pwm;
889} 912}
890 913
891#define SUBID_DVBS_KNC1 0x0010 914#define SUBID_DVBS_KNC1 0x0010
892#define SUBID_DVBS_KNC1_PLUS 0x0011 915#define SUBID_DVBS_KNC1_PLUS 0x0011
893#define SUBID_DVBS_TYPHOON 0x4f56 916#define SUBID_DVBS_TYPHOON 0x4f56
894#define SUBID_DVBS_CINERGY1200 0x1154 917#define SUBID_DVBS_CINERGY1200 0x1154
895#define SUBID_DVBS_CYNERGY1200N 0x1155 918#define SUBID_DVBS_CYNERGY1200N 0x1155
896 919#define SUBID_DVBS_TV_STAR 0x0014
897#define SUBID_DVBS_TV_STAR 0x0014 920#define SUBID_DVBS_TV_STAR_CI 0x0016
898#define SUBID_DVBS_TV_STAR_CI 0x0016 921#define SUBID_DVBS_EASYWATCH_1 0x001a
899#define SUBID_DVBS_EASYWATCH_1 0x001a 922#define SUBID_DVBS_EASYWATCH 0x001e
900#define SUBID_DVBS_EASYWATCH 0x001e 923
901#define SUBID_DVBC_EASYWATCH 0x002a 924#define SUBID_DVBC_EASYWATCH 0x002a
902#define SUBID_DVBC_KNC1 0x0020 925#define SUBID_DVBC_EASYWATCH_MK3 0x002c
903#define SUBID_DVBC_KNC1_PLUS 0x0021 926#define SUBID_DVBC_KNC1 0x0020
904#define SUBID_DVBC_CINERGY1200 0x1156 927#define SUBID_DVBC_KNC1_PLUS 0x0021
905 928#define SUBID_DVBC_KNC1_MK3 0x0022
906#define SUBID_DVBT_KNC1_PLUS 0x0031 929#define SUBID_DVBC_KNC1_PLUS_MK3 0x0023
907#define SUBID_DVBT_KNC1 0x0030 930#define SUBID_DVBC_CINERGY1200 0x1156
908#define SUBID_DVBT_CINERGY1200 0x1157 931#define SUBID_DVBC_CINERGY1200_MK3 0x1176
932
933#define SUBID_DVBT_KNC1_PLUS 0x0031
934#define SUBID_DVBT_KNC1 0x0030
935#define SUBID_DVBT_CINERGY1200 0x1157
909 936
910static void frontend_init(struct budget_av *budget_av) 937static void frontend_init(struct budget_av *budget_av)
911{ 938{
@@ -924,6 +951,7 @@ static void frontend_init(struct budget_av *budget_av)
924 case SUBID_DVBC_KNC1_PLUS: 951 case SUBID_DVBC_KNC1_PLUS:
925 case SUBID_DVBT_KNC1_PLUS: 952 case SUBID_DVBT_KNC1_PLUS:
926 case SUBID_DVBC_EASYWATCH: 953 case SUBID_DVBC_EASYWATCH:
954 case SUBID_DVBC_KNC1_PLUS_MK3:
927 saa7146_setgpio(saa, 3, SAA7146_GPIO_OUTHI); 955 saa7146_setgpio(saa, 3, SAA7146_GPIO_OUTHI);
928 break; 956 break;
929 } 957 }
@@ -980,6 +1008,7 @@ static void frontend_init(struct budget_av *budget_av)
980 case SUBID_DVBC_CINERGY1200: 1008 case SUBID_DVBC_CINERGY1200:
981 case SUBID_DVBC_EASYWATCH: 1009 case SUBID_DVBC_EASYWATCH:
982 budget_av->reinitialise_demod = 1; 1010 budget_av->reinitialise_demod = 1;
1011 budget_av->budget.dev->i2c_bitrate = SAA7146_I2C_BUS_BIT_RATE_240;
983 fe = dvb_attach(tda10021_attach, &philips_cu1216_config, 1012 fe = dvb_attach(tda10021_attach, &philips_cu1216_config,
984 &budget_av->budget.i2c_adap, 1013 &budget_av->budget.i2c_adap,
985 read_pwm(budget_av)); 1014 read_pwm(budget_av));
@@ -992,6 +1021,20 @@ static void frontend_init(struct budget_av *budget_av)
992 } 1021 }
993 break; 1022 break;
994 1023
1024 case SUBID_DVBC_EASYWATCH_MK3:
1025 case SUBID_DVBC_CINERGY1200_MK3:
1026 case SUBID_DVBC_KNC1_MK3:
1027 case SUBID_DVBC_KNC1_PLUS_MK3:
1028 budget_av->reinitialise_demod = 1;
1029 budget_av->budget.dev->i2c_bitrate = SAA7146_I2C_BUS_BIT_RATE_240;
1030 fe = dvb_attach(tda10023_attach, &philips_cu1216_config,
1031 &budget_av->budget.i2c_adap,
1032 read_pwm(budget_av));
1033 if (fe) {
1034 fe->ops.tuner_ops.set_params = philips_cu1216_tuner_set_params;
1035 }
1036 break;
1037
995 case SUBID_DVBT_KNC1: 1038 case SUBID_DVBT_KNC1:
996 case SUBID_DVBT_KNC1_PLUS: 1039 case SUBID_DVBT_KNC1_PLUS:
997 case SUBID_DVBT_CINERGY1200: 1040 case SUBID_DVBT_CINERGY1200:
@@ -1220,12 +1263,16 @@ MAKE_BUDGET_INFO(kncxs, "KNC TV STAR DVB-S", BUDGET_TVSTAR);
1220MAKE_BUDGET_INFO(satewpls, "Satelco EasyWatch DVB-S light", BUDGET_TVSTAR); 1263MAKE_BUDGET_INFO(satewpls, "Satelco EasyWatch DVB-S light", BUDGET_TVSTAR);
1221MAKE_BUDGET_INFO(satewpls1, "Satelco EasyWatch DVB-S light", BUDGET_KNC1S); 1264MAKE_BUDGET_INFO(satewpls1, "Satelco EasyWatch DVB-S light", BUDGET_KNC1S);
1222MAKE_BUDGET_INFO(satewplc, "Satelco EasyWatch DVB-C", BUDGET_KNC1CP); 1265MAKE_BUDGET_INFO(satewplc, "Satelco EasyWatch DVB-C", BUDGET_KNC1CP);
1266MAKE_BUDGET_INFO(satewcmk3, "Satelco EasyWatch DVB-C MK3", BUDGET_KNC1C_MK3);
1223MAKE_BUDGET_INFO(knc1sp, "KNC1 DVB-S Plus", BUDGET_KNC1SP); 1267MAKE_BUDGET_INFO(knc1sp, "KNC1 DVB-S Plus", BUDGET_KNC1SP);
1224MAKE_BUDGET_INFO(knc1cp, "KNC1 DVB-C Plus", BUDGET_KNC1CP); 1268MAKE_BUDGET_INFO(knc1cp, "KNC1 DVB-C Plus", BUDGET_KNC1CP);
1269MAKE_BUDGET_INFO(knc1cmk3, "KNC1 DVB-C MK3", BUDGET_KNC1C_MK3);
1270MAKE_BUDGET_INFO(knc1cpmk3, "KNC1 DVB-C Plus MK3", BUDGET_KNC1CP_MK3);
1225MAKE_BUDGET_INFO(knc1tp, "KNC1 DVB-T Plus", BUDGET_KNC1TP); 1271MAKE_BUDGET_INFO(knc1tp, "KNC1 DVB-T Plus", BUDGET_KNC1TP);
1226MAKE_BUDGET_INFO(cin1200s, "TerraTec Cinergy 1200 DVB-S", BUDGET_CIN1200S); 1272MAKE_BUDGET_INFO(cin1200s, "TerraTec Cinergy 1200 DVB-S", BUDGET_CIN1200S);
1227MAKE_BUDGET_INFO(cin1200sn, "TerraTec Cinergy 1200 DVB-S", BUDGET_CIN1200S); 1273MAKE_BUDGET_INFO(cin1200sn, "TerraTec Cinergy 1200 DVB-S", BUDGET_CIN1200S);
1228MAKE_BUDGET_INFO(cin1200c, "Terratec Cinergy 1200 DVB-C", BUDGET_CIN1200C); 1274MAKE_BUDGET_INFO(cin1200c, "Terratec Cinergy 1200 DVB-C", BUDGET_CIN1200C);
1275MAKE_BUDGET_INFO(cin1200cmk3, "Terratec Cinergy 1200 DVB-C MK3", BUDGET_CIN1200C_MK3);
1229MAKE_BUDGET_INFO(cin1200t, "Terratec Cinergy 1200 DVB-T", BUDGET_CIN1200T); 1276MAKE_BUDGET_INFO(cin1200t, "Terratec Cinergy 1200 DVB-T", BUDGET_CIN1200T);
1230 1277
1231static struct pci_device_id pci_tbl[] = { 1278static struct pci_device_id pci_tbl[] = {
@@ -1239,13 +1286,17 @@ static struct pci_device_id pci_tbl[] = {
1239 MAKE_EXTENSION_PCI(satewpls, 0x1894, 0x001e), 1286 MAKE_EXTENSION_PCI(satewpls, 0x1894, 0x001e),
1240 MAKE_EXTENSION_PCI(satewpls1, 0x1894, 0x001a), 1287 MAKE_EXTENSION_PCI(satewpls1, 0x1894, 0x001a),
1241 MAKE_EXTENSION_PCI(satewplc, 0x1894, 0x002a), 1288 MAKE_EXTENSION_PCI(satewplc, 0x1894, 0x002a),
1289 MAKE_EXTENSION_PCI(satewcmk3, 0x1894, 0x002c),
1242 MAKE_EXTENSION_PCI(knc1c, 0x1894, 0x0020), 1290 MAKE_EXTENSION_PCI(knc1c, 0x1894, 0x0020),
1243 MAKE_EXTENSION_PCI(knc1cp, 0x1894, 0x0021), 1291 MAKE_EXTENSION_PCI(knc1cp, 0x1894, 0x0021),
1292 MAKE_EXTENSION_PCI(knc1cmk3, 0x1894, 0x0022),
1293 MAKE_EXTENSION_PCI(knc1cpmk3, 0x1894, 0x0023),
1244 MAKE_EXTENSION_PCI(knc1t, 0x1894, 0x0030), 1294 MAKE_EXTENSION_PCI(knc1t, 0x1894, 0x0030),
1245 MAKE_EXTENSION_PCI(knc1tp, 0x1894, 0x0031), 1295 MAKE_EXTENSION_PCI(knc1tp, 0x1894, 0x0031),
1246 MAKE_EXTENSION_PCI(cin1200s, 0x153b, 0x1154), 1296 MAKE_EXTENSION_PCI(cin1200s, 0x153b, 0x1154),
1247 MAKE_EXTENSION_PCI(cin1200sn, 0x153b, 0x1155), 1297 MAKE_EXTENSION_PCI(cin1200sn, 0x153b, 0x1155),
1248 MAKE_EXTENSION_PCI(cin1200c, 0x153b, 0x1156), 1298 MAKE_EXTENSION_PCI(cin1200c, 0x153b, 0x1156),
1299 MAKE_EXTENSION_PCI(cin1200cmk3, 0x153b, 0x1176),
1249 MAKE_EXTENSION_PCI(cin1200t, 0x153b, 0x1157), 1300 MAKE_EXTENSION_PCI(cin1200t, 0x153b, 0x1157),
1250 { 1301 {
1251 .vendor = 0, 1302 .vendor = 0,
diff --git a/drivers/media/dvb/ttpci/budget-core.c b/drivers/media/dvb/ttpci/budget-core.c
index cef9d8d8a122..6b97dc1e6b65 100644
--- a/drivers/media/dvb/ttpci/budget-core.c
+++ b/drivers/media/dvb/ttpci/budget-core.c
@@ -109,6 +109,19 @@ static int start_ts_capture(struct budget *budget)
109 saa7146_write(dev, MC2, (MASK_10 | MASK_26)); 109 saa7146_write(dev, MC2, (MASK_10 | MASK_26));
110 saa7146_write(dev, BRS_CTRL, 0x60000000); 110 saa7146_write(dev, BRS_CTRL, 0x60000000);
111 break; 111 break;
112 case BUDGET_CIN1200C_MK3:
113 case BUDGET_KNC1C_MK3:
114 case BUDGET_KNC1CP_MK3:
115 if (budget->video_port == BUDGET_VIDEO_PORTA) {
116 saa7146_write(dev, DD1_INIT, 0x06000200);
117 saa7146_write(dev, MC2, (MASK_09 | MASK_25 | MASK_10 | MASK_26));
118 saa7146_write(dev, BRS_CTRL, 0x00000000);
119 } else {
120 saa7146_write(dev, DD1_INIT, 0x00000600);
121 saa7146_write(dev, MC2, (MASK_09 | MASK_25 | MASK_10 | MASK_26));
122 saa7146_write(dev, BRS_CTRL, 0x60000000);
123 }
124 break;
112 default: 125 default:
113 if (budget->video_port == BUDGET_VIDEO_PORTA) { 126 if (budget->video_port == BUDGET_VIDEO_PORTA) {
114 saa7146_write(dev, DD1_INIT, 0x06000200); 127 saa7146_write(dev, DD1_INIT, 0x06000200);
@@ -418,6 +431,9 @@ int ttpci_budget_init(struct budget *budget, struct saa7146_dev *dev,
418 case BUDGET_KNC1C: 431 case BUDGET_KNC1C:
419 case BUDGET_KNC1CP: 432 case BUDGET_KNC1CP:
420 case BUDGET_CIN1200C: 433 case BUDGET_CIN1200C:
434 case BUDGET_KNC1C_MK3:
435 case BUDGET_KNC1CP_MK3:
436 case BUDGET_CIN1200C_MK3:
421 budget->buffer_width = TS_WIDTH_DVBC; 437 budget->buffer_width = TS_WIDTH_DVBC;
422 max_bufsize = TS_MAX_BUFSIZE_K_DVBC; 438 max_bufsize = TS_MAX_BUFSIZE_K_DVBC;
423 height_mask = TS_HEIGHT_MASK_DVBC; 439 height_mask = TS_HEIGHT_MASK_DVBC;
diff --git a/drivers/media/dvb/ttpci/budget.h b/drivers/media/dvb/ttpci/budget.h
index e8a5c79178e1..d764ffa728b0 100644
--- a/drivers/media/dvb/ttpci/budget.h
+++ b/drivers/media/dvb/ttpci/budget.h
@@ -99,6 +99,9 @@ static struct saa7146_pci_extension_data x_var = { \
99#define BUDGET_KNC1CP 12 99#define BUDGET_KNC1CP 12
100#define BUDGET_KNC1TP 13 100#define BUDGET_KNC1TP 13
101#define BUDGET_TVSTAR 14 101#define BUDGET_TVSTAR 14
102#define BUDGET_CIN1200C_MK3 15
103#define BUDGET_KNC1C_MK3 16
104#define BUDGET_KNC1CP_MK3 17
102 105
103#define BUDGET_VIDEO_PORTA 0 106#define BUDGET_VIDEO_PORTA 0
104#define BUDGET_VIDEO_PORTB 1 107#define BUDGET_VIDEO_PORTB 1