aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
authorAndrew de Quincey <adq_dvb@lidskialf.net>2006-08-08 08:10:08 -0400
committerMauro Carvalho Chehab <mchehab@infradead.org>2006-09-26 10:53:24 -0400
commitc10d14d62d7b7596fd5c7bb8aad3f2b56f8640e6 (patch)
treef66723500fbc0414742f14411cd64dd6d9a336a0 /drivers/media
parent13fef9335f4fe2a73e1733f8807e69711736faef (diff)
V4L/DVB (4384): Remove remaining static function calls
Rewrote _write() calls to use write() op. Signed-off-by: Andrew de Quincey <adq_dvb@lidskialf.net> Acked-by: Michael Krufky <mkrufky@linuxtv.org> Acked-by: Trent Piepho <xyzzy@speakeasy.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/dvb/frontends/cx24110.c17
-rw-r--r--drivers/media/dvb/frontends/cx24110.h8
-rw-r--r--drivers/media/dvb/frontends/mt352.c16
-rw-r--r--drivers/media/dvb/frontends/mt352.h7
-rw-r--r--drivers/media/dvb/frontends/stv0299.c9
-rw-r--r--drivers/media/dvb/frontends/stv0299.h10
-rw-r--r--drivers/media/dvb/frontends/tda10021.c63
-rw-r--r--drivers/media/dvb/frontends/tda10021.h8
-rw-r--r--drivers/media/dvb/frontends/tda1004x.c22
-rw-r--r--drivers/media/dvb/frontends/tda1004x.h8
-rw-r--r--drivers/media/dvb/frontends/zl10353.c3
-rw-r--r--drivers/media/dvb/frontends/zl10353.h2
-rw-r--r--drivers/media/dvb/ttpci/budget-ci.c6
-rw-r--r--drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c6
14 files changed, 114 insertions, 71 deletions
diff --git a/drivers/media/dvb/frontends/cx24110.c b/drivers/media/dvb/frontends/cx24110.c
index ce3c7398bac9..ae96395217a2 100644
--- a/drivers/media/dvb/frontends/cx24110.c
+++ b/drivers/media/dvb/frontends/cx24110.c
@@ -1,4 +1,4 @@
1/* 1 /*
2 cx24110 - Single Chip Satellite Channel Receiver driver module 2 cx24110 - Single Chip Satellite Channel Receiver driver module
3 3
4 Copyright (C) 2002 Peter Hettkamp <peter.hettkamp@htp-tel.de> based on 4 Copyright (C) 2002 Peter Hettkamp <peter.hettkamp@htp-tel.de> based on
@@ -311,16 +311,17 @@ static int cx24110_set_symbolrate (struct cx24110_state* state, u32 srate)
311 311
312} 312}
313 313
314int cx24110_pll_write (struct dvb_frontend* fe, u32 data) 314static int _cx24110_pll_write (struct dvb_frontend* fe, u8 *buf, int len)
315{ 315{
316 struct cx24110_state *state = fe->demodulator_priv; 316 struct cx24110_state *state = fe->demodulator_priv;
317 317
318 if (len != 3)
319 return -EINVAL;
320
318/* tuner data is 21 bits long, must be left-aligned in data */ 321/* tuner data is 21 bits long, must be left-aligned in data */
319/* tuner cx24108 is written through a dedicated 3wire interface on the demod chip */ 322/* tuner cx24108 is written through a dedicated 3wire interface on the demod chip */
320/* FIXME (low): add error handling, avoid infinite loops if HW fails... */ 323/* FIXME (low): add error handling, avoid infinite loops if HW fails... */
321 324
322 dprintk("cx24110 debug: cx24108_write(%8.8x)\n",data);
323
324 cx24110_writereg(state,0x6d,0x30); /* auto mode at 62kHz */ 325 cx24110_writereg(state,0x6d,0x30); /* auto mode at 62kHz */
325 cx24110_writereg(state,0x70,0x15); /* auto mode 21 bits */ 326 cx24110_writereg(state,0x70,0x15); /* auto mode 21 bits */
326 327
@@ -329,19 +330,19 @@ int cx24110_pll_write (struct dvb_frontend* fe, u32 data)
329 cx24110_writereg(state,0x72,0); 330 cx24110_writereg(state,0x72,0);
330 331
331 /* write the topmost 8 bits */ 332 /* write the topmost 8 bits */
332 cx24110_writereg(state,0x72,(data>>24)&0xff); 333 cx24110_writereg(state,0x72,buf[0]);
333 334
334 /* wait for the send to be completed */ 335 /* wait for the send to be completed */
335 while ((cx24110_readreg(state,0x6d)&0xc0)==0x80) 336 while ((cx24110_readreg(state,0x6d)&0xc0)==0x80)
336 ; 337 ;
337 338
338 /* send another 8 bytes */ 339 /* send another 8 bytes */
339 cx24110_writereg(state,0x72,(data>>16)&0xff); 340 cx24110_writereg(state,0x72,buf[1]);
340 while ((cx24110_readreg(state,0x6d)&0xc0)==0x80) 341 while ((cx24110_readreg(state,0x6d)&0xc0)==0x80)
341 ; 342 ;
342 343
343 /* and the topmost 5 bits of this byte */ 344 /* and the topmost 5 bits of this byte */
344 cx24110_writereg(state,0x72,(data>>8)&0xff); 345 cx24110_writereg(state,0x72,buf[2]);
345 while ((cx24110_readreg(state,0x6d)&0xc0)==0x80) 346 while ((cx24110_readreg(state,0x6d)&0xc0)==0x80)
346 ; 347 ;
347 348
@@ -642,6 +643,7 @@ static struct dvb_frontend_ops cx24110_ops = {
642 .release = cx24110_release, 643 .release = cx24110_release,
643 644
644 .init = cx24110_initfe, 645 .init = cx24110_initfe,
646 .write = _cx24110_pll_write,
645 .set_frontend = cx24110_set_frontend, 647 .set_frontend = cx24110_set_frontend,
646 .get_frontend = cx24110_get_frontend, 648 .get_frontend = cx24110_get_frontend,
647 .read_status = cx24110_read_status, 649 .read_status = cx24110_read_status,
@@ -664,4 +666,3 @@ MODULE_AUTHOR("Peter Hettkamp");
664MODULE_LICENSE("GPL"); 666MODULE_LICENSE("GPL");
665 667
666EXPORT_SYMBOL(cx24110_attach); 668EXPORT_SYMBOL(cx24110_attach);
667EXPORT_SYMBOL(cx24110_pll_write);
diff --git a/drivers/media/dvb/frontends/cx24110.h b/drivers/media/dvb/frontends/cx24110.h
index b354a64e0e74..9c2b76e784f3 100644
--- a/drivers/media/dvb/frontends/cx24110.h
+++ b/drivers/media/dvb/frontends/cx24110.h
@@ -36,6 +36,12 @@ struct cx24110_config
36extern struct dvb_frontend* cx24110_attach(const struct cx24110_config* config, 36extern struct dvb_frontend* cx24110_attach(const struct cx24110_config* config,
37 struct i2c_adapter* i2c); 37 struct i2c_adapter* i2c);
38 38
39extern int cx24110_pll_write(struct dvb_frontend* fe, u32 data); 39static inline int cx24110_pll_write(struct dvb_frontend *fe, u32 val) {
40 int r = 0;
41 u8 buf[] = {(u8) (val>>24), (u8) (val>>16), (u8) (val>>8)};
42 if (fe->ops.write)
43 r = fe->ops.write(fe, buf, 3);
44 return r;
45}
40 46
41#endif // CX24110_H 47#endif // CX24110_H
diff --git a/drivers/media/dvb/frontends/mt352.c b/drivers/media/dvb/frontends/mt352.c
index 5de7376c94ce..87e31ca7e108 100644
--- a/drivers/media/dvb/frontends/mt352.c
+++ b/drivers/media/dvb/frontends/mt352.c
@@ -70,7 +70,7 @@ static int mt352_single_write(struct dvb_frontend *fe, u8 reg, u8 val)
70 return 0; 70 return 0;
71} 71}
72 72
73int mt352_write(struct dvb_frontend* fe, u8* ibuf, int ilen) 73static int _mt352_write(struct dvb_frontend* fe, u8* ibuf, int ilen)
74{ 74{
75 int err,i; 75 int err,i;
76 for (i=0; i < ilen-1; i++) 76 for (i=0; i < ilen-1; i++)
@@ -107,7 +107,7 @@ static int mt352_sleep(struct dvb_frontend* fe)
107{ 107{
108 static u8 mt352_softdown[] = { CLOCK_CTL, 0x20, 0x08 }; 108 static u8 mt352_softdown[] = { CLOCK_CTL, 0x20, 0x08 };
109 109
110 mt352_write(fe, mt352_softdown, sizeof(mt352_softdown)); 110 _mt352_write(fe, mt352_softdown, sizeof(mt352_softdown));
111 return 0; 111 return 0;
112} 112}
113 113
@@ -293,14 +293,14 @@ static int mt352_set_parameters(struct dvb_frontend* fe,
293 fe->ops.i2c_gate_ctrl(fe, 0); 293 fe->ops.i2c_gate_ctrl(fe, 0);
294 } 294 }
295 295
296 mt352_write(fe, buf, 8); 296 _mt352_write(fe, buf, 8);
297 mt352_write(fe, fsm_go, 2); 297 _mt352_write(fe, fsm_go, 2);
298 } else { 298 } else {
299 if (fe->ops.tuner_ops.calc_regs) { 299 if (fe->ops.tuner_ops.calc_regs) {
300 fe->ops.tuner_ops.calc_regs(fe, param, buf+8, 5); 300 fe->ops.tuner_ops.calc_regs(fe, param, buf+8, 5);
301 buf[8] <<= 1; 301 buf[8] <<= 1;
302 mt352_write(fe, buf, sizeof(buf)); 302 _mt352_write(fe, buf, sizeof(buf));
303 mt352_write(fe, tuner_go, 2); 303 _mt352_write(fe, tuner_go, 2);
304 } 304 }
305 } 305 }
306 306
@@ -522,7 +522,7 @@ static int mt352_init(struct dvb_frontend* fe)
522 (mt352_read_register(state, CONFIG) & 0x20) == 0) { 522 (mt352_read_register(state, CONFIG) & 0x20) == 0) {
523 523
524 /* Do a "hard" reset */ 524 /* Do a "hard" reset */
525 mt352_write(fe, mt352_reset_attach, sizeof(mt352_reset_attach)); 525 _mt352_write(fe, mt352_reset_attach, sizeof(mt352_reset_attach));
526 return state->config.demod_init(fe); 526 return state->config.demod_init(fe);
527 } 527 }
528 528
@@ -585,6 +585,7 @@ static struct dvb_frontend_ops mt352_ops = {
585 585
586 .init = mt352_init, 586 .init = mt352_init,
587 .sleep = mt352_sleep, 587 .sleep = mt352_sleep,
588 .write = _mt352_write,
588 589
589 .set_frontend = mt352_set_parameters, 590 .set_frontend = mt352_set_parameters,
590 .get_frontend = mt352_get_parameters, 591 .get_frontend = mt352_get_parameters,
@@ -605,4 +606,3 @@ MODULE_AUTHOR("Holger Waechtler, Daniel Mack, Antonio Mancuso");
605MODULE_LICENSE("GPL"); 606MODULE_LICENSE("GPL");
606 607
607EXPORT_SYMBOL(mt352_attach); 608EXPORT_SYMBOL(mt352_attach);
608EXPORT_SYMBOL(mt352_write);
diff --git a/drivers/media/dvb/frontends/mt352.h b/drivers/media/dvb/frontends/mt352.h
index 9e7ff4b8fe5f..0de2057f9d9c 100644
--- a/drivers/media/dvb/frontends/mt352.h
+++ b/drivers/media/dvb/frontends/mt352.h
@@ -54,6 +54,11 @@ struct mt352_config
54extern struct dvb_frontend* mt352_attach(const struct mt352_config* config, 54extern struct dvb_frontend* mt352_attach(const struct mt352_config* config,
55 struct i2c_adapter* i2c); 55 struct i2c_adapter* i2c);
56 56
57extern int mt352_write(struct dvb_frontend* fe, u8* ibuf, int ilen); 57static inline int mt352_write(struct dvb_frontend *fe, u8 *buf, int len) {
58 int r = 0;
59 if (fe->ops.write)
60 r = fe->ops.write(fe, buf, len);
61 return r;
62}
58 63
59#endif // MT352_H 64#endif // MT352_H
diff --git a/drivers/media/dvb/frontends/stv0299.c b/drivers/media/dvb/frontends/stv0299.c
index 96648a75440d..93483769eca8 100644
--- a/drivers/media/dvb/frontends/stv0299.c
+++ b/drivers/media/dvb/frontends/stv0299.c
@@ -92,11 +92,14 @@ static int stv0299_writeregI (struct stv0299_state* state, u8 reg, u8 data)
92 return (ret != 1) ? -EREMOTEIO : 0; 92 return (ret != 1) ? -EREMOTEIO : 0;
93} 93}
94 94
95int stv0299_writereg (struct dvb_frontend* fe, u8 reg, u8 data) 95int stv0299_write(struct dvb_frontend* fe, u8 *buf, int len)
96{ 96{
97 struct stv0299_state* state = fe->demodulator_priv; 97 struct stv0299_state* state = fe->demodulator_priv;
98 98
99 return stv0299_writeregI(state, reg, data); 99 if (len != 2)
100 return -EINVAL;
101
102 return stv0299_writeregI(state, buf[0], buf[1]);
100} 103}
101 104
102static u8 stv0299_readreg (struct stv0299_state* state, u8 reg) 105static u8 stv0299_readreg (struct stv0299_state* state, u8 reg)
@@ -694,6 +697,7 @@ static struct dvb_frontend_ops stv0299_ops = {
694 697
695 .init = stv0299_init, 698 .init = stv0299_init,
696 .sleep = stv0299_sleep, 699 .sleep = stv0299_sleep,
700 .write = stv0299_write,
697 .i2c_gate_ctrl = stv0299_i2c_gate_ctrl, 701 .i2c_gate_ctrl = stv0299_i2c_gate_ctrl,
698 702
699 .set_frontend = stv0299_set_frontend, 703 .set_frontend = stv0299_set_frontend,
@@ -724,5 +728,4 @@ MODULE_AUTHOR("Ralph Metzler, Holger Waechtler, Peter Schildmann, Felix Domke, "
724 "Andreas Oberritter, Andrew de Quincey, Kenneth Aafly"); 728 "Andreas Oberritter, Andrew de Quincey, Kenneth Aafly");
725MODULE_LICENSE("GPL"); 729MODULE_LICENSE("GPL");
726 730
727EXPORT_SYMBOL(stv0299_writereg);
728EXPORT_SYMBOL(stv0299_attach); 731EXPORT_SYMBOL(stv0299_attach);
diff --git a/drivers/media/dvb/frontends/stv0299.h b/drivers/media/dvb/frontends/stv0299.h
index 1504828e4232..d1abaf978a03 100644
--- a/drivers/media/dvb/frontends/stv0299.h
+++ b/drivers/media/dvb/frontends/stv0299.h
@@ -89,9 +89,15 @@ struct stv0299_config
89 int (*set_symbol_rate)(struct dvb_frontend* fe, u32 srate, u32 ratio); 89 int (*set_symbol_rate)(struct dvb_frontend* fe, u32 srate, u32 ratio);
90}; 90};
91 91
92extern int stv0299_writereg (struct dvb_frontend* fe, u8 reg, u8 data);
93
94extern struct dvb_frontend* stv0299_attach(const struct stv0299_config* config, 92extern struct dvb_frontend* stv0299_attach(const struct stv0299_config* config,
95 struct i2c_adapter* i2c); 93 struct i2c_adapter* i2c);
96 94
95static inline int stv0299_writereg(struct dvb_frontend *fe, u8 reg, u8 val) {
96 int r = 0;
97 u8 buf[] = {reg, val};
98 if (fe->ops.write)
99 r = fe->ops.write(fe, buf, 2);
100 return r;
101}
102
97#endif // STV0299_H 103#endif // STV0299_H
diff --git a/drivers/media/dvb/frontends/tda10021.c b/drivers/media/dvb/frontends/tda10021.c
index 9cbd164aa281..dca89171be1f 100644
--- a/drivers/media/dvb/frontends/tda10021.c
+++ b/drivers/media/dvb/frontends/tda10021.c
@@ -72,7 +72,7 @@ static u8 tda10021_inittab[0x40]=
72 0x04, 0x2d, 0x2f, 0xff, 0x00, 0x00, 0x00, 0x00, 72 0x04, 0x2d, 0x2f, 0xff, 0x00, 0x00, 0x00, 0x00,
73}; 73};
74 74
75static int tda10021_writereg (struct tda10021_state* state, u8 reg, u8 data) 75static int _tda10021_writereg (struct tda10021_state* state, u8 reg, u8 data)
76{ 76{
77 u8 buf[] = { reg, data }; 77 u8 buf[] = { reg, data };
78 struct i2c_msg msg = { .addr = state->config->demod_address, .flags = 0, .buf = buf, .len = 2 }; 78 struct i2c_msg msg = { .addr = state->config->demod_address, .flags = 0, .buf = buf, .len = 2 };
@@ -88,14 +88,6 @@ static int tda10021_writereg (struct tda10021_state* state, u8 reg, u8 data)
88 return (ret != 1) ? -EREMOTEIO : 0; 88 return (ret != 1) ? -EREMOTEIO : 0;
89} 89}
90 90
91int tda10021_write_byte(struct dvb_frontend* fe, int reg, int data)
92{
93 struct tda10021_state* state = fe->demodulator_priv;
94
95 return tda10021_writereg(state, reg, data);
96}
97EXPORT_SYMBOL(tda10021_write_byte);
98
99static u8 tda10021_readreg (struct tda10021_state* state, u8 reg) 91static u8 tda10021_readreg (struct tda10021_state* state, u8 reg)
100{ 92{
101 u8 b0 [] = { reg }; 93 u8 b0 [] = { reg };
@@ -149,8 +141,8 @@ static int tda10021_setup_reg0 (struct tda10021_state* state, u8 reg0,
149 else if (INVERSION_OFF == inversion) 141 else if (INVERSION_OFF == inversion)
150 DISABLE_INVERSION(reg0); 142 DISABLE_INVERSION(reg0);
151 143
152 tda10021_writereg (state, 0x00, reg0 & 0xfe); 144 _tda10021_writereg (state, 0x00, reg0 & 0xfe);
153 tda10021_writereg (state, 0x00, reg0 | 0x01); 145 _tda10021_writereg (state, 0x00, reg0 | 0x01);
154 146
155 state->reg0 = reg0; 147 state->reg0 = reg0;
156 return 0; 148 return 0;
@@ -198,17 +190,27 @@ static int tda10021_set_symbolrate (struct tda10021_state* state, u32 symbolrate
198 190
199 NDEC = (NDEC << 6) | tda10021_inittab[0x03]; 191 NDEC = (NDEC << 6) | tda10021_inittab[0x03];
200 192
201 tda10021_writereg (state, 0x03, NDEC); 193 _tda10021_writereg (state, 0x03, NDEC);
202 tda10021_writereg (state, 0x0a, BDR&0xff); 194 _tda10021_writereg (state, 0x0a, BDR&0xff);
203 tda10021_writereg (state, 0x0b, (BDR>> 8)&0xff); 195 _tda10021_writereg (state, 0x0b, (BDR>> 8)&0xff);
204 tda10021_writereg (state, 0x0c, (BDR>>16)&0x3f); 196 _tda10021_writereg (state, 0x0c, (BDR>>16)&0x3f);
205 197
206 tda10021_writereg (state, 0x0d, BDRI); 198 _tda10021_writereg (state, 0x0d, BDRI);
207 tda10021_writereg (state, 0x0e, SFIL); 199 _tda10021_writereg (state, 0x0e, SFIL);
208 200
209 return 0; 201 return 0;
210} 202}
211 203
204int tda10021_write(struct dvb_frontend* fe, u8 *buf, int len)
205{
206 struct tda10021_state* state = fe->demodulator_priv;
207
208 if (len != 2)
209 return -EINVAL;
210
211 return _tda10021_writereg(state, buf[0], buf[1]);
212}
213
212static int tda10021_init (struct dvb_frontend *fe) 214static int tda10021_init (struct dvb_frontend *fe)
213{ 215{
214 struct tda10021_state* state = fe->demodulator_priv; 216 struct tda10021_state* state = fe->demodulator_priv;
@@ -216,12 +218,12 @@ static int tda10021_init (struct dvb_frontend *fe)
216 218
217 dprintk("DVB: TDA10021(%d): init chip\n", fe->adapter->num); 219 dprintk("DVB: TDA10021(%d): init chip\n", fe->adapter->num);
218 220
219 //tda10021_writereg (fe, 0, 0); 221 //_tda10021_writereg (fe, 0, 0);
220 222
221 for (i=0; i<tda10021_inittab_size; i++) 223 for (i=0; i<tda10021_inittab_size; i++)
222 tda10021_writereg (state, i, tda10021_inittab[i]); 224 _tda10021_writereg (state, i, tda10021_inittab[i]);
223 225
224 tda10021_writereg (state, 0x34, state->pwm); 226 _tda10021_writereg (state, 0x34, state->pwm);
225 227
226 //Comment by markus 228 //Comment by markus
227 //0x2A[3-0] == PDIV -> P multiplaying factor (P=PDIV+1)(default 0) 229 //0x2A[3-0] == PDIV -> P multiplaying factor (P=PDIV+1)(default 0)
@@ -230,7 +232,7 @@ static int tda10021_init (struct dvb_frontend *fe)
230 //0x2A[6] == POLAXIN -> Polarity of the input reference clock (default 0) 232 //0x2A[6] == POLAXIN -> Polarity of the input reference clock (default 0)
231 233
232 //Activate PLL 234 //Activate PLL
233 tda10021_writereg(state, 0x2a, tda10021_inittab[0x2a] & 0xef); 235 _tda10021_writereg(state, 0x2a, tda10021_inittab[0x2a] & 0xef);
234 return 0; 236 return 0;
235} 237}
236 238
@@ -264,12 +266,12 @@ static int tda10021_set_parameters (struct dvb_frontend *fe,
264 } 266 }
265 267
266 tda10021_set_symbolrate (state, p->u.qam.symbol_rate); 268 tda10021_set_symbolrate (state, p->u.qam.symbol_rate);
267 tda10021_writereg (state, 0x34, state->pwm); 269 _tda10021_writereg (state, 0x34, state->pwm);
268 270
269 tda10021_writereg (state, 0x01, reg0x01[qam]); 271 _tda10021_writereg (state, 0x01, reg0x01[qam]);
270 tda10021_writereg (state, 0x05, reg0x05[qam]); 272 _tda10021_writereg (state, 0x05, reg0x05[qam]);
271 tda10021_writereg (state, 0x08, reg0x08[qam]); 273 _tda10021_writereg (state, 0x08, reg0x08[qam]);
272 tda10021_writereg (state, 0x09, reg0x09[qam]); 274 _tda10021_writereg (state, 0x09, reg0x09[qam]);
273 275
274 tda10021_setup_reg0 (state, reg0x00[qam], p->inversion); 276 tda10021_setup_reg0 (state, reg0x00[qam], p->inversion);
275 277
@@ -342,8 +344,8 @@ static int tda10021_read_ucblocks(struct dvb_frontend* fe, u32* ucblocks)
342 *ucblocks = 0xffffffff; 344 *ucblocks = 0xffffffff;
343 345
344 /* reset uncorrected block counter */ 346 /* reset uncorrected block counter */
345 tda10021_writereg (state, 0x10, tda10021_inittab[0x10] & 0xdf); 347 _tda10021_writereg (state, 0x10, tda10021_inittab[0x10] & 0xdf);
346 tda10021_writereg (state, 0x10, tda10021_inittab[0x10]); 348 _tda10021_writereg (state, 0x10, tda10021_inittab[0x10]);
347 349
348 return 0; 350 return 0;
349} 351}
@@ -392,8 +394,8 @@ static int tda10021_sleep(struct dvb_frontend* fe)
392{ 394{
393 struct tda10021_state* state = fe->demodulator_priv; 395 struct tda10021_state* state = fe->demodulator_priv;
394 396
395 tda10021_writereg (state, 0x1b, 0x02); /* pdown ADC */ 397 _tda10021_writereg (state, 0x1b, 0x02); /* pdown ADC */
396 tda10021_writereg (state, 0x00, 0x80); /* standby */ 398 _tda10021_writereg (state, 0x00, 0x80); /* standby */
397 399
398 return 0; 400 return 0;
399} 401}
@@ -459,6 +461,7 @@ static struct dvb_frontend_ops tda10021_ops = {
459 461
460 .init = tda10021_init, 462 .init = tda10021_init,
461 .sleep = tda10021_sleep, 463 .sleep = tda10021_sleep,
464 .write = tda10021_write,
462 .i2c_gate_ctrl = tda10021_i2c_gate_ctrl, 465 .i2c_gate_ctrl = tda10021_i2c_gate_ctrl,
463 466
464 .set_frontend = tda10021_set_parameters, 467 .set_frontend = tda10021_set_parameters,
diff --git a/drivers/media/dvb/frontends/tda10021.h b/drivers/media/dvb/frontends/tda10021.h
index b1df4259bee9..e77df5ed7807 100644
--- a/drivers/media/dvb/frontends/tda10021.h
+++ b/drivers/media/dvb/frontends/tda10021.h
@@ -35,6 +35,12 @@ struct tda10021_config
35extern struct dvb_frontend* tda10021_attach(const struct tda10021_config* config, 35extern struct dvb_frontend* tda10021_attach(const struct tda10021_config* config,
36 struct i2c_adapter* i2c, u8 pwm); 36 struct i2c_adapter* i2c, u8 pwm);
37 37
38extern int tda10021_write_byte(struct dvb_frontend* fe, int reg, int data); 38static inline int tda10021_writereg(struct dvb_frontend *fe, u8 reg, u8 val) {
39 int r = 0;
40 u8 buf[] = {reg, val};
41 if (fe->ops.write)
42 r = fe->ops.write(fe, buf, 2);
43 return r;
44}
39 45
40#endif // TDA10021_H 46#endif // TDA10021_H
diff --git a/drivers/media/dvb/frontends/tda1004x.c b/drivers/media/dvb/frontends/tda1004x.c
index 59a2ed614fca..478d97735407 100644
--- a/drivers/media/dvb/frontends/tda1004x.c
+++ b/drivers/media/dvb/frontends/tda1004x.c
@@ -579,11 +579,14 @@ static int tda1004x_decode_fec(int tdafec)
579 return -1; 579 return -1;
580} 580}
581 581
582int tda1004x_write_byte(struct dvb_frontend* fe, int reg, int data) 582int tda1004x_write(struct dvb_frontend* fe, u8 *buf, int len)
583{ 583{
584 struct tda1004x_state* state = fe->demodulator_priv; 584 struct tda1004x_state* state = fe->demodulator_priv;
585 585
586 return tda1004x_write_byteI(state, reg, data); 586 if (len != 2)
587 return -EINVAL;
588
589 return tda1004x_write_byteI(state, buf[0], buf[1]);
587} 590}
588 591
589static int tda10045_init(struct dvb_frontend* fe) 592static int tda10045_init(struct dvb_frontend* fe)
@@ -1192,7 +1195,13 @@ static int tda1004x_get_tune_settings(struct dvb_frontend* fe, struct dvb_fronte
1192 return 0; 1195 return 0;
1193} 1196}
1194 1197
1195static void tda1004x_release(struct dvb_frontend* fe) 1198static void tda10045_release(struct dvb_frontend* fe)
1199{
1200 struct tda1004x_state *state = fe->demodulator_priv;
1201 kfree(state);
1202}
1203
1204static void tda10046_release(struct dvb_frontend* fe)
1196{ 1205{
1197 struct tda1004x_state *state = fe->demodulator_priv; 1206 struct tda1004x_state *state = fe->demodulator_priv;
1198 kfree(state); 1207 kfree(state);
@@ -1212,10 +1221,11 @@ static struct dvb_frontend_ops tda10045_ops = {
1212 FE_CAN_TRANSMISSION_MODE_AUTO | FE_CAN_GUARD_INTERVAL_AUTO 1221 FE_CAN_TRANSMISSION_MODE_AUTO | FE_CAN_GUARD_INTERVAL_AUTO
1213 }, 1222 },
1214 1223
1215 .release = tda1004x_release, 1224 .release = tda10045_release,
1216 1225
1217 .init = tda10045_init, 1226 .init = tda10045_init,
1218 .sleep = tda1004x_sleep, 1227 .sleep = tda1004x_sleep,
1228 .write = tda1004x_write,
1219 .i2c_gate_ctrl = tda1004x_i2c_gate_ctrl, 1229 .i2c_gate_ctrl = tda1004x_i2c_gate_ctrl,
1220 1230
1221 .set_frontend = tda1004x_set_fe, 1231 .set_frontend = tda1004x_set_fe,
@@ -1270,10 +1280,11 @@ static struct dvb_frontend_ops tda10046_ops = {
1270 FE_CAN_TRANSMISSION_MODE_AUTO | FE_CAN_GUARD_INTERVAL_AUTO 1280 FE_CAN_TRANSMISSION_MODE_AUTO | FE_CAN_GUARD_INTERVAL_AUTO
1271 }, 1281 },
1272 1282
1273 .release = tda1004x_release, 1283 .release = tda10046_release,
1274 1284
1275 .init = tda10046_init, 1285 .init = tda10046_init,
1276 .sleep = tda1004x_sleep, 1286 .sleep = tda1004x_sleep,
1287 .write = tda1004x_write,
1277 .i2c_gate_ctrl = tda1004x_i2c_gate_ctrl, 1288 .i2c_gate_ctrl = tda1004x_i2c_gate_ctrl,
1278 1289
1279 .set_frontend = tda1004x_set_fe, 1290 .set_frontend = tda1004x_set_fe,
@@ -1323,4 +1334,3 @@ MODULE_LICENSE("GPL");
1323 1334
1324EXPORT_SYMBOL(tda10045_attach); 1335EXPORT_SYMBOL(tda10045_attach);
1325EXPORT_SYMBOL(tda10046_attach); 1336EXPORT_SYMBOL(tda10046_attach);
1326EXPORT_SYMBOL(tda1004x_write_byte);
diff --git a/drivers/media/dvb/frontends/tda1004x.h b/drivers/media/dvb/frontends/tda1004x.h
index b877b23ed734..7ffffa0c65f5 100644
--- a/drivers/media/dvb/frontends/tda1004x.h
+++ b/drivers/media/dvb/frontends/tda1004x.h
@@ -77,6 +77,12 @@ extern struct dvb_frontend* tda10045_attach(const struct tda1004x_config* config
77extern struct dvb_frontend* tda10046_attach(const struct tda1004x_config* config, 77extern struct dvb_frontend* tda10046_attach(const struct tda1004x_config* config,
78 struct i2c_adapter* i2c); 78 struct i2c_adapter* i2c);
79 79
80extern int tda1004x_write_byte(struct dvb_frontend* fe, int reg, int data); 80static inline int tda1004x_writereg(struct dvb_frontend *fe, u8 reg, u8 val) {
81 int r = 0;
82 u8 buf[] = {reg, val};
83 if (fe->ops.write)
84 r = fe->ops.write(fe, buf, 2);
85 return r;
86}
81 87
82#endif // TDA1004X_H 88#endif // TDA1004X_H
diff --git a/drivers/media/dvb/frontends/zl10353.c b/drivers/media/dvb/frontends/zl10353.c
index 2b95e8b6cd39..953fb55d87b6 100644
--- a/drivers/media/dvb/frontends/zl10353.c
+++ b/drivers/media/dvb/frontends/zl10353.c
@@ -258,7 +258,6 @@ static int zl10353_init(struct dvb_frontend *fe)
258static void zl10353_release(struct dvb_frontend *fe) 258static void zl10353_release(struct dvb_frontend *fe)
259{ 259{
260 struct zl10353_state *state = fe->demodulator_priv; 260 struct zl10353_state *state = fe->demodulator_priv;
261
262 kfree(state); 261 kfree(state);
263} 262}
264 263
@@ -314,6 +313,7 @@ static struct dvb_frontend_ops zl10353_ops = {
314 313
315 .init = zl10353_init, 314 .init = zl10353_init,
316 .sleep = zl10353_sleep, 315 .sleep = zl10353_sleep,
316 .write = zl10353_write,
317 317
318 .set_frontend = zl10353_set_parameters, 318 .set_frontend = zl10353_set_parameters,
319 .get_tune_settings = zl10353_get_tune_settings, 319 .get_tune_settings = zl10353_get_tune_settings,
@@ -330,4 +330,3 @@ MODULE_AUTHOR("Chris Pascoe");
330MODULE_LICENSE("GPL"); 330MODULE_LICENSE("GPL");
331 331
332EXPORT_SYMBOL(zl10353_attach); 332EXPORT_SYMBOL(zl10353_attach);
333EXPORT_SYMBOL(zl10353_write);
diff --git a/drivers/media/dvb/frontends/zl10353.h b/drivers/media/dvb/frontends/zl10353.h
index 9770cb840cfc..15804b384e2d 100644
--- a/drivers/media/dvb/frontends/zl10353.h
+++ b/drivers/media/dvb/frontends/zl10353.h
@@ -36,6 +36,4 @@ struct zl10353_config
36extern struct dvb_frontend* zl10353_attach(const struct zl10353_config *config, 36extern struct dvb_frontend* zl10353_attach(const struct zl10353_config *config,
37 struct i2c_adapter *i2c); 37 struct i2c_adapter *i2c);
38 38
39extern int zl10353_write(struct dvb_frontend *fe, u8 *ibuf, int ilen);
40
41#endif /* ZL10353_H */ 39#endif /* ZL10353_H */
diff --git a/drivers/media/dvb/ttpci/budget-ci.c b/drivers/media/dvb/ttpci/budget-ci.c
index 3d9a8db61f1f..8710813668f1 100644
--- a/drivers/media/dvb/ttpci/budget-ci.c
+++ b/drivers/media/dvb/ttpci/budget-ci.c
@@ -749,17 +749,17 @@ static int philips_tdm1316l_tuner_set_params(struct dvb_frontend *fe, struct dvb
749 // setup PLL filter and TDA9889 749 // setup PLL filter and TDA9889
750 switch (params->u.ofdm.bandwidth) { 750 switch (params->u.ofdm.bandwidth) {
751 case BANDWIDTH_6_MHZ: 751 case BANDWIDTH_6_MHZ:
752 tda1004x_write_byte(fe, 0x0C, 0x14); 752 tda1004x_writereg(fe, 0x0C, 0x14);
753 filter = 0; 753 filter = 0;
754 break; 754 break;
755 755
756 case BANDWIDTH_7_MHZ: 756 case BANDWIDTH_7_MHZ:
757 tda1004x_write_byte(fe, 0x0C, 0x80); 757 tda1004x_writereg(fe, 0x0C, 0x80);
758 filter = 0; 758 filter = 0;
759 break; 759 break;
760 760
761 case BANDWIDTH_8_MHZ: 761 case BANDWIDTH_8_MHZ:
762 tda1004x_write_byte(fe, 0x0C, 0x14); 762 tda1004x_writereg(fe, 0x0C, 0x14);
763 filter = 1; 763 filter = 1;
764 break; 764 break;
765 765
diff --git a/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c b/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c
index 04cef3023457..3c299df89410 100644
--- a/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c
+++ b/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c
@@ -1107,17 +1107,17 @@ static int philips_tdm1316l_tuner_set_params(struct dvb_frontend* fe, struct dvb
1107 // setup PLL filter 1107 // setup PLL filter
1108 switch (params->u.ofdm.bandwidth) { 1108 switch (params->u.ofdm.bandwidth) {
1109 case BANDWIDTH_6_MHZ: 1109 case BANDWIDTH_6_MHZ:
1110 tda1004x_write_byte(fe, 0x0C, 0); 1110 tda1004x_writereg(fe, 0x0C, 0);
1111 filter = 0; 1111 filter = 0;
1112 break; 1112 break;
1113 1113
1114 case BANDWIDTH_7_MHZ: 1114 case BANDWIDTH_7_MHZ:
1115 tda1004x_write_byte(fe, 0x0C, 0); 1115 tda1004x_writereg(fe, 0x0C, 0);
1116 filter = 0; 1116 filter = 0;
1117 break; 1117 break;
1118 1118
1119 case BANDWIDTH_8_MHZ: 1119 case BANDWIDTH_8_MHZ:
1120 tda1004x_write_byte(fe, 0x0C, 0xFF); 1120 tda1004x_writereg(fe, 0x0C, 0xFF);
1121 filter = 1; 1121 filter = 1;
1122 break; 1122 break;
1123 1123