diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2008-04-24 14:21:08 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-04-24 14:21:08 -0400 |
commit | c328d54cd4ad120d76284e46dcca6c6cf996154a (patch) | |
tree | 104c023be66faa5fce6e0a56c0a6d13c62fd21e5 /drivers/media/dvb | |
parent | 346ad4b7fe392571f19314f153db9151dbc1d82b (diff) | |
parent | b0166ab3a6ae6d7af8d9a21a7836154963c69a11 (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/v4l-dvb
* git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/v4l-dvb: (452 commits)
V4L/DVB (7731): tuner-xc2028: fix signal strength calculus
V4L/DVB (7730): tuner-xc2028: Fix SCODE load for MTS firmwares
V4L/DVB (7729): Fix VIDIOCGAP corruption in ivtv
V4L/DVB (7728): tea5761: bugzilla #10462: tea5761 autodetection code were broken
V4L/DVB (7726): cx23885: Enable cx23417 support on the HVR1800
V4L/DVB (7725): cx23885: Add generic cx23417 hardware encoder support
V4L/DVB (7723): pvrusb2: Clean up input selection list generation in V4L interface
V4L/DVB (7722): pvrusb2: Implement FM radio support for Gotview USB2.0 DVD 2
V4L/DVB (7721): pvrusb2: Restructure cx23416 firmware loading to have a common exit point
V4L/DVB (7720): pvrusb2: Fix bad error code on cx23416 firmware load failure
V4L/DVB (7719): pvrusb2: Implement input selection enforcement
V4L/DVB (7718): pvrusb2-dvb: update Kbuild selections
V4L/DVB (7717): pvrusb2-dvb: add DVB-T support for Hauppauge pvrusb2 model 73xxx
V4L/DVB (7716): pvrusb2: clean up global functions
V4L/DVB (7715): pvrusb2: Clean out all use of __FUNCTION__
V4L/DVB (7714): pvrusb2: Fix hang on module removal
V4L/DVB (7713): pvrusb2: Implement cleaner DVB kernel thread shutdown
V4L/DVB (7712): pvrusb2: Close connect/disconnect race
V4L/DVB (7711): pvrusb2: Fix race on module unload
V4L/DVB (7710): pvrusb2: Implement critical digital streaming quirk for onair devices
...
Diffstat (limited to 'drivers/media/dvb')
168 files changed, 5505 insertions, 1942 deletions
diff --git a/drivers/media/dvb/b2c2/Kconfig b/drivers/media/dvb/b2c2/Kconfig index 3197aeb61d1f..6ec5afba1ca7 100644 --- a/drivers/media/dvb/b2c2/Kconfig +++ b/drivers/media/dvb/b2c2/Kconfig | |||
@@ -9,6 +9,11 @@ config DVB_B2C2_FLEXCOP | |||
9 | select DVB_STV0297 if !DVB_FE_CUSTOMISE | 9 | select DVB_STV0297 if !DVB_FE_CUSTOMISE |
10 | select DVB_BCM3510 if !DVB_FE_CUSTOMISE | 10 | select DVB_BCM3510 if !DVB_FE_CUSTOMISE |
11 | select DVB_LGDT330X if !DVB_FE_CUSTOMISE | 11 | select DVB_LGDT330X if !DVB_FE_CUSTOMISE |
12 | select TUNER_SIMPLE if !DVB_FE_CUSTOMISE | ||
13 | select DVB_S5H1420 if !DVB_FE_CUSTOMISE | ||
14 | select DVB_TUNER_ITD1000 if !DVB_FE_CUSTOMISE | ||
15 | select DVB_ISL6421 if !DVB_FE_CUSTOMISE | ||
16 | select DVB_CX24123 if !DVB_FE_CUSTOMISE | ||
12 | help | 17 | help |
13 | Support for the digital TV receiver chip made by B2C2 Inc. included in | 18 | Support for the digital TV receiver chip made by B2C2 Inc. included in |
14 | Technisats PCI cards and USB boxes. | 19 | Technisats PCI cards and USB boxes. |
diff --git a/drivers/media/dvb/b2c2/Makefile b/drivers/media/dvb/b2c2/Makefile index e97ff60a1eff..870e2848c296 100644 --- a/drivers/media/dvb/b2c2/Makefile +++ b/drivers/media/dvb/b2c2/Makefile | |||
@@ -2,6 +2,7 @@ b2c2-flexcop-objs = flexcop.o flexcop-fe-tuner.o flexcop-i2c.o \ | |||
2 | flexcop-sram.o flexcop-eeprom.o flexcop-misc.o flexcop-hw-filter.o | 2 | flexcop-sram.o flexcop-eeprom.o flexcop-misc.o flexcop-hw-filter.o |
3 | obj-$(CONFIG_DVB_B2C2_FLEXCOP) += b2c2-flexcop.o | 3 | obj-$(CONFIG_DVB_B2C2_FLEXCOP) += b2c2-flexcop.o |
4 | 4 | ||
5 | |||
5 | ifneq ($(CONFIG_DVB_B2C2_FLEXCOP_PCI),) | 6 | ifneq ($(CONFIG_DVB_B2C2_FLEXCOP_PCI),) |
6 | b2c2-flexcop-objs += flexcop-dma.o | 7 | b2c2-flexcop-objs += flexcop-dma.o |
7 | endif | 8 | endif |
@@ -13,3 +14,4 @@ b2c2-flexcop-usb-objs = flexcop-usb.o | |||
13 | obj-$(CONFIG_DVB_B2C2_FLEXCOP_USB) += b2c2-flexcop-usb.o | 14 | obj-$(CONFIG_DVB_B2C2_FLEXCOP_USB) += b2c2-flexcop-usb.o |
14 | 15 | ||
15 | EXTRA_CFLAGS += -Idrivers/media/dvb/dvb-core/ -Idrivers/media/dvb/frontends/ | 16 | EXTRA_CFLAGS += -Idrivers/media/dvb/dvb-core/ -Idrivers/media/dvb/frontends/ |
17 | EXTRA_CFLAGS += -Idrivers/media/video/ | ||
diff --git a/drivers/media/dvb/b2c2/flexcop-common.h b/drivers/media/dvb/b2c2/flexcop-common.h index 5a6c4fe249e7..8ce06336e76f 100644 --- a/drivers/media/dvb/b2c2/flexcop-common.h +++ b/drivers/media/dvb/b2c2/flexcop-common.h | |||
@@ -44,6 +44,14 @@ struct flexcop_dma { | |||
44 | u32 size; /* size of each address in bytes */ | 44 | u32 size; /* size of each address in bytes */ |
45 | }; | 45 | }; |
46 | 46 | ||
47 | struct flexcop_i2c_adapter { | ||
48 | struct flexcop_device *fc; | ||
49 | struct i2c_adapter i2c_adap; | ||
50 | |||
51 | u8 no_base_addr; | ||
52 | flexcop_i2c_port_t port; | ||
53 | }; | ||
54 | |||
47 | /* Control structure for data definitions that are common to | 55 | /* Control structure for data definitions that are common to |
48 | * the B2C2-based PCI and USB devices. | 56 | * the B2C2-based PCI and USB devices. |
49 | */ | 57 | */ |
@@ -72,7 +80,7 @@ struct flexcop_device { | |||
72 | struct dmx_frontend mem_frontend; | 80 | struct dmx_frontend mem_frontend; |
73 | int (*fe_sleep) (struct dvb_frontend *); | 81 | int (*fe_sleep) (struct dvb_frontend *); |
74 | 82 | ||
75 | struct i2c_adapter i2c_adap; | 83 | struct flexcop_i2c_adapter fc_i2c_adap[3]; |
76 | struct mutex i2c_mutex; | 84 | struct mutex i2c_mutex; |
77 | struct module *owner; | 85 | struct module *owner; |
78 | 86 | ||
@@ -87,7 +95,8 @@ struct flexcop_device { | |||
87 | int (*write_ibi_reg) (struct flexcop_device *, flexcop_ibi_register, flexcop_ibi_value); | 95 | int (*write_ibi_reg) (struct flexcop_device *, flexcop_ibi_register, flexcop_ibi_value); |
88 | 96 | ||
89 | 97 | ||
90 | int (*i2c_request) (struct flexcop_device*, flexcop_access_op_t, flexcop_i2c_port_t, u8 chipaddr, u8 addr, u8 *buf, u16 len); | 98 | int (*i2c_request) (struct flexcop_i2c_adapter*, |
99 | flexcop_access_op_t, u8 chipaddr, u8 addr, u8 *buf, u16 len); | ||
91 | int (*stream_control) (struct flexcop_device*, int); | 100 | int (*stream_control) (struct flexcop_device*, int); |
92 | 101 | ||
93 | int (*get_mac_addr) (struct flexcop_device *fc, int extended); | 102 | int (*get_mac_addr) (struct flexcop_device *fc, int extended); |
@@ -128,8 +137,8 @@ int flexcop_eeprom_check_mac_addr(struct flexcop_device *fc, int extended); | |||
128 | * one. We have it in flexcop-i2c.c, because it is going via the actual | 137 | * one. We have it in flexcop-i2c.c, because it is going via the actual |
129 | * I2C-channel of the flexcop. | 138 | * I2C-channel of the flexcop. |
130 | */ | 139 | */ |
131 | int flexcop_i2c_request(struct flexcop_device*, flexcop_access_op_t, | 140 | int flexcop_i2c_request(struct flexcop_i2c_adapter*, flexcop_access_op_t, |
132 | flexcop_i2c_port_t, u8 chipaddr, u8 addr, u8 *buf, u16 len); | 141 | u8 chipaddr, u8 addr, u8 *buf, u16 len); |
133 | 142 | ||
134 | /* from flexcop-sram.c */ | 143 | /* from flexcop-sram.c */ |
135 | int flexcop_sram_set_dest(struct flexcop_device *fc, flexcop_sram_dest_t dest, flexcop_sram_dest_target_t target); | 144 | int flexcop_sram_set_dest(struct flexcop_device *fc, flexcop_sram_dest_t dest, flexcop_sram_dest_target_t target); |
diff --git a/drivers/media/dvb/b2c2/flexcop-dma.c b/drivers/media/dvb/b2c2/flexcop-dma.c index 6f592bc32d22..a91ed28f03a4 100644 --- a/drivers/media/dvb/b2c2/flexcop-dma.c +++ b/drivers/media/dvb/b2c2/flexcop-dma.c | |||
@@ -112,7 +112,7 @@ static int flexcop_dma_remap(struct flexcop_device *fc, | |||
112 | { | 112 | { |
113 | flexcop_ibi_register r = (dma_idx & FC_DMA_1) ? dma1_00c : dma2_01c; | 113 | flexcop_ibi_register r = (dma_idx & FC_DMA_1) ? dma1_00c : dma2_01c; |
114 | flexcop_ibi_value v = fc->read_ibi_reg(fc,r); | 114 | flexcop_ibi_value v = fc->read_ibi_reg(fc,r); |
115 | deb_info("%s\n",__FUNCTION__); | 115 | deb_info("%s\n",__func__); |
116 | v.dma_0xc.remap_enable = onoff; | 116 | v.dma_0xc.remap_enable = onoff; |
117 | fc->write_ibi_reg(fc,r,v); | 117 | fc->write_ibi_reg(fc,r,v); |
118 | return 0; | 118 | return 0; |
@@ -162,7 +162,7 @@ int flexcop_dma_config_timer(struct flexcop_device *fc, | |||
162 | 162 | ||
163 | flexcop_dma_remap(fc,dma_idx,0); | 163 | flexcop_dma_remap(fc,dma_idx,0); |
164 | 164 | ||
165 | deb_info("%s\n",__FUNCTION__); | 165 | deb_info("%s\n",__func__); |
166 | v.dma_0x4_write.dmatimer = cycles; | 166 | v.dma_0x4_write.dmatimer = cycles; |
167 | fc->write_ibi_reg(fc,r,v); | 167 | fc->write_ibi_reg(fc,r,v); |
168 | return 0; | 168 | return 0; |
diff --git a/drivers/media/dvb/b2c2/flexcop-eeprom.c b/drivers/media/dvb/b2c2/flexcop-eeprom.c index bbcf070a178d..8a8ae8a3e6ba 100644 --- a/drivers/media/dvb/b2c2/flexcop-eeprom.c +++ b/drivers/media/dvb/b2c2/flexcop-eeprom.c | |||
@@ -114,15 +114,18 @@ static int flexcop_eeprom_request(struct flexcop_device *fc, flexcop_access_op_t | |||
114 | { | 114 | { |
115 | int i,ret = 0; | 115 | int i,ret = 0; |
116 | u8 chipaddr = 0x50 | ((addr >> 8) & 3); | 116 | u8 chipaddr = 0x50 | ((addr >> 8) & 3); |
117 | for (i = 0; i < retries; i++) | 117 | for (i = 0; i < retries; i++) { |
118 | if ((ret = fc->i2c_request(fc,op,FC_I2C_PORT_EEPROM,chipaddr,addr & 0xff,buf,len)) == 0) | 118 | ret = fc->i2c_request(&fc->fc_i2c_adap[1], op, chipaddr, |
119 | addr & 0xff, buf, len); | ||
120 | if (ret == 0) | ||
119 | break; | 121 | break; |
122 | } | ||
120 | return ret; | 123 | return ret; |
121 | } | 124 | } |
122 | 125 | ||
123 | static int flexcop_eeprom_lrc_read(struct flexcop_device *fc, u16 addr, u8 *buf, u16 len, int retries) | 126 | static int flexcop_eeprom_lrc_read(struct flexcop_device *fc, u16 addr, u8 *buf, u16 len, int retries) |
124 | { | 127 | { |
125 | int ret = flexcop_eeprom_request(fc,FC_READ,addr,buf,len,retries); | 128 | int ret = flexcop_eeprom_request(fc, FC_READ, addr, buf, len, retries); |
126 | if (ret == 0) | 129 | if (ret == 0) |
127 | if (calc_lrc(buf, len - 1) != buf[len - 1]) | 130 | if (calc_lrc(buf, len - 1) != buf[len - 1]) |
128 | ret = -EINVAL; | 131 | ret = -EINVAL; |
diff --git a/drivers/media/dvb/b2c2/flexcop-fe-tuner.c b/drivers/media/dvb/b2c2/flexcop-fe-tuner.c index 0378fd646591..7b0ea3bdfafb 100644 --- a/drivers/media/dvb/b2c2/flexcop-fe-tuner.c +++ b/drivers/media/dvb/b2c2/flexcop-fe-tuner.c | |||
@@ -5,6 +5,8 @@ | |||
5 | * | 5 | * |
6 | * see flexcop.c for copyright information. | 6 | * see flexcop.c for copyright information. |
7 | */ | 7 | */ |
8 | #include <media/tuner.h> | ||
9 | |||
8 | #include "flexcop.h" | 10 | #include "flexcop.h" |
9 | 11 | ||
10 | #include "stv0299.h" | 12 | #include "stv0299.h" |
@@ -15,6 +17,15 @@ | |||
15 | #include "mt312.h" | 17 | #include "mt312.h" |
16 | #include "lgdt330x.h" | 18 | #include "lgdt330x.h" |
17 | #include "dvb-pll.h" | 19 | #include "dvb-pll.h" |
20 | #include "tuner-simple.h" | ||
21 | |||
22 | #include "s5h1420.h" | ||
23 | #include "itd1000.h" | ||
24 | |||
25 | #include "cx24123.h" | ||
26 | #include "cx24113.h" | ||
27 | |||
28 | #include "isl6421.h" | ||
18 | 29 | ||
19 | /* lnb control */ | 30 | /* lnb control */ |
20 | 31 | ||
@@ -180,13 +191,13 @@ static int samsung_tbmu24112_tuner_set_params(struct dvb_frontend* fe, struct dv | |||
180 | buf[2] = 0x84; /* 0xC4 */ | 191 | buf[2] = 0x84; /* 0xC4 */ |
181 | buf[3] = 0x08; | 192 | buf[3] = 0x08; |
182 | 193 | ||
183 | if (params->frequency < 1500000) buf[3] |= 0x10; | 194 | if (params->frequency < 1500000) |
195 | buf[3] |= 0x10; | ||
184 | 196 | ||
185 | if (fe->ops.i2c_gate_ctrl) | 197 | if (fe->ops.i2c_gate_ctrl) |
186 | fe->ops.i2c_gate_ctrl(fe, 1); | 198 | fe->ops.i2c_gate_ctrl(fe, 1); |
187 | if (i2c_transfer(&fc->i2c_adap, &msg, 1) != 1) { | 199 | if (i2c_transfer(&fc->fc_i2c_adap[0].i2c_adap, &msg, 1) != 1) |
188 | return -EIO; | 200 | return -EIO; |
189 | } | ||
190 | return 0; | 201 | return 0; |
191 | } | 202 | } |
192 | 203 | ||
@@ -241,7 +252,7 @@ static struct stv0299_config samsung_tbmu24112_config = { | |||
241 | .mclk = 88000000UL, | 252 | .mclk = 88000000UL, |
242 | .invert = 0, | 253 | .invert = 0, |
243 | .skip_reinit = 0, | 254 | .skip_reinit = 0, |
244 | .lock_output = STV0229_LOCKOUTPUT_LK, | 255 | .lock_output = STV0299_LOCKOUTPUT_LK, |
245 | .volt13_op0_op1 = STV0299_VOLT13_OP1, | 256 | .volt13_op0_op1 = STV0299_VOLT13_OP1, |
246 | .min_delay_ms = 100, | 257 | .min_delay_ms = 100, |
247 | .set_symbol_rate = samsung_tbmu24112_set_symbol_rate, | 258 | .set_symbol_rate = samsung_tbmu24112_set_symbol_rate, |
@@ -337,7 +348,7 @@ static int skystar23_samsung_tbdu18132_tuner_set_params(struct dvb_frontend* fe, | |||
337 | 348 | ||
338 | if (fe->ops.i2c_gate_ctrl) | 349 | if (fe->ops.i2c_gate_ctrl) |
339 | fe->ops.i2c_gate_ctrl(fe, 1); | 350 | fe->ops.i2c_gate_ctrl(fe, 1); |
340 | if (i2c_transfer(&fc->i2c_adap, &msg, 1) != 1) | 351 | if (i2c_transfer(&fc->fc_i2c_adap[0].i2c_adap, &msg, 1) != 1) |
341 | return -EIO; | 352 | return -EIO; |
342 | return 0; | 353 | return 0; |
343 | } | 354 | } |
@@ -386,10 +397,11 @@ static int alps_tdee4_stv0297_tuner_set_params(struct dvb_frontend* fe, | |||
386 | if (fe->ops.i2c_gate_ctrl) | 397 | if (fe->ops.i2c_gate_ctrl) |
387 | fe->ops.i2c_gate_ctrl(fe, 0); | 398 | fe->ops.i2c_gate_ctrl(fe, 0); |
388 | deb_tuner("tuner buffer for %d Hz: %x %x %x %x\n",fep->frequency, buf[0],buf[1],buf[2],buf[3]); | 399 | deb_tuner("tuner buffer for %d Hz: %x %x %x %x\n",fep->frequency, buf[0],buf[1],buf[2],buf[3]); |
389 | ret = fc->i2c_request(fc, FC_WRITE, FC_I2C_PORT_TUNER, 0x61, buf[0], &buf[1], 3); | 400 | ret = fc->i2c_request(&fc->fc_i2c_adap[2], |
401 | FC_WRITE, 0x61, buf[0], &buf[1], 3); | ||
390 | deb_tuner("tuner write returned: %d\n",ret); | 402 | deb_tuner("tuner write returned: %d\n",ret); |
391 | 403 | ||
392 | return 0; | 404 | return ret; |
393 | } | 405 | } |
394 | 406 | ||
395 | static u8 alps_tdee4_stv0297_inittab[] = { | 407 | static u8 alps_tdee4_stv0297_inittab[] = { |
@@ -472,56 +484,159 @@ static struct stv0297_config alps_tdee4_stv0297_config = { | |||
472 | // .pll_set = alps_tdee4_stv0297_pll_set, | 484 | // .pll_set = alps_tdee4_stv0297_pll_set, |
473 | }; | 485 | }; |
474 | 486 | ||
487 | |||
488 | /* SkyStar2 rev2.7 (a/u) */ | ||
489 | static struct s5h1420_config skystar2_rev2_7_s5h1420_config = { | ||
490 | .demod_address = 0x53, | ||
491 | .invert = 1, | ||
492 | .repeated_start_workaround = 1, | ||
493 | }; | ||
494 | |||
495 | static struct itd1000_config skystar2_rev2_7_itd1000_config = { | ||
496 | .i2c_address = 0x61, | ||
497 | }; | ||
498 | |||
499 | /* SkyStar2 rev2.8 */ | ||
500 | static struct cx24123_config skystar2_rev2_8_cx24123_config = { | ||
501 | .demod_address = 0x55, | ||
502 | .dont_use_pll = 1, | ||
503 | .agc_callback = cx24113_agc_callback, | ||
504 | }; | ||
505 | |||
506 | static const struct cx24113_config skystar2_rev2_8_cx24113_config = { | ||
507 | .i2c_addr = 0x54, | ||
508 | .xtal_khz = 10111, | ||
509 | }; | ||
510 | |||
475 | /* try to figure out the frontend, each card/box can have on of the following list */ | 511 | /* try to figure out the frontend, each card/box can have on of the following list */ |
476 | int flexcop_frontend_init(struct flexcop_device *fc) | 512 | int flexcop_frontend_init(struct flexcop_device *fc) |
477 | { | 513 | { |
478 | struct dvb_frontend_ops *ops; | 514 | struct dvb_frontend_ops *ops; |
515 | struct i2c_adapter *i2c = &fc->fc_i2c_adap[0].i2c_adap; | ||
516 | struct i2c_adapter *i2c_tuner; | ||
517 | |||
518 | /* enable no_base_addr - no repeated start when reading */ | ||
519 | fc->fc_i2c_adap[0].no_base_addr = 1; | ||
520 | fc->fe = dvb_attach(s5h1420_attach, &skystar2_rev2_7_s5h1420_config, i2c); | ||
521 | if (fc->fe != NULL) { | ||
522 | flexcop_ibi_value r108; | ||
523 | i2c_tuner = s5h1420_get_tuner_i2c_adapter(fc->fe); | ||
524 | ops = &fc->fe->ops; | ||
525 | |||
526 | fc->fe_sleep = ops->sleep; | ||
527 | ops->sleep = flexcop_sleep; | ||
528 | |||
529 | fc->dev_type = FC_SKY_REV27; | ||
530 | |||
531 | /* enable no_base_addr - no repeated start when reading */ | ||
532 | fc->fc_i2c_adap[2].no_base_addr = 1; | ||
533 | if (dvb_attach(isl6421_attach, fc->fe, &fc->fc_i2c_adap[2].i2c_adap, 0x08, 1, 1) == NULL) | ||
534 | err("ISL6421 could NOT be attached"); | ||
535 | else | ||
536 | info("ISL6421 successfully attached"); | ||
537 | |||
538 | /* the ITD1000 requires a lower i2c clock - it slows down the stuff for everyone - but is it a problem ? */ | ||
539 | r108.raw = 0x00000506; | ||
540 | fc->write_ibi_reg(fc, tw_sm_c_108, r108); | ||
541 | if (i2c_tuner) { | ||
542 | if (dvb_attach(itd1000_attach, fc->fe, i2c_tuner, &skystar2_rev2_7_itd1000_config) == NULL) | ||
543 | err("ITD1000 could NOT be attached"); | ||
544 | else | ||
545 | info("ITD1000 successfully attached"); | ||
546 | } | ||
547 | goto fe_found; | ||
548 | } | ||
549 | fc->fc_i2c_adap[0].no_base_addr = 0; /* for the next devices we need it again */ | ||
550 | |||
551 | /* try the sky v2.8 (cx24123, isl6421) */ | ||
552 | fc->fe = dvb_attach(cx24123_attach, | ||
553 | &skystar2_rev2_8_cx24123_config, i2c); | ||
554 | if (fc->fe != NULL) { | ||
555 | i2c_tuner = cx24123_get_tuner_i2c_adapter(fc->fe); | ||
556 | if (i2c_tuner != NULL) { | ||
557 | if (dvb_attach(cx24113_attach, fc->fe, | ||
558 | &skystar2_rev2_8_cx24113_config, | ||
559 | i2c_tuner) == NULL) | ||
560 | err("CX24113 could NOT be attached"); | ||
561 | else | ||
562 | info("CX24113 successfully attached"); | ||
563 | } | ||
564 | |||
565 | fc->dev_type = FC_SKY_REV28; | ||
566 | |||
567 | fc->fc_i2c_adap[2].no_base_addr = 1; | ||
568 | if (dvb_attach(isl6421_attach, fc->fe, | ||
569 | &fc->fc_i2c_adap[2].i2c_adap, 0x08, 0, 0) == NULL) | ||
570 | err("ISL6421 could NOT be attached"); | ||
571 | else | ||
572 | info("ISL6421 successfully attached"); | ||
573 | |||
574 | /* TODO on i2c_adap[1] addr 0x11 (EEPROM) there seems to be an | ||
575 | * IR-receiver (PIC16F818) - but the card has no input for | ||
576 | * that ??? */ | ||
577 | |||
578 | goto fe_found; | ||
579 | } | ||
479 | 580 | ||
480 | /* try the sky v2.6 (stv0299/Samsung tbmu24112(sl1935)) */ | 581 | /* try the sky v2.6 (stv0299/Samsung tbmu24112(sl1935)) */ |
481 | if ((fc->fe = dvb_attach(stv0299_attach, &samsung_tbmu24112_config, &fc->i2c_adap)) != NULL) { | 582 | fc->fe = dvb_attach(stv0299_attach, &samsung_tbmu24112_config, i2c); |
583 | if (fc->fe != NULL) { | ||
482 | ops = &fc->fe->ops; | 584 | ops = &fc->fe->ops; |
483 | 585 | ||
484 | ops->tuner_ops.set_params = samsung_tbmu24112_tuner_set_params; | 586 | ops->tuner_ops.set_params = samsung_tbmu24112_tuner_set_params; |
485 | 587 | ||
486 | ops->set_voltage = flexcop_set_voltage; | 588 | ops->set_voltage = flexcop_set_voltage; |
487 | 589 | ||
488 | fc->fe_sleep = ops->sleep; | 590 | fc->fe_sleep = ops->sleep; |
489 | ops->sleep = flexcop_sleep; | 591 | ops->sleep = flexcop_sleep; |
592 | |||
593 | fc->dev_type = FC_SKY; | ||
594 | goto fe_found; | ||
595 | } | ||
490 | 596 | ||
491 | fc->dev_type = FC_SKY; | ||
492 | info("found the stv0299 at i2c address: 0x%02x",samsung_tbmu24112_config.demod_address); | ||
493 | } else | ||
494 | /* try the air dvb-t (mt352/Samsung tdtc9251dh0(??)) */ | 597 | /* try the air dvb-t (mt352/Samsung tdtc9251dh0(??)) */ |
495 | if ((fc->fe = dvb_attach(mt352_attach, &samsung_tdtc9251dh0_config, &fc->i2c_adap)) != NULL ) { | 598 | fc->fe = dvb_attach(mt352_attach, &samsung_tdtc9251dh0_config, i2c); |
496 | fc->dev_type = FC_AIR_DVB; | 599 | if (fc->fe != NULL) { |
600 | fc->dev_type = FC_AIR_DVB; | ||
497 | fc->fe->ops.tuner_ops.calc_regs = samsung_tdtc9251dh0_calc_regs; | 601 | fc->fe->ops.tuner_ops.calc_regs = samsung_tdtc9251dh0_calc_regs; |
498 | info("found the mt352 at i2c address: 0x%02x",samsung_tdtc9251dh0_config.demod_address); | 602 | goto fe_found; |
499 | } else | 603 | } |
604 | |||
500 | /* try the air atsc 2nd generation (nxt2002) */ | 605 | /* try the air atsc 2nd generation (nxt2002) */ |
501 | if ((fc->fe = dvb_attach(nxt200x_attach, &samsung_tbmv_config, &fc->i2c_adap)) != NULL) { | 606 | fc->fe = dvb_attach(nxt200x_attach, &samsung_tbmv_config, i2c); |
502 | fc->dev_type = FC_AIR_ATSC2; | 607 | if (fc->fe != NULL) { |
608 | fc->dev_type = FC_AIR_ATSC2; | ||
503 | dvb_attach(dvb_pll_attach, fc->fe, 0x61, NULL, DVB_PLL_SAMSUNG_TBMV); | 609 | dvb_attach(dvb_pll_attach, fc->fe, 0x61, NULL, DVB_PLL_SAMSUNG_TBMV); |
504 | info("found the nxt2002 at i2c address: 0x%02x",samsung_tbmv_config.demod_address); | 610 | goto fe_found; |
505 | } else | 611 | } |
506 | /* try the air atsc 3nd generation (lgdt3303) */ | 612 | |
507 | if ((fc->fe = dvb_attach(lgdt330x_attach, &air2pc_atsc_hd5000_config, &fc->i2c_adap)) != NULL) { | 613 | fc->fe = dvb_attach(lgdt330x_attach, &air2pc_atsc_hd5000_config, i2c); |
508 | fc->dev_type = FC_AIR_ATSC3; | 614 | if (fc->fe != NULL) { |
509 | dvb_attach(dvb_pll_attach, fc->fe, 0x61, &fc->i2c_adap, DVB_PLL_LG_TDVS_H06XF); | 615 | fc->dev_type = FC_AIR_ATSC3; |
510 | info("found the lgdt3303 at i2c address: 0x%02x",air2pc_atsc_hd5000_config.demod_address); | 616 | dvb_attach(simple_tuner_attach, fc->fe, i2c, 0x61, |
511 | } else | 617 | TUNER_LG_TDVS_H06XF); |
618 | goto fe_found; | ||
619 | } | ||
620 | |||
512 | /* try the air atsc 1nd generation (bcm3510)/panasonic ct10s */ | 621 | /* try the air atsc 1nd generation (bcm3510)/panasonic ct10s */ |
513 | if ((fc->fe = dvb_attach(bcm3510_attach, &air2pc_atsc_first_gen_config, &fc->i2c_adap)) != NULL) { | 622 | fc->fe = dvb_attach(bcm3510_attach, &air2pc_atsc_first_gen_config, i2c); |
514 | fc->dev_type = FC_AIR_ATSC1; | 623 | if (fc->fe != NULL) { |
515 | info("found the bcm3510 at i2c address: 0x%02x",air2pc_atsc_first_gen_config.demod_address); | 624 | fc->dev_type = FC_AIR_ATSC1; |
516 | } else | 625 | goto fe_found; |
626 | } | ||
627 | |||
517 | /* try the cable dvb (stv0297) */ | 628 | /* try the cable dvb (stv0297) */ |
518 | if ((fc->fe = dvb_attach(stv0297_attach, &alps_tdee4_stv0297_config, &fc->i2c_adap)) != NULL) { | 629 | fc->fe = dvb_attach(stv0297_attach, &alps_tdee4_stv0297_config, i2c); |
519 | fc->dev_type = FC_CABLE; | 630 | if (fc->fe != NULL) { |
631 | fc->dev_type = FC_CABLE; | ||
520 | fc->fe->ops.tuner_ops.set_params = alps_tdee4_stv0297_tuner_set_params; | 632 | fc->fe->ops.tuner_ops.set_params = alps_tdee4_stv0297_tuner_set_params; |
521 | info("found the stv0297 at i2c address: 0x%02x",alps_tdee4_stv0297_config.demod_address); | 633 | goto fe_found; |
522 | } else | 634 | } |
635 | |||
523 | /* try the sky v2.3 (vp310/Samsung tbdu18132(tsa5059)) */ | 636 | /* try the sky v2.3 (vp310/Samsung tbdu18132(tsa5059)) */ |
524 | if ((fc->fe = dvb_attach(vp310_mt312_attach, &skystar23_samsung_tbdu18132_config, &fc->i2c_adap)) != NULL) { | 637 | fc->fe = dvb_attach(vp310_mt312_attach, |
638 | &skystar23_samsung_tbdu18132_config, i2c); | ||
639 | if (fc->fe != NULL) { | ||
525 | ops = &fc->fe->ops; | 640 | ops = &fc->fe->ops; |
526 | 641 | ||
527 | ops->tuner_ops.set_params = skystar23_samsung_tbdu18132_tuner_set_params; | 642 | ops->tuner_ops.set_params = skystar23_samsung_tbdu18132_tuner_set_params; |
@@ -535,19 +650,21 @@ int flexcop_frontend_init(struct flexcop_device *fc) | |||
535 | ops->sleep = flexcop_sleep; | 650 | ops->sleep = flexcop_sleep; |
536 | 651 | ||
537 | fc->dev_type = FC_SKY_OLD; | 652 | fc->dev_type = FC_SKY_OLD; |
538 | info("found the vp310 (aka mt312) at i2c address: 0x%02x",skystar23_samsung_tbdu18132_config.demod_address); | 653 | goto fe_found; |
539 | } | 654 | } |
540 | 655 | ||
541 | if (fc->fe == NULL) { | 656 | err("no frontend driver found for this B2C2/FlexCop adapter"); |
542 | err("no frontend driver found for this B2C2/FlexCop adapter"); | 657 | return -ENODEV; |
543 | return -ENODEV; | 658 | |
544 | } else { | 659 | fe_found: |
545 | if (dvb_register_frontend(&fc->dvb_adapter, fc->fe)) { | 660 | info("found '%s' .", fc->fe->ops.info.name); |
546 | err("frontend registration failed!"); | 661 | if (dvb_register_frontend(&fc->dvb_adapter, fc->fe)) { |
547 | dvb_frontend_detach(fc->fe); | 662 | err("frontend registration failed!"); |
548 | fc->fe = NULL; | 663 | ops = &fc->fe->ops; |
549 | return -EINVAL; | 664 | if (ops->release != NULL) |
550 | } | 665 | ops->release(fc->fe); |
666 | fc->fe = NULL; | ||
667 | return -EINVAL; | ||
551 | } | 668 | } |
552 | fc->init_state |= FC_STATE_FE_INIT; | 669 | fc->init_state |= FC_STATE_FE_INIT; |
553 | return 0; | 670 | return 0; |
diff --git a/drivers/media/dvb/b2c2/flexcop-i2c.c b/drivers/media/dvb/b2c2/flexcop-i2c.c index 6bf858a436c9..55973eaf3711 100644 --- a/drivers/media/dvb/b2c2/flexcop-i2c.c +++ b/drivers/media/dvb/b2c2/flexcop-i2c.c | |||
@@ -9,6 +9,8 @@ | |||
9 | 9 | ||
10 | #define FC_MAX_I2C_RETRIES 100000 | 10 | #define FC_MAX_I2C_RETRIES 100000 |
11 | 11 | ||
12 | /* #define DUMP_I2C_MESSAGES */ | ||
13 | |||
12 | static int flexcop_i2c_operation(struct flexcop_device *fc, flexcop_ibi_value *r100) | 14 | static int flexcop_i2c_operation(struct flexcop_device *fc, flexcop_ibi_value *r100) |
13 | { | 15 | { |
14 | int i; | 16 | int i; |
@@ -38,30 +40,25 @@ static int flexcop_i2c_operation(struct flexcop_device *fc, flexcop_ibi_value *r | |||
38 | return -EREMOTEIO; | 40 | return -EREMOTEIO; |
39 | } | 41 | } |
40 | 42 | ||
41 | static int flexcop_i2c_read4(struct flexcop_device *fc, flexcop_ibi_value r100, u8 *buf) | 43 | static int flexcop_i2c_read4(struct flexcop_i2c_adapter *i2c, |
44 | flexcop_ibi_value r100, u8 *buf) | ||
42 | { | 45 | { |
43 | flexcop_ibi_value r104; | 46 | flexcop_ibi_value r104; |
44 | int len = r100.tw_sm_c_100.total_bytes, /* remember total_bytes is buflen-1 */ | 47 | int len = r100.tw_sm_c_100.total_bytes, /* remember total_bytes is buflen-1 */ |
45 | ret; | 48 | ret; |
46 | 49 | ||
47 | if ((ret = flexcop_i2c_operation(fc,&r100)) != 0) { | 50 | r100.tw_sm_c_100.no_base_addr_ack_error = i2c->no_base_addr; |
48 | /* The Cablestar needs a different kind of i2c-transfer (does not | 51 | ret = flexcop_i2c_operation(i2c->fc, &r100); |
49 | * support "Repeat Start"): | 52 | if (ret != 0) { |
50 | * wait for the ACK failure, | 53 | deb_i2c("read failed. %d\n", ret); |
51 | * and do a subsequent read with the Bit 30 enabled | 54 | return ret; |
52 | */ | ||
53 | r100.tw_sm_c_100.no_base_addr_ack_error = 1; | ||
54 | if ((ret = flexcop_i2c_operation(fc,&r100)) != 0) { | ||
55 | deb_i2c("no_base_addr read failed. %d\n",ret); | ||
56 | return ret; | ||
57 | } | ||
58 | } | 55 | } |
59 | 56 | ||
60 | buf[0] = r100.tw_sm_c_100.data1_reg; | 57 | buf[0] = r100.tw_sm_c_100.data1_reg; |
61 | 58 | ||
62 | if (len > 0) { | 59 | if (len > 0) { |
63 | r104 = fc->read_ibi_reg(fc,tw_sm_c_104); | 60 | r104 = i2c->fc->read_ibi_reg(i2c->fc, tw_sm_c_104); |
64 | deb_i2c("read: r100: %08x, r104: %08x\n",r100.raw,r104.raw); | 61 | deb_i2c("read: r100: %08x, r104: %08x\n", r100.raw, r104.raw); |
65 | 62 | ||
66 | /* there is at least one more byte, otherwise we wouldn't be here */ | 63 | /* there is at least one more byte, otherwise we wouldn't be here */ |
67 | buf[1] = r104.tw_sm_c_104.data2_reg; | 64 | buf[1] = r104.tw_sm_c_104.data2_reg; |
@@ -85,17 +82,22 @@ static int flexcop_i2c_write4(struct flexcop_device *fc, flexcop_ibi_value r100, | |||
85 | r104.tw_sm_c_104.data3_reg = len > 1 ? buf[2] : 0; | 82 | r104.tw_sm_c_104.data3_reg = len > 1 ? buf[2] : 0; |
86 | r104.tw_sm_c_104.data4_reg = len > 2 ? buf[3] : 0; | 83 | r104.tw_sm_c_104.data4_reg = len > 2 ? buf[3] : 0; |
87 | 84 | ||
88 | deb_i2c("write: r100: %08x, r104: %08x\n",r100.raw,r104.raw); | 85 | deb_i2c("write: r100: %08x, r104: %08x\n", r100.raw, r104.raw); |
89 | 86 | ||
90 | /* write the additional i2c data before doing the actual i2c operation */ | 87 | /* write the additional i2c data before doing the actual i2c operation */ |
91 | fc->write_ibi_reg(fc,tw_sm_c_104,r104); | 88 | fc->write_ibi_reg(fc, tw_sm_c_104, r104); |
92 | return flexcop_i2c_operation(fc,&r100); | 89 | return flexcop_i2c_operation(fc, &r100); |
93 | } | 90 | } |
94 | 91 | ||
95 | int flexcop_i2c_request(struct flexcop_device *fc, flexcop_access_op_t op, | 92 | int flexcop_i2c_request(struct flexcop_i2c_adapter *i2c, |
96 | flexcop_i2c_port_t port, u8 chipaddr, u8 addr, u8 *buf, u16 len) | 93 | flexcop_access_op_t op, u8 chipaddr, u8 addr, u8 *buf, u16 len) |
97 | { | 94 | { |
98 | int ret; | 95 | int ret; |
96 | |||
97 | #ifdef DUMP_I2C_MESSAGES | ||
98 | int i; | ||
99 | #endif | ||
100 | |||
99 | u16 bytes_to_transfer; | 101 | u16 bytes_to_transfer; |
100 | flexcop_ibi_value r100; | 102 | flexcop_ibi_value r100; |
101 | 103 | ||
@@ -103,7 +105,25 @@ int flexcop_i2c_request(struct flexcop_device *fc, flexcop_access_op_t op, | |||
103 | r100.raw = 0; | 105 | r100.raw = 0; |
104 | r100.tw_sm_c_100.chipaddr = chipaddr; | 106 | r100.tw_sm_c_100.chipaddr = chipaddr; |
105 | r100.tw_sm_c_100.twoWS_rw = op; | 107 | r100.tw_sm_c_100.twoWS_rw = op; |
106 | r100.tw_sm_c_100.twoWS_port_reg = port; | 108 | r100.tw_sm_c_100.twoWS_port_reg = i2c->port; |
109 | |||
110 | #ifdef DUMP_I2C_MESSAGES | ||
111 | printk(KERN_DEBUG "%d ", i2c->port); | ||
112 | if (op == FC_READ) | ||
113 | printk("rd("); | ||
114 | else | ||
115 | printk("wr("); | ||
116 | |||
117 | printk("%02x): %02x ", chipaddr, addr); | ||
118 | #endif | ||
119 | |||
120 | /* in that case addr is the only value -> | ||
121 | * we write it twice as baseaddr and val0 | ||
122 | * BBTI is doing it like that for ISL6421 at least */ | ||
123 | if (i2c->no_base_addr && len == 0 && op == FC_WRITE) { | ||
124 | buf = &addr; | ||
125 | len = 1; | ||
126 | } | ||
107 | 127 | ||
108 | while (len != 0) { | 128 | while (len != 0) { |
109 | bytes_to_transfer = len > 4 ? 4 : len; | 129 | bytes_to_transfer = len > 4 ? 4 : len; |
@@ -112,9 +132,14 @@ int flexcop_i2c_request(struct flexcop_device *fc, flexcop_access_op_t op, | |||
112 | r100.tw_sm_c_100.baseaddr = addr; | 132 | r100.tw_sm_c_100.baseaddr = addr; |
113 | 133 | ||
114 | if (op == FC_READ) | 134 | if (op == FC_READ) |
115 | ret = flexcop_i2c_read4(fc, r100, buf); | 135 | ret = flexcop_i2c_read4(i2c, r100, buf); |
116 | else | 136 | else |
117 | ret = flexcop_i2c_write4(fc,r100, buf); | 137 | ret = flexcop_i2c_write4(i2c->fc, r100, buf); |
138 | |||
139 | #ifdef DUMP_I2C_MESSAGES | ||
140 | for (i = 0; i < bytes_to_transfer; i++) | ||
141 | printk("%02x ", buf[i]); | ||
142 | #endif | ||
118 | 143 | ||
119 | if (ret < 0) | 144 | if (ret < 0) |
120 | return ret; | 145 | return ret; |
@@ -122,7 +147,11 @@ int flexcop_i2c_request(struct flexcop_device *fc, flexcop_access_op_t op, | |||
122 | buf += bytes_to_transfer; | 147 | buf += bytes_to_transfer; |
123 | addr += bytes_to_transfer; | 148 | addr += bytes_to_transfer; |
124 | len -= bytes_to_transfer; | 149 | len -= bytes_to_transfer; |
125 | }; | 150 | } |
151 | |||
152 | #ifdef DUMP_I2C_MESSAGES | ||
153 | printk("\n"); | ||
154 | #endif | ||
126 | 155 | ||
127 | return 0; | 156 | return 0; |
128 | } | 157 | } |
@@ -132,7 +161,7 @@ EXPORT_SYMBOL(flexcop_i2c_request); | |||
132 | /* master xfer callback for demodulator */ | 161 | /* master xfer callback for demodulator */ |
133 | static int flexcop_master_xfer(struct i2c_adapter *i2c_adap, struct i2c_msg msgs[], int num) | 162 | static int flexcop_master_xfer(struct i2c_adapter *i2c_adap, struct i2c_msg msgs[], int num) |
134 | { | 163 | { |
135 | struct flexcop_device *fc = i2c_get_adapdata(i2c_adap); | 164 | struct flexcop_i2c_adapter *i2c = i2c_get_adapdata(i2c_adap); |
136 | int i, ret = 0; | 165 | int i, ret = 0; |
137 | 166 | ||
138 | /* Some drivers use 1 byte or 0 byte reads as probes, which this | 167 | /* Some drivers use 1 byte or 0 byte reads as probes, which this |
@@ -142,34 +171,29 @@ static int flexcop_master_xfer(struct i2c_adapter *i2c_adap, struct i2c_msg msgs | |||
142 | if (num == 1 && msgs[0].flags == I2C_M_RD && msgs[0].len <= 1) | 171 | if (num == 1 && msgs[0].flags == I2C_M_RD && msgs[0].len <= 1) |
143 | return 1; | 172 | return 1; |
144 | 173 | ||
145 | if (mutex_lock_interruptible(&fc->i2c_mutex)) | 174 | if (mutex_lock_interruptible(&i2c->fc->i2c_mutex)) |
146 | return -ERESTARTSYS; | 175 | return -ERESTARTSYS; |
147 | 176 | ||
148 | /* reading */ | 177 | for (i = 0; i < num; i++) { |
149 | if (num == 2 && | 178 | /* reading */ |
150 | msgs[0].flags == 0 && | 179 | if (i+1 < num && (msgs[i+1].flags == I2C_M_RD)) { |
151 | msgs[1].flags == I2C_M_RD && | 180 | ret = i2c->fc->i2c_request(i2c, FC_READ, msgs[i].addr, |
152 | msgs[0].buf != NULL && | 181 | msgs[i].buf[0], msgs[i+1].buf, msgs[i+1].len); |
153 | msgs[1].buf != NULL) { | 182 | i++; /* skip the following message */ |
154 | 183 | } else /* writing */ | |
155 | ret = fc->i2c_request(fc, FC_READ, FC_I2C_PORT_DEMOD, msgs[0].addr, msgs[0].buf[0], msgs[1].buf, msgs[1].len); | 184 | ret = i2c->fc->i2c_request(i2c, FC_WRITE, msgs[i].addr, |
156 | 185 | msgs[i].buf[0], &msgs[i].buf[1], | |
157 | } else for (i = 0; i < num; i++) { /* writing command */ | 186 | msgs[i].len - 1); |
158 | if (msgs[i].flags != 0 || msgs[i].buf == NULL || msgs[i].len < 2) { | 187 | if (ret < 0) { |
159 | ret = -EINVAL; | 188 | err("i2c master_xfer failed"); |
160 | break; | 189 | break; |
161 | } | 190 | } |
162 | |||
163 | ret = fc->i2c_request(fc, FC_WRITE, FC_I2C_PORT_DEMOD, msgs[i].addr, msgs[i].buf[0], &msgs[i].buf[1], msgs[i].len - 1); | ||
164 | } | 191 | } |
165 | 192 | ||
166 | if (ret < 0) | 193 | mutex_unlock(&i2c->fc->i2c_mutex); |
167 | err("i2c master_xfer failed"); | ||
168 | else | ||
169 | ret = num; | ||
170 | |||
171 | mutex_unlock(&fc->i2c_mutex); | ||
172 | 194 | ||
195 | if (ret == 0) | ||
196 | ret = num; | ||
173 | return ret; | 197 | return ret; |
174 | } | 198 | } |
175 | 199 | ||
@@ -189,28 +213,68 @@ int flexcop_i2c_init(struct flexcop_device *fc) | |||
189 | 213 | ||
190 | mutex_init(&fc->i2c_mutex); | 214 | mutex_init(&fc->i2c_mutex); |
191 | 215 | ||
192 | memset(&fc->i2c_adap, 0, sizeof(struct i2c_adapter)); | 216 | fc->fc_i2c_adap[0].fc = fc; |
193 | strncpy(fc->i2c_adap.name, "B2C2 FlexCop device", | 217 | fc->fc_i2c_adap[1].fc = fc; |
194 | sizeof(fc->i2c_adap.name)); | 218 | fc->fc_i2c_adap[2].fc = fc; |
195 | 219 | ||
196 | i2c_set_adapdata(&fc->i2c_adap,fc); | 220 | fc->fc_i2c_adap[0].port = FC_I2C_PORT_DEMOD; |
221 | fc->fc_i2c_adap[1].port = FC_I2C_PORT_EEPROM; | ||
222 | fc->fc_i2c_adap[2].port = FC_I2C_PORT_TUNER; | ||
223 | |||
224 | strncpy(fc->fc_i2c_adap[0].i2c_adap.name, | ||
225 | "B2C2 FlexCop I2C to demod", I2C_NAME_SIZE); | ||
226 | strncpy(fc->fc_i2c_adap[1].i2c_adap.name, | ||
227 | "B2C2 FlexCop I2C to eeprom", I2C_NAME_SIZE); | ||
228 | strncpy(fc->fc_i2c_adap[2].i2c_adap.name, | ||
229 | "B2C2 FlexCop I2C to tuner", I2C_NAME_SIZE); | ||
230 | |||
231 | i2c_set_adapdata(&fc->fc_i2c_adap[0].i2c_adap, &fc->fc_i2c_adap[0]); | ||
232 | i2c_set_adapdata(&fc->fc_i2c_adap[1].i2c_adap, &fc->fc_i2c_adap[1]); | ||
233 | i2c_set_adapdata(&fc->fc_i2c_adap[2].i2c_adap, &fc->fc_i2c_adap[2]); | ||
234 | |||
235 | fc->fc_i2c_adap[0].i2c_adap.class = | ||
236 | fc->fc_i2c_adap[1].i2c_adap.class = | ||
237 | fc->fc_i2c_adap[2].i2c_adap.class = I2C_CLASS_TV_DIGITAL; | ||
238 | fc->fc_i2c_adap[0].i2c_adap.algo = | ||
239 | fc->fc_i2c_adap[1].i2c_adap.algo = | ||
240 | fc->fc_i2c_adap[2].i2c_adap.algo = &flexcop_algo; | ||
241 | fc->fc_i2c_adap[0].i2c_adap.algo_data = | ||
242 | fc->fc_i2c_adap[1].i2c_adap.algo_data = | ||
243 | fc->fc_i2c_adap[2].i2c_adap.algo_data = NULL; | ||
244 | fc->fc_i2c_adap[0].i2c_adap.dev.parent = | ||
245 | fc->fc_i2c_adap[1].i2c_adap.dev.parent = | ||
246 | fc->fc_i2c_adap[2].i2c_adap.dev.parent = fc->dev; | ||
247 | |||
248 | ret = i2c_add_adapter(&fc->fc_i2c_adap[0].i2c_adap); | ||
249 | if (ret < 0) | ||
250 | return ret; | ||
197 | 251 | ||
198 | fc->i2c_adap.class = I2C_CLASS_TV_DIGITAL; | 252 | ret = i2c_add_adapter(&fc->fc_i2c_adap[1].i2c_adap); |
199 | fc->i2c_adap.algo = &flexcop_algo; | 253 | if (ret < 0) |
200 | fc->i2c_adap.algo_data = NULL; | 254 | goto adap_1_failed; |
201 | fc->i2c_adap.dev.parent = fc->dev; | ||
202 | 255 | ||
203 | if ((ret = i2c_add_adapter(&fc->i2c_adap)) < 0) | 256 | ret = i2c_add_adapter(&fc->fc_i2c_adap[2].i2c_adap); |
204 | return ret; | 257 | if (ret < 0) |
258 | goto adap_2_failed; | ||
205 | 259 | ||
206 | fc->init_state |= FC_STATE_I2C_INIT; | 260 | fc->init_state |= FC_STATE_I2C_INIT; |
207 | return 0; | 261 | return 0; |
262 | |||
263 | adap_2_failed: | ||
264 | i2c_del_adapter(&fc->fc_i2c_adap[1].i2c_adap); | ||
265 | adap_1_failed: | ||
266 | i2c_del_adapter(&fc->fc_i2c_adap[0].i2c_adap); | ||
267 | |||
268 | return ret; | ||
208 | } | 269 | } |
209 | 270 | ||
210 | void flexcop_i2c_exit(struct flexcop_device *fc) | 271 | void flexcop_i2c_exit(struct flexcop_device *fc) |
211 | { | 272 | { |
212 | if (fc->init_state & FC_STATE_I2C_INIT) | 273 | if (fc->init_state & FC_STATE_I2C_INIT) { |
213 | i2c_del_adapter(&fc->i2c_adap); | 274 | i2c_del_adapter(&fc->fc_i2c_adap[2].i2c_adap); |
275 | i2c_del_adapter(&fc->fc_i2c_adap[1].i2c_adap); | ||
276 | i2c_del_adapter(&fc->fc_i2c_adap[0].i2c_adap); | ||
277 | } | ||
214 | 278 | ||
215 | fc->init_state &= ~FC_STATE_I2C_INIT; | 279 | fc->init_state &= ~FC_STATE_I2C_INIT; |
216 | } | 280 | } |
diff --git a/drivers/media/dvb/b2c2/flexcop-misc.c b/drivers/media/dvb/b2c2/flexcop-misc.c index 167583bf0621..93d20e56f909 100644 --- a/drivers/media/dvb/b2c2/flexcop-misc.c +++ b/drivers/media/dvb/b2c2/flexcop-misc.c | |||
@@ -52,6 +52,8 @@ static const char *flexcop_device_names[] = { | |||
52 | "Sky2PC/SkyStar 2 DVB-S (old version)", | 52 | "Sky2PC/SkyStar 2 DVB-S (old version)", |
53 | "Cable2PC/CableStar 2 DVB-C", | 53 | "Cable2PC/CableStar 2 DVB-C", |
54 | "Air2PC/AirStar 2 ATSC 3rd generation (HD5000)", | 54 | "Air2PC/AirStar 2 ATSC 3rd generation (HD5000)", |
55 | "Sky2PC/SkyStar 2 DVB-S rev 2.7a/u", | ||
56 | "Sky2PC/SkyStar 2 DVB-S rev 2.8", | ||
55 | }; | 57 | }; |
56 | 58 | ||
57 | static const char *flexcop_bus_names[] = { | 59 | static const char *flexcop_bus_names[] = { |
diff --git a/drivers/media/dvb/b2c2/flexcop-pci.c b/drivers/media/dvb/b2c2/flexcop-pci.c index 01af4d237eb1..5b30dfc7846b 100644 --- a/drivers/media/dvb/b2c2/flexcop-pci.c +++ b/drivers/media/dvb/b2c2/flexcop-pci.c | |||
@@ -32,7 +32,7 @@ MODULE_PARM_DESC(irq_chk_intv, "set the interval for IRQ watchdog (currently jus | |||
32 | #define deb_irq(args...) dprintk(0x08,args) | 32 | #define deb_irq(args...) dprintk(0x08,args) |
33 | #define deb_chk(args...) dprintk(0x10,args) | 33 | #define deb_chk(args...) dprintk(0x10,args) |
34 | 34 | ||
35 | static int debug = 0; | 35 | static int debug; |
36 | module_param(debug, int, 0644); | 36 | module_param(debug, int, 0644); |
37 | MODULE_PARM_DESC(debug, "set debug level (1=info,2=regs,4=TS,8=irqdma (|-able))." DEBSTATUS); | 37 | MODULE_PARM_DESC(debug, "set debug level (1=info,2=regs,4=TS,8=irqdma (|-able))." DEBSTATUS); |
38 | 38 | ||
diff --git a/drivers/media/dvb/b2c2/flexcop-reg.h b/drivers/media/dvb/b2c2/flexcop-reg.h index 491f9bd6e195..7599fccc1a5b 100644 --- a/drivers/media/dvb/b2c2/flexcop-reg.h +++ b/drivers/media/dvb/b2c2/flexcop-reg.h | |||
@@ -25,6 +25,8 @@ typedef enum { | |||
25 | FC_SKY_OLD, | 25 | FC_SKY_OLD, |
26 | FC_CABLE, | 26 | FC_CABLE, |
27 | FC_AIR_ATSC3, | 27 | FC_AIR_ATSC3, |
28 | FC_SKY_REV27, | ||
29 | FC_SKY_REV28, | ||
28 | } flexcop_device_type_t; | 30 | } flexcop_device_type_t; |
29 | 31 | ||
30 | typedef enum { | 32 | typedef enum { |
diff --git a/drivers/media/dvb/b2c2/flexcop-sram.c b/drivers/media/dvb/b2c2/flexcop-sram.c index 01570ec80962..cda69528548a 100644 --- a/drivers/media/dvb/b2c2/flexcop-sram.c +++ b/drivers/media/dvb/b2c2/flexcop-sram.c | |||
@@ -90,7 +90,7 @@ static void flexcop_sram_write(struct adapter *adapter, u32 bank, u32 addr, u8 * | |||
90 | }; | 90 | }; |
91 | 91 | ||
92 | if (retries == 0) | 92 | if (retries == 0) |
93 | printk("%s: SRAM timeout\n", __FUNCTION__); | 93 | printk("%s: SRAM timeout\n", __func__); |
94 | 94 | ||
95 | write_reg_dw(adapter, 0x700, command); | 95 | write_reg_dw(adapter, 0x700, command); |
96 | 96 | ||
@@ -115,7 +115,7 @@ static void flex_sram_read(struct adapter *adapter, u32 bank, u32 addr, u8 *buf, | |||
115 | }; | 115 | }; |
116 | 116 | ||
117 | if (retries == 0) | 117 | if (retries == 0) |
118 | printk("%s: SRAM timeout\n", __FUNCTION__); | 118 | printk("%s: SRAM timeout\n", __func__); |
119 | 119 | ||
120 | write_reg_dw(adapter, 0x700, command); | 120 | write_reg_dw(adapter, 0x700, command); |
121 | 121 | ||
@@ -127,7 +127,7 @@ static void flex_sram_read(struct adapter *adapter, u32 bank, u32 addr, u8 *buf, | |||
127 | }; | 127 | }; |
128 | 128 | ||
129 | if (retries == 0) | 129 | if (retries == 0) |
130 | printk("%s: SRAM timeout\n", __FUNCTION__); | 130 | printk("%s: SRAM timeout\n", __func__); |
131 | 131 | ||
132 | value = read_reg_dw(adapter, 0x700) >> 0x10; | 132 | value = read_reg_dw(adapter, 0x700) >> 0x10; |
133 | 133 | ||
@@ -240,13 +240,13 @@ static void sram_init(struct adapter *adapter) | |||
240 | 240 | ||
241 | adapter->dw_sram_type = tmp & 0x30000; | 241 | adapter->dw_sram_type = tmp & 0x30000; |
242 | 242 | ||
243 | ddprintk("%s: dw_sram_type = %x\n", __FUNCTION__, adapter->dw_sram_type); | 243 | ddprintk("%s: dw_sram_type = %x\n", __func__, adapter->dw_sram_type); |
244 | 244 | ||
245 | } else { | 245 | } else { |
246 | 246 | ||
247 | adapter->dw_sram_type = 0x10000; | 247 | adapter->dw_sram_type = 0x10000; |
248 | 248 | ||
249 | ddprintk("%s: dw_sram_type = %x\n", __FUNCTION__, adapter->dw_sram_type); | 249 | ddprintk("%s: dw_sram_type = %x\n", __func__, adapter->dw_sram_type); |
250 | } | 250 | } |
251 | 251 | ||
252 | /* return value is never used? */ | 252 | /* return value is never used? */ |
@@ -257,7 +257,7 @@ static int sram_test_location(struct adapter *adapter, u32 mask, u32 addr) | |||
257 | { | 257 | { |
258 | u8 tmp1, tmp2; | 258 | u8 tmp1, tmp2; |
259 | 259 | ||
260 | dprintk("%s: mask = %x, addr = %x\n", __FUNCTION__, mask, addr); | 260 | dprintk("%s: mask = %x, addr = %x\n", __func__, mask, addr); |
261 | 261 | ||
262 | sram_set_size(adapter, mask); | 262 | sram_set_size(adapter, mask); |
263 | sram_init(adapter); | 263 | sram_init(adapter); |
@@ -275,7 +275,7 @@ static int sram_test_location(struct adapter *adapter, u32 mask, u32 addr) | |||
275 | sram_read(adapter, addr, &tmp2, 1); | 275 | sram_read(adapter, addr, &tmp2, 1); |
276 | sram_read(adapter, addr, &tmp2, 1); | 276 | sram_read(adapter, addr, &tmp2, 1); |
277 | 277 | ||
278 | dprintk("%s: wrote 0xa5, read 0x%2x\n", __FUNCTION__, tmp2); | 278 | dprintk("%s: wrote 0xa5, read 0x%2x\n", __func__, tmp2); |
279 | 279 | ||
280 | if (tmp2 != 0xa5) | 280 | if (tmp2 != 0xa5) |
281 | return 0; | 281 | return 0; |
@@ -293,7 +293,7 @@ static int sram_test_location(struct adapter *adapter, u32 mask, u32 addr) | |||
293 | sram_read(adapter, addr, &tmp2, 1); | 293 | sram_read(adapter, addr, &tmp2, 1); |
294 | sram_read(adapter, addr, &tmp2, 1); | 294 | sram_read(adapter, addr, &tmp2, 1); |
295 | 295 | ||
296 | dprintk("%s: wrote 0x5a, read 0x%2x\n", __FUNCTION__, tmp2); | 296 | dprintk("%s: wrote 0x5a, read 0x%2x\n", __func__, tmp2); |
297 | 297 | ||
298 | if (tmp2 != 0x5a) | 298 | if (tmp2 != 0x5a) |
299 | return 0; | 299 | return 0; |
@@ -340,7 +340,7 @@ static int flexcop_sram_detect(struct flexcop_device *fc) | |||
340 | 340 | ||
341 | tmp3 = read_reg_dw(adapter, 0x71c); | 341 | tmp3 = read_reg_dw(adapter, 0x71c); |
342 | 342 | ||
343 | dprintk("%s: tmp3 = %x\n", __FUNCTION__, tmp3); | 343 | dprintk("%s: tmp3 = %x\n", __func__, tmp3); |
344 | 344 | ||
345 | write_reg_dw(adapter, 0x71c, tmp2); | 345 | write_reg_dw(adapter, 0x71c, tmp2); |
346 | 346 | ||
@@ -351,7 +351,7 @@ static int flexcop_sram_detect(struct flexcop_device *fc) | |||
351 | sram_init(adapter); | 351 | sram_init(adapter); |
352 | write_reg_dw(adapter, 0x208, tmp); | 352 | write_reg_dw(adapter, 0x208, tmp); |
353 | 353 | ||
354 | dprintk("%s: sram size = 32K\n", __FUNCTION__); | 354 | dprintk("%s: sram size = 32K\n", __func__); |
355 | 355 | ||
356 | return 32; | 356 | return 32; |
357 | } | 357 | } |
@@ -361,7 +361,7 @@ static int flexcop_sram_detect(struct flexcop_device *fc) | |||
361 | sram_init(adapter); | 361 | sram_init(adapter); |
362 | write_reg_dw(adapter, 0x208, tmp); | 362 | write_reg_dw(adapter, 0x208, tmp); |
363 | 363 | ||
364 | dprintk("%s: sram size = 128K\n", __FUNCTION__); | 364 | dprintk("%s: sram size = 128K\n", __func__); |
365 | 365 | ||
366 | return 128; | 366 | return 128; |
367 | } | 367 | } |
@@ -371,7 +371,7 @@ static int flexcop_sram_detect(struct flexcop_device *fc) | |||
371 | sram_init(adapter); | 371 | sram_init(adapter); |
372 | write_reg_dw(adapter, 0x208, tmp); | 372 | write_reg_dw(adapter, 0x208, tmp); |
373 | 373 | ||
374 | dprintk("%s: sram size = 64K\n", __FUNCTION__); | 374 | dprintk("%s: sram size = 64K\n", __func__); |
375 | 375 | ||
376 | return 64; | 376 | return 64; |
377 | } | 377 | } |
@@ -381,7 +381,7 @@ static int flexcop_sram_detect(struct flexcop_device *fc) | |||
381 | sram_init(adapter); | 381 | sram_init(adapter); |
382 | write_reg_dw(adapter, 0x208, tmp); | 382 | write_reg_dw(adapter, 0x208, tmp); |
383 | 383 | ||
384 | dprintk("%s: sram size = 32K\n", __FUNCTION__); | 384 | dprintk("%s: sram size = 32K\n", __func__); |
385 | 385 | ||
386 | return 32; | 386 | return 32; |
387 | } | 387 | } |
@@ -390,7 +390,7 @@ static int flexcop_sram_detect(struct flexcop_device *fc) | |||
390 | sram_init(adapter); | 390 | sram_init(adapter); |
391 | write_reg_dw(adapter, 0x208, tmp); | 391 | write_reg_dw(adapter, 0x208, tmp); |
392 | 392 | ||
393 | dprintk("%s: SRAM detection failed. Set to 32K \n", __FUNCTION__); | 393 | dprintk("%s: SRAM detection failed. Set to 32K \n", __func__); |
394 | 394 | ||
395 | return 0; | 395 | return 0; |
396 | } | 396 | } |
diff --git a/drivers/media/dvb/b2c2/flexcop-usb.c b/drivers/media/dvb/b2c2/flexcop-usb.c index 87fb75f0d1cf..449fb5c3d0b1 100644 --- a/drivers/media/dvb/b2c2/flexcop-usb.c +++ b/drivers/media/dvb/b2c2/flexcop-usb.c | |||
@@ -211,10 +211,11 @@ static int flexcop_usb_utility_req(struct flexcop_usb *fc_usb, int set, | |||
211 | #endif | 211 | #endif |
212 | 212 | ||
213 | /* usb i2c stuff */ | 213 | /* usb i2c stuff */ |
214 | static int flexcop_usb_i2c_req(struct flexcop_usb *fc_usb, | 214 | static int flexcop_usb_i2c_req(struct flexcop_i2c_adapter *i2c, |
215 | flexcop_usb_request_t req, flexcop_usb_i2c_function_t func, | 215 | flexcop_usb_request_t req, flexcop_usb_i2c_function_t func, |
216 | flexcop_i2c_port_t port, u8 chipaddr, u8 addr, u8 *buf, u8 buflen) | 216 | u8 chipaddr, u8 addr, u8 *buf, u8 buflen) |
217 | { | 217 | { |
218 | struct flexcop_usb *fc_usb = i2c->fc->bus_specific; | ||
218 | u16 wValue, wIndex; | 219 | u16 wValue, wIndex; |
219 | int nWaitTime,pipe,len; | 220 | int nWaitTime,pipe,len; |
220 | // u8 dwRequestType; | 221 | // u8 dwRequestType; |
@@ -242,7 +243,7 @@ static int flexcop_usb_i2c_req(struct flexcop_usb *fc_usb, | |||
242 | deb_info("unsupported function for i2c_req %x\n",func); | 243 | deb_info("unsupported function for i2c_req %x\n",func); |
243 | return -EINVAL; | 244 | return -EINVAL; |
244 | } | 245 | } |
245 | wValue = (func << 8 ) | (port << 4); | 246 | wValue = (func << 8) | (i2c->port << 4); |
246 | wIndex = (chipaddr << 8 ) | addr; | 247 | wIndex = (chipaddr << 8 ) | addr; |
247 | 248 | ||
248 | deb_i2c("i2c %2d: %02x %02x %02x %02x %02x %02x\n",func,request_type,req, | 249 | deb_i2c("i2c %2d: %02x %02x %02x %02x %02x %02x\n",func,request_type,req, |
@@ -274,13 +275,15 @@ static int flexcop_usb_write_ibi_reg(struct flexcop_device *fc, flexcop_ibi_regi | |||
274 | return flexcop_usb_readwrite_dw(fc,reg, &val.raw, 0); | 275 | return flexcop_usb_readwrite_dw(fc,reg, &val.raw, 0); |
275 | } | 276 | } |
276 | 277 | ||
277 | static int flexcop_usb_i2c_request(struct flexcop_device *fc, flexcop_access_op_t op, | 278 | static int flexcop_usb_i2c_request(struct flexcop_i2c_adapter *i2c, |
278 | flexcop_i2c_port_t port, u8 chipaddr, u8 addr, u8 *buf, u16 len) | 279 | flexcop_access_op_t op, u8 chipaddr, u8 addr, u8 *buf, u16 len) |
279 | { | 280 | { |
280 | if (op == FC_READ) | 281 | if (op == FC_READ) |
281 | return flexcop_usb_i2c_req(fc->bus_specific,B2C2_USB_I2C_REQUEST,USB_FUNC_I2C_READ,port,chipaddr,addr,buf,len); | 282 | return flexcop_usb_i2c_req(i2c, B2C2_USB_I2C_REQUEST, |
283 | USB_FUNC_I2C_READ, chipaddr, addr, buf, len); | ||
282 | else | 284 | else |
283 | return flexcop_usb_i2c_req(fc->bus_specific,B2C2_USB_I2C_REQUEST,USB_FUNC_I2C_WRITE,port,chipaddr,addr,buf,len); | 285 | return flexcop_usb_i2c_req(i2c, B2C2_USB_I2C_REQUEST, |
286 | USB_FUNC_I2C_WRITE, chipaddr, addr, buf, len); | ||
284 | } | 287 | } |
285 | 288 | ||
286 | static void flexcop_usb_process_frame(struct flexcop_usb *fc_usb, u8 *buffer, int buffer_length) | 289 | static void flexcop_usb_process_frame(struct flexcop_usb *fc_usb, u8 *buffer, int buffer_length) |
diff --git a/drivers/media/dvb/b2c2/flexcop.c b/drivers/media/dvb/b2c2/flexcop.c index 2ddafd071c97..5f79c8dc3836 100644 --- a/drivers/media/dvb/b2c2/flexcop.c +++ b/drivers/media/dvb/b2c2/flexcop.c | |||
@@ -49,6 +49,8 @@ module_param_named(debug, b2c2_flexcop_debug, int, 0644); | |||
49 | MODULE_PARM_DESC(debug, "set debug level (1=info,2=tuner,4=i2c,8=ts,16=sram,32=reg (|-able))." DEBSTATUS); | 49 | MODULE_PARM_DESC(debug, "set debug level (1=info,2=tuner,4=i2c,8=ts,16=sram,32=reg (|-able))." DEBSTATUS); |
50 | #undef DEBSTATUS | 50 | #undef DEBSTATUS |
51 | 51 | ||
52 | DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); | ||
53 | |||
52 | /* global zero for ibi values */ | 54 | /* global zero for ibi values */ |
53 | flexcop_ibi_value ibi_zero; | 55 | flexcop_ibi_value ibi_zero; |
54 | 56 | ||
@@ -66,8 +68,10 @@ static int flexcop_dvb_stop_feed(struct dvb_demux_feed *dvbdmxfeed) | |||
66 | 68 | ||
67 | static int flexcop_dvb_init(struct flexcop_device *fc) | 69 | static int flexcop_dvb_init(struct flexcop_device *fc) |
68 | { | 70 | { |
69 | int ret; | 71 | int ret = dvb_register_adapter(&fc->dvb_adapter, |
70 | if ((ret = dvb_register_adapter(&fc->dvb_adapter,"FlexCop Digital TV device",fc->owner,fc->dev)) < 0) { | 72 | "FlexCop Digital TV device", fc->owner, |
73 | fc->dev, adapter_nr); | ||
74 | if (ret < 0) { | ||
71 | err("error registering DVB adapter"); | 75 | err("error registering DVB adapter"); |
72 | return ret; | 76 | return ret; |
73 | } | 77 | } |
@@ -257,6 +261,12 @@ int flexcop_device_initialize(struct flexcop_device *fc) | |||
257 | if ((ret = flexcop_dvb_init(fc))) | 261 | if ((ret = flexcop_dvb_init(fc))) |
258 | goto error; | 262 | goto error; |
259 | 263 | ||
264 | /* i2c has to be done before doing EEProm stuff - | ||
265 | * because the EEProm is accessed via i2c */ | ||
266 | ret = flexcop_i2c_init(fc); | ||
267 | if (ret) | ||
268 | goto error; | ||
269 | |||
260 | /* do the MAC address reading after initializing the dvb_adapter */ | 270 | /* do the MAC address reading after initializing the dvb_adapter */ |
261 | if (fc->get_mac_addr(fc, 0) == 0) { | 271 | if (fc->get_mac_addr(fc, 0) == 0) { |
262 | u8 *b = fc->dvb_adapter.proposed_mac; | 272 | u8 *b = fc->dvb_adapter.proposed_mac; |
@@ -266,10 +276,6 @@ int flexcop_device_initialize(struct flexcop_device *fc) | |||
266 | } else | 276 | } else |
267 | warn("reading of MAC address failed.\n"); | 277 | warn("reading of MAC address failed.\n"); |
268 | 278 | ||
269 | |||
270 | if ((ret = flexcop_i2c_init(fc))) | ||
271 | goto error; | ||
272 | |||
273 | if ((ret = flexcop_frontend_init(fc))) | 279 | if ((ret = flexcop_frontend_init(fc))) |
274 | goto error; | 280 | goto error; |
275 | 281 | ||
diff --git a/drivers/media/dvb/bt8xx/Kconfig b/drivers/media/dvb/bt8xx/Kconfig index ea666174e988..902c762e0b7f 100644 --- a/drivers/media/dvb/bt8xx/Kconfig +++ b/drivers/media/dvb/bt8xx/Kconfig | |||
@@ -7,8 +7,8 @@ config DVB_BT8XX | |||
7 | select DVB_CX24110 if !DVB_FE_CUSTOMISE | 7 | select DVB_CX24110 if !DVB_FE_CUSTOMISE |
8 | select DVB_OR51211 if !DVB_FE_CUSTOMISE | 8 | select DVB_OR51211 if !DVB_FE_CUSTOMISE |
9 | select DVB_LGDT330X if !DVB_FE_CUSTOMISE | 9 | select DVB_LGDT330X if !DVB_FE_CUSTOMISE |
10 | select DVB_PLL if !DVB_FE_CUSTOMISE | ||
11 | select DVB_ZL10353 if !DVB_FE_CUSTOMISE | 10 | select DVB_ZL10353 if !DVB_FE_CUSTOMISE |
11 | select TUNER_SIMPLE if !DVB_FE_CUSTOMISE | ||
12 | select FW_LOADER | 12 | select FW_LOADER |
13 | help | 13 | help |
14 | Support for PCI cards based on the Bt8xx PCI bridge. Examples are | 14 | Support for PCI cards based on the Bt8xx PCI bridge. Examples are |
diff --git a/drivers/media/dvb/bt8xx/Makefile b/drivers/media/dvb/bt8xx/Makefile index 84cf70504d17..9d3e68b5d6eb 100644 --- a/drivers/media/dvb/bt8xx/Makefile +++ b/drivers/media/dvb/bt8xx/Makefile | |||
@@ -1,3 +1,6 @@ | |||
1 | obj-$(CONFIG_DVB_BT8XX) += bt878.o dvb-bt8xx.o dst.o dst_ca.o | 1 | obj-$(CONFIG_DVB_BT8XX) += bt878.o dvb-bt8xx.o dst.o dst_ca.o |
2 | 2 | ||
3 | EXTRA_CFLAGS += -Idrivers/media/dvb/dvb-core/ -Idrivers/media/video/bt8xx -Idrivers/media/dvb/frontends | 3 | EXTRA_CFLAGS += -Idrivers/media/dvb/dvb-core |
4 | EXTRA_CFLAGS += -Idrivers/media/dvb/frontends | ||
5 | EXTRA_CFLAGS += -Idrivers/media/video/bt8xx | ||
6 | EXTRA_CFLAGS += -Idrivers/media/video | ||
diff --git a/drivers/media/dvb/bt8xx/dst.c b/drivers/media/dvb/bt8xx/dst.c index 307ff35bdf13..75711bde23ad 100644 --- a/drivers/media/dvb/bt8xx/dst.c +++ b/drivers/media/dvb/bt8xx/dst.c | |||
@@ -1290,7 +1290,7 @@ static int dst_get_signal(struct dst_state *state) | |||
1290 | { | 1290 | { |
1291 | int retval; | 1291 | int retval; |
1292 | u8 get_signal[] = { 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfb }; | 1292 | u8 get_signal[] = { 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfb }; |
1293 | //dprintk("%s: Getting Signal strength and other parameters\n", __FUNCTION__); | 1293 | //dprintk("%s: Getting Signal strength and other parameters\n", __func__); |
1294 | if ((state->diseq_flags & ATTEMPT_TUNE) == 0) { | 1294 | if ((state->diseq_flags & ATTEMPT_TUNE) == 0) { |
1295 | state->decode_lock = state->decode_strength = state->decode_snr = 0; | 1295 | state->decode_lock = state->decode_strength = state->decode_snr = 0; |
1296 | return 0; | 1296 | return 0; |
diff --git a/drivers/media/dvb/bt8xx/dst_ca.c b/drivers/media/dvb/bt8xx/dst_ca.c index 50bc32a8bd55..0258451423ad 100644 --- a/drivers/media/dvb/bt8xx/dst_ca.c +++ b/drivers/media/dvb/bt8xx/dst_ca.c | |||
@@ -36,13 +36,13 @@ | |||
36 | #define dprintk(x, y, z, format, arg...) do { \ | 36 | #define dprintk(x, y, z, format, arg...) do { \ |
37 | if (z) { \ | 37 | if (z) { \ |
38 | if ((x > DST_CA_ERROR) && (x > y)) \ | 38 | if ((x > DST_CA_ERROR) && (x > y)) \ |
39 | printk(KERN_ERR "%s: " format "\n", __FUNCTION__ , ##arg); \ | 39 | printk(KERN_ERR "%s: " format "\n", __func__ , ##arg); \ |
40 | else if ((x > DST_CA_NOTICE) && (x > y)) \ | 40 | else if ((x > DST_CA_NOTICE) && (x > y)) \ |
41 | printk(KERN_NOTICE "%s: " format "\n", __FUNCTION__ , ##arg); \ | 41 | printk(KERN_NOTICE "%s: " format "\n", __func__ , ##arg); \ |
42 | else if ((x > DST_CA_INFO) && (x > y)) \ | 42 | else if ((x > DST_CA_INFO) && (x > y)) \ |
43 | printk(KERN_INFO "%s: " format "\n", __FUNCTION__ , ##arg); \ | 43 | printk(KERN_INFO "%s: " format "\n", __func__ , ##arg); \ |
44 | else if ((x > DST_CA_DEBUG) && (x > y)) \ | 44 | else if ((x > DST_CA_DEBUG) && (x > y)) \ |
45 | printk(KERN_DEBUG "%s: " format "\n", __FUNCTION__ , ##arg); \ | 45 | printk(KERN_DEBUG "%s: " format "\n", __func__ , ##arg); \ |
46 | } else { \ | 46 | } else { \ |
47 | if (x > y) \ | 47 | if (x > y) \ |
48 | printk(format, ## arg); \ | 48 | printk(format, ## arg); \ |
@@ -162,7 +162,7 @@ static int ca_get_app_info(struct dst_state *state) | |||
162 | dprintk(verbose, DST_CA_INFO, 1, " ================================ CI Module Application Info ======================================"); | 162 | dprintk(verbose, DST_CA_INFO, 1, " ================================ CI Module Application Info ======================================"); |
163 | dprintk(verbose, DST_CA_INFO, 1, " Application Type=[%d], Application Vendor=[%d], Vendor Code=[%d]\n%s: Application info=[%s]", | 163 | dprintk(verbose, DST_CA_INFO, 1, " Application Type=[%d], Application Vendor=[%d], Vendor Code=[%d]\n%s: Application info=[%s]", |
164 | state->messages[7], (state->messages[8] << 8) | state->messages[9], | 164 | state->messages[7], (state->messages[8] << 8) | state->messages[9], |
165 | (state->messages[10] << 8) | state->messages[11], __FUNCTION__, (char *)(&state->messages[12])); | 165 | (state->messages[10] << 8) | state->messages[11], __func__, (char *)(&state->messages[12])); |
166 | dprintk(verbose, DST_CA_INFO, 1, " =================================================================================================="); | 166 | dprintk(verbose, DST_CA_INFO, 1, " =================================================================================================="); |
167 | 167 | ||
168 | // Transform dst message to correct application_info message | 168 | // Transform dst message to correct application_info message |
diff --git a/drivers/media/dvb/bt8xx/dvb-bt8xx.c b/drivers/media/dvb/bt8xx/dvb-bt8xx.c index dedd30a8356b..6afbfbbef0ce 100644 --- a/drivers/media/dvb/bt8xx/dvb-bt8xx.c +++ b/drivers/media/dvb/bt8xx/dvb-bt8xx.c | |||
@@ -40,10 +40,12 @@ static int debug; | |||
40 | module_param(debug, int, 0644); | 40 | module_param(debug, int, 0644); |
41 | MODULE_PARM_DESC(debug, "Turn on/off debugging (default:off)."); | 41 | MODULE_PARM_DESC(debug, "Turn on/off debugging (default:off)."); |
42 | 42 | ||
43 | DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); | ||
44 | |||
43 | #define dprintk( args... ) \ | 45 | #define dprintk( args... ) \ |
44 | do \ | 46 | do { \ |
45 | if (debug) printk(KERN_DEBUG args); \ | 47 | if (debug) printk(KERN_DEBUG args); \ |
46 | while (0) | 48 | } while (0) |
47 | 49 | ||
48 | #define IF_FREQUENCYx6 217 /* 6 * 36.16666666667MHz */ | 50 | #define IF_FREQUENCYx6 217 /* 6 * 36.16666666667MHz */ |
49 | 51 | ||
@@ -609,8 +611,9 @@ static void frontend_init(struct dvb_bt8xx_card *card, u32 type) | |||
609 | lgdt330x_reset(card); | 611 | lgdt330x_reset(card); |
610 | card->fe = dvb_attach(lgdt330x_attach, &tdvs_tua6034_config, card->i2c_adapter); | 612 | card->fe = dvb_attach(lgdt330x_attach, &tdvs_tua6034_config, card->i2c_adapter); |
611 | if (card->fe != NULL) { | 613 | if (card->fe != NULL) { |
612 | dvb_attach(dvb_pll_attach, card->fe, 0x61, | 614 | dvb_attach(simple_tuner_attach, card->fe, |
613 | card->i2c_adapter, DVB_PLL_LG_TDVS_H06XF); | 615 | card->i2c_adapter, 0x61, |
616 | TUNER_LG_TDVS_H06XF); | ||
614 | dprintk ("dvb_bt8xx: lgdt330x detected\n"); | 617 | dprintk ("dvb_bt8xx: lgdt330x detected\n"); |
615 | } | 618 | } |
616 | break; | 619 | break; |
@@ -670,7 +673,7 @@ static void frontend_init(struct dvb_bt8xx_card *card, u32 type) | |||
670 | state->dst_ca = NULL; | 673 | state->dst_ca = NULL; |
671 | /* DST is not a frontend, attaching the ASIC */ | 674 | /* DST is not a frontend, attaching the ASIC */ |
672 | if (dvb_attach(dst_attach, state, &card->dvb_adapter) == NULL) { | 675 | if (dvb_attach(dst_attach, state, &card->dvb_adapter) == NULL) { |
673 | printk("%s: Could not find a Twinhan DST.\n", __FUNCTION__); | 676 | printk("%s: Could not find a Twinhan DST.\n", __func__); |
674 | break; | 677 | break; |
675 | } | 678 | } |
676 | /* Attach other DST peripherals if any */ | 679 | /* Attach other DST peripherals if any */ |
@@ -692,8 +695,9 @@ static void frontend_init(struct dvb_bt8xx_card *card, u32 type) | |||
692 | case BTTV_BOARD_PC_HDTV: | 695 | case BTTV_BOARD_PC_HDTV: |
693 | card->fe = dvb_attach(or51211_attach, &or51211_config, card->i2c_adapter); | 696 | card->fe = dvb_attach(or51211_attach, &or51211_config, card->i2c_adapter); |
694 | if (card->fe != NULL) | 697 | if (card->fe != NULL) |
695 | dvb_attach(dvb_pll_attach, card->fe, 0x61, | 698 | dvb_attach(simple_tuner_attach, card->fe, |
696 | card->i2c_adapter, DVB_PLL_FCV1236D); | 699 | card->i2c_adapter, 0x61, |
700 | TUNER_PHILIPS_FCV1236D); | ||
697 | break; | 701 | break; |
698 | } | 702 | } |
699 | 703 | ||
@@ -715,7 +719,10 @@ static int __devinit dvb_bt8xx_load_card(struct dvb_bt8xx_card *card, u32 type) | |||
715 | { | 719 | { |
716 | int result; | 720 | int result; |
717 | 721 | ||
718 | if ((result = dvb_register_adapter(&card->dvb_adapter, card->card_name, THIS_MODULE, &card->bt->dev->dev)) < 0) { | 722 | result = dvb_register_adapter(&card->dvb_adapter, card->card_name, |
723 | THIS_MODULE, &card->bt->dev->dev, | ||
724 | adapter_nr); | ||
725 | if (result < 0) { | ||
719 | printk("dvb_bt8xx: dvb_register_adapter failed (errno = %d)\n", result); | 726 | printk("dvb_bt8xx: dvb_register_adapter failed (errno = %d)\n", result); |
720 | return result; | 727 | return result; |
721 | } | 728 | } |
diff --git a/drivers/media/dvb/bt8xx/dvb-bt8xx.h b/drivers/media/dvb/bt8xx/dvb-bt8xx.h index 436880e68672..4499ed2ac0ed 100644 --- a/drivers/media/dvb/bt8xx/dvb-bt8xx.h +++ b/drivers/media/dvb/bt8xx/dvb-bt8xx.h | |||
@@ -38,7 +38,7 @@ | |||
38 | #include "or51211.h" | 38 | #include "or51211.h" |
39 | #include "lgdt330x.h" | 39 | #include "lgdt330x.h" |
40 | #include "zl10353.h" | 40 | #include "zl10353.h" |
41 | #include "dvb-pll.h" | 41 | #include "tuner-simple.h" |
42 | 42 | ||
43 | struct dvb_bt8xx_card { | 43 | struct dvb_bt8xx_card { |
44 | struct mutex lock; | 44 | struct mutex lock; |
diff --git a/drivers/media/dvb/cinergyT2/cinergyT2.c b/drivers/media/dvb/cinergyT2/cinergyT2.c index db08b0a8888a..f5010e8671b8 100644 --- a/drivers/media/dvb/cinergyT2/cinergyT2.c +++ b/drivers/media/dvb/cinergyT2/cinergyT2.c | |||
@@ -58,11 +58,13 @@ static int debug; | |||
58 | module_param_named(debug, debug, int, 0644); | 58 | module_param_named(debug, debug, int, 0644); |
59 | MODULE_PARM_DESC(debug, "Turn on/off debugging (default:off)."); | 59 | MODULE_PARM_DESC(debug, "Turn on/off debugging (default:off)."); |
60 | 60 | ||
61 | DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); | ||
62 | |||
61 | #define dprintk(level, args...) \ | 63 | #define dprintk(level, args...) \ |
62 | do { \ | 64 | do { \ |
63 | if ((debug & level)) { \ | 65 | if ((debug & level)) { \ |
64 | printk("%s: %s(): ", KBUILD_MODNAME, \ | 66 | printk("%s: %s(): ", KBUILD_MODNAME, \ |
65 | __FUNCTION__); \ | 67 | __func__); \ |
66 | printk(args); } \ | 68 | printk(args); } \ |
67 | } while (0) | 69 | } while (0) |
68 | 70 | ||
@@ -938,7 +940,10 @@ static int cinergyt2_probe (struct usb_interface *intf, | |||
938 | return -ENOMEM; | 940 | return -ENOMEM; |
939 | } | 941 | } |
940 | 942 | ||
941 | if ((err = dvb_register_adapter(&cinergyt2->adapter, DRIVER_NAME, THIS_MODULE, &cinergyt2->udev->dev)) < 0) { | 943 | err = dvb_register_adapter(&cinergyt2->adapter, DRIVER_NAME, |
944 | THIS_MODULE, &cinergyt2->udev->dev, | ||
945 | adapter_nr); | ||
946 | if (err < 0) { | ||
942 | kfree(cinergyt2); | 947 | kfree(cinergyt2); |
943 | return err; | 948 | return err; |
944 | } | 949 | } |
diff --git a/drivers/media/dvb/dvb-core/demux.h b/drivers/media/dvb/dvb-core/demux.h index 0c1d87c5227a..b0d347daae47 100644 --- a/drivers/media/dvb/dvb-core/demux.h +++ b/drivers/media/dvb/dvb-core/demux.h | |||
@@ -80,6 +80,8 @@ enum dmx_success { | |||
80 | #define TS_PAYLOAD_ONLY 2 /* in case TS_PACKET is set, only send the TS | 80 | #define TS_PAYLOAD_ONLY 2 /* in case TS_PACKET is set, only send the TS |
81 | payload (<=184 bytes per packet) to callback */ | 81 | payload (<=184 bytes per packet) to callback */ |
82 | #define TS_DECODER 4 /* send stream to built-in decoder (if present) */ | 82 | #define TS_DECODER 4 /* send stream to built-in decoder (if present) */ |
83 | #define TS_DEMUX 8 /* in case TS_PACKET is set, send the TS to | ||
84 | the demux device, not to the dvr device */ | ||
83 | 85 | ||
84 | /* PES type for filters which write to built-in decoder */ | 86 | /* PES type for filters which write to built-in decoder */ |
85 | /* these should be kept identical to the types in dmx.h */ | 87 | /* these should be kept identical to the types in dmx.h */ |
diff --git a/drivers/media/dvb/dvb-core/dmxdev.c b/drivers/media/dvb/dvb-core/dmxdev.c index f94bc31e3b33..df5bef6a2517 100644 --- a/drivers/media/dvb/dvb-core/dmxdev.c +++ b/drivers/media/dvb/dvb-core/dmxdev.c | |||
@@ -126,7 +126,7 @@ static int dvb_dvr_open(struct inode *inode, struct file *file) | |||
126 | struct dmxdev *dmxdev = dvbdev->priv; | 126 | struct dmxdev *dmxdev = dvbdev->priv; |
127 | struct dmx_frontend *front; | 127 | struct dmx_frontend *front; |
128 | 128 | ||
129 | dprintk("function : %s\n", __FUNCTION__); | 129 | dprintk("function : %s\n", __func__); |
130 | 130 | ||
131 | if (mutex_lock_interruptible(&dmxdev->mutex)) | 131 | if (mutex_lock_interruptible(&dmxdev->mutex)) |
132 | return -ERESTARTSYS; | 132 | return -ERESTARTSYS; |
@@ -259,6 +259,39 @@ static ssize_t dvb_dvr_read(struct file *file, char __user *buf, size_t count, | |||
259 | return ret; | 259 | return ret; |
260 | } | 260 | } |
261 | 261 | ||
262 | static int dvb_dvr_set_buffer_size(struct dmxdev *dmxdev, | ||
263 | unsigned long size) | ||
264 | { | ||
265 | struct dvb_ringbuffer *buf = &dmxdev->dvr_buffer; | ||
266 | void *newmem; | ||
267 | void *oldmem; | ||
268 | |||
269 | dprintk("function : %s\n", __func__); | ||
270 | |||
271 | if (buf->size == size) | ||
272 | return 0; | ||
273 | if (!size) | ||
274 | return -EINVAL; | ||
275 | |||
276 | newmem = vmalloc(size); | ||
277 | if (!newmem) | ||
278 | return -ENOMEM; | ||
279 | |||
280 | oldmem = buf->data; | ||
281 | |||
282 | spin_lock_irq(&dmxdev->lock); | ||
283 | buf->data = newmem; | ||
284 | buf->size = size; | ||
285 | |||
286 | /* reset and not flush in case the buffer shrinks */ | ||
287 | dvb_ringbuffer_reset(buf); | ||
288 | spin_unlock_irq(&dmxdev->lock); | ||
289 | |||
290 | vfree(oldmem); | ||
291 | |||
292 | return 0; | ||
293 | } | ||
294 | |||
262 | static inline void dvb_dmxdev_filter_state_set(struct dmxdev_filter | 295 | static inline void dvb_dmxdev_filter_state_set(struct dmxdev_filter |
263 | *dmxdevfilter, int state) | 296 | *dmxdevfilter, int state) |
264 | { | 297 | { |
@@ -271,28 +304,32 @@ static int dvb_dmxdev_set_buffer_size(struct dmxdev_filter *dmxdevfilter, | |||
271 | unsigned long size) | 304 | unsigned long size) |
272 | { | 305 | { |
273 | struct dvb_ringbuffer *buf = &dmxdevfilter->buffer; | 306 | struct dvb_ringbuffer *buf = &dmxdevfilter->buffer; |
274 | void *mem; | 307 | void *newmem; |
308 | void *oldmem; | ||
275 | 309 | ||
276 | if (buf->size == size) | 310 | if (buf->size == size) |
277 | return 0; | 311 | return 0; |
312 | if (!size) | ||
313 | return -EINVAL; | ||
278 | if (dmxdevfilter->state >= DMXDEV_STATE_GO) | 314 | if (dmxdevfilter->state >= DMXDEV_STATE_GO) |
279 | return -EBUSY; | 315 | return -EBUSY; |
316 | |||
317 | newmem = vmalloc(size); | ||
318 | if (!newmem) | ||
319 | return -ENOMEM; | ||
320 | |||
321 | oldmem = buf->data; | ||
322 | |||
280 | spin_lock_irq(&dmxdevfilter->dev->lock); | 323 | spin_lock_irq(&dmxdevfilter->dev->lock); |
281 | mem = buf->data; | 324 | buf->data = newmem; |
282 | buf->data = NULL; | ||
283 | buf->size = size; | 325 | buf->size = size; |
284 | dvb_ringbuffer_flush(buf); | 326 | |
327 | /* reset and not flush in case the buffer shrinks */ | ||
328 | dvb_ringbuffer_reset(buf); | ||
285 | spin_unlock_irq(&dmxdevfilter->dev->lock); | 329 | spin_unlock_irq(&dmxdevfilter->dev->lock); |
286 | vfree(mem); | ||
287 | 330 | ||
288 | if (buf->size) { | 331 | vfree(oldmem); |
289 | mem = vmalloc(dmxdevfilter->buffer.size); | 332 | |
290 | if (!mem) | ||
291 | return -ENOMEM; | ||
292 | spin_lock_irq(&dmxdevfilter->dev->lock); | ||
293 | buf->data = mem; | ||
294 | spin_unlock_irq(&dmxdevfilter->dev->lock); | ||
295 | } | ||
296 | return 0; | 333 | return 0; |
297 | } | 334 | } |
298 | 335 | ||
@@ -374,7 +411,8 @@ static int dvb_dmxdev_ts_callback(const u8 *buffer1, size_t buffer1_len, | |||
374 | return 0; | 411 | return 0; |
375 | } | 412 | } |
376 | 413 | ||
377 | if (dmxdevfilter->params.pes.output == DMX_OUT_TAP) | 414 | if (dmxdevfilter->params.pes.output == DMX_OUT_TAP |
415 | || dmxdevfilter->params.pes.output == DMX_OUT_TSDEMUX_TAP) | ||
378 | buffer = &dmxdevfilter->buffer; | 416 | buffer = &dmxdevfilter->buffer; |
379 | else | 417 | else |
380 | buffer = &dmxdevfilter->dev->dvr_buffer; | 418 | buffer = &dmxdevfilter->dev->dvr_buffer; |
@@ -550,7 +588,7 @@ static int dvb_dmxdev_filter_start(struct dmxdev_filter *filter) | |||
550 | dvb_dmxdev_section_callback); | 588 | dvb_dmxdev_section_callback); |
551 | if (ret < 0) { | 589 | if (ret < 0) { |
552 | printk("DVB (%s): could not alloc feed\n", | 590 | printk("DVB (%s): could not alloc feed\n", |
553 | __FUNCTION__); | 591 | __func__); |
554 | return ret; | 592 | return ret; |
555 | } | 593 | } |
556 | 594 | ||
@@ -558,7 +596,7 @@ static int dvb_dmxdev_filter_start(struct dmxdev_filter *filter) | |||
558 | (para->flags & DMX_CHECK_CRC) ? 1 : 0); | 596 | (para->flags & DMX_CHECK_CRC) ? 1 : 0); |
559 | if (ret < 0) { | 597 | if (ret < 0) { |
560 | printk("DVB (%s): could not set feed\n", | 598 | printk("DVB (%s): could not set feed\n", |
561 | __FUNCTION__); | 599 | __func__); |
562 | dvb_dmxdev_feed_restart(filter); | 600 | dvb_dmxdev_feed_restart(filter); |
563 | return ret; | 601 | return ret; |
564 | } | 602 | } |
@@ -620,9 +658,10 @@ static int dvb_dmxdev_filter_start(struct dmxdev_filter *filter) | |||
620 | 658 | ||
621 | if (otype == DMX_OUT_TS_TAP) | 659 | if (otype == DMX_OUT_TS_TAP) |
622 | ts_type |= TS_PACKET; | 660 | ts_type |= TS_PACKET; |
623 | 661 | else if (otype == DMX_OUT_TSDEMUX_TAP) | |
624 | if (otype == DMX_OUT_TAP) | 662 | ts_type |= TS_PACKET | TS_DEMUX; |
625 | ts_type |= TS_PAYLOAD_ONLY | TS_PACKET; | 663 | else if (otype == DMX_OUT_TAP) |
664 | ts_type |= TS_PACKET | TS_DEMUX | TS_PAYLOAD_ONLY; | ||
626 | 665 | ||
627 | ret = dmxdev->demux->allocate_ts_feed(dmxdev->demux, | 666 | ret = dmxdev->demux->allocate_ts_feed(dmxdev->demux, |
628 | tsfeed, | 667 | tsfeed, |
@@ -732,7 +771,7 @@ static int dvb_dmxdev_filter_set(struct dmxdev *dmxdev, | |||
732 | struct dmxdev_filter *dmxdevfilter, | 771 | struct dmxdev_filter *dmxdevfilter, |
733 | struct dmx_sct_filter_params *params) | 772 | struct dmx_sct_filter_params *params) |
734 | { | 773 | { |
735 | dprintk("function : %s\n", __FUNCTION__); | 774 | dprintk("function : %s\n", __func__); |
736 | 775 | ||
737 | dvb_dmxdev_filter_stop(dmxdevfilter); | 776 | dvb_dmxdev_filter_stop(dmxdevfilter); |
738 | 777 | ||
@@ -1007,6 +1046,7 @@ static int dvb_dvr_do_ioctl(struct inode *inode, struct file *file, | |||
1007 | { | 1046 | { |
1008 | struct dvb_device *dvbdev = file->private_data; | 1047 | struct dvb_device *dvbdev = file->private_data; |
1009 | struct dmxdev *dmxdev = dvbdev->priv; | 1048 | struct dmxdev *dmxdev = dvbdev->priv; |
1049 | unsigned long arg = (unsigned long)parg; | ||
1010 | int ret; | 1050 | int ret; |
1011 | 1051 | ||
1012 | if (mutex_lock_interruptible(&dmxdev->mutex)) | 1052 | if (mutex_lock_interruptible(&dmxdev->mutex)) |
@@ -1014,8 +1054,7 @@ static int dvb_dvr_do_ioctl(struct inode *inode, struct file *file, | |||
1014 | 1054 | ||
1015 | switch (cmd) { | 1055 | switch (cmd) { |
1016 | case DMX_SET_BUFFER_SIZE: | 1056 | case DMX_SET_BUFFER_SIZE: |
1017 | // FIXME: implement | 1057 | ret = dvb_dvr_set_buffer_size(dmxdev, arg); |
1018 | ret = 0; | ||
1019 | break; | 1058 | break; |
1020 | 1059 | ||
1021 | default: | 1060 | default: |
@@ -1038,7 +1077,7 @@ static unsigned int dvb_dvr_poll(struct file *file, poll_table *wait) | |||
1038 | struct dmxdev *dmxdev = dvbdev->priv; | 1077 | struct dmxdev *dmxdev = dvbdev->priv; |
1039 | unsigned int mask = 0; | 1078 | unsigned int mask = 0; |
1040 | 1079 | ||
1041 | dprintk("function : %s\n", __FUNCTION__); | 1080 | dprintk("function : %s\n", __func__); |
1042 | 1081 | ||
1043 | poll_wait(file, &dmxdev->dvr_buffer.queue, wait); | 1082 | poll_wait(file, &dmxdev->dvr_buffer.queue, wait); |
1044 | 1083 | ||
diff --git a/drivers/media/dvb/dvb-core/dvb_ca_en50221.c b/drivers/media/dvb/dvb-core/dvb_ca_en50221.c index 89437fdab8be..8cbdb0ec67e2 100644 --- a/drivers/media/dvb/dvb-core/dvb_ca_en50221.c +++ b/drivers/media/dvb/dvb-core/dvb_ca_en50221.c | |||
@@ -250,7 +250,7 @@ static int dvb_ca_en50221_wait_if_status(struct dvb_ca_private *ca, int slot, | |||
250 | unsigned long timeout; | 250 | unsigned long timeout; |
251 | unsigned long start; | 251 | unsigned long start; |
252 | 252 | ||
253 | dprintk("%s\n", __FUNCTION__); | 253 | dprintk("%s\n", __func__); |
254 | 254 | ||
255 | /* loop until timeout elapsed */ | 255 | /* loop until timeout elapsed */ |
256 | start = jiffies; | 256 | start = jiffies; |
@@ -263,7 +263,7 @@ static int dvb_ca_en50221_wait_if_status(struct dvb_ca_private *ca, int slot, | |||
263 | 263 | ||
264 | /* if we got the flags, it was successful! */ | 264 | /* if we got the flags, it was successful! */ |
265 | if (res & waitfor) { | 265 | if (res & waitfor) { |
266 | dprintk("%s succeeded timeout:%lu\n", __FUNCTION__, jiffies - start); | 266 | dprintk("%s succeeded timeout:%lu\n", __func__, jiffies - start); |
267 | return 0; | 267 | return 0; |
268 | } | 268 | } |
269 | 269 | ||
@@ -276,7 +276,7 @@ static int dvb_ca_en50221_wait_if_status(struct dvb_ca_private *ca, int slot, | |||
276 | msleep(1); | 276 | msleep(1); |
277 | } | 277 | } |
278 | 278 | ||
279 | dprintk("%s failed timeout:%lu\n", __FUNCTION__, jiffies - start); | 279 | dprintk("%s failed timeout:%lu\n", __func__, jiffies - start); |
280 | 280 | ||
281 | /* if we get here, we've timed out */ | 281 | /* if we get here, we've timed out */ |
282 | return -ETIMEDOUT; | 282 | return -ETIMEDOUT; |
@@ -297,7 +297,7 @@ static int dvb_ca_en50221_link_init(struct dvb_ca_private *ca, int slot) | |||
297 | int buf_size; | 297 | int buf_size; |
298 | u8 buf[2]; | 298 | u8 buf[2]; |
299 | 299 | ||
300 | dprintk("%s\n", __FUNCTION__); | 300 | dprintk("%s\n", __func__); |
301 | 301 | ||
302 | /* we'll be determining these during this function */ | 302 | /* we'll be determining these during this function */ |
303 | ca->slot_info[slot].da_irq_supported = 0; | 303 | ca->slot_info[slot].da_irq_supported = 0; |
@@ -549,7 +549,7 @@ static int dvb_ca_en50221_set_configoption(struct dvb_ca_private *ca, int slot) | |||
549 | { | 549 | { |
550 | int configoption; | 550 | int configoption; |
551 | 551 | ||
552 | dprintk("%s\n", __FUNCTION__); | 552 | dprintk("%s\n", __func__); |
553 | 553 | ||
554 | /* set the config option */ | 554 | /* set the config option */ |
555 | ca->pub->write_attribute_mem(ca->pub, slot, | 555 | ca->pub->write_attribute_mem(ca->pub, slot, |
@@ -587,7 +587,7 @@ static int dvb_ca_en50221_read_data(struct dvb_ca_private *ca, int slot, u8 * eb | |||
587 | u8 buf[HOST_LINK_BUF_SIZE]; | 587 | u8 buf[HOST_LINK_BUF_SIZE]; |
588 | int i; | 588 | int i; |
589 | 589 | ||
590 | dprintk("%s\n", __FUNCTION__); | 590 | dprintk("%s\n", __func__); |
591 | 591 | ||
592 | /* check if we have space for a link buf in the rx_buffer */ | 592 | /* check if we have space for a link buf in the rx_buffer */ |
593 | if (ebuf == NULL) { | 593 | if (ebuf == NULL) { |
@@ -708,7 +708,7 @@ static int dvb_ca_en50221_write_data(struct dvb_ca_private *ca, int slot, u8 * b | |||
708 | int status; | 708 | int status; |
709 | int i; | 709 | int i; |
710 | 710 | ||
711 | dprintk("%s\n", __FUNCTION__); | 711 | dprintk("%s\n", __func__); |
712 | 712 | ||
713 | 713 | ||
714 | // sanity check | 714 | // sanity check |
@@ -785,7 +785,7 @@ EXPORT_SYMBOL(dvb_ca_en50221_camchange_irq); | |||
785 | */ | 785 | */ |
786 | static int dvb_ca_en50221_slot_shutdown(struct dvb_ca_private *ca, int slot) | 786 | static int dvb_ca_en50221_slot_shutdown(struct dvb_ca_private *ca, int slot) |
787 | { | 787 | { |
788 | dprintk("%s\n", __FUNCTION__); | 788 | dprintk("%s\n", __func__); |
789 | 789 | ||
790 | ca->pub->slot_shutdown(ca->pub, slot); | 790 | ca->pub->slot_shutdown(ca->pub, slot); |
791 | ca->slot_info[slot].slot_state = DVB_CA_SLOTSTATE_NONE; | 791 | ca->slot_info[slot].slot_state = DVB_CA_SLOTSTATE_NONE; |
@@ -892,7 +892,7 @@ void dvb_ca_en50221_frda_irq(struct dvb_ca_en50221 *pubca, int slot) | |||
892 | static void dvb_ca_en50221_thread_wakeup(struct dvb_ca_private *ca) | 892 | static void dvb_ca_en50221_thread_wakeup(struct dvb_ca_private *ca) |
893 | { | 893 | { |
894 | 894 | ||
895 | dprintk("%s\n", __FUNCTION__); | 895 | dprintk("%s\n", __func__); |
896 | 896 | ||
897 | ca->wakeup = 1; | 897 | ca->wakeup = 1; |
898 | mb(); | 898 | mb(); |
@@ -964,7 +964,7 @@ static int dvb_ca_en50221_thread(void *data) | |||
964 | int pktcount; | 964 | int pktcount; |
965 | void *rxbuf; | 965 | void *rxbuf; |
966 | 966 | ||
967 | dprintk("%s\n", __FUNCTION__); | 967 | dprintk("%s\n", __func__); |
968 | 968 | ||
969 | /* choose the correct initial delay */ | 969 | /* choose the correct initial delay */ |
970 | dvb_ca_en50221_thread_update_delay(ca); | 970 | dvb_ca_en50221_thread_update_delay(ca); |
@@ -1172,7 +1172,7 @@ static int dvb_ca_en50221_io_do_ioctl(struct inode *inode, struct file *file, | |||
1172 | int err = 0; | 1172 | int err = 0; |
1173 | int slot; | 1173 | int slot; |
1174 | 1174 | ||
1175 | dprintk("%s\n", __FUNCTION__); | 1175 | dprintk("%s\n", __func__); |
1176 | 1176 | ||
1177 | switch (cmd) { | 1177 | switch (cmd) { |
1178 | case CA_RESET: | 1178 | case CA_RESET: |
@@ -1266,7 +1266,7 @@ static ssize_t dvb_ca_en50221_io_write(struct file *file, | |||
1266 | unsigned long timeout; | 1266 | unsigned long timeout; |
1267 | int written; | 1267 | int written; |
1268 | 1268 | ||
1269 | dprintk("%s\n", __FUNCTION__); | 1269 | dprintk("%s\n", __func__); |
1270 | 1270 | ||
1271 | /* Incoming packet has a 2 byte header. hdr[0] = slot_id, hdr[1] = connection_id */ | 1271 | /* Incoming packet has a 2 byte header. hdr[0] = slot_id, hdr[1] = connection_id */ |
1272 | if (count < 2) | 1272 | if (count < 2) |
@@ -1401,7 +1401,7 @@ static ssize_t dvb_ca_en50221_io_read(struct file *file, char __user * buf, | |||
1401 | int pktlen; | 1401 | int pktlen; |
1402 | int dispose = 0; | 1402 | int dispose = 0; |
1403 | 1403 | ||
1404 | dprintk("%s\n", __FUNCTION__); | 1404 | dprintk("%s\n", __func__); |
1405 | 1405 | ||
1406 | /* Outgoing packet has a 2 byte header. hdr[0] = slot_id, hdr[1] = connection_id */ | 1406 | /* Outgoing packet has a 2 byte header. hdr[0] = slot_id, hdr[1] = connection_id */ |
1407 | if (count < 2) | 1407 | if (count < 2) |
@@ -1490,7 +1490,7 @@ static int dvb_ca_en50221_io_open(struct inode *inode, struct file *file) | |||
1490 | int err; | 1490 | int err; |
1491 | int i; | 1491 | int i; |
1492 | 1492 | ||
1493 | dprintk("%s\n", __FUNCTION__); | 1493 | dprintk("%s\n", __func__); |
1494 | 1494 | ||
1495 | if (!try_module_get(ca->pub->owner)) | 1495 | if (!try_module_get(ca->pub->owner)) |
1496 | return -EIO; | 1496 | return -EIO; |
@@ -1534,7 +1534,7 @@ static int dvb_ca_en50221_io_release(struct inode *inode, struct file *file) | |||
1534 | struct dvb_ca_private *ca = dvbdev->priv; | 1534 | struct dvb_ca_private *ca = dvbdev->priv; |
1535 | int err; | 1535 | int err; |
1536 | 1536 | ||
1537 | dprintk("%s\n", __FUNCTION__); | 1537 | dprintk("%s\n", __func__); |
1538 | 1538 | ||
1539 | /* mark the CA device as closed */ | 1539 | /* mark the CA device as closed */ |
1540 | ca->open = 0; | 1540 | ca->open = 0; |
@@ -1564,7 +1564,7 @@ static unsigned int dvb_ca_en50221_io_poll(struct file *file, poll_table * wait) | |||
1564 | int slot; | 1564 | int slot; |
1565 | int result = 0; | 1565 | int result = 0; |
1566 | 1566 | ||
1567 | dprintk("%s\n", __FUNCTION__); | 1567 | dprintk("%s\n", __func__); |
1568 | 1568 | ||
1569 | if (dvb_ca_en50221_io_read_condition(ca, &result, &slot) == 1) { | 1569 | if (dvb_ca_en50221_io_read_condition(ca, &result, &slot) == 1) { |
1570 | mask |= POLLIN; | 1570 | mask |= POLLIN; |
@@ -1626,7 +1626,7 @@ int dvb_ca_en50221_init(struct dvb_adapter *dvb_adapter, | |||
1626 | struct dvb_ca_private *ca = NULL; | 1626 | struct dvb_ca_private *ca = NULL; |
1627 | int i; | 1627 | int i; |
1628 | 1628 | ||
1629 | dprintk("%s\n", __FUNCTION__); | 1629 | dprintk("%s\n", __func__); |
1630 | 1630 | ||
1631 | if (slot_count < 1) | 1631 | if (slot_count < 1) |
1632 | return -EINVAL; | 1632 | return -EINVAL; |
@@ -1704,7 +1704,7 @@ void dvb_ca_en50221_release(struct dvb_ca_en50221 *pubca) | |||
1704 | struct dvb_ca_private *ca = pubca->private; | 1704 | struct dvb_ca_private *ca = pubca->private; |
1705 | int i; | 1705 | int i; |
1706 | 1706 | ||
1707 | dprintk("%s\n", __FUNCTION__); | 1707 | dprintk("%s\n", __func__); |
1708 | 1708 | ||
1709 | /* shutdown the thread if there was one */ | 1709 | /* shutdown the thread if there was one */ |
1710 | kthread_stop(ca->thread); | 1710 | kthread_stop(ca->thread); |
diff --git a/drivers/media/dvb/dvb-core/dvb_demux.c b/drivers/media/dvb/dvb-core/dvb_demux.c index 7959020f9317..934e15fffc56 100644 --- a/drivers/media/dvb/dvb-core/dvb_demux.c +++ b/drivers/media/dvb/dvb-core/dvb_demux.c | |||
@@ -368,7 +368,7 @@ static inline void dvb_dmx_swfilter_packet_type(struct dvb_demux_feed *feed, | |||
368 | #define DVR_FEED(f) \ | 368 | #define DVR_FEED(f) \ |
369 | (((f)->type == DMX_TYPE_TS) && \ | 369 | (((f)->type == DMX_TYPE_TS) && \ |
370 | ((f)->feed.ts.is_filtering) && \ | 370 | ((f)->feed.ts.is_filtering) && \ |
371 | (((f)->ts_type & (TS_PACKET|TS_PAYLOAD_ONLY)) == TS_PACKET)) | 371 | (((f)->ts_type & (TS_PACKET | TS_DEMUX)) == TS_PACKET)) |
372 | 372 | ||
373 | static void dvb_dmx_swfilter_packet(struct dvb_demux *demux, const u8 *buf) | 373 | static void dvb_dmx_swfilter_packet(struct dvb_demux *demux, const u8 *buf) |
374 | { | 374 | { |
@@ -553,7 +553,7 @@ static void dvb_demux_feed_add(struct dvb_demux_feed *feed) | |||
553 | spin_lock_irq(&feed->demux->lock); | 553 | spin_lock_irq(&feed->demux->lock); |
554 | if (dvb_demux_feed_find(feed)) { | 554 | if (dvb_demux_feed_find(feed)) { |
555 | printk(KERN_ERR "%s: feed already in list (type=%x state=%x pid=%x)\n", | 555 | printk(KERN_ERR "%s: feed already in list (type=%x state=%x pid=%x)\n", |
556 | __FUNCTION__, feed->type, feed->state, feed->pid); | 556 | __func__, feed->type, feed->state, feed->pid); |
557 | goto out; | 557 | goto out; |
558 | } | 558 | } |
559 | 559 | ||
@@ -567,7 +567,7 @@ static void dvb_demux_feed_del(struct dvb_demux_feed *feed) | |||
567 | spin_lock_irq(&feed->demux->lock); | 567 | spin_lock_irq(&feed->demux->lock); |
568 | if (!(dvb_demux_feed_find(feed))) { | 568 | if (!(dvb_demux_feed_find(feed))) { |
569 | printk(KERN_ERR "%s: feed not in list (type=%x state=%x pid=%x)\n", | 569 | printk(KERN_ERR "%s: feed not in list (type=%x state=%x pid=%x)\n", |
570 | __FUNCTION__, feed->type, feed->state, feed->pid); | 570 | __func__, feed->type, feed->state, feed->pid); |
571 | goto out; | 571 | goto out; |
572 | } | 572 | } |
573 | 573 | ||
diff --git a/drivers/media/dvb/dvb-core/dvb_frontend.c b/drivers/media/dvb/dvb-core/dvb_frontend.c index 925cfa6221ad..2dddd08c5445 100644 --- a/drivers/media/dvb/dvb-core/dvb_frontend.c +++ b/drivers/media/dvb/dvb-core/dvb_frontend.c | |||
@@ -135,7 +135,7 @@ static void dvb_frontend_add_event(struct dvb_frontend *fe, fe_status_t status) | |||
135 | struct dvb_frontend_event *e; | 135 | struct dvb_frontend_event *e; |
136 | int wp; | 136 | int wp; |
137 | 137 | ||
138 | dprintk ("%s\n", __FUNCTION__); | 138 | dprintk ("%s\n", __func__); |
139 | 139 | ||
140 | if (mutex_lock_interruptible (&events->mtx)) | 140 | if (mutex_lock_interruptible (&events->mtx)) |
141 | return; | 141 | return; |
@@ -171,7 +171,7 @@ static int dvb_frontend_get_event(struct dvb_frontend *fe, | |||
171 | struct dvb_frontend_private *fepriv = fe->frontend_priv; | 171 | struct dvb_frontend_private *fepriv = fe->frontend_priv; |
172 | struct dvb_fe_events *events = &fepriv->events; | 172 | struct dvb_fe_events *events = &fepriv->events; |
173 | 173 | ||
174 | dprintk ("%s\n", __FUNCTION__); | 174 | dprintk ("%s\n", __func__); |
175 | 175 | ||
176 | if (events->overflow) { | 176 | if (events->overflow) { |
177 | events->overflow = 0; | 177 | events->overflow = 0; |
@@ -237,7 +237,7 @@ static void dvb_frontend_swzigzag_update_delay(struct dvb_frontend_private *fepr | |||
237 | { | 237 | { |
238 | int q2; | 238 | int q2; |
239 | 239 | ||
240 | dprintk ("%s\n", __FUNCTION__); | 240 | dprintk ("%s\n", __func__); |
241 | 241 | ||
242 | if (locked) | 242 | if (locked) |
243 | (fepriv->quality) = (fepriv->quality * 220 + 36*256) / 256; | 243 | (fepriv->quality) = (fepriv->quality * 220 + 36*256) / 256; |
@@ -329,7 +329,7 @@ static int dvb_frontend_swzigzag_autotune(struct dvb_frontend *fe, int check_wra | |||
329 | 329 | ||
330 | dprintk("%s: drift:%i inversion:%i auto_step:%i " | 330 | dprintk("%s: drift:%i inversion:%i auto_step:%i " |
331 | "auto_sub_step:%i started_auto_step:%i\n", | 331 | "auto_sub_step:%i started_auto_step:%i\n", |
332 | __FUNCTION__, fepriv->lnb_drift, fepriv->inversion, | 332 | __func__, fepriv->lnb_drift, fepriv->inversion, |
333 | fepriv->auto_step, fepriv->auto_sub_step, fepriv->started_auto_step); | 333 | fepriv->auto_step, fepriv->auto_sub_step, fepriv->started_auto_step); |
334 | 334 | ||
335 | /* set the frontend itself */ | 335 | /* set the frontend itself */ |
@@ -511,7 +511,7 @@ static int dvb_frontend_thread(void *data) | |||
511 | fe_status_t s; | 511 | fe_status_t s; |
512 | struct dvb_frontend_parameters *params; | 512 | struct dvb_frontend_parameters *params; |
513 | 513 | ||
514 | dprintk("%s\n", __FUNCTION__); | 514 | dprintk("%s\n", __func__); |
515 | 515 | ||
516 | fepriv->check_wrapped = 0; | 516 | fepriv->check_wrapped = 0; |
517 | fepriv->quality = 0; | 517 | fepriv->quality = 0; |
@@ -597,7 +597,7 @@ static void dvb_frontend_stop(struct dvb_frontend *fe) | |||
597 | { | 597 | { |
598 | struct dvb_frontend_private *fepriv = fe->frontend_priv; | 598 | struct dvb_frontend_private *fepriv = fe->frontend_priv; |
599 | 599 | ||
600 | dprintk ("%s\n", __FUNCTION__); | 600 | dprintk ("%s\n", __func__); |
601 | 601 | ||
602 | fepriv->exit = 1; | 602 | fepriv->exit = 1; |
603 | mb(); | 603 | mb(); |
@@ -665,7 +665,7 @@ static int dvb_frontend_start(struct dvb_frontend *fe) | |||
665 | struct dvb_frontend_private *fepriv = fe->frontend_priv; | 665 | struct dvb_frontend_private *fepriv = fe->frontend_priv; |
666 | struct task_struct *fe_thread; | 666 | struct task_struct *fe_thread; |
667 | 667 | ||
668 | dprintk ("%s\n", __FUNCTION__); | 668 | dprintk ("%s\n", __func__); |
669 | 669 | ||
670 | if (fepriv->thread) { | 670 | if (fepriv->thread) { |
671 | if (!fepriv->exit) | 671 | if (!fepriv->exit) |
@@ -763,7 +763,7 @@ static int dvb_frontend_ioctl(struct inode *inode, struct file *file, | |||
763 | struct dvb_frontend_private *fepriv = fe->frontend_priv; | 763 | struct dvb_frontend_private *fepriv = fe->frontend_priv; |
764 | int err = -EOPNOTSUPP; | 764 | int err = -EOPNOTSUPP; |
765 | 765 | ||
766 | dprintk ("%s\n", __FUNCTION__); | 766 | dprintk ("%s\n", __func__); |
767 | 767 | ||
768 | if (fepriv->exit) | 768 | if (fepriv->exit) |
769 | return -ENODEV; | 769 | return -ENODEV; |
@@ -895,7 +895,7 @@ static int dvb_frontend_ioctl(struct inode *inode, struct file *file, | |||
895 | int i; | 895 | int i; |
896 | u8 last = 1; | 896 | u8 last = 1; |
897 | if (dvb_frontend_debug) | 897 | if (dvb_frontend_debug) |
898 | printk("%s switch command: 0x%04lx\n", __FUNCTION__, cmd); | 898 | printk("%s switch command: 0x%04lx\n", __func__, cmd); |
899 | do_gettimeofday(&nexttime); | 899 | do_gettimeofday(&nexttime); |
900 | if (dvb_frontend_debug) | 900 | if (dvb_frontend_debug) |
901 | memcpy(&tv[0], &nexttime, sizeof(struct timeval)); | 901 | memcpy(&tv[0], &nexttime, sizeof(struct timeval)); |
@@ -919,7 +919,7 @@ static int dvb_frontend_ioctl(struct inode *inode, struct file *file, | |||
919 | } | 919 | } |
920 | if (dvb_frontend_debug) { | 920 | if (dvb_frontend_debug) { |
921 | printk("%s(%d): switch delay (should be 32k followed by all 8k\n", | 921 | printk("%s(%d): switch delay (should be 32k followed by all 8k\n", |
922 | __FUNCTION__, fe->dvb->num); | 922 | __func__, fe->dvb->num); |
923 | for (i = 1; i < 10; i++) | 923 | for (i = 1; i < 10; i++) |
924 | printk("%d: %d\n", i, timeval_usec_diff(tv[i-1] , tv[i])); | 924 | printk("%d: %d\n", i, timeval_usec_diff(tv[i-1] , tv[i])); |
925 | } | 925 | } |
@@ -1037,7 +1037,7 @@ static unsigned int dvb_frontend_poll(struct file *file, struct poll_table_struc | |||
1037 | struct dvb_frontend *fe = dvbdev->priv; | 1037 | struct dvb_frontend *fe = dvbdev->priv; |
1038 | struct dvb_frontend_private *fepriv = fe->frontend_priv; | 1038 | struct dvb_frontend_private *fepriv = fe->frontend_priv; |
1039 | 1039 | ||
1040 | dprintk ("%s\n", __FUNCTION__); | 1040 | dprintk ("%s\n", __func__); |
1041 | 1041 | ||
1042 | poll_wait (file, &fepriv->events.wait_queue, wait); | 1042 | poll_wait (file, &fepriv->events.wait_queue, wait); |
1043 | 1043 | ||
@@ -1054,7 +1054,7 @@ static int dvb_frontend_open(struct inode *inode, struct file *file) | |||
1054 | struct dvb_frontend_private *fepriv = fe->frontend_priv; | 1054 | struct dvb_frontend_private *fepriv = fe->frontend_priv; |
1055 | int ret; | 1055 | int ret; |
1056 | 1056 | ||
1057 | dprintk ("%s\n", __FUNCTION__); | 1057 | dprintk ("%s\n", __func__); |
1058 | 1058 | ||
1059 | if (dvbdev->users == -1 && fe->ops.ts_bus_ctrl) { | 1059 | if (dvbdev->users == -1 && fe->ops.ts_bus_ctrl) { |
1060 | if ((ret = fe->ops.ts_bus_ctrl(fe, 1)) < 0) | 1060 | if ((ret = fe->ops.ts_bus_ctrl(fe, 1)) < 0) |
@@ -1095,7 +1095,7 @@ static int dvb_frontend_release(struct inode *inode, struct file *file) | |||
1095 | struct dvb_frontend_private *fepriv = fe->frontend_priv; | 1095 | struct dvb_frontend_private *fepriv = fe->frontend_priv; |
1096 | int ret; | 1096 | int ret; |
1097 | 1097 | ||
1098 | dprintk ("%s\n", __FUNCTION__); | 1098 | dprintk ("%s\n", __func__); |
1099 | 1099 | ||
1100 | if ((file->f_flags & O_ACCMODE) != O_RDONLY) | 1100 | if ((file->f_flags & O_ACCMODE) != O_RDONLY) |
1101 | fepriv->release_jiffies = jiffies; | 1101 | fepriv->release_jiffies = jiffies; |
@@ -1135,7 +1135,7 @@ int dvb_register_frontend(struct dvb_adapter* dvb, | |||
1135 | .kernel_ioctl = dvb_frontend_ioctl | 1135 | .kernel_ioctl = dvb_frontend_ioctl |
1136 | }; | 1136 | }; |
1137 | 1137 | ||
1138 | dprintk ("%s\n", __FUNCTION__); | 1138 | dprintk ("%s\n", __func__); |
1139 | 1139 | ||
1140 | if (mutex_lock_interruptible(&frontend_mutex)) | 1140 | if (mutex_lock_interruptible(&frontend_mutex)) |
1141 | return -ERESTARTSYS; | 1141 | return -ERESTARTSYS; |
@@ -1169,7 +1169,7 @@ EXPORT_SYMBOL(dvb_register_frontend); | |||
1169 | int dvb_unregister_frontend(struct dvb_frontend* fe) | 1169 | int dvb_unregister_frontend(struct dvb_frontend* fe) |
1170 | { | 1170 | { |
1171 | struct dvb_frontend_private *fepriv = fe->frontend_priv; | 1171 | struct dvb_frontend_private *fepriv = fe->frontend_priv; |
1172 | dprintk ("%s\n", __FUNCTION__); | 1172 | dprintk ("%s\n", __func__); |
1173 | 1173 | ||
1174 | mutex_lock(&frontend_mutex); | 1174 | mutex_lock(&frontend_mutex); |
1175 | dvb_frontend_stop (fe); | 1175 | dvb_frontend_stop (fe); |
diff --git a/drivers/media/dvb/dvb-core/dvb_net.c b/drivers/media/dvb/dvb-core/dvb_net.c index 4c8b62e2c035..56d871cfd7fc 100644 --- a/drivers/media/dvb/dvb-core/dvb_net.c +++ b/drivers/media/dvb/dvb-core/dvb_net.c | |||
@@ -354,7 +354,7 @@ static void dvb_net_ule( struct net_device *dev, const u8 *buf, size_t buf_len ) | |||
354 | #ifdef ULE_DEBUG | 354 | #ifdef ULE_DEBUG |
355 | /* The code inside ULE_DEBUG keeps a history of the last 100 TS cells processed. */ | 355 | /* The code inside ULE_DEBUG keeps a history of the last 100 TS cells processed. */ |
356 | static unsigned char ule_hist[100*TS_SZ]; | 356 | static unsigned char ule_hist[100*TS_SZ]; |
357 | static unsigned char *ule_where = ule_hist, ule_dump = 0; | 357 | static unsigned char *ule_where = ule_hist, ule_dump; |
358 | #endif | 358 | #endif |
359 | 359 | ||
360 | /* For all TS cells in current buffer. | 360 | /* For all TS cells in current buffer. |
@@ -965,17 +965,17 @@ static int dvb_net_feed_start(struct net_device *dev) | |||
965 | struct dmx_demux *demux = priv->demux; | 965 | struct dmx_demux *demux = priv->demux; |
966 | unsigned char *mac = (unsigned char *) dev->dev_addr; | 966 | unsigned char *mac = (unsigned char *) dev->dev_addr; |
967 | 967 | ||
968 | dprintk("%s: rx_mode %i\n", __FUNCTION__, priv->rx_mode); | 968 | dprintk("%s: rx_mode %i\n", __func__, priv->rx_mode); |
969 | mutex_lock(&priv->mutex); | 969 | mutex_lock(&priv->mutex); |
970 | if (priv->tsfeed || priv->secfeed || priv->secfilter || priv->multi_secfilter[0]) | 970 | if (priv->tsfeed || priv->secfeed || priv->secfilter || priv->multi_secfilter[0]) |
971 | printk("%s: BUG %d\n", __FUNCTION__, __LINE__); | 971 | printk("%s: BUG %d\n", __func__, __LINE__); |
972 | 972 | ||
973 | priv->secfeed=NULL; | 973 | priv->secfeed=NULL; |
974 | priv->secfilter=NULL; | 974 | priv->secfilter=NULL; |
975 | priv->tsfeed = NULL; | 975 | priv->tsfeed = NULL; |
976 | 976 | ||
977 | if (priv->feedtype == DVB_NET_FEEDTYPE_MPE) { | 977 | if (priv->feedtype == DVB_NET_FEEDTYPE_MPE) { |
978 | dprintk("%s: alloc secfeed\n", __FUNCTION__); | 978 | dprintk("%s: alloc secfeed\n", __func__); |
979 | ret=demux->allocate_section_feed(demux, &priv->secfeed, | 979 | ret=demux->allocate_section_feed(demux, &priv->secfeed, |
980 | dvb_net_sec_callback); | 980 | dvb_net_sec_callback); |
981 | if (ret<0) { | 981 | if (ret<0) { |
@@ -993,38 +993,38 @@ static int dvb_net_feed_start(struct net_device *dev) | |||
993 | } | 993 | } |
994 | 994 | ||
995 | if (priv->rx_mode != RX_MODE_PROMISC) { | 995 | if (priv->rx_mode != RX_MODE_PROMISC) { |
996 | dprintk("%s: set secfilter\n", __FUNCTION__); | 996 | dprintk("%s: set secfilter\n", __func__); |
997 | dvb_net_filter_sec_set(dev, &priv->secfilter, mac, mask_normal); | 997 | dvb_net_filter_sec_set(dev, &priv->secfilter, mac, mask_normal); |
998 | } | 998 | } |
999 | 999 | ||
1000 | switch (priv->rx_mode) { | 1000 | switch (priv->rx_mode) { |
1001 | case RX_MODE_MULTI: | 1001 | case RX_MODE_MULTI: |
1002 | for (i = 0; i < priv->multi_num; i++) { | 1002 | for (i = 0; i < priv->multi_num; i++) { |
1003 | dprintk("%s: set multi_secfilter[%d]\n", __FUNCTION__, i); | 1003 | dprintk("%s: set multi_secfilter[%d]\n", __func__, i); |
1004 | dvb_net_filter_sec_set(dev, &priv->multi_secfilter[i], | 1004 | dvb_net_filter_sec_set(dev, &priv->multi_secfilter[i], |
1005 | priv->multi_macs[i], mask_normal); | 1005 | priv->multi_macs[i], mask_normal); |
1006 | } | 1006 | } |
1007 | break; | 1007 | break; |
1008 | case RX_MODE_ALL_MULTI: | 1008 | case RX_MODE_ALL_MULTI: |
1009 | priv->multi_num=1; | 1009 | priv->multi_num=1; |
1010 | dprintk("%s: set multi_secfilter[0]\n", __FUNCTION__); | 1010 | dprintk("%s: set multi_secfilter[0]\n", __func__); |
1011 | dvb_net_filter_sec_set(dev, &priv->multi_secfilter[0], | 1011 | dvb_net_filter_sec_set(dev, &priv->multi_secfilter[0], |
1012 | mac_allmulti, mask_allmulti); | 1012 | mac_allmulti, mask_allmulti); |
1013 | break; | 1013 | break; |
1014 | case RX_MODE_PROMISC: | 1014 | case RX_MODE_PROMISC: |
1015 | priv->multi_num=0; | 1015 | priv->multi_num=0; |
1016 | dprintk("%s: set secfilter\n", __FUNCTION__); | 1016 | dprintk("%s: set secfilter\n", __func__); |
1017 | dvb_net_filter_sec_set(dev, &priv->secfilter, mac, mask_promisc); | 1017 | dvb_net_filter_sec_set(dev, &priv->secfilter, mac, mask_promisc); |
1018 | break; | 1018 | break; |
1019 | } | 1019 | } |
1020 | 1020 | ||
1021 | dprintk("%s: start filtering\n", __FUNCTION__); | 1021 | dprintk("%s: start filtering\n", __func__); |
1022 | priv->secfeed->start_filtering(priv->secfeed); | 1022 | priv->secfeed->start_filtering(priv->secfeed); |
1023 | } else if (priv->feedtype == DVB_NET_FEEDTYPE_ULE) { | 1023 | } else if (priv->feedtype == DVB_NET_FEEDTYPE_ULE) { |
1024 | struct timespec timeout = { 0, 10000000 }; // 10 msec | 1024 | struct timespec timeout = { 0, 10000000 }; // 10 msec |
1025 | 1025 | ||
1026 | /* we have payloads encapsulated in TS */ | 1026 | /* we have payloads encapsulated in TS */ |
1027 | dprintk("%s: alloc tsfeed\n", __FUNCTION__); | 1027 | dprintk("%s: alloc tsfeed\n", __func__); |
1028 | ret = demux->allocate_ts_feed(demux, &priv->tsfeed, dvb_net_ts_callback); | 1028 | ret = demux->allocate_ts_feed(demux, &priv->tsfeed, dvb_net_ts_callback); |
1029 | if (ret < 0) { | 1029 | if (ret < 0) { |
1030 | printk("%s: could not allocate ts feed\n", dev->name); | 1030 | printk("%s: could not allocate ts feed\n", dev->name); |
@@ -1048,7 +1048,7 @@ static int dvb_net_feed_start(struct net_device *dev) | |||
1048 | goto error; | 1048 | goto error; |
1049 | } | 1049 | } |
1050 | 1050 | ||
1051 | dprintk("%s: start filtering\n", __FUNCTION__); | 1051 | dprintk("%s: start filtering\n", __func__); |
1052 | priv->tsfeed->start_filtering(priv->tsfeed); | 1052 | priv->tsfeed->start_filtering(priv->tsfeed); |
1053 | } else | 1053 | } else |
1054 | ret = -EINVAL; | 1054 | ret = -EINVAL; |
@@ -1063,17 +1063,17 @@ static int dvb_net_feed_stop(struct net_device *dev) | |||
1063 | struct dvb_net_priv *priv = dev->priv; | 1063 | struct dvb_net_priv *priv = dev->priv; |
1064 | int i, ret = 0; | 1064 | int i, ret = 0; |
1065 | 1065 | ||
1066 | dprintk("%s\n", __FUNCTION__); | 1066 | dprintk("%s\n", __func__); |
1067 | mutex_lock(&priv->mutex); | 1067 | mutex_lock(&priv->mutex); |
1068 | if (priv->feedtype == DVB_NET_FEEDTYPE_MPE) { | 1068 | if (priv->feedtype == DVB_NET_FEEDTYPE_MPE) { |
1069 | if (priv->secfeed) { | 1069 | if (priv->secfeed) { |
1070 | if (priv->secfeed->is_filtering) { | 1070 | if (priv->secfeed->is_filtering) { |
1071 | dprintk("%s: stop secfeed\n", __FUNCTION__); | 1071 | dprintk("%s: stop secfeed\n", __func__); |
1072 | priv->secfeed->stop_filtering(priv->secfeed); | 1072 | priv->secfeed->stop_filtering(priv->secfeed); |
1073 | } | 1073 | } |
1074 | 1074 | ||
1075 | if (priv->secfilter) { | 1075 | if (priv->secfilter) { |
1076 | dprintk("%s: release secfilter\n", __FUNCTION__); | 1076 | dprintk("%s: release secfilter\n", __func__); |
1077 | priv->secfeed->release_filter(priv->secfeed, | 1077 | priv->secfeed->release_filter(priv->secfeed, |
1078 | priv->secfilter); | 1078 | priv->secfilter); |
1079 | priv->secfilter=NULL; | 1079 | priv->secfilter=NULL; |
@@ -1082,7 +1082,7 @@ static int dvb_net_feed_stop(struct net_device *dev) | |||
1082 | for (i=0; i<priv->multi_num; i++) { | 1082 | for (i=0; i<priv->multi_num; i++) { |
1083 | if (priv->multi_secfilter[i]) { | 1083 | if (priv->multi_secfilter[i]) { |
1084 | dprintk("%s: release multi_filter[%d]\n", | 1084 | dprintk("%s: release multi_filter[%d]\n", |
1085 | __FUNCTION__, i); | 1085 | __func__, i); |
1086 | priv->secfeed->release_filter(priv->secfeed, | 1086 | priv->secfeed->release_filter(priv->secfeed, |
1087 | priv->multi_secfilter[i]); | 1087 | priv->multi_secfilter[i]); |
1088 | priv->multi_secfilter[i] = NULL; | 1088 | priv->multi_secfilter[i] = NULL; |
@@ -1096,7 +1096,7 @@ static int dvb_net_feed_stop(struct net_device *dev) | |||
1096 | } else if (priv->feedtype == DVB_NET_FEEDTYPE_ULE) { | 1096 | } else if (priv->feedtype == DVB_NET_FEEDTYPE_ULE) { |
1097 | if (priv->tsfeed) { | 1097 | if (priv->tsfeed) { |
1098 | if (priv->tsfeed->is_filtering) { | 1098 | if (priv->tsfeed->is_filtering) { |
1099 | dprintk("%s: stop tsfeed\n", __FUNCTION__); | 1099 | dprintk("%s: stop tsfeed\n", __func__); |
1100 | priv->tsfeed->stop_filtering(priv->tsfeed); | 1100 | priv->tsfeed->stop_filtering(priv->tsfeed); |
1101 | } | 1101 | } |
1102 | priv->demux->release_ts_feed(priv->demux, priv->tsfeed); | 1102 | priv->demux->release_ts_feed(priv->demux, priv->tsfeed); |
diff --git a/drivers/media/dvb/dvb-core/dvb_ringbuffer.c b/drivers/media/dvb/dvb-core/dvb_ringbuffer.c index ac9d93cf83c6..872985b7912d 100644 --- a/drivers/media/dvb/dvb-core/dvb_ringbuffer.c +++ b/drivers/media/dvb/dvb-core/dvb_ringbuffer.c | |||
@@ -90,7 +90,11 @@ void dvb_ringbuffer_flush(struct dvb_ringbuffer *rbuf) | |||
90 | rbuf->error = 0; | 90 | rbuf->error = 0; |
91 | } | 91 | } |
92 | 92 | ||
93 | 93 | void dvb_ringbuffer_reset(struct dvb_ringbuffer *rbuf) | |
94 | { | ||
95 | rbuf->pread = rbuf->pwrite = 0; | ||
96 | rbuf->error = 0; | ||
97 | } | ||
94 | 98 | ||
95 | void dvb_ringbuffer_flush_spinlock_wakeup(struct dvb_ringbuffer *rbuf) | 99 | void dvb_ringbuffer_flush_spinlock_wakeup(struct dvb_ringbuffer *rbuf) |
96 | { | 100 | { |
diff --git a/drivers/media/dvb/dvb-core/dvb_ringbuffer.h b/drivers/media/dvb/dvb-core/dvb_ringbuffer.h index d97714e75736..890826262966 100644 --- a/drivers/media/dvb/dvb-core/dvb_ringbuffer.h +++ b/drivers/media/dvb/dvb-core/dvb_ringbuffer.h | |||
@@ -69,6 +69,7 @@ struct dvb_ringbuffer { | |||
69 | ** to lock read or write operations. | 69 | ** to lock read or write operations. |
70 | ** Two or more readers must be locked against each other. | 70 | ** Two or more readers must be locked against each other. |
71 | ** Flushing the buffer counts as a read operation. | 71 | ** Flushing the buffer counts as a read operation. |
72 | ** Resetting the buffer counts as a read and write operation. | ||
72 | ** Two or more writers must be locked against each other. | 73 | ** Two or more writers must be locked against each other. |
73 | */ | 74 | */ |
74 | 75 | ||
@@ -85,6 +86,13 @@ extern ssize_t dvb_ringbuffer_free(struct dvb_ringbuffer *rbuf); | |||
85 | extern ssize_t dvb_ringbuffer_avail(struct dvb_ringbuffer *rbuf); | 86 | extern ssize_t dvb_ringbuffer_avail(struct dvb_ringbuffer *rbuf); |
86 | 87 | ||
87 | 88 | ||
89 | /* | ||
90 | ** Reset the read and write pointers to zero and flush the buffer | ||
91 | ** This counts as a read and write operation | ||
92 | */ | ||
93 | extern void dvb_ringbuffer_reset(struct dvb_ringbuffer *rbuf); | ||
94 | |||
95 | |||
88 | /* read routines & macros */ | 96 | /* read routines & macros */ |
89 | /* ---------------------- */ | 97 | /* ---------------------- */ |
90 | /* flush buffer */ | 98 | /* flush buffer */ |
diff --git a/drivers/media/dvb/dvb-core/dvbdev.c b/drivers/media/dvb/dvb-core/dvbdev.c index 18738faecbbc..8b56d929f7fd 100644 --- a/drivers/media/dvb/dvb-core/dvbdev.c +++ b/drivers/media/dvb/dvb-core/dvbdev.c | |||
@@ -49,7 +49,6 @@ static const char * const dnames[] = { | |||
49 | "net", "osd" | 49 | "net", "osd" |
50 | }; | 50 | }; |
51 | 51 | ||
52 | #define DVB_MAX_ADAPTERS 8 | ||
53 | #define DVB_MAX_IDS 4 | 52 | #define DVB_MAX_IDS 4 |
54 | #define nums2minor(num,type,id) ((num << 6) | (id << 4) | type) | 53 | #define nums2minor(num,type,id) ((num << 6) | (id << 4) | type) |
55 | #define MAX_DVB_MINORS (DVB_MAX_ADAPTERS*64) | 54 | #define MAX_DVB_MINORS (DVB_MAX_ADAPTERS*64) |
@@ -97,7 +96,7 @@ static int dvb_device_open(struct inode *inode, struct file *file) | |||
97 | } | 96 | } |
98 | 97 | ||
99 | 98 | ||
100 | static struct file_operations dvb_device_fops = | 99 | static const struct file_operations dvb_device_fops = |
101 | { | 100 | { |
102 | .owner = THIS_MODULE, | 101 | .owner = THIS_MODULE, |
103 | .open = dvb_device_open, | 102 | .open = dvb_device_open, |
@@ -196,7 +195,7 @@ int dvb_register_device(struct dvb_adapter *adap, struct dvb_device **pdvbdev, | |||
196 | if ((id = dvbdev_get_free_id (adap, type)) < 0){ | 195 | if ((id = dvbdev_get_free_id (adap, type)) < 0){ |
197 | mutex_unlock(&dvbdev_register_lock); | 196 | mutex_unlock(&dvbdev_register_lock); |
198 | *pdvbdev = NULL; | 197 | *pdvbdev = NULL; |
199 | printk(KERN_ERR "%s: couldn't find free device id\n", __FUNCTION__); | 198 | printk(KERN_ERR "%s: couldn't find free device id\n", __func__); |
200 | return -ENFILE; | 199 | return -ENFILE; |
201 | } | 200 | } |
202 | 201 | ||
@@ -235,7 +234,7 @@ int dvb_register_device(struct dvb_adapter *adap, struct dvb_device **pdvbdev, | |||
235 | "dvb%d.%s%d", adap->num, dnames[type], id); | 234 | "dvb%d.%s%d", adap->num, dnames[type], id); |
236 | if (IS_ERR(clsdev)) { | 235 | if (IS_ERR(clsdev)) { |
237 | printk(KERN_ERR "%s: failed to create device dvb%d.%s%d (%ld)\n", | 236 | printk(KERN_ERR "%s: failed to create device dvb%d.%s%d (%ld)\n", |
238 | __FUNCTION__, adap->num, dnames[type], id, PTR_ERR(clsdev)); | 237 | __func__, adap->num, dnames[type], id, PTR_ERR(clsdev)); |
239 | return PTR_ERR(clsdev); | 238 | return PTR_ERR(clsdev); |
240 | } | 239 | } |
241 | 240 | ||
@@ -262,18 +261,25 @@ void dvb_unregister_device(struct dvb_device *dvbdev) | |||
262 | } | 261 | } |
263 | EXPORT_SYMBOL(dvb_unregister_device); | 262 | EXPORT_SYMBOL(dvb_unregister_device); |
264 | 263 | ||
264 | static int dvbdev_check_free_adapter_num(int num) | ||
265 | { | ||
266 | struct list_head *entry; | ||
267 | list_for_each(entry, &dvb_adapter_list) { | ||
268 | struct dvb_adapter *adap; | ||
269 | adap = list_entry(entry, struct dvb_adapter, list_head); | ||
270 | if (adap->num == num) | ||
271 | return 0; | ||
272 | } | ||
273 | return 1; | ||
274 | } | ||
265 | 275 | ||
266 | static int dvbdev_get_free_adapter_num (void) | 276 | static int dvbdev_get_free_adapter_num (void) |
267 | { | 277 | { |
268 | int num = 0; | 278 | int num = 0; |
269 | 279 | ||
270 | while (num < DVB_MAX_ADAPTERS) { | 280 | while (num < DVB_MAX_ADAPTERS) { |
271 | struct dvb_adapter *adap; | 281 | if (dvbdev_check_free_adapter_num(num)) |
272 | list_for_each_entry(adap, &dvb_adapter_list, list_head) | 282 | return num; |
273 | if (adap->num == num) | ||
274 | goto skip; | ||
275 | return num; | ||
276 | skip: | ||
277 | num++; | 283 | num++; |
278 | } | 284 | } |
279 | 285 | ||
@@ -281,13 +287,28 @@ skip: | |||
281 | } | 287 | } |
282 | 288 | ||
283 | 289 | ||
284 | int dvb_register_adapter(struct dvb_adapter *adap, const char *name, struct module *module, struct device *device) | 290 | int dvb_register_adapter(struct dvb_adapter *adap, const char *name, |
291 | struct module *module, struct device *device, | ||
292 | short *adapter_nums) | ||
285 | { | 293 | { |
286 | int num; | 294 | int i, num; |
287 | 295 | ||
288 | mutex_lock(&dvbdev_register_lock); | 296 | mutex_lock(&dvbdev_register_lock); |
289 | 297 | ||
290 | if ((num = dvbdev_get_free_adapter_num ()) < 0) { | 298 | for (i = 0; i < DVB_MAX_ADAPTERS; ++i) { |
299 | num = adapter_nums[i]; | ||
300 | if (num >= 0 && num < DVB_MAX_ADAPTERS) { | ||
301 | /* use the one the driver asked for */ | ||
302 | if (dvbdev_check_free_adapter_num(num)) | ||
303 | break; | ||
304 | } else { | ||
305 | num = dvbdev_get_free_adapter_num(); | ||
306 | break; | ||
307 | } | ||
308 | num = -1; | ||
309 | } | ||
310 | |||
311 | if (num < 0) { | ||
291 | mutex_unlock(&dvbdev_register_lock); | 312 | mutex_unlock(&dvbdev_register_lock); |
292 | return -ENFILE; | 313 | return -ENFILE; |
293 | } | 314 | } |
diff --git a/drivers/media/dvb/dvb-core/dvbdev.h b/drivers/media/dvb/dvb-core/dvbdev.h index 6dff10ebf470..5f9a737c6de1 100644 --- a/drivers/media/dvb/dvb-core/dvbdev.h +++ b/drivers/media/dvb/dvb-core/dvbdev.h | |||
@@ -31,6 +31,10 @@ | |||
31 | 31 | ||
32 | #define DVB_MAJOR 212 | 32 | #define DVB_MAJOR 212 |
33 | 33 | ||
34 | #define DVB_MAX_ADAPTERS 8 | ||
35 | |||
36 | #define DVB_UNSET (-1) | ||
37 | |||
34 | #define DVB_DEVICE_VIDEO 0 | 38 | #define DVB_DEVICE_VIDEO 0 |
35 | #define DVB_DEVICE_AUDIO 1 | 39 | #define DVB_DEVICE_AUDIO 1 |
36 | #define DVB_DEVICE_SEC 2 | 40 | #define DVB_DEVICE_SEC 2 |
@@ -41,6 +45,11 @@ | |||
41 | #define DVB_DEVICE_NET 7 | 45 | #define DVB_DEVICE_NET 7 |
42 | #define DVB_DEVICE_OSD 8 | 46 | #define DVB_DEVICE_OSD 8 |
43 | 47 | ||
48 | #define DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr) \ | ||
49 | static short adapter_nr[] = \ | ||
50 | {[0 ... (DVB_MAX_ADAPTERS - 1)] = DVB_UNSET }; \ | ||
51 | module_param_array(adapter_nr, short, NULL, 0444); \ | ||
52 | MODULE_PARM_DESC(adapter_nr, "DVB adapter numbers") | ||
44 | 53 | ||
45 | struct dvb_adapter { | 54 | struct dvb_adapter { |
46 | int num; | 55 | int num; |
@@ -78,7 +87,9 @@ struct dvb_device { | |||
78 | }; | 87 | }; |
79 | 88 | ||
80 | 89 | ||
81 | extern int dvb_register_adapter (struct dvb_adapter *adap, const char *name, struct module *module, struct device *device); | 90 | extern int dvb_register_adapter(struct dvb_adapter *adap, const char *name, |
91 | struct module *module, struct device *device, | ||
92 | short *adapter_nums); | ||
82 | extern int dvb_unregister_adapter (struct dvb_adapter *adap); | 93 | extern int dvb_unregister_adapter (struct dvb_adapter *adap); |
83 | 94 | ||
84 | extern int dvb_register_device (struct dvb_adapter *adap, | 95 | extern int dvb_register_device (struct dvb_adapter *adap, |
diff --git a/drivers/media/dvb/dvb-usb/Kconfig b/drivers/media/dvb/dvb-usb/Kconfig index d73934dd4c57..3c8493d2026d 100644 --- a/drivers/media/dvb/dvb-usb/Kconfig +++ b/drivers/media/dvb/dvb-usb/Kconfig | |||
@@ -105,6 +105,7 @@ config DVB_USB_CXUSB | |||
105 | select DVB_LGDT330X if !DVB_FE_CUSTOMISE | 105 | select DVB_LGDT330X if !DVB_FE_CUSTOMISE |
106 | select DVB_MT352 if !DVB_FE_CUSTOMISE | 106 | select DVB_MT352 if !DVB_FE_CUSTOMISE |
107 | select DVB_ZL10353 if !DVB_FE_CUSTOMISE | 107 | select DVB_ZL10353 if !DVB_FE_CUSTOMISE |
108 | select TUNER_SIMPLE if !DVB_FE_CUSTOMISE | ||
108 | help | 109 | help |
109 | Say Y here to support the Conexant USB2.0 hybrid reference design. | 110 | Say Y here to support the Conexant USB2.0 hybrid reference design. |
110 | Currently, only DVB and ATSC modes are supported, analog mode | 111 | Currently, only DVB and ATSC modes are supported, analog mode |
diff --git a/drivers/media/dvb/dvb-usb/a800.c b/drivers/media/dvb/dvb-usb/a800.c index a6c5f19f680d..dc8c8784caa8 100644 --- a/drivers/media/dvb/dvb-usb/a800.c +++ b/drivers/media/dvb/dvb-usb/a800.c | |||
@@ -18,6 +18,9 @@ | |||
18 | static int debug; | 18 | static int debug; |
19 | module_param(debug, int, 0644); | 19 | module_param(debug, int, 0644); |
20 | MODULE_PARM_DESC(debug, "set debugging level (rc=1 (or-able))." DVB_USB_DEBUG_STATUS); | 20 | MODULE_PARM_DESC(debug, "set debugging level (rc=1 (or-able))." DVB_USB_DEBUG_STATUS); |
21 | |||
22 | DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); | ||
23 | |||
21 | #define deb_rc(args...) dprintk(debug,0x01,args) | 24 | #define deb_rc(args...) dprintk(debug,0x01,args) |
22 | 25 | ||
23 | static int a800_power_ctrl(struct dvb_usb_device *d, int onoff) | 26 | static int a800_power_ctrl(struct dvb_usb_device *d, int onoff) |
@@ -94,7 +97,8 @@ static struct dvb_usb_device_properties a800_properties; | |||
94 | static int a800_probe(struct usb_interface *intf, | 97 | static int a800_probe(struct usb_interface *intf, |
95 | const struct usb_device_id *id) | 98 | const struct usb_device_id *id) |
96 | { | 99 | { |
97 | return dvb_usb_device_init(intf,&a800_properties,THIS_MODULE,NULL); | 100 | return dvb_usb_device_init(intf, &a800_properties, |
101 | THIS_MODULE, NULL, adapter_nr); | ||
98 | } | 102 | } |
99 | 103 | ||
100 | /* do not change the order of the ID table */ | 104 | /* do not change the order of the ID table */ |
diff --git a/drivers/media/dvb/dvb-usb/af9005.c b/drivers/media/dvb/dvb-usb/af9005.c index e7f76f515b4f..cfe71feefcad 100644 --- a/drivers/media/dvb/dvb-usb/af9005.c +++ b/drivers/media/dvb/dvb-usb/af9005.c | |||
@@ -39,6 +39,8 @@ int dvb_usb_af9005_dump_eeprom = 0; | |||
39 | module_param_named(dump_eeprom, dvb_usb_af9005_dump_eeprom, int, 0); | 39 | module_param_named(dump_eeprom, dvb_usb_af9005_dump_eeprom, int, 0); |
40 | MODULE_PARM_DESC(dump_eeprom, "dump contents of the eeprom."); | 40 | MODULE_PARM_DESC(dump_eeprom, "dump contents of the eeprom."); |
41 | 41 | ||
42 | DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); | ||
43 | |||
42 | /* remote control decoder */ | 44 | /* remote control decoder */ |
43 | int (*rc_decode) (struct dvb_usb_device * d, u8 * data, int len, u32 * event, | 45 | int (*rc_decode) (struct dvb_usb_device * d, u8 * data, int len, u32 * event, |
44 | int *state); | 46 | int *state); |
@@ -1020,7 +1022,8 @@ static struct dvb_usb_device_properties af9005_properties; | |||
1020 | static int af9005_usb_probe(struct usb_interface *intf, | 1022 | static int af9005_usb_probe(struct usb_interface *intf, |
1021 | const struct usb_device_id *id) | 1023 | const struct usb_device_id *id) |
1022 | { | 1024 | { |
1023 | return dvb_usb_device_init(intf, &af9005_properties, THIS_MODULE, NULL); | 1025 | return dvb_usb_device_init(intf, &af9005_properties, |
1026 | THIS_MODULE, NULL, adapter_nr); | ||
1024 | } | 1027 | } |
1025 | 1028 | ||
1026 | static struct usb_device_id af9005_usb_table[] = { | 1029 | static struct usb_device_id af9005_usb_table[] = { |
diff --git a/drivers/media/dvb/dvb-usb/au6610.c b/drivers/media/dvb/dvb-usb/au6610.c index f3ff81314696..2ccb90fa60c8 100644 --- a/drivers/media/dvb/dvb-usb/au6610.c +++ b/drivers/media/dvb/dvb-usb/au6610.c | |||
@@ -19,6 +19,8 @@ static int dvb_usb_au6610_debug; | |||
19 | module_param_named(debug, dvb_usb_au6610_debug, int, 0644); | 19 | module_param_named(debug, dvb_usb_au6610_debug, int, 0644); |
20 | MODULE_PARM_DESC(debug, "set debugging level (1=rc (or-able))." DVB_USB_DEBUG_STATUS); | 20 | MODULE_PARM_DESC(debug, "set debugging level (1=rc (or-able))." DVB_USB_DEBUG_STATUS); |
21 | 21 | ||
22 | DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); | ||
23 | |||
22 | static int au6610_usb_msg(struct dvb_usb_device *d, u8 operation, u8 addr, | 24 | static int au6610_usb_msg(struct dvb_usb_device *d, u8 operation, u8 addr, |
23 | u8 *wbuf, u16 wlen, u8 *rbuf, u16 rlen) | 25 | u8 *wbuf, u16 wlen, u8 *rbuf, u16 rlen) |
24 | { | 26 | { |
@@ -163,7 +165,9 @@ static int au6610_probe(struct usb_interface *intf, | |||
163 | if (intf->num_altsetting < AU6610_ALTSETTING_COUNT) | 165 | if (intf->num_altsetting < AU6610_ALTSETTING_COUNT) |
164 | return -ENODEV; | 166 | return -ENODEV; |
165 | 167 | ||
166 | if ((ret = dvb_usb_device_init(intf, &au6610_properties, THIS_MODULE, &d)) == 0) { | 168 | ret = dvb_usb_device_init(intf, &au6610_properties, THIS_MODULE, &d, |
169 | adapter_nr); | ||
170 | if (ret == 0) { | ||
167 | alt = usb_altnum_to_altsetting(intf, AU6610_ALTSETTING); | 171 | alt = usb_altnum_to_altsetting(intf, AU6610_ALTSETTING); |
168 | 172 | ||
169 | if (alt == NULL) { | 173 | if (alt == NULL) { |
diff --git a/drivers/media/dvb/dvb-usb/cxusb.c b/drivers/media/dvb/dvb-usb/cxusb.c index c58365005ac1..720fcd1c3c1d 100644 --- a/drivers/media/dvb/dvb-usb/cxusb.c +++ b/drivers/media/dvb/dvb-usb/cxusb.c | |||
@@ -23,6 +23,8 @@ | |||
23 | * | 23 | * |
24 | * see Documentation/dvb/README.dvb-usb for more information | 24 | * see Documentation/dvb/README.dvb-usb for more information |
25 | */ | 25 | */ |
26 | #include <media/tuner.h> | ||
27 | |||
26 | #include "cxusb.h" | 28 | #include "cxusb.h" |
27 | 29 | ||
28 | #include "cx22702.h" | 30 | #include "cx22702.h" |
@@ -31,12 +33,15 @@ | |||
31 | #include "mt352_priv.h" | 33 | #include "mt352_priv.h" |
32 | #include "zl10353.h" | 34 | #include "zl10353.h" |
33 | #include "tuner-xc2028.h" | 35 | #include "tuner-xc2028.h" |
34 | #include "tuner-xc2028-types.h" | 36 | #include "tuner-simple.h" |
35 | 37 | ||
36 | /* debug */ | 38 | /* debug */ |
37 | static int dvb_usb_cxusb_debug; | 39 | static int dvb_usb_cxusb_debug; |
38 | module_param_named(debug, dvb_usb_cxusb_debug, int, 0644); | 40 | module_param_named(debug, dvb_usb_cxusb_debug, int, 0644); |
39 | MODULE_PARM_DESC(debug, "set debugging level (1=rc (or-able))." DVB_USB_DEBUG_STATUS); | 41 | MODULE_PARM_DESC(debug, "set debugging level (1=rc (or-able))." DVB_USB_DEBUG_STATUS); |
42 | |||
43 | DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); | ||
44 | |||
40 | #define deb_info(args...) dprintk(dvb_usb_cxusb_debug,0x01,args) | 45 | #define deb_info(args...) dprintk(dvb_usb_cxusb_debug,0x01,args) |
41 | #define deb_i2c(args...) if (d->udev->descriptor.idVendor == USB_VID_MEDION) \ | 46 | #define deb_i2c(args...) if (d->udev->descriptor.idVendor == USB_VID_MEDION) \ |
42 | dprintk(dvb_usb_cxusb_debug,0x01,args) | 47 | dprintk(dvb_usb_cxusb_debug,0x01,args) |
@@ -450,8 +455,9 @@ static struct mt352_config cxusb_mt352_xc3028_config = { | |||
450 | /* Callbacks for DVB USB */ | 455 | /* Callbacks for DVB USB */ |
451 | static int cxusb_fmd1216me_tuner_attach(struct dvb_usb_adapter *adap) | 456 | static int cxusb_fmd1216me_tuner_attach(struct dvb_usb_adapter *adap) |
452 | { | 457 | { |
453 | dvb_attach(dvb_pll_attach, adap->fe, 0x61, &adap->dev->i2c_adap, | 458 | dvb_attach(simple_tuner_attach, adap->fe, |
454 | DVB_PLL_FMD1216ME); | 459 | &adap->dev->i2c_adap, 0x61, |
460 | TUNER_PHILIPS_FMD1216ME_MK3); | ||
455 | return 0; | 461 | return 0; |
456 | } | 462 | } |
457 | 463 | ||
@@ -477,8 +483,8 @@ static int cxusb_dtt7579_tuner_attach(struct dvb_usb_adapter *adap) | |||
477 | 483 | ||
478 | static int cxusb_lgh064f_tuner_attach(struct dvb_usb_adapter *adap) | 484 | static int cxusb_lgh064f_tuner_attach(struct dvb_usb_adapter *adap) |
479 | { | 485 | { |
480 | dvb_attach(dvb_pll_attach, adap->fe, 0x61, &adap->dev->i2c_adap, | 486 | dvb_attach(simple_tuner_attach, adap->fe, |
481 | DVB_PLL_LG_TDVS_H06XF); | 487 | &adap->dev->i2c_adap, 0x61, TUNER_LG_TDVS_H06XF); |
482 | return 0; | 488 | return 0; |
483 | } | 489 | } |
484 | 490 | ||
@@ -488,14 +494,14 @@ static int dvico_bluebird_xc2028_callback(void *ptr, int command, int arg) | |||
488 | 494 | ||
489 | switch (command) { | 495 | switch (command) { |
490 | case XC2028_TUNER_RESET: | 496 | case XC2028_TUNER_RESET: |
491 | deb_info("%s: XC2028_TUNER_RESET %d\n", __FUNCTION__, arg); | 497 | deb_info("%s: XC2028_TUNER_RESET %d\n", __func__, arg); |
492 | cxusb_bluebird_gpio_pulse(d, 0x01, 1); | 498 | cxusb_bluebird_gpio_pulse(d, 0x01, 1); |
493 | break; | 499 | break; |
494 | case XC2028_RESET_CLK: | 500 | case XC2028_RESET_CLK: |
495 | deb_info("%s: XC2028_RESET_CLK %d\n", __FUNCTION__, arg); | 501 | deb_info("%s: XC2028_RESET_CLK %d\n", __func__, arg); |
496 | break; | 502 | break; |
497 | default: | 503 | default: |
498 | deb_info("%s: unknown command %d, arg %d\n", __FUNCTION__, | 504 | deb_info("%s: unknown command %d, arg %d\n", __func__, |
499 | command, arg); | 505 | command, arg); |
500 | return -EINVAL; | 506 | return -EINVAL; |
501 | } | 507 | } |
@@ -509,13 +515,12 @@ static int cxusb_dvico_xc3028_tuner_attach(struct dvb_usb_adapter *adap) | |||
509 | struct xc2028_config cfg = { | 515 | struct xc2028_config cfg = { |
510 | .i2c_adap = &adap->dev->i2c_adap, | 516 | .i2c_adap = &adap->dev->i2c_adap, |
511 | .i2c_addr = 0x61, | 517 | .i2c_addr = 0x61, |
512 | .video_dev = adap->dev, | ||
513 | .callback = dvico_bluebird_xc2028_callback, | 518 | .callback = dvico_bluebird_xc2028_callback, |
514 | }; | 519 | }; |
515 | static struct xc2028_ctrl ctl = { | 520 | static struct xc2028_ctrl ctl = { |
516 | .fname = "xc3028-dvico-au-01.fw", | 521 | .fname = "xc3028-dvico-au-01.fw", |
517 | .max_len = 64, | 522 | .max_len = 64, |
518 | .scode_table = ZARLINK456, | 523 | .scode_table = XC3028_FE_ZARLINK456, |
519 | }; | 524 | }; |
520 | 525 | ||
521 | fe = dvb_attach(xc2028_attach, adap->fe, &cfg); | 526 | fe = dvb_attach(xc2028_attach, adap->fe, &cfg); |
@@ -720,16 +725,24 @@ static struct dvb_usb_device_properties cxusb_bluebird_nano2_needsfirmware_prope | |||
720 | static int cxusb_probe(struct usb_interface *intf, | 725 | static int cxusb_probe(struct usb_interface *intf, |
721 | const struct usb_device_id *id) | 726 | const struct usb_device_id *id) |
722 | { | 727 | { |
723 | if (dvb_usb_device_init(intf,&cxusb_medion_properties,THIS_MODULE,NULL) == 0 || | 728 | if (0 == dvb_usb_device_init(intf, &cxusb_medion_properties, |
724 | dvb_usb_device_init(intf,&cxusb_bluebird_lgh064f_properties,THIS_MODULE,NULL) == 0 || | 729 | THIS_MODULE, NULL, adapter_nr) || |
725 | dvb_usb_device_init(intf,&cxusb_bluebird_dee1601_properties,THIS_MODULE,NULL) == 0 || | 730 | 0 == dvb_usb_device_init(intf, &cxusb_bluebird_lgh064f_properties, |
726 | dvb_usb_device_init(intf,&cxusb_bluebird_lgz201_properties,THIS_MODULE,NULL) == 0 || | 731 | THIS_MODULE, NULL, adapter_nr) || |
727 | dvb_usb_device_init(intf,&cxusb_bluebird_dtt7579_properties,THIS_MODULE,NULL) == 0 || | 732 | 0 == dvb_usb_device_init(intf, &cxusb_bluebird_dee1601_properties, |
728 | dvb_usb_device_init(intf,&cxusb_bluebird_dualdig4_properties,THIS_MODULE,NULL) == 0 || | 733 | THIS_MODULE, NULL, adapter_nr) || |
729 | dvb_usb_device_init(intf,&cxusb_bluebird_nano2_properties,THIS_MODULE,NULL) == 0 || | 734 | 0 == dvb_usb_device_init(intf, &cxusb_bluebird_lgz201_properties, |
730 | dvb_usb_device_init(intf,&cxusb_bluebird_nano2_needsfirmware_properties,THIS_MODULE,NULL) == 0) { | 735 | THIS_MODULE, NULL, adapter_nr) || |
736 | 0 == dvb_usb_device_init(intf, &cxusb_bluebird_dtt7579_properties, | ||
737 | THIS_MODULE, NULL, adapter_nr) || | ||
738 | 0 == dvb_usb_device_init(intf, &cxusb_bluebird_dualdig4_properties, | ||
739 | THIS_MODULE, NULL, adapter_nr) || | ||
740 | 0 == dvb_usb_device_init(intf, &cxusb_bluebird_nano2_properties, | ||
741 | THIS_MODULE, NULL, adapter_nr) || | ||
742 | 0 == dvb_usb_device_init(intf, | ||
743 | &cxusb_bluebird_nano2_needsfirmware_properties, | ||
744 | THIS_MODULE, NULL, adapter_nr)) | ||
731 | return 0; | 745 | return 0; |
732 | } | ||
733 | 746 | ||
734 | return -EINVAL; | 747 | return -EINVAL; |
735 | } | 748 | } |
diff --git a/drivers/media/dvb/dvb-usb/dib0700.h b/drivers/media/dvb/dvb-usb/dib0700.h index 4a903ea95896..66d4dc6ba46f 100644 --- a/drivers/media/dvb/dvb-usb/dib0700.h +++ b/drivers/media/dvb/dvb-usb/dib0700.h | |||
@@ -37,6 +37,7 @@ struct dib0700_state { | |||
37 | u8 channel_state; | 37 | u8 channel_state; |
38 | u16 mt2060_if1[2]; | 38 | u16 mt2060_if1[2]; |
39 | u8 rc_toggle; | 39 | u8 rc_toggle; |
40 | u8 rc_counter; | ||
40 | u8 is_dib7000pc; | 41 | u8 is_dib7000pc; |
41 | }; | 42 | }; |
42 | 43 | ||
@@ -44,12 +45,15 @@ extern int dib0700_set_gpio(struct dvb_usb_device *, enum dib07x0_gpios gpio, u8 | |||
44 | extern int dib0700_ctrl_clock(struct dvb_usb_device *d, u32 clk_MHz, u8 clock_out_gp3); | 45 | extern int dib0700_ctrl_clock(struct dvb_usb_device *d, u32 clk_MHz, u8 clock_out_gp3); |
45 | extern int dib0700_ctrl_rd(struct dvb_usb_device *d, u8 *tx, u8 txlen, u8 *rx, u8 rxlen); | 46 | extern int dib0700_ctrl_rd(struct dvb_usb_device *d, u8 *tx, u8 txlen, u8 *rx, u8 rxlen); |
46 | extern int dib0700_download_firmware(struct usb_device *udev, const struct firmware *fw); | 47 | extern int dib0700_download_firmware(struct usb_device *udev, const struct firmware *fw); |
48 | extern int dib0700_rc_setup(struct dvb_usb_device *d); | ||
47 | extern int dib0700_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff); | 49 | extern int dib0700_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff); |
48 | extern struct i2c_algorithm dib0700_i2c_algo; | 50 | extern struct i2c_algorithm dib0700_i2c_algo; |
49 | extern int dib0700_identify_state(struct usb_device *udev, struct dvb_usb_device_properties *props, | 51 | extern int dib0700_identify_state(struct usb_device *udev, struct dvb_usb_device_properties *props, |
50 | struct dvb_usb_device_description **desc, int *cold); | 52 | struct dvb_usb_device_description **desc, int *cold); |
51 | 53 | ||
52 | extern int dib0700_device_count; | 54 | extern int dib0700_device_count; |
55 | extern int dvb_usb_dib0700_ir_proto; | ||
53 | extern struct dvb_usb_device_properties dib0700_devices[]; | 56 | extern struct dvb_usb_device_properties dib0700_devices[]; |
54 | extern struct usb_device_id dib0700_usb_id_table[]; | 57 | extern struct usb_device_id dib0700_usb_id_table[]; |
58 | |||
55 | #endif | 59 | #endif |
diff --git a/drivers/media/dvb/dvb-usb/dib0700_core.c b/drivers/media/dvb/dvb-usb/dib0700_core.c index c9857d5c6982..595a04696c87 100644 --- a/drivers/media/dvb/dvb-usb/dib0700_core.c +++ b/drivers/media/dvb/dvb-usb/dib0700_core.c | |||
@@ -13,10 +13,12 @@ int dvb_usb_dib0700_debug; | |||
13 | module_param_named(debug,dvb_usb_dib0700_debug, int, 0644); | 13 | module_param_named(debug,dvb_usb_dib0700_debug, int, 0644); |
14 | MODULE_PARM_DESC(debug, "set debugging level (1=info,2=fw,4=fwdata,8=data (or-able))." DVB_USB_DEBUG_STATUS); | 14 | MODULE_PARM_DESC(debug, "set debugging level (1=info,2=fw,4=fwdata,8=data (or-able))." DVB_USB_DEBUG_STATUS); |
15 | 15 | ||
16 | static int dvb_usb_dib0700_ir_proto = 1; | 16 | int dvb_usb_dib0700_ir_proto = 1; |
17 | module_param(dvb_usb_dib0700_ir_proto, int, 0644); | 17 | module_param(dvb_usb_dib0700_ir_proto, int, 0644); |
18 | MODULE_PARM_DESC(dvb_usb_dib0700_ir_proto, "set ir protocol (0=NEC, 1=RC5 (default), 2=RC6)."); | 18 | MODULE_PARM_DESC(dvb_usb_dib0700_ir_proto, "set ir protocol (0=NEC, 1=RC5 (default), 2=RC6)."); |
19 | 19 | ||
20 | DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); | ||
21 | |||
20 | /* expecting rx buffer: request data[0] data[1] ... data[2] */ | 22 | /* expecting rx buffer: request data[0] data[1] ... data[2] */ |
21 | static int dib0700_ctrl_wr(struct dvb_usb_device *d, u8 *tx, u8 txlen) | 23 | static int dib0700_ctrl_wr(struct dvb_usb_device *d, u8 *tx, u8 txlen) |
22 | { | 24 | { |
@@ -261,7 +263,7 @@ int dib0700_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff) | |||
261 | return dib0700_ctrl_wr(adap->dev, b, 4); | 263 | return dib0700_ctrl_wr(adap->dev, b, 4); |
262 | } | 264 | } |
263 | 265 | ||
264 | static int dib0700_rc_setup(struct dvb_usb_device *d) | 266 | int dib0700_rc_setup(struct dvb_usb_device *d) |
265 | { | 267 | { |
266 | u8 rc_setup[3] = {REQUEST_SET_RC, dvb_usb_dib0700_ir_proto, 0}; | 268 | u8 rc_setup[3] = {REQUEST_SET_RC, dvb_usb_dib0700_ir_proto, 0}; |
267 | int i = dib0700_ctrl_wr(d, rc_setup, 3); | 269 | int i = dib0700_ctrl_wr(d, rc_setup, 3); |
@@ -279,7 +281,8 @@ static int dib0700_probe(struct usb_interface *intf, | |||
279 | struct dvb_usb_device *dev; | 281 | struct dvb_usb_device *dev; |
280 | 282 | ||
281 | for (i = 0; i < dib0700_device_count; i++) | 283 | for (i = 0; i < dib0700_device_count; i++) |
282 | if (dvb_usb_device_init(intf, &dib0700_devices[i], THIS_MODULE, &dev) == 0) | 284 | if (dvb_usb_device_init(intf, &dib0700_devices[i], THIS_MODULE, |
285 | &dev, adapter_nr) == 0) | ||
283 | { | 286 | { |
284 | dib0700_rc_setup(dev); | 287 | dib0700_rc_setup(dev); |
285 | return 0; | 288 | return 0; |
diff --git a/drivers/media/dvb/dvb-usb/dib0700_devices.c b/drivers/media/dvb/dvb-usb/dib0700_devices.c index e7093826e975..6477fc66cc23 100644 --- a/drivers/media/dvb/dvb-usb/dib0700_devices.c +++ b/drivers/media/dvb/dvb-usb/dib0700_devices.c | |||
@@ -13,6 +13,7 @@ | |||
13 | #include "dib7000p.h" | 13 | #include "dib7000p.h" |
14 | #include "mt2060.h" | 14 | #include "mt2060.h" |
15 | #include "mt2266.h" | 15 | #include "mt2266.h" |
16 | #include "tuner-xc2028.h" | ||
16 | #include "dib0070.h" | 17 | #include "dib0070.h" |
17 | 18 | ||
18 | static int force_lna_activation; | 19 | static int force_lna_activation; |
@@ -297,10 +298,156 @@ static int stk7700d_tuner_attach(struct dvb_usb_adapter *adap) | |||
297 | &stk7700d_mt2266_config[adap->id]) == NULL ? -ENODEV : 0;; | 298 | &stk7700d_mt2266_config[adap->id]) == NULL ? -ENODEV : 0;; |
298 | } | 299 | } |
299 | 300 | ||
301 | /* STK7700-PH: Digital/Analog Hybrid Tuner, e.h. Cinergy HT USB HE */ | ||
302 | struct dibx000_agc_config xc3028_agc_config = { | ||
303 | BAND_VHF | BAND_UHF, /* band_caps */ | ||
304 | |||
305 | /* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0, P_agc_freq_pwm_div=0, | ||
306 | * P_agc_inv_pwm1=0, P_agc_inv_pwm2=0, P_agc_inh_dc_rv_est=0, | ||
307 | * P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=2, P_agc_write=0 */ | ||
308 | (0 << 15) | (0 << 14) | (0 << 11) | (0 << 10) | (0 << 9) | (0 << 8) | | ||
309 | (3 << 5) | (0 << 4) | (2 << 1) | (0 << 0), /* setup */ | ||
310 | |||
311 | 712, /* inv_gain */ | ||
312 | 21, /* time_stabiliz */ | ||
313 | |||
314 | 0, /* alpha_level */ | ||
315 | 118, /* thlock */ | ||
316 | |||
317 | 0, /* wbd_inv */ | ||
318 | 2867, /* wbd_ref */ | ||
319 | 0, /* wbd_sel */ | ||
320 | 2, /* wbd_alpha */ | ||
321 | |||
322 | 0, /* agc1_max */ | ||
323 | 0, /* agc1_min */ | ||
324 | 39718, /* agc2_max */ | ||
325 | 9930, /* agc2_min */ | ||
326 | 0, /* agc1_pt1 */ | ||
327 | 0, /* agc1_pt2 */ | ||
328 | 0, /* agc1_pt3 */ | ||
329 | 0, /* agc1_slope1 */ | ||
330 | 0, /* agc1_slope2 */ | ||
331 | 0, /* agc2_pt1 */ | ||
332 | 128, /* agc2_pt2 */ | ||
333 | 29, /* agc2_slope1 */ | ||
334 | 29, /* agc2_slope2 */ | ||
335 | |||
336 | 17, /* alpha_mant */ | ||
337 | 27, /* alpha_exp */ | ||
338 | 23, /* beta_mant */ | ||
339 | 51, /* beta_exp */ | ||
340 | |||
341 | 1, /* perform_agc_softsplit */ | ||
342 | }; | ||
343 | |||
344 | /* PLL Configuration for COFDM BW_MHz = 8.00 with external clock = 30.00 */ | ||
345 | struct dibx000_bandwidth_config xc3028_bw_config = { | ||
346 | 60000, 30000, /* internal, sampling */ | ||
347 | 1, 8, 3, 1, 0, /* pll_cfg: prediv, ratio, range, reset, bypass */ | ||
348 | 0, 0, 1, 1, 0, /* misc: refdiv, bypclk_div, IO_CLK_en_core, ADClkSrc, | ||
349 | modulo */ | ||
350 | (3 << 14) | (1 << 12) | (524 << 0), /* sad_cfg: refsel, sel, freq_15k */ | ||
351 | (1 << 25) | 5816102, /* ifreq = 5.200000 MHz */ | ||
352 | 20452225, /* timf */ | ||
353 | 30000000, /* xtal_hz */ | ||
354 | }; | ||
355 | |||
356 | static struct dib7000p_config stk7700ph_dib7700_xc3028_config = { | ||
357 | .output_mpeg2_in_188_bytes = 1, | ||
358 | .tuner_is_baseband = 1, | ||
359 | |||
360 | .agc_config_count = 1, | ||
361 | .agc = &xc3028_agc_config, | ||
362 | .bw = &xc3028_bw_config, | ||
363 | |||
364 | .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS, | ||
365 | .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES, | ||
366 | .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS, | ||
367 | }; | ||
368 | |||
369 | static int stk7700ph_xc3028_callback(void *ptr, int command, int arg) | ||
370 | { | ||
371 | struct dvb_usb_adapter *adap = ptr; | ||
372 | |||
373 | switch (command) { | ||
374 | case XC2028_TUNER_RESET: | ||
375 | /* Send the tuner in then out of reset */ | ||
376 | dib7000p_set_gpio(adap->fe, 8, 0, 0); msleep(10); | ||
377 | dib7000p_set_gpio(adap->fe, 8, 0, 1); | ||
378 | break; | ||
379 | case XC2028_RESET_CLK: | ||
380 | break; | ||
381 | default: | ||
382 | err("%s: unknown command %d, arg %d\n", __func__, | ||
383 | command, arg); | ||
384 | return -EINVAL; | ||
385 | } | ||
386 | return 0; | ||
387 | } | ||
388 | |||
389 | static struct xc2028_ctrl stk7700ph_xc3028_ctrl = { | ||
390 | .fname = XC2028_DEFAULT_FIRMWARE, | ||
391 | .max_len = 64, | ||
392 | .demod = XC3028_FE_DIBCOM52, | ||
393 | }; | ||
394 | |||
395 | static struct xc2028_config stk7700ph_xc3028_config = { | ||
396 | .i2c_addr = 0x61, | ||
397 | .callback = stk7700ph_xc3028_callback, | ||
398 | .ctrl = &stk7700ph_xc3028_ctrl, | ||
399 | }; | ||
400 | |||
401 | static int stk7700ph_frontend_attach(struct dvb_usb_adapter *adap) | ||
402 | { | ||
403 | struct usb_device_descriptor *desc = &adap->dev->udev->descriptor; | ||
404 | |||
405 | if (desc->idVendor == USB_VID_PINNACLE && | ||
406 | desc->idProduct == USB_PID_PINNACLE_EXPRESSCARD_320CX) | ||
407 | dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0); | ||
408 | else | ||
409 | dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1); | ||
410 | msleep(20); | ||
411 | dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1); | ||
412 | dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1); | ||
413 | dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1); | ||
414 | dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0); | ||
415 | msleep(10); | ||
416 | dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1); | ||
417 | msleep(20); | ||
418 | dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1); | ||
419 | msleep(10); | ||
420 | |||
421 | dib7000p_i2c_enumeration(&adap->dev->i2c_adap, 1, 18, | ||
422 | &stk7700ph_dib7700_xc3028_config); | ||
423 | |||
424 | adap->fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap, 0x80, | ||
425 | &stk7700ph_dib7700_xc3028_config); | ||
426 | |||
427 | return adap->fe == NULL ? -ENODEV : 0; | ||
428 | } | ||
429 | |||
430 | static int stk7700ph_tuner_attach(struct dvb_usb_adapter *adap) | ||
431 | { | ||
432 | struct i2c_adapter *tun_i2c; | ||
433 | |||
434 | tun_i2c = dib7000p_get_i2c_master(adap->fe, | ||
435 | DIBX000_I2C_INTERFACE_TUNER, 1); | ||
436 | |||
437 | stk7700ph_xc3028_config.i2c_adap = tun_i2c; | ||
438 | stk7700ph_xc3028_config.video_dev = adap; | ||
439 | |||
440 | return dvb_attach(xc2028_attach, adap->fe, &stk7700ph_xc3028_config) | ||
441 | == NULL ? -ENODEV : 0; | ||
442 | } | ||
443 | |||
300 | #define DEFAULT_RC_INTERVAL 150 | 444 | #define DEFAULT_RC_INTERVAL 150 |
301 | 445 | ||
302 | static u8 rc_request[] = { REQUEST_POLL_RC, 0 }; | 446 | static u8 rc_request[] = { REQUEST_POLL_RC, 0 }; |
303 | 447 | ||
448 | /* Number of keypresses to ignore before start repeating */ | ||
449 | #define RC_REPEAT_DELAY 2 | ||
450 | |||
304 | static int dib0700_rc_query(struct dvb_usb_device *d, u32 *event, int *state) | 451 | static int dib0700_rc_query(struct dvb_usb_device *d, u32 *event, int *state) |
305 | { | 452 | { |
306 | u8 key[4]; | 453 | u8 key[4]; |
@@ -314,18 +461,67 @@ static int dib0700_rc_query(struct dvb_usb_device *d, u32 *event, int *state) | |||
314 | err("RC Query Failed"); | 461 | err("RC Query Failed"); |
315 | return -1; | 462 | return -1; |
316 | } | 463 | } |
464 | |||
465 | /* losing half of KEY_0 events from Philipps rc5 remotes.. */ | ||
317 | if (key[0]==0 && key[1]==0 && key[2]==0 && key[3]==0) return 0; | 466 | if (key[0]==0 && key[1]==0 && key[2]==0 && key[3]==0) return 0; |
318 | if (key[3-1]!=st->rc_toggle) { | 467 | |
468 | /* info("%d: %2X %2X %2X %2X",dvb_usb_dib0700_ir_proto,(int)key[3-2],(int)key[3-3],(int)key[3-1],(int)key[3]); */ | ||
469 | |||
470 | dib0700_rc_setup(d); /* reset ir sensor data to prevent false events */ | ||
471 | |||
472 | switch (dvb_usb_dib0700_ir_proto) { | ||
473 | case 0: { | ||
474 | /* NEC protocol sends repeat code as 0 0 0 FF */ | ||
475 | if ((key[3-2] == 0x00) && (key[3-3] == 0x00) && | ||
476 | (key[3] == 0xFF)) { | ||
477 | st->rc_counter++; | ||
478 | if (st->rc_counter > RC_REPEAT_DELAY) { | ||
479 | *event = d->last_event; | ||
480 | *state = REMOTE_KEY_PRESSED; | ||
481 | st->rc_counter = RC_REPEAT_DELAY; | ||
482 | } | ||
483 | return 0; | ||
484 | } | ||
319 | for (i=0;i<d->props.rc_key_map_size; i++) { | 485 | for (i=0;i<d->props.rc_key_map_size; i++) { |
320 | if (keymap[i].custom == key[3-2] && keymap[i].data == key[3-3]) { | 486 | if (keymap[i].custom == key[3-2] && keymap[i].data == key[3-3]) { |
487 | st->rc_counter = 0; | ||
488 | *event = keymap[i].event; | ||
489 | *state = REMOTE_KEY_PRESSED; | ||
490 | d->last_event = keymap[i].event; | ||
491 | return 0; | ||
492 | } | ||
493 | } | ||
494 | break; | ||
495 | } | ||
496 | default: { | ||
497 | /* RC-5 protocol changes toggle bit on new keypress */ | ||
498 | for (i = 0; i < d->props.rc_key_map_size; i++) { | ||
499 | if (keymap[i].custom == key[3-2] && keymap[i].data == key[3-3]) { | ||
500 | if (d->last_event == keymap[i].event && | ||
501 | key[3-1] == st->rc_toggle) { | ||
502 | st->rc_counter++; | ||
503 | /* prevents unwanted double hits */ | ||
504 | if (st->rc_counter > RC_REPEAT_DELAY) { | ||
505 | *event = d->last_event; | ||
506 | *state = REMOTE_KEY_PRESSED; | ||
507 | st->rc_counter = RC_REPEAT_DELAY; | ||
508 | } | ||
509 | |||
510 | return 0; | ||
511 | } | ||
512 | st->rc_counter = 0; | ||
321 | *event = keymap[i].event; | 513 | *event = keymap[i].event; |
322 | *state = REMOTE_KEY_PRESSED; | 514 | *state = REMOTE_KEY_PRESSED; |
323 | st->rc_toggle=key[3-1]; | 515 | st->rc_toggle = key[3-1]; |
516 | d->last_event = keymap[i].event; | ||
324 | return 0; | 517 | return 0; |
325 | } | 518 | } |
326 | } | 519 | } |
327 | err("Unknown remote controller key : %2X %2X",(int)key[3-2],(int)key[3-3]); | 520 | break; |
328 | } | 521 | } |
522 | } | ||
523 | err("Unknown remote controller key: %2X %2X %2X %2X", (int) key[3-2], (int) key[3-3], (int) key[3-1], (int) key[3]); | ||
524 | d->last_event = 0; | ||
329 | return 0; | 525 | return 0; |
330 | } | 526 | } |
331 | 527 | ||
@@ -794,6 +990,10 @@ static struct dib7000p_config dib7070p_dib7000p_config = { | |||
794 | /* STK7070P */ | 990 | /* STK7070P */ |
795 | static int stk7070p_frontend_attach(struct dvb_usb_adapter *adap) | 991 | static int stk7070p_frontend_attach(struct dvb_usb_adapter *adap) |
796 | { | 992 | { |
993 | if (adap->dev->udev->descriptor.idVendor == USB_VID_PINNACLE && | ||
994 | adap->dev->udev->descriptor.idProduct == USB_PID_PINNACLE_PCTV72E) | ||
995 | dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0); | ||
996 | else | ||
797 | dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1); | 997 | dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1); |
798 | msleep(10); | 998 | msleep(10); |
799 | dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1); | 999 | dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1); |
@@ -808,9 +1008,11 @@ static int stk7070p_frontend_attach(struct dvb_usb_adapter *adap) | |||
808 | msleep(10); | 1008 | msleep(10); |
809 | dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1); | 1009 | dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1); |
810 | 1010 | ||
811 | dib7000p_i2c_enumeration(&adap->dev->i2c_adap, 1, 18, &dib7070p_dib7000p_config); | 1011 | dib7000p_i2c_enumeration(&adap->dev->i2c_adap, 1, 18, |
1012 | &dib7070p_dib7000p_config); | ||
812 | 1013 | ||
813 | adap->fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap, 0x80, &dib7070p_dib7000p_config); | 1014 | adap->fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap, 0x80, |
1015 | &dib7070p_dib7000p_config); | ||
814 | return adap->fe == NULL ? -ENODEV : 0; | 1016 | return adap->fe == NULL ? -ENODEV : 0; |
815 | } | 1017 | } |
816 | 1018 | ||
@@ -878,34 +1080,43 @@ static int stk7070pd_frontend_attach1(struct dvb_usb_adapter *adap) | |||
878 | /* DVB-USB and USB stuff follows */ | 1080 | /* DVB-USB and USB stuff follows */ |
879 | struct usb_device_id dib0700_usb_id_table[] = { | 1081 | struct usb_device_id dib0700_usb_id_table[] = { |
880 | /* 0 */ { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7700P) }, | 1082 | /* 0 */ { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7700P) }, |
881 | { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7700P_PC) }, | 1083 | { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7700P_PC) }, |
882 | 1084 | { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_500) }, | |
883 | { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_500) }, | 1085 | { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_500_2) }, |
884 | { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_500_2) }, | 1086 | { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_STICK) }, |
885 | { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_STICK) }, | ||
886 | /* 5 */ { USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_VOLAR) }, | 1087 | /* 5 */ { USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_VOLAR) }, |
887 | { USB_DEVICE(USB_VID_COMPRO, USB_PID_COMPRO_VIDEOMATE_U500) }, | 1088 | { USB_DEVICE(USB_VID_COMPRO, USB_PID_COMPRO_VIDEOMATE_U500) }, |
888 | { USB_DEVICE(USB_VID_UNIWILL, USB_PID_UNIWILL_STK7700P) }, | 1089 | { USB_DEVICE(USB_VID_UNIWILL, USB_PID_UNIWILL_STK7700P) }, |
889 | { USB_DEVICE(USB_VID_LEADTEK, USB_PID_WINFAST_DTV_DONGLE_STK7700P) }, | 1090 | { USB_DEVICE(USB_VID_LEADTEK, USB_PID_WINFAST_DTV_DONGLE_STK7700P) }, |
890 | { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_STICK_2) }, | 1091 | { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_STICK_2) }, |
891 | /* 10 */{ USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_VOLAR_2) }, | 1092 | /* 10 */{ USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_VOLAR_2) }, |
892 | { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV2000E) }, | 1093 | { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV2000E) }, |
893 | { USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_CINERGY_DT_XS_DIVERSITY) }, | 1094 | { USB_DEVICE(USB_VID_TERRATEC, |
894 | { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_TD_STICK) }, | 1095 | USB_PID_TERRATEC_CINERGY_DT_XS_DIVERSITY) }, |
895 | { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7700D) }, | 1096 | { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_TD_STICK) }, |
1097 | { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7700D) }, | ||
896 | /* 15 */{ USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7070P) }, | 1098 | /* 15 */{ USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7070P) }, |
897 | { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV_DVB_T_FLASH) }, | 1099 | { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV_DVB_T_FLASH) }, |
898 | { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7070PD) }, | 1100 | { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7070PD) }, |
899 | { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV_DUAL_DIVERSITY_DVB_T) }, | 1101 | { USB_DEVICE(USB_VID_PINNACLE, |
900 | { USB_DEVICE(USB_VID_COMPRO, USB_PID_COMPRO_VIDEOMATE_U500_PC) }, | 1102 | USB_PID_PINNACLE_PCTV_DUAL_DIVERSITY_DVB_T) }, |
1103 | { USB_DEVICE(USB_VID_COMPRO, USB_PID_COMPRO_VIDEOMATE_U500_PC) }, | ||
901 | /* 20 */{ USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_EXPRESS) }, | 1104 | /* 20 */{ USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_EXPRESS) }, |
902 | { USB_DEVICE(USB_VID_GIGABYTE, USB_PID_GIGABYTE_U7000) }, | 1105 | { USB_DEVICE(USB_VID_GIGABYTE, USB_PID_GIGABYTE_U7000) }, |
903 | { USB_DEVICE(USB_VID_ULTIMA_ELECTRONIC, USB_PID_ARTEC_T14BR) }, | 1106 | { USB_DEVICE(USB_VID_ULTIMA_ELECTRONIC, USB_PID_ARTEC_T14BR) }, |
904 | { USB_DEVICE(USB_VID_ASUS, USB_PID_ASUS_U3000) }, | 1107 | { USB_DEVICE(USB_VID_ASUS, USB_PID_ASUS_U3000) }, |
905 | { USB_DEVICE(USB_VID_ASUS, USB_PID_ASUS_U3100) }, | 1108 | { USB_DEVICE(USB_VID_ASUS, USB_PID_ASUS_U3100) }, |
906 | /* 25 */ { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_STICK_3) }, | 1109 | /* 25 */{ USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_STICK_3) }, |
907 | { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_MYTV_T) }, | 1110 | { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_MYTV_T) }, |
908 | { 0 } /* Terminating entry */ | 1111 | { USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_CINERGY_HT_USB_XE) }, |
1112 | { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_EXPRESSCARD_320CX) }, | ||
1113 | { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV72E) }, | ||
1114 | /* 30 */{ USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV73E) }, | ||
1115 | { USB_DEVICE(USB_VID_YUAN, USB_PID_YUAN_EC372S) }, | ||
1116 | { USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_CINERGY_HT_EXPRESS) }, | ||
1117 | { USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_CINERGY_T_XXS) }, | ||
1118 | { USB_DEVICE(USB_VID_LEADTEK, USB_PID_WINFAST_DTV_DONGLE_STK7700P_2) }, | ||
1119 | { 0 } /* Terminating entry */ | ||
909 | }; | 1120 | }; |
910 | MODULE_DEVICE_TABLE(usb, dib0700_usb_id_table); | 1121 | MODULE_DEVICE_TABLE(usb, dib0700_usb_id_table); |
911 | 1122 | ||
@@ -969,7 +1180,7 @@ struct dvb_usb_device_properties dib0700_devices[] = { | |||
969 | { NULL }, | 1180 | { NULL }, |
970 | }, | 1181 | }, |
971 | { "Leadtek Winfast DTV Dongle (STK7700P based)", | 1182 | { "Leadtek Winfast DTV Dongle (STK7700P based)", |
972 | { &dib0700_usb_id_table[8], NULL }, | 1183 | { &dib0700_usb_id_table[8], &dib0700_usb_id_table[34] }, |
973 | { NULL }, | 1184 | { NULL }, |
974 | }, | 1185 | }, |
975 | { "AVerMedia AVerTV DVB-T Express", | 1186 | { "AVerMedia AVerTV DVB-T Express", |
@@ -1069,12 +1280,16 @@ struct dvb_usb_device_properties dib0700_devices[] = { | |||
1069 | }, | 1280 | }, |
1070 | }, | 1281 | }, |
1071 | 1282 | ||
1072 | .num_device_descs = 1, | 1283 | .num_device_descs = 2, |
1073 | .devices = { | 1284 | .devices = { |
1074 | { "ASUS My Cinema U3000 Mini DVBT Tuner", | 1285 | { "ASUS My Cinema U3000 Mini DVBT Tuner", |
1075 | { &dib0700_usb_id_table[23], NULL }, | 1286 | { &dib0700_usb_id_table[23], NULL }, |
1076 | { NULL }, | 1287 | { NULL }, |
1077 | }, | 1288 | }, |
1289 | { "Yuan EC372S", | ||
1290 | { &dib0700_usb_id_table[31], NULL }, | ||
1291 | { NULL }, | ||
1292 | } | ||
1078 | } | 1293 | } |
1079 | }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, | 1294 | }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, |
1080 | 1295 | ||
@@ -1090,7 +1305,7 @@ struct dvb_usb_device_properties dib0700_devices[] = { | |||
1090 | }, | 1305 | }, |
1091 | }, | 1306 | }, |
1092 | 1307 | ||
1093 | .num_device_descs = 6, | 1308 | .num_device_descs = 9, |
1094 | .devices = { | 1309 | .devices = { |
1095 | { "DiBcom STK7070P reference design", | 1310 | { "DiBcom STK7070P reference design", |
1096 | { &dib0700_usb_id_table[15], NULL }, | 1311 | { &dib0700_usb_id_table[15], NULL }, |
@@ -1116,6 +1331,18 @@ struct dvb_usb_device_properties dib0700_devices[] = { | |||
1116 | { &dib0700_usb_id_table[26], NULL }, | 1331 | { &dib0700_usb_id_table[26], NULL }, |
1117 | { NULL }, | 1332 | { NULL }, |
1118 | }, | 1333 | }, |
1334 | { "Pinnacle PCTV 72e", | ||
1335 | { &dib0700_usb_id_table[29], NULL }, | ||
1336 | { NULL }, | ||
1337 | }, | ||
1338 | { "Pinnacle PCTV 73e", | ||
1339 | { &dib0700_usb_id_table[30], NULL }, | ||
1340 | { NULL }, | ||
1341 | }, | ||
1342 | { "Terratec Cinergy T USB XXS", | ||
1343 | { &dib0700_usb_id_table[33], NULL }, | ||
1344 | { NULL }, | ||
1345 | }, | ||
1119 | }, | 1346 | }, |
1120 | 1347 | ||
1121 | .rc_interval = DEFAULT_RC_INTERVAL, | 1348 | .rc_interval = DEFAULT_RC_INTERVAL, |
@@ -1155,6 +1382,40 @@ struct dvb_usb_device_properties dib0700_devices[] = { | |||
1155 | { NULL }, | 1382 | { NULL }, |
1156 | } | 1383 | } |
1157 | } | 1384 | } |
1385 | }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, | ||
1386 | |||
1387 | .num_adapters = 1, | ||
1388 | .adapter = { | ||
1389 | { | ||
1390 | .frontend_attach = stk7700ph_frontend_attach, | ||
1391 | .tuner_attach = stk7700ph_tuner_attach, | ||
1392 | |||
1393 | DIB0700_DEFAULT_STREAMING_CONFIG(0x02), | ||
1394 | |||
1395 | .size_of_priv = sizeof(struct | ||
1396 | dib0700_adapter_state), | ||
1397 | }, | ||
1398 | }, | ||
1399 | |||
1400 | .num_device_descs = 3, | ||
1401 | .devices = { | ||
1402 | { "Terratec Cinergy HT USB XE", | ||
1403 | { &dib0700_usb_id_table[27], NULL }, | ||
1404 | { NULL }, | ||
1405 | }, | ||
1406 | { "Pinnacle Expresscard 320cx", | ||
1407 | { &dib0700_usb_id_table[28], NULL }, | ||
1408 | { NULL }, | ||
1409 | }, | ||
1410 | { "Terratec Cinergy HT Express", | ||
1411 | { &dib0700_usb_id_table[32], NULL }, | ||
1412 | { NULL }, | ||
1413 | }, | ||
1414 | }, | ||
1415 | .rc_interval = DEFAULT_RC_INTERVAL, | ||
1416 | .rc_key_map = dib0700_rc_keys, | ||
1417 | .rc_key_map_size = ARRAY_SIZE(dib0700_rc_keys), | ||
1418 | .rc_query = dib0700_rc_query | ||
1158 | }, | 1419 | }, |
1159 | }; | 1420 | }; |
1160 | 1421 | ||
diff --git a/drivers/media/dvb/dvb-usb/dibusb-mb.c b/drivers/media/dvb/dvb-usb/dibusb-mb.c index 043cadae0859..eeef50bff4f9 100644 --- a/drivers/media/dvb/dvb-usb/dibusb-mb.c +++ b/drivers/media/dvb/dvb-usb/dibusb-mb.c | |||
@@ -14,6 +14,8 @@ | |||
14 | */ | 14 | */ |
15 | #include "dibusb.h" | 15 | #include "dibusb.h" |
16 | 16 | ||
17 | DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); | ||
18 | |||
17 | static int dib3000mb_i2c_gate_ctrl(struct dvb_frontend* fe, int enable) | 19 | static int dib3000mb_i2c_gate_ctrl(struct dvb_frontend* fe, int enable) |
18 | { | 20 | { |
19 | struct dvb_usb_adapter *adap = fe->dvb->priv; | 21 | struct dvb_usb_adapter *adap = fe->dvb->priv; |
@@ -107,10 +109,14 @@ static struct dvb_usb_device_properties artec_t1_usb2_properties; | |||
107 | static int dibusb_probe(struct usb_interface *intf, | 109 | static int dibusb_probe(struct usb_interface *intf, |
108 | const struct usb_device_id *id) | 110 | const struct usb_device_id *id) |
109 | { | 111 | { |
110 | if (dvb_usb_device_init(intf,&dibusb1_1_properties,THIS_MODULE,NULL) == 0 || | 112 | if (0 == dvb_usb_device_init(intf, &dibusb1_1_properties, |
111 | dvb_usb_device_init(intf,&dibusb1_1_an2235_properties,THIS_MODULE,NULL) == 0 || | 113 | THIS_MODULE, NULL, adapter_nr) || |
112 | dvb_usb_device_init(intf,&dibusb2_0b_properties,THIS_MODULE,NULL) == 0 || | 114 | 0 == dvb_usb_device_init(intf, &dibusb1_1_an2235_properties, |
113 | dvb_usb_device_init(intf,&artec_t1_usb2_properties,THIS_MODULE,NULL) == 0) | 115 | THIS_MODULE, NULL, adapter_nr) || |
116 | 0 == dvb_usb_device_init(intf, &dibusb2_0b_properties, | ||
117 | THIS_MODULE, NULL, adapter_nr) || | ||
118 | 0 == dvb_usb_device_init(intf, &artec_t1_usb2_properties, | ||
119 | THIS_MODULE, NULL, adapter_nr)) | ||
114 | return 0; | 120 | return 0; |
115 | 121 | ||
116 | return -EINVAL; | 122 | return -EINVAL; |
diff --git a/drivers/media/dvb/dvb-usb/dibusb-mc.c b/drivers/media/dvb/dvb-usb/dibusb-mc.c index e7ea3e753d6d..059cec955318 100644 --- a/drivers/media/dvb/dvb-usb/dibusb-mc.c +++ b/drivers/media/dvb/dvb-usb/dibusb-mc.c | |||
@@ -14,13 +14,16 @@ | |||
14 | */ | 14 | */ |
15 | #include "dibusb.h" | 15 | #include "dibusb.h" |
16 | 16 | ||
17 | DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); | ||
18 | |||
17 | /* USB Driver stuff */ | 19 | /* USB Driver stuff */ |
18 | static struct dvb_usb_device_properties dibusb_mc_properties; | 20 | static struct dvb_usb_device_properties dibusb_mc_properties; |
19 | 21 | ||
20 | static int dibusb_mc_probe(struct usb_interface *intf, | 22 | static int dibusb_mc_probe(struct usb_interface *intf, |
21 | const struct usb_device_id *id) | 23 | const struct usb_device_id *id) |
22 | { | 24 | { |
23 | return dvb_usb_device_init(intf,&dibusb_mc_properties,THIS_MODULE,NULL); | 25 | return dvb_usb_device_init(intf, &dibusb_mc_properties, THIS_MODULE, |
26 | NULL, adapter_nr); | ||
24 | } | 27 | } |
25 | 28 | ||
26 | /* do not change the order of the ID table */ | 29 | /* do not change the order of the ID table */ |
diff --git a/drivers/media/dvb/dvb-usb/digitv.c b/drivers/media/dvb/dvb-usb/digitv.c index 3acbda4aa27e..b545cf3eab2e 100644 --- a/drivers/media/dvb/dvb-usb/digitv.c +++ b/drivers/media/dvb/dvb-usb/digitv.c | |||
@@ -20,6 +20,9 @@ | |||
20 | static int dvb_usb_digitv_debug; | 20 | static int dvb_usb_digitv_debug; |
21 | module_param_named(debug,dvb_usb_digitv_debug, int, 0644); | 21 | module_param_named(debug,dvb_usb_digitv_debug, int, 0644); |
22 | MODULE_PARM_DESC(debug, "set debugging level (1=rc (or-able))." DVB_USB_DEBUG_STATUS); | 22 | MODULE_PARM_DESC(debug, "set debugging level (1=rc (or-able))." DVB_USB_DEBUG_STATUS); |
23 | |||
24 | DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); | ||
25 | |||
23 | #define deb_rc(args...) dprintk(dvb_usb_digitv_debug,0x01,args) | 26 | #define deb_rc(args...) dprintk(dvb_usb_digitv_debug,0x01,args) |
24 | 27 | ||
25 | static int digitv_ctrl_msg(struct dvb_usb_device *d, | 28 | static int digitv_ctrl_msg(struct dvb_usb_device *d, |
@@ -256,8 +259,9 @@ static int digitv_probe(struct usb_interface *intf, | |||
256 | const struct usb_device_id *id) | 259 | const struct usb_device_id *id) |
257 | { | 260 | { |
258 | struct dvb_usb_device *d; | 261 | struct dvb_usb_device *d; |
259 | int ret; | 262 | int ret = dvb_usb_device_init(intf, &digitv_properties, THIS_MODULE, &d, |
260 | if ((ret = dvb_usb_device_init(intf,&digitv_properties,THIS_MODULE,&d)) == 0) { | 263 | adapter_nr); |
264 | if (ret == 0) { | ||
261 | u8 b[4] = { 0 }; | 265 | u8 b[4] = { 0 }; |
262 | 266 | ||
263 | if (d != NULL) { /* do that only when the firmware is loaded */ | 267 | if (d != NULL) { /* do that only when the firmware is loaded */ |
diff --git a/drivers/media/dvb/dvb-usb/dtt200u.c b/drivers/media/dvb/dvb-usb/dtt200u.c index d86cf9bee91c..81a6cbf60160 100644 --- a/drivers/media/dvb/dvb-usb/dtt200u.c +++ b/drivers/media/dvb/dvb-usb/dtt200u.c | |||
@@ -18,6 +18,8 @@ int dvb_usb_dtt200u_debug; | |||
18 | module_param_named(debug,dvb_usb_dtt200u_debug, int, 0644); | 18 | module_param_named(debug,dvb_usb_dtt200u_debug, int, 0644); |
19 | MODULE_PARM_DESC(debug, "set debugging level (1=info,xfer=2 (or-able))." DVB_USB_DEBUG_STATUS); | 19 | MODULE_PARM_DESC(debug, "set debugging level (1=info,xfer=2 (or-able))." DVB_USB_DEBUG_STATUS); |
20 | 20 | ||
21 | DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); | ||
22 | |||
21 | static int dtt200u_power_ctrl(struct dvb_usb_device *d, int onoff) | 23 | static int dtt200u_power_ctrl(struct dvb_usb_device *d, int onoff) |
22 | { | 24 | { |
23 | u8 b = SET_INIT; | 25 | u8 b = SET_INIT; |
@@ -101,11 +103,16 @@ static struct dvb_usb_device_properties wt220u_miglia_properties; | |||
101 | static int dtt200u_usb_probe(struct usb_interface *intf, | 103 | static int dtt200u_usb_probe(struct usb_interface *intf, |
102 | const struct usb_device_id *id) | 104 | const struct usb_device_id *id) |
103 | { | 105 | { |
104 | if (dvb_usb_device_init(intf,&dtt200u_properties,THIS_MODULE,NULL) == 0 || | 106 | if (0 == dvb_usb_device_init(intf, &dtt200u_properties, |
105 | dvb_usb_device_init(intf,&wt220u_properties,THIS_MODULE,NULL) == 0 || | 107 | THIS_MODULE, NULL, adapter_nr) || |
106 | dvb_usb_device_init(intf,&wt220u_fc_properties,THIS_MODULE,NULL) == 0 || | 108 | 0 == dvb_usb_device_init(intf, &wt220u_properties, |
107 | dvb_usb_device_init(intf,&wt220u_zl0353_properties,THIS_MODULE,NULL) == 0 || | 109 | THIS_MODULE, NULL, adapter_nr) || |
108 | dvb_usb_device_init(intf,&wt220u_miglia_properties,THIS_MODULE,NULL) == 0) | 110 | 0 == dvb_usb_device_init(intf, &wt220u_fc_properties, |
111 | THIS_MODULE, NULL, adapter_nr) || | ||
112 | 0 == dvb_usb_device_init(intf, &wt220u_zl0353_properties, | ||
113 | THIS_MODULE, NULL, adapter_nr) || | ||
114 | 0 == dvb_usb_device_init(intf, &wt220u_miglia_properties, | ||
115 | THIS_MODULE, NULL, adapter_nr)) | ||
109 | return 0; | 116 | return 0; |
110 | 117 | ||
111 | return -ENODEV; | 118 | return -ENODEV; |
diff --git a/drivers/media/dvb/dvb-usb/dvb-usb-common.h b/drivers/media/dvb/dvb-usb/dvb-usb-common.h index 35ab68f6dcf6..6b7b2a89242e 100644 --- a/drivers/media/dvb/dvb-usb/dvb-usb-common.h +++ b/drivers/media/dvb/dvb-usb/dvb-usb-common.h | |||
@@ -40,7 +40,8 @@ extern int dvb_usb_adapter_stream_exit(struct dvb_usb_adapter *adap); | |||
40 | extern int dvb_usb_i2c_init(struct dvb_usb_device *); | 40 | extern int dvb_usb_i2c_init(struct dvb_usb_device *); |
41 | extern int dvb_usb_i2c_exit(struct dvb_usb_device *); | 41 | extern int dvb_usb_i2c_exit(struct dvb_usb_device *); |
42 | 42 | ||
43 | extern int dvb_usb_adapter_dvb_init(struct dvb_usb_adapter *adap); | 43 | extern int dvb_usb_adapter_dvb_init(struct dvb_usb_adapter *adap, |
44 | short *adapter_nums); | ||
44 | extern int dvb_usb_adapter_dvb_exit(struct dvb_usb_adapter *adap); | 45 | extern int dvb_usb_adapter_dvb_exit(struct dvb_usb_adapter *adap); |
45 | extern int dvb_usb_adapter_frontend_init(struct dvb_usb_adapter *adap); | 46 | extern int dvb_usb_adapter_frontend_init(struct dvb_usb_adapter *adap); |
46 | extern int dvb_usb_adapter_frontend_exit(struct dvb_usb_adapter *adap); | 47 | extern int dvb_usb_adapter_frontend_exit(struct dvb_usb_adapter *adap); |
diff --git a/drivers/media/dvb/dvb-usb/dvb-usb-dvb.c b/drivers/media/dvb/dvb-usb/dvb-usb-dvb.c index 4561a672da92..ce8cd0c5d831 100644 --- a/drivers/media/dvb/dvb-usb/dvb-usb-dvb.c +++ b/drivers/media/dvb/dvb-usb/dvb-usb-dvb.c | |||
@@ -77,12 +77,13 @@ static int dvb_usb_stop_feed(struct dvb_demux_feed *dvbdmxfeed) | |||
77 | return dvb_usb_ctrl_feed(dvbdmxfeed,0); | 77 | return dvb_usb_ctrl_feed(dvbdmxfeed,0); |
78 | } | 78 | } |
79 | 79 | ||
80 | int dvb_usb_adapter_dvb_init(struct dvb_usb_adapter *adap) | 80 | int dvb_usb_adapter_dvb_init(struct dvb_usb_adapter *adap, short *adapter_nums) |
81 | { | 81 | { |
82 | int ret; | 82 | int ret = dvb_register_adapter(&adap->dvb_adap, adap->dev->desc->name, |
83 | adap->dev->owner, &adap->dev->udev->dev, | ||
84 | adapter_nums); | ||
83 | 85 | ||
84 | if ((ret = dvb_register_adapter(&adap->dvb_adap, adap->dev->desc->name, | 86 | if (ret < 0) { |
85 | adap->dev->owner, &adap->dev->udev->dev)) < 0) { | ||
86 | deb_info("dvb_register_adapter failed: error %d", ret); | 87 | deb_info("dvb_register_adapter failed: error %d", ret); |
87 | goto err; | 88 | goto err; |
88 | } | 89 | } |
diff --git a/drivers/media/dvb/dvb-usb/dvb-usb-ids.h b/drivers/media/dvb/dvb-usb/dvb-usb-ids.h index aa4844ef875e..34245d1b7dd9 100644 --- a/drivers/media/dvb/dvb-usb/dvb-usb-ids.h +++ b/drivers/media/dvb/dvb-usb/dvb-usb-ids.h | |||
@@ -40,14 +40,15 @@ | |||
40 | #define USB_VID_MSI 0x0db0 | 40 | #define USB_VID_MSI 0x0db0 |
41 | #define USB_VID_OPERA1 0x695c | 41 | #define USB_VID_OPERA1 0x695c |
42 | #define USB_VID_PINNACLE 0x2304 | 42 | #define USB_VID_PINNACLE 0x2304 |
43 | #define USB_VID_TECHNOTREND 0x0b48 | ||
43 | #define USB_VID_TERRATEC 0x0ccd | 44 | #define USB_VID_TERRATEC 0x0ccd |
44 | #define USB_VID_VISIONPLUS 0x13d3 | 45 | #define USB_VID_VISIONPLUS 0x13d3 |
45 | #define USB_VID_TWINHAN 0x1822 | 46 | #define USB_VID_TWINHAN 0x1822 |
46 | #define USB_VID_ULTIMA_ELECTRONIC 0x05d8 | 47 | #define USB_VID_ULTIMA_ELECTRONIC 0x05d8 |
47 | #define USB_VID_UNIWILL 0x1584 | 48 | #define USB_VID_UNIWILL 0x1584 |
48 | #define USB_VID_WIDEVIEW 0x14aa | 49 | #define USB_VID_WIDEVIEW 0x14aa |
49 | /* dom : pour gigabyte u7000 */ | ||
50 | #define USB_VID_GIGABYTE 0x1044 | 50 | #define USB_VID_GIGABYTE 0x1044 |
51 | #define USB_VID_YUAN 0x1164 | ||
51 | 52 | ||
52 | 53 | ||
53 | /* Product IDs */ | 54 | /* Product IDs */ |
@@ -134,10 +135,17 @@ | |||
134 | #define USB_PID_AVERMEDIA_EXPRESS 0xb568 | 135 | #define USB_PID_AVERMEDIA_EXPRESS 0xb568 |
135 | #define USB_PID_AVERMEDIA_VOLAR 0xa807 | 136 | #define USB_PID_AVERMEDIA_VOLAR 0xa807 |
136 | #define USB_PID_AVERMEDIA_VOLAR_2 0xb808 | 137 | #define USB_PID_AVERMEDIA_VOLAR_2 0xb808 |
138 | #define USB_PID_TECHNOTREND_CONNECT_S2400 0x3006 | ||
137 | #define USB_PID_TERRATEC_CINERGY_DT_XS_DIVERSITY 0x005a | 139 | #define USB_PID_TERRATEC_CINERGY_DT_XS_DIVERSITY 0x005a |
140 | #define USB_PID_TERRATEC_CINERGY_HT_USB_XE 0x0058 | ||
141 | #define USB_PID_TERRATEC_CINERGY_HT_EXPRESS 0x0060 | ||
142 | #define USB_PID_TERRATEC_CINERGY_T_XXS 0x0078 | ||
143 | #define USB_PID_PINNACLE_EXPRESSCARD_320CX 0x022e | ||
138 | #define USB_PID_PINNACLE_PCTV2000E 0x022c | 144 | #define USB_PID_PINNACLE_PCTV2000E 0x022c |
139 | #define USB_PID_PINNACLE_PCTV_DVB_T_FLASH 0x0228 | 145 | #define USB_PID_PINNACLE_PCTV_DVB_T_FLASH 0x0228 |
140 | #define USB_PID_PINNACLE_PCTV_DUAL_DIVERSITY_DVB_T 0x0229 | 146 | #define USB_PID_PINNACLE_PCTV_DUAL_DIVERSITY_DVB_T 0x0229 |
147 | #define USB_PID_PINNACLE_PCTV72E 0x0236 | ||
148 | #define USB_PID_PINNACLE_PCTV73E 0x0237 | ||
141 | #define USB_PID_PCTV_200E 0x020e | 149 | #define USB_PID_PCTV_200E 0x020e |
142 | #define USB_PID_PCTV_400E 0x020f | 150 | #define USB_PID_PCTV_400E 0x020f |
143 | #define USB_PID_PCTV_450E 0x0222 | 151 | #define USB_PID_PCTV_450E 0x0222 |
@@ -172,6 +180,7 @@ | |||
172 | #define USB_PID_WINFAST_DTV_DONGLE_COLD 0x6025 | 180 | #define USB_PID_WINFAST_DTV_DONGLE_COLD 0x6025 |
173 | #define USB_PID_WINFAST_DTV_DONGLE_WARM 0x6026 | 181 | #define USB_PID_WINFAST_DTV_DONGLE_WARM 0x6026 |
174 | #define USB_PID_WINFAST_DTV_DONGLE_STK7700P 0x6f00 | 182 | #define USB_PID_WINFAST_DTV_DONGLE_STK7700P 0x6f00 |
183 | #define USB_PID_WINFAST_DTV_DONGLE_STK7700P_2 0x6f01 | ||
175 | #define USB_PID_GENPIX_8PSK_REV_1_COLD 0x0200 | 184 | #define USB_PID_GENPIX_8PSK_REV_1_COLD 0x0200 |
176 | #define USB_PID_GENPIX_8PSK_REV_1_WARM 0x0201 | 185 | #define USB_PID_GENPIX_8PSK_REV_1_WARM 0x0201 |
177 | #define USB_PID_GENPIX_8PSK_REV_2 0x0202 | 186 | #define USB_PID_GENPIX_8PSK_REV_2 0x0202 |
@@ -183,9 +192,9 @@ | |||
183 | #define USB_PID_OPERA1_WARM 0x3829 | 192 | #define USB_PID_OPERA1_WARM 0x3829 |
184 | #define USB_PID_LIFEVIEW_TV_WALKER_TWIN_COLD 0x0514 | 193 | #define USB_PID_LIFEVIEW_TV_WALKER_TWIN_COLD 0x0514 |
185 | #define USB_PID_LIFEVIEW_TV_WALKER_TWIN_WARM 0x0513 | 194 | #define USB_PID_LIFEVIEW_TV_WALKER_TWIN_WARM 0x0513 |
186 | /* dom pour gigabyte u7000 */ | ||
187 | #define USB_PID_GIGABYTE_U7000 0x7001 | 195 | #define USB_PID_GIGABYTE_U7000 0x7001 |
188 | #define USB_PID_ASUS_U3000 0x171f | 196 | #define USB_PID_ASUS_U3000 0x171f |
189 | #define USB_PID_ASUS_U3100 0x173f | 197 | #define USB_PID_ASUS_U3100 0x173f |
198 | #define USB_PID_YUAN_EC372S 0x1edc | ||
190 | 199 | ||
191 | #endif | 200 | #endif |
diff --git a/drivers/media/dvb/dvb-usb/dvb-usb-init.c b/drivers/media/dvb/dvb-usb/dvb-usb-init.c index cdd717c3fe45..e331db8c77b2 100644 --- a/drivers/media/dvb/dvb-usb/dvb-usb-init.c +++ b/drivers/media/dvb/dvb-usb/dvb-usb-init.c | |||
@@ -26,7 +26,7 @@ static int dvb_usb_force_pid_filter_usage; | |||
26 | module_param_named(force_pid_filter_usage, dvb_usb_force_pid_filter_usage, int, 0444); | 26 | module_param_named(force_pid_filter_usage, dvb_usb_force_pid_filter_usage, int, 0444); |
27 | MODULE_PARM_DESC(force_pid_filter_usage, "force all dvb-usb-devices to use a PID filter, if any (default: 0)."); | 27 | MODULE_PARM_DESC(force_pid_filter_usage, "force all dvb-usb-devices to use a PID filter, if any (default: 0)."); |
28 | 28 | ||
29 | static int dvb_usb_adapter_init(struct dvb_usb_device *d) | 29 | static int dvb_usb_adapter_init(struct dvb_usb_device *d, short *adapter_nrs) |
30 | { | 30 | { |
31 | struct dvb_usb_adapter *adap; | 31 | struct dvb_usb_adapter *adap; |
32 | int ret,n; | 32 | int ret,n; |
@@ -72,7 +72,7 @@ static int dvb_usb_adapter_init(struct dvb_usb_device *d) | |||
72 | } | 72 | } |
73 | 73 | ||
74 | if ((ret = dvb_usb_adapter_stream_init(adap)) || | 74 | if ((ret = dvb_usb_adapter_stream_init(adap)) || |
75 | (ret = dvb_usb_adapter_dvb_init(adap)) || | 75 | (ret = dvb_usb_adapter_dvb_init(adap, adapter_nrs)) || |
76 | (ret = dvb_usb_adapter_frontend_init(adap))) { | 76 | (ret = dvb_usb_adapter_frontend_init(adap))) { |
77 | return ret; | 77 | return ret; |
78 | } | 78 | } |
@@ -122,7 +122,7 @@ static int dvb_usb_exit(struct dvb_usb_device *d) | |||
122 | return 0; | 122 | return 0; |
123 | } | 123 | } |
124 | 124 | ||
125 | static int dvb_usb_init(struct dvb_usb_device *d) | 125 | static int dvb_usb_init(struct dvb_usb_device *d, short *adapter_nums) |
126 | { | 126 | { |
127 | int ret = 0; | 127 | int ret = 0; |
128 | 128 | ||
@@ -143,7 +143,7 @@ static int dvb_usb_init(struct dvb_usb_device *d) | |||
143 | dvb_usb_device_power_ctrl(d, 1); | 143 | dvb_usb_device_power_ctrl(d, 1); |
144 | 144 | ||
145 | if ((ret = dvb_usb_i2c_init(d)) || | 145 | if ((ret = dvb_usb_i2c_init(d)) || |
146 | (ret = dvb_usb_adapter_init(d))) { | 146 | (ret = dvb_usb_adapter_init(d, adapter_nums))) { |
147 | dvb_usb_exit(d); | 147 | dvb_usb_exit(d); |
148 | return ret; | 148 | return ret; |
149 | } | 149 | } |
@@ -213,8 +213,10 @@ int dvb_usb_device_power_ctrl(struct dvb_usb_device *d, int onoff) | |||
213 | /* | 213 | /* |
214 | * USB | 214 | * USB |
215 | */ | 215 | */ |
216 | int dvb_usb_device_init(struct usb_interface *intf, struct dvb_usb_device_properties | 216 | int dvb_usb_device_init(struct usb_interface *intf, |
217 | *props, struct module *owner,struct dvb_usb_device **du) | 217 | struct dvb_usb_device_properties *props, |
218 | struct module *owner, struct dvb_usb_device **du, | ||
219 | short *adapter_nums) | ||
218 | { | 220 | { |
219 | struct usb_device *udev = interface_to_usbdev(intf); | 221 | struct usb_device *udev = interface_to_usbdev(intf); |
220 | struct dvb_usb_device *d = NULL; | 222 | struct dvb_usb_device *d = NULL; |
@@ -254,7 +256,7 @@ int dvb_usb_device_init(struct usb_interface *intf, struct dvb_usb_device_proper | |||
254 | if (du != NULL) | 256 | if (du != NULL) |
255 | *du = d; | 257 | *du = d; |
256 | 258 | ||
257 | ret = dvb_usb_init(d); | 259 | ret = dvb_usb_init(d, adapter_nums); |
258 | 260 | ||
259 | if (ret == 0) | 261 | if (ret == 0) |
260 | info("%s successfully initialized and connected.",desc->name); | 262 | info("%s successfully initialized and connected.",desc->name); |
diff --git a/drivers/media/dvb/dvb-usb/dvb-usb.h b/drivers/media/dvb/dvb-usb/dvb-usb.h index d1b3c7b81fff..b1de0f7e26e8 100644 --- a/drivers/media/dvb/dvb-usb/dvb-usb.h +++ b/drivers/media/dvb/dvb-usb/dvb-usb.h | |||
@@ -372,7 +372,10 @@ struct dvb_usb_device { | |||
372 | void *priv; | 372 | void *priv; |
373 | }; | 373 | }; |
374 | 374 | ||
375 | extern int dvb_usb_device_init(struct usb_interface *, struct dvb_usb_device_properties *, struct module *, struct dvb_usb_device **); | 375 | extern int dvb_usb_device_init(struct usb_interface *, |
376 | struct dvb_usb_device_properties *, | ||
377 | struct module *, struct dvb_usb_device **, | ||
378 | short *adapter_nums); | ||
376 | extern void dvb_usb_device_exit(struct usb_interface *); | 379 | extern void dvb_usb_device_exit(struct usb_interface *); |
377 | 380 | ||
378 | /* the generic read/write method for device control */ | 381 | /* the generic read/write method for device control */ |
diff --git a/drivers/media/dvb/dvb-usb/gl861.c b/drivers/media/dvb/dvb-usb/gl861.c index 6b99d9f4d5b3..0a8ac64a4e33 100644 --- a/drivers/media/dvb/dvb-usb/gl861.c +++ b/drivers/media/dvb/dvb-usb/gl861.c | |||
@@ -16,6 +16,8 @@ static int dvb_usb_gl861_debug; | |||
16 | module_param_named(debug,dvb_usb_gl861_debug, int, 0644); | 16 | module_param_named(debug,dvb_usb_gl861_debug, int, 0644); |
17 | MODULE_PARM_DESC(debug, "set debugging level (1=rc (or-able))." DVB_USB_DEBUG_STATUS); | 17 | MODULE_PARM_DESC(debug, "set debugging level (1=rc (or-able))." DVB_USB_DEBUG_STATUS); |
18 | 18 | ||
19 | DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); | ||
20 | |||
19 | static int gl861_i2c_msg(struct dvb_usb_device *d, u8 addr, | 21 | static int gl861_i2c_msg(struct dvb_usb_device *d, u8 addr, |
20 | u8 *wbuf, u16 wlen, u8 *rbuf, u16 rlen) | 22 | u8 *wbuf, u16 wlen, u8 *rbuf, u16 rlen) |
21 | { | 23 | { |
@@ -140,7 +142,9 @@ static int gl861_probe(struct usb_interface *intf, | |||
140 | if (intf->num_altsetting < 2) | 142 | if (intf->num_altsetting < 2) |
141 | return -ENODEV; | 143 | return -ENODEV; |
142 | 144 | ||
143 | if ((ret = dvb_usb_device_init(intf, &gl861_properties, THIS_MODULE, &d)) == 0) { | 145 | ret = dvb_usb_device_init(intf, &gl861_properties, THIS_MODULE, &d, |
146 | adapter_nr); | ||
147 | if (ret == 0) { | ||
144 | alt = usb_altnum_to_altsetting(intf, 0); | 148 | alt = usb_altnum_to_altsetting(intf, 0); |
145 | 149 | ||
146 | if (alt == NULL) { | 150 | if (alt == NULL) { |
diff --git a/drivers/media/dvb/dvb-usb/gp8psk-fe.c b/drivers/media/dvb/dvb-usb/gp8psk-fe.c index e37142d9271a..262a858c3068 100644 --- a/drivers/media/dvb/dvb-usb/gp8psk-fe.c +++ b/drivers/media/dvb/dvb-usb/gp8psk-fe.c | |||
@@ -152,7 +152,7 @@ static int gp8psk_fe_send_diseqc_msg (struct dvb_frontend* fe, | |||
152 | { | 152 | { |
153 | struct gp8psk_fe_state *st = fe->demodulator_priv; | 153 | struct gp8psk_fe_state *st = fe->demodulator_priv; |
154 | 154 | ||
155 | deb_fe("%s\n",__FUNCTION__); | 155 | deb_fe("%s\n",__func__); |
156 | 156 | ||
157 | if (gp8psk_usb_out_op(st->d,SEND_DISEQC_COMMAND, m->msg[0], 0, | 157 | if (gp8psk_usb_out_op(st->d,SEND_DISEQC_COMMAND, m->msg[0], 0, |
158 | m->msg, m->msg_len)) { | 158 | m->msg, m->msg_len)) { |
@@ -167,7 +167,7 @@ static int gp8psk_fe_send_diseqc_burst (struct dvb_frontend* fe, | |||
167 | struct gp8psk_fe_state *st = fe->demodulator_priv; | 167 | struct gp8psk_fe_state *st = fe->demodulator_priv; |
168 | u8 cmd; | 168 | u8 cmd; |
169 | 169 | ||
170 | deb_fe("%s\n",__FUNCTION__); | 170 | deb_fe("%s\n",__func__); |
171 | 171 | ||
172 | /* These commands are certainly wrong */ | 172 | /* These commands are certainly wrong */ |
173 | cmd = (burst == SEC_MINI_A) ? 0x00 : 0x01; | 173 | cmd = (burst == SEC_MINI_A) ? 0x00 : 0x01; |
diff --git a/drivers/media/dvb/dvb-usb/gp8psk.c b/drivers/media/dvb/dvb-usb/gp8psk.c index 83e8535014c6..9a942afaf0af 100644 --- a/drivers/media/dvb/dvb-usb/gp8psk.c +++ b/drivers/media/dvb/dvb-usb/gp8psk.c | |||
@@ -22,6 +22,8 @@ int dvb_usb_gp8psk_debug; | |||
22 | module_param_named(debug,dvb_usb_gp8psk_debug, int, 0644); | 22 | module_param_named(debug,dvb_usb_gp8psk_debug, int, 0644); |
23 | MODULE_PARM_DESC(debug, "set debugging level (1=info,xfer=2,rc=4 (or-able))." DVB_USB_DEBUG_STATUS); | 23 | MODULE_PARM_DESC(debug, "set debugging level (1=info,xfer=2,rc=4 (or-able))." DVB_USB_DEBUG_STATUS); |
24 | 24 | ||
25 | DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); | ||
26 | |||
25 | int gp8psk_usb_in_op(struct dvb_usb_device *d, u8 req, u16 value, u16 index, u8 *b, int blen) | 27 | int gp8psk_usb_in_op(struct dvb_usb_device *d, u8 req, u16 value, u16 index, u8 *b, int blen) |
26 | { | 28 | { |
27 | int ret = 0,try = 0; | 29 | int ret = 0,try = 0; |
@@ -190,7 +192,8 @@ static int gp8psk_usb_probe(struct usb_interface *intf, | |||
190 | { | 192 | { |
191 | int ret; | 193 | int ret; |
192 | struct usb_device *udev = interface_to_usbdev(intf); | 194 | struct usb_device *udev = interface_to_usbdev(intf); |
193 | ret = dvb_usb_device_init(intf,&gp8psk_properties,THIS_MODULE,NULL); | 195 | ret = dvb_usb_device_init(intf, &gp8psk_properties, |
196 | THIS_MODULE, NULL, adapter_nr); | ||
194 | if (ret == 0) { | 197 | if (ret == 0) { |
195 | info("found Genpix USB device pID = %x (hex)", | 198 | info("found Genpix USB device pID = %x (hex)", |
196 | le16_to_cpu(udev->descriptor.idProduct)); | 199 | le16_to_cpu(udev->descriptor.idProduct)); |
diff --git a/drivers/media/dvb/dvb-usb/m920x.c b/drivers/media/dvb/dvb-usb/m920x.c index a956bc503a4c..a12e6f784fda 100644 --- a/drivers/media/dvb/dvb-usb/m920x.c +++ b/drivers/media/dvb/dvb-usb/m920x.c | |||
@@ -22,6 +22,8 @@ static int dvb_usb_m920x_debug; | |||
22 | module_param_named(debug,dvb_usb_m920x_debug, int, 0644); | 22 | module_param_named(debug,dvb_usb_m920x_debug, int, 0644); |
23 | MODULE_PARM_DESC(debug, "set debugging level (1=rc (or-able))." DVB_USB_DEBUG_STATUS); | 23 | MODULE_PARM_DESC(debug, "set debugging level (1=rc (or-able))." DVB_USB_DEBUG_STATUS); |
24 | 24 | ||
25 | DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); | ||
26 | |||
25 | static int m920x_set_filter(struct dvb_usb_device *d, int type, int idx, int pid); | 27 | static int m920x_set_filter(struct dvb_usb_device *d, int type, int idx, int pid); |
26 | 28 | ||
27 | static inline int m920x_read(struct usb_device *udev, u8 request, u16 value, | 29 | static inline int m920x_read(struct usb_device *udev, u8 request, u16 value, |
@@ -477,7 +479,7 @@ static struct qt1010_config m920x_qt1010_config = { | |||
477 | /* Callbacks for DVB USB */ | 479 | /* Callbacks for DVB USB */ |
478 | static int m920x_mt352_frontend_attach(struct dvb_usb_adapter *adap) | 480 | static int m920x_mt352_frontend_attach(struct dvb_usb_adapter *adap) |
479 | { | 481 | { |
480 | deb("%s\n",__FUNCTION__); | 482 | deb("%s\n",__func__); |
481 | 483 | ||
482 | if ((adap->fe = dvb_attach(mt352_attach, | 484 | if ((adap->fe = dvb_attach(mt352_attach, |
483 | &m920x_mt352_config, | 485 | &m920x_mt352_config, |
@@ -489,7 +491,7 @@ static int m920x_mt352_frontend_attach(struct dvb_usb_adapter *adap) | |||
489 | 491 | ||
490 | static int m920x_tda10046_08_frontend_attach(struct dvb_usb_adapter *adap) | 492 | static int m920x_tda10046_08_frontend_attach(struct dvb_usb_adapter *adap) |
491 | { | 493 | { |
492 | deb("%s\n",__FUNCTION__); | 494 | deb("%s\n",__func__); |
493 | 495 | ||
494 | if ((adap->fe = dvb_attach(tda10046_attach, | 496 | if ((adap->fe = dvb_attach(tda10046_attach, |
495 | &m920x_tda10046_08_config, | 497 | &m920x_tda10046_08_config, |
@@ -501,7 +503,7 @@ static int m920x_tda10046_08_frontend_attach(struct dvb_usb_adapter *adap) | |||
501 | 503 | ||
502 | static int m920x_tda10046_0b_frontend_attach(struct dvb_usb_adapter *adap) | 504 | static int m920x_tda10046_0b_frontend_attach(struct dvb_usb_adapter *adap) |
503 | { | 505 | { |
504 | deb("%s\n",__FUNCTION__); | 506 | deb("%s\n",__func__); |
505 | 507 | ||
506 | if ((adap->fe = dvb_attach(tda10046_attach, | 508 | if ((adap->fe = dvb_attach(tda10046_attach, |
507 | &m920x_tda10046_0b_config, | 509 | &m920x_tda10046_0b_config, |
@@ -513,7 +515,7 @@ static int m920x_tda10046_0b_frontend_attach(struct dvb_usb_adapter *adap) | |||
513 | 515 | ||
514 | static int m920x_qt1010_tuner_attach(struct dvb_usb_adapter *adap) | 516 | static int m920x_qt1010_tuner_attach(struct dvb_usb_adapter *adap) |
515 | { | 517 | { |
516 | deb("%s\n",__FUNCTION__); | 518 | deb("%s\n",__func__); |
517 | 519 | ||
518 | if (dvb_attach(qt1010_attach, adap->fe, &adap->dev->i2c_adap, &m920x_qt1010_config) == NULL) | 520 | if (dvb_attach(qt1010_attach, adap->fe, &adap->dev->i2c_adap, &m920x_qt1010_config) == NULL) |
519 | return -ENODEV; | 521 | return -ENODEV; |
@@ -523,7 +525,7 @@ static int m920x_qt1010_tuner_attach(struct dvb_usb_adapter *adap) | |||
523 | 525 | ||
524 | static int m920x_tda8275_60_tuner_attach(struct dvb_usb_adapter *adap) | 526 | static int m920x_tda8275_60_tuner_attach(struct dvb_usb_adapter *adap) |
525 | { | 527 | { |
526 | deb("%s\n",__FUNCTION__); | 528 | deb("%s\n",__func__); |
527 | 529 | ||
528 | if (dvb_attach(tda827x_attach, adap->fe, 0x60, &adap->dev->i2c_adap, NULL) == NULL) | 530 | if (dvb_attach(tda827x_attach, adap->fe, 0x60, &adap->dev->i2c_adap, NULL) == NULL) |
529 | return -ENODEV; | 531 | return -ENODEV; |
@@ -533,7 +535,7 @@ static int m920x_tda8275_60_tuner_attach(struct dvb_usb_adapter *adap) | |||
533 | 535 | ||
534 | static int m920x_tda8275_61_tuner_attach(struct dvb_usb_adapter *adap) | 536 | static int m920x_tda8275_61_tuner_attach(struct dvb_usb_adapter *adap) |
535 | { | 537 | { |
536 | deb("%s\n",__FUNCTION__); | 538 | deb("%s\n",__func__); |
537 | 539 | ||
538 | if (dvb_attach(tda827x_attach, adap->fe, 0x61, &adap->dev->i2c_adap, NULL) == NULL) | 540 | if (dvb_attach(tda827x_attach, adap->fe, 0x61, &adap->dev->i2c_adap, NULL) == NULL) |
539 | return -ENODEV; | 541 | return -ENODEV; |
@@ -618,27 +620,31 @@ static int m920x_probe(struct usb_interface *intf, | |||
618 | * multi-tuner device | 620 | * multi-tuner device |
619 | */ | 621 | */ |
620 | 622 | ||
621 | if ((ret = dvb_usb_device_init(intf, &megasky_properties, | 623 | ret = dvb_usb_device_init(intf, &megasky_properties, |
622 | THIS_MODULE, &d)) == 0) { | 624 | THIS_MODULE, &d, adapter_nr); |
625 | if (ret == 0) { | ||
623 | rc_init_seq = megasky_rc_init; | 626 | rc_init_seq = megasky_rc_init; |
624 | goto found; | 627 | goto found; |
625 | } | 628 | } |
626 | 629 | ||
627 | if ((ret = dvb_usb_device_init(intf, &digivox_mini_ii_properties, | 630 | ret = dvb_usb_device_init(intf, &digivox_mini_ii_properties, |
628 | THIS_MODULE, &d)) == 0) { | 631 | THIS_MODULE, &d, adapter_nr); |
632 | if (ret == 0) { | ||
629 | /* No remote control, so no rc_init_seq */ | 633 | /* No remote control, so no rc_init_seq */ |
630 | goto found; | 634 | goto found; |
631 | } | 635 | } |
632 | 636 | ||
633 | /* This configures both tuners on the TV Walker Twin */ | 637 | /* This configures both tuners on the TV Walker Twin */ |
634 | if ((ret = dvb_usb_device_init(intf, &tvwalkertwin_properties, | 638 | ret = dvb_usb_device_init(intf, &tvwalkertwin_properties, |
635 | THIS_MODULE, &d)) == 0) { | 639 | THIS_MODULE, &d, adapter_nr); |
640 | if (ret == 0) { | ||
636 | rc_init_seq = tvwalkertwin_rc_init; | 641 | rc_init_seq = tvwalkertwin_rc_init; |
637 | goto found; | 642 | goto found; |
638 | } | 643 | } |
639 | 644 | ||
640 | if ((ret = dvb_usb_device_init(intf, &dposh_properties, | 645 | ret = dvb_usb_device_init(intf, &dposh_properties, |
641 | THIS_MODULE, &d)) == 0) { | 646 | THIS_MODULE, &d, adapter_nr); |
647 | if (ret == 0) { | ||
642 | /* Remote controller not supported yet. */ | 648 | /* Remote controller not supported yet. */ |
643 | goto found; | 649 | goto found; |
644 | } | 650 | } |
diff --git a/drivers/media/dvb/dvb-usb/nova-t-usb2.c b/drivers/media/dvb/dvb-usb/nova-t-usb2.c index badc468170ea..07fb843c7c2b 100644 --- a/drivers/media/dvb/dvb-usb/nova-t-usb2.c +++ b/drivers/media/dvb/dvb-usb/nova-t-usb2.c | |||
@@ -15,6 +15,8 @@ static int debug; | |||
15 | module_param(debug, int, 0644); | 15 | module_param(debug, int, 0644); |
16 | MODULE_PARM_DESC(debug, "set debugging level (1=rc,2=eeprom (|-able))." DVB_USB_DEBUG_STATUS); | 16 | MODULE_PARM_DESC(debug, "set debugging level (1=rc,2=eeprom (|-able))." DVB_USB_DEBUG_STATUS); |
17 | 17 | ||
18 | DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); | ||
19 | |||
18 | #define deb_rc(args...) dprintk(debug,0x01,args) | 20 | #define deb_rc(args...) dprintk(debug,0x01,args) |
19 | #define deb_ee(args...) dprintk(debug,0x02,args) | 21 | #define deb_ee(args...) dprintk(debug,0x02,args) |
20 | 22 | ||
@@ -142,7 +144,8 @@ static struct dvb_usb_device_properties nova_t_properties; | |||
142 | static int nova_t_probe(struct usb_interface *intf, | 144 | static int nova_t_probe(struct usb_interface *intf, |
143 | const struct usb_device_id *id) | 145 | const struct usb_device_id *id) |
144 | { | 146 | { |
145 | return dvb_usb_device_init(intf,&nova_t_properties,THIS_MODULE,NULL); | 147 | return dvb_usb_device_init(intf, &nova_t_properties, |
148 | THIS_MODULE, NULL, adapter_nr); | ||
146 | } | 149 | } |
147 | 150 | ||
148 | /* do not change the order of the ID table */ | 151 | /* do not change the order of the ID table */ |
diff --git a/drivers/media/dvb/dvb-usb/opera1.c b/drivers/media/dvb/dvb-usb/opera1.c index 302cc67407c3..7e32d11f32b0 100644 --- a/drivers/media/dvb/dvb-usb/opera1.c +++ b/drivers/media/dvb/dvb-usb/opera1.c | |||
@@ -46,6 +46,9 @@ MODULE_PARM_DESC(debug, | |||
46 | "set debugging level (1=info,xfer=2,pll=4,ts=8,err=16,rc=32,fw=64 (or-able))." | 46 | "set debugging level (1=info,xfer=2,pll=4,ts=8,err=16,rc=32,fw=64 (or-able))." |
47 | DVB_USB_DEBUG_STATUS); | 47 | DVB_USB_DEBUG_STATUS); |
48 | 48 | ||
49 | DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); | ||
50 | |||
51 | |||
49 | static int opera1_xilinx_rw(struct usb_device *dev, u8 request, u16 value, | 52 | static int opera1_xilinx_rw(struct usb_device *dev, u8 request, u16 value, |
50 | u8 * data, u16 len, int flags) | 53 | u8 * data, u16 len, int flags) |
51 | { | 54 | { |
@@ -243,7 +246,7 @@ static struct stv0299_config opera1_stv0299_config = { | |||
243 | .mclk = 88000000UL, | 246 | .mclk = 88000000UL, |
244 | .invert = 1, | 247 | .invert = 1, |
245 | .skip_reinit = 0, | 248 | .skip_reinit = 0, |
246 | .lock_output = STV0229_LOCKOUTPUT_0, | 249 | .lock_output = STV0299_LOCKOUTPUT_0, |
247 | .volt13_op0_op1 = STV0299_VOLT13_OP0, | 250 | .volt13_op0_op1 = STV0299_VOLT13_OP0, |
248 | .inittab = opera1_inittab, | 251 | .inittab = opera1_inittab, |
249 | .set_symbol_rate = opera1_stv0299_set_symbol_rate, | 252 | .set_symbol_rate = opera1_stv0299_set_symbol_rate, |
@@ -548,7 +551,8 @@ static int opera1_probe(struct usb_interface *intf, | |||
548 | return -EINVAL; | 551 | return -EINVAL; |
549 | } | 552 | } |
550 | 553 | ||
551 | if (dvb_usb_device_init(intf, &opera1_properties, THIS_MODULE, NULL) != 0) | 554 | if (0 != dvb_usb_device_init(intf, &opera1_properties, |
555 | THIS_MODULE, NULL, adapter_nr)) | ||
552 | return -EINVAL; | 556 | return -EINVAL; |
553 | return 0; | 557 | return 0; |
554 | } | 558 | } |
diff --git a/drivers/media/dvb/dvb-usb/ttusb2.c b/drivers/media/dvb/dvb-usb/ttusb2.c index 3b9da9c25c6e..20ca9d9ee99b 100644 --- a/drivers/media/dvb/dvb-usb/ttusb2.c +++ b/drivers/media/dvb/dvb-usb/ttusb2.c | |||
@@ -37,6 +37,8 @@ static int dvb_usb_ttusb2_debug; | |||
37 | module_param_named(debug,dvb_usb_ttusb2_debug, int, 0644); | 37 | module_param_named(debug,dvb_usb_ttusb2_debug, int, 0644); |
38 | MODULE_PARM_DESC(debug, "set debugging level (1=info (or-able))." DVB_USB_DEBUG_STATUS); | 38 | MODULE_PARM_DESC(debug, "set debugging level (1=info (or-able))." DVB_USB_DEBUG_STATUS); |
39 | 39 | ||
40 | DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); | ||
41 | |||
40 | struct ttusb2_state { | 42 | struct ttusb2_state { |
41 | u8 id; | 43 | u8 id; |
42 | }; | 44 | }; |
@@ -145,6 +147,7 @@ static struct tda10086_config tda10086_config = { | |||
145 | .demod_address = 0x0e, | 147 | .demod_address = 0x0e, |
146 | .invert = 0, | 148 | .invert = 0, |
147 | .diseqc_tone = 1, | 149 | .diseqc_tone = 1, |
150 | .xtal_freq = TDA10086_XTAL_16M, | ||
148 | }; | 151 | }; |
149 | 152 | ||
150 | static int ttusb2_frontend_attach(struct dvb_usb_adapter *adap) | 153 | static int ttusb2_frontend_attach(struct dvb_usb_adapter *adap) |
@@ -176,17 +179,25 @@ static int ttusb2_tuner_attach(struct dvb_usb_adapter *adap) | |||
176 | 179 | ||
177 | /* DVB USB Driver stuff */ | 180 | /* DVB USB Driver stuff */ |
178 | static struct dvb_usb_device_properties ttusb2_properties; | 181 | static struct dvb_usb_device_properties ttusb2_properties; |
182 | static struct dvb_usb_device_properties ttusb2_properties_s2400; | ||
179 | 183 | ||
180 | static int ttusb2_probe(struct usb_interface *intf, | 184 | static int ttusb2_probe(struct usb_interface *intf, |
181 | const struct usb_device_id *id) | 185 | const struct usb_device_id *id) |
182 | { | 186 | { |
183 | return dvb_usb_device_init(intf,&ttusb2_properties,THIS_MODULE,NULL); | 187 | if (0 == dvb_usb_device_init(intf, &ttusb2_properties, |
188 | THIS_MODULE, NULL, adapter_nr) || | ||
189 | 0 == dvb_usb_device_init(intf, &ttusb2_properties_s2400, | ||
190 | THIS_MODULE, NULL, adapter_nr)) | ||
191 | return 0; | ||
192 | return -ENODEV; | ||
184 | } | 193 | } |
185 | 194 | ||
186 | static struct usb_device_id ttusb2_table [] = { | 195 | static struct usb_device_id ttusb2_table [] = { |
187 | { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PCTV_400E) }, | 196 | { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PCTV_400E) }, |
188 | { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PCTV_450E) }, | 197 | { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PCTV_450E) }, |
189 | {} /* Terminating entry */ | 198 | { USB_DEVICE(USB_VID_TECHNOTREND, |
199 | USB_PID_TECHNOTREND_CONNECT_S2400) }, | ||
200 | {} /* Terminating entry */ | ||
190 | }; | 201 | }; |
191 | MODULE_DEVICE_TABLE (usb, ttusb2_table); | 202 | MODULE_DEVICE_TABLE (usb, ttusb2_table); |
192 | 203 | ||
@@ -242,6 +253,54 @@ static struct dvb_usb_device_properties ttusb2_properties = { | |||
242 | } | 253 | } |
243 | }; | 254 | }; |
244 | 255 | ||
256 | static struct dvb_usb_device_properties ttusb2_properties_s2400 = { | ||
257 | .caps = DVB_USB_IS_AN_I2C_ADAPTER, | ||
258 | |||
259 | .usb_ctrl = CYPRESS_FX2, | ||
260 | .firmware = "dvb-usb-tt-s2400-01.fw", | ||
261 | |||
262 | .size_of_priv = sizeof(struct ttusb2_state), | ||
263 | |||
264 | .num_adapters = 1, | ||
265 | .adapter = { | ||
266 | { | ||
267 | .streaming_ctrl = NULL, | ||
268 | |||
269 | .frontend_attach = ttusb2_frontend_attach, | ||
270 | .tuner_attach = ttusb2_tuner_attach, | ||
271 | |||
272 | /* parameter for the MPEG2-data transfer */ | ||
273 | .stream = { | ||
274 | .type = USB_ISOC, | ||
275 | .count = 5, | ||
276 | .endpoint = 0x02, | ||
277 | .u = { | ||
278 | .isoc = { | ||
279 | .framesperurb = 4, | ||
280 | .framesize = 940, | ||
281 | .interval = 1, | ||
282 | } | ||
283 | } | ||
284 | } | ||
285 | } | ||
286 | }, | ||
287 | |||
288 | .power_ctrl = ttusb2_power_ctrl, | ||
289 | .identify_state = ttusb2_identify_state, | ||
290 | |||
291 | .i2c_algo = &ttusb2_i2c_algo, | ||
292 | |||
293 | .generic_bulk_ctrl_endpoint = 0x01, | ||
294 | |||
295 | .num_device_descs = 1, | ||
296 | .devices = { | ||
297 | { "Technotrend TT-connect S-2400", | ||
298 | { &ttusb2_table[2], NULL }, | ||
299 | { NULL }, | ||
300 | }, | ||
301 | } | ||
302 | }; | ||
303 | |||
245 | static struct usb_driver ttusb2_driver = { | 304 | static struct usb_driver ttusb2_driver = { |
246 | .name = "dvb_usb_ttusb2", | 305 | .name = "dvb_usb_ttusb2", |
247 | .probe = ttusb2_probe, | 306 | .probe = ttusb2_probe, |
diff --git a/drivers/media/dvb/dvb-usb/umt-010.c b/drivers/media/dvb/dvb-usb/umt-010.c index 0dcab3d4e236..9e7653bb3b66 100644 --- a/drivers/media/dvb/dvb-usb/umt-010.c +++ b/drivers/media/dvb/dvb-usb/umt-010.c | |||
@@ -13,6 +13,8 @@ | |||
13 | 13 | ||
14 | #include "mt352.h" | 14 | #include "mt352.h" |
15 | 15 | ||
16 | DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); | ||
17 | |||
16 | static int umt_mt352_demod_init(struct dvb_frontend *fe) | 18 | static int umt_mt352_demod_init(struct dvb_frontend *fe) |
17 | { | 19 | { |
18 | static u8 mt352_clock_config[] = { 0x89, 0xb8, 0x2d }; | 20 | static u8 mt352_clock_config[] = { 0x89, 0xb8, 0x2d }; |
@@ -75,7 +77,8 @@ static struct dvb_usb_device_properties umt_properties; | |||
75 | static int umt_probe(struct usb_interface *intf, | 77 | static int umt_probe(struct usb_interface *intf, |
76 | const struct usb_device_id *id) | 78 | const struct usb_device_id *id) |
77 | { | 79 | { |
78 | if (dvb_usb_device_init(intf,&umt_properties,THIS_MODULE,NULL) == 0) | 80 | if (0 == dvb_usb_device_init(intf, &umt_properties, |
81 | THIS_MODULE, NULL, adapter_nr)) | ||
79 | return 0; | 82 | return 0; |
80 | return -EINVAL; | 83 | return -EINVAL; |
81 | } | 84 | } |
diff --git a/drivers/media/dvb/dvb-usb/vp702x-fe.c b/drivers/media/dvb/dvb-usb/vp702x-fe.c index c3fdc7cd094e..ccc7e4452664 100644 --- a/drivers/media/dvb/dvb-usb/vp702x-fe.c +++ b/drivers/media/dvb/dvb-usb/vp702x-fe.c | |||
@@ -67,7 +67,7 @@ static int vp702x_fe_read_status(struct dvb_frontend* fe, fe_status_t *status) | |||
67 | { | 67 | { |
68 | struct vp702x_fe_state *st = fe->demodulator_priv; | 68 | struct vp702x_fe_state *st = fe->demodulator_priv; |
69 | vp702x_fe_refresh_state(st); | 69 | vp702x_fe_refresh_state(st); |
70 | deb_fe("%s\n",__FUNCTION__); | 70 | deb_fe("%s\n",__func__); |
71 | 71 | ||
72 | if (st->lock == 0) | 72 | if (st->lock == 0) |
73 | *status = FE_HAS_LOCK | FE_HAS_SYNC | FE_HAS_VITERBI | FE_HAS_SIGNAL | FE_HAS_CARRIER; | 73 | *status = FE_HAS_LOCK | FE_HAS_SYNC | FE_HAS_VITERBI | FE_HAS_SIGNAL | FE_HAS_CARRIER; |
@@ -121,7 +121,7 @@ static int vp702x_fe_read_snr(struct dvb_frontend* fe, u16 *snr) | |||
121 | 121 | ||
122 | static int vp702x_fe_get_tune_settings(struct dvb_frontend* fe, struct dvb_frontend_tune_settings *tune) | 122 | static int vp702x_fe_get_tune_settings(struct dvb_frontend* fe, struct dvb_frontend_tune_settings *tune) |
123 | { | 123 | { |
124 | deb_fe("%s\n",__FUNCTION__); | 124 | deb_fe("%s\n",__func__); |
125 | tune->min_delay_ms = 2000; | 125 | tune->min_delay_ms = 2000; |
126 | return 0; | 126 | return 0; |
127 | } | 127 | } |
@@ -183,21 +183,21 @@ static int vp702x_fe_set_frontend(struct dvb_frontend* fe, | |||
183 | static int vp702x_fe_init(struct dvb_frontend *fe) | 183 | static int vp702x_fe_init(struct dvb_frontend *fe) |
184 | { | 184 | { |
185 | struct vp702x_fe_state *st = fe->demodulator_priv; | 185 | struct vp702x_fe_state *st = fe->demodulator_priv; |
186 | deb_fe("%s\n",__FUNCTION__); | 186 | deb_fe("%s\n",__func__); |
187 | vp702x_usb_in_op(st->d, RESET_TUNER, 0, 0, NULL, 0); | 187 | vp702x_usb_in_op(st->d, RESET_TUNER, 0, 0, NULL, 0); |
188 | return 0; | 188 | return 0; |
189 | } | 189 | } |
190 | 190 | ||
191 | static int vp702x_fe_sleep(struct dvb_frontend *fe) | 191 | static int vp702x_fe_sleep(struct dvb_frontend *fe) |
192 | { | 192 | { |
193 | deb_fe("%s\n",__FUNCTION__); | 193 | deb_fe("%s\n",__func__); |
194 | return 0; | 194 | return 0; |
195 | } | 195 | } |
196 | 196 | ||
197 | static int vp702x_fe_get_frontend(struct dvb_frontend* fe, | 197 | static int vp702x_fe_get_frontend(struct dvb_frontend* fe, |
198 | struct dvb_frontend_parameters *fep) | 198 | struct dvb_frontend_parameters *fep) |
199 | { | 199 | { |
200 | deb_fe("%s\n",__FUNCTION__); | 200 | deb_fe("%s\n",__func__); |
201 | return 0; | 201 | return 0; |
202 | } | 202 | } |
203 | 203 | ||
@@ -208,7 +208,7 @@ static int vp702x_fe_send_diseqc_msg (struct dvb_frontend* fe, | |||
208 | u8 cmd[8],ibuf[10]; | 208 | u8 cmd[8],ibuf[10]; |
209 | memset(cmd,0,8); | 209 | memset(cmd,0,8); |
210 | 210 | ||
211 | deb_fe("%s\n",__FUNCTION__); | 211 | deb_fe("%s\n",__func__); |
212 | 212 | ||
213 | if (m->msg_len > 4) | 213 | if (m->msg_len > 4) |
214 | return -EINVAL; | 214 | return -EINVAL; |
@@ -230,7 +230,7 @@ static int vp702x_fe_send_diseqc_msg (struct dvb_frontend* fe, | |||
230 | 230 | ||
231 | static int vp702x_fe_send_diseqc_burst (struct dvb_frontend* fe, fe_sec_mini_cmd_t burst) | 231 | static int vp702x_fe_send_diseqc_burst (struct dvb_frontend* fe, fe_sec_mini_cmd_t burst) |
232 | { | 232 | { |
233 | deb_fe("%s\n",__FUNCTION__); | 233 | deb_fe("%s\n",__func__); |
234 | return 0; | 234 | return 0; |
235 | } | 235 | } |
236 | 236 | ||
@@ -238,7 +238,7 @@ static int vp702x_fe_set_tone(struct dvb_frontend* fe, fe_sec_tone_mode_t tone) | |||
238 | { | 238 | { |
239 | struct vp702x_fe_state *st = fe->demodulator_priv; | 239 | struct vp702x_fe_state *st = fe->demodulator_priv; |
240 | u8 ibuf[10]; | 240 | u8 ibuf[10]; |
241 | deb_fe("%s\n",__FUNCTION__); | 241 | deb_fe("%s\n",__func__); |
242 | 242 | ||
243 | st->tone_mode = tone; | 243 | st->tone_mode = tone; |
244 | 244 | ||
@@ -263,7 +263,7 @@ static int vp702x_fe_set_voltage (struct dvb_frontend* fe, fe_sec_voltage_t | |||
263 | { | 263 | { |
264 | struct vp702x_fe_state *st = fe->demodulator_priv; | 264 | struct vp702x_fe_state *st = fe->demodulator_priv; |
265 | u8 ibuf[10]; | 265 | u8 ibuf[10]; |
266 | deb_fe("%s\n",__FUNCTION__); | 266 | deb_fe("%s\n",__func__); |
267 | 267 | ||
268 | st->voltage = voltage; | 268 | st->voltage = voltage; |
269 | 269 | ||
diff --git a/drivers/media/dvb/dvb-usb/vp702x.c b/drivers/media/dvb/dvb-usb/vp702x.c index e553c139ac44..986fff9a5ba8 100644 --- a/drivers/media/dvb/dvb-usb/vp702x.c +++ b/drivers/media/dvb/dvb-usb/vp702x.c | |||
@@ -21,6 +21,8 @@ int dvb_usb_vp702x_debug; | |||
21 | module_param_named(debug,dvb_usb_vp702x_debug, int, 0644); | 21 | module_param_named(debug,dvb_usb_vp702x_debug, int, 0644); |
22 | MODULE_PARM_DESC(debug, "set debugging level (1=info,xfer=2,rc=4 (or-able))." DVB_USB_DEBUG_STATUS); | 22 | MODULE_PARM_DESC(debug, "set debugging level (1=info,xfer=2,rc=4 (or-able))." DVB_USB_DEBUG_STATUS); |
23 | 23 | ||
24 | DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); | ||
25 | |||
24 | struct vp702x_state { | 26 | struct vp702x_state { |
25 | int pid_filter_count; | 27 | int pid_filter_count; |
26 | int pid_filter_can_bypass; | 28 | int pid_filter_can_bypass; |
@@ -238,7 +240,8 @@ static struct dvb_usb_device_properties vp702x_properties; | |||
238 | static int vp702x_usb_probe(struct usb_interface *intf, | 240 | static int vp702x_usb_probe(struct usb_interface *intf, |
239 | const struct usb_device_id *id) | 241 | const struct usb_device_id *id) |
240 | { | 242 | { |
241 | return dvb_usb_device_init(intf,&vp702x_properties,THIS_MODULE,NULL); | 243 | return dvb_usb_device_init(intf, &vp702x_properties, |
244 | THIS_MODULE, NULL, adapter_nr); | ||
242 | } | 245 | } |
243 | 246 | ||
244 | static struct usb_device_id vp702x_usb_table [] = { | 247 | static struct usb_device_id vp702x_usb_table [] = { |
diff --git a/drivers/media/dvb/dvb-usb/vp7045.c b/drivers/media/dvb/dvb-usb/vp7045.c index c172babf59bb..acb345504e0d 100644 --- a/drivers/media/dvb/dvb-usb/vp7045.c +++ b/drivers/media/dvb/dvb-usb/vp7045.c | |||
@@ -18,6 +18,9 @@ | |||
18 | static int dvb_usb_vp7045_debug; | 18 | static int dvb_usb_vp7045_debug; |
19 | module_param_named(debug,dvb_usb_vp7045_debug, int, 0644); | 19 | module_param_named(debug,dvb_usb_vp7045_debug, int, 0644); |
20 | MODULE_PARM_DESC(debug, "set debugging level (1=info,xfer=2,rc=4 (or-able))." DVB_USB_DEBUG_STATUS); | 20 | MODULE_PARM_DESC(debug, "set debugging level (1=info,xfer=2,rc=4 (or-able))." DVB_USB_DEBUG_STATUS); |
21 | |||
22 | DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); | ||
23 | |||
21 | #define deb_info(args...) dprintk(dvb_usb_vp7045_debug,0x01,args) | 24 | #define deb_info(args...) dprintk(dvb_usb_vp7045_debug,0x01,args) |
22 | #define deb_xfer(args...) dprintk(dvb_usb_vp7045_debug,0x02,args) | 25 | #define deb_xfer(args...) dprintk(dvb_usb_vp7045_debug,0x02,args) |
23 | #define deb_rc(args...) dprintk(dvb_usb_vp7045_debug,0x04,args) | 26 | #define deb_rc(args...) dprintk(dvb_usb_vp7045_debug,0x04,args) |
@@ -219,7 +222,8 @@ static struct dvb_usb_device_properties vp7045_properties; | |||
219 | static int vp7045_usb_probe(struct usb_interface *intf, | 222 | static int vp7045_usb_probe(struct usb_interface *intf, |
220 | const struct usb_device_id *id) | 223 | const struct usb_device_id *id) |
221 | { | 224 | { |
222 | return dvb_usb_device_init(intf,&vp7045_properties,THIS_MODULE,NULL); | 225 | return dvb_usb_device_init(intf, &vp7045_properties, |
226 | THIS_MODULE, NULL, adapter_nr); | ||
223 | } | 227 | } |
224 | 228 | ||
225 | static struct usb_device_id vp7045_usb_table [] = { | 229 | static struct usb_device_id vp7045_usb_table [] = { |
diff --git a/drivers/media/dvb/frontends/Kconfig b/drivers/media/dvb/frontends/Kconfig index 9ad86ce4a4e5..68fab616f55d 100644 --- a/drivers/media/dvb/frontends/Kconfig +++ b/drivers/media/dvb/frontends/Kconfig | |||
@@ -188,6 +188,14 @@ config DVB_DIB7000P | |||
188 | A DVB-T tuner module. Designed for mobile usage. Say Y when you want | 188 | A DVB-T tuner module. Designed for mobile usage. Say Y when you want |
189 | to support this frontend. | 189 | to support this frontend. |
190 | 190 | ||
191 | config DVB_TDA10048 | ||
192 | tristate "Philips TDA10048HN based" | ||
193 | depends on DVB_CORE && I2C | ||
194 | default m if DVB_FE_CUSTOMISE | ||
195 | select FW_LOADER | ||
196 | help | ||
197 | A DVB-T tuner module. Say Y when you want to support this frontend. | ||
198 | |||
191 | comment "DVB-C (cable) frontends" | 199 | comment "DVB-C (cable) frontends" |
192 | depends on DVB_CORE | 200 | depends on DVB_CORE |
193 | 201 | ||
@@ -291,6 +299,14 @@ config DVB_S5H1409 | |||
291 | An ATSC 8VSB and QAM64/256 tuner module. Say Y when you want | 299 | An ATSC 8VSB and QAM64/256 tuner module. Say Y when you want |
292 | to support this frontend. | 300 | to support this frontend. |
293 | 301 | ||
302 | config DVB_AU8522 | ||
303 | tristate "Auvitek AU8522 based" | ||
304 | depends on DVB_CORE && I2C | ||
305 | default m if DVB_FE_CUSTOMISE | ||
306 | help | ||
307 | An ATSC 8VSB and QAM64/256 tuner module. Say Y when you want | ||
308 | to support this frontend. | ||
309 | |||
294 | comment "Tuners/PLL support" | 310 | comment "Tuners/PLL support" |
295 | depends on DVB_CORE | 311 | depends on DVB_CORE |
296 | 312 | ||
@@ -369,6 +385,11 @@ config DVB_TUNER_XC5000 | |||
369 | This device is only used inside a SiP called togther with a | 385 | This device is only used inside a SiP called togther with a |
370 | demodulator for now. | 386 | demodulator for now. |
371 | 387 | ||
388 | config DVB_TUNER_ITD1000 | ||
389 | tristate "Integrant ITD1000 Zero IF tuner for DVB-S/DSS" | ||
390 | depends on DVB_CORE && I2C | ||
391 | default m if DVB_FE_CUSTOMISE | ||
392 | |||
372 | comment "Miscellaneous devices" | 393 | comment "Miscellaneous devices" |
373 | depends on DVB_CORE | 394 | depends on DVB_CORE |
374 | 395 | ||
@@ -379,6 +400,13 @@ config DVB_LNBP21 | |||
379 | help | 400 | help |
380 | An SEC control chip. | 401 | An SEC control chip. |
381 | 402 | ||
403 | config DVB_ISL6405 | ||
404 | tristate "ISL6405 SEC controller" | ||
405 | depends on DVB_CORE && I2C | ||
406 | default m if DVB_FE_CUSTOMISE | ||
407 | help | ||
408 | An SEC control chip. | ||
409 | |||
382 | config DVB_ISL6421 | 410 | config DVB_ISL6421 |
383 | tristate "ISL6421 SEC controller" | 411 | tristate "ISL6421 SEC controller" |
384 | depends on DVB_CORE && I2C | 412 | depends on DVB_CORE && I2C |
diff --git a/drivers/media/dvb/frontends/Makefile b/drivers/media/dvb/frontends/Makefile index 16bd107ebd32..2f873fc0f649 100644 --- a/drivers/media/dvb/frontends/Makefile +++ b/drivers/media/dvb/frontends/Makefile | |||
@@ -38,6 +38,7 @@ obj-$(CONFIG_DVB_S5H1420) += s5h1420.o | |||
38 | obj-$(CONFIG_DVB_LGDT330X) += lgdt330x.o | 38 | obj-$(CONFIG_DVB_LGDT330X) += lgdt330x.o |
39 | obj-$(CONFIG_DVB_CX24123) += cx24123.o | 39 | obj-$(CONFIG_DVB_CX24123) += cx24123.o |
40 | obj-$(CONFIG_DVB_LNBP21) += lnbp21.o | 40 | obj-$(CONFIG_DVB_LNBP21) += lnbp21.o |
41 | obj-$(CONFIG_DVB_ISL6405) += isl6405.o | ||
41 | obj-$(CONFIG_DVB_ISL6421) += isl6421.o | 42 | obj-$(CONFIG_DVB_ISL6421) += isl6421.o |
42 | obj-$(CONFIG_DVB_TDA10086) += tda10086.o | 43 | obj-$(CONFIG_DVB_TDA10086) += tda10086.o |
43 | obj-$(CONFIG_DVB_TDA826X) += tda826x.o | 44 | obj-$(CONFIG_DVB_TDA826X) += tda826x.o |
@@ -51,3 +52,6 @@ obj-$(CONFIG_DVB_TUA6100) += tua6100.o | |||
51 | obj-$(CONFIG_DVB_TUNER_MT2131) += mt2131.o | 52 | obj-$(CONFIG_DVB_TUNER_MT2131) += mt2131.o |
52 | obj-$(CONFIG_DVB_S5H1409) += s5h1409.o | 53 | obj-$(CONFIG_DVB_S5H1409) += s5h1409.o |
53 | obj-$(CONFIG_DVB_TUNER_XC5000) += xc5000.o | 54 | obj-$(CONFIG_DVB_TUNER_XC5000) += xc5000.o |
55 | obj-$(CONFIG_DVB_TUNER_ITD1000) += itd1000.o | ||
56 | obj-$(CONFIG_DVB_AU8522) += au8522.o | ||
57 | obj-$(CONFIG_DVB_TDA10048) += tda10048.o | ||
diff --git a/drivers/media/dvb/frontends/au8522.c b/drivers/media/dvb/frontends/au8522.c new file mode 100644 index 000000000000..084a280c2d7f --- /dev/null +++ b/drivers/media/dvb/frontends/au8522.c | |||
@@ -0,0 +1,692 @@ | |||
1 | /* | ||
2 | Auvitek AU8522 QAM/8VSB demodulator driver | ||
3 | |||
4 | Copyright (C) 2008 Steven Toth <stoth@hauppauge.com> | ||
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 | GNU General Public License for more details. | ||
15 | |||
16 | You should have received a copy of the GNU General Public License | ||
17 | along with this program; if not, write to the Free Software | ||
18 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
19 | |||
20 | */ | ||
21 | |||
22 | #include <linux/kernel.h> | ||
23 | #include <linux/init.h> | ||
24 | #include <linux/module.h> | ||
25 | #include <linux/string.h> | ||
26 | #include <linux/slab.h> | ||
27 | #include <linux/delay.h> | ||
28 | #include "dvb_frontend.h" | ||
29 | #include "dvb-pll.h" | ||
30 | #include "au8522.h" | ||
31 | |||
32 | struct au8522_state { | ||
33 | |||
34 | struct i2c_adapter *i2c; | ||
35 | |||
36 | /* configuration settings */ | ||
37 | const struct au8522_config *config; | ||
38 | |||
39 | struct dvb_frontend frontend; | ||
40 | |||
41 | u32 current_frequency; | ||
42 | fe_modulation_t current_modulation; | ||
43 | |||
44 | }; | ||
45 | |||
46 | static int debug; | ||
47 | |||
48 | #define dprintk(arg...) do { \ | ||
49 | if (debug) \ | ||
50 | printk(arg); \ | ||
51 | } while (0) | ||
52 | |||
53 | /* 16 bit registers, 8 bit values */ | ||
54 | static int au8522_writereg(struct au8522_state *state, u16 reg, u8 data) | ||
55 | { | ||
56 | int ret; | ||
57 | u8 buf [] = { reg >> 8, reg & 0xff, data }; | ||
58 | |||
59 | struct i2c_msg msg = { .addr = state->config->demod_address, | ||
60 | .flags = 0, .buf = buf, .len = 3 }; | ||
61 | |||
62 | ret = i2c_transfer(state->i2c, &msg, 1); | ||
63 | |||
64 | if (ret != 1) | ||
65 | printk("%s: writereg error (reg == 0x%02x, val == 0x%04x, " | ||
66 | "ret == %i)\n", __func__, reg, data, ret); | ||
67 | |||
68 | return (ret != 1) ? -1 : 0; | ||
69 | } | ||
70 | |||
71 | static u8 au8522_readreg(struct au8522_state *state, u16 reg) | ||
72 | { | ||
73 | int ret; | ||
74 | u8 b0 [] = { reg >> 8, reg & 0xff }; | ||
75 | u8 b1 [] = { 0 }; | ||
76 | |||
77 | struct i2c_msg msg [] = { | ||
78 | { .addr = state->config->demod_address, .flags = 0, | ||
79 | .buf = b0, .len = 2 }, | ||
80 | { .addr = state->config->demod_address, .flags = I2C_M_RD, | ||
81 | .buf = b1, .len = 1 } }; | ||
82 | |||
83 | ret = i2c_transfer(state->i2c, msg, 2); | ||
84 | |||
85 | if (ret != 2) | ||
86 | printk(KERN_ERR "%s: readreg error (ret == %i)\n", | ||
87 | __func__, ret); | ||
88 | return b1[0]; | ||
89 | } | ||
90 | |||
91 | static int au8522_i2c_gate_ctrl(struct dvb_frontend *fe, int enable) | ||
92 | { | ||
93 | struct au8522_state *state = fe->demodulator_priv; | ||
94 | |||
95 | dprintk("%s(%d)\n", __func__, enable); | ||
96 | |||
97 | if (enable) | ||
98 | return au8522_writereg(state, 0x106, 1); | ||
99 | else | ||
100 | return au8522_writereg(state, 0x106, 0); | ||
101 | } | ||
102 | |||
103 | struct mse2snr_tab { | ||
104 | u16 val; | ||
105 | u16 data; | ||
106 | }; | ||
107 | |||
108 | /* VSB SNR lookup table */ | ||
109 | static struct mse2snr_tab vsb_mse2snr_tab[] = { | ||
110 | { 0, 270 }, | ||
111 | { 2, 250 }, | ||
112 | { 3, 240 }, | ||
113 | { 5, 230 }, | ||
114 | { 7, 220 }, | ||
115 | { 9, 210 }, | ||
116 | { 12, 200 }, | ||
117 | { 13, 195 }, | ||
118 | { 15, 190 }, | ||
119 | { 17, 185 }, | ||
120 | { 19, 180 }, | ||
121 | { 21, 175 }, | ||
122 | { 24, 170 }, | ||
123 | { 27, 165 }, | ||
124 | { 31, 160 }, | ||
125 | { 32, 158 }, | ||
126 | { 33, 156 }, | ||
127 | { 36, 152 }, | ||
128 | { 37, 150 }, | ||
129 | { 39, 148 }, | ||
130 | { 40, 146 }, | ||
131 | { 41, 144 }, | ||
132 | { 43, 142 }, | ||
133 | { 44, 140 }, | ||
134 | { 48, 135 }, | ||
135 | { 50, 130 }, | ||
136 | { 43, 142 }, | ||
137 | { 53, 125 }, | ||
138 | { 56, 120 }, | ||
139 | { 256, 115 }, | ||
140 | }; | ||
141 | |||
142 | /* QAM64 SNR lookup table */ | ||
143 | static struct mse2snr_tab qam64_mse2snr_tab[] = { | ||
144 | { 15, 0 }, | ||
145 | { 16, 290 }, | ||
146 | { 17, 288 }, | ||
147 | { 18, 286 }, | ||
148 | { 19, 284 }, | ||
149 | { 20, 282 }, | ||
150 | { 21, 281 }, | ||
151 | { 22, 279 }, | ||
152 | { 23, 277 }, | ||
153 | { 24, 275 }, | ||
154 | { 25, 273 }, | ||
155 | { 26, 271 }, | ||
156 | { 27, 269 }, | ||
157 | { 28, 268 }, | ||
158 | { 29, 266 }, | ||
159 | { 30, 264 }, | ||
160 | { 31, 262 }, | ||
161 | { 32, 260 }, | ||
162 | { 33, 259 }, | ||
163 | { 34, 258 }, | ||
164 | { 35, 256 }, | ||
165 | { 36, 255 }, | ||
166 | { 37, 254 }, | ||
167 | { 38, 252 }, | ||
168 | { 39, 251 }, | ||
169 | { 40, 250 }, | ||
170 | { 41, 249 }, | ||
171 | { 42, 248 }, | ||
172 | { 43, 246 }, | ||
173 | { 44, 245 }, | ||
174 | { 45, 244 }, | ||
175 | { 46, 242 }, | ||
176 | { 47, 241 }, | ||
177 | { 48, 240 }, | ||
178 | { 50, 239 }, | ||
179 | { 51, 238 }, | ||
180 | { 53, 237 }, | ||
181 | { 54, 236 }, | ||
182 | { 56, 235 }, | ||
183 | { 57, 234 }, | ||
184 | { 59, 233 }, | ||
185 | { 60, 232 }, | ||
186 | { 62, 231 }, | ||
187 | { 63, 230 }, | ||
188 | { 65, 229 }, | ||
189 | { 67, 228 }, | ||
190 | { 68, 227 }, | ||
191 | { 70, 226 }, | ||
192 | { 71, 225 }, | ||
193 | { 73, 224 }, | ||
194 | { 74, 223 }, | ||
195 | { 76, 222 }, | ||
196 | { 78, 221 }, | ||
197 | { 80, 220 }, | ||
198 | { 82, 219 }, | ||
199 | { 85, 218 }, | ||
200 | { 88, 217 }, | ||
201 | { 90, 216 }, | ||
202 | { 92, 215 }, | ||
203 | { 93, 214 }, | ||
204 | { 94, 212 }, | ||
205 | { 95, 211 }, | ||
206 | { 97, 210 }, | ||
207 | { 99, 209 }, | ||
208 | { 101, 208 }, | ||
209 | { 102, 207 }, | ||
210 | { 104, 206 }, | ||
211 | { 107, 205 }, | ||
212 | { 111, 204 }, | ||
213 | { 114, 203 }, | ||
214 | { 118, 202 }, | ||
215 | { 122, 201 }, | ||
216 | { 125, 200 }, | ||
217 | { 128, 199 }, | ||
218 | { 130, 198 }, | ||
219 | { 132, 197 }, | ||
220 | { 256, 190 }, | ||
221 | }; | ||
222 | |||
223 | /* QAM256 SNR lookup table */ | ||
224 | static struct mse2snr_tab qam256_mse2snr_tab[] = { | ||
225 | { 16, 0 }, | ||
226 | { 17, 400 }, | ||
227 | { 18, 398 }, | ||
228 | { 19, 396 }, | ||
229 | { 20, 394 }, | ||
230 | { 21, 392 }, | ||
231 | { 22, 390 }, | ||
232 | { 23, 388 }, | ||
233 | { 24, 386 }, | ||
234 | { 25, 384 }, | ||
235 | { 26, 382 }, | ||
236 | { 27, 380 }, | ||
237 | { 28, 379 }, | ||
238 | { 29, 378 }, | ||
239 | { 30, 377 }, | ||
240 | { 31, 376 }, | ||
241 | { 32, 375 }, | ||
242 | { 33, 374 }, | ||
243 | { 34, 373 }, | ||
244 | { 35, 372 }, | ||
245 | { 36, 371 }, | ||
246 | { 37, 370 }, | ||
247 | { 38, 362 }, | ||
248 | { 39, 354 }, | ||
249 | { 40, 346 }, | ||
250 | { 41, 338 }, | ||
251 | { 42, 330 }, | ||
252 | { 43, 328 }, | ||
253 | { 44, 326 }, | ||
254 | { 45, 324 }, | ||
255 | { 46, 322 }, | ||
256 | { 47, 320 }, | ||
257 | { 48, 319 }, | ||
258 | { 49, 318 }, | ||
259 | { 50, 317 }, | ||
260 | { 51, 316 }, | ||
261 | { 52, 315 }, | ||
262 | { 53, 314 }, | ||
263 | { 54, 313 }, | ||
264 | { 55, 312 }, | ||
265 | { 56, 311 }, | ||
266 | { 57, 310 }, | ||
267 | { 58, 308 }, | ||
268 | { 59, 306 }, | ||
269 | { 60, 304 }, | ||
270 | { 61, 302 }, | ||
271 | { 62, 300 }, | ||
272 | { 63, 298 }, | ||
273 | { 65, 295 }, | ||
274 | { 68, 294 }, | ||
275 | { 70, 293 }, | ||
276 | { 73, 292 }, | ||
277 | { 76, 291 }, | ||
278 | { 78, 290 }, | ||
279 | { 79, 289 }, | ||
280 | { 81, 288 }, | ||
281 | { 82, 287 }, | ||
282 | { 83, 286 }, | ||
283 | { 84, 285 }, | ||
284 | { 85, 284 }, | ||
285 | { 86, 283 }, | ||
286 | { 88, 282 }, | ||
287 | { 89, 281 }, | ||
288 | { 256, 280 }, | ||
289 | }; | ||
290 | |||
291 | static int au8522_mse2snr_lookup(struct mse2snr_tab *tab, int sz, int mse, | ||
292 | u16 *snr) | ||
293 | { | ||
294 | int i, ret = -EINVAL; | ||
295 | dprintk("%s()\n", __func__); | ||
296 | |||
297 | for (i = 0; i < sz; i++) { | ||
298 | if (mse < tab[i].val) { | ||
299 | *snr = tab[i].data; | ||
300 | ret = 0; | ||
301 | break; | ||
302 | } | ||
303 | } | ||
304 | dprintk("%s() snr=%d\n", __func__, *snr); | ||
305 | return ret; | ||
306 | } | ||
307 | |||
308 | /* VSB Modulation table */ | ||
309 | static struct { | ||
310 | u16 reg; | ||
311 | u16 data; | ||
312 | } VSB_mod_tab[] = { | ||
313 | { 0x8090, 0x84 }, | ||
314 | { 0x4092, 0x11 }, | ||
315 | { 0x2005, 0x00 }, | ||
316 | { 0x8091, 0x80 }, | ||
317 | { 0x80a3, 0x0c }, | ||
318 | { 0x80a4, 0xe8 }, | ||
319 | { 0x8081, 0xc4 }, | ||
320 | { 0x80a5, 0x40 }, | ||
321 | { 0x80a7, 0x40 }, | ||
322 | { 0x80a6, 0x67 }, | ||
323 | { 0x8262, 0x20 }, | ||
324 | { 0x821c, 0x30 }, | ||
325 | { 0x80d8, 0x1a }, | ||
326 | { 0x8227, 0xa0 }, | ||
327 | { 0x8121, 0xff }, | ||
328 | { 0x80a8, 0xf0 }, | ||
329 | { 0x80a9, 0x05 }, | ||
330 | { 0x80aa, 0x77 }, | ||
331 | { 0x80ab, 0xf0 }, | ||
332 | { 0x80ac, 0x05 }, | ||
333 | { 0x80ad, 0x77 }, | ||
334 | { 0x80ae, 0x41 }, | ||
335 | { 0x80af, 0x66 }, | ||
336 | { 0x821b, 0xcc }, | ||
337 | { 0x821d, 0x80 }, | ||
338 | { 0x80b5, 0xfb }, | ||
339 | { 0x80b6, 0x8e }, | ||
340 | { 0x80b7, 0x39 }, | ||
341 | { 0x80a4, 0xe8 }, | ||
342 | { 0x8231, 0x13 }, | ||
343 | }; | ||
344 | |||
345 | /* QAM Modulation table */ | ||
346 | static struct { | ||
347 | u16 reg; | ||
348 | u16 data; | ||
349 | } QAM_mod_tab[] = { | ||
350 | { 0x80a3, 0x09 }, | ||
351 | { 0x80a4, 0x00 }, | ||
352 | { 0x8081, 0xc4 }, | ||
353 | { 0x80a5, 0x40 }, | ||
354 | { 0x80b5, 0xfb }, | ||
355 | { 0x80b6, 0x8e }, | ||
356 | { 0x80b7, 0x39 }, | ||
357 | { 0x80aa, 0x77 }, | ||
358 | { 0x80ad, 0x77 }, | ||
359 | { 0x80a6, 0x67 }, | ||
360 | { 0x8262, 0x20 }, | ||
361 | { 0x821c, 0x30 }, | ||
362 | { 0x80b8, 0x3e }, | ||
363 | { 0x80b9, 0xf0 }, | ||
364 | { 0x80ba, 0x01 }, | ||
365 | { 0x80bb, 0x18 }, | ||
366 | { 0x80bc, 0x50 }, | ||
367 | { 0x80bd, 0x00 }, | ||
368 | { 0x80be, 0xea }, | ||
369 | { 0x80bf, 0xef }, | ||
370 | { 0x80c0, 0xfc }, | ||
371 | { 0x80c1, 0xbd }, | ||
372 | { 0x80c2, 0x1f }, | ||
373 | { 0x80c3, 0xfc }, | ||
374 | { 0x80c4, 0xdd }, | ||
375 | { 0x80c5, 0xaf }, | ||
376 | { 0x80c6, 0x00 }, | ||
377 | { 0x80c7, 0x38 }, | ||
378 | { 0x80c8, 0x30 }, | ||
379 | { 0x80c9, 0x05 }, | ||
380 | { 0x80ca, 0x4a }, | ||
381 | { 0x80cb, 0xd0 }, | ||
382 | { 0x80cc, 0x01 }, | ||
383 | { 0x80cd, 0xd9 }, | ||
384 | { 0x80ce, 0x6f }, | ||
385 | { 0x80cf, 0xf9 }, | ||
386 | { 0x80d0, 0x70 }, | ||
387 | { 0x80d1, 0xdf }, | ||
388 | { 0x80d2, 0xf7 }, | ||
389 | { 0x80d3, 0xc2 }, | ||
390 | { 0x80d4, 0xdf }, | ||
391 | { 0x80d5, 0x02 }, | ||
392 | { 0x80d6, 0x9a }, | ||
393 | { 0x80d7, 0xd0 }, | ||
394 | { 0x8250, 0x0d }, | ||
395 | { 0x8251, 0xcd }, | ||
396 | { 0x8252, 0xe0 }, | ||
397 | { 0x8253, 0x05 }, | ||
398 | { 0x8254, 0xa7 }, | ||
399 | { 0x8255, 0xff }, | ||
400 | { 0x8256, 0xed }, | ||
401 | { 0x8257, 0x5b }, | ||
402 | { 0x8258, 0xae }, | ||
403 | { 0x8259, 0xe6 }, | ||
404 | { 0x825a, 0x3d }, | ||
405 | { 0x825b, 0x0f }, | ||
406 | { 0x825c, 0x0d }, | ||
407 | { 0x825d, 0xea }, | ||
408 | { 0x825e, 0xf2 }, | ||
409 | { 0x825f, 0x51 }, | ||
410 | { 0x8260, 0xf5 }, | ||
411 | { 0x8261, 0x06 }, | ||
412 | { 0x821a, 0x00 }, | ||
413 | { 0x8546, 0x40 }, | ||
414 | { 0x8210, 0x26 }, | ||
415 | { 0x8211, 0xf6 }, | ||
416 | { 0x8212, 0x84 }, | ||
417 | { 0x8213, 0x02 }, | ||
418 | { 0x8502, 0x01 }, | ||
419 | { 0x8121, 0x04 }, | ||
420 | { 0x8122, 0x04 }, | ||
421 | { 0x852e, 0x10 }, | ||
422 | { 0x80a4, 0xca }, | ||
423 | { 0x80a7, 0x40 }, | ||
424 | { 0x8526, 0x01 }, | ||
425 | }; | ||
426 | |||
427 | static int au8522_enable_modulation(struct dvb_frontend *fe, | ||
428 | fe_modulation_t m) | ||
429 | { | ||
430 | struct au8522_state *state = fe->demodulator_priv; | ||
431 | int i; | ||
432 | |||
433 | dprintk("%s(0x%08x)\n", __func__, m); | ||
434 | |||
435 | switch (m) { | ||
436 | case VSB_8: | ||
437 | dprintk("%s() VSB_8\n", __func__); | ||
438 | for (i = 0; i < ARRAY_SIZE(VSB_mod_tab); i++) | ||
439 | au8522_writereg(state, | ||
440 | VSB_mod_tab[i].reg, | ||
441 | VSB_mod_tab[i].data); | ||
442 | break; | ||
443 | case QAM_64: | ||
444 | case QAM_256: | ||
445 | dprintk("%s() QAM 64/256\n", __func__); | ||
446 | for (i = 0; i < ARRAY_SIZE(QAM_mod_tab); i++) | ||
447 | au8522_writereg(state, | ||
448 | QAM_mod_tab[i].reg, | ||
449 | QAM_mod_tab[i].data); | ||
450 | break; | ||
451 | default: | ||
452 | dprintk("%s() Invalid modulation\n", __func__); | ||
453 | return -EINVAL; | ||
454 | } | ||
455 | |||
456 | state->current_modulation = m; | ||
457 | |||
458 | return 0; | ||
459 | } | ||
460 | |||
461 | /* Talk to the demod, set the FEC, GUARD, QAM settings etc */ | ||
462 | static int au8522_set_frontend(struct dvb_frontend *fe, | ||
463 | struct dvb_frontend_parameters *p) | ||
464 | { | ||
465 | struct au8522_state *state = fe->demodulator_priv; | ||
466 | |||
467 | dprintk("%s(frequency=%d)\n", __func__, p->frequency); | ||
468 | |||
469 | state->current_frequency = p->frequency; | ||
470 | |||
471 | au8522_enable_modulation(fe, p->u.vsb.modulation); | ||
472 | |||
473 | /* Allow the demod to settle */ | ||
474 | msleep(100); | ||
475 | |||
476 | if (fe->ops.tuner_ops.set_params) { | ||
477 | if (fe->ops.i2c_gate_ctrl) | ||
478 | fe->ops.i2c_gate_ctrl(fe, 1); | ||
479 | fe->ops.tuner_ops.set_params(fe, p); | ||
480 | if (fe->ops.i2c_gate_ctrl) | ||
481 | fe->ops.i2c_gate_ctrl(fe, 0); | ||
482 | } | ||
483 | |||
484 | return 0; | ||
485 | } | ||
486 | |||
487 | /* Reset the demod hardware and reset all of the configuration registers | ||
488 | to a default state. */ | ||
489 | static int au8522_init(struct dvb_frontend *fe) | ||
490 | { | ||
491 | struct au8522_state *state = fe->demodulator_priv; | ||
492 | dprintk("%s()\n", __func__); | ||
493 | |||
494 | au8522_writereg(state, 0xa4, 1 << 5); | ||
495 | |||
496 | au8522_i2c_gate_ctrl(fe, 1); | ||
497 | |||
498 | return 0; | ||
499 | } | ||
500 | |||
501 | static int au8522_read_status(struct dvb_frontend *fe, fe_status_t *status) | ||
502 | { | ||
503 | struct au8522_state *state = fe->demodulator_priv; | ||
504 | u8 reg; | ||
505 | u32 tuner_status = 0; | ||
506 | |||
507 | *status = 0; | ||
508 | |||
509 | if (state->current_modulation == VSB_8) { | ||
510 | dprintk("%s() Checking VSB_8\n", __func__); | ||
511 | reg = au8522_readreg(state, 0x4088); | ||
512 | if (reg & 0x01) | ||
513 | *status |= FE_HAS_VITERBI; | ||
514 | if (reg & 0x02) | ||
515 | *status |= FE_HAS_LOCK | FE_HAS_SYNC; | ||
516 | } else { | ||
517 | dprintk("%s() Checking QAM\n", __func__); | ||
518 | reg = au8522_readreg(state, 0x4541); | ||
519 | if (reg & 0x80) | ||
520 | *status |= FE_HAS_VITERBI; | ||
521 | if (reg & 0x20) | ||
522 | *status |= FE_HAS_LOCK | FE_HAS_SYNC; | ||
523 | } | ||
524 | |||
525 | switch (state->config->status_mode) { | ||
526 | case AU8522_DEMODLOCKING: | ||
527 | dprintk("%s() DEMODLOCKING\n", __func__); | ||
528 | if (*status & FE_HAS_VITERBI) | ||
529 | *status |= FE_HAS_CARRIER | FE_HAS_SIGNAL; | ||
530 | break; | ||
531 | case AU8522_TUNERLOCKING: | ||
532 | /* Get the tuner status */ | ||
533 | dprintk("%s() TUNERLOCKING\n", __func__); | ||
534 | if (fe->ops.tuner_ops.get_status) { | ||
535 | if (fe->ops.i2c_gate_ctrl) | ||
536 | fe->ops.i2c_gate_ctrl(fe, 1); | ||
537 | |||
538 | fe->ops.tuner_ops.get_status(fe, &tuner_status); | ||
539 | |||
540 | if (fe->ops.i2c_gate_ctrl) | ||
541 | fe->ops.i2c_gate_ctrl(fe, 0); | ||
542 | } | ||
543 | if (tuner_status) | ||
544 | *status |= FE_HAS_CARRIER | FE_HAS_SIGNAL; | ||
545 | break; | ||
546 | } | ||
547 | |||
548 | dprintk("%s() status 0x%08x\n", __func__, *status); | ||
549 | |||
550 | return 0; | ||
551 | } | ||
552 | |||
553 | static int au8522_read_snr(struct dvb_frontend *fe, u16 *snr) | ||
554 | { | ||
555 | struct au8522_state *state = fe->demodulator_priv; | ||
556 | int ret = -EINVAL; | ||
557 | |||
558 | dprintk("%s()\n", __func__); | ||
559 | |||
560 | if (state->current_modulation == QAM_256) | ||
561 | ret = au8522_mse2snr_lookup(qam256_mse2snr_tab, | ||
562 | ARRAY_SIZE(qam256_mse2snr_tab), | ||
563 | au8522_readreg(state, 0x4522), | ||
564 | snr); | ||
565 | else if (state->current_modulation == QAM_64) | ||
566 | ret = au8522_mse2snr_lookup(qam64_mse2snr_tab, | ||
567 | ARRAY_SIZE(qam64_mse2snr_tab), | ||
568 | au8522_readreg(state, 0x4522), | ||
569 | snr); | ||
570 | else /* VSB_8 */ | ||
571 | ret = au8522_mse2snr_lookup(vsb_mse2snr_tab, | ||
572 | ARRAY_SIZE(vsb_mse2snr_tab), | ||
573 | au8522_readreg(state, 0x4311), | ||
574 | snr); | ||
575 | |||
576 | return ret; | ||
577 | } | ||
578 | |||
579 | static int au8522_read_signal_strength(struct dvb_frontend *fe, | ||
580 | u16 *signal_strength) | ||
581 | { | ||
582 | return au8522_read_snr(fe, signal_strength); | ||
583 | } | ||
584 | |||
585 | static int au8522_read_ucblocks(struct dvb_frontend *fe, u32 *ucblocks) | ||
586 | { | ||
587 | struct au8522_state *state = fe->demodulator_priv; | ||
588 | |||
589 | if (state->current_modulation == VSB_8) | ||
590 | *ucblocks = au8522_readreg(state, 0x4087); | ||
591 | else | ||
592 | *ucblocks = au8522_readreg(state, 0x4543); | ||
593 | |||
594 | return 0; | ||
595 | } | ||
596 | |||
597 | static int au8522_read_ber(struct dvb_frontend *fe, u32 *ber) | ||
598 | { | ||
599 | return au8522_read_ucblocks(fe, ber); | ||
600 | } | ||
601 | |||
602 | static int au8522_get_frontend(struct dvb_frontend *fe, | ||
603 | struct dvb_frontend_parameters *p) | ||
604 | { | ||
605 | struct au8522_state *state = fe->demodulator_priv; | ||
606 | |||
607 | p->frequency = state->current_frequency; | ||
608 | p->u.vsb.modulation = state->current_modulation; | ||
609 | |||
610 | return 0; | ||
611 | } | ||
612 | |||
613 | static int au8522_get_tune_settings(struct dvb_frontend *fe, | ||
614 | struct dvb_frontend_tune_settings *tune) | ||
615 | { | ||
616 | tune->min_delay_ms = 1000; | ||
617 | return 0; | ||
618 | } | ||
619 | |||
620 | static void au8522_release(struct dvb_frontend *fe) | ||
621 | { | ||
622 | struct au8522_state *state = fe->demodulator_priv; | ||
623 | kfree(state); | ||
624 | } | ||
625 | |||
626 | static struct dvb_frontend_ops au8522_ops; | ||
627 | |||
628 | struct dvb_frontend *au8522_attach(const struct au8522_config *config, | ||
629 | struct i2c_adapter *i2c) | ||
630 | { | ||
631 | struct au8522_state *state = NULL; | ||
632 | |||
633 | /* allocate memory for the internal state */ | ||
634 | state = kmalloc(sizeof(struct au8522_state), GFP_KERNEL); | ||
635 | if (state == NULL) | ||
636 | goto error; | ||
637 | |||
638 | /* setup the state */ | ||
639 | state->config = config; | ||
640 | state->i2c = i2c; | ||
641 | /* create dvb_frontend */ | ||
642 | memcpy(&state->frontend.ops, &au8522_ops, | ||
643 | sizeof(struct dvb_frontend_ops)); | ||
644 | state->frontend.demodulator_priv = state; | ||
645 | |||
646 | if (au8522_init(&state->frontend) != 0) { | ||
647 | printk(KERN_ERR "%s: Failed to initialize correctly\n", | ||
648 | __func__); | ||
649 | goto error; | ||
650 | } | ||
651 | |||
652 | /* Note: Leaving the I2C gate open here. */ | ||
653 | au8522_i2c_gate_ctrl(&state->frontend, 1); | ||
654 | |||
655 | return &state->frontend; | ||
656 | |||
657 | error: | ||
658 | kfree(state); | ||
659 | return NULL; | ||
660 | } | ||
661 | EXPORT_SYMBOL(au8522_attach); | ||
662 | |||
663 | static struct dvb_frontend_ops au8522_ops = { | ||
664 | |||
665 | .info = { | ||
666 | .name = "Auvitek AU8522 QAM/8VSB Frontend", | ||
667 | .type = FE_ATSC, | ||
668 | .frequency_min = 54000000, | ||
669 | .frequency_max = 858000000, | ||
670 | .frequency_stepsize = 62500, | ||
671 | .caps = FE_CAN_QAM_64 | FE_CAN_QAM_256 | FE_CAN_8VSB | ||
672 | }, | ||
673 | |||
674 | .init = au8522_init, | ||
675 | .i2c_gate_ctrl = au8522_i2c_gate_ctrl, | ||
676 | .set_frontend = au8522_set_frontend, | ||
677 | .get_frontend = au8522_get_frontend, | ||
678 | .get_tune_settings = au8522_get_tune_settings, | ||
679 | .read_status = au8522_read_status, | ||
680 | .read_ber = au8522_read_ber, | ||
681 | .read_signal_strength = au8522_read_signal_strength, | ||
682 | .read_snr = au8522_read_snr, | ||
683 | .read_ucblocks = au8522_read_ucblocks, | ||
684 | .release = au8522_release, | ||
685 | }; | ||
686 | |||
687 | module_param(debug, int, 0644); | ||
688 | MODULE_PARM_DESC(debug, "Enable verbose debug messages"); | ||
689 | |||
690 | MODULE_DESCRIPTION("Auvitek AU8522 QAM-B/ATSC Demodulator driver"); | ||
691 | MODULE_AUTHOR("Steven Toth"); | ||
692 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/media/dvb/frontends/au8522.h b/drivers/media/dvb/frontends/au8522.h new file mode 100644 index 000000000000..d7affa3cdb27 --- /dev/null +++ b/drivers/media/dvb/frontends/au8522.h | |||
@@ -0,0 +1,56 @@ | |||
1 | /* | ||
2 | Auvitek AU8522 QAM/8VSB demodulator driver | ||
3 | |||
4 | Copyright (C) 2008 Steven Toth <stoth@hauppauge.com> | ||
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 | GNU General Public License for more details. | ||
15 | |||
16 | You should have received a copy of the GNU General Public License | ||
17 | along with this program; if not, write to the Free Software | ||
18 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
19 | |||
20 | */ | ||
21 | |||
22 | #ifndef __AU8522_H__ | ||
23 | #define __AU8522_H__ | ||
24 | |||
25 | #include <linux/dvb/frontend.h> | ||
26 | |||
27 | struct au8522_config { | ||
28 | /* the demodulator's i2c address */ | ||
29 | u8 demod_address; | ||
30 | |||
31 | /* Return lock status based on tuner lock, or demod lock */ | ||
32 | #define AU8522_TUNERLOCKING 0 | ||
33 | #define AU8522_DEMODLOCKING 1 | ||
34 | u8 status_mode; | ||
35 | }; | ||
36 | |||
37 | #if defined(CONFIG_DVB_AU8522) || \ | ||
38 | (defined(CONFIG_DVB_AU8522_MODULE) && defined(MODULE)) | ||
39 | extern struct dvb_frontend *au8522_attach(const struct au8522_config *config, | ||
40 | struct i2c_adapter *i2c); | ||
41 | #else | ||
42 | static inline | ||
43 | struct dvb_frontend *au8522_attach(const struct au8522_config *config, | ||
44 | struct i2c_adapter *i2c) | ||
45 | { | ||
46 | printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__); | ||
47 | return NULL; | ||
48 | } | ||
49 | #endif /* CONFIG_DVB_AU8522 */ | ||
50 | |||
51 | #endif /* __AU8522_H__ */ | ||
52 | |||
53 | /* | ||
54 | * Local variables: | ||
55 | * c-basic-offset: 8 | ||
56 | */ | ||
diff --git a/drivers/media/dvb/frontends/bcm3510.c b/drivers/media/dvb/frontends/bcm3510.c index a913f49c062b..d268e65e777d 100644 --- a/drivers/media/dvb/frontends/bcm3510.c +++ b/drivers/media/dvb/frontends/bcm3510.c | |||
@@ -91,7 +91,7 @@ static int bcm3510_writebytes (struct bcm3510_state *state, u8 reg, u8 *buf, u8 | |||
91 | if ((err = i2c_transfer (state->i2c, &msg, 1)) != 1) { | 91 | if ((err = i2c_transfer (state->i2c, &msg, 1)) != 1) { |
92 | 92 | ||
93 | deb_info("%s: i2c write error (addr %02x, reg %02x, err == %i)\n", | 93 | deb_info("%s: i2c write error (addr %02x, reg %02x, err == %i)\n", |
94 | __FUNCTION__, state->config->demod_address, reg, err); | 94 | __func__, state->config->demod_address, reg, err); |
95 | return -EREMOTEIO; | 95 | return -EREMOTEIO; |
96 | } | 96 | } |
97 | 97 | ||
@@ -110,7 +110,7 @@ static int bcm3510_readbytes (struct bcm3510_state *state, u8 reg, u8 *buf, u8 l | |||
110 | 110 | ||
111 | if ((err = i2c_transfer (state->i2c, msg, 2)) != 2) { | 111 | if ((err = i2c_transfer (state->i2c, msg, 2)) != 2) { |
112 | deb_info("%s: i2c read error (addr %02x, reg %02x, err == %i)\n", | 112 | deb_info("%s: i2c read error (addr %02x, reg %02x, err == %i)\n", |
113 | __FUNCTION__, state->config->demod_address, reg, err); | 113 | __func__, state->config->demod_address, reg, err); |
114 | return -EREMOTEIO; | 114 | return -EREMOTEIO; |
115 | } | 115 | } |
116 | deb_i2c("i2c rd %02x: ",reg); | 116 | deb_i2c("i2c rd %02x: ",reg); |
diff --git a/drivers/media/dvb/frontends/bcm3510.h b/drivers/media/dvb/frontends/bcm3510.h index 7e4f95e1734b..f4575c0cc446 100644 --- a/drivers/media/dvb/frontends/bcm3510.h +++ b/drivers/media/dvb/frontends/bcm3510.h | |||
@@ -41,7 +41,7 @@ extern struct dvb_frontend* bcm3510_attach(const struct bcm3510_config* config, | |||
41 | static inline struct dvb_frontend* bcm3510_attach(const struct bcm3510_config* config, | 41 | static inline struct dvb_frontend* bcm3510_attach(const struct bcm3510_config* config, |
42 | struct i2c_adapter* i2c) | 42 | struct i2c_adapter* i2c) |
43 | { | 43 | { |
44 | printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __FUNCTION__); | 44 | printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__); |
45 | return NULL; | 45 | return NULL; |
46 | } | 46 | } |
47 | #endif // CONFIG_DVB_BCM3510 | 47 | #endif // CONFIG_DVB_BCM3510 |
diff --git a/drivers/media/dvb/frontends/bsbe1.h b/drivers/media/dvb/frontends/bsbe1.h index d8f65738e5d2..5e431ebd089b 100644 --- a/drivers/media/dvb/frontends/bsbe1.h +++ b/drivers/media/dvb/frontends/bsbe1.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * bsbe1.h - ALPS BSBE1 tuner support (moved from av7110.c) | 2 | * bsbe1.h - ALPS BSBE1 tuner support |
3 | * | 3 | * |
4 | * This program is free software; you can redistribute it and/or | 4 | * This program is free software; you can redistribute it and/or |
5 | * modify it under the terms of the GNU General Public License | 5 | * modify it under the terms of the GNU General Public License |
@@ -26,44 +26,24 @@ | |||
26 | #define BSBE1_H | 26 | #define BSBE1_H |
27 | 27 | ||
28 | static u8 alps_bsbe1_inittab[] = { | 28 | static u8 alps_bsbe1_inittab[] = { |
29 | 0x01, 0x15, | 29 | 0x01, 0x15, /* XTAL = 4MHz, VCO = 352 MHz */ |
30 | 0x02, 0x30, | 30 | 0x02, 0x30, /* MCLK = 88 MHz */ |
31 | 0x03, 0x00, | 31 | 0x03, 0x00, /* ACR output 0 */ |
32 | 0x04, 0x7d, /* F22FR = 0x7d, F22 = f_VCO / 128 / 0x7d = 22 kHz */ | 32 | 0x04, 0x7d, /* F22FR = 0x7d, F22 = f_VCO / 128 / 0x7d = 22 kHz */ |
33 | 0x05, 0x35, /* I2CT = 0, SCLT = 1, SDAT = 1 */ | 33 | 0x05, 0x05, /* I2CT = 0, SCLT = 1, SDAT = 1 */ |
34 | 0x06, 0x40, /* DAC not used, set to high impendance mode */ | 34 | 0x06, 0x00, /* DAC output 0 */ |
35 | 0x07, 0x00, /* DAC LSB */ | ||
36 | 0x08, 0x40, /* DiSEqC off, LNB power on OP2/LOCK pin on */ | 35 | 0x08, 0x40, /* DiSEqC off, LNB power on OP2/LOCK pin on */ |
37 | 0x09, 0x00, /* FIFO */ | 36 | 0x09, 0x00, /* FIFO */ |
38 | 0x0c, 0x51, /* OP1 ctl = Normal, OP1 val = 1 (LNB Power ON) */ | 37 | 0x0c, 0x51, /* OP1/OP0 normal, val = 1 (LNB power on) */ |
39 | 0x0d, 0x82, /* DC offset compensation = ON, beta_agc1 = 2 */ | 38 | 0x0d, 0x82, /* DC offset compensation = on, beta_agc1 = 2 */ |
40 | 0x0e, 0x23, /* alpha_tmg = 2, beta_tmg = 3 */ | 39 | 0x0f, 0x92, /* AGC1R */ |
41 | 0x10, 0x3f, // AGC2 0x3d | 40 | 0x10, 0x34, /* AGC2O */ |
42 | 0x11, 0x84, | 41 | 0x11, 0x84, /* TLSR */ |
43 | 0x12, 0xb9, | 42 | 0x12, 0xb9, /* CFD */ |
44 | 0x15, 0xc9, // lock detector threshold | 43 | 0x15, 0xc9, /* lock detector threshold */ |
45 | 0x16, 0x00, | 44 | 0x28, 0x00, /* out imp: normal, type: parallel, FEC mode: QPSK */ |
46 | 0x17, 0x00, | 45 | 0x33, 0xfc, /* RS control */ |
47 | 0x18, 0x00, | 46 | 0x34, 0x93, /* count viterbi bit errors per 2E18 bytes */ |
48 | 0x19, 0x00, | ||
49 | 0x1a, 0x00, | ||
50 | 0x1f, 0x50, | ||
51 | 0x20, 0x00, | ||
52 | 0x21, 0x00, | ||
53 | 0x22, 0x00, | ||
54 | 0x23, 0x00, | ||
55 | 0x28, 0x00, // out imp: normal out type: parallel FEC mode:0 | ||
56 | 0x29, 0x1e, // 1/2 threshold | ||
57 | 0x2a, 0x14, // 2/3 threshold | ||
58 | 0x2b, 0x0f, // 3/4 threshold | ||
59 | 0x2c, 0x09, // 5/6 threshold | ||
60 | 0x2d, 0x05, // 7/8 threshold | ||
61 | 0x2e, 0x01, | ||
62 | 0x31, 0x1f, // test all FECs | ||
63 | 0x32, 0x19, // viterbi and synchro search | ||
64 | 0x33, 0xfc, // rs control | ||
65 | 0x34, 0x93, // error control | ||
66 | 0x0f, 0x92, | ||
67 | 0xff, 0xff | 47 | 0xff, 0xff |
68 | }; | 48 | }; |
69 | 49 | ||
@@ -100,11 +80,11 @@ static int alps_bsbe1_tuner_set_params(struct dvb_frontend* fe, struct dvb_front | |||
100 | if ((params->frequency < 950000) || (params->frequency > 2150000)) | 80 | if ((params->frequency < 950000) || (params->frequency > 2150000)) |
101 | return -EINVAL; | 81 | return -EINVAL; |
102 | 82 | ||
103 | div = (params->frequency + (125 - 1)) / 125; // round correctly | 83 | div = params->frequency / 1000; |
104 | data[0] = (div >> 8) & 0x7f; | 84 | data[0] = (div >> 8) & 0x7f; |
105 | data[1] = div & 0xff; | 85 | data[1] = div & 0xff; |
106 | data[2] = 0x80 | ((div & 0x18000) >> 10) | 4; | 86 | data[2] = 0x80 | ((div & 0x18000) >> 10) | 0x1; |
107 | data[3] = (params->frequency > 1530000) ? 0xE0 : 0xE4; | 87 | data[3] = 0xe0; |
108 | 88 | ||
109 | if (fe->ops.i2c_gate_ctrl) | 89 | if (fe->ops.i2c_gate_ctrl) |
110 | fe->ops.i2c_gate_ctrl(fe, 1); | 90 | fe->ops.i2c_gate_ctrl(fe, 1); |
diff --git a/drivers/media/dvb/frontends/bsru6.h b/drivers/media/dvb/frontends/bsru6.h index e231cd84b3a1..45a6dfd8ebb5 100644 --- a/drivers/media/dvb/frontends/bsru6.h +++ b/drivers/media/dvb/frontends/bsru6.h | |||
@@ -133,7 +133,7 @@ static struct stv0299_config alps_bsru6_config = { | |||
133 | .mclk = 88000000UL, | 133 | .mclk = 88000000UL, |
134 | .invert = 1, | 134 | .invert = 1, |
135 | .skip_reinit = 0, | 135 | .skip_reinit = 0, |
136 | .lock_output = STV0229_LOCKOUTPUT_1, | 136 | .lock_output = STV0299_LOCKOUTPUT_1, |
137 | .volt13_op0_op1 = STV0299_VOLT13_OP1, | 137 | .volt13_op0_op1 = STV0299_VOLT13_OP1, |
138 | .min_delay_ms = 100, | 138 | .min_delay_ms = 100, |
139 | .set_symbol_rate = alps_bsru6_set_symbol_rate, | 139 | .set_symbol_rate = alps_bsru6_set_symbol_rate, |
diff --git a/drivers/media/dvb/frontends/cx22700.c b/drivers/media/dvb/frontends/cx22700.c index 11a4968f18cb..ace5cb17165d 100644 --- a/drivers/media/dvb/frontends/cx22700.c +++ b/drivers/media/dvb/frontends/cx22700.c | |||
@@ -73,13 +73,13 @@ static int cx22700_writereg (struct cx22700_state* state, u8 reg, u8 data) | |||
73 | u8 buf [] = { reg, data }; | 73 | u8 buf [] = { reg, data }; |
74 | struct i2c_msg msg = { .addr = state->config->demod_address, .flags = 0, .buf = buf, .len = 2 }; | 74 | struct i2c_msg msg = { .addr = state->config->demod_address, .flags = 0, .buf = buf, .len = 2 }; |
75 | 75 | ||
76 | dprintk ("%s\n", __FUNCTION__); | 76 | dprintk ("%s\n", __func__); |
77 | 77 | ||
78 | ret = i2c_transfer (state->i2c, &msg, 1); | 78 | ret = i2c_transfer (state->i2c, &msg, 1); |
79 | 79 | ||
80 | if (ret != 1) | 80 | if (ret != 1) |
81 | printk("%s: writereg error (reg == 0x%02x, val == 0x%02x, ret == %i)\n", | 81 | printk("%s: writereg error (reg == 0x%02x, val == 0x%02x, ret == %i)\n", |
82 | __FUNCTION__, reg, data, ret); | 82 | __func__, reg, data, ret); |
83 | 83 | ||
84 | return (ret != 1) ? -1 : 0; | 84 | return (ret != 1) ? -1 : 0; |
85 | } | 85 | } |
@@ -92,7 +92,7 @@ static int cx22700_readreg (struct cx22700_state* state, u8 reg) | |||
92 | struct i2c_msg msg [] = { { .addr = state->config->demod_address, .flags = 0, .buf = b0, .len = 1 }, | 92 | struct i2c_msg msg [] = { { .addr = state->config->demod_address, .flags = 0, .buf = b0, .len = 1 }, |
93 | { .addr = state->config->demod_address, .flags = I2C_M_RD, .buf = b1, .len = 1 } }; | 93 | { .addr = state->config->demod_address, .flags = I2C_M_RD, .buf = b1, .len = 1 } }; |
94 | 94 | ||
95 | dprintk ("%s\n", __FUNCTION__); | 95 | dprintk ("%s\n", __func__); |
96 | 96 | ||
97 | ret = i2c_transfer (state->i2c, msg, 2); | 97 | ret = i2c_transfer (state->i2c, msg, 2); |
98 | 98 | ||
@@ -105,7 +105,7 @@ static int cx22700_set_inversion (struct cx22700_state* state, int inversion) | |||
105 | { | 105 | { |
106 | u8 val; | 106 | u8 val; |
107 | 107 | ||
108 | dprintk ("%s\n", __FUNCTION__); | 108 | dprintk ("%s\n", __func__); |
109 | 109 | ||
110 | switch (inversion) { | 110 | switch (inversion) { |
111 | case INVERSION_AUTO: | 111 | case INVERSION_AUTO: |
@@ -127,7 +127,7 @@ static int cx22700_set_tps (struct cx22700_state *state, struct dvb_ofdm_paramet | |||
127 | static const u8 fec_tab [6] = { 0, 1, 2, 0, 3, 4 }; | 127 | static const u8 fec_tab [6] = { 0, 1, 2, 0, 3, 4 }; |
128 | u8 val; | 128 | u8 val; |
129 | 129 | ||
130 | dprintk ("%s\n", __FUNCTION__); | 130 | dprintk ("%s\n", __func__); |
131 | 131 | ||
132 | if (p->code_rate_HP < FEC_1_2 || p->code_rate_HP > FEC_7_8) | 132 | if (p->code_rate_HP < FEC_1_2 || p->code_rate_HP > FEC_7_8) |
133 | return -EINVAL; | 133 | return -EINVAL; |
@@ -191,7 +191,7 @@ static int cx22700_get_tps (struct cx22700_state* state, struct dvb_ofdm_paramet | |||
191 | FEC_5_6, FEC_7_8 }; | 191 | FEC_5_6, FEC_7_8 }; |
192 | u8 val; | 192 | u8 val; |
193 | 193 | ||
194 | dprintk ("%s\n", __FUNCTION__); | 194 | dprintk ("%s\n", __func__); |
195 | 195 | ||
196 | if (!(cx22700_readreg(state, 0x07) & 0x20)) /* tps valid? */ | 196 | if (!(cx22700_readreg(state, 0x07) & 0x20)) /* tps valid? */ |
197 | return -EAGAIN; | 197 | return -EAGAIN; |
diff --git a/drivers/media/dvb/frontends/cx22700.h b/drivers/media/dvb/frontends/cx22700.h index 7ac33690cdcc..4757a930ca05 100644 --- a/drivers/media/dvb/frontends/cx22700.h +++ b/drivers/media/dvb/frontends/cx22700.h | |||
@@ -38,7 +38,7 @@ extern struct dvb_frontend* cx22700_attach(const struct cx22700_config* config, | |||
38 | static inline struct dvb_frontend* cx22700_attach(const struct cx22700_config* config, | 38 | static inline struct dvb_frontend* cx22700_attach(const struct cx22700_config* config, |
39 | struct i2c_adapter* i2c) | 39 | struct i2c_adapter* i2c) |
40 | { | 40 | { |
41 | printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __FUNCTION__); | 41 | printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__); |
42 | return NULL; | 42 | return NULL; |
43 | } | 43 | } |
44 | #endif // CONFIG_DVB_CX22700 | 44 | #endif // CONFIG_DVB_CX22700 |
diff --git a/drivers/media/dvb/frontends/cx22702.c b/drivers/media/dvb/frontends/cx22702.c index 1dc164d5488c..cc1db4e371c3 100644 --- a/drivers/media/dvb/frontends/cx22702.c +++ b/drivers/media/dvb/frontends/cx22702.c | |||
@@ -48,7 +48,7 @@ struct cx22702_state { | |||
48 | u8 prevUCBlocks; | 48 | u8 prevUCBlocks; |
49 | }; | 49 | }; |
50 | 50 | ||
51 | static int debug = 0; | 51 | static int debug; |
52 | #define dprintk if (debug) printk | 52 | #define dprintk if (debug) printk |
53 | 53 | ||
54 | /* Register values to initialise the demod */ | 54 | /* Register values to initialise the demod */ |
@@ -90,7 +90,7 @@ static int cx22702_writereg (struct cx22702_state* state, u8 reg, u8 data) | |||
90 | 90 | ||
91 | if (ret != 1) | 91 | if (ret != 1) |
92 | printk("%s: writereg error (reg == 0x%02x, val == 0x%02x, ret == %i)\n", | 92 | printk("%s: writereg error (reg == 0x%02x, val == 0x%02x, ret == %i)\n", |
93 | __FUNCTION__, reg, data, ret); | 93 | __func__, reg, data, ret); |
94 | 94 | ||
95 | return (ret != 1) ? -1 : 0; | 95 | return (ret != 1) ? -1 : 0; |
96 | } | 96 | } |
@@ -108,7 +108,7 @@ static u8 cx22702_readreg (struct cx22702_state* state, u8 reg) | |||
108 | ret = i2c_transfer(state->i2c, msg, 2); | 108 | ret = i2c_transfer(state->i2c, msg, 2); |
109 | 109 | ||
110 | if (ret != 2) | 110 | if (ret != 2) |
111 | printk("%s: readreg error (ret == %i)\n", __FUNCTION__, ret); | 111 | printk("%s: readreg error (ret == %i)\n", __func__, ret); |
112 | 112 | ||
113 | return b1[0]; | 113 | return b1[0]; |
114 | } | 114 | } |
@@ -195,7 +195,7 @@ static int cx22702_get_tps (struct cx22702_state *state, struct dvb_ofdm_paramet | |||
195 | static int cx22702_i2c_gate_ctrl(struct dvb_frontend* fe, int enable) | 195 | static int cx22702_i2c_gate_ctrl(struct dvb_frontend* fe, int enable) |
196 | { | 196 | { |
197 | struct cx22702_state* state = fe->demodulator_priv; | 197 | struct cx22702_state* state = fe->demodulator_priv; |
198 | dprintk ("%s(%d)\n", __FUNCTION__, enable); | 198 | dprintk ("%s(%d)\n", __func__, enable); |
199 | if (enable) | 199 | if (enable) |
200 | return cx22702_writereg (state, 0x0D, cx22702_readreg(state, 0x0D) & 0xfe); | 200 | return cx22702_writereg (state, 0x0D, cx22702_readreg(state, 0x0D) & 0xfe); |
201 | else | 201 | else |
@@ -228,7 +228,7 @@ static int cx22702_set_tps (struct dvb_frontend* fe, struct dvb_frontend_paramet | |||
228 | cx22702_writereg(state, 0x0C, cx22702_readreg(state, 0x0C) &0xcf ); | 228 | cx22702_writereg(state, 0x0C, cx22702_readreg(state, 0x0C) &0xcf ); |
229 | break; | 229 | break; |
230 | default: | 230 | default: |
231 | dprintk ("%s: invalid bandwidth\n",__FUNCTION__); | 231 | dprintk ("%s: invalid bandwidth\n",__func__); |
232 | return -EINVAL; | 232 | return -EINVAL; |
233 | } | 233 | } |
234 | 234 | ||
@@ -250,7 +250,7 @@ static int cx22702_set_tps (struct dvb_frontend* fe, struct dvb_frontend_paramet | |||
250 | cx22702_writereg(state, 0x0B, cx22702_readreg(state, 0x0B) & 0xfc ); | 250 | cx22702_writereg(state, 0x0B, cx22702_readreg(state, 0x0B) & 0xfc ); |
251 | cx22702_writereg(state, 0x0C, (cx22702_readreg(state, 0x0C) & 0xBF) | 0x40 ); | 251 | cx22702_writereg(state, 0x0C, (cx22702_readreg(state, 0x0C) & 0xBF) | 0x40 ); |
252 | cx22702_writereg(state, 0x00, 0x01); /* Begin aquisition */ | 252 | cx22702_writereg(state, 0x00, 0x01); /* Begin aquisition */ |
253 | dprintk("%s: Autodetecting\n",__FUNCTION__); | 253 | dprintk("%s: Autodetecting\n",__func__); |
254 | return 0; | 254 | return 0; |
255 | } | 255 | } |
256 | 256 | ||
@@ -261,7 +261,7 @@ static int cx22702_set_tps (struct dvb_frontend* fe, struct dvb_frontend_paramet | |||
261 | case QAM_16: val = (val&0xe7)|0x08; break; | 261 | case QAM_16: val = (val&0xe7)|0x08; break; |
262 | case QAM_64: val = (val&0xe7)|0x10; break; | 262 | case QAM_64: val = (val&0xe7)|0x10; break; |
263 | default: | 263 | default: |
264 | dprintk ("%s: invalid constellation\n",__FUNCTION__); | 264 | dprintk ("%s: invalid constellation\n",__func__); |
265 | return -EINVAL; | 265 | return -EINVAL; |
266 | } | 266 | } |
267 | switch(p->u.ofdm.hierarchy_information) { | 267 | switch(p->u.ofdm.hierarchy_information) { |
@@ -270,7 +270,7 @@ static int cx22702_set_tps (struct dvb_frontend* fe, struct dvb_frontend_paramet | |||
270 | case HIERARCHY_2: val = (val&0xf8)|2; break; | 270 | case HIERARCHY_2: val = (val&0xf8)|2; break; |
271 | case HIERARCHY_4: val = (val&0xf8)|3; break; | 271 | case HIERARCHY_4: val = (val&0xf8)|3; break; |
272 | default: | 272 | default: |
273 | dprintk ("%s: invalid hierarchy\n",__FUNCTION__); | 273 | dprintk ("%s: invalid hierarchy\n",__func__); |
274 | return -EINVAL; | 274 | return -EINVAL; |
275 | } | 275 | } |
276 | cx22702_writereg (state, 0x06, val); | 276 | cx22702_writereg (state, 0x06, val); |
@@ -284,7 +284,7 @@ static int cx22702_set_tps (struct dvb_frontend* fe, struct dvb_frontend_paramet | |||
284 | case FEC_5_6: val = (val&0xc7)|0x18; break; | 284 | case FEC_5_6: val = (val&0xc7)|0x18; break; |
285 | case FEC_7_8: val = (val&0xc7)|0x20; break; | 285 | case FEC_7_8: val = (val&0xc7)|0x20; break; |
286 | default: | 286 | default: |
287 | dprintk ("%s: invalid code_rate_HP\n",__FUNCTION__); | 287 | dprintk ("%s: invalid code_rate_HP\n",__func__); |
288 | return -EINVAL; | 288 | return -EINVAL; |
289 | } | 289 | } |
290 | switch(p->u.ofdm.code_rate_LP) { | 290 | switch(p->u.ofdm.code_rate_LP) { |
@@ -295,7 +295,7 @@ static int cx22702_set_tps (struct dvb_frontend* fe, struct dvb_frontend_paramet | |||
295 | case FEC_5_6: val = (val&0xf8)|3; break; | 295 | case FEC_5_6: val = (val&0xf8)|3; break; |
296 | case FEC_7_8: val = (val&0xf8)|4; break; | 296 | case FEC_7_8: val = (val&0xf8)|4; break; |
297 | default: | 297 | default: |
298 | dprintk ("%s: invalid code_rate_LP\n",__FUNCTION__); | 298 | dprintk ("%s: invalid code_rate_LP\n",__func__); |
299 | return -EINVAL; | 299 | return -EINVAL; |
300 | } | 300 | } |
301 | cx22702_writereg (state, 0x07, val); | 301 | cx22702_writereg (state, 0x07, val); |
@@ -307,14 +307,14 @@ static int cx22702_set_tps (struct dvb_frontend* fe, struct dvb_frontend_paramet | |||
307 | case GUARD_INTERVAL_1_8: val = (val&0xf3)|0x08; break; | 307 | case GUARD_INTERVAL_1_8: val = (val&0xf3)|0x08; break; |
308 | case GUARD_INTERVAL_1_4: val = (val&0xf3)|0x0c; break; | 308 | case GUARD_INTERVAL_1_4: val = (val&0xf3)|0x0c; break; |
309 | default: | 309 | default: |
310 | dprintk ("%s: invalid guard_interval\n",__FUNCTION__); | 310 | dprintk ("%s: invalid guard_interval\n",__func__); |
311 | return -EINVAL; | 311 | return -EINVAL; |
312 | } | 312 | } |
313 | switch(p->u.ofdm.transmission_mode) { | 313 | switch(p->u.ofdm.transmission_mode) { |
314 | case TRANSMISSION_MODE_2K: val = (val&0xfc); break; | 314 | case TRANSMISSION_MODE_2K: val = (val&0xfc); break; |
315 | case TRANSMISSION_MODE_8K: val = (val&0xfc)|1; break; | 315 | case TRANSMISSION_MODE_8K: val = (val&0xfc)|1; break; |
316 | default: | 316 | default: |
317 | dprintk ("%s: invalid transmission_mode\n",__FUNCTION__); | 317 | dprintk ("%s: invalid transmission_mode\n",__func__); |
318 | return -EINVAL; | 318 | return -EINVAL; |
319 | } | 319 | } |
320 | cx22702_writereg(state, 0x08, val); | 320 | cx22702_writereg(state, 0x08, val); |
@@ -360,7 +360,7 @@ static int cx22702_read_status(struct dvb_frontend* fe, fe_status_t* status) | |||
360 | reg23 = cx22702_readreg (state, 0x23); | 360 | reg23 = cx22702_readreg (state, 0x23); |
361 | 361 | ||
362 | dprintk ("%s: status demod=0x%02x agc=0x%02x\n" | 362 | dprintk ("%s: status demod=0x%02x agc=0x%02x\n" |
363 | ,__FUNCTION__,reg0A,reg23); | 363 | ,__func__,reg0A,reg23); |
364 | 364 | ||
365 | if(reg0A & 0x10) { | 365 | if(reg0A & 0x10) { |
366 | *status |= FE_HAS_LOCK; | 366 | *status |= FE_HAS_LOCK; |
diff --git a/drivers/media/dvb/frontends/cx22702.h b/drivers/media/dvb/frontends/cx22702.h index 9cd64da6ee40..8af766a31552 100644 --- a/drivers/media/dvb/frontends/cx22702.h +++ b/drivers/media/dvb/frontends/cx22702.h | |||
@@ -48,7 +48,7 @@ extern struct dvb_frontend* cx22702_attach(const struct cx22702_config* config, | |||
48 | static inline struct dvb_frontend* cx22702_attach(const struct cx22702_config* config, | 48 | static inline struct dvb_frontend* cx22702_attach(const struct cx22702_config* config, |
49 | struct i2c_adapter* i2c) | 49 | struct i2c_adapter* i2c) |
50 | { | 50 | { |
51 | printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __FUNCTION__); | 51 | printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__); |
52 | return NULL; | 52 | return NULL; |
53 | } | 53 | } |
54 | #endif // CONFIG_DVB_CX22702 | 54 | #endif // CONFIG_DVB_CX22702 |
diff --git a/drivers/media/dvb/frontends/cx24110.c b/drivers/media/dvb/frontends/cx24110.c index b03d8283c37d..87ae29db024f 100644 --- a/drivers/media/dvb/frontends/cx24110.c +++ b/drivers/media/dvb/frontends/cx24110.c | |||
@@ -121,7 +121,7 @@ static int cx24110_writereg (struct cx24110_state* state, int reg, int data) | |||
121 | 121 | ||
122 | if ((err = i2c_transfer(state->i2c, &msg, 1)) != 1) { | 122 | if ((err = i2c_transfer(state->i2c, &msg, 1)) != 1) { |
123 | dprintk ("%s: writereg error (err == %i, reg == 0x%02x," | 123 | dprintk ("%s: writereg error (err == %i, reg == 0x%02x," |
124 | " data == 0x%02x)\n", __FUNCTION__, err, reg, data); | 124 | " data == 0x%02x)\n", __func__, err, reg, data); |
125 | return -EREMOTEIO; | 125 | return -EREMOTEIO; |
126 | } | 126 | } |
127 | 127 | ||
@@ -247,7 +247,7 @@ static int cx24110_set_symbolrate (struct cx24110_state* state, u32 srate) | |||
247 | static const u32 bands[]={5000000UL,15000000UL,90999000UL/2}; | 247 | static const u32 bands[]={5000000UL,15000000UL,90999000UL/2}; |
248 | int i; | 248 | int i; |
249 | 249 | ||
250 | dprintk("cx24110 debug: entering %s(%d)\n",__FUNCTION__,srate); | 250 | dprintk("cx24110 debug: entering %s(%d)\n",__func__,srate); |
251 | if (srate>90999000UL/2) | 251 | if (srate>90999000UL/2) |
252 | srate=90999000UL/2; | 252 | srate=90999000UL/2; |
253 | if (srate<500000) | 253 | if (srate<500000) |
@@ -358,7 +358,7 @@ static int cx24110_initfe(struct dvb_frontend* fe) | |||
358 | /* fixme (low): error handling */ | 358 | /* fixme (low): error handling */ |
359 | int i; | 359 | int i; |
360 | 360 | ||
361 | dprintk("%s: init chip\n", __FUNCTION__); | 361 | dprintk("%s: init chip\n", __func__); |
362 | 362 | ||
363 | for(i = 0; i < ARRAY_SIZE(cx24110_regdata); i++) { | 363 | for(i = 0; i < ARRAY_SIZE(cx24110_regdata); i++) { |
364 | cx24110_writereg(state, cx24110_regdata[i].reg, cx24110_regdata[i].data); | 364 | cx24110_writereg(state, cx24110_regdata[i].reg, cx24110_regdata[i].data); |
diff --git a/drivers/media/dvb/frontends/cx24110.h b/drivers/media/dvb/frontends/cx24110.h index 0ca3af4db513..1792adb23c4d 100644 --- a/drivers/media/dvb/frontends/cx24110.h +++ b/drivers/media/dvb/frontends/cx24110.h | |||
@@ -48,7 +48,7 @@ extern struct dvb_frontend* cx24110_attach(const struct cx24110_config* config, | |||
48 | static inline struct dvb_frontend* cx24110_attach(const struct cx24110_config* config, | 48 | static inline struct dvb_frontend* cx24110_attach(const struct cx24110_config* config, |
49 | struct i2c_adapter* i2c) | 49 | struct i2c_adapter* i2c) |
50 | { | 50 | { |
51 | printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __FUNCTION__); | 51 | printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__); |
52 | return NULL; | 52 | return NULL; |
53 | } | 53 | } |
54 | #endif // CONFIG_DVB_CX24110 | 54 | #endif // CONFIG_DVB_CX24110 |
diff --git a/drivers/media/dvb/frontends/cx24113.h b/drivers/media/dvb/frontends/cx24113.h new file mode 100644 index 000000000000..5ab3dd11076b --- /dev/null +++ b/drivers/media/dvb/frontends/cx24113.h | |||
@@ -0,0 +1,48 @@ | |||
1 | /* | ||
2 | * Driver for Conexant CX24113/CX24128 Tuner (Satelite) | ||
3 | * | ||
4 | * Copyright (C) 2007-8 Patrick Boettcher <pb@linuxtv.org> | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | * | ||
15 | * GNU General Public License for more details. | ||
16 | * | ||
17 | * You should have received a copy of the GNU General Public License | ||
18 | * along with this program; if not, write to the Free Software | ||
19 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.= | ||
20 | */ | ||
21 | |||
22 | #ifndef CX24113_H | ||
23 | #define CX24113_H | ||
24 | |||
25 | struct dvb_frontend; | ||
26 | |||
27 | struct cx24113_config { | ||
28 | u8 i2c_addr; /* 0x14 or 0x54 */ | ||
29 | |||
30 | u32 xtal_khz; | ||
31 | }; | ||
32 | |||
33 | /* TODO: #if defined(CONFIG_DVB_TUNER_CX24113) || \ | ||
34 | * (defined(CONFIG_DVB_TUNER_CX24113_MODULE) && defined(MODULE)) */ | ||
35 | |||
36 | static inline struct dvb_frontend *cx24113_attach(struct dvb_frontend *fe, | ||
37 | const struct cx24113_config *config, struct i2c_adapter *i2c) | ||
38 | { | ||
39 | printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__); | ||
40 | return NULL; | ||
41 | } | ||
42 | |||
43 | static inline void cx24113_agc_callback(struct dvb_frontend *fe) | ||
44 | { | ||
45 | printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__); | ||
46 | } | ||
47 | |||
48 | #endif /* CX24113_H */ | ||
diff --git a/drivers/media/dvb/frontends/cx24123.c b/drivers/media/dvb/frontends/cx24123.c index d74fdbd63361..7f68d78c6558 100644 --- a/drivers/media/dvb/frontends/cx24123.c +++ b/drivers/media/dvb/frontends/cx24123.c | |||
@@ -1,24 +1,26 @@ | |||
1 | /* | 1 | /* |
2 | Conexant cx24123/cx24109 - DVB QPSK Satellite demod/tuner driver | 2 | * Conexant cx24123/cx24109 - DVB QPSK Satellite demod/tuner driver |
3 | 3 | * | |
4 | Copyright (C) 2005 Steven Toth <stoth@hauppauge.com> | 4 | * Copyright (C) 2005 Steven Toth <stoth@hauppauge.com> |
5 | 5 | * | |
6 | Support for KWorld DVB-S 100 by Vadim Catana <skystar@moldova.cc> | 6 | * Support for KWorld DVB-S 100 by Vadim Catana <skystar@moldova.cc> |
7 | 7 | * | |
8 | This program is free software; you can redistribute it and/or modify | 8 | * Support for CX24123/CX24113-NIM by Patrick Boettcher <pb@linuxtv.org> |
9 | it under the terms of the GNU General Public License as published by | 9 | * |
10 | the Free Software Foundation; either version 2 of the License, or | 10 | * This program is free software; you can redistribute it and/or |
11 | (at your option) any later version. | 11 | * modify it under the terms of the GNU General Public License as |
12 | 12 | * published by the Free Software Foundation; either version 2 of | |
13 | This program is distributed in the hope that it will be useful, | 13 | * the License, or (at your option) any later version. |
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 14 | * |
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 15 | * This program is distributed in the hope that it will be useful, |
16 | GNU General Public License for more details. | 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
18 | You should have received a copy of the GNU General Public License | 18 | * General Public License for more details. |
19 | along with this program; if not, write to the Free Software | 19 | * |
20 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | 20 | * You should have received a copy of the GNU General Public License |
21 | */ | 21 | * along with this program; if not, write to the Free Software |
22 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
23 | */ | ||
22 | 24 | ||
23 | #include <linux/slab.h> | 25 | #include <linux/slab.h> |
24 | #include <linux/kernel.h> | 26 | #include <linux/kernel.h> |
@@ -32,9 +34,16 @@ | |||
32 | 34 | ||
33 | static int force_band; | 35 | static int force_band; |
34 | static int debug; | 36 | static int debug; |
37 | |||
38 | #define info(args...) do { printk(KERN_INFO "CX24123: " args); } while (0) | ||
39 | #define err(args...) do { printk(KERN_ERR "CX24123: " args); } while (0) | ||
40 | |||
35 | #define dprintk(args...) \ | 41 | #define dprintk(args...) \ |
36 | do { \ | 42 | do { \ |
37 | if (debug) printk (KERN_DEBUG "cx24123: " args); \ | 43 | if (debug) { \ |
44 | printk(KERN_DEBUG "CX24123: %s: ", __func__); \ | ||
45 | printk(args); \ | ||
46 | } \ | ||
38 | } while (0) | 47 | } while (0) |
39 | 48 | ||
40 | struct cx24123_state | 49 | struct cx24123_state |
@@ -51,6 +60,10 @@ struct cx24123_state | |||
51 | u32 pllarg; | 60 | u32 pllarg; |
52 | u32 FILTune; | 61 | u32 FILTune; |
53 | 62 | ||
63 | struct i2c_adapter tuner_i2c_adapter; | ||
64 | |||
65 | u8 demod_rev; | ||
66 | |||
54 | /* The Demod/Tuner can't easily provide these, we cache them */ | 67 | /* The Demod/Tuner can't easily provide these, we cache them */ |
55 | u32 currentfreq; | 68 | u32 currentfreq; |
56 | u32 currentsymbolrate; | 69 | u32 currentsymbolrate; |
@@ -225,48 +238,52 @@ static struct { | |||
225 | {0x67, 0x83}, /* Non-DCII symbol clock */ | 238 | {0x67, 0x83}, /* Non-DCII symbol clock */ |
226 | }; | 239 | }; |
227 | 240 | ||
228 | static int cx24123_writereg(struct cx24123_state* state, int reg, int data) | 241 | static int cx24123_i2c_writereg(struct cx24123_state *state, |
242 | u8 i2c_addr, int reg, int data) | ||
229 | { | 243 | { |
230 | u8 buf[] = { reg, data }; | 244 | u8 buf[] = { reg, data }; |
231 | struct i2c_msg msg = { .addr = state->config->demod_address, .flags = 0, .buf = buf, .len = 2 }; | 245 | struct i2c_msg msg = { |
246 | .addr = i2c_addr, .flags = 0, .buf = buf, .len = 2 | ||
247 | }; | ||
232 | int err; | 248 | int err; |
233 | 249 | ||
234 | if (debug>1) | 250 | /* printk(KERN_DEBUG "wr(%02x): %02x %02x\n", i2c_addr, reg, data); */ |
235 | printk("cx24123: %s: write reg 0x%02x, value 0x%02x\n", | ||
236 | __FUNCTION__,reg, data); | ||
237 | 251 | ||
238 | if ((err = i2c_transfer(state->i2c, &msg, 1)) != 1) { | 252 | if ((err = i2c_transfer(state->i2c, &msg, 1)) != 1) { |
239 | printk("%s: writereg error(err == %i, reg == 0x%02x," | 253 | printk("%s: writereg error(err == %i, reg == 0x%02x," |
240 | " data == 0x%02x)\n", __FUNCTION__, err, reg, data); | 254 | " data == 0x%02x)\n", __func__, err, reg, data); |
241 | return -EREMOTEIO; | 255 | return err; |
242 | } | 256 | } |
243 | 257 | ||
244 | return 0; | 258 | return 0; |
245 | } | 259 | } |
246 | 260 | ||
247 | static int cx24123_readreg(struct cx24123_state* state, u8 reg) | 261 | static int cx24123_i2c_readreg(struct cx24123_state *state, u8 i2c_addr, u8 reg) |
248 | { | 262 | { |
249 | int ret; | 263 | int ret; |
250 | u8 b0[] = { reg }; | 264 | u8 b = 0; |
251 | u8 b1[] = { 0 }; | ||
252 | struct i2c_msg msg[] = { | 265 | struct i2c_msg msg[] = { |
253 | { .addr = state->config->demod_address, .flags = 0, .buf = b0, .len = 1 }, | 266 | { .addr = i2c_addr, .flags = 0, .buf = ®, .len = 1 }, |
254 | { .addr = state->config->demod_address, .flags = I2C_M_RD, .buf = b1, .len = 1 } | 267 | { .addr = i2c_addr, .flags = I2C_M_RD, .buf = &b, .len = 1 } |
255 | }; | 268 | }; |
256 | 269 | ||
257 | ret = i2c_transfer(state->i2c, msg, 2); | 270 | ret = i2c_transfer(state->i2c, msg, 2); |
258 | 271 | ||
259 | if (ret != 2) { | 272 | if (ret != 2) { |
260 | printk("%s: reg=0x%x (error=%d)\n", __FUNCTION__, reg, ret); | 273 | err("%s: reg=0x%x (error=%d)\n", __func__, reg, ret); |
261 | return ret; | 274 | return ret; |
262 | } | 275 | } |
263 | 276 | ||
264 | if (debug>1) | 277 | /* printk(KERN_DEBUG "rd(%02x): %02x %02x\n", i2c_addr, reg, b); */ |
265 | printk("cx24123: read reg 0x%02x, value 0x%02x\n",reg, ret); | ||
266 | 278 | ||
267 | return b1[0]; | 279 | return b; |
268 | } | 280 | } |
269 | 281 | ||
282 | #define cx24123_readreg(state, reg) \ | ||
283 | cx24123_i2c_readreg(state, state->config->demod_address, reg) | ||
284 | #define cx24123_writereg(state, reg, val) \ | ||
285 | cx24123_i2c_writereg(state, state->config->demod_address, reg, val) | ||
286 | |||
270 | static int cx24123_set_inversion(struct cx24123_state* state, fe_spectral_inversion_t inversion) | 287 | static int cx24123_set_inversion(struct cx24123_state* state, fe_spectral_inversion_t inversion) |
271 | { | 288 | { |
272 | u8 nom_reg = cx24123_readreg(state, 0x0e); | 289 | u8 nom_reg = cx24123_readreg(state, 0x0e); |
@@ -274,17 +291,17 @@ static int cx24123_set_inversion(struct cx24123_state* state, fe_spectral_invers | |||
274 | 291 | ||
275 | switch (inversion) { | 292 | switch (inversion) { |
276 | case INVERSION_OFF: | 293 | case INVERSION_OFF: |
277 | dprintk("%s: inversion off\n",__FUNCTION__); | 294 | dprintk("inversion off\n"); |
278 | cx24123_writereg(state, 0x0e, nom_reg & ~0x80); | 295 | cx24123_writereg(state, 0x0e, nom_reg & ~0x80); |
279 | cx24123_writereg(state, 0x10, auto_reg | 0x80); | 296 | cx24123_writereg(state, 0x10, auto_reg | 0x80); |
280 | break; | 297 | break; |
281 | case INVERSION_ON: | 298 | case INVERSION_ON: |
282 | dprintk("%s: inversion on\n",__FUNCTION__); | 299 | dprintk("inversion on\n"); |
283 | cx24123_writereg(state, 0x0e, nom_reg | 0x80); | 300 | cx24123_writereg(state, 0x0e, nom_reg | 0x80); |
284 | cx24123_writereg(state, 0x10, auto_reg | 0x80); | 301 | cx24123_writereg(state, 0x10, auto_reg | 0x80); |
285 | break; | 302 | break; |
286 | case INVERSION_AUTO: | 303 | case INVERSION_AUTO: |
287 | dprintk("%s: inversion auto\n",__FUNCTION__); | 304 | dprintk("inversion auto\n"); |
288 | cx24123_writereg(state, 0x10, auto_reg & ~0x80); | 305 | cx24123_writereg(state, 0x10, auto_reg & ~0x80); |
289 | break; | 306 | break; |
290 | default: | 307 | default: |
@@ -301,10 +318,10 @@ static int cx24123_get_inversion(struct cx24123_state* state, fe_spectral_invers | |||
301 | val = cx24123_readreg(state, 0x1b) >> 7; | 318 | val = cx24123_readreg(state, 0x1b) >> 7; |
302 | 319 | ||
303 | if (val == 0) { | 320 | if (val == 0) { |
304 | dprintk("%s: read inversion off\n",__FUNCTION__); | 321 | dprintk("read inversion off\n"); |
305 | *inversion = INVERSION_OFF; | 322 | *inversion = INVERSION_OFF; |
306 | } else { | 323 | } else { |
307 | dprintk("%s: read inversion on\n",__FUNCTION__); | 324 | dprintk("read inversion on\n"); |
308 | *inversion = INVERSION_ON; | 325 | *inversion = INVERSION_ON; |
309 | } | 326 | } |
310 | 327 | ||
@@ -326,42 +343,42 @@ static int cx24123_set_fec(struct cx24123_state* state, fe_code_rate_t fec) | |||
326 | 343 | ||
327 | switch (fec) { | 344 | switch (fec) { |
328 | case FEC_1_2: | 345 | case FEC_1_2: |
329 | dprintk("%s: set FEC to 1/2\n",__FUNCTION__); | 346 | dprintk("set FEC to 1/2\n"); |
330 | cx24123_writereg(state, 0x0e, nom_reg | 0x01); | 347 | cx24123_writereg(state, 0x0e, nom_reg | 0x01); |
331 | cx24123_writereg(state, 0x0f, 0x02); | 348 | cx24123_writereg(state, 0x0f, 0x02); |
332 | break; | 349 | break; |
333 | case FEC_2_3: | 350 | case FEC_2_3: |
334 | dprintk("%s: set FEC to 2/3\n",__FUNCTION__); | 351 | dprintk("set FEC to 2/3\n"); |
335 | cx24123_writereg(state, 0x0e, nom_reg | 0x02); | 352 | cx24123_writereg(state, 0x0e, nom_reg | 0x02); |
336 | cx24123_writereg(state, 0x0f, 0x04); | 353 | cx24123_writereg(state, 0x0f, 0x04); |
337 | break; | 354 | break; |
338 | case FEC_3_4: | 355 | case FEC_3_4: |
339 | dprintk("%s: set FEC to 3/4\n",__FUNCTION__); | 356 | dprintk("set FEC to 3/4\n"); |
340 | cx24123_writereg(state, 0x0e, nom_reg | 0x03); | 357 | cx24123_writereg(state, 0x0e, nom_reg | 0x03); |
341 | cx24123_writereg(state, 0x0f, 0x08); | 358 | cx24123_writereg(state, 0x0f, 0x08); |
342 | break; | 359 | break; |
343 | case FEC_4_5: | 360 | case FEC_4_5: |
344 | dprintk("%s: set FEC to 4/5\n",__FUNCTION__); | 361 | dprintk("set FEC to 4/5\n"); |
345 | cx24123_writereg(state, 0x0e, nom_reg | 0x04); | 362 | cx24123_writereg(state, 0x0e, nom_reg | 0x04); |
346 | cx24123_writereg(state, 0x0f, 0x10); | 363 | cx24123_writereg(state, 0x0f, 0x10); |
347 | break; | 364 | break; |
348 | case FEC_5_6: | 365 | case FEC_5_6: |
349 | dprintk("%s: set FEC to 5/6\n",__FUNCTION__); | 366 | dprintk("set FEC to 5/6\n"); |
350 | cx24123_writereg(state, 0x0e, nom_reg | 0x05); | 367 | cx24123_writereg(state, 0x0e, nom_reg | 0x05); |
351 | cx24123_writereg(state, 0x0f, 0x20); | 368 | cx24123_writereg(state, 0x0f, 0x20); |
352 | break; | 369 | break; |
353 | case FEC_6_7: | 370 | case FEC_6_7: |
354 | dprintk("%s: set FEC to 6/7\n",__FUNCTION__); | 371 | dprintk("set FEC to 6/7\n"); |
355 | cx24123_writereg(state, 0x0e, nom_reg | 0x06); | 372 | cx24123_writereg(state, 0x0e, nom_reg | 0x06); |
356 | cx24123_writereg(state, 0x0f, 0x40); | 373 | cx24123_writereg(state, 0x0f, 0x40); |
357 | break; | 374 | break; |
358 | case FEC_7_8: | 375 | case FEC_7_8: |
359 | dprintk("%s: set FEC to 7/8\n",__FUNCTION__); | 376 | dprintk("set FEC to 7/8\n"); |
360 | cx24123_writereg(state, 0x0e, nom_reg | 0x07); | 377 | cx24123_writereg(state, 0x0e, nom_reg | 0x07); |
361 | cx24123_writereg(state, 0x0f, 0x80); | 378 | cx24123_writereg(state, 0x0f, 0x80); |
362 | break; | 379 | break; |
363 | case FEC_AUTO: | 380 | case FEC_AUTO: |
364 | dprintk("%s: set FEC to auto\n",__FUNCTION__); | 381 | dprintk("set FEC to auto\n"); |
365 | cx24123_writereg(state, 0x0f, 0xfe); | 382 | cx24123_writereg(state, 0x0f, 0xfe); |
366 | break; | 383 | break; |
367 | default: | 384 | default: |
@@ -490,7 +507,8 @@ static int cx24123_set_symbolrate(struct cx24123_state* state, u32 srate) | |||
490 | tmp = cx24123_readreg(state, 0x0c) & ~0xe0; | 507 | tmp = cx24123_readreg(state, 0x0c) & ~0xe0; |
491 | cx24123_writereg(state, 0x0c, tmp | sample_gain << 5); | 508 | cx24123_writereg(state, 0x0c, tmp | sample_gain << 5); |
492 | 509 | ||
493 | dprintk("%s: srate=%d, ratio=0x%08x, sample_rate=%i sample_gain=%d\n", __FUNCTION__, srate, ratio, sample_rate, sample_gain); | 510 | dprintk("srate=%d, ratio=0x%08x, sample_rate=%i sample_gain=%d\n", |
511 | srate, ratio, sample_rate, sample_gain); | ||
494 | 512 | ||
495 | return 0; | 513 | return 0; |
496 | } | 514 | } |
@@ -570,7 +588,7 @@ static int cx24123_pll_writereg(struct dvb_frontend* fe, struct dvb_frontend_par | |||
570 | struct cx24123_state *state = fe->demodulator_priv; | 588 | struct cx24123_state *state = fe->demodulator_priv; |
571 | unsigned long timeout; | 589 | unsigned long timeout; |
572 | 590 | ||
573 | dprintk("%s: pll writereg called, data=0x%08x\n",__FUNCTION__,data); | 591 | dprintk("pll writereg called, data=0x%08x\n", data); |
574 | 592 | ||
575 | /* align the 21 bytes into to bit23 boundary */ | 593 | /* align the 21 bytes into to bit23 boundary */ |
576 | data = data << 3; | 594 | data = data << 3; |
@@ -583,7 +601,8 @@ static int cx24123_pll_writereg(struct dvb_frontend* fe, struct dvb_frontend_par | |||
583 | cx24123_writereg(state, 0x22, (data >> 16) & 0xff); | 601 | cx24123_writereg(state, 0x22, (data >> 16) & 0xff); |
584 | while ((cx24123_readreg(state, 0x20) & 0x40) == 0) { | 602 | while ((cx24123_readreg(state, 0x20) & 0x40) == 0) { |
585 | if (time_after(jiffies, timeout)) { | 603 | if (time_after(jiffies, timeout)) { |
586 | printk("%s: demodulator is not responding, possibly hung, aborting.\n", __FUNCTION__); | 604 | err("%s: demodulator is not responding, "\ |
605 | "possibly hung, aborting.\n", __func__); | ||
587 | return -EREMOTEIO; | 606 | return -EREMOTEIO; |
588 | } | 607 | } |
589 | msleep(10); | 608 | msleep(10); |
@@ -594,7 +613,8 @@ static int cx24123_pll_writereg(struct dvb_frontend* fe, struct dvb_frontend_par | |||
594 | cx24123_writereg(state, 0x22, (data>>8) & 0xff ); | 613 | cx24123_writereg(state, 0x22, (data>>8) & 0xff ); |
595 | while ((cx24123_readreg(state, 0x20) & 0x40) == 0) { | 614 | while ((cx24123_readreg(state, 0x20) & 0x40) == 0) { |
596 | if (time_after(jiffies, timeout)) { | 615 | if (time_after(jiffies, timeout)) { |
597 | printk("%s: demodulator is not responding, possibly hung, aborting.\n", __FUNCTION__); | 616 | err("%s: demodulator is not responding, "\ |
617 | "possibly hung, aborting.\n", __func__); | ||
598 | return -EREMOTEIO; | 618 | return -EREMOTEIO; |
599 | } | 619 | } |
600 | msleep(10); | 620 | msleep(10); |
@@ -605,7 +625,8 @@ static int cx24123_pll_writereg(struct dvb_frontend* fe, struct dvb_frontend_par | |||
605 | cx24123_writereg(state, 0x22, (data) & 0xff ); | 625 | cx24123_writereg(state, 0x22, (data) & 0xff ); |
606 | while ((cx24123_readreg(state, 0x20) & 0x80)) { | 626 | while ((cx24123_readreg(state, 0x20) & 0x80)) { |
607 | if (time_after(jiffies, timeout)) { | 627 | if (time_after(jiffies, timeout)) { |
608 | printk("%s: demodulator is not responding, possibly hung, aborting.\n", __FUNCTION__); | 628 | err("%s: demodulator is not responding," \ |
629 | "possibly hung, aborting.\n", __func__); | ||
609 | return -EREMOTEIO; | 630 | return -EREMOTEIO; |
610 | } | 631 | } |
611 | msleep(10); | 632 | msleep(10); |
@@ -626,7 +647,7 @@ static int cx24123_pll_tune(struct dvb_frontend* fe, struct dvb_frontend_paramet | |||
626 | dprintk("frequency=%i\n", p->frequency); | 647 | dprintk("frequency=%i\n", p->frequency); |
627 | 648 | ||
628 | if (cx24123_pll_calculate(fe, p) != 0) { | 649 | if (cx24123_pll_calculate(fe, p) != 0) { |
629 | printk("%s: cx24123_pll_calcutate failed\n",__FUNCTION__); | 650 | err("%s: cx24123_pll_calcutate failed\n", __func__); |
630 | return -EINVAL; | 651 | return -EINVAL; |
631 | } | 652 | } |
632 | 653 | ||
@@ -643,18 +664,38 @@ static int cx24123_pll_tune(struct dvb_frontend* fe, struct dvb_frontend_paramet | |||
643 | cx24123_writereg(state, 0x27, state->FILTune >> 2); | 664 | cx24123_writereg(state, 0x27, state->FILTune >> 2); |
644 | cx24123_writereg(state, 0x28, val | (state->FILTune & 0x3)); | 665 | cx24123_writereg(state, 0x28, val | (state->FILTune & 0x3)); |
645 | 666 | ||
646 | dprintk("%s: pll tune VCA=%d, band=%d, pll=%d\n",__FUNCTION__,state->VCAarg, | 667 | dprintk("pll tune VCA=%d, band=%d, pll=%d\n", state->VCAarg, |
647 | state->bandselectarg,state->pllarg); | 668 | state->bandselectarg, state->pllarg); |
648 | 669 | ||
649 | return 0; | 670 | return 0; |
650 | } | 671 | } |
651 | 672 | ||
673 | |||
674 | /* | ||
675 | * 0x23: | ||
676 | * [7:7] = BTI enabled | ||
677 | * [6:6] = I2C repeater enabled | ||
678 | * [5:5] = I2C repeater start | ||
679 | * [0:0] = BTI start | ||
680 | */ | ||
681 | |||
682 | /* mode == 1 -> i2c-repeater, 0 -> bti */ | ||
683 | static int cx24123_repeater_mode(struct cx24123_state *state, u8 mode, u8 start) | ||
684 | { | ||
685 | u8 r = cx24123_readreg(state, 0x23) & 0x1e; | ||
686 | if (mode) | ||
687 | r |= (1 << 6) | (start << 5); | ||
688 | else | ||
689 | r |= (1 << 7) | (start); | ||
690 | return cx24123_writereg(state, 0x23, r); | ||
691 | } | ||
692 | |||
652 | static int cx24123_initfe(struct dvb_frontend* fe) | 693 | static int cx24123_initfe(struct dvb_frontend* fe) |
653 | { | 694 | { |
654 | struct cx24123_state *state = fe->demodulator_priv; | 695 | struct cx24123_state *state = fe->demodulator_priv; |
655 | int i; | 696 | int i; |
656 | 697 | ||
657 | dprintk("%s: init frontend\n",__FUNCTION__); | 698 | dprintk("init frontend\n"); |
658 | 699 | ||
659 | /* Configure the demod to a good set of defaults */ | 700 | /* Configure the demod to a good set of defaults */ |
660 | for (i = 0; i < ARRAY_SIZE(cx24123_regdata); i++) | 701 | for (i = 0; i < ARRAY_SIZE(cx24123_regdata); i++) |
@@ -664,6 +705,9 @@ static int cx24123_initfe(struct dvb_frontend* fe) | |||
664 | if(state->config->lnb_polarity) | 705 | if(state->config->lnb_polarity) |
665 | cx24123_writereg(state, 0x32, cx24123_readreg(state, 0x32) | 0x02); | 706 | cx24123_writereg(state, 0x32, cx24123_readreg(state, 0x32) | 0x02); |
666 | 707 | ||
708 | if (state->config->dont_use_pll) | ||
709 | cx24123_repeater_mode(state, 1, 0); | ||
710 | |||
667 | return 0; | 711 | return 0; |
668 | } | 712 | } |
669 | 713 | ||
@@ -676,10 +720,10 @@ static int cx24123_set_voltage(struct dvb_frontend* fe, fe_sec_voltage_t voltage | |||
676 | 720 | ||
677 | switch (voltage) { | 721 | switch (voltage) { |
678 | case SEC_VOLTAGE_13: | 722 | case SEC_VOLTAGE_13: |
679 | dprintk("%s: setting voltage 13V\n", __FUNCTION__); | 723 | dprintk("setting voltage 13V\n"); |
680 | return cx24123_writereg(state, 0x29, val & 0x7f); | 724 | return cx24123_writereg(state, 0x29, val & 0x7f); |
681 | case SEC_VOLTAGE_18: | 725 | case SEC_VOLTAGE_18: |
682 | dprintk("%s: setting voltage 18V\n", __FUNCTION__); | 726 | dprintk("setting voltage 18V\n"); |
683 | return cx24123_writereg(state, 0x29, val | 0x80); | 727 | return cx24123_writereg(state, 0x29, val | 0x80); |
684 | case SEC_VOLTAGE_OFF: | 728 | case SEC_VOLTAGE_OFF: |
685 | /* already handled in cx88-dvb */ | 729 | /* already handled in cx88-dvb */ |
@@ -697,7 +741,8 @@ static void cx24123_wait_for_diseqc(struct cx24123_state *state) | |||
697 | unsigned long timeout = jiffies + msecs_to_jiffies(200); | 741 | unsigned long timeout = jiffies + msecs_to_jiffies(200); |
698 | while (!(cx24123_readreg(state, 0x29) & 0x40)) { | 742 | while (!(cx24123_readreg(state, 0x29) & 0x40)) { |
699 | if(time_after(jiffies, timeout)) { | 743 | if(time_after(jiffies, timeout)) { |
700 | printk("%s: diseqc queue not ready, command may be lost.\n", __FUNCTION__); | 744 | err("%s: diseqc queue not ready, " \ |
745 | "command may be lost.\n", __func__); | ||
701 | break; | 746 | break; |
702 | } | 747 | } |
703 | msleep(10); | 748 | msleep(10); |
@@ -709,7 +754,7 @@ static int cx24123_send_diseqc_msg(struct dvb_frontend* fe, struct dvb_diseqc_ma | |||
709 | struct cx24123_state *state = fe->demodulator_priv; | 754 | struct cx24123_state *state = fe->demodulator_priv; |
710 | int i, val, tone; | 755 | int i, val, tone; |
711 | 756 | ||
712 | dprintk("%s:\n",__FUNCTION__); | 757 | dprintk("\n"); |
713 | 758 | ||
714 | /* stop continuous tone if enabled */ | 759 | /* stop continuous tone if enabled */ |
715 | tone = cx24123_readreg(state, 0x29); | 760 | tone = cx24123_readreg(state, 0x29); |
@@ -744,7 +789,7 @@ static int cx24123_diseqc_send_burst(struct dvb_frontend* fe, fe_sec_mini_cmd_t | |||
744 | struct cx24123_state *state = fe->demodulator_priv; | 789 | struct cx24123_state *state = fe->demodulator_priv; |
745 | int val, tone; | 790 | int val, tone; |
746 | 791 | ||
747 | dprintk("%s:\n", __FUNCTION__); | 792 | dprintk("\n"); |
748 | 793 | ||
749 | /* stop continuous tone if enabled */ | 794 | /* stop continuous tone if enabled */ |
750 | tone = cx24123_readreg(state, 0x29); | 795 | tone = cx24123_readreg(state, 0x29); |
@@ -778,13 +823,21 @@ static int cx24123_diseqc_send_burst(struct dvb_frontend* fe, fe_sec_mini_cmd_t | |||
778 | static int cx24123_read_status(struct dvb_frontend* fe, fe_status_t* status) | 823 | static int cx24123_read_status(struct dvb_frontend* fe, fe_status_t* status) |
779 | { | 824 | { |
780 | struct cx24123_state *state = fe->demodulator_priv; | 825 | struct cx24123_state *state = fe->demodulator_priv; |
781 | |||
782 | int sync = cx24123_readreg(state, 0x14); | 826 | int sync = cx24123_readreg(state, 0x14); |
783 | int lock = cx24123_readreg(state, 0x20); | ||
784 | 827 | ||
785 | *status = 0; | 828 | *status = 0; |
786 | if (lock & 0x01) | 829 | if (state->config->dont_use_pll) { |
787 | *status |= FE_HAS_SIGNAL; | 830 | u32 tun_status = 0; |
831 | if (fe->ops.tuner_ops.get_status) | ||
832 | fe->ops.tuner_ops.get_status(fe, &tun_status); | ||
833 | if (tun_status & TUNER_STATUS_LOCKED) | ||
834 | *status |= FE_HAS_SIGNAL; | ||
835 | } else { | ||
836 | int lock = cx24123_readreg(state, 0x20); | ||
837 | if (lock & 0x01) | ||
838 | *status |= FE_HAS_SIGNAL; | ||
839 | } | ||
840 | |||
788 | if (sync & 0x02) | 841 | if (sync & 0x02) |
789 | *status |= FE_HAS_CARRIER; /* Phase locked */ | 842 | *status |= FE_HAS_CARRIER; /* Phase locked */ |
790 | if (sync & 0x04) | 843 | if (sync & 0x04) |
@@ -803,7 +856,7 @@ static int cx24123_read_status(struct dvb_frontend* fe, fe_status_t* status) | |||
803 | * Configured to return the measurement of errors in blocks, because no UCBLOCKS value | 856 | * Configured to return the measurement of errors in blocks, because no UCBLOCKS value |
804 | * is available, so this value doubles up to satisfy both measurements | 857 | * is available, so this value doubles up to satisfy both measurements |
805 | */ | 858 | */ |
806 | static int cx24123_read_ber(struct dvb_frontend* fe, u32* ber) | 859 | static int cx24123_read_ber(struct dvb_frontend *fe, u32 *ber) |
807 | { | 860 | { |
808 | struct cx24123_state *state = fe->demodulator_priv; | 861 | struct cx24123_state *state = fe->demodulator_priv; |
809 | 862 | ||
@@ -813,23 +866,24 @@ static int cx24123_read_ber(struct dvb_frontend* fe, u32* ber) | |||
813 | (cx24123_readreg(state, 0x1d) << 8 | | 866 | (cx24123_readreg(state, 0x1d) << 8 | |
814 | cx24123_readreg(state, 0x1e)); | 867 | cx24123_readreg(state, 0x1e)); |
815 | 868 | ||
816 | dprintk("%s: BER = %d\n",__FUNCTION__,*ber); | 869 | dprintk("BER = %d\n", *ber); |
817 | 870 | ||
818 | return 0; | 871 | return 0; |
819 | } | 872 | } |
820 | 873 | ||
821 | static int cx24123_read_signal_strength(struct dvb_frontend* fe, u16* signal_strength) | 874 | static int cx24123_read_signal_strength(struct dvb_frontend *fe, |
875 | u16 *signal_strength) | ||
822 | { | 876 | { |
823 | struct cx24123_state *state = fe->demodulator_priv; | 877 | struct cx24123_state *state = fe->demodulator_priv; |
824 | 878 | ||
825 | *signal_strength = cx24123_readreg(state, 0x3b) << 8; /* larger = better */ | 879 | *signal_strength = cx24123_readreg(state, 0x3b) << 8; /* larger = better */ |
826 | 880 | ||
827 | dprintk("%s: Signal strength = %d\n",__FUNCTION__,*signal_strength); | 881 | dprintk("Signal strength = %d\n", *signal_strength); |
828 | 882 | ||
829 | return 0; | 883 | return 0; |
830 | } | 884 | } |
831 | 885 | ||
832 | static int cx24123_read_snr(struct dvb_frontend* fe, u16* snr) | 886 | static int cx24123_read_snr(struct dvb_frontend *fe, u16 *snr) |
833 | { | 887 | { |
834 | struct cx24123_state *state = fe->demodulator_priv; | 888 | struct cx24123_state *state = fe->demodulator_priv; |
835 | 889 | ||
@@ -838,16 +892,17 @@ static int cx24123_read_snr(struct dvb_frontend* fe, u16* snr) | |||
838 | *snr = 65535 - (((u16)cx24123_readreg(state, 0x18) << 8) | | 892 | *snr = 65535 - (((u16)cx24123_readreg(state, 0x18) << 8) | |
839 | (u16)cx24123_readreg(state, 0x19)); | 893 | (u16)cx24123_readreg(state, 0x19)); |
840 | 894 | ||
841 | dprintk("%s: read S/N index = %d\n",__FUNCTION__,*snr); | 895 | dprintk("read S/N index = %d\n", *snr); |
842 | 896 | ||
843 | return 0; | 897 | return 0; |
844 | } | 898 | } |
845 | 899 | ||
846 | static int cx24123_set_frontend(struct dvb_frontend* fe, struct dvb_frontend_parameters *p) | 900 | static int cx24123_set_frontend(struct dvb_frontend *fe, |
901 | struct dvb_frontend_parameters *p) | ||
847 | { | 902 | { |
848 | struct cx24123_state *state = fe->demodulator_priv; | 903 | struct cx24123_state *state = fe->demodulator_priv; |
849 | 904 | ||
850 | dprintk("%s: set_frontend\n",__FUNCTION__); | 905 | dprintk("\n"); |
851 | 906 | ||
852 | if (state->config->set_ts_params) | 907 | if (state->config->set_ts_params) |
853 | state->config->set_ts_params(fe, 0); | 908 | state->config->set_ts_params(fe, 0); |
@@ -858,13 +913,22 @@ static int cx24123_set_frontend(struct dvb_frontend* fe, struct dvb_frontend_par | |||
858 | cx24123_set_inversion(state, p->inversion); | 913 | cx24123_set_inversion(state, p->inversion); |
859 | cx24123_set_fec(state, p->u.qpsk.fec_inner); | 914 | cx24123_set_fec(state, p->u.qpsk.fec_inner); |
860 | cx24123_set_symbolrate(state, p->u.qpsk.symbol_rate); | 915 | cx24123_set_symbolrate(state, p->u.qpsk.symbol_rate); |
861 | cx24123_pll_tune(fe, p); | 916 | |
917 | if (!state->config->dont_use_pll) | ||
918 | cx24123_pll_tune(fe, p); | ||
919 | else if (fe->ops.tuner_ops.set_params) | ||
920 | fe->ops.tuner_ops.set_params(fe, p); | ||
921 | else | ||
922 | err("it seems I don't have a tuner..."); | ||
862 | 923 | ||
863 | /* Enable automatic aquisition and reset cycle */ | 924 | /* Enable automatic aquisition and reset cycle */ |
864 | cx24123_writereg(state, 0x03, (cx24123_readreg(state, 0x03) | 0x07)); | 925 | cx24123_writereg(state, 0x03, (cx24123_readreg(state, 0x03) | 0x07)); |
865 | cx24123_writereg(state, 0x00, 0x10); | 926 | cx24123_writereg(state, 0x00, 0x10); |
866 | cx24123_writereg(state, 0x00, 0); | 927 | cx24123_writereg(state, 0x00, 0); |
867 | 928 | ||
929 | if (state->config->agc_callback) | ||
930 | state->config->agc_callback(fe); | ||
931 | |||
868 | return 0; | 932 | return 0; |
869 | } | 933 | } |
870 | 934 | ||
@@ -872,14 +936,14 @@ static int cx24123_get_frontend(struct dvb_frontend* fe, struct dvb_frontend_par | |||
872 | { | 936 | { |
873 | struct cx24123_state *state = fe->demodulator_priv; | 937 | struct cx24123_state *state = fe->demodulator_priv; |
874 | 938 | ||
875 | dprintk("%s: get_frontend\n",__FUNCTION__); | 939 | dprintk("\n"); |
876 | 940 | ||
877 | if (cx24123_get_inversion(state, &p->inversion) != 0) { | 941 | if (cx24123_get_inversion(state, &p->inversion) != 0) { |
878 | printk("%s: Failed to get inversion status\n",__FUNCTION__); | 942 | err("%s: Failed to get inversion status\n", __func__); |
879 | return -EREMOTEIO; | 943 | return -EREMOTEIO; |
880 | } | 944 | } |
881 | if (cx24123_get_fec(state, &p->u.qpsk.fec_inner) != 0) { | 945 | if (cx24123_get_fec(state, &p->u.qpsk.fec_inner) != 0) { |
882 | printk("%s: Failed to get fec status\n",__FUNCTION__); | 946 | err("%s: Failed to get fec status\n", __func__); |
883 | return -EREMOTEIO; | 947 | return -EREMOTEIO; |
884 | } | 948 | } |
885 | p->frequency = state->currentfreq; | 949 | p->frequency = state->currentfreq; |
@@ -900,13 +964,13 @@ static int cx24123_set_tone(struct dvb_frontend* fe, fe_sec_tone_mode_t tone) | |||
900 | 964 | ||
901 | switch (tone) { | 965 | switch (tone) { |
902 | case SEC_TONE_ON: | 966 | case SEC_TONE_ON: |
903 | dprintk("%s: setting tone on\n", __FUNCTION__); | 967 | dprintk("setting tone on\n"); |
904 | return cx24123_writereg(state, 0x29, val | 0x10); | 968 | return cx24123_writereg(state, 0x29, val | 0x10); |
905 | case SEC_TONE_OFF: | 969 | case SEC_TONE_OFF: |
906 | dprintk("%s: setting tone off\n",__FUNCTION__); | 970 | dprintk("setting tone off\n"); |
907 | return cx24123_writereg(state, 0x29, val & 0xef); | 971 | return cx24123_writereg(state, 0x29, val & 0xef); |
908 | default: | 972 | default: |
909 | printk("%s: CASE reached default with tone=%d\n", __FUNCTION__, tone); | 973 | err("CASE reached default with tone=%d\n", tone); |
910 | return -EINVAL; | 974 | return -EINVAL; |
911 | } | 975 | } |
912 | 976 | ||
@@ -939,47 +1003,86 @@ static int cx24123_get_algo(struct dvb_frontend *fe) | |||
939 | static void cx24123_release(struct dvb_frontend* fe) | 1003 | static void cx24123_release(struct dvb_frontend* fe) |
940 | { | 1004 | { |
941 | struct cx24123_state* state = fe->demodulator_priv; | 1005 | struct cx24123_state* state = fe->demodulator_priv; |
942 | dprintk("%s\n",__FUNCTION__); | 1006 | dprintk("\n"); |
1007 | i2c_del_adapter(&state->tuner_i2c_adapter); | ||
943 | kfree(state); | 1008 | kfree(state); |
944 | } | 1009 | } |
945 | 1010 | ||
1011 | static int cx24123_tuner_i2c_tuner_xfer(struct i2c_adapter *i2c_adap, | ||
1012 | struct i2c_msg msg[], int num) | ||
1013 | { | ||
1014 | struct cx24123_state *state = i2c_get_adapdata(i2c_adap); | ||
1015 | /* this repeater closes after the first stop */ | ||
1016 | cx24123_repeater_mode(state, 1, 1); | ||
1017 | return i2c_transfer(state->i2c, msg, num); | ||
1018 | } | ||
1019 | |||
1020 | static u32 cx24123_tuner_i2c_func(struct i2c_adapter *adapter) | ||
1021 | { | ||
1022 | return I2C_FUNC_I2C; | ||
1023 | } | ||
1024 | |||
1025 | static struct i2c_algorithm cx24123_tuner_i2c_algo = { | ||
1026 | .master_xfer = cx24123_tuner_i2c_tuner_xfer, | ||
1027 | .functionality = cx24123_tuner_i2c_func, | ||
1028 | }; | ||
1029 | |||
1030 | struct i2c_adapter * | ||
1031 | cx24123_get_tuner_i2c_adapter(struct dvb_frontend *fe) | ||
1032 | { | ||
1033 | struct cx24123_state *state = fe->demodulator_priv; | ||
1034 | return &state->tuner_i2c_adapter; | ||
1035 | } | ||
1036 | EXPORT_SYMBOL(cx24123_get_tuner_i2c_adapter); | ||
1037 | |||
946 | static struct dvb_frontend_ops cx24123_ops; | 1038 | static struct dvb_frontend_ops cx24123_ops; |
947 | 1039 | ||
948 | struct dvb_frontend* cx24123_attach(const struct cx24123_config* config, | 1040 | struct dvb_frontend* cx24123_attach(const struct cx24123_config* config, |
949 | struct i2c_adapter* i2c) | 1041 | struct i2c_adapter* i2c) |
950 | { | 1042 | { |
951 | struct cx24123_state* state = NULL; | 1043 | struct cx24123_state *state = |
952 | int ret; | 1044 | kzalloc(sizeof(struct cx24123_state), GFP_KERNEL); |
953 | |||
954 | dprintk("%s\n",__FUNCTION__); | ||
955 | 1045 | ||
1046 | dprintk("\n"); | ||
956 | /* allocate memory for the internal state */ | 1047 | /* allocate memory for the internal state */ |
957 | state = kmalloc(sizeof(struct cx24123_state), GFP_KERNEL); | ||
958 | if (state == NULL) { | 1048 | if (state == NULL) { |
959 | printk("Unable to kmalloc\n"); | 1049 | err("Unable to kmalloc\n"); |
960 | goto error; | 1050 | goto error; |
961 | } | 1051 | } |
962 | 1052 | ||
963 | /* setup the state */ | 1053 | /* setup the state */ |
964 | state->config = config; | 1054 | state->config = config; |
965 | state->i2c = i2c; | 1055 | state->i2c = i2c; |
966 | state->VCAarg = 0; | ||
967 | state->VGAarg = 0; | ||
968 | state->bandselectarg = 0; | ||
969 | state->pllarg = 0; | ||
970 | state->currentfreq = 0; | ||
971 | state->currentsymbolrate = 0; | ||
972 | 1056 | ||
973 | /* check if the demod is there */ | 1057 | /* check if the demod is there */ |
974 | ret = cx24123_readreg(state, 0x00); | 1058 | state->demod_rev = cx24123_readreg(state, 0x00); |
975 | if ((ret != 0xd1) && (ret != 0xe1)) { | 1059 | switch (state->demod_rev) { |
976 | printk("Version != d1 or e1\n"); | 1060 | case 0xe1: info("detected CX24123C\n"); break; |
1061 | case 0xd1: info("detected CX24123\n"); break; | ||
1062 | default: | ||
1063 | err("wrong demod revision: %x\n", state->demod_rev); | ||
977 | goto error; | 1064 | goto error; |
978 | } | 1065 | } |
979 | 1066 | ||
980 | /* create dvb_frontend */ | 1067 | /* create dvb_frontend */ |
981 | memcpy(&state->frontend.ops, &cx24123_ops, sizeof(struct dvb_frontend_ops)); | 1068 | memcpy(&state->frontend.ops, &cx24123_ops, sizeof(struct dvb_frontend_ops)); |
982 | state->frontend.demodulator_priv = state; | 1069 | state->frontend.demodulator_priv = state; |
1070 | |||
1071 | /* create tuner i2c adapter */ | ||
1072 | if (config->dont_use_pll) | ||
1073 | cx24123_repeater_mode(state, 1, 0); | ||
1074 | |||
1075 | strncpy(state->tuner_i2c_adapter.name, | ||
1076 | "CX24123 tuner I2C bus", I2C_NAME_SIZE); | ||
1077 | state->tuner_i2c_adapter.class = I2C_CLASS_TV_DIGITAL, | ||
1078 | state->tuner_i2c_adapter.algo = &cx24123_tuner_i2c_algo; | ||
1079 | state->tuner_i2c_adapter.algo_data = NULL; | ||
1080 | i2c_set_adapdata(&state->tuner_i2c_adapter, state); | ||
1081 | if (i2c_add_adapter(&state->tuner_i2c_adapter) < 0) { | ||
1082 | err("tuner i2c bus could not be initialized\n"); | ||
1083 | goto error; | ||
1084 | } | ||
1085 | |||
983 | return &state->frontend; | 1086 | return &state->frontend; |
984 | 1087 | ||
985 | error: | 1088 | error: |
@@ -1029,7 +1132,8 @@ MODULE_PARM_DESC(debug, "Activates frontend debugging (default:0)"); | |||
1029 | module_param(force_band, int, 0644); | 1132 | module_param(force_band, int, 0644); |
1030 | MODULE_PARM_DESC(force_band, "Force a specific band select (1-9, default:off)."); | 1133 | MODULE_PARM_DESC(force_band, "Force a specific band select (1-9, default:off)."); |
1031 | 1134 | ||
1032 | MODULE_DESCRIPTION("DVB Frontend module for Conexant cx24123/cx24109 hardware"); | 1135 | MODULE_DESCRIPTION("DVB Frontend module for Conexant " \ |
1136 | "CX24123/CX24109/CX24113 hardware"); | ||
1033 | MODULE_AUTHOR("Steven Toth"); | 1137 | MODULE_AUTHOR("Steven Toth"); |
1034 | MODULE_LICENSE("GPL"); | 1138 | MODULE_LICENSE("GPL"); |
1035 | 1139 | ||
diff --git a/drivers/media/dvb/frontends/cx24123.h b/drivers/media/dvb/frontends/cx24123.h index 84f9e4f5c15e..81ebc3d2f19f 100644 --- a/drivers/media/dvb/frontends/cx24123.h +++ b/drivers/media/dvb/frontends/cx24123.h | |||
@@ -33,16 +33,27 @@ struct cx24123_config | |||
33 | 33 | ||
34 | /* 0 = LNB voltage normal, 1 = LNB voltage inverted */ | 34 | /* 0 = LNB voltage normal, 1 = LNB voltage inverted */ |
35 | int lnb_polarity; | 35 | int lnb_polarity; |
36 | |||
37 | /* this device has another tuner */ | ||
38 | u8 dont_use_pll; | ||
39 | void (*agc_callback) (struct dvb_frontend *); | ||
36 | }; | 40 | }; |
37 | 41 | ||
38 | #if defined(CONFIG_DVB_CX24123) || (defined(CONFIG_DVB_CX24123_MODULE) && defined(MODULE)) | 42 | #if defined(CONFIG_DVB_CX24123) || (defined(CONFIG_DVB_CX24123_MODULE) && defined(MODULE)) |
39 | extern struct dvb_frontend* cx24123_attach(const struct cx24123_config* config, | 43 | extern struct dvb_frontend *cx24123_attach(const struct cx24123_config *config, |
40 | struct i2c_adapter* i2c); | 44 | struct i2c_adapter *i2c); |
45 | extern struct i2c_adapter *cx24123_get_tuner_i2c_adapter(struct dvb_frontend *); | ||
41 | #else | 46 | #else |
42 | static inline struct dvb_frontend* cx24123_attach(const struct cx24123_config* config, | 47 | static inline struct dvb_frontend *cx24123_attach( |
43 | struct i2c_adapter* i2c) | 48 | const struct cx24123_config *config, struct i2c_adapter *i2c) |
49 | { | ||
50 | printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__); | ||
51 | return NULL; | ||
52 | } | ||
53 | static struct i2c_adapter * | ||
54 | cx24123_get_tuner_i2c_adapter(struct dvb_frontend *fe) | ||
44 | { | 55 | { |
45 | printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __FUNCTION__); | 56 | printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__); |
46 | return NULL; | 57 | return NULL; |
47 | } | 58 | } |
48 | #endif // CONFIG_DVB_CX24123 | 59 | #endif // CONFIG_DVB_CX24123 |
diff --git a/drivers/media/dvb/frontends/dib3000.h b/drivers/media/dvb/frontends/dib3000.h index a6d3854a67bc..ba917359fa65 100644 --- a/drivers/media/dvb/frontends/dib3000.h +++ b/drivers/media/dvb/frontends/dib3000.h | |||
@@ -48,7 +48,7 @@ extern struct dvb_frontend* dib3000mb_attach(const struct dib3000_config* config | |||
48 | static inline struct dvb_frontend* dib3000mb_attach(const struct dib3000_config* config, | 48 | static inline struct dvb_frontend* dib3000mb_attach(const struct dib3000_config* config, |
49 | struct i2c_adapter* i2c, struct dib_fe_xfer_ops *xfer_ops) | 49 | struct i2c_adapter* i2c, struct dib_fe_xfer_ops *xfer_ops) |
50 | { | 50 | { |
51 | printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __FUNCTION__); | 51 | printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__); |
52 | return NULL; | 52 | return NULL; |
53 | } | 53 | } |
54 | #endif // CONFIG_DVB_DIB3000MB | 54 | #endif // CONFIG_DVB_DIB3000MB |
diff --git a/drivers/media/dvb/frontends/dib3000mc.h b/drivers/media/dvb/frontends/dib3000mc.h index 72d4757601d8..4142ed7a47d0 100644 --- a/drivers/media/dvb/frontends/dib3000mc.h +++ b/drivers/media/dvb/frontends/dib3000mc.h | |||
@@ -44,7 +44,7 @@ extern struct dvb_frontend * dib3000mc_attach(struct i2c_adapter *i2c_adap, u8 i | |||
44 | #else | 44 | #else |
45 | static inline struct dvb_frontend * dib3000mc_attach(struct i2c_adapter *i2c_adap, u8 i2c_addr, struct dib3000mc_config *cfg) | 45 | static inline struct dvb_frontend * dib3000mc_attach(struct i2c_adapter *i2c_adap, u8 i2c_addr, struct dib3000mc_config *cfg) |
46 | { | 46 | { |
47 | printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __FUNCTION__); | 47 | printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__); |
48 | return NULL; | 48 | return NULL; |
49 | } | 49 | } |
50 | #endif // CONFIG_DVB_DIB3000MC | 50 | #endif // CONFIG_DVB_DIB3000MC |
diff --git a/drivers/media/dvb/frontends/dib7000p.c b/drivers/media/dvb/frontends/dib7000p.c index 47c23e29753e..1a0142e0d741 100644 --- a/drivers/media/dvb/frontends/dib7000p.c +++ b/drivers/media/dvb/frontends/dib7000p.c | |||
@@ -1168,7 +1168,7 @@ static int dib7000p_set_frontend(struct dvb_frontend* fe, | |||
1168 | ret = dib7000p_tune(fe, fep); | 1168 | ret = dib7000p_tune(fe, fep); |
1169 | 1169 | ||
1170 | /* make this a config parameter */ | 1170 | /* make this a config parameter */ |
1171 | dib7000p_set_output_mode(state, OUTMODE_MPEG2_FIFO); | 1171 | dib7000p_set_output_mode(state, state->cfg.output_mode); |
1172 | return ret; | 1172 | return ret; |
1173 | } | 1173 | } |
1174 | 1174 | ||
@@ -1330,6 +1330,12 @@ struct dvb_frontend * dib7000p_attach(struct i2c_adapter *i2c_adap, u8 i2c_addr, | |||
1330 | st->gpio_val = cfg->gpio_val; | 1330 | st->gpio_val = cfg->gpio_val; |
1331 | st->gpio_dir = cfg->gpio_dir; | 1331 | st->gpio_dir = cfg->gpio_dir; |
1332 | 1332 | ||
1333 | /* Ensure the output mode remains at the previous default if it's | ||
1334 | * not specifically set by the caller. | ||
1335 | */ | ||
1336 | if (st->cfg.output_mode != OUTMODE_MPEG2_SERIAL) | ||
1337 | st->cfg.output_mode = OUTMODE_MPEG2_FIFO; | ||
1338 | |||
1333 | demod = &st->demod; | 1339 | demod = &st->demod; |
1334 | demod->demodulator_priv = st; | 1340 | demod->demodulator_priv = st; |
1335 | memcpy(&st->demod.ops, &dib7000p_ops, sizeof(struct dvb_frontend_ops)); | 1341 | memcpy(&st->demod.ops, &dib7000p_ops, sizeof(struct dvb_frontend_ops)); |
diff --git a/drivers/media/dvb/frontends/dib7000p.h b/drivers/media/dvb/frontends/dib7000p.h index eefcac8b5244..081bd81f3da2 100644 --- a/drivers/media/dvb/frontends/dib7000p.h +++ b/drivers/media/dvb/frontends/dib7000p.h | |||
@@ -31,6 +31,8 @@ struct dib7000p_config { | |||
31 | u8 spur_protect; | 31 | u8 spur_protect; |
32 | 32 | ||
33 | int (*agc_control) (struct dvb_frontend *, u8 before); | 33 | int (*agc_control) (struct dvb_frontend *, u8 before); |
34 | |||
35 | u8 output_mode; | ||
34 | }; | 36 | }; |
35 | 37 | ||
36 | #define DEFAULT_DIB7000P_I2C_ADDRESS 18 | 38 | #define DEFAULT_DIB7000P_I2C_ADDRESS 18 |
diff --git a/drivers/media/dvb/frontends/dvb-pll.c b/drivers/media/dvb/frontends/dvb-pll.c index 8c8d7342d0b3..a054894ff481 100644 --- a/drivers/media/dvb/frontends/dvb-pll.c +++ b/drivers/media/dvb/frontends/dvb-pll.c | |||
@@ -44,14 +44,10 @@ struct dvb_pll_priv { | |||
44 | 44 | ||
45 | static unsigned int dvb_pll_devcount; | 45 | static unsigned int dvb_pll_devcount; |
46 | 46 | ||
47 | static int debug = 0; | 47 | static int debug; |
48 | module_param(debug, int, 0644); | 48 | module_param(debug, int, 0644); |
49 | MODULE_PARM_DESC(debug, "enable verbose debug messages"); | 49 | MODULE_PARM_DESC(debug, "enable verbose debug messages"); |
50 | 50 | ||
51 | static unsigned int input[DVB_PLL_MAX] = { [ 0 ... (DVB_PLL_MAX-1) ] = 0 }; | ||
52 | module_param_array(input, int, NULL, 0644); | ||
53 | MODULE_PARM_DESC(input,"specify rf input choice, 0 for autoselect (default)"); | ||
54 | |||
55 | static unsigned int id[DVB_PLL_MAX] = | 51 | static unsigned int id[DVB_PLL_MAX] = |
56 | { [ 0 ... (DVB_PLL_MAX-1) ] = DVB_PLL_UNDEFINED }; | 52 | { [ 0 ... (DVB_PLL_MAX-1) ] = DVB_PLL_UNDEFINED }; |
57 | module_param_array(id, int, NULL, 0644); | 53 | module_param_array(id, int, NULL, 0644); |
@@ -80,23 +76,6 @@ struct dvb_pll_desc { | |||
80 | /* ----------------------------------------------------------- */ | 76 | /* ----------------------------------------------------------- */ |
81 | /* descriptions */ | 77 | /* descriptions */ |
82 | 78 | ||
83 | /* Set AGC TOP value to 103 dBuV: | ||
84 | 0x80 = Control Byte | ||
85 | 0x40 = 250 uA charge pump (irrelevant) | ||
86 | 0x18 = Aux Byte to follow | ||
87 | 0x06 = 64.5 kHz divider (irrelevant) | ||
88 | 0x01 = Disable Vt (aka sleep) | ||
89 | |||
90 | 0x00 = AGC Time constant 2s Iagc = 300 nA (vs 0x80 = 9 nA) | ||
91 | 0x50 = AGC Take over point = 103 dBuV */ | ||
92 | static u8 tua603x_agc103[] = { 2, 0x80|0x40|0x18|0x06|0x01, 0x00|0x50 }; | ||
93 | |||
94 | /* 0x04 = 166.67 kHz divider | ||
95 | |||
96 | 0x80 = AGC Time constant 50ms Iagc = 9 uA | ||
97 | 0x20 = AGC Take over point = 112 dBuV */ | ||
98 | static u8 tua603x_agc112[] = { 2, 0x80|0x40|0x18|0x04|0x01, 0x80|0x20 }; | ||
99 | |||
100 | static struct dvb_pll_desc dvb_pll_thomson_dtt7579 = { | 79 | static struct dvb_pll_desc dvb_pll_thomson_dtt7579 = { |
101 | .name = "Thomson dtt7579", | 80 | .name = "Thomson dtt7579", |
102 | .min = 177000000, | 81 | .min = 177000000, |
@@ -112,19 +91,6 @@ static struct dvb_pll_desc dvb_pll_thomson_dtt7579 = { | |||
112 | }, | 91 | }, |
113 | }; | 92 | }; |
114 | 93 | ||
115 | static struct dvb_pll_desc dvb_pll_thomson_dtt7610 = { | ||
116 | .name = "Thomson dtt7610", | ||
117 | .min = 44000000, | ||
118 | .max = 958000000, | ||
119 | .iffreq= 44000000, | ||
120 | .count = 3, | ||
121 | .entries = { | ||
122 | { 157250000, 62500, 0x8e, 0x39 }, | ||
123 | { 454000000, 62500, 0x8e, 0x3a }, | ||
124 | { 999999999, 62500, 0x8e, 0x3c }, | ||
125 | }, | ||
126 | }; | ||
127 | |||
128 | static void thomson_dtt759x_bw(struct dvb_frontend *fe, u8 *buf, | 94 | static void thomson_dtt759x_bw(struct dvb_frontend *fe, u8 *buf, |
129 | const struct dvb_frontend_parameters *params) | 95 | const struct dvb_frontend_parameters *params) |
130 | { | 96 | { |
@@ -165,34 +131,6 @@ static struct dvb_pll_desc dvb_pll_lg_z201 = { | |||
165 | }, | 131 | }, |
166 | }; | 132 | }; |
167 | 133 | ||
168 | static struct dvb_pll_desc dvb_pll_microtune_4042 = { | ||
169 | .name = "Microtune 4042 FI5", | ||
170 | .min = 57000000, | ||
171 | .max = 858000000, | ||
172 | .iffreq= 44000000, | ||
173 | .count = 3, | ||
174 | .entries = { | ||
175 | { 162000000, 62500, 0x8e, 0xa1 }, | ||
176 | { 457000000, 62500, 0x8e, 0x91 }, | ||
177 | { 999999999, 62500, 0x8e, 0x31 }, | ||
178 | }, | ||
179 | }; | ||
180 | |||
181 | static struct dvb_pll_desc dvb_pll_thomson_dtt761x = { | ||
182 | /* DTT 7611 7611A 7612 7613 7613A 7614 7615 7615A */ | ||
183 | .name = "Thomson dtt761x", | ||
184 | .min = 57000000, | ||
185 | .max = 863000000, | ||
186 | .iffreq= 44000000, | ||
187 | .count = 3, | ||
188 | .initdata = tua603x_agc103, | ||
189 | .entries = { | ||
190 | { 147000000, 62500, 0x8e, 0x39 }, | ||
191 | { 417000000, 62500, 0x8e, 0x3a }, | ||
192 | { 999999999, 62500, 0x8e, 0x3c }, | ||
193 | }, | ||
194 | }; | ||
195 | |||
196 | static struct dvb_pll_desc dvb_pll_unknown_1 = { | 134 | static struct dvb_pll_desc dvb_pll_unknown_1 = { |
197 | .name = "unknown 1", /* used by dntv live dvb-t */ | 135 | .name = "unknown 1", /* used by dntv live dvb-t */ |
198 | .min = 174000000, | 136 | .min = 174000000, |
@@ -301,54 +239,6 @@ static struct dvb_pll_desc dvb_pll_tua6034 = { | |||
301 | }, | 239 | }, |
302 | }; | 240 | }; |
303 | 241 | ||
304 | /* Infineon TUA6034 | ||
305 | * used in LG TDVS-H061F, LG TDVS-H062F and LG TDVS-H064F | ||
306 | */ | ||
307 | static struct dvb_pll_desc dvb_pll_lg_tdvs_h06xf = { | ||
308 | .name = "LG TDVS-H06xF", | ||
309 | .min = 54000000, | ||
310 | .max = 863000000, | ||
311 | .iffreq= 44000000, | ||
312 | .initdata = tua603x_agc103, | ||
313 | .count = 3, | ||
314 | .entries = { | ||
315 | { 165000000, 62500, 0xce, 0x01 }, | ||
316 | { 450000000, 62500, 0xce, 0x02 }, | ||
317 | { 999999999, 62500, 0xce, 0x04 }, | ||
318 | }, | ||
319 | }; | ||
320 | |||
321 | /* Philips FMD1216ME | ||
322 | * used in Medion Hybrid PCMCIA card and USB Box | ||
323 | */ | ||
324 | static void fmd1216me_bw(struct dvb_frontend *fe, u8 *buf, | ||
325 | const struct dvb_frontend_parameters *params) | ||
326 | { | ||
327 | if (params->u.ofdm.bandwidth == BANDWIDTH_8_MHZ && | ||
328 | params->frequency >= 158870000) | ||
329 | buf[3] |= 0x08; | ||
330 | } | ||
331 | |||
332 | static struct dvb_pll_desc dvb_pll_fmd1216me = { | ||
333 | .name = "Philips FMD1216ME", | ||
334 | .min = 50870000, | ||
335 | .max = 858000000, | ||
336 | .iffreq= 36125000, | ||
337 | .set = fmd1216me_bw, | ||
338 | .initdata = tua603x_agc112, | ||
339 | .sleepdata = (u8[]){ 4, 0x9c, 0x60, 0x85, 0x54 }, | ||
340 | .count = 7, | ||
341 | .entries = { | ||
342 | { 143870000, 166667, 0xbc, 0x41 }, | ||
343 | { 158870000, 166667, 0xf4, 0x41 }, | ||
344 | { 329870000, 166667, 0xbc, 0x42 }, | ||
345 | { 441870000, 166667, 0xf4, 0x42 }, | ||
346 | { 625870000, 166667, 0xbc, 0x44 }, | ||
347 | { 803870000, 166667, 0xf4, 0x44 }, | ||
348 | { 999999999, 166667, 0xfc, 0x44 }, | ||
349 | } | ||
350 | }; | ||
351 | |||
352 | /* ALPS TDED4 | 242 | /* ALPS TDED4 |
353 | * used in Nebula-Cards and USB boxes | 243 | * used in Nebula-Cards and USB boxes |
354 | */ | 244 | */ |
@@ -391,55 +281,6 @@ static struct dvb_pll_desc dvb_pll_tdhu2 = { | |||
391 | } | 281 | } |
392 | }; | 282 | }; |
393 | 283 | ||
394 | /* Philips TUV1236D | ||
395 | * used in ATI HDTV Wonder | ||
396 | */ | ||
397 | static void tuv1236d_rf(struct dvb_frontend *fe, u8 *buf, | ||
398 | const struct dvb_frontend_parameters *params) | ||
399 | { | ||
400 | struct dvb_pll_priv *priv = fe->tuner_priv; | ||
401 | unsigned int new_rf = input[priv->nr]; | ||
402 | |||
403 | if ((new_rf == 0) || (new_rf > 2)) { | ||
404 | switch (params->u.vsb.modulation) { | ||
405 | case QAM_64: | ||
406 | case QAM_256: | ||
407 | new_rf = 1; | ||
408 | break; | ||
409 | case VSB_8: | ||
410 | default: | ||
411 | new_rf = 2; | ||
412 | } | ||
413 | } | ||
414 | |||
415 | switch (new_rf) { | ||
416 | case 1: | ||
417 | buf[3] |= 0x08; | ||
418 | break; | ||
419 | case 2: | ||
420 | buf[3] &= ~0x08; | ||
421 | break; | ||
422 | default: | ||
423 | printk(KERN_WARNING | ||
424 | "%s: unhandled rf input selection: %d", | ||
425 | __FUNCTION__, new_rf); | ||
426 | } | ||
427 | } | ||
428 | |||
429 | static struct dvb_pll_desc dvb_pll_tuv1236d = { | ||
430 | .name = "Philips TUV1236D", | ||
431 | .min = 54000000, | ||
432 | .max = 864000000, | ||
433 | .iffreq= 44000000, | ||
434 | .set = tuv1236d_rf, | ||
435 | .count = 3, | ||
436 | .entries = { | ||
437 | { 157250000, 62500, 0xc6, 0x41 }, | ||
438 | { 454000000, 62500, 0xc6, 0x42 }, | ||
439 | { 999999999, 62500, 0xc6, 0x44 }, | ||
440 | }, | ||
441 | }; | ||
442 | |||
443 | /* Samsung TBMV30111IN / TBMV30712IN1 | 284 | /* Samsung TBMV30111IN / TBMV30712IN1 |
444 | * used in Air2PC ATSC - 2nd generation (nxt2002) | 285 | * used in Air2PC ATSC - 2nd generation (nxt2002) |
445 | */ | 286 | */ |
@@ -476,64 +317,6 @@ static struct dvb_pll_desc dvb_pll_philips_sd1878_tda8261 = { | |||
476 | }, | 317 | }, |
477 | }; | 318 | }; |
478 | 319 | ||
479 | /* | ||
480 | * Philips TD1316 Tuner. | ||
481 | */ | ||
482 | static void td1316_bw(struct dvb_frontend *fe, u8 *buf, | ||
483 | const struct dvb_frontend_parameters *params) | ||
484 | { | ||
485 | u8 band; | ||
486 | |||
487 | /* determine band */ | ||
488 | if (params->frequency < 161000000) | ||
489 | band = 1; | ||
490 | else if (params->frequency < 444000000) | ||
491 | band = 2; | ||
492 | else | ||
493 | band = 4; | ||
494 | |||
495 | buf[3] |= band; | ||
496 | |||
497 | /* setup PLL filter */ | ||
498 | if (params->u.ofdm.bandwidth == BANDWIDTH_8_MHZ) | ||
499 | buf[3] |= 1 << 3; | ||
500 | } | ||
501 | |||
502 | static struct dvb_pll_desc dvb_pll_philips_td1316 = { | ||
503 | .name = "Philips TD1316", | ||
504 | .min = 87000000, | ||
505 | .max = 895000000, | ||
506 | .iffreq= 36166667, | ||
507 | .set = td1316_bw, | ||
508 | .count = 9, | ||
509 | .entries = { | ||
510 | { 93834000, 166667, 0xca, 0x60}, | ||
511 | { 123834000, 166667, 0xca, 0xa0}, | ||
512 | { 163834000, 166667, 0xca, 0xc0}, | ||
513 | { 253834000, 166667, 0xca, 0x60}, | ||
514 | { 383834000, 166667, 0xca, 0xa0}, | ||
515 | { 443834000, 166667, 0xca, 0xc0}, | ||
516 | { 583834000, 166667, 0xca, 0x60}, | ||
517 | { 793834000, 166667, 0xca, 0xa0}, | ||
518 | { 858834000, 166667, 0xca, 0xe0}, | ||
519 | }, | ||
520 | }; | ||
521 | |||
522 | /* FE6600 used on DViCO Hybrid */ | ||
523 | static struct dvb_pll_desc dvb_pll_thomson_fe6600 = { | ||
524 | .name = "Thomson FE6600", | ||
525 | .min = 44250000, | ||
526 | .max = 858000000, | ||
527 | .iffreq= 36125000, | ||
528 | .count = 4, | ||
529 | .entries = { | ||
530 | { 250000000, 166667, 0xb4, 0x12 }, | ||
531 | { 455000000, 166667, 0xfe, 0x11 }, | ||
532 | { 775500000, 166667, 0xbc, 0x18 }, | ||
533 | { 999999999, 166667, 0xf4, 0x18 }, | ||
534 | } | ||
535 | }; | ||
536 | |||
537 | static void opera1_bw(struct dvb_frontend *fe, u8 *buf, | 320 | static void opera1_bw(struct dvb_frontend *fe, u8 *buf, |
538 | const struct dvb_frontend_parameters *params) | 321 | const struct dvb_frontend_parameters *params) |
539 | { | 322 | { |
@@ -560,50 +343,23 @@ static struct dvb_pll_desc dvb_pll_opera1 = { | |||
560 | } | 343 | } |
561 | }; | 344 | }; |
562 | 345 | ||
563 | /* Philips FCV1236D | ||
564 | */ | ||
565 | static struct dvb_pll_desc dvb_pll_fcv1236d = { | ||
566 | /* Bit_0: RF Input select | ||
567 | * Bit_1: 0=digital, 1=analog | ||
568 | */ | ||
569 | .name = "Philips FCV1236D", | ||
570 | .min = 53000000, | ||
571 | .max = 803000000, | ||
572 | .iffreq= 44000000, | ||
573 | .count = 3, | ||
574 | .entries = { | ||
575 | { 159000000, 62500, 0x8e, 0xa0 }, | ||
576 | { 453000000, 62500, 0x8e, 0x90 }, | ||
577 | { 999999999, 62500, 0x8e, 0x30 }, | ||
578 | }, | ||
579 | }; | ||
580 | |||
581 | /* ----------------------------------------------------------- */ | 346 | /* ----------------------------------------------------------- */ |
582 | 347 | ||
583 | static struct dvb_pll_desc *pll_list[] = { | 348 | static struct dvb_pll_desc *pll_list[] = { |
584 | [DVB_PLL_UNDEFINED] = NULL, | 349 | [DVB_PLL_UNDEFINED] = NULL, |
585 | [DVB_PLL_THOMSON_DTT7579] = &dvb_pll_thomson_dtt7579, | 350 | [DVB_PLL_THOMSON_DTT7579] = &dvb_pll_thomson_dtt7579, |
586 | [DVB_PLL_THOMSON_DTT759X] = &dvb_pll_thomson_dtt759x, | 351 | [DVB_PLL_THOMSON_DTT759X] = &dvb_pll_thomson_dtt759x, |
587 | [DVB_PLL_THOMSON_DTT7610] = &dvb_pll_thomson_dtt7610, | ||
588 | [DVB_PLL_LG_Z201] = &dvb_pll_lg_z201, | 352 | [DVB_PLL_LG_Z201] = &dvb_pll_lg_z201, |
589 | [DVB_PLL_MICROTUNE_4042] = &dvb_pll_microtune_4042, | ||
590 | [DVB_PLL_THOMSON_DTT761X] = &dvb_pll_thomson_dtt761x, | ||
591 | [DVB_PLL_UNKNOWN_1] = &dvb_pll_unknown_1, | 353 | [DVB_PLL_UNKNOWN_1] = &dvb_pll_unknown_1, |
592 | [DVB_PLL_TUA6010XS] = &dvb_pll_tua6010xs, | 354 | [DVB_PLL_TUA6010XS] = &dvb_pll_tua6010xs, |
593 | [DVB_PLL_ENV57H1XD5] = &dvb_pll_env57h1xd5, | 355 | [DVB_PLL_ENV57H1XD5] = &dvb_pll_env57h1xd5, |
594 | [DVB_PLL_TUA6034] = &dvb_pll_tua6034, | 356 | [DVB_PLL_TUA6034] = &dvb_pll_tua6034, |
595 | [DVB_PLL_LG_TDVS_H06XF] = &dvb_pll_lg_tdvs_h06xf, | ||
596 | [DVB_PLL_TDA665X] = &dvb_pll_tda665x, | 357 | [DVB_PLL_TDA665X] = &dvb_pll_tda665x, |
597 | [DVB_PLL_FMD1216ME] = &dvb_pll_fmd1216me, | ||
598 | [DVB_PLL_TDED4] = &dvb_pll_tded4, | 358 | [DVB_PLL_TDED4] = &dvb_pll_tded4, |
599 | [DVB_PLL_TUV1236D] = &dvb_pll_tuv1236d, | ||
600 | [DVB_PLL_TDHU2] = &dvb_pll_tdhu2, | 359 | [DVB_PLL_TDHU2] = &dvb_pll_tdhu2, |
601 | [DVB_PLL_SAMSUNG_TBMV] = &dvb_pll_samsung_tbmv, | 360 | [DVB_PLL_SAMSUNG_TBMV] = &dvb_pll_samsung_tbmv, |
602 | [DVB_PLL_PHILIPS_SD1878_TDA8261] = &dvb_pll_philips_sd1878_tda8261, | 361 | [DVB_PLL_PHILIPS_SD1878_TDA8261] = &dvb_pll_philips_sd1878_tda8261, |
603 | [DVB_PLL_PHILIPS_TD1316] = &dvb_pll_philips_td1316, | ||
604 | [DVB_PLL_THOMSON_FE6600] = &dvb_pll_thomson_fe6600, | ||
605 | [DVB_PLL_OPERA1] = &dvb_pll_opera1, | 362 | [DVB_PLL_OPERA1] = &dvb_pll_opera1, |
606 | [DVB_PLL_FCV1236D] = &dvb_pll_fcv1236d, | ||
607 | }; | 363 | }; |
608 | 364 | ||
609 | /* ----------------------------------------------------------- */ | 365 | /* ----------------------------------------------------------- */ |
@@ -849,20 +605,6 @@ struct dvb_frontend *dvb_pll_attach(struct dvb_frontend *fe, int pll_addr, | |||
849 | id[priv->nr] == pll_desc_id ? | 605 | id[priv->nr] == pll_desc_id ? |
850 | "insmod option" : "autodetected"); | 606 | "insmod option" : "autodetected"); |
851 | } | 607 | } |
852 | if ((debug) || (input[priv->nr] > 0)) { | ||
853 | printk("dvb-pll[%d]", priv->nr); | ||
854 | if (i2c != NULL) | ||
855 | printk(" %d-%04x", i2c_adapter_id(i2c), pll_addr); | ||
856 | printk(": tuner rf input will be "); | ||
857 | switch (input[priv->nr]) { | ||
858 | case 0: | ||
859 | printk("autoselected\n"); | ||
860 | break; | ||
861 | default: | ||
862 | printk("set to input %d (insmod option)\n", | ||
863 | input[priv->nr]); | ||
864 | } | ||
865 | } | ||
866 | 608 | ||
867 | return fe; | 609 | return fe; |
868 | } | 610 | } |
diff --git a/drivers/media/dvb/frontends/dvb-pll.h b/drivers/media/dvb/frontends/dvb-pll.h index e93a8104052b..872ca29e7cf3 100644 --- a/drivers/media/dvb/frontends/dvb-pll.h +++ b/drivers/media/dvb/frontends/dvb-pll.h | |||
@@ -11,26 +11,17 @@ | |||
11 | #define DVB_PLL_UNDEFINED 0 | 11 | #define DVB_PLL_UNDEFINED 0 |
12 | #define DVB_PLL_THOMSON_DTT7579 1 | 12 | #define DVB_PLL_THOMSON_DTT7579 1 |
13 | #define DVB_PLL_THOMSON_DTT759X 2 | 13 | #define DVB_PLL_THOMSON_DTT759X 2 |
14 | #define DVB_PLL_THOMSON_DTT7610 3 | 14 | #define DVB_PLL_LG_Z201 3 |
15 | #define DVB_PLL_LG_Z201 4 | 15 | #define DVB_PLL_UNKNOWN_1 4 |
16 | #define DVB_PLL_MICROTUNE_4042 5 | 16 | #define DVB_PLL_TUA6010XS 5 |
17 | #define DVB_PLL_THOMSON_DTT761X 6 | 17 | #define DVB_PLL_ENV57H1XD5 6 |
18 | #define DVB_PLL_UNKNOWN_1 7 | 18 | #define DVB_PLL_TUA6034 7 |
19 | #define DVB_PLL_TUA6010XS 8 | 19 | #define DVB_PLL_TDA665X 8 |
20 | #define DVB_PLL_ENV57H1XD5 9 | 20 | #define DVB_PLL_TDED4 9 |
21 | #define DVB_PLL_TUA6034 10 | 21 | #define DVB_PLL_TDHU2 10 |
22 | #define DVB_PLL_LG_TDVS_H06XF 11 | 22 | #define DVB_PLL_SAMSUNG_TBMV 11 |
23 | #define DVB_PLL_TDA665X 12 | 23 | #define DVB_PLL_PHILIPS_SD1878_TDA8261 12 |
24 | #define DVB_PLL_FMD1216ME 13 | 24 | #define DVB_PLL_OPERA1 13 |
25 | #define DVB_PLL_TDED4 14 | ||
26 | #define DVB_PLL_TUV1236D 15 | ||
27 | #define DVB_PLL_TDHU2 16 | ||
28 | #define DVB_PLL_SAMSUNG_TBMV 17 | ||
29 | #define DVB_PLL_PHILIPS_SD1878_TDA8261 18 | ||
30 | #define DVB_PLL_PHILIPS_TD1316 19 | ||
31 | #define DVB_PLL_THOMSON_FE6600 20 | ||
32 | #define DVB_PLL_OPERA1 21 | ||
33 | #define DVB_PLL_FCV1236D 22 | ||
34 | 25 | ||
35 | /** | 26 | /** |
36 | * Attach a dvb-pll to the supplied frontend structure. | 27 | * Attach a dvb-pll to the supplied frontend structure. |
@@ -52,7 +43,7 @@ static inline struct dvb_frontend *dvb_pll_attach(struct dvb_frontend *fe, | |||
52 | struct i2c_adapter *i2c, | 43 | struct i2c_adapter *i2c, |
53 | unsigned int pll_desc_id) | 44 | unsigned int pll_desc_id) |
54 | { | 45 | { |
55 | printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __FUNCTION__); | 46 | printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__); |
56 | return NULL; | 47 | return NULL; |
57 | } | 48 | } |
58 | #endif | 49 | #endif |
diff --git a/drivers/media/dvb/frontends/isl6405.c b/drivers/media/dvb/frontends/isl6405.c new file mode 100644 index 000000000000..33d33f4d8867 --- /dev/null +++ b/drivers/media/dvb/frontends/isl6405.c | |||
@@ -0,0 +1,164 @@ | |||
1 | /* | ||
2 | * isl6405.c - driver for dual lnb supply and control ic ISL6405 | ||
3 | * | ||
4 | * Copyright (C) 2008 Hartmut Hackmann | ||
5 | * Copyright (C) 2006 Oliver Endriss | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or | ||
8 | * modify it under the terms of the GNU General Public License | ||
9 | * as published by the Free Software Foundation; either version 2 | ||
10 | * of the License, or (at your option) any later version. | ||
11 | * | ||
12 | * | ||
13 | * This program is distributed in the hope that it will be useful, | ||
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
16 | * GNU General Public License for more details. | ||
17 | * | ||
18 | * | ||
19 | * You should have received a copy of the GNU General Public License | ||
20 | * along with this program; if not, write to the Free Software | ||
21 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||
22 | * Or, point your browser to http://www.gnu.org/copyleft/gpl.html | ||
23 | * | ||
24 | * | ||
25 | * the project's page is at http://www.linuxtv.org | ||
26 | */ | ||
27 | #include <linux/delay.h> | ||
28 | #include <linux/errno.h> | ||
29 | #include <linux/init.h> | ||
30 | #include <linux/kernel.h> | ||
31 | #include <linux/module.h> | ||
32 | #include <linux/string.h> | ||
33 | #include <linux/slab.h> | ||
34 | |||
35 | #include "dvb_frontend.h" | ||
36 | #include "isl6405.h" | ||
37 | |||
38 | struct isl6405 { | ||
39 | u8 config; | ||
40 | u8 override_or; | ||
41 | u8 override_and; | ||
42 | struct i2c_adapter *i2c; | ||
43 | u8 i2c_addr; | ||
44 | }; | ||
45 | |||
46 | static int isl6405_set_voltage(struct dvb_frontend *fe, fe_sec_voltage_t voltage) | ||
47 | { | ||
48 | struct isl6405 *isl6405 = (struct isl6405 *) fe->sec_priv; | ||
49 | struct i2c_msg msg = { .addr = isl6405->i2c_addr, .flags = 0, | ||
50 | .buf = &isl6405->config, | ||
51 | .len = sizeof(isl6405->config) }; | ||
52 | |||
53 | if (isl6405->override_or & 0x80) { | ||
54 | isl6405->config &= ~(ISL6405_VSEL2 | ISL6405_EN2); | ||
55 | switch (voltage) { | ||
56 | case SEC_VOLTAGE_OFF: | ||
57 | break; | ||
58 | case SEC_VOLTAGE_13: | ||
59 | isl6405->config |= ISL6405_EN2; | ||
60 | break; | ||
61 | case SEC_VOLTAGE_18: | ||
62 | isl6405->config |= (ISL6405_EN2 | ISL6405_VSEL2); | ||
63 | break; | ||
64 | default: | ||
65 | return -EINVAL; | ||
66 | } | ||
67 | } else { | ||
68 | isl6405->config &= ~(ISL6405_VSEL1 | ISL6405_EN1); | ||
69 | switch (voltage) { | ||
70 | case SEC_VOLTAGE_OFF: | ||
71 | break; | ||
72 | case SEC_VOLTAGE_13: | ||
73 | isl6405->config |= ISL6405_EN1; | ||
74 | break; | ||
75 | case SEC_VOLTAGE_18: | ||
76 | isl6405->config |= (ISL6405_EN1 | ISL6405_VSEL1); | ||
77 | break; | ||
78 | default: | ||
79 | return -EINVAL; | ||
80 | }; | ||
81 | } | ||
82 | isl6405->config |= isl6405->override_or; | ||
83 | isl6405->config &= isl6405->override_and; | ||
84 | |||
85 | return (i2c_transfer(isl6405->i2c, &msg, 1) == 1) ? 0 : -EIO; | ||
86 | } | ||
87 | |||
88 | static int isl6405_enable_high_lnb_voltage(struct dvb_frontend *fe, long arg) | ||
89 | { | ||
90 | struct isl6405 *isl6405 = (struct isl6405 *) fe->sec_priv; | ||
91 | struct i2c_msg msg = { .addr = isl6405->i2c_addr, .flags = 0, | ||
92 | .buf = &isl6405->config, | ||
93 | .len = sizeof(isl6405->config) }; | ||
94 | |||
95 | if (isl6405->override_or & 0x80) { | ||
96 | if (arg) | ||
97 | isl6405->config |= ISL6405_LLC2; | ||
98 | else | ||
99 | isl6405->config &= ~ISL6405_LLC2; | ||
100 | } else { | ||
101 | if (arg) | ||
102 | isl6405->config |= ISL6405_LLC1; | ||
103 | else | ||
104 | isl6405->config &= ~ISL6405_LLC1; | ||
105 | } | ||
106 | isl6405->config |= isl6405->override_or; | ||
107 | isl6405->config &= isl6405->override_and; | ||
108 | |||
109 | return (i2c_transfer(isl6405->i2c, &msg, 1) == 1) ? 0 : -EIO; | ||
110 | } | ||
111 | |||
112 | static void isl6405_release(struct dvb_frontend *fe) | ||
113 | { | ||
114 | /* power off */ | ||
115 | isl6405_set_voltage(fe, SEC_VOLTAGE_OFF); | ||
116 | |||
117 | /* free */ | ||
118 | kfree(fe->sec_priv); | ||
119 | fe->sec_priv = NULL; | ||
120 | } | ||
121 | |||
122 | struct dvb_frontend *isl6405_attach(struct dvb_frontend *fe, struct i2c_adapter *i2c, | ||
123 | u8 i2c_addr, u8 override_set, u8 override_clear) | ||
124 | { | ||
125 | struct isl6405 *isl6405 = kmalloc(sizeof(struct isl6405), GFP_KERNEL); | ||
126 | if (!isl6405) | ||
127 | return NULL; | ||
128 | |||
129 | /* default configuration */ | ||
130 | if (override_set & 0x80) | ||
131 | isl6405->config = ISL6405_ISEL2; | ||
132 | else | ||
133 | isl6405->config = ISL6405_ISEL1; | ||
134 | isl6405->i2c = i2c; | ||
135 | isl6405->i2c_addr = i2c_addr; | ||
136 | fe->sec_priv = isl6405; | ||
137 | |||
138 | /* bits which should be forced to '1' */ | ||
139 | isl6405->override_or = override_set; | ||
140 | |||
141 | /* bits which should be forced to '0' */ | ||
142 | isl6405->override_and = ~override_clear; | ||
143 | |||
144 | /* detect if it is present or not */ | ||
145 | if (isl6405_set_voltage(fe, SEC_VOLTAGE_OFF)) { | ||
146 | kfree(isl6405); | ||
147 | fe->sec_priv = NULL; | ||
148 | return NULL; | ||
149 | } | ||
150 | |||
151 | /* install release callback */ | ||
152 | fe->ops.release_sec = isl6405_release; | ||
153 | |||
154 | /* override frontend ops */ | ||
155 | fe->ops.set_voltage = isl6405_set_voltage; | ||
156 | fe->ops.enable_high_lnb_voltage = isl6405_enable_high_lnb_voltage; | ||
157 | |||
158 | return fe; | ||
159 | } | ||
160 | EXPORT_SYMBOL(isl6405_attach); | ||
161 | |||
162 | MODULE_DESCRIPTION("Driver for lnb supply and control ic isl6405"); | ||
163 | MODULE_AUTHOR("Hartmut Hackmann & Oliver Endriss"); | ||
164 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/media/dvb/frontends/isl6405.h b/drivers/media/dvb/frontends/isl6405.h new file mode 100644 index 000000000000..1c793d37576b --- /dev/null +++ b/drivers/media/dvb/frontends/isl6405.h | |||
@@ -0,0 +1,74 @@ | |||
1 | /* | ||
2 | * isl6405.h - driver for dual lnb supply and control ic ISL6405 | ||
3 | * | ||
4 | * Copyright (C) 2008 Hartmut Hackmann | ||
5 | * Copyright (C) 2006 Oliver Endriss | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or | ||
8 | * modify it under the terms of the GNU General Public License | ||
9 | * as published by the Free Software Foundation; either version 2 | ||
10 | * of the License, or (at your option) any later version. | ||
11 | * | ||
12 | * | ||
13 | * This program is distributed in the hope that it will be useful, | ||
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
16 | * GNU General Public License for more details. | ||
17 | * | ||
18 | * | ||
19 | * You should have received a copy of the GNU General Public License | ||
20 | * along with this program; if not, write to the Free Software | ||
21 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||
22 | * Or, point your browser to http://www.gnu.org/copyleft/gpl.html | ||
23 | * | ||
24 | * | ||
25 | * the project's page is at http://www.linuxtv.org | ||
26 | */ | ||
27 | |||
28 | #ifndef _ISL6405_H | ||
29 | #define _ISL6405_H | ||
30 | |||
31 | #include <linux/dvb/frontend.h> | ||
32 | |||
33 | /* system register bits */ | ||
34 | |||
35 | /* this bit selects register (control) 1 or 2 | ||
36 | note that the bit maps are different */ | ||
37 | |||
38 | #define ISL6405_SR 0x80 | ||
39 | |||
40 | /* SR = 0 */ | ||
41 | #define ISL6405_OLF1 0x01 | ||
42 | #define ISL6405_EN1 0x02 | ||
43 | #define ISL6405_VSEL1 0x04 | ||
44 | #define ISL6405_LLC1 0x08 | ||
45 | #define ISL6405_ENT1 0x10 | ||
46 | #define ISL6405_ISEL1 0x20 | ||
47 | #define ISL6405_DCL 0x40 | ||
48 | |||
49 | /* SR = 1 */ | ||
50 | #define ISL6405_OLF2 0x01 | ||
51 | #define ISL6405_OTF 0x02 | ||
52 | #define ISL6405_EN2 0x04 | ||
53 | #define ISL6405_VSEL2 0x08 | ||
54 | #define ISL6405_LLC2 0x10 | ||
55 | #define ISL6405_ENT2 0x20 | ||
56 | #define ISL6405_ISEL2 0x40 | ||
57 | |||
58 | #if defined(CONFIG_DVB_ISL6405) || (defined(CONFIG_DVB_ISL6405_MODULE) && defined(MODULE)) | ||
59 | /* override_set and override_clear control which system register bits (above) | ||
60 | * to always set & clear | ||
61 | */ | ||
62 | extern struct dvb_frontend *isl6405_attach(struct dvb_frontend *fe, struct i2c_adapter *i2c, | ||
63 | u8 i2c_addr, u8 override_set, u8 override_clear); | ||
64 | #else | ||
65 | static inline struct dvb_frontend *isl6405_attach(struct dvb_frontend *fe, | ||
66 | struct i2c_adapter *i2c, u8 i2c_addr, | ||
67 | u8 override_set, u8 override_clear) | ||
68 | { | ||
69 | printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__); | ||
70 | return NULL; | ||
71 | } | ||
72 | #endif /* CONFIG_DVB_ISL6405 */ | ||
73 | |||
74 | #endif | ||
diff --git a/drivers/media/dvb/frontends/isl6421.h b/drivers/media/dvb/frontends/isl6421.h index ea7f78a7d3cd..47e4518a042d 100644 --- a/drivers/media/dvb/frontends/isl6421.h +++ b/drivers/media/dvb/frontends/isl6421.h | |||
@@ -47,7 +47,7 @@ extern struct dvb_frontend *isl6421_attach(struct dvb_frontend *fe, struct i2c_a | |||
47 | static inline struct dvb_frontend *isl6421_attach(struct dvb_frontend *fe, struct i2c_adapter *i2c, u8 i2c_addr, | 47 | static inline struct dvb_frontend *isl6421_attach(struct dvb_frontend *fe, struct i2c_adapter *i2c, u8 i2c_addr, |
48 | u8 override_set, u8 override_clear) | 48 | u8 override_set, u8 override_clear) |
49 | { | 49 | { |
50 | printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __FUNCTION__); | 50 | printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__); |
51 | return NULL; | 51 | return NULL; |
52 | } | 52 | } |
53 | #endif // CONFIG_DVB_ISL6421 | 53 | #endif // CONFIG_DVB_ISL6421 |
diff --git a/drivers/media/dvb/frontends/itd1000.c b/drivers/media/dvb/frontends/itd1000.c new file mode 100644 index 000000000000..04c562ccf990 --- /dev/null +++ b/drivers/media/dvb/frontends/itd1000.c | |||
@@ -0,0 +1,400 @@ | |||
1 | /* | ||
2 | * Driver for the Integrant ITD1000 "Zero-IF Tuner IC for Direct Broadcast Satellite" | ||
3 | * | ||
4 | * Copyright (c) 2007-8 Patrick Boettcher <pb@linuxtv.org> | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | * | ||
15 | * GNU General Public License for more details. | ||
16 | * | ||
17 | * You should have received a copy of the GNU General Public License | ||
18 | * along with this program; if not, write to the Free Software | ||
19 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.= | ||
20 | */ | ||
21 | |||
22 | #include <linux/module.h> | ||
23 | #include <linux/moduleparam.h> | ||
24 | #include <linux/delay.h> | ||
25 | #include <linux/dvb/frontend.h> | ||
26 | #include <linux/i2c.h> | ||
27 | |||
28 | #include "dvb_frontend.h" | ||
29 | |||
30 | #include "itd1000.h" | ||
31 | #include "itd1000_priv.h" | ||
32 | |||
33 | static int debug; | ||
34 | module_param(debug, int, 0644); | ||
35 | MODULE_PARM_DESC(debug, "Turn on/off debugging (default:off)."); | ||
36 | |||
37 | #define deb(args...) do { \ | ||
38 | if (debug) { \ | ||
39 | printk(KERN_DEBUG "ITD1000: " args);\ | ||
40 | printk("\n"); \ | ||
41 | } \ | ||
42 | } while (0) | ||
43 | |||
44 | #define warn(args...) do { \ | ||
45 | printk(KERN_WARNING "ITD1000: " args); \ | ||
46 | printk("\n"); \ | ||
47 | } while (0) | ||
48 | |||
49 | #define info(args...) do { \ | ||
50 | printk(KERN_INFO "ITD1000: " args); \ | ||
51 | printk("\n"); \ | ||
52 | } while (0) | ||
53 | |||
54 | /* don't write more than one byte with flexcop behind */ | ||
55 | static int itd1000_write_regs(struct itd1000_state *state, u8 reg, u8 v[], u8 len) | ||
56 | { | ||
57 | u8 buf[1+len]; | ||
58 | struct i2c_msg msg = { | ||
59 | .addr = state->cfg->i2c_address, .flags = 0, .buf = buf, .len = len+1 | ||
60 | }; | ||
61 | buf[0] = reg; | ||
62 | memcpy(&buf[1], v, len); | ||
63 | |||
64 | /* deb("wr %02x: %02x", reg, v[0]); */ | ||
65 | |||
66 | if (i2c_transfer(state->i2c, &msg, 1) != 1) { | ||
67 | printk(KERN_WARNING "itd1000 I2C write failed\n"); | ||
68 | return -EREMOTEIO; | ||
69 | } | ||
70 | return 0; | ||
71 | } | ||
72 | |||
73 | static int itd1000_read_reg(struct itd1000_state *state, u8 reg) | ||
74 | { | ||
75 | u8 val; | ||
76 | struct i2c_msg msg[2] = { | ||
77 | { .addr = state->cfg->i2c_address, .flags = 0, .buf = ®, .len = 1 }, | ||
78 | { .addr = state->cfg->i2c_address, .flags = I2C_M_RD, .buf = &val, .len = 1 }, | ||
79 | }; | ||
80 | |||
81 | /* ugly flexcop workaround */ | ||
82 | itd1000_write_regs(state, (reg - 1) & 0xff, &state->shadow[(reg - 1) & 0xff], 1); | ||
83 | |||
84 | if (i2c_transfer(state->i2c, msg, 2) != 2) { | ||
85 | warn("itd1000 I2C read failed"); | ||
86 | return -EREMOTEIO; | ||
87 | } | ||
88 | return val; | ||
89 | } | ||
90 | |||
91 | static inline int itd1000_write_reg(struct itd1000_state *state, u8 r, u8 v) | ||
92 | { | ||
93 | int ret = itd1000_write_regs(state, r, &v, 1); | ||
94 | state->shadow[r] = v; | ||
95 | return ret; | ||
96 | } | ||
97 | |||
98 | |||
99 | static struct { | ||
100 | u32 symbol_rate; | ||
101 | u8 pgaext : 4; /* PLLFH */ | ||
102 | u8 bbgvmin : 4; /* BBGVMIN */ | ||
103 | } itd1000_lpf_pga[] = { | ||
104 | { 0, 0x8, 0x3 }, | ||
105 | { 5200000, 0x8, 0x3 }, | ||
106 | { 12200000, 0x4, 0x3 }, | ||
107 | { 15400000, 0x2, 0x3 }, | ||
108 | { 19800000, 0x2, 0x3 }, | ||
109 | { 21500000, 0x2, 0x3 }, | ||
110 | { 24500000, 0x2, 0x3 }, | ||
111 | { 28400000, 0x2, 0x3 }, | ||
112 | { 33400000, 0x2, 0x3 }, | ||
113 | { 34400000, 0x1, 0x4 }, | ||
114 | { 34400000, 0x1, 0x4 }, | ||
115 | { 38400000, 0x1, 0x4 }, | ||
116 | { 38400000, 0x1, 0x4 }, | ||
117 | { 40400000, 0x1, 0x4 }, | ||
118 | { 45400000, 0x1, 0x4 }, | ||
119 | }; | ||
120 | |||
121 | static void itd1000_set_lpf_bw(struct itd1000_state *state, u32 symbol_rate) | ||
122 | { | ||
123 | u8 i; | ||
124 | u8 con1 = itd1000_read_reg(state, CON1) & 0xfd; | ||
125 | u8 pllfh = itd1000_read_reg(state, PLLFH) & 0x0f; | ||
126 | u8 bbgvmin = itd1000_read_reg(state, BBGVMIN) & 0xf0; | ||
127 | u8 bw = itd1000_read_reg(state, BW) & 0xf0; | ||
128 | |||
129 | deb("symbol_rate = %d", symbol_rate); | ||
130 | |||
131 | /* not sure what is that ? - starting to download the table */ | ||
132 | itd1000_write_reg(state, CON1, con1 | (1 << 1)); | ||
133 | |||
134 | for (i = 0; i < ARRAY_SIZE(itd1000_lpf_pga); i++) | ||
135 | if (symbol_rate < itd1000_lpf_pga[i].symbol_rate) { | ||
136 | deb("symrate: index: %d pgaext: %x, bbgvmin: %x", i, itd1000_lpf_pga[i].pgaext, itd1000_lpf_pga[i].bbgvmin); | ||
137 | itd1000_write_reg(state, PLLFH, pllfh | (itd1000_lpf_pga[i].pgaext << 4)); | ||
138 | itd1000_write_reg(state, BBGVMIN, bbgvmin | (itd1000_lpf_pga[i].bbgvmin)); | ||
139 | itd1000_write_reg(state, BW, bw | (i & 0x0f)); | ||
140 | break; | ||
141 | } | ||
142 | |||
143 | itd1000_write_reg(state, CON1, con1 | (0 << 1)); | ||
144 | } | ||
145 | |||
146 | static struct { | ||
147 | u8 vcorg; | ||
148 | u32 fmax_rg; | ||
149 | } itd1000_vcorg[] = { | ||
150 | { 1, 920000 }, | ||
151 | { 2, 971000 }, | ||
152 | { 3, 1031000 }, | ||
153 | { 4, 1091000 }, | ||
154 | { 5, 1171000 }, | ||
155 | { 6, 1281000 }, | ||
156 | { 7, 1381000 }, | ||
157 | { 8, 500000 }, /* this is intentional. */ | ||
158 | { 9, 1451000 }, | ||
159 | { 10, 1531000 }, | ||
160 | { 11, 1631000 }, | ||
161 | { 12, 1741000 }, | ||
162 | { 13, 1891000 }, | ||
163 | { 14, 2071000 }, | ||
164 | { 15, 2250000 }, | ||
165 | }; | ||
166 | |||
167 | static void itd1000_set_vco(struct itd1000_state *state, u32 freq_khz) | ||
168 | { | ||
169 | u8 i; | ||
170 | u8 gvbb_i2c = itd1000_read_reg(state, GVBB_I2C) & 0xbf; | ||
171 | u8 vco_chp1_i2c = itd1000_read_reg(state, VCO_CHP1_I2C) & 0x0f; | ||
172 | u8 adcout; | ||
173 | |||
174 | /* reserved bit again (reset ?) */ | ||
175 | itd1000_write_reg(state, GVBB_I2C, gvbb_i2c | (1 << 6)); | ||
176 | |||
177 | for (i = 0; i < ARRAY_SIZE(itd1000_vcorg); i++) { | ||
178 | if (freq_khz < itd1000_vcorg[i].fmax_rg) { | ||
179 | itd1000_write_reg(state, VCO_CHP1_I2C, vco_chp1_i2c | (itd1000_vcorg[i].vcorg << 4)); | ||
180 | msleep(1); | ||
181 | |||
182 | adcout = itd1000_read_reg(state, PLLLOCK) & 0x0f; | ||
183 | |||
184 | deb("VCO: %dkHz: %d -> ADCOUT: %d %02x", freq_khz, itd1000_vcorg[i].vcorg, adcout, vco_chp1_i2c); | ||
185 | |||
186 | if (adcout > 13) { | ||
187 | if (!(itd1000_vcorg[i].vcorg == 7 || itd1000_vcorg[i].vcorg == 15)) | ||
188 | itd1000_write_reg(state, VCO_CHP1_I2C, vco_chp1_i2c | ((itd1000_vcorg[i].vcorg + 1) << 4)); | ||
189 | } else if (adcout < 2) { | ||
190 | if (!(itd1000_vcorg[i].vcorg == 1 || itd1000_vcorg[i].vcorg == 9)) | ||
191 | itd1000_write_reg(state, VCO_CHP1_I2C, vco_chp1_i2c | ((itd1000_vcorg[i].vcorg - 1) << 4)); | ||
192 | } | ||
193 | break; | ||
194 | } | ||
195 | } | ||
196 | } | ||
197 | |||
198 | struct { | ||
199 | u32 freq; | ||
200 | u8 values[10]; /* RFTR, RFST1 - RFST9 */ | ||
201 | } itd1000_fre_values[] = { | ||
202 | { 1075000, { 0x59, 0x1d, 0x1c, 0x17, 0x16, 0x0f, 0x0e, 0x0c, 0x0b, 0x0a } }, | ||
203 | { 1250000, { 0x89, 0x1e, 0x1d, 0x17, 0x15, 0x0f, 0x0e, 0x0c, 0x0b, 0x0a } }, | ||
204 | { 1450000, { 0x89, 0x1e, 0x1d, 0x17, 0x15, 0x0f, 0x0e, 0x0c, 0x0b, 0x0a } }, | ||
205 | { 1650000, { 0x69, 0x1e, 0x1d, 0x17, 0x15, 0x0f, 0x0e, 0x0c, 0x0b, 0x0a } }, | ||
206 | { 1750000, { 0x69, 0x1e, 0x17, 0x15, 0x14, 0x0f, 0x0e, 0x0c, 0x0b, 0x0a } }, | ||
207 | { 1850000, { 0x69, 0x1d, 0x17, 0x16, 0x14, 0x0f, 0x0e, 0x0d, 0x0b, 0x0a } }, | ||
208 | { 1900000, { 0x69, 0x1d, 0x17, 0x15, 0x14, 0x0f, 0x0e, 0x0d, 0x0b, 0x0a } }, | ||
209 | { 1950000, { 0x69, 0x1d, 0x17, 0x16, 0x14, 0x13, 0x0e, 0x0d, 0x0b, 0x0a } }, | ||
210 | { 2050000, { 0x69, 0x1e, 0x1d, 0x17, 0x16, 0x14, 0x13, 0x0e, 0x0b, 0x0a } }, | ||
211 | { 2150000, { 0x69, 0x1d, 0x1c, 0x17, 0x15, 0x14, 0x13, 0x0f, 0x0e, 0x0b } } | ||
212 | }; | ||
213 | |||
214 | |||
215 | #define FREF 16 | ||
216 | |||
217 | static void itd1000_set_lo(struct itd1000_state *state, u32 freq_khz) | ||
218 | { | ||
219 | int i, j; | ||
220 | u32 plln, pllf; | ||
221 | u64 tmp; | ||
222 | |||
223 | plln = (freq_khz * 1000) / 2 / FREF; | ||
224 | |||
225 | /* Compute the factional part times 1000 */ | ||
226 | tmp = plln % 1000000; | ||
227 | plln /= 1000000; | ||
228 | |||
229 | tmp *= 1048576; | ||
230 | do_div(tmp, 1000000); | ||
231 | pllf = (u32) tmp; | ||
232 | |||
233 | state->frequency = ((plln * 1000) + (pllf * 1000)/1048576) * 2*FREF; | ||
234 | deb("frequency: %dkHz (wanted) %dkHz (set), PLLF = %d, PLLN = %d", freq_khz, state->frequency, pllf, plln); | ||
235 | |||
236 | itd1000_write_reg(state, PLLNH, 0x80); /* PLLNH */; | ||
237 | itd1000_write_reg(state, PLLNL, plln & 0xff); | ||
238 | itd1000_write_reg(state, PLLFH, (itd1000_read_reg(state, PLLFH) & 0xf0) | ((pllf >> 16) & 0x0f)); | ||
239 | itd1000_write_reg(state, PLLFM, (pllf >> 8) & 0xff); | ||
240 | itd1000_write_reg(state, PLLFL, (pllf >> 0) & 0xff); | ||
241 | |||
242 | for (i = 0; i < ARRAY_SIZE(itd1000_fre_values); i++) { | ||
243 | if (freq_khz <= itd1000_fre_values[i].freq) { | ||
244 | deb("fre_values: %d", i); | ||
245 | itd1000_write_reg(state, RFTR, itd1000_fre_values[i].values[0]); | ||
246 | for (j = 0; j < 9; j++) | ||
247 | itd1000_write_reg(state, RFST1+j, itd1000_fre_values[i].values[j+1]); | ||
248 | break; | ||
249 | } | ||
250 | } | ||
251 | |||
252 | itd1000_set_vco(state, freq_khz); | ||
253 | } | ||
254 | |||
255 | static int itd1000_set_parameters(struct dvb_frontend *fe, struct dvb_frontend_parameters *p) | ||
256 | { | ||
257 | struct itd1000_state *state = fe->tuner_priv; | ||
258 | u8 pllcon1; | ||
259 | |||
260 | itd1000_set_lo(state, p->frequency); | ||
261 | itd1000_set_lpf_bw(state, p->u.qpsk.symbol_rate); | ||
262 | |||
263 | pllcon1 = itd1000_read_reg(state, PLLCON1) & 0x7f; | ||
264 | itd1000_write_reg(state, PLLCON1, pllcon1 | (1 << 7)); | ||
265 | itd1000_write_reg(state, PLLCON1, pllcon1); | ||
266 | |||
267 | return 0; | ||
268 | } | ||
269 | |||
270 | static int itd1000_get_frequency(struct dvb_frontend *fe, u32 *frequency) | ||
271 | { | ||
272 | struct itd1000_state *state = fe->tuner_priv; | ||
273 | *frequency = state->frequency; | ||
274 | return 0; | ||
275 | } | ||
276 | |||
277 | static int itd1000_get_bandwidth(struct dvb_frontend *fe, u32 *bandwidth) | ||
278 | { | ||
279 | return 0; | ||
280 | } | ||
281 | |||
282 | static u8 itd1000_init_tab[][2] = { | ||
283 | { PLLCON1, 0x65 }, /* Register does not change */ | ||
284 | { PLLNH, 0x80 }, /* Bits [7:6] do not change */ | ||
285 | { RESERVED_0X6D, 0x3b }, | ||
286 | { VCO_CHP2_I2C, 0x12 }, | ||
287 | { 0x72, 0xf9 }, /* No such regsister defined */ | ||
288 | { RESERVED_0X73, 0xff }, | ||
289 | { RESERVED_0X74, 0xb2 }, | ||
290 | { RESERVED_0X75, 0xc7 }, | ||
291 | { EXTGVBBRF, 0xf0 }, | ||
292 | { DIVAGCCK, 0x80 }, | ||
293 | { BBTR, 0xa0 }, | ||
294 | { RESERVED_0X7E, 0x4f }, | ||
295 | { 0x82, 0x88 }, /* No such regsister defined */ | ||
296 | { 0x83, 0x80 }, /* No such regsister defined */ | ||
297 | { 0x84, 0x80 }, /* No such regsister defined */ | ||
298 | { RESERVED_0X85, 0x74 }, | ||
299 | { RESERVED_0X86, 0xff }, | ||
300 | { RESERVED_0X88, 0x02 }, | ||
301 | { RESERVED_0X89, 0x16 }, | ||
302 | { RFST0, 0x1f }, | ||
303 | { RESERVED_0X94, 0x66 }, | ||
304 | { RESERVED_0X95, 0x66 }, | ||
305 | { RESERVED_0X96, 0x77 }, | ||
306 | { RESERVED_0X97, 0x99 }, | ||
307 | { RESERVED_0X98, 0xff }, | ||
308 | { RESERVED_0X99, 0xfc }, | ||
309 | { RESERVED_0X9A, 0xba }, | ||
310 | { RESERVED_0X9B, 0xaa }, | ||
311 | }; | ||
312 | |||
313 | static u8 itd1000_reinit_tab[][2] = { | ||
314 | { VCO_CHP1_I2C, 0x8a }, | ||
315 | { BW, 0x87 }, | ||
316 | { GVBB_I2C, 0x03 }, | ||
317 | { BBGVMIN, 0x03 }, | ||
318 | { CON1, 0x2e }, | ||
319 | }; | ||
320 | |||
321 | |||
322 | static int itd1000_init(struct dvb_frontend *fe) | ||
323 | { | ||
324 | struct itd1000_state *state = fe->tuner_priv; | ||
325 | int i; | ||
326 | |||
327 | for (i = 0; i < ARRAY_SIZE(itd1000_init_tab); i++) | ||
328 | itd1000_write_reg(state, itd1000_init_tab[i][0], itd1000_init_tab[i][1]); | ||
329 | |||
330 | for (i = 0; i < ARRAY_SIZE(itd1000_reinit_tab); i++) | ||
331 | itd1000_write_reg(state, itd1000_reinit_tab[i][0], itd1000_reinit_tab[i][1]); | ||
332 | |||
333 | return 0; | ||
334 | } | ||
335 | |||
336 | static int itd1000_sleep(struct dvb_frontend *fe) | ||
337 | { | ||
338 | return 0; | ||
339 | } | ||
340 | |||
341 | static int itd1000_release(struct dvb_frontend *fe) | ||
342 | { | ||
343 | kfree(fe->tuner_priv); | ||
344 | fe->tuner_priv = NULL; | ||
345 | return 0; | ||
346 | } | ||
347 | |||
348 | static const struct dvb_tuner_ops itd1000_tuner_ops = { | ||
349 | .info = { | ||
350 | .name = "Integrant ITD1000", | ||
351 | .frequency_min = 950000, | ||
352 | .frequency_max = 2150000, | ||
353 | .frequency_step = 125, /* kHz for QPSK frontends */ | ||
354 | }, | ||
355 | |||
356 | .release = itd1000_release, | ||
357 | |||
358 | .init = itd1000_init, | ||
359 | .sleep = itd1000_sleep, | ||
360 | |||
361 | .set_params = itd1000_set_parameters, | ||
362 | .get_frequency = itd1000_get_frequency, | ||
363 | .get_bandwidth = itd1000_get_bandwidth | ||
364 | }; | ||
365 | |||
366 | |||
367 | struct dvb_frontend *itd1000_attach(struct dvb_frontend *fe, struct i2c_adapter *i2c, struct itd1000_config *cfg) | ||
368 | { | ||
369 | struct itd1000_state *state = NULL; | ||
370 | u8 i = 0; | ||
371 | |||
372 | state = kzalloc(sizeof(struct itd1000_state), GFP_KERNEL); | ||
373 | if (state == NULL) | ||
374 | return NULL; | ||
375 | |||
376 | state->cfg = cfg; | ||
377 | state->i2c = i2c; | ||
378 | |||
379 | i = itd1000_read_reg(state, 0); | ||
380 | if (i != 0) { | ||
381 | kfree(state); | ||
382 | return NULL; | ||
383 | } | ||
384 | info("successfully identified (ID: %d)", i); | ||
385 | |||
386 | memset(state->shadow, 0xff, sizeof(state->shadow)); | ||
387 | for (i = 0x65; i < 0x9c; i++) | ||
388 | state->shadow[i] = itd1000_read_reg(state, i); | ||
389 | |||
390 | memcpy(&fe->ops.tuner_ops, &itd1000_tuner_ops, sizeof(struct dvb_tuner_ops)); | ||
391 | |||
392 | fe->tuner_priv = state; | ||
393 | |||
394 | return fe; | ||
395 | } | ||
396 | EXPORT_SYMBOL(itd1000_attach); | ||
397 | |||
398 | MODULE_AUTHOR("Patrick Boettcher <pb@linuxtv.org>"); | ||
399 | MODULE_DESCRIPTION("Integrant ITD1000 driver"); | ||
400 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/media/dvb/frontends/itd1000.h b/drivers/media/dvb/frontends/itd1000.h new file mode 100644 index 000000000000..5e18df071b88 --- /dev/null +++ b/drivers/media/dvb/frontends/itd1000.h | |||
@@ -0,0 +1,42 @@ | |||
1 | /* | ||
2 | * Driver for the Integrant ITD1000 "Zero-IF Tuner IC for Direct Broadcast Satellite" | ||
3 | * | ||
4 | * Copyright (c) 2007 Patrick Boettcher <pb@linuxtv.org> | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | * | ||
15 | * GNU General Public License for more details. | ||
16 | * | ||
17 | * You should have received a copy of the GNU General Public License | ||
18 | * along with this program; if not, write to the Free Software | ||
19 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.= | ||
20 | */ | ||
21 | |||
22 | #ifndef ITD1000_H | ||
23 | #define ITD1000_H | ||
24 | |||
25 | struct dvb_frontend; | ||
26 | struct i2c_adapter; | ||
27 | |||
28 | struct itd1000_config { | ||
29 | u8 i2c_address; | ||
30 | }; | ||
31 | |||
32 | #if defined(CONFIG_DVB_TUNER_ITD1000) || (defined(CONFIG_DVB_TUNER_ITD1000_MODULE) && defined(MODULE)) | ||
33 | extern struct dvb_frontend *itd1000_attach(struct dvb_frontend *fe, struct i2c_adapter *i2c, struct itd1000_config *cfg); | ||
34 | #else | ||
35 | static inline struct dvb_frontend *itd1000_attach(struct dvb_frontend *fe, struct i2c_adapter *i2c, struct itd1000_config *cfg) | ||
36 | { | ||
37 | printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__); | ||
38 | return NULL; | ||
39 | } | ||
40 | #endif | ||
41 | |||
42 | #endif | ||
diff --git a/drivers/media/dvb/frontends/itd1000_priv.h b/drivers/media/dvb/frontends/itd1000_priv.h new file mode 100644 index 000000000000..8cdc54e57903 --- /dev/null +++ b/drivers/media/dvb/frontends/itd1000_priv.h | |||
@@ -0,0 +1,88 @@ | |||
1 | /* | ||
2 | * Driver for the Integrant ITD1000 "Zero-IF Tuner IC for Direct Broadcast Satellite" | ||
3 | * | ||
4 | * Copyright (c) 2007 Patrick Boettcher <pb@linuxtv.org> | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | * | ||
15 | * GNU General Public License for more details. | ||
16 | * | ||
17 | * You should have received a copy of the GNU General Public License | ||
18 | * along with this program; if not, write to the Free Software | ||
19 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.= | ||
20 | */ | ||
21 | |||
22 | #ifndef ITD1000_PRIV_H | ||
23 | #define ITD1000_PRIV_H | ||
24 | |||
25 | struct itd1000_state { | ||
26 | struct itd1000_config *cfg; | ||
27 | struct i2c_adapter *i2c; | ||
28 | |||
29 | u32 frequency; /* contains the value resulting from the LO-setting */ | ||
30 | |||
31 | /* ugly workaround for flexcop's incapable i2c-controller | ||
32 | * FIXME, if possible | ||
33 | */ | ||
34 | u8 shadow[255]; | ||
35 | }; | ||
36 | |||
37 | enum itd1000_register { | ||
38 | VCO_CHP1 = 0x65, | ||
39 | VCO_CHP2, | ||
40 | PLLCON1, | ||
41 | PLLNH, | ||
42 | PLLNL, | ||
43 | PLLFH, | ||
44 | PLLFM, | ||
45 | PLLFL, | ||
46 | RESERVED_0X6D, | ||
47 | PLLLOCK, | ||
48 | VCO_CHP2_I2C, | ||
49 | VCO_CHP1_I2C, | ||
50 | BW, | ||
51 | RESERVED_0X73 = 0x73, | ||
52 | RESERVED_0X74, | ||
53 | RESERVED_0X75, | ||
54 | GVBB, | ||
55 | GVRF, | ||
56 | GVBB_I2C, | ||
57 | EXTGVBBRF, | ||
58 | DIVAGCCK, | ||
59 | BBTR, | ||
60 | RFTR, | ||
61 | BBGVMIN, | ||
62 | RESERVED_0X7E, | ||
63 | RESERVED_0X85 = 0x85, | ||
64 | RESERVED_0X86, | ||
65 | CON1, | ||
66 | RESERVED_0X88, | ||
67 | RESERVED_0X89, | ||
68 | RFST0, | ||
69 | RFST1, | ||
70 | RFST2, | ||
71 | RFST3, | ||
72 | RFST4, | ||
73 | RFST5, | ||
74 | RFST6, | ||
75 | RFST7, | ||
76 | RFST8, | ||
77 | RFST9, | ||
78 | RESERVED_0X94, | ||
79 | RESERVED_0X95, | ||
80 | RESERVED_0X96, | ||
81 | RESERVED_0X97, | ||
82 | RESERVED_0X98, | ||
83 | RESERVED_0X99, | ||
84 | RESERVED_0X9A, | ||
85 | RESERVED_0X9B, | ||
86 | }; | ||
87 | |||
88 | #endif | ||
diff --git a/drivers/media/dvb/frontends/l64781.c b/drivers/media/dvb/frontends/l64781.c index 443d9045d4c9..e1e70e9e0cb9 100644 --- a/drivers/media/dvb/frontends/l64781.c +++ b/drivers/media/dvb/frontends/l64781.c | |||
@@ -57,7 +57,7 @@ static int l64781_writereg (struct l64781_state* state, u8 reg, u8 data) | |||
57 | 57 | ||
58 | if ((ret = i2c_transfer(state->i2c, &msg, 1)) != 1) | 58 | if ((ret = i2c_transfer(state->i2c, &msg, 1)) != 1) |
59 | dprintk ("%s: write_reg error (reg == %02x) = %02x!\n", | 59 | dprintk ("%s: write_reg error (reg == %02x) = %02x!\n", |
60 | __FUNCTION__, reg, ret); | 60 | __func__, reg, ret); |
61 | 61 | ||
62 | return (ret != 1) ? -1 : 0; | 62 | return (ret != 1) ? -1 : 0; |
63 | } | 63 | } |
diff --git a/drivers/media/dvb/frontends/l64781.h b/drivers/media/dvb/frontends/l64781.h index cd15f76ff28d..1305a9e7fb0b 100644 --- a/drivers/media/dvb/frontends/l64781.h +++ b/drivers/media/dvb/frontends/l64781.h | |||
@@ -38,7 +38,7 @@ extern struct dvb_frontend* l64781_attach(const struct l64781_config* config, | |||
38 | static inline struct dvb_frontend* l64781_attach(const struct l64781_config* config, | 38 | static inline struct dvb_frontend* l64781_attach(const struct l64781_config* config, |
39 | struct i2c_adapter* i2c) | 39 | struct i2c_adapter* i2c) |
40 | { | 40 | { |
41 | printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __FUNCTION__); | 41 | printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__); |
42 | return NULL; | 42 | return NULL; |
43 | } | 43 | } |
44 | #endif // CONFIG_DVB_L64781 | 44 | #endif // CONFIG_DVB_L64781 |
diff --git a/drivers/media/dvb/frontends/lgdt330x.c b/drivers/media/dvb/frontends/lgdt330x.c index bdc9fa88b86a..f0195c8272f4 100644 --- a/drivers/media/dvb/frontends/lgdt330x.c +++ b/drivers/media/dvb/frontends/lgdt330x.c | |||
@@ -49,7 +49,7 @@ | |||
49 | /* Use Equalizer Mean Squared Error instead of Phaser Tracker MSE */ | 49 | /* Use Equalizer Mean Squared Error instead of Phaser Tracker MSE */ |
50 | /* #define USE_EQMSE */ | 50 | /* #define USE_EQMSE */ |
51 | 51 | ||
52 | static int debug = 0; | 52 | static int debug; |
53 | module_param(debug, int, 0644); | 53 | module_param(debug, int, 0644); |
54 | MODULE_PARM_DESC(debug,"Turn on/off lgdt330x frontend debugging (default:off)."); | 54 | MODULE_PARM_DESC(debug,"Turn on/off lgdt330x frontend debugging (default:off)."); |
55 | #define dprintk(args...) \ | 55 | #define dprintk(args...) \ |
@@ -88,7 +88,7 @@ static int i2c_write_demod_bytes (struct lgdt330x_state* state, | |||
88 | 88 | ||
89 | for (i=0; i<len-1; i+=2){ | 89 | for (i=0; i<len-1; i+=2){ |
90 | if ((err = i2c_transfer(state->i2c, &msg, 1)) != 1) { | 90 | if ((err = i2c_transfer(state->i2c, &msg, 1)) != 1) { |
91 | printk(KERN_WARNING "lgdt330x: %s error (addr %02x <- %02x, err = %i)\n", __FUNCTION__, msg.buf[0], msg.buf[1], err); | 91 | printk(KERN_WARNING "lgdt330x: %s error (addr %02x <- %02x, err = %i)\n", __func__, msg.buf[0], msg.buf[1], err); |
92 | if (err < 0) | 92 | if (err < 0) |
93 | return err; | 93 | return err; |
94 | else | 94 | else |
@@ -117,7 +117,7 @@ static u8 i2c_read_demod_bytes (struct lgdt330x_state* state, | |||
117 | int ret; | 117 | int ret; |
118 | ret = i2c_transfer(state->i2c, msg, 2); | 118 | ret = i2c_transfer(state->i2c, msg, 2); |
119 | if (ret != 2) { | 119 | if (ret != 2) { |
120 | printk(KERN_WARNING "lgdt330x: %s: addr 0x%02x select 0x%02x error (ret == %i)\n", __FUNCTION__, state->config->demod_address, reg, ret); | 120 | printk(KERN_WARNING "lgdt330x: %s: addr 0x%02x select 0x%02x error (ret == %i)\n", __func__, state->config->demod_address, reg, ret); |
121 | } else { | 121 | } else { |
122 | ret = 0; | 122 | ret = 0; |
123 | } | 123 | } |
@@ -256,7 +256,7 @@ static int lgdt330x_init(struct dvb_frontend* fe) | |||
256 | printk (KERN_WARNING "Only LGDT3302 and LGDT3303 are supported chips.\n"); | 256 | printk (KERN_WARNING "Only LGDT3302 and LGDT3303 are supported chips.\n"); |
257 | err = -ENODEV; | 257 | err = -ENODEV; |
258 | } | 258 | } |
259 | dprintk("%s entered as %s\n", __FUNCTION__, chip_name); | 259 | dprintk("%s entered as %s\n", __func__, chip_name); |
260 | if (err < 0) | 260 | if (err < 0) |
261 | return err; | 261 | return err; |
262 | return lgdt330x_SwReset(state); | 262 | return lgdt330x_SwReset(state); |
@@ -334,7 +334,7 @@ static int lgdt330x_set_parameters(struct dvb_frontend* fe, | |||
334 | if (state->current_modulation != param->u.vsb.modulation) { | 334 | if (state->current_modulation != param->u.vsb.modulation) { |
335 | switch(param->u.vsb.modulation) { | 335 | switch(param->u.vsb.modulation) { |
336 | case VSB_8: | 336 | case VSB_8: |
337 | dprintk("%s: VSB_8 MODE\n", __FUNCTION__); | 337 | dprintk("%s: VSB_8 MODE\n", __func__); |
338 | 338 | ||
339 | /* Select VSB mode */ | 339 | /* Select VSB mode */ |
340 | top_ctrl_cfg[1] = 0x03; | 340 | top_ctrl_cfg[1] = 0x03; |
@@ -350,7 +350,7 @@ static int lgdt330x_set_parameters(struct dvb_frontend* fe, | |||
350 | break; | 350 | break; |
351 | 351 | ||
352 | case QAM_64: | 352 | case QAM_64: |
353 | dprintk("%s: QAM_64 MODE\n", __FUNCTION__); | 353 | dprintk("%s: QAM_64 MODE\n", __func__); |
354 | 354 | ||
355 | /* Select QAM_64 mode */ | 355 | /* Select QAM_64 mode */ |
356 | top_ctrl_cfg[1] = 0x00; | 356 | top_ctrl_cfg[1] = 0x00; |
@@ -366,7 +366,7 @@ static int lgdt330x_set_parameters(struct dvb_frontend* fe, | |||
366 | break; | 366 | break; |
367 | 367 | ||
368 | case QAM_256: | 368 | case QAM_256: |
369 | dprintk("%s: QAM_256 MODE\n", __FUNCTION__); | 369 | dprintk("%s: QAM_256 MODE\n", __func__); |
370 | 370 | ||
371 | /* Select QAM_256 mode */ | 371 | /* Select QAM_256 mode */ |
372 | top_ctrl_cfg[1] = 0x01; | 372 | top_ctrl_cfg[1] = 0x01; |
@@ -381,7 +381,7 @@ static int lgdt330x_set_parameters(struct dvb_frontend* fe, | |||
381 | } | 381 | } |
382 | break; | 382 | break; |
383 | default: | 383 | default: |
384 | printk(KERN_WARNING "lgdt330x: %s: Modulation type(%d) UNSUPPORTED\n", __FUNCTION__, param->u.vsb.modulation); | 384 | printk(KERN_WARNING "lgdt330x: %s: Modulation type(%d) UNSUPPORTED\n", __func__, param->u.vsb.modulation); |
385 | return -1; | 385 | return -1; |
386 | } | 386 | } |
387 | /* | 387 | /* |
@@ -431,7 +431,7 @@ static int lgdt3302_read_status(struct dvb_frontend* fe, fe_status_t* status) | |||
431 | 431 | ||
432 | /* AGC status register */ | 432 | /* AGC status register */ |
433 | i2c_read_demod_bytes(state, AGC_STATUS, buf, 1); | 433 | i2c_read_demod_bytes(state, AGC_STATUS, buf, 1); |
434 | dprintk("%s: AGC_STATUS = 0x%02x\n", __FUNCTION__, buf[0]); | 434 | dprintk("%s: AGC_STATUS = 0x%02x\n", __func__, buf[0]); |
435 | if ((buf[0] & 0x0c) == 0x8){ | 435 | if ((buf[0] & 0x0c) == 0x8){ |
436 | /* Test signal does not exist flag */ | 436 | /* Test signal does not exist flag */ |
437 | /* as well as the AGC lock flag. */ | 437 | /* as well as the AGC lock flag. */ |
@@ -445,7 +445,7 @@ static int lgdt3302_read_status(struct dvb_frontend* fe, fe_status_t* status) | |||
445 | */ | 445 | */ |
446 | /* signal status */ | 446 | /* signal status */ |
447 | i2c_read_demod_bytes(state, TOP_CONTROL, buf, sizeof(buf)); | 447 | i2c_read_demod_bytes(state, TOP_CONTROL, buf, sizeof(buf)); |
448 | dprintk("%s: TOP_CONTROL = 0x%02x, IRO_MASK = 0x%02x, IRQ_STATUS = 0x%02x\n", __FUNCTION__, buf[0], buf[1], buf[2]); | 448 | dprintk("%s: TOP_CONTROL = 0x%02x, IRO_MASK = 0x%02x, IRQ_STATUS = 0x%02x\n", __func__, buf[0], buf[1], buf[2]); |
449 | 449 | ||
450 | 450 | ||
451 | /* sync status */ | 451 | /* sync status */ |
@@ -461,7 +461,7 @@ static int lgdt3302_read_status(struct dvb_frontend* fe, fe_status_t* status) | |||
461 | 461 | ||
462 | /* Carrier Recovery Lock Status Register */ | 462 | /* Carrier Recovery Lock Status Register */ |
463 | i2c_read_demod_bytes(state, CARRIER_LOCK, buf, 1); | 463 | i2c_read_demod_bytes(state, CARRIER_LOCK, buf, 1); |
464 | dprintk("%s: CARRIER_LOCK = 0x%02x\n", __FUNCTION__, buf[0]); | 464 | dprintk("%s: CARRIER_LOCK = 0x%02x\n", __func__, buf[0]); |
465 | switch (state->current_modulation) { | 465 | switch (state->current_modulation) { |
466 | case QAM_256: | 466 | case QAM_256: |
467 | case QAM_64: | 467 | case QAM_64: |
@@ -474,7 +474,7 @@ static int lgdt3302_read_status(struct dvb_frontend* fe, fe_status_t* status) | |||
474 | *status |= FE_HAS_CARRIER; | 474 | *status |= FE_HAS_CARRIER; |
475 | break; | 475 | break; |
476 | default: | 476 | default: |
477 | printk(KERN_WARNING "lgdt330x: %s: Modulation set to unsupported value\n", __FUNCTION__); | 477 | printk(KERN_WARNING "lgdt330x: %s: Modulation set to unsupported value\n", __func__); |
478 | } | 478 | } |
479 | 479 | ||
480 | return 0; | 480 | return 0; |
@@ -493,7 +493,7 @@ static int lgdt3303_read_status(struct dvb_frontend* fe, fe_status_t* status) | |||
493 | if (err < 0) | 493 | if (err < 0) |
494 | return err; | 494 | return err; |
495 | 495 | ||
496 | dprintk("%s: AGC_STATUS = 0x%02x\n", __FUNCTION__, buf[0]); | 496 | dprintk("%s: AGC_STATUS = 0x%02x\n", __func__, buf[0]); |
497 | if ((buf[0] & 0x21) == 0x01){ | 497 | if ((buf[0] & 0x21) == 0x01){ |
498 | /* Test input signal does not exist flag */ | 498 | /* Test input signal does not exist flag */ |
499 | /* as well as the AGC lock flag. */ | 499 | /* as well as the AGC lock flag. */ |
@@ -502,7 +502,7 @@ static int lgdt3303_read_status(struct dvb_frontend* fe, fe_status_t* status) | |||
502 | 502 | ||
503 | /* Carrier Recovery Lock Status Register */ | 503 | /* Carrier Recovery Lock Status Register */ |
504 | i2c_read_demod_bytes(state, CARRIER_LOCK, buf, 1); | 504 | i2c_read_demod_bytes(state, CARRIER_LOCK, buf, 1); |
505 | dprintk("%s: CARRIER_LOCK = 0x%02x\n", __FUNCTION__, buf[0]); | 505 | dprintk("%s: CARRIER_LOCK = 0x%02x\n", __func__, buf[0]); |
506 | switch (state->current_modulation) { | 506 | switch (state->current_modulation) { |
507 | case QAM_256: | 507 | case QAM_256: |
508 | case QAM_64: | 508 | case QAM_64: |
@@ -533,7 +533,7 @@ static int lgdt3303_read_status(struct dvb_frontend* fe, fe_status_t* status) | |||
533 | } | 533 | } |
534 | break; | 534 | break; |
535 | default: | 535 | default: |
536 | printk(KERN_WARNING "lgdt330x: %s: Modulation set to unsupported value\n", __FUNCTION__); | 536 | printk(KERN_WARNING "lgdt330x: %s: Modulation set to unsupported value\n", __func__); |
537 | } | 537 | } |
538 | return 0; | 538 | return 0; |
539 | } | 539 | } |
@@ -607,14 +607,14 @@ static int lgdt3302_read_snr(struct dvb_frontend* fe, u16* snr) | |||
607 | break; | 607 | break; |
608 | default: | 608 | default: |
609 | printk(KERN_ERR "lgdt330x: %s: Modulation set to unsupported value\n", | 609 | printk(KERN_ERR "lgdt330x: %s: Modulation set to unsupported value\n", |
610 | __FUNCTION__); | 610 | __func__); |
611 | return -EREMOTEIO; /* return -EDRIVER_IS_GIBBERED; */ | 611 | return -EREMOTEIO; /* return -EDRIVER_IS_GIBBERED; */ |
612 | } | 612 | } |
613 | 613 | ||
614 | state->snr = calculate_snr(noise, c); | 614 | state->snr = calculate_snr(noise, c); |
615 | *snr = (state->snr) >> 16; /* Convert from 8.24 fixed-point to 8.8 */ | 615 | *snr = (state->snr) >> 16; /* Convert from 8.24 fixed-point to 8.8 */ |
616 | 616 | ||
617 | dprintk("%s: noise = 0x%08x, snr = %d.%02d dB\n", __FUNCTION__, noise, | 617 | dprintk("%s: noise = 0x%08x, snr = %d.%02d dB\n", __func__, noise, |
618 | state->snr >> 24, (((state->snr>>8) & 0xffff) * 100) >> 16); | 618 | state->snr >> 24, (((state->snr>>8) & 0xffff) * 100) >> 16); |
619 | 619 | ||
620 | return 0; | 620 | return 0; |
@@ -651,14 +651,14 @@ static int lgdt3303_read_snr(struct dvb_frontend* fe, u16* snr) | |||
651 | break; | 651 | break; |
652 | default: | 652 | default: |
653 | printk(KERN_ERR "lgdt330x: %s: Modulation set to unsupported value\n", | 653 | printk(KERN_ERR "lgdt330x: %s: Modulation set to unsupported value\n", |
654 | __FUNCTION__); | 654 | __func__); |
655 | return -EREMOTEIO; /* return -EDRIVER_IS_GIBBERED; */ | 655 | return -EREMOTEIO; /* return -EDRIVER_IS_GIBBERED; */ |
656 | } | 656 | } |
657 | 657 | ||
658 | state->snr = calculate_snr(noise, c); | 658 | state->snr = calculate_snr(noise, c); |
659 | *snr = (state->snr) >> 16; /* Convert from 8.24 fixed-point to 8.8 */ | 659 | *snr = (state->snr) >> 16; /* Convert from 8.24 fixed-point to 8.8 */ |
660 | 660 | ||
661 | dprintk("%s: noise = 0x%08x, snr = %d.%02d dB\n", __FUNCTION__, noise, | 661 | dprintk("%s: noise = 0x%08x, snr = %d.%02d dB\n", __func__, noise, |
662 | state->snr >> 24, (((state->snr >> 8) & 0xffff) * 100) >> 16); | 662 | state->snr >> 24, (((state->snr >> 8) & 0xffff) * 100) >> 16); |
663 | 663 | ||
664 | return 0; | 664 | return 0; |
@@ -743,7 +743,7 @@ struct dvb_frontend* lgdt330x_attach(const struct lgdt330x_config* config, | |||
743 | 743 | ||
744 | error: | 744 | error: |
745 | kfree(state); | 745 | kfree(state); |
746 | dprintk("%s: ERROR\n",__FUNCTION__); | 746 | dprintk("%s: ERROR\n",__func__); |
747 | return NULL; | 747 | return NULL; |
748 | } | 748 | } |
749 | 749 | ||
diff --git a/drivers/media/dvb/frontends/lgdt330x.h b/drivers/media/dvb/frontends/lgdt330x.h index 995059004b10..9012504f0f2d 100644 --- a/drivers/media/dvb/frontends/lgdt330x.h +++ b/drivers/media/dvb/frontends/lgdt330x.h | |||
@@ -59,7 +59,7 @@ extern struct dvb_frontend* lgdt330x_attach(const struct lgdt330x_config* config | |||
59 | static inline struct dvb_frontend* lgdt330x_attach(const struct lgdt330x_config* config, | 59 | static inline struct dvb_frontend* lgdt330x_attach(const struct lgdt330x_config* config, |
60 | struct i2c_adapter* i2c) | 60 | struct i2c_adapter* i2c) |
61 | { | 61 | { |
62 | printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __FUNCTION__); | 62 | printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__); |
63 | return NULL; | 63 | return NULL; |
64 | } | 64 | } |
65 | #endif // CONFIG_DVB_LGDT330X | 65 | #endif // CONFIG_DVB_LGDT330X |
diff --git a/drivers/media/dvb/frontends/lnbp21.h b/drivers/media/dvb/frontends/lnbp21.h index 68906acf7d63..8fe094bd9689 100644 --- a/drivers/media/dvb/frontends/lnbp21.h +++ b/drivers/media/dvb/frontends/lnbp21.h | |||
@@ -45,7 +45,7 @@ extern struct dvb_frontend *lnbp21_attach(struct dvb_frontend *fe, struct i2c_ad | |||
45 | #else | 45 | #else |
46 | static inline struct dvb_frontend *lnbp21_attach(struct dvb_frontend *fe, struct i2c_adapter *i2c, u8 override_set, u8 override_clear) | 46 | static inline struct dvb_frontend *lnbp21_attach(struct dvb_frontend *fe, struct i2c_adapter *i2c, u8 override_set, u8 override_clear) |
47 | { | 47 | { |
48 | printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __FUNCTION__); | 48 | printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__); |
49 | return NULL; | 49 | return NULL; |
50 | } | 50 | } |
51 | #endif // CONFIG_DVB_LNBP21 | 51 | #endif // CONFIG_DVB_LNBP21 |
diff --git a/drivers/media/dvb/frontends/mt2060.h b/drivers/media/dvb/frontends/mt2060.h index 0a86eab3a954..acba0058f519 100644 --- a/drivers/media/dvb/frontends/mt2060.h +++ b/drivers/media/dvb/frontends/mt2060.h | |||
@@ -35,7 +35,7 @@ extern struct dvb_frontend * mt2060_attach(struct dvb_frontend *fe, struct i2c_a | |||
35 | #else | 35 | #else |
36 | static inline struct dvb_frontend * mt2060_attach(struct dvb_frontend *fe, struct i2c_adapter *i2c, struct mt2060_config *cfg, u16 if1) | 36 | static inline struct dvb_frontend * mt2060_attach(struct dvb_frontend *fe, struct i2c_adapter *i2c, struct mt2060_config *cfg, u16 if1) |
37 | { | 37 | { |
38 | printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __FUNCTION__); | 38 | printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__); |
39 | return NULL; | 39 | return NULL; |
40 | } | 40 | } |
41 | #endif // CONFIG_DVB_TUNER_MT2060 | 41 | #endif // CONFIG_DVB_TUNER_MT2060 |
diff --git a/drivers/media/dvb/frontends/mt2131.c b/drivers/media/dvb/frontends/mt2131.c index 13cf16668171..e254bcfc2efb 100644 --- a/drivers/media/dvb/frontends/mt2131.c +++ b/drivers/media/dvb/frontends/mt2131.c | |||
@@ -110,7 +110,7 @@ static int mt2131_set_params(struct dvb_frontend *fe, | |||
110 | priv->bandwidth = 0; | 110 | priv->bandwidth = 0; |
111 | 111 | ||
112 | freq = params->frequency / 1000; // Hz -> kHz | 112 | freq = params->frequency / 1000; // Hz -> kHz |
113 | dprintk(1, "%s() freq=%d\n", __FUNCTION__, freq); | 113 | dprintk(1, "%s() freq=%d\n", __func__, freq); |
114 | 114 | ||
115 | f_lo1 = freq + MT2131_IF1 * 1000; | 115 | f_lo1 = freq + MT2131_IF1 * 1000; |
116 | f_lo1 = (f_lo1 / 250) * 250; | 116 | f_lo1 = (f_lo1 / 250) * 250; |
@@ -187,7 +187,7 @@ static int mt2131_set_params(struct dvb_frontend *fe, | |||
187 | static int mt2131_get_frequency(struct dvb_frontend *fe, u32 *frequency) | 187 | static int mt2131_get_frequency(struct dvb_frontend *fe, u32 *frequency) |
188 | { | 188 | { |
189 | struct mt2131_priv *priv = fe->tuner_priv; | 189 | struct mt2131_priv *priv = fe->tuner_priv; |
190 | dprintk(1, "%s()\n", __FUNCTION__); | 190 | dprintk(1, "%s()\n", __func__); |
191 | *frequency = priv->frequency; | 191 | *frequency = priv->frequency; |
192 | return 0; | 192 | return 0; |
193 | } | 193 | } |
@@ -195,7 +195,7 @@ static int mt2131_get_frequency(struct dvb_frontend *fe, u32 *frequency) | |||
195 | static int mt2131_get_bandwidth(struct dvb_frontend *fe, u32 *bandwidth) | 195 | static int mt2131_get_bandwidth(struct dvb_frontend *fe, u32 *bandwidth) |
196 | { | 196 | { |
197 | struct mt2131_priv *priv = fe->tuner_priv; | 197 | struct mt2131_priv *priv = fe->tuner_priv; |
198 | dprintk(1, "%s()\n", __FUNCTION__); | 198 | dprintk(1, "%s()\n", __func__); |
199 | *bandwidth = priv->bandwidth; | 199 | *bandwidth = priv->bandwidth; |
200 | return 0; | 200 | return 0; |
201 | } | 201 | } |
@@ -214,7 +214,7 @@ static int mt2131_get_status(struct dvb_frontend *fe, u32 *status) | |||
214 | 214 | ||
215 | mt2131_readreg(priv, 0x09, &afc_status); | 215 | mt2131_readreg(priv, 0x09, &afc_status); |
216 | dprintk(1, "%s() - LO Status = 0x%x, AFC Status = 0x%x\n", | 216 | dprintk(1, "%s() - LO Status = 0x%x, AFC Status = 0x%x\n", |
217 | __FUNCTION__, lock_status, afc_status); | 217 | __func__, lock_status, afc_status); |
218 | 218 | ||
219 | return 0; | 219 | return 0; |
220 | } | 220 | } |
@@ -223,7 +223,7 @@ static int mt2131_init(struct dvb_frontend *fe) | |||
223 | { | 223 | { |
224 | struct mt2131_priv *priv = fe->tuner_priv; | 224 | struct mt2131_priv *priv = fe->tuner_priv; |
225 | int ret; | 225 | int ret; |
226 | dprintk(1, "%s()\n", __FUNCTION__); | 226 | dprintk(1, "%s()\n", __func__); |
227 | 227 | ||
228 | if ((ret = mt2131_writeregs(priv, mt2131_config1, | 228 | if ((ret = mt2131_writeregs(priv, mt2131_config1, |
229 | sizeof(mt2131_config1))) < 0) | 229 | sizeof(mt2131_config1))) < 0) |
@@ -243,7 +243,7 @@ static int mt2131_init(struct dvb_frontend *fe) | |||
243 | 243 | ||
244 | static int mt2131_release(struct dvb_frontend *fe) | 244 | static int mt2131_release(struct dvb_frontend *fe) |
245 | { | 245 | { |
246 | dprintk(1, "%s()\n", __FUNCTION__); | 246 | dprintk(1, "%s()\n", __func__); |
247 | kfree(fe->tuner_priv); | 247 | kfree(fe->tuner_priv); |
248 | fe->tuner_priv = NULL; | 248 | fe->tuner_priv = NULL; |
249 | return 0; | 249 | return 0; |
@@ -273,7 +273,7 @@ struct dvb_frontend * mt2131_attach(struct dvb_frontend *fe, | |||
273 | struct mt2131_priv *priv = NULL; | 273 | struct mt2131_priv *priv = NULL; |
274 | u8 id = 0; | 274 | u8 id = 0; |
275 | 275 | ||
276 | dprintk(1, "%s()\n", __FUNCTION__); | 276 | dprintk(1, "%s()\n", __func__); |
277 | 277 | ||
278 | priv = kzalloc(sizeof(struct mt2131_priv), GFP_KERNEL); | 278 | priv = kzalloc(sizeof(struct mt2131_priv), GFP_KERNEL); |
279 | if (priv == NULL) | 279 | if (priv == NULL) |
diff --git a/drivers/media/dvb/frontends/mt2131.h b/drivers/media/dvb/frontends/mt2131.h index 1e4ffe7dc8c8..606d8576bc98 100644 --- a/drivers/media/dvb/frontends/mt2131.h +++ b/drivers/media/dvb/frontends/mt2131.h | |||
@@ -41,7 +41,7 @@ static inline struct dvb_frontend* mt2131_attach(struct dvb_frontend *fe, | |||
41 | struct mt2131_config *cfg, | 41 | struct mt2131_config *cfg, |
42 | u16 if1) | 42 | u16 if1) |
43 | { | 43 | { |
44 | printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __FUNCTION__); | 44 | printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__); |
45 | return NULL; | 45 | return NULL; |
46 | } | 46 | } |
47 | #endif /* CONFIG_DVB_TUNER_MT2131 */ | 47 | #endif /* CONFIG_DVB_TUNER_MT2131 */ |
diff --git a/drivers/media/dvb/frontends/mt2266.h b/drivers/media/dvb/frontends/mt2266.h index f31dd613ad37..c5113efe333c 100644 --- a/drivers/media/dvb/frontends/mt2266.h +++ b/drivers/media/dvb/frontends/mt2266.h | |||
@@ -29,7 +29,7 @@ extern struct dvb_frontend * mt2266_attach(struct dvb_frontend *fe, struct i2c_a | |||
29 | #else | 29 | #else |
30 | static inline struct dvb_frontend * mt2266_attach(struct dvb_frontend *fe, struct i2c_adapter *i2c, struct mt2266_config *cfg) | 30 | static inline struct dvb_frontend * mt2266_attach(struct dvb_frontend *fe, struct i2c_adapter *i2c, struct mt2266_config *cfg) |
31 | { | 31 | { |
32 | printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __FUNCTION__); | 32 | printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__); |
33 | return NULL; | 33 | return NULL; |
34 | } | 34 | } |
35 | #endif // CONFIG_DVB_TUNER_MT2266 | 35 | #endif // CONFIG_DVB_TUNER_MT2266 |
diff --git a/drivers/media/dvb/frontends/mt312.c b/drivers/media/dvb/frontends/mt312.c index 1638301fbd6e..081ca3398c76 100644 --- a/drivers/media/dvb/frontends/mt312.c +++ b/drivers/media/dvb/frontends/mt312.c | |||
@@ -1,7 +1,8 @@ | |||
1 | /* | 1 | /* |
2 | Driver for Zarlink VP310/MT312 Satellite Channel Decoder | 2 | Driver for Zarlink VP310/MT312/ZL10313 Satellite Channel Decoder |
3 | 3 | ||
4 | Copyright (C) 2003 Andreas Oberritter <obi@linuxtv.org> | 4 | Copyright (C) 2003 Andreas Oberritter <obi@linuxtv.org> |
5 | Copyright (C) 2008 Matthias Schwarzott <zzam@gentoo.org> | ||
5 | 6 | ||
6 | This program is free software; you can redistribute it and/or modify | 7 | 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 | it under the terms of the GNU General Public License as published by |
@@ -43,7 +44,8 @@ struct mt312_state { | |||
43 | struct dvb_frontend frontend; | 44 | struct dvb_frontend frontend; |
44 | 45 | ||
45 | u8 id; | 46 | u8 id; |
46 | u8 frequency; | 47 | unsigned long xtal; |
48 | u8 freq_mult; | ||
47 | }; | 49 | }; |
48 | 50 | ||
49 | static int debug; | 51 | static int debug; |
@@ -53,12 +55,11 @@ static int debug; | |||
53 | printk(KERN_DEBUG "mt312: " args); \ | 55 | printk(KERN_DEBUG "mt312: " args); \ |
54 | } while (0) | 56 | } while (0) |
55 | 57 | ||
56 | #define MT312_SYS_CLK 90000000UL /* 90 MHz */ | ||
57 | #define MT312_LPOWER_SYS_CLK 60000000UL /* 60 MHz */ | ||
58 | #define MT312_PLL_CLK 10000000UL /* 10 MHz */ | 58 | #define MT312_PLL_CLK 10000000UL /* 10 MHz */ |
59 | #define MT312_PLL_CLK_10_111 10111000UL /* 10.111 MHz */ | ||
59 | 60 | ||
60 | static int mt312_read(struct mt312_state *state, const enum mt312_reg_addr reg, | 61 | static int mt312_read(struct mt312_state *state, const enum mt312_reg_addr reg, |
61 | void *buf, const size_t count) | 62 | u8 *buf, const size_t count) |
62 | { | 63 | { |
63 | int ret; | 64 | int ret; |
64 | struct i2c_msg msg[2]; | 65 | struct i2c_msg msg[2]; |
@@ -76,7 +77,7 @@ static int mt312_read(struct mt312_state *state, const enum mt312_reg_addr reg, | |||
76 | ret = i2c_transfer(state->i2c, msg, 2); | 77 | ret = i2c_transfer(state->i2c, msg, 2); |
77 | 78 | ||
78 | if (ret != 2) { | 79 | if (ret != 2) { |
79 | printk(KERN_ERR "%s: ret == %d\n", __FUNCTION__, ret); | 80 | printk(KERN_ERR "%s: ret == %d\n", __func__, ret); |
80 | return -EREMOTEIO; | 81 | return -EREMOTEIO; |
81 | } | 82 | } |
82 | 83 | ||
@@ -84,7 +85,7 @@ static int mt312_read(struct mt312_state *state, const enum mt312_reg_addr reg, | |||
84 | int i; | 85 | int i; |
85 | dprintk("R(%d):", reg & 0x7f); | 86 | dprintk("R(%d):", reg & 0x7f); |
86 | for (i = 0; i < count; i++) | 87 | for (i = 0; i < count; i++) |
87 | printk(" %02x", ((const u8 *) buf)[i]); | 88 | printk(" %02x", buf[i]); |
88 | printk("\n"); | 89 | printk("\n"); |
89 | } | 90 | } |
90 | 91 | ||
@@ -92,7 +93,7 @@ static int mt312_read(struct mt312_state *state, const enum mt312_reg_addr reg, | |||
92 | } | 93 | } |
93 | 94 | ||
94 | static int mt312_write(struct mt312_state *state, const enum mt312_reg_addr reg, | 95 | static int mt312_write(struct mt312_state *state, const enum mt312_reg_addr reg, |
95 | const void *src, const size_t count) | 96 | const u8 *src, const size_t count) |
96 | { | 97 | { |
97 | int ret; | 98 | int ret; |
98 | u8 buf[count + 1]; | 99 | u8 buf[count + 1]; |
@@ -102,7 +103,7 @@ static int mt312_write(struct mt312_state *state, const enum mt312_reg_addr reg, | |||
102 | int i; | 103 | int i; |
103 | dprintk("W(%d):", reg & 0x7f); | 104 | dprintk("W(%d):", reg & 0x7f); |
104 | for (i = 0; i < count; i++) | 105 | for (i = 0; i < count; i++) |
105 | printk(" %02x", ((const u8 *) src)[i]); | 106 | printk(" %02x", src[i]); |
106 | printk("\n"); | 107 | printk("\n"); |
107 | } | 108 | } |
108 | 109 | ||
@@ -117,7 +118,7 @@ static int mt312_write(struct mt312_state *state, const enum mt312_reg_addr reg, | |||
117 | ret = i2c_transfer(state->i2c, &msg, 1); | 118 | ret = i2c_transfer(state->i2c, &msg, 1); |
118 | 119 | ||
119 | if (ret != 1) { | 120 | if (ret != 1) { |
120 | dprintk("%s: ret == %d\n", __FUNCTION__, ret); | 121 | dprintk("%s: ret == %d\n", __func__, ret); |
121 | return -EREMOTEIO; | 122 | return -EREMOTEIO; |
122 | } | 123 | } |
123 | 124 | ||
@@ -209,7 +210,7 @@ static int mt312_get_symbol_rate(struct mt312_state *state, u32 *sr) | |||
209 | dprintk("sym_rat_op=%d dec_ratio=%d\n", | 210 | dprintk("sym_rat_op=%d dec_ratio=%d\n", |
210 | sym_rat_op, dec_ratio); | 211 | sym_rat_op, dec_ratio); |
211 | dprintk("*sr(manual) = %lu\n", | 212 | dprintk("*sr(manual) = %lu\n", |
212 | (((MT312_PLL_CLK * 8192) / (sym_rat_op + 8192)) * | 213 | (((state->xtal * 8192) / (sym_rat_op + 8192)) * |
213 | 2) - dec_ratio); | 214 | 2) - dec_ratio); |
214 | } | 215 | } |
215 | 216 | ||
@@ -242,7 +243,7 @@ static int mt312_initfe(struct dvb_frontend *fe) | |||
242 | 243 | ||
243 | /* wake up */ | 244 | /* wake up */ |
244 | ret = mt312_writereg(state, CONFIG, | 245 | ret = mt312_writereg(state, CONFIG, |
245 | (state->frequency == 60 ? 0x88 : 0x8c)); | 246 | (state->freq_mult == 6 ? 0x88 : 0x8c)); |
246 | if (ret < 0) | 247 | if (ret < 0) |
247 | return ret; | 248 | return ret; |
248 | 249 | ||
@@ -265,12 +266,37 @@ static int mt312_initfe(struct dvb_frontend *fe) | |||
265 | return ret; | 266 | return ret; |
266 | } | 267 | } |
267 | 268 | ||
269 | switch (state->id) { | ||
270 | case ID_ZL10313: | ||
271 | /* enable ADC */ | ||
272 | ret = mt312_writereg(state, GPP_CTRL, 0x80); | ||
273 | if (ret < 0) | ||
274 | return ret; | ||
275 | |||
276 | /* configure ZL10313 for optimal ADC performance */ | ||
277 | buf[0] = 0x80; | ||
278 | buf[1] = 0xB0; | ||
279 | ret = mt312_write(state, HW_CTRL, buf, 2); | ||
280 | if (ret < 0) | ||
281 | return ret; | ||
282 | |||
283 | /* enable MPEG output and ADCs */ | ||
284 | ret = mt312_writereg(state, HW_CTRL, 0x00); | ||
285 | if (ret < 0) | ||
286 | return ret; | ||
287 | |||
288 | ret = mt312_writereg(state, MPEG_CTRL, 0x00); | ||
289 | if (ret < 0) | ||
290 | return ret; | ||
291 | |||
292 | break; | ||
293 | } | ||
294 | |||
268 | /* SYS_CLK */ | 295 | /* SYS_CLK */ |
269 | buf[0] = mt312_div((state->frequency == 60 ? MT312_LPOWER_SYS_CLK : | 296 | buf[0] = mt312_div(state->xtal * state->freq_mult * 2, 1000000); |
270 | MT312_SYS_CLK) * 2, 1000000); | ||
271 | 297 | ||
272 | /* DISEQC_RATIO */ | 298 | /* DISEQC_RATIO */ |
273 | buf[1] = mt312_div(MT312_PLL_CLK, 15000 * 4); | 299 | buf[1] = mt312_div(state->xtal, 22000 * 4); |
274 | 300 | ||
275 | ret = mt312_write(state, SYS_CLK, buf, sizeof(buf)); | 301 | ret = mt312_write(state, SYS_CLK, buf, sizeof(buf)); |
276 | if (ret < 0) | 302 | if (ret < 0) |
@@ -280,7 +306,17 @@ static int mt312_initfe(struct dvb_frontend *fe) | |||
280 | if (ret < 0) | 306 | if (ret < 0) |
281 | return ret; | 307 | return ret; |
282 | 308 | ||
283 | ret = mt312_writereg(state, OP_CTRL, 0x53); | 309 | /* different MOCLK polarity */ |
310 | switch (state->id) { | ||
311 | case ID_ZL10313: | ||
312 | buf[0] = 0x33; | ||
313 | break; | ||
314 | default: | ||
315 | buf[0] = 0x53; | ||
316 | break; | ||
317 | } | ||
318 | |||
319 | ret = mt312_writereg(state, OP_CTRL, buf[0]); | ||
284 | if (ret < 0) | 320 | if (ret < 0) |
285 | return ret; | 321 | return ret; |
286 | 322 | ||
@@ -323,6 +359,9 @@ static int mt312_send_master_cmd(struct dvb_frontend *fe, | |||
323 | if (ret < 0) | 359 | if (ret < 0) |
324 | return ret; | 360 | return ret; |
325 | 361 | ||
362 | /* is there a better way to wait for message to be transmitted */ | ||
363 | msleep(100); | ||
364 | |||
326 | /* set DISEQC_MODE[2:0] to zero if a return message is expected */ | 365 | /* set DISEQC_MODE[2:0] to zero if a return message is expected */ |
327 | if (c->msg[0] & 0x02) { | 366 | if (c->msg[0] & 0x02) { |
328 | ret = mt312_writereg(state, DISEQC_MODE, (diseqc_mode & 0x40)); | 367 | ret = mt312_writereg(state, DISEQC_MODE, (diseqc_mode & 0x40)); |
@@ -383,11 +422,16 @@ static int mt312_set_voltage(struct dvb_frontend *fe, const fe_sec_voltage_t v) | |||
383 | { | 422 | { |
384 | struct mt312_state *state = fe->demodulator_priv; | 423 | struct mt312_state *state = fe->demodulator_priv; |
385 | const u8 volt_tab[3] = { 0x00, 0x40, 0x00 }; | 424 | const u8 volt_tab[3] = { 0x00, 0x40, 0x00 }; |
425 | u8 val; | ||
386 | 426 | ||
387 | if (v > SEC_VOLTAGE_OFF) | 427 | if (v > SEC_VOLTAGE_OFF) |
388 | return -EINVAL; | 428 | return -EINVAL; |
389 | 429 | ||
390 | return mt312_writereg(state, DISEQC_MODE, volt_tab[v]); | 430 | val = volt_tab[v]; |
431 | if (state->config->voltage_inverted) | ||
432 | val ^= 0x40; | ||
433 | |||
434 | return mt312_writereg(state, DISEQC_MODE, val); | ||
391 | } | 435 | } |
392 | 436 | ||
393 | static int mt312_read_status(struct dvb_frontend *fe, fe_status_t *s) | 437 | static int mt312_read_status(struct dvb_frontend *fe, fe_status_t *s) |
@@ -463,7 +507,7 @@ static int mt312_read_snr(struct dvb_frontend *fe, u16 *snr) | |||
463 | int ret; | 507 | int ret; |
464 | u8 buf[2]; | 508 | u8 buf[2]; |
465 | 509 | ||
466 | ret = mt312_read(state, M_SNR_H, &buf, sizeof(buf)); | 510 | ret = mt312_read(state, M_SNR_H, buf, sizeof(buf)); |
467 | if (ret < 0) | 511 | if (ret < 0) |
468 | return ret; | 512 | return ret; |
469 | 513 | ||
@@ -478,7 +522,7 @@ static int mt312_read_ucblocks(struct dvb_frontend *fe, u32 *ubc) | |||
478 | int ret; | 522 | int ret; |
479 | u8 buf[2]; | 523 | u8 buf[2]; |
480 | 524 | ||
481 | ret = mt312_read(state, RS_UBC_H, &buf, sizeof(buf)); | 525 | ret = mt312_read(state, RS_UBC_H, buf, sizeof(buf)); |
482 | if (ret < 0) | 526 | if (ret < 0) |
483 | return ret; | 527 | return ret; |
484 | 528 | ||
@@ -499,7 +543,7 @@ static int mt312_set_frontend(struct dvb_frontend *fe, | |||
499 | { 0x00, 0x01, 0x02, 0x04, 0x3f, 0x08, 0x10, 0x20, 0x3f, 0x3f }; | 543 | { 0x00, 0x01, 0x02, 0x04, 0x3f, 0x08, 0x10, 0x20, 0x3f, 0x3f }; |
500 | const u8 inv_tab[3] = { 0x00, 0x40, 0x80 }; | 544 | const u8 inv_tab[3] = { 0x00, 0x40, 0x80 }; |
501 | 545 | ||
502 | dprintk("%s: Freq %d\n", __FUNCTION__, p->frequency); | 546 | dprintk("%s: Freq %d\n", __func__, p->frequency); |
503 | 547 | ||
504 | if ((p->frequency < fe->ops.info.frequency_min) | 548 | if ((p->frequency < fe->ops.info.frequency_min) |
505 | || (p->frequency > fe->ops.info.frequency_max)) | 549 | || (p->frequency > fe->ops.info.frequency_max)) |
@@ -532,17 +576,17 @@ static int mt312_set_frontend(struct dvb_frontend *fe, | |||
532 | return ret; | 576 | return ret; |
533 | if (p->u.qpsk.symbol_rate >= 30000000) { | 577 | if (p->u.qpsk.symbol_rate >= 30000000) { |
534 | /* Note that 30MS/s should use 90MHz */ | 578 | /* Note that 30MS/s should use 90MHz */ |
535 | if ((config_val & 0x0c) == 0x08) { | 579 | if (state->freq_mult == 6) { |
536 | /* We are running 60MHz */ | 580 | /* We are running 60MHz */ |
537 | state->frequency = 90; | 581 | state->freq_mult = 9; |
538 | ret = mt312_initfe(fe); | 582 | ret = mt312_initfe(fe); |
539 | if (ret < 0) | 583 | if (ret < 0) |
540 | return ret; | 584 | return ret; |
541 | } | 585 | } |
542 | } else { | 586 | } else { |
543 | if ((config_val & 0x0c) == 0x0C) { | 587 | if (state->freq_mult == 9) { |
544 | /* We are running 90MHz */ | 588 | /* We are running 90MHz */ |
545 | state->frequency = 60; | 589 | state->freq_mult = 6; |
546 | ret = mt312_initfe(fe); | 590 | ret = mt312_initfe(fe); |
547 | if (ret < 0) | 591 | if (ret < 0) |
548 | return ret; | 592 | return ret; |
@@ -551,6 +595,7 @@ static int mt312_set_frontend(struct dvb_frontend *fe, | |||
551 | break; | 595 | break; |
552 | 596 | ||
553 | case ID_MT312: | 597 | case ID_MT312: |
598 | case ID_ZL10313: | ||
554 | break; | 599 | break; |
555 | 600 | ||
556 | default: | 601 | default: |
@@ -616,11 +661,29 @@ static int mt312_i2c_gate_ctrl(struct dvb_frontend *fe, int enable) | |||
616 | { | 661 | { |
617 | struct mt312_state *state = fe->demodulator_priv; | 662 | struct mt312_state *state = fe->demodulator_priv; |
618 | 663 | ||
619 | if (enable) { | 664 | u8 val = 0x00; |
620 | return mt312_writereg(state, GPP_CTRL, 0x40); | 665 | int ret; |
621 | } else { | 666 | |
622 | return mt312_writereg(state, GPP_CTRL, 0x00); | 667 | switch (state->id) { |
668 | case ID_ZL10313: | ||
669 | ret = mt312_readreg(state, GPP_CTRL, &val); | ||
670 | if (ret < 0) | ||
671 | goto error; | ||
672 | |||
673 | /* preserve this bit to not accidently shutdown ADC */ | ||
674 | val &= 0x80; | ||
675 | break; | ||
623 | } | 676 | } |
677 | |||
678 | if (enable) | ||
679 | val |= 0x40; | ||
680 | else | ||
681 | val &= ~0x40; | ||
682 | |||
683 | ret = mt312_writereg(state, GPP_CTRL, val); | ||
684 | |||
685 | error: | ||
686 | return ret; | ||
624 | } | 687 | } |
625 | 688 | ||
626 | static int mt312_sleep(struct dvb_frontend *fe) | 689 | static int mt312_sleep(struct dvb_frontend *fe) |
@@ -634,6 +697,18 @@ static int mt312_sleep(struct dvb_frontend *fe) | |||
634 | if (ret < 0) | 697 | if (ret < 0) |
635 | return ret; | 698 | return ret; |
636 | 699 | ||
700 | if (state->id == ID_ZL10313) { | ||
701 | /* reset ADC */ | ||
702 | ret = mt312_writereg(state, GPP_CTRL, 0x00); | ||
703 | if (ret < 0) | ||
704 | return ret; | ||
705 | |||
706 | /* full shutdown of ADCs, mpeg bus tristated */ | ||
707 | ret = mt312_writereg(state, HW_CTRL, 0x0d); | ||
708 | if (ret < 0) | ||
709 | return ret; | ||
710 | } | ||
711 | |||
637 | ret = mt312_readreg(state, CONFIG, &config); | 712 | ret = mt312_readreg(state, CONFIG, &config); |
638 | if (ret < 0) | 713 | if (ret < 0) |
639 | return ret; | 714 | return ret; |
@@ -661,6 +736,7 @@ static void mt312_release(struct dvb_frontend *fe) | |||
661 | kfree(state); | 736 | kfree(state); |
662 | } | 737 | } |
663 | 738 | ||
739 | #define MT312_SYS_CLK 90000000UL /* 90 MHz */ | ||
664 | static struct dvb_frontend_ops vp310_mt312_ops = { | 740 | static struct dvb_frontend_ops vp310_mt312_ops = { |
665 | 741 | ||
666 | .info = { | 742 | .info = { |
@@ -668,8 +744,8 @@ static struct dvb_frontend_ops vp310_mt312_ops = { | |||
668 | .type = FE_QPSK, | 744 | .type = FE_QPSK, |
669 | .frequency_min = 950000, | 745 | .frequency_min = 950000, |
670 | .frequency_max = 2150000, | 746 | .frequency_max = 2150000, |
671 | .frequency_stepsize = (MT312_PLL_CLK / 1000) / 128, | 747 | .frequency_stepsize = (MT312_PLL_CLK / 1000) / 128, /* FIXME: adjust freq to real used xtal */ |
672 | .symbol_rate_min = MT312_SYS_CLK / 128, | 748 | .symbol_rate_min = MT312_SYS_CLK / 128, /* FIXME as above */ |
673 | .symbol_rate_max = MT312_SYS_CLK / 2, | 749 | .symbol_rate_max = MT312_SYS_CLK / 2, |
674 | .caps = | 750 | .caps = |
675 | FE_CAN_FEC_1_2 | FE_CAN_FEC_2_3 | | 751 | FE_CAN_FEC_1_2 | FE_CAN_FEC_2_3 | |
@@ -726,14 +802,21 @@ struct dvb_frontend *vp310_mt312_attach(const struct mt312_config *config, | |||
726 | switch (state->id) { | 802 | switch (state->id) { |
727 | case ID_VP310: | 803 | case ID_VP310: |
728 | strcpy(state->frontend.ops.info.name, "Zarlink VP310 DVB-S"); | 804 | strcpy(state->frontend.ops.info.name, "Zarlink VP310 DVB-S"); |
729 | state->frequency = 90; | 805 | state->xtal = MT312_PLL_CLK; |
806 | state->freq_mult = 9; | ||
730 | break; | 807 | break; |
731 | case ID_MT312: | 808 | case ID_MT312: |
732 | strcpy(state->frontend.ops.info.name, "Zarlink MT312 DVB-S"); | 809 | strcpy(state->frontend.ops.info.name, "Zarlink MT312 DVB-S"); |
733 | state->frequency = 60; | 810 | state->xtal = MT312_PLL_CLK; |
811 | state->freq_mult = 6; | ||
812 | break; | ||
813 | case ID_ZL10313: | ||
814 | strcpy(state->frontend.ops.info.name, "Zarlink ZL10313 DVB-S"); | ||
815 | state->xtal = MT312_PLL_CLK_10_111; | ||
816 | state->freq_mult = 9; | ||
734 | break; | 817 | break; |
735 | default: | 818 | default: |
736 | printk(KERN_WARNING "Only Zarlink VP310/MT312" | 819 | printk(KERN_WARNING "Only Zarlink VP310/MT312/ZL10313" |
737 | " are supported chips.\n"); | 820 | " are supported chips.\n"); |
738 | goto error; | 821 | goto error; |
739 | } | 822 | } |
@@ -749,7 +832,7 @@ EXPORT_SYMBOL(vp310_mt312_attach); | |||
749 | module_param(debug, int, 0644); | 832 | module_param(debug, int, 0644); |
750 | MODULE_PARM_DESC(debug, "Turn on/off frontend debugging (default:off)."); | 833 | MODULE_PARM_DESC(debug, "Turn on/off frontend debugging (default:off)."); |
751 | 834 | ||
752 | MODULE_DESCRIPTION("Zarlink VP310/MT312 DVB-S Demodulator driver"); | 835 | MODULE_DESCRIPTION("Zarlink VP310/MT312/ZL10313 DVB-S Demodulator driver"); |
753 | MODULE_AUTHOR("Andreas Oberritter <obi@linuxtv.org>"); | 836 | MODULE_AUTHOR("Andreas Oberritter <obi@linuxtv.org>"); |
754 | MODULE_LICENSE("GPL"); | 837 | MODULE_LICENSE("GPL"); |
755 | 838 | ||
diff --git a/drivers/media/dvb/frontends/mt312.h b/drivers/media/dvb/frontends/mt312.h index f17cb93ba9ba..96338f0c4dd4 100644 --- a/drivers/media/dvb/frontends/mt312.h +++ b/drivers/media/dvb/frontends/mt312.h | |||
@@ -31,6 +31,9 @@ | |||
31 | struct mt312_config { | 31 | struct mt312_config { |
32 | /* the demodulator's i2c address */ | 32 | /* the demodulator's i2c address */ |
33 | u8 demod_address; | 33 | u8 demod_address; |
34 | |||
35 | /* inverted voltage setting */ | ||
36 | int voltage_inverted:1; | ||
34 | }; | 37 | }; |
35 | 38 | ||
36 | #if defined(CONFIG_DVB_MT312) || (defined(CONFIG_DVB_MT312_MODULE) && defined(MODULE)) | 39 | #if defined(CONFIG_DVB_MT312) || (defined(CONFIG_DVB_MT312_MODULE) && defined(MODULE)) |
@@ -40,7 +43,7 @@ struct dvb_frontend *vp310_mt312_attach(const struct mt312_config *config, | |||
40 | static inline struct dvb_frontend *vp310_mt312_attach( | 43 | static inline struct dvb_frontend *vp310_mt312_attach( |
41 | const struct mt312_config *config, struct i2c_adapter *i2c) | 44 | const struct mt312_config *config, struct i2c_adapter *i2c) |
42 | { | 45 | { |
43 | printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __FUNCTION__); | 46 | printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__); |
44 | return NULL; | 47 | return NULL; |
45 | } | 48 | } |
46 | #endif /* CONFIG_DVB_MT312 */ | 49 | #endif /* CONFIG_DVB_MT312 */ |
diff --git a/drivers/media/dvb/frontends/mt312_priv.h b/drivers/media/dvb/frontends/mt312_priv.h index 5e0b95b5337b..a3959f94d639 100644 --- a/drivers/media/dvb/frontends/mt312_priv.h +++ b/drivers/media/dvb/frontends/mt312_priv.h | |||
@@ -110,6 +110,8 @@ enum mt312_reg_addr { | |||
110 | VIT_ERRPER_H = 83, | 110 | VIT_ERRPER_H = 83, |
111 | VIT_ERRPER_M = 84, | 111 | VIT_ERRPER_M = 84, |
112 | VIT_ERRPER_L = 85, | 112 | VIT_ERRPER_L = 85, |
113 | HW_CTRL = 84, /* ZL10313 only */ | ||
114 | MPEG_CTRL = 85, /* ZL10313 only */ | ||
113 | VIT_SETUP = 86, | 115 | VIT_SETUP = 86, |
114 | VIT_REF0 = 87, | 116 | VIT_REF0 = 87, |
115 | VIT_REF1 = 88, | 117 | VIT_REF1 = 88, |
@@ -156,7 +158,8 @@ enum mt312_reg_addr { | |||
156 | 158 | ||
157 | enum mt312_model_id { | 159 | enum mt312_model_id { |
158 | ID_VP310 = 1, | 160 | ID_VP310 = 1, |
159 | ID_MT312 = 3 | 161 | ID_MT312 = 3, |
162 | ID_ZL10313 = 5, | ||
160 | }; | 163 | }; |
161 | 164 | ||
162 | #endif /* DVB_FRONTENDS_MT312_PRIV */ | 165 | #endif /* DVB_FRONTENDS_MT312_PRIV */ |
diff --git a/drivers/media/dvb/frontends/mt352.c b/drivers/media/dvb/frontends/mt352.c index 7cd190b6f015..beba5aa0db50 100644 --- a/drivers/media/dvb/frontends/mt352.c +++ b/drivers/media/dvb/frontends/mt352.c | |||
@@ -95,7 +95,7 @@ static int mt352_read_register(struct mt352_state* state, u8 reg) | |||
95 | 95 | ||
96 | if (ret != 2) { | 96 | if (ret != 2) { |
97 | printk("%s: readreg error (reg=%d, ret==%i)\n", | 97 | printk("%s: readreg error (reg=%d, ret==%i)\n", |
98 | __FUNCTION__, reg, ret); | 98 | __func__, reg, ret); |
99 | return ret; | 99 | return ret; |
100 | } | 100 | } |
101 | 101 | ||
@@ -135,7 +135,7 @@ static void mt352_calc_nominal_rate(struct mt352_state* state, | |||
135 | value = 64 * bw * (1<<16) / (7 * 8); | 135 | value = 64 * bw * (1<<16) / (7 * 8); |
136 | value = value * 1000 / adc_clock; | 136 | value = value * 1000 / adc_clock; |
137 | dprintk("%s: bw %d, adc_clock %d => 0x%x\n", | 137 | dprintk("%s: bw %d, adc_clock %d => 0x%x\n", |
138 | __FUNCTION__, bw, adc_clock, value); | 138 | __func__, bw, adc_clock, value); |
139 | buf[0] = msb(value); | 139 | buf[0] = msb(value); |
140 | buf[1] = lsb(value); | 140 | buf[1] = lsb(value); |
141 | } | 141 | } |
@@ -161,7 +161,7 @@ static void mt352_calc_input_freq(struct mt352_state* state, | |||
161 | } | 161 | } |
162 | value = -16374 * ife / adc_clock; | 162 | value = -16374 * ife / adc_clock; |
163 | dprintk("%s: if2 %d, ife %d, adc_clock %d => %d / 0x%x\n", | 163 | dprintk("%s: if2 %d, ife %d, adc_clock %d => %d / 0x%x\n", |
164 | __FUNCTION__, if2, ife, adc_clock, value, value & 0x3fff); | 164 | __func__, if2, ife, adc_clock, value, value & 0x3fff); |
165 | buf[0] = msb(value); | 165 | buf[0] = msb(value); |
166 | buf[1] = lsb(value); | 166 | buf[1] = lsb(value); |
167 | } | 167 | } |
@@ -521,7 +521,7 @@ static int mt352_init(struct dvb_frontend* fe) | |||
521 | 521 | ||
522 | static u8 mt352_reset_attach [] = { RESET, 0xC0 }; | 522 | static u8 mt352_reset_attach [] = { RESET, 0xC0 }; |
523 | 523 | ||
524 | dprintk("%s: hello\n",__FUNCTION__); | 524 | dprintk("%s: hello\n",__func__); |
525 | 525 | ||
526 | if ((mt352_read_register(state, CLOCK_CTL) & 0x10) == 0 || | 526 | if ((mt352_read_register(state, CLOCK_CTL) & 0x10) == 0 || |
527 | (mt352_read_register(state, CONFIG) & 0x20) == 0) { | 527 | (mt352_read_register(state, CONFIG) & 0x20) == 0) { |
diff --git a/drivers/media/dvb/frontends/mt352.h b/drivers/media/dvb/frontends/mt352.h index e9964081fd84..595092f9f0c4 100644 --- a/drivers/media/dvb/frontends/mt352.h +++ b/drivers/media/dvb/frontends/mt352.h | |||
@@ -58,7 +58,7 @@ extern struct dvb_frontend* mt352_attach(const struct mt352_config* config, | |||
58 | static inline struct dvb_frontend* mt352_attach(const struct mt352_config* config, | 58 | static inline struct dvb_frontend* mt352_attach(const struct mt352_config* config, |
59 | struct i2c_adapter* i2c) | 59 | struct i2c_adapter* i2c) |
60 | { | 60 | { |
61 | printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __FUNCTION__); | 61 | printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__); |
62 | return NULL; | 62 | return NULL; |
63 | } | 63 | } |
64 | #endif // CONFIG_DVB_MT352 | 64 | #endif // CONFIG_DVB_MT352 |
diff --git a/drivers/media/dvb/frontends/nxt200x.c b/drivers/media/dvb/frontends/nxt200x.c index fcf964fe1d6b..23d022852543 100644 --- a/drivers/media/dvb/frontends/nxt200x.c +++ b/drivers/media/dvb/frontends/nxt200x.c | |||
@@ -74,7 +74,7 @@ static int i2c_writebytes (struct nxt200x_state* state, u8 addr, u8 *buf, u8 len | |||
74 | 74 | ||
75 | if ((err = i2c_transfer (state->i2c, &msg, 1)) != 1) { | 75 | if ((err = i2c_transfer (state->i2c, &msg, 1)) != 1) { |
76 | printk (KERN_WARNING "nxt200x: %s: i2c write error (addr 0x%02x, err == %i)\n", | 76 | printk (KERN_WARNING "nxt200x: %s: i2c write error (addr 0x%02x, err == %i)\n", |
77 | __FUNCTION__, addr, err); | 77 | __func__, addr, err); |
78 | return -EREMOTEIO; | 78 | return -EREMOTEIO; |
79 | } | 79 | } |
80 | return 0; | 80 | return 0; |
@@ -87,7 +87,7 @@ static u8 i2c_readbytes (struct nxt200x_state* state, u8 addr, u8* buf, u8 len) | |||
87 | 87 | ||
88 | if ((err = i2c_transfer (state->i2c, &msg, 1)) != 1) { | 88 | if ((err = i2c_transfer (state->i2c, &msg, 1)) != 1) { |
89 | printk (KERN_WARNING "nxt200x: %s: i2c read error (addr 0x%02x, err == %i)\n", | 89 | printk (KERN_WARNING "nxt200x: %s: i2c read error (addr 0x%02x, err == %i)\n", |
90 | __FUNCTION__, addr, err); | 90 | __func__, addr, err); |
91 | return -EREMOTEIO; | 91 | return -EREMOTEIO; |
92 | } | 92 | } |
93 | return 0; | 93 | return 0; |
@@ -104,7 +104,7 @@ static int nxt200x_writebytes (struct nxt200x_state* state, u8 reg, u8 *buf, u8 | |||
104 | 104 | ||
105 | if ((err = i2c_transfer (state->i2c, &msg, 1)) != 1) { | 105 | if ((err = i2c_transfer (state->i2c, &msg, 1)) != 1) { |
106 | printk (KERN_WARNING "nxt200x: %s: i2c write error (addr 0x%02x, err == %i)\n", | 106 | printk (KERN_WARNING "nxt200x: %s: i2c write error (addr 0x%02x, err == %i)\n", |
107 | __FUNCTION__, state->config->demod_address, err); | 107 | __func__, state->config->demod_address, err); |
108 | return -EREMOTEIO; | 108 | return -EREMOTEIO; |
109 | } | 109 | } |
110 | return 0; | 110 | return 0; |
@@ -121,7 +121,7 @@ static u8 nxt200x_readbytes (struct nxt200x_state* state, u8 reg, u8* buf, u8 le | |||
121 | 121 | ||
122 | if ((err = i2c_transfer (state->i2c, msg, 2)) != 2) { | 122 | if ((err = i2c_transfer (state->i2c, msg, 2)) != 2) { |
123 | printk (KERN_WARNING "nxt200x: %s: i2c read error (addr 0x%02x, err == %i)\n", | 123 | printk (KERN_WARNING "nxt200x: %s: i2c read error (addr 0x%02x, err == %i)\n", |
124 | __FUNCTION__, state->config->demod_address, err); | 124 | __func__, state->config->demod_address, err); |
125 | return -EREMOTEIO; | 125 | return -EREMOTEIO; |
126 | } | 126 | } |
127 | return 0; | 127 | return 0; |
@@ -146,7 +146,7 @@ static u16 nxt200x_crc(u16 crc, u8 c) | |||
146 | static int nxt200x_writereg_multibyte (struct nxt200x_state* state, u8 reg, u8* data, u8 len) | 146 | static int nxt200x_writereg_multibyte (struct nxt200x_state* state, u8 reg, u8* data, u8 len) |
147 | { | 147 | { |
148 | u8 attr, len2, buf; | 148 | u8 attr, len2, buf; |
149 | dprintk("%s\n", __FUNCTION__); | 149 | dprintk("%s\n", __func__); |
150 | 150 | ||
151 | /* set mutli register register */ | 151 | /* set mutli register register */ |
152 | nxt200x_writebytes(state, 0x35, ®, 1); | 152 | nxt200x_writebytes(state, 0x35, ®, 1); |
@@ -207,7 +207,7 @@ static int nxt200x_readreg_multibyte (struct nxt200x_state* state, u8 reg, u8* d | |||
207 | { | 207 | { |
208 | int i; | 208 | int i; |
209 | u8 buf, len2, attr; | 209 | u8 buf, len2, attr; |
210 | dprintk("%s\n", __FUNCTION__); | 210 | dprintk("%s\n", __func__); |
211 | 211 | ||
212 | /* set mutli register register */ | 212 | /* set mutli register register */ |
213 | nxt200x_writebytes(state, 0x35, ®, 1); | 213 | nxt200x_writebytes(state, 0x35, ®, 1); |
@@ -254,7 +254,7 @@ static int nxt200x_readreg_multibyte (struct nxt200x_state* state, u8 reg, u8* d | |||
254 | static void nxt200x_microcontroller_stop (struct nxt200x_state* state) | 254 | static void nxt200x_microcontroller_stop (struct nxt200x_state* state) |
255 | { | 255 | { |
256 | u8 buf, stopval, counter = 0; | 256 | u8 buf, stopval, counter = 0; |
257 | dprintk("%s\n", __FUNCTION__); | 257 | dprintk("%s\n", __func__); |
258 | 258 | ||
259 | /* set correct stop value */ | 259 | /* set correct stop value */ |
260 | switch (state->demod_chip) { | 260 | switch (state->demod_chip) { |
@@ -287,7 +287,7 @@ static void nxt200x_microcontroller_stop (struct nxt200x_state* state) | |||
287 | static void nxt200x_microcontroller_start (struct nxt200x_state* state) | 287 | static void nxt200x_microcontroller_start (struct nxt200x_state* state) |
288 | { | 288 | { |
289 | u8 buf; | 289 | u8 buf; |
290 | dprintk("%s\n", __FUNCTION__); | 290 | dprintk("%s\n", __func__); |
291 | 291 | ||
292 | buf = 0x00; | 292 | buf = 0x00; |
293 | nxt200x_writebytes(state, 0x22, &buf, 1); | 293 | nxt200x_writebytes(state, 0x22, &buf, 1); |
@@ -297,7 +297,7 @@ static void nxt2004_microcontroller_init (struct nxt200x_state* state) | |||
297 | { | 297 | { |
298 | u8 buf[9]; | 298 | u8 buf[9]; |
299 | u8 counter = 0; | 299 | u8 counter = 0; |
300 | dprintk("%s\n", __FUNCTION__); | 300 | dprintk("%s\n", __func__); |
301 | 301 | ||
302 | buf[0] = 0x00; | 302 | buf[0] = 0x00; |
303 | nxt200x_writebytes(state, 0x2b, buf, 1); | 303 | nxt200x_writebytes(state, 0x2b, buf, 1); |
@@ -328,7 +328,7 @@ static int nxt200x_writetuner (struct nxt200x_state* state, u8* data) | |||
328 | { | 328 | { |
329 | u8 buf, count = 0; | 329 | u8 buf, count = 0; |
330 | 330 | ||
331 | dprintk("%s\n", __FUNCTION__); | 331 | dprintk("%s\n", __func__); |
332 | 332 | ||
333 | dprintk("Tuner Bytes: %02X %02X %02X %02X\n", data[1], data[2], data[3], data[4]); | 333 | dprintk("Tuner Bytes: %02X %02X %02X %02X\n", data[1], data[2], data[3], data[4]); |
334 | 334 | ||
@@ -387,7 +387,7 @@ static int nxt200x_writetuner (struct nxt200x_state* state, u8* data) | |||
387 | static void nxt200x_agc_reset(struct nxt200x_state* state) | 387 | static void nxt200x_agc_reset(struct nxt200x_state* state) |
388 | { | 388 | { |
389 | u8 buf; | 389 | u8 buf; |
390 | dprintk("%s\n", __FUNCTION__); | 390 | dprintk("%s\n", __func__); |
391 | 391 | ||
392 | switch (state->demod_chip) { | 392 | switch (state->demod_chip) { |
393 | case NXT2002: | 393 | case NXT2002: |
@@ -416,7 +416,7 @@ static int nxt2002_load_firmware (struct dvb_frontend* fe, const struct firmware | |||
416 | u8 buf[3], written = 0, chunkpos = 0; | 416 | u8 buf[3], written = 0, chunkpos = 0; |
417 | u16 rambase, position, crc = 0; | 417 | u16 rambase, position, crc = 0; |
418 | 418 | ||
419 | dprintk("%s\n", __FUNCTION__); | 419 | dprintk("%s\n", __func__); |
420 | dprintk("Firmware is %zu bytes\n", fw->size); | 420 | dprintk("Firmware is %zu bytes\n", fw->size); |
421 | 421 | ||
422 | /* Get the RAM base for this nxt2002 */ | 422 | /* Get the RAM base for this nxt2002 */ |
@@ -483,7 +483,7 @@ static int nxt2004_load_firmware (struct dvb_frontend* fe, const struct firmware | |||
483 | u8 buf[3]; | 483 | u8 buf[3]; |
484 | u16 rambase, position, crc=0; | 484 | u16 rambase, position, crc=0; |
485 | 485 | ||
486 | dprintk("%s\n", __FUNCTION__); | 486 | dprintk("%s\n", __func__); |
487 | dprintk("Firmware is %zu bytes\n", fw->size); | 487 | dprintk("Firmware is %zu bytes\n", fw->size); |
488 | 488 | ||
489 | /* set rambase */ | 489 | /* set rambase */ |
diff --git a/drivers/media/dvb/frontends/nxt200x.h b/drivers/media/dvb/frontends/nxt200x.h index bb0ef58d7972..f3c84583770f 100644 --- a/drivers/media/dvb/frontends/nxt200x.h +++ b/drivers/media/dvb/frontends/nxt200x.h | |||
@@ -49,7 +49,7 @@ extern struct dvb_frontend* nxt200x_attach(const struct nxt200x_config* config, | |||
49 | static inline struct dvb_frontend* nxt200x_attach(const struct nxt200x_config* config, | 49 | static inline struct dvb_frontend* nxt200x_attach(const struct nxt200x_config* config, |
50 | struct i2c_adapter* i2c) | 50 | struct i2c_adapter* i2c) |
51 | { | 51 | { |
52 | printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __FUNCTION__); | 52 | printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__); |
53 | return NULL; | 53 | return NULL; |
54 | } | 54 | } |
55 | #endif // CONFIG_DVB_NXT200X | 55 | #endif // CONFIG_DVB_NXT200X |
diff --git a/drivers/media/dvb/frontends/nxt6000.c b/drivers/media/dvb/frontends/nxt6000.c index d313d7dcf386..0eef22dbf8a0 100644 --- a/drivers/media/dvb/frontends/nxt6000.c +++ b/drivers/media/dvb/frontends/nxt6000.c | |||
@@ -38,7 +38,7 @@ struct nxt6000_state { | |||
38 | struct dvb_frontend frontend; | 38 | struct dvb_frontend frontend; |
39 | }; | 39 | }; |
40 | 40 | ||
41 | static int debug = 0; | 41 | static int debug; |
42 | #define dprintk if (debug) printk | 42 | #define dprintk if (debug) printk |
43 | 43 | ||
44 | static int nxt6000_writereg(struct nxt6000_state* state, u8 reg, u8 data) | 44 | static int nxt6000_writereg(struct nxt6000_state* state, u8 reg, u8 data) |
diff --git a/drivers/media/dvb/frontends/nxt6000.h b/drivers/media/dvb/frontends/nxt6000.h index 13d22518356e..878eb38a075e 100644 --- a/drivers/media/dvb/frontends/nxt6000.h +++ b/drivers/media/dvb/frontends/nxt6000.h | |||
@@ -40,7 +40,7 @@ extern struct dvb_frontend* nxt6000_attach(const struct nxt6000_config* config, | |||
40 | static inline struct dvb_frontend* nxt6000_attach(const struct nxt6000_config* config, | 40 | static inline struct dvb_frontend* nxt6000_attach(const struct nxt6000_config* config, |
41 | struct i2c_adapter* i2c) | 41 | struct i2c_adapter* i2c) |
42 | { | 42 | { |
43 | printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __FUNCTION__); | 43 | printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__); |
44 | return NULL; | 44 | return NULL; |
45 | } | 45 | } |
46 | #endif // CONFIG_DVB_NXT6000 | 46 | #endif // CONFIG_DVB_NXT6000 |
diff --git a/drivers/media/dvb/frontends/or51132.c b/drivers/media/dvb/frontends/or51132.c index 8ffb8daca031..c7b5785f81f2 100644 --- a/drivers/media/dvb/frontends/or51132.c +++ b/drivers/media/dvb/frontends/or51132.c | |||
@@ -419,7 +419,7 @@ static int or51132_read_status(struct dvb_frontend* fe, fe_status_t* status) | |||
419 | *status = 0; | 419 | *status = 0; |
420 | return -EREMOTEIO; | 420 | return -EREMOTEIO; |
421 | } | 421 | } |
422 | dprintk("%s: read_status %04x\n", __FUNCTION__, reg); | 422 | dprintk("%s: read_status %04x\n", __func__, reg); |
423 | 423 | ||
424 | if (reg & 0x0100) /* Receiver Lock */ | 424 | if (reg & 0x0100) /* Receiver Lock */ |
425 | *status = FE_HAS_SIGNAL|FE_HAS_CARRIER|FE_HAS_VITERBI| | 425 | *status = FE_HAS_SIGNAL|FE_HAS_CARRIER|FE_HAS_VITERBI| |
@@ -504,14 +504,14 @@ start: | |||
504 | if (retry--) goto start; | 504 | if (retry--) goto start; |
505 | return -EREMOTEIO; | 505 | return -EREMOTEIO; |
506 | } | 506 | } |
507 | dprintk("%s: modulation %02x, NTSC rej O%s\n", __FUNCTION__, | 507 | dprintk("%s: modulation %02x, NTSC rej O%s\n", __func__, |
508 | reg&0xff, reg&0x1000?"n":"ff"); | 508 | reg&0xff, reg&0x1000?"n":"ff"); |
509 | 509 | ||
510 | /* Calculate SNR using noise, c, and NTSC rejection correction */ | 510 | /* Calculate SNR using noise, c, and NTSC rejection correction */ |
511 | state->snr = calculate_snr(noise, c) - usK; | 511 | state->snr = calculate_snr(noise, c) - usK; |
512 | *snr = (state->snr) >> 16; | 512 | *snr = (state->snr) >> 16; |
513 | 513 | ||
514 | dprintk("%s: noise = 0x%08x, snr = %d.%02d dB\n", __FUNCTION__, noise, | 514 | dprintk("%s: noise = 0x%08x, snr = %d.%02d dB\n", __func__, noise, |
515 | state->snr >> 24, (((state->snr>>8) & 0xffff) * 100) >> 16); | 515 | state->snr >> 24, (((state->snr>>8) & 0xffff) * 100) >> 16); |
516 | 516 | ||
517 | return 0; | 517 | return 0; |
diff --git a/drivers/media/dvb/frontends/or51132.h b/drivers/media/dvb/frontends/or51132.h index add24f0a743b..1b8e04d973c8 100644 --- a/drivers/media/dvb/frontends/or51132.h +++ b/drivers/media/dvb/frontends/or51132.h | |||
@@ -41,7 +41,7 @@ extern struct dvb_frontend* or51132_attach(const struct or51132_config* config, | |||
41 | static inline struct dvb_frontend* or51132_attach(const struct or51132_config* config, | 41 | static inline struct dvb_frontend* or51132_attach(const struct or51132_config* config, |
42 | struct i2c_adapter* i2c) | 42 | struct i2c_adapter* i2c) |
43 | { | 43 | { |
44 | printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __FUNCTION__); | 44 | printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__); |
45 | return NULL; | 45 | return NULL; |
46 | } | 46 | } |
47 | #endif // CONFIG_DVB_OR51132 | 47 | #endif // CONFIG_DVB_OR51132 |
diff --git a/drivers/media/dvb/frontends/or51211.c b/drivers/media/dvb/frontends/or51211.c index 6a6b0d727c6f..7eaa4765593f 100644 --- a/drivers/media/dvb/frontends/or51211.c +++ b/drivers/media/dvb/frontends/or51211.c | |||
@@ -307,19 +307,19 @@ static int or51211_read_snr(struct dvb_frontend* fe, u16* snr) | |||
307 | 307 | ||
308 | if (i2c_writebytes(state,state->config->demod_address,snd_buf,3)) { | 308 | if (i2c_writebytes(state,state->config->demod_address,snd_buf,3)) { |
309 | printk(KERN_WARNING "%s: error writing snr reg\n", | 309 | printk(KERN_WARNING "%s: error writing snr reg\n", |
310 | __FUNCTION__); | 310 | __func__); |
311 | return -1; | 311 | return -1; |
312 | } | 312 | } |
313 | if (i2c_readbytes(state,state->config->demod_address,rec_buf,2)) { | 313 | if (i2c_readbytes(state,state->config->demod_address,rec_buf,2)) { |
314 | printk(KERN_WARNING "%s: read_status read error\n", | 314 | printk(KERN_WARNING "%s: read_status read error\n", |
315 | __FUNCTION__); | 315 | __func__); |
316 | return -1; | 316 | return -1; |
317 | } | 317 | } |
318 | 318 | ||
319 | state->snr = calculate_snr(rec_buf[0], 89599047); | 319 | state->snr = calculate_snr(rec_buf[0], 89599047); |
320 | *snr = (state->snr) >> 16; | 320 | *snr = (state->snr) >> 16; |
321 | 321 | ||
322 | dprintk("%s: noise = 0x%02x, snr = %d.%02d dB\n", __FUNCTION__, rec_buf[0], | 322 | dprintk("%s: noise = 0x%02x, snr = %d.%02d dB\n", __func__, rec_buf[0], |
323 | state->snr >> 24, (((state->snr>>8) & 0xffff) * 100) >> 16); | 323 | state->snr >> 24, (((state->snr>>8) & 0xffff) * 100) >> 16); |
324 | 324 | ||
325 | return 0; | 325 | return 0; |
diff --git a/drivers/media/dvb/frontends/or51211.h b/drivers/media/dvb/frontends/or51211.h index 8aad8402d615..3ce0508b898e 100644 --- a/drivers/media/dvb/frontends/or51211.h +++ b/drivers/media/dvb/frontends/or51211.h | |||
@@ -44,7 +44,7 @@ extern struct dvb_frontend* or51211_attach(const struct or51211_config* config, | |||
44 | static inline struct dvb_frontend* or51211_attach(const struct or51211_config* config, | 44 | static inline struct dvb_frontend* or51211_attach(const struct or51211_config* config, |
45 | struct i2c_adapter* i2c) | 45 | struct i2c_adapter* i2c) |
46 | { | 46 | { |
47 | printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __FUNCTION__); | 47 | printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__); |
48 | return NULL; | 48 | return NULL; |
49 | } | 49 | } |
50 | #endif // CONFIG_DVB_OR51211 | 50 | #endif // CONFIG_DVB_OR51211 |
diff --git a/drivers/media/dvb/frontends/qt1010.h b/drivers/media/dvb/frontends/qt1010.h index 3ab4aa045c36..cff6a7ca5380 100644 --- a/drivers/media/dvb/frontends/qt1010.h +++ b/drivers/media/dvb/frontends/qt1010.h | |||
@@ -45,7 +45,7 @@ static inline struct dvb_frontend *qt1010_attach(struct dvb_frontend *fe, | |||
45 | struct i2c_adapter *i2c, | 45 | struct i2c_adapter *i2c, |
46 | struct qt1010_config *cfg) | 46 | struct qt1010_config *cfg) |
47 | { | 47 | { |
48 | printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __FUNCTION__); | 48 | printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__); |
49 | return NULL; | 49 | return NULL; |
50 | } | 50 | } |
51 | #endif // CONFIG_DVB_TUNER_QT1010 | 51 | #endif // CONFIG_DVB_TUNER_QT1010 |
diff --git a/drivers/media/dvb/frontends/s5h1409.c b/drivers/media/dvb/frontends/s5h1409.c index 1a4d8319773c..b999ec424ff7 100644 --- a/drivers/media/dvb/frontends/s5h1409.c +++ b/drivers/media/dvb/frontends/s5h1409.c | |||
@@ -48,7 +48,7 @@ struct s5h1409_state { | |||
48 | u32 qam_state; | 48 | u32 qam_state; |
49 | }; | 49 | }; |
50 | 50 | ||
51 | static int debug = 0; | 51 | static int debug; |
52 | #define dprintk if (debug) printk | 52 | #define dprintk if (debug) printk |
53 | 53 | ||
54 | /* Register values to initialise the demod, this will set VSB by default */ | 54 | /* Register values to initialise the demod, this will set VSB by default */ |
@@ -312,7 +312,7 @@ static int s5h1409_writereg(struct s5h1409_state* state, u8 reg, u16 data) | |||
312 | 312 | ||
313 | if (ret != 1) | 313 | if (ret != 1) |
314 | printk("%s: writereg error (reg == 0x%02x, val == 0x%04x, " | 314 | printk("%s: writereg error (reg == 0x%02x, val == 0x%04x, " |
315 | "ret == %i)\n", __FUNCTION__, reg, data, ret); | 315 | "ret == %i)\n", __func__, reg, data, ret); |
316 | 316 | ||
317 | return (ret != 1) ? -1 : 0; | 317 | return (ret != 1) ? -1 : 0; |
318 | } | 318 | } |
@@ -332,7 +332,7 @@ static u16 s5h1409_readreg(struct s5h1409_state* state, u8 reg) | |||
332 | ret = i2c_transfer(state->i2c, msg, 2); | 332 | ret = i2c_transfer(state->i2c, msg, 2); |
333 | 333 | ||
334 | if (ret != 2) | 334 | if (ret != 2) |
335 | printk("%s: readreg error (ret == %i)\n", __FUNCTION__, ret); | 335 | printk("%s: readreg error (ret == %i)\n", __func__, ret); |
336 | return (b1[0] << 8) | b1[1]; | 336 | return (b1[0] << 8) | b1[1]; |
337 | } | 337 | } |
338 | 338 | ||
@@ -340,7 +340,7 @@ static int s5h1409_softreset(struct dvb_frontend* fe) | |||
340 | { | 340 | { |
341 | struct s5h1409_state* state = fe->demodulator_priv; | 341 | struct s5h1409_state* state = fe->demodulator_priv; |
342 | 342 | ||
343 | dprintk("%s()\n", __FUNCTION__); | 343 | dprintk("%s()\n", __func__); |
344 | 344 | ||
345 | s5h1409_writereg(state, 0xf5, 0); | 345 | s5h1409_writereg(state, 0xf5, 0); |
346 | s5h1409_writereg(state, 0xf5, 1); | 346 | s5h1409_writereg(state, 0xf5, 1); |
@@ -356,7 +356,7 @@ static int s5h1409_set_if_freq(struct dvb_frontend* fe, int KHz) | |||
356 | { | 356 | { |
357 | struct s5h1409_state* state = fe->demodulator_priv; | 357 | struct s5h1409_state* state = fe->demodulator_priv; |
358 | 358 | ||
359 | dprintk("%s(%d KHz)\n", __FUNCTION__, KHz); | 359 | dprintk("%s(%d KHz)\n", __func__, KHz); |
360 | 360 | ||
361 | switch (KHz) { | 361 | switch (KHz) { |
362 | case 4000: | 362 | case 4000: |
@@ -381,7 +381,7 @@ static int s5h1409_set_spectralinversion(struct dvb_frontend* fe, int inverted) | |||
381 | { | 381 | { |
382 | struct s5h1409_state* state = fe->demodulator_priv; | 382 | struct s5h1409_state* state = fe->demodulator_priv; |
383 | 383 | ||
384 | dprintk("%s(%d)\n", __FUNCTION__, inverted); | 384 | dprintk("%s(%d)\n", __func__, inverted); |
385 | 385 | ||
386 | if(inverted == 1) | 386 | if(inverted == 1) |
387 | return s5h1409_writereg(state, 0x1b, 0x1101); /* Inverted */ | 387 | return s5h1409_writereg(state, 0x1b, 0x1101); /* Inverted */ |
@@ -394,25 +394,25 @@ static int s5h1409_enable_modulation(struct dvb_frontend* fe, | |||
394 | { | 394 | { |
395 | struct s5h1409_state* state = fe->demodulator_priv; | 395 | struct s5h1409_state* state = fe->demodulator_priv; |
396 | 396 | ||
397 | dprintk("%s(0x%08x)\n", __FUNCTION__, m); | 397 | dprintk("%s(0x%08x)\n", __func__, m); |
398 | 398 | ||
399 | switch(m) { | 399 | switch(m) { |
400 | case VSB_8: | 400 | case VSB_8: |
401 | dprintk("%s() VSB_8\n", __FUNCTION__); | 401 | dprintk("%s() VSB_8\n", __func__); |
402 | if (state->if_freq != S5H1409_VSB_IF_FREQ) | 402 | if (state->if_freq != S5H1409_VSB_IF_FREQ) |
403 | s5h1409_set_if_freq(fe, S5H1409_VSB_IF_FREQ); | 403 | s5h1409_set_if_freq(fe, S5H1409_VSB_IF_FREQ); |
404 | s5h1409_writereg(state, 0xf4, 0); | 404 | s5h1409_writereg(state, 0xf4, 0); |
405 | break; | 405 | break; |
406 | case QAM_64: | 406 | case QAM_64: |
407 | case QAM_256: | 407 | case QAM_256: |
408 | dprintk("%s() QAM_AUTO (64/256)\n", __FUNCTION__); | 408 | dprintk("%s() QAM_AUTO (64/256)\n", __func__); |
409 | if (state->if_freq != S5H1409_QAM_IF_FREQ) | 409 | if (state->if_freq != S5H1409_QAM_IF_FREQ) |
410 | s5h1409_set_if_freq(fe, S5H1409_QAM_IF_FREQ); | 410 | s5h1409_set_if_freq(fe, S5H1409_QAM_IF_FREQ); |
411 | s5h1409_writereg(state, 0xf4, 1); | 411 | s5h1409_writereg(state, 0xf4, 1); |
412 | s5h1409_writereg(state, 0x85, 0x110); | 412 | s5h1409_writereg(state, 0x85, 0x110); |
413 | break; | 413 | break; |
414 | default: | 414 | default: |
415 | dprintk("%s() Invalid modulation\n", __FUNCTION__); | 415 | dprintk("%s() Invalid modulation\n", __func__); |
416 | return -EINVAL; | 416 | return -EINVAL; |
417 | } | 417 | } |
418 | 418 | ||
@@ -426,7 +426,7 @@ static int s5h1409_i2c_gate_ctrl(struct dvb_frontend* fe, int enable) | |||
426 | { | 426 | { |
427 | struct s5h1409_state* state = fe->demodulator_priv; | 427 | struct s5h1409_state* state = fe->demodulator_priv; |
428 | 428 | ||
429 | dprintk("%s(%d)\n", __FUNCTION__, enable); | 429 | dprintk("%s(%d)\n", __func__, enable); |
430 | 430 | ||
431 | if (enable) | 431 | if (enable) |
432 | return s5h1409_writereg(state, 0xf3, 1); | 432 | return s5h1409_writereg(state, 0xf3, 1); |
@@ -438,7 +438,7 @@ static int s5h1409_set_gpio(struct dvb_frontend* fe, int enable) | |||
438 | { | 438 | { |
439 | struct s5h1409_state* state = fe->demodulator_priv; | 439 | struct s5h1409_state* state = fe->demodulator_priv; |
440 | 440 | ||
441 | dprintk("%s(%d)\n", __FUNCTION__, enable); | 441 | dprintk("%s(%d)\n", __func__, enable); |
442 | 442 | ||
443 | if (enable) | 443 | if (enable) |
444 | return s5h1409_writereg(state, 0xe3, | 444 | return s5h1409_writereg(state, 0xe3, |
@@ -452,7 +452,7 @@ static int s5h1409_sleep(struct dvb_frontend* fe, int enable) | |||
452 | { | 452 | { |
453 | struct s5h1409_state* state = fe->demodulator_priv; | 453 | struct s5h1409_state* state = fe->demodulator_priv; |
454 | 454 | ||
455 | dprintk("%s(%d)\n", __FUNCTION__, enable); | 455 | dprintk("%s(%d)\n", __func__, enable); |
456 | 456 | ||
457 | return s5h1409_writereg(state, 0xf2, enable); | 457 | return s5h1409_writereg(state, 0xf2, enable); |
458 | } | 458 | } |
@@ -461,7 +461,7 @@ static int s5h1409_register_reset(struct dvb_frontend* fe) | |||
461 | { | 461 | { |
462 | struct s5h1409_state* state = fe->demodulator_priv; | 462 | struct s5h1409_state* state = fe->demodulator_priv; |
463 | 463 | ||
464 | dprintk("%s()\n", __FUNCTION__); | 464 | dprintk("%s()\n", __func__); |
465 | 465 | ||
466 | return s5h1409_writereg(state, 0xfa, 0); | 466 | return s5h1409_writereg(state, 0xfa, 0); |
467 | } | 467 | } |
@@ -534,7 +534,7 @@ static int s5h1409_set_frontend (struct dvb_frontend* fe, | |||
534 | { | 534 | { |
535 | struct s5h1409_state* state = fe->demodulator_priv; | 535 | struct s5h1409_state* state = fe->demodulator_priv; |
536 | 536 | ||
537 | dprintk("%s(frequency=%d)\n", __FUNCTION__, p->frequency); | 537 | dprintk("%s(frequency=%d)\n", __func__, p->frequency); |
538 | 538 | ||
539 | s5h1409_softreset(fe); | 539 | s5h1409_softreset(fe); |
540 | 540 | ||
@@ -565,7 +565,7 @@ static int s5h1409_set_mpeg_timing(struct dvb_frontend *fe, int mode) | |||
565 | struct s5h1409_state *state = fe->demodulator_priv; | 565 | struct s5h1409_state *state = fe->demodulator_priv; |
566 | u16 val; | 566 | u16 val; |
567 | 567 | ||
568 | dprintk("%s(%d)\n", __FUNCTION__, mode); | 568 | dprintk("%s(%d)\n", __func__, mode); |
569 | 569 | ||
570 | val = s5h1409_readreg(state, 0xac) & 0xcfff; | 570 | val = s5h1409_readreg(state, 0xac) & 0xcfff; |
571 | switch (mode) { | 571 | switch (mode) { |
@@ -573,7 +573,7 @@ static int s5h1409_set_mpeg_timing(struct dvb_frontend *fe, int mode) | |||
573 | val |= 0x0000; | 573 | val |= 0x0000; |
574 | break; | 574 | break; |
575 | case S5H1409_MPEGTIMING_CONTINOUS_NONINVERTING_CLOCK: | 575 | case S5H1409_MPEGTIMING_CONTINOUS_NONINVERTING_CLOCK: |
576 | dprintk("%s(%d) Mode1 or Defaulting\n", __FUNCTION__, mode); | 576 | dprintk("%s(%d) Mode1 or Defaulting\n", __func__, mode); |
577 | val |= 0x1000; | 577 | val |= 0x1000; |
578 | break; | 578 | break; |
579 | case S5H1409_MPEGTIMING_NONCONTINOUS_INVERTING_CLOCK: | 579 | case S5H1409_MPEGTIMING_NONCONTINOUS_INVERTING_CLOCK: |
@@ -597,7 +597,7 @@ static int s5h1409_init (struct dvb_frontend* fe) | |||
597 | int i; | 597 | int i; |
598 | 598 | ||
599 | struct s5h1409_state* state = fe->demodulator_priv; | 599 | struct s5h1409_state* state = fe->demodulator_priv; |
600 | dprintk("%s()\n", __FUNCTION__); | 600 | dprintk("%s()\n", __func__); |
601 | 601 | ||
602 | s5h1409_sleep(fe, 0); | 602 | s5h1409_sleep(fe, 0); |
603 | s5h1409_register_reset(fe); | 603 | s5h1409_register_reset(fe); |
@@ -663,7 +663,7 @@ static int s5h1409_read_status(struct dvb_frontend* fe, fe_status_t* status) | |||
663 | break; | 663 | break; |
664 | } | 664 | } |
665 | 665 | ||
666 | dprintk("%s() status 0x%08x\n", __FUNCTION__, *status); | 666 | dprintk("%s() status 0x%08x\n", __func__, *status); |
667 | 667 | ||
668 | return 0; | 668 | return 0; |
669 | } | 669 | } |
@@ -671,7 +671,7 @@ static int s5h1409_read_status(struct dvb_frontend* fe, fe_status_t* status) | |||
671 | static int s5h1409_qam256_lookup_snr(struct dvb_frontend* fe, u16* snr, u16 v) | 671 | static int s5h1409_qam256_lookup_snr(struct dvb_frontend* fe, u16* snr, u16 v) |
672 | { | 672 | { |
673 | int i, ret = -EINVAL; | 673 | int i, ret = -EINVAL; |
674 | dprintk("%s()\n", __FUNCTION__); | 674 | dprintk("%s()\n", __func__); |
675 | 675 | ||
676 | for (i=0; i < ARRAY_SIZE(qam256_snr_tab); i++) { | 676 | for (i=0; i < ARRAY_SIZE(qam256_snr_tab); i++) { |
677 | if (v < qam256_snr_tab[i].val) { | 677 | if (v < qam256_snr_tab[i].val) { |
@@ -686,7 +686,7 @@ static int s5h1409_qam256_lookup_snr(struct dvb_frontend* fe, u16* snr, u16 v) | |||
686 | static int s5h1409_qam64_lookup_snr(struct dvb_frontend* fe, u16* snr, u16 v) | 686 | static int s5h1409_qam64_lookup_snr(struct dvb_frontend* fe, u16* snr, u16 v) |
687 | { | 687 | { |
688 | int i, ret = -EINVAL; | 688 | int i, ret = -EINVAL; |
689 | dprintk("%s()\n", __FUNCTION__); | 689 | dprintk("%s()\n", __func__); |
690 | 690 | ||
691 | for (i=0; i < ARRAY_SIZE(qam64_snr_tab); i++) { | 691 | for (i=0; i < ARRAY_SIZE(qam64_snr_tab); i++) { |
692 | if (v < qam64_snr_tab[i].val) { | 692 | if (v < qam64_snr_tab[i].val) { |
@@ -701,7 +701,7 @@ static int s5h1409_qam64_lookup_snr(struct dvb_frontend* fe, u16* snr, u16 v) | |||
701 | static int s5h1409_vsb_lookup_snr(struct dvb_frontend* fe, u16* snr, u16 v) | 701 | static int s5h1409_vsb_lookup_snr(struct dvb_frontend* fe, u16* snr, u16 v) |
702 | { | 702 | { |
703 | int i, ret = -EINVAL; | 703 | int i, ret = -EINVAL; |
704 | dprintk("%s()\n", __FUNCTION__); | 704 | dprintk("%s()\n", __func__); |
705 | 705 | ||
706 | for (i=0; i < ARRAY_SIZE(vsb_snr_tab); i++) { | 706 | for (i=0; i < ARRAY_SIZE(vsb_snr_tab); i++) { |
707 | if (v > vsb_snr_tab[i].val) { | 707 | if (v > vsb_snr_tab[i].val) { |
@@ -710,7 +710,7 @@ static int s5h1409_vsb_lookup_snr(struct dvb_frontend* fe, u16* snr, u16 v) | |||
710 | break; | 710 | break; |
711 | } | 711 | } |
712 | } | 712 | } |
713 | dprintk("%s() snr=%d\n", __FUNCTION__, *snr); | 713 | dprintk("%s() snr=%d\n", __func__, *snr); |
714 | return ret; | 714 | return ret; |
715 | } | 715 | } |
716 | 716 | ||
@@ -718,7 +718,7 @@ static int s5h1409_read_snr(struct dvb_frontend* fe, u16* snr) | |||
718 | { | 718 | { |
719 | struct s5h1409_state* state = fe->demodulator_priv; | 719 | struct s5h1409_state* state = fe->demodulator_priv; |
720 | u16 reg; | 720 | u16 reg; |
721 | dprintk("%s()\n", __FUNCTION__); | 721 | dprintk("%s()\n", __func__); |
722 | 722 | ||
723 | switch(state->current_modulation) { | 723 | switch(state->current_modulation) { |
724 | case QAM_64: | 724 | case QAM_64: |
@@ -812,7 +812,7 @@ struct dvb_frontend* s5h1409_attach(const struct s5h1409_config* config, | |||
812 | 812 | ||
813 | if (s5h1409_init(&state->frontend) != 0) { | 813 | if (s5h1409_init(&state->frontend) != 0) { |
814 | printk(KERN_ERR "%s: Failed to initialize correctly\n", | 814 | printk(KERN_ERR "%s: Failed to initialize correctly\n", |
815 | __FUNCTION__); | 815 | __func__); |
816 | goto error; | 816 | goto error; |
817 | } | 817 | } |
818 | 818 | ||
diff --git a/drivers/media/dvb/frontends/s5h1409.h b/drivers/media/dvb/frontends/s5h1409.h index f0bb13fe808b..59f4335964c6 100644 --- a/drivers/media/dvb/frontends/s5h1409.h +++ b/drivers/media/dvb/frontends/s5h1409.h | |||
@@ -67,7 +67,7 @@ extern struct dvb_frontend* s5h1409_attach(const struct s5h1409_config* config, | |||
67 | static inline struct dvb_frontend* s5h1409_attach(const struct s5h1409_config* config, | 67 | static inline struct dvb_frontend* s5h1409_attach(const struct s5h1409_config* config, |
68 | struct i2c_adapter* i2c) | 68 | struct i2c_adapter* i2c) |
69 | { | 69 | { |
70 | printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __FUNCTION__); | 70 | printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__); |
71 | return NULL; | 71 | return NULL; |
72 | } | 72 | } |
73 | #endif /* CONFIG_DVB_S5H1409 */ | 73 | #endif /* CONFIG_DVB_S5H1409 */ |
diff --git a/drivers/media/dvb/frontends/s5h1420.c b/drivers/media/dvb/frontends/s5h1420.c index 2c2c344c4c64..281e1cb2edc6 100644 --- a/drivers/media/dvb/frontends/s5h1420.c +++ b/drivers/media/dvb/frontends/s5h1420.c | |||
@@ -1,24 +1,26 @@ | |||
1 | /* | 1 | /* |
2 | Driver for Samsung S5H1420 QPSK Demodulator | 2 | * Driver for |
3 | 3 | * Samsung S5H1420 and | |
4 | Copyright (C) 2005 Andrew de Quincey <adq_dvb@lidskialf.net> | 4 | * PnpNetwork PN1010 QPSK Demodulator |
5 | 5 | * | |
6 | This program is free software; you can redistribute it and/or modify | 6 | * Copyright (C) 2005 Andrew de Quincey <adq_dvb@lidskialf.net> |
7 | it under the terms of the GNU General Public License as published by | 7 | * Copyright (C) 2005-8 Patrick Boettcher <pb@linuxtv.org> |
8 | the Free Software Foundation; either version 2 of the License, or | 8 | * |
9 | (at your option) any later version. | 9 | * This program is free software; you can redistribute it and/or modify |
10 | 10 | * it under the terms of the GNU General Public License as published by | |
11 | This program is distributed in the hope that it will be useful, | 11 | * the Free Software Foundation; either version 2 of the License, or |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 | * (at your option) any later version. |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 13 | * |
14 | 14 | * This program is distributed in the hope that it will be useful, | |
15 | GNU General Public License for more details. | 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
16 | 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 | You should have received a copy of the GNU General Public License | 17 | * |
18 | along with this program; if not, write to the Free Software | 18 | * GNU General Public License for more details. |
19 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | 19 | * |
20 | 20 | * You should have received a copy of the GNU General Public License | |
21 | */ | 21 | * along with this program; if not, write to the Free Software |
22 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
23 | */ | ||
22 | 24 | ||
23 | #include <linux/kernel.h> | 25 | #include <linux/kernel.h> |
24 | #include <linux/module.h> | 26 | #include <linux/module.h> |
@@ -29,23 +31,35 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | |||
29 | #include <linux/jiffies.h> | 31 | #include <linux/jiffies.h> |
30 | #include <asm/div64.h> | 32 | #include <asm/div64.h> |
31 | 33 | ||
32 | #include "dvb_frontend.h" | 34 | #include <linux/i2c.h> |
33 | #include "s5h1420.h" | ||
34 | 35 | ||
35 | 36 | ||
37 | #include "dvb_frontend.h" | ||
38 | #include "s5h1420.h" | ||
39 | #include "s5h1420_priv.h" | ||
36 | 40 | ||
37 | #define TONE_FREQ 22000 | 41 | #define TONE_FREQ 22000 |
38 | 42 | ||
39 | struct s5h1420_state { | 43 | struct s5h1420_state { |
40 | struct i2c_adapter* i2c; | 44 | struct i2c_adapter* i2c; |
41 | const struct s5h1420_config* config; | 45 | const struct s5h1420_config* config; |
46 | |||
42 | struct dvb_frontend frontend; | 47 | struct dvb_frontend frontend; |
48 | struct i2c_adapter tuner_i2c_adapter; | ||
49 | |||
50 | u8 CON_1_val; | ||
43 | 51 | ||
44 | u8 postlocked:1; | 52 | u8 postlocked:1; |
45 | u32 fclk; | 53 | u32 fclk; |
46 | u32 tunedfreq; | 54 | u32 tunedfreq; |
47 | fe_code_rate_t fec_inner; | 55 | fe_code_rate_t fec_inner; |
48 | u32 symbol_rate; | 56 | u32 symbol_rate; |
57 | |||
58 | /* FIXME: ugly workaround for flexcop's incapable i2c-controller | ||
59 | * it does not support repeated-start, workaround: write addr-1 | ||
60 | * and then read | ||
61 | */ | ||
62 | u8 shadow[255]; | ||
49 | }; | 63 | }; |
50 | 64 | ||
51 | static u32 s5h1420_getsymbolrate(struct s5h1420_state* state); | 65 | static u32 s5h1420_getsymbolrate(struct s5h1420_state* state); |
@@ -53,44 +67,66 @@ static int s5h1420_get_tune_settings(struct dvb_frontend* fe, | |||
53 | struct dvb_frontend_tune_settings* fesettings); | 67 | struct dvb_frontend_tune_settings* fesettings); |
54 | 68 | ||
55 | 69 | ||
56 | static int debug = 0; | 70 | static int debug; |
57 | #define dprintk if (debug) printk | 71 | module_param(debug, int, 0644); |
72 | MODULE_PARM_DESC(debug, "enable debugging"); | ||
73 | |||
74 | #define dprintk(x...) do { \ | ||
75 | if (debug) \ | ||
76 | printk(KERN_DEBUG "S5H1420: " x); \ | ||
77 | } while (0) | ||
78 | |||
79 | static u8 s5h1420_readreg(struct s5h1420_state *state, u8 reg) | ||
80 | { | ||
81 | int ret; | ||
82 | u8 b[2]; | ||
83 | struct i2c_msg msg[] = { | ||
84 | { .addr = state->config->demod_address, .flags = 0, .buf = b, .len = 2 }, | ||
85 | { .addr = state->config->demod_address, .flags = 0, .buf = ®, .len = 1 }, | ||
86 | { .addr = state->config->demod_address, .flags = I2C_M_RD, .buf = b, .len = 1 }, | ||
87 | }; | ||
88 | |||
89 | b[0] = (reg - 1) & 0xff; | ||
90 | b[1] = state->shadow[(reg - 1) & 0xff]; | ||
91 | |||
92 | if (state->config->repeated_start_workaround) { | ||
93 | ret = i2c_transfer(state->i2c, msg, 3); | ||
94 | if (ret != 3) | ||
95 | return ret; | ||
96 | } else { | ||
97 | ret = i2c_transfer(state->i2c, &msg[1], 2); | ||
98 | if (ret != 2) | ||
99 | return ret; | ||
100 | } | ||
101 | |||
102 | /* dprintk("rd(%02x): %02x %02x\n", state->config->demod_address, reg, b[0]); */ | ||
103 | |||
104 | return b[0]; | ||
105 | } | ||
58 | 106 | ||
59 | static int s5h1420_writereg (struct s5h1420_state* state, u8 reg, u8 data) | 107 | static int s5h1420_writereg (struct s5h1420_state* state, u8 reg, u8 data) |
60 | { | 108 | { |
61 | u8 buf [] = { reg, data }; | 109 | u8 buf[] = { reg, data }; |
62 | struct i2c_msg msg = { .addr = state->config->demod_address, .flags = 0, .buf = buf, .len = 2 }; | 110 | struct i2c_msg msg = { .addr = state->config->demod_address, .flags = 0, .buf = buf, .len = 2 }; |
63 | int err; | 111 | int err; |
64 | 112 | ||
65 | if ((err = i2c_transfer (state->i2c, &msg, 1)) != 1) { | 113 | /* dprintk("wr(%02x): %02x %02x\n", state->config->demod_address, reg, data); */ |
66 | dprintk ("%s: writereg error (err == %i, reg == 0x%02x, data == 0x%02x)\n", __FUNCTION__, err, reg, data); | 114 | err = i2c_transfer(state->i2c, &msg, 1); |
115 | if (err != 1) { | ||
116 | dprintk("%s: writereg error (err == %i, reg == 0x%02x, data == 0x%02x)\n", __func__, err, reg, data); | ||
67 | return -EREMOTEIO; | 117 | return -EREMOTEIO; |
68 | } | 118 | } |
119 | state->shadow[reg] = data; | ||
69 | 120 | ||
70 | return 0; | 121 | return 0; |
71 | } | 122 | } |
72 | 123 | ||
73 | static u8 s5h1420_readreg (struct s5h1420_state* state, u8 reg) | ||
74 | { | ||
75 | int ret; | ||
76 | u8 b0 [] = { reg }; | ||
77 | u8 b1 [] = { 0 }; | ||
78 | struct i2c_msg msg1 = { .addr = state->config->demod_address, .flags = 0, .buf = b0, .len = 1 }; | ||
79 | struct i2c_msg msg2 = { .addr = state->config->demod_address, .flags = I2C_M_RD, .buf = b1, .len = 1 }; | ||
80 | |||
81 | if ((ret = i2c_transfer (state->i2c, &msg1, 1)) != 1) | ||
82 | return ret; | ||
83 | |||
84 | if ((ret = i2c_transfer (state->i2c, &msg2, 1)) != 1) | ||
85 | return ret; | ||
86 | |||
87 | return b1[0]; | ||
88 | } | ||
89 | |||
90 | static int s5h1420_set_voltage (struct dvb_frontend* fe, fe_sec_voltage_t voltage) | 124 | static int s5h1420_set_voltage (struct dvb_frontend* fe, fe_sec_voltage_t voltage) |
91 | { | 125 | { |
92 | struct s5h1420_state* state = fe->demodulator_priv; | 126 | struct s5h1420_state* state = fe->demodulator_priv; |
93 | 127 | ||
128 | dprintk("enter %s\n", __func__); | ||
129 | |||
94 | switch(voltage) { | 130 | switch(voltage) { |
95 | case SEC_VOLTAGE_13: | 131 | case SEC_VOLTAGE_13: |
96 | s5h1420_writereg(state, 0x3c, | 132 | s5h1420_writereg(state, 0x3c, |
@@ -106,6 +142,7 @@ static int s5h1420_set_voltage (struct dvb_frontend* fe, fe_sec_voltage_t voltag | |||
106 | break; | 142 | break; |
107 | } | 143 | } |
108 | 144 | ||
145 | dprintk("leave %s\n", __func__); | ||
109 | return 0; | 146 | return 0; |
110 | } | 147 | } |
111 | 148 | ||
@@ -113,6 +150,7 @@ static int s5h1420_set_tone (struct dvb_frontend* fe, fe_sec_tone_mode_t tone) | |||
113 | { | 150 | { |
114 | struct s5h1420_state* state = fe->demodulator_priv; | 151 | struct s5h1420_state* state = fe->demodulator_priv; |
115 | 152 | ||
153 | dprintk("enter %s\n", __func__); | ||
116 | switch(tone) { | 154 | switch(tone) { |
117 | case SEC_TONE_ON: | 155 | case SEC_TONE_ON: |
118 | s5h1420_writereg(state, 0x3b, | 156 | s5h1420_writereg(state, 0x3b, |
@@ -124,6 +162,7 @@ static int s5h1420_set_tone (struct dvb_frontend* fe, fe_sec_tone_mode_t tone) | |||
124 | (s5h1420_readreg(state, 0x3b) & 0x74) | 0x01); | 162 | (s5h1420_readreg(state, 0x3b) & 0x74) | 0x01); |
125 | break; | 163 | break; |
126 | } | 164 | } |
165 | dprintk("leave %s\n", __func__); | ||
127 | 166 | ||
128 | return 0; | 167 | return 0; |
129 | } | 168 | } |
@@ -137,6 +176,7 @@ static int s5h1420_send_master_cmd (struct dvb_frontend* fe, | |||
137 | unsigned long timeout; | 176 | unsigned long timeout; |
138 | int result = 0; | 177 | int result = 0; |
139 | 178 | ||
179 | dprintk("enter %s\n", __func__); | ||
140 | if (cmd->msg_len > 8) | 180 | if (cmd->msg_len > 8) |
141 | return -EINVAL; | 181 | return -EINVAL; |
142 | 182 | ||
@@ -168,6 +208,7 @@ static int s5h1420_send_master_cmd (struct dvb_frontend* fe, | |||
168 | /* restore original settings */ | 208 | /* restore original settings */ |
169 | s5h1420_writereg(state, 0x3b, val); | 209 | s5h1420_writereg(state, 0x3b, val); |
170 | msleep(15); | 210 | msleep(15); |
211 | dprintk("leave %s\n", __func__); | ||
171 | return result; | 212 | return result; |
172 | } | 213 | } |
173 | 214 | ||
@@ -289,6 +330,8 @@ static int s5h1420_read_status(struct dvb_frontend* fe, fe_status_t* status) | |||
289 | struct s5h1420_state* state = fe->demodulator_priv; | 330 | struct s5h1420_state* state = fe->demodulator_priv; |
290 | u8 val; | 331 | u8 val; |
291 | 332 | ||
333 | dprintk("enter %s\n", __func__); | ||
334 | |||
292 | if (status == NULL) | 335 | if (status == NULL) |
293 | return -EINVAL; | 336 | return -EINVAL; |
294 | 337 | ||
@@ -297,13 +340,13 @@ static int s5h1420_read_status(struct dvb_frontend* fe, fe_status_t* status) | |||
297 | 340 | ||
298 | /* fix for FEC 5/6 inversion issue - if it doesn't quite lock, invert | 341 | /* fix for FEC 5/6 inversion issue - if it doesn't quite lock, invert |
299 | the inversion, wait a bit and check again */ | 342 | the inversion, wait a bit and check again */ |
300 | if (*status == (FE_HAS_SIGNAL|FE_HAS_CARRIER|FE_HAS_VITERBI)) { | 343 | if (*status == (FE_HAS_SIGNAL | FE_HAS_CARRIER | FE_HAS_VITERBI)) { |
301 | val = s5h1420_readreg(state, 0x32); | 344 | val = s5h1420_readreg(state, Vit10); |
302 | if ((val & 0x07) == 0x03) { | 345 | if ((val & 0x07) == 0x03) { |
303 | if (val & 0x08) | 346 | if (val & 0x08) |
304 | s5h1420_writereg(state, 0x31, 0x13); | 347 | s5h1420_writereg(state, Vit09, 0x13); |
305 | else | 348 | else |
306 | s5h1420_writereg(state, 0x31, 0x1b); | 349 | s5h1420_writereg(state, Vit09, 0x1b); |
307 | 350 | ||
308 | /* wait a bit then update lock status */ | 351 | /* wait a bit then update lock status */ |
309 | mdelay(200); | 352 | mdelay(200); |
@@ -312,68 +355,73 @@ static int s5h1420_read_status(struct dvb_frontend* fe, fe_status_t* status) | |||
312 | } | 355 | } |
313 | 356 | ||
314 | /* perform post lock setup */ | 357 | /* perform post lock setup */ |
315 | if ((*status & FE_HAS_LOCK) && (!state->postlocked)) { | 358 | if ((*status & FE_HAS_LOCK) && !state->postlocked) { |
316 | 359 | ||
317 | /* calculate the data rate */ | 360 | /* calculate the data rate */ |
318 | u32 tmp = s5h1420_getsymbolrate(state); | 361 | u32 tmp = s5h1420_getsymbolrate(state); |
319 | switch(s5h1420_readreg(state, 0x32) & 0x07) { | 362 | switch (s5h1420_readreg(state, Vit10) & 0x07) { |
320 | case 0: | 363 | case 0: tmp = (tmp * 2 * 1) / 2; break; |
321 | tmp = (tmp * 2 * 1) / 2; | 364 | case 1: tmp = (tmp * 2 * 2) / 3; break; |
322 | break; | 365 | case 2: tmp = (tmp * 2 * 3) / 4; break; |
323 | 366 | case 3: tmp = (tmp * 2 * 5) / 6; break; | |
324 | case 1: | 367 | case 4: tmp = (tmp * 2 * 6) / 7; break; |
325 | tmp = (tmp * 2 * 2) / 3; | 368 | case 5: tmp = (tmp * 2 * 7) / 8; break; |
326 | break; | ||
327 | |||
328 | case 2: | ||
329 | tmp = (tmp * 2 * 3) / 4; | ||
330 | break; | ||
331 | |||
332 | case 3: | ||
333 | tmp = (tmp * 2 * 5) / 6; | ||
334 | break; | ||
335 | |||
336 | case 4: | ||
337 | tmp = (tmp * 2 * 6) / 7; | ||
338 | break; | ||
339 | |||
340 | case 5: | ||
341 | tmp = (tmp * 2 * 7) / 8; | ||
342 | break; | ||
343 | } | 369 | } |
370 | |||
344 | if (tmp == 0) { | 371 | if (tmp == 0) { |
345 | printk("s5h1420: avoided division by 0\n"); | 372 | printk(KERN_ERR "s5h1420: avoided division by 0\n"); |
346 | tmp = 1; | 373 | tmp = 1; |
347 | } | 374 | } |
348 | tmp = state->fclk / tmp; | 375 | tmp = state->fclk / tmp; |
349 | 376 | ||
377 | |||
350 | /* set the MPEG_CLK_INTL for the calculated data rate */ | 378 | /* set the MPEG_CLK_INTL for the calculated data rate */ |
351 | if (tmp < 4) | 379 | if (tmp < 2) |
352 | val = 0x00; | 380 | val = 0x00; |
353 | else if (tmp < 8) | 381 | else if (tmp < 5) |
354 | val = 0x01; | 382 | val = 0x01; |
355 | else if (tmp < 12) | 383 | else if (tmp < 9) |
356 | val = 0x02; | 384 | val = 0x02; |
357 | else if (tmp < 16) | 385 | else if (tmp < 13) |
358 | val = 0x03; | 386 | val = 0x03; |
359 | else if (tmp < 24) | 387 | else if (tmp < 17) |
360 | val = 0x04; | 388 | val = 0x04; |
361 | else if (tmp < 32) | 389 | else if (tmp < 25) |
362 | val = 0x05; | 390 | val = 0x05; |
363 | else | 391 | else if (tmp < 33) |
364 | val = 0x06; | 392 | val = 0x06; |
365 | s5h1420_writereg(state, 0x22, val); | 393 | else |
394 | val = 0x07; | ||
395 | dprintk("for MPEG_CLK_INTL %d %x\n", tmp, val); | ||
396 | |||
397 | s5h1420_writereg(state, FEC01, 0x18); | ||
398 | s5h1420_writereg(state, FEC01, 0x10); | ||
399 | s5h1420_writereg(state, FEC01, val); | ||
400 | |||
401 | /* Enable "MPEG_Out" */ | ||
402 | val = s5h1420_readreg(state, Mpeg02); | ||
403 | s5h1420_writereg(state, Mpeg02, val | (1 << 6)); | ||
366 | 404 | ||
367 | /* DC freeze */ | 405 | /* kicker disable */ |
368 | s5h1420_writereg(state, 0x1f, s5h1420_readreg(state, 0x1f) | 0x01); | 406 | val = s5h1420_readreg(state, QPSK01) & 0x7f; |
407 | s5h1420_writereg(state, QPSK01, val); | ||
369 | 408 | ||
370 | /* kicker disable + remove DC offset */ | 409 | /* DC freeze TODO it was never activated by default or it can stay activated */ |
371 | s5h1420_writereg(state, 0x05, s5h1420_readreg(state, 0x05) & 0x6f); | 410 | |
411 | if (s5h1420_getsymbolrate(state) >= 20000000) { | ||
412 | s5h1420_writereg(state, Loop04, 0x8a); | ||
413 | s5h1420_writereg(state, Loop05, 0x6a); | ||
414 | } else { | ||
415 | s5h1420_writereg(state, Loop04, 0x58); | ||
416 | s5h1420_writereg(state, Loop05, 0x27); | ||
417 | } | ||
372 | 418 | ||
373 | /* post-lock processing has been done! */ | 419 | /* post-lock processing has been done! */ |
374 | state->postlocked = 1; | 420 | state->postlocked = 1; |
375 | } | 421 | } |
376 | 422 | ||
423 | dprintk("leave %s\n", __func__); | ||
424 | |||
377 | return 0; | 425 | return 0; |
378 | } | 426 | } |
379 | 427 | ||
@@ -414,6 +462,7 @@ static int s5h1420_read_ucblocks(struct dvb_frontend* fe, u32* ucblocks) | |||
414 | 462 | ||
415 | static void s5h1420_reset(struct s5h1420_state* state) | 463 | static void s5h1420_reset(struct s5h1420_state* state) |
416 | { | 464 | { |
465 | dprintk("%s\n", __func__); | ||
417 | s5h1420_writereg (state, 0x01, 0x08); | 466 | s5h1420_writereg (state, 0x01, 0x08); |
418 | s5h1420_writereg (state, 0x01, 0x00); | 467 | s5h1420_writereg (state, 0x01, 0x00); |
419 | udelay(10); | 468 | udelay(10); |
@@ -422,54 +471,52 @@ static void s5h1420_reset(struct s5h1420_state* state) | |||
422 | static void s5h1420_setsymbolrate(struct s5h1420_state* state, | 471 | static void s5h1420_setsymbolrate(struct s5h1420_state* state, |
423 | struct dvb_frontend_parameters *p) | 472 | struct dvb_frontend_parameters *p) |
424 | { | 473 | { |
474 | u8 v; | ||
425 | u64 val; | 475 | u64 val; |
426 | 476 | ||
477 | dprintk("enter %s\n", __func__); | ||
478 | |||
427 | val = ((u64) p->u.qpsk.symbol_rate / 1000ULL) * (1ULL<<24); | 479 | val = ((u64) p->u.qpsk.symbol_rate / 1000ULL) * (1ULL<<24); |
428 | if (p->u.qpsk.symbol_rate <= 21000000) { | 480 | if (p->u.qpsk.symbol_rate < 29000000) |
429 | val *= 2; | 481 | val *= 2; |
430 | } | ||
431 | do_div(val, (state->fclk / 1000)); | 482 | do_div(val, (state->fclk / 1000)); |
432 | 483 | ||
433 | s5h1420_writereg(state, 0x09, s5h1420_readreg(state, 0x09) & 0x7f); | 484 | dprintk("symbol rate register: %06llx\n", val); |
434 | s5h1420_writereg(state, 0x11, val >> 16); | 485 | |
435 | s5h1420_writereg(state, 0x12, val >> 8); | 486 | v = s5h1420_readreg(state, Loop01); |
436 | s5h1420_writereg(state, 0x13, val & 0xff); | 487 | s5h1420_writereg(state, Loop01, v & 0x7f); |
437 | s5h1420_writereg(state, 0x09, s5h1420_readreg(state, 0x09) | 0x80); | 488 | s5h1420_writereg(state, Tnco01, val >> 16); |
489 | s5h1420_writereg(state, Tnco02, val >> 8); | ||
490 | s5h1420_writereg(state, Tnco03, val & 0xff); | ||
491 | s5h1420_writereg(state, Loop01, v | 0x80); | ||
492 | dprintk("leave %s\n", __func__); | ||
438 | } | 493 | } |
439 | 494 | ||
440 | static u32 s5h1420_getsymbolrate(struct s5h1420_state* state) | 495 | static u32 s5h1420_getsymbolrate(struct s5h1420_state* state) |
441 | { | 496 | { |
442 | u64 val = 0; | 497 | return state->symbol_rate; |
443 | int sampling = 2; | ||
444 | |||
445 | if (s5h1420_readreg(state, 0x05) & 0x2) | ||
446 | sampling = 1; | ||
447 | |||
448 | s5h1420_writereg(state, 0x06, s5h1420_readreg(state, 0x06) | 0x08); | ||
449 | val = s5h1420_readreg(state, 0x11) << 16; | ||
450 | val |= s5h1420_readreg(state, 0x12) << 8; | ||
451 | val |= s5h1420_readreg(state, 0x13); | ||
452 | s5h1420_writereg(state, 0x06, s5h1420_readreg(state, 0x06) & 0xf7); | ||
453 | |||
454 | val *= (state->fclk / 1000ULL); | ||
455 | do_div(val, ((1<<24) * sampling)); | ||
456 | |||
457 | return (u32) (val * 1000ULL); | ||
458 | } | 498 | } |
459 | 499 | ||
460 | static void s5h1420_setfreqoffset(struct s5h1420_state* state, int freqoffset) | 500 | static void s5h1420_setfreqoffset(struct s5h1420_state* state, int freqoffset) |
461 | { | 501 | { |
462 | int val; | 502 | int val; |
503 | u8 v; | ||
504 | |||
505 | dprintk("enter %s\n", __func__); | ||
463 | 506 | ||
464 | /* remember freqoffset is in kHz, but the chip wants the offset in Hz, so | 507 | /* remember freqoffset is in kHz, but the chip wants the offset in Hz, so |
465 | * divide fclk by 1000000 to get the correct value. */ | 508 | * divide fclk by 1000000 to get the correct value. */ |
466 | val = -(int) ((freqoffset * (1<<24)) / (state->fclk / 1000000)); | 509 | val = -(int) ((freqoffset * (1<<24)) / (state->fclk / 1000000)); |
467 | 510 | ||
468 | s5h1420_writereg(state, 0x09, s5h1420_readreg(state, 0x09) & 0xbf); | 511 | dprintk("phase rotator/freqoffset: %d %06x\n", freqoffset, val); |
469 | s5h1420_writereg(state, 0x0e, val >> 16); | 512 | |
470 | s5h1420_writereg(state, 0x0f, val >> 8); | 513 | v = s5h1420_readreg(state, Loop01); |
471 | s5h1420_writereg(state, 0x10, val & 0xff); | 514 | s5h1420_writereg(state, Loop01, v & 0xbf); |
472 | s5h1420_writereg(state, 0x09, s5h1420_readreg(state, 0x09) | 0x40); | 515 | s5h1420_writereg(state, Pnco01, val >> 16); |
516 | s5h1420_writereg(state, Pnco02, val >> 8); | ||
517 | s5h1420_writereg(state, Pnco03, val & 0xff); | ||
518 | s5h1420_writereg(state, Loop01, v | 0x40); | ||
519 | dprintk("leave %s\n", __func__); | ||
473 | } | 520 | } |
474 | 521 | ||
475 | static int s5h1420_getfreqoffset(struct s5h1420_state* state) | 522 | static int s5h1420_getfreqoffset(struct s5h1420_state* state) |
@@ -496,52 +543,53 @@ static void s5h1420_setfec_inversion(struct s5h1420_state* state, | |||
496 | struct dvb_frontend_parameters *p) | 543 | struct dvb_frontend_parameters *p) |
497 | { | 544 | { |
498 | u8 inversion = 0; | 545 | u8 inversion = 0; |
546 | u8 vit08, vit09; | ||
547 | |||
548 | dprintk("enter %s\n", __func__); | ||
499 | 549 | ||
500 | if (p->inversion == INVERSION_OFF) { | 550 | if (p->inversion == INVERSION_OFF) |
501 | inversion = state->config->invert ? 0x08 : 0; | 551 | inversion = state->config->invert ? 0x08 : 0; |
502 | } else if (p->inversion == INVERSION_ON) { | 552 | else if (p->inversion == INVERSION_ON) |
503 | inversion = state->config->invert ? 0 : 0x08; | 553 | inversion = state->config->invert ? 0 : 0x08; |
504 | } | ||
505 | 554 | ||
506 | if ((p->u.qpsk.fec_inner == FEC_AUTO) || (p->inversion == INVERSION_AUTO)) { | 555 | if ((p->u.qpsk.fec_inner == FEC_AUTO) || (p->inversion == INVERSION_AUTO)) { |
507 | s5h1420_writereg(state, 0x30, 0x3f); | 556 | vit08 = 0x3f; |
508 | s5h1420_writereg(state, 0x31, 0x00 | inversion); | 557 | vit09 = 0; |
509 | } else { | 558 | } else { |
510 | switch(p->u.qpsk.fec_inner) { | 559 | switch(p->u.qpsk.fec_inner) { |
511 | case FEC_1_2: | 560 | case FEC_1_2: |
512 | s5h1420_writereg(state, 0x30, 0x01); | 561 | vit08 = 0x01; vit09 = 0x10; |
513 | s5h1420_writereg(state, 0x31, 0x10 | inversion); | ||
514 | break; | 562 | break; |
515 | 563 | ||
516 | case FEC_2_3: | 564 | case FEC_2_3: |
517 | s5h1420_writereg(state, 0x30, 0x02); | 565 | vit08 = 0x02; vit09 = 0x11; |
518 | s5h1420_writereg(state, 0x31, 0x11 | inversion); | ||
519 | break; | 566 | break; |
520 | 567 | ||
521 | case FEC_3_4: | 568 | case FEC_3_4: |
522 | s5h1420_writereg(state, 0x30, 0x04); | 569 | vit08 = 0x04; vit09 = 0x12; |
523 | s5h1420_writereg(state, 0x31, 0x12 | inversion); | ||
524 | break; | 570 | break; |
525 | 571 | ||
526 | case FEC_5_6: | 572 | case FEC_5_6: |
527 | s5h1420_writereg(state, 0x30, 0x08); | 573 | vit08 = 0x08; vit09 = 0x13; |
528 | s5h1420_writereg(state, 0x31, 0x13 | inversion); | ||
529 | break; | 574 | break; |
530 | 575 | ||
531 | case FEC_6_7: | 576 | case FEC_6_7: |
532 | s5h1420_writereg(state, 0x30, 0x10); | 577 | vit08 = 0x10; vit09 = 0x14; |
533 | s5h1420_writereg(state, 0x31, 0x14 | inversion); | ||
534 | break; | 578 | break; |
535 | 579 | ||
536 | case FEC_7_8: | 580 | case FEC_7_8: |
537 | s5h1420_writereg(state, 0x30, 0x20); | 581 | vit08 = 0x20; vit09 = 0x15; |
538 | s5h1420_writereg(state, 0x31, 0x15 | inversion); | ||
539 | break; | 582 | break; |
540 | 583 | ||
541 | default: | 584 | default: |
542 | return; | 585 | return; |
543 | } | 586 | } |
544 | } | 587 | } |
588 | vit09 |= inversion; | ||
589 | dprintk("fec: %02x %02x\n", vit08, vit09); | ||
590 | s5h1420_writereg(state, Vit08, vit08); | ||
591 | s5h1420_writereg(state, Vit09, vit09); | ||
592 | dprintk("leave %s\n", __func__); | ||
545 | } | 593 | } |
546 | 594 | ||
547 | static fe_code_rate_t s5h1420_getfec(struct s5h1420_state* state) | 595 | static fe_code_rate_t s5h1420_getfec(struct s5h1420_state* state) |
@@ -583,16 +631,19 @@ static int s5h1420_set_frontend(struct dvb_frontend* fe, | |||
583 | struct s5h1420_state* state = fe->demodulator_priv; | 631 | struct s5h1420_state* state = fe->demodulator_priv; |
584 | int frequency_delta; | 632 | int frequency_delta; |
585 | struct dvb_frontend_tune_settings fesettings; | 633 | struct dvb_frontend_tune_settings fesettings; |
634 | uint8_t clock_settting; | ||
635 | |||
636 | dprintk("enter %s\n", __func__); | ||
586 | 637 | ||
587 | /* check if we should do a fast-tune */ | 638 | /* check if we should do a fast-tune */ |
588 | memcpy(&fesettings.parameters, p, sizeof(struct dvb_frontend_parameters)); | 639 | memcpy(&fesettings.parameters, p, sizeof(struct dvb_frontend_parameters)); |
589 | s5h1420_get_tune_settings(fe, &fesettings); | 640 | s5h1420_get_tune_settings(fe, &fesettings); |
590 | frequency_delta = p->frequency - state->tunedfreq; | 641 | frequency_delta = p->frequency - state->tunedfreq; |
591 | if ((frequency_delta > -fesettings.max_drift) && | 642 | if ((frequency_delta > -fesettings.max_drift) && |
592 | (frequency_delta < fesettings.max_drift) && | 643 | (frequency_delta < fesettings.max_drift) && |
593 | (frequency_delta != 0) && | 644 | (frequency_delta != 0) && |
594 | (state->fec_inner == p->u.qpsk.fec_inner) && | 645 | (state->fec_inner == p->u.qpsk.fec_inner) && |
595 | (state->symbol_rate == p->u.qpsk.symbol_rate)) { | 646 | (state->symbol_rate == p->u.qpsk.symbol_rate)) { |
596 | 647 | ||
597 | if (fe->ops.tuner_ops.set_params) { | 648 | if (fe->ops.tuner_ops.set_params) { |
598 | fe->ops.tuner_ops.set_params(fe, p); | 649 | fe->ops.tuner_ops.set_params(fe, p); |
@@ -606,54 +657,93 @@ static int s5h1420_set_frontend(struct dvb_frontend* fe, | |||
606 | } else { | 657 | } else { |
607 | s5h1420_setfreqoffset(state, 0); | 658 | s5h1420_setfreqoffset(state, 0); |
608 | } | 659 | } |
660 | dprintk("simple tune\n"); | ||
609 | return 0; | 661 | return 0; |
610 | } | 662 | } |
663 | dprintk("tuning demod\n"); | ||
611 | 664 | ||
612 | /* first of all, software reset */ | 665 | /* first of all, software reset */ |
613 | s5h1420_reset(state); | 666 | s5h1420_reset(state); |
614 | 667 | ||
615 | /* set s5h1420 fclk PLL according to desired symbol rate */ | 668 | /* set s5h1420 fclk PLL according to desired symbol rate */ |
616 | if (p->u.qpsk.symbol_rate > 28000000) { | 669 | if (p->u.qpsk.symbol_rate > 33000000) |
617 | state->fclk = 88000000; | 670 | state->fclk = 80000000; |
618 | s5h1420_writereg(state, 0x03, 0x50); | 671 | else if (p->u.qpsk.symbol_rate > 28500000) |
619 | s5h1420_writereg(state, 0x04, 0x40); | ||
620 | s5h1420_writereg(state, 0x05, 0xae); | ||
621 | } else if (p->u.qpsk.symbol_rate > 21000000) { | ||
622 | state->fclk = 59000000; | 672 | state->fclk = 59000000; |
623 | s5h1420_writereg(state, 0x03, 0x33); | 673 | else if (p->u.qpsk.symbol_rate > 25000000) |
624 | s5h1420_writereg(state, 0x04, 0x40); | 674 | state->fclk = 86000000; |
625 | s5h1420_writereg(state, 0x05, 0xae); | 675 | else if (p->u.qpsk.symbol_rate > 1900000) |
626 | } else { | ||
627 | state->fclk = 88000000; | 676 | state->fclk = 88000000; |
628 | s5h1420_writereg(state, 0x03, 0x50); | 677 | else |
629 | s5h1420_writereg(state, 0x04, 0x40); | 678 | state->fclk = 44000000; |
630 | s5h1420_writereg(state, 0x05, 0xac); | 679 | |
680 | /* Clock */ | ||
681 | switch (state->fclk) { | ||
682 | default: | ||
683 | case 88000000: | ||
684 | clock_settting = 80; | ||
685 | break; | ||
686 | case 86000000: | ||
687 | clock_settting = 78; | ||
688 | break; | ||
689 | case 80000000: | ||
690 | clock_settting = 72; | ||
691 | break; | ||
692 | case 59000000: | ||
693 | clock_settting = 51; | ||
694 | break; | ||
695 | case 44000000: | ||
696 | clock_settting = 36; | ||
697 | break; | ||
631 | } | 698 | } |
699 | dprintk("pll01: %d, ToneFreq: %d\n", state->fclk/1000000 - 8, (state->fclk + (TONE_FREQ * 32) - 1) / (TONE_FREQ * 32)); | ||
700 | s5h1420_writereg(state, PLL01, state->fclk/1000000 - 8); | ||
701 | s5h1420_writereg(state, PLL02, 0x40); | ||
702 | s5h1420_writereg(state, DiS01, (state->fclk + (TONE_FREQ * 32) - 1) / (TONE_FREQ * 32)); | ||
632 | 703 | ||
633 | /* set misc registers */ | 704 | /* TODO DC offset removal, config parameter ? */ |
634 | s5h1420_writereg(state, 0x02, 0x00); | 705 | if (p->u.qpsk.symbol_rate > 29000000) |
635 | s5h1420_writereg(state, 0x06, 0x00); | 706 | s5h1420_writereg(state, QPSK01, 0xae | 0x10); |
636 | s5h1420_writereg(state, 0x07, 0xb0); | 707 | else |
637 | s5h1420_writereg(state, 0x0a, 0xe7); | 708 | s5h1420_writereg(state, QPSK01, 0xac | 0x10); |
638 | s5h1420_writereg(state, 0x0b, 0x78); | ||
639 | s5h1420_writereg(state, 0x0c, 0x48); | ||
640 | s5h1420_writereg(state, 0x0d, 0x6b); | ||
641 | s5h1420_writereg(state, 0x2e, 0x8e); | ||
642 | s5h1420_writereg(state, 0x35, 0x33); | ||
643 | s5h1420_writereg(state, 0x38, 0x01); | ||
644 | s5h1420_writereg(state, 0x39, 0x7d); | ||
645 | s5h1420_writereg(state, 0x3a, (state->fclk + (TONE_FREQ * 32) - 1) / (TONE_FREQ * 32)); | ||
646 | s5h1420_writereg(state, 0x3c, 0x00); | ||
647 | s5h1420_writereg(state, 0x45, 0x61); | ||
648 | s5h1420_writereg(state, 0x46, 0x1d); | ||
649 | 709 | ||
650 | /* start QPSK */ | 710 | /* set misc registers */ |
651 | s5h1420_writereg(state, 0x05, s5h1420_readreg(state, 0x05) | 1); | 711 | s5h1420_writereg(state, CON_1, 0x00); |
712 | s5h1420_writereg(state, QPSK02, 0x00); | ||
713 | s5h1420_writereg(state, Pre01, 0xb0); | ||
714 | |||
715 | s5h1420_writereg(state, Loop01, 0xF0); | ||
716 | s5h1420_writereg(state, Loop02, 0x2a); /* e7 for s5h1420 */ | ||
717 | s5h1420_writereg(state, Loop03, 0x79); /* 78 for s5h1420 */ | ||
718 | if (p->u.qpsk.symbol_rate > 20000000) | ||
719 | s5h1420_writereg(state, Loop04, 0x79); | ||
720 | else | ||
721 | s5h1420_writereg(state, Loop04, 0x58); | ||
722 | s5h1420_writereg(state, Loop05, 0x6b); | ||
723 | |||
724 | if (p->u.qpsk.symbol_rate >= 8000000) | ||
725 | s5h1420_writereg(state, Post01, (0 << 6) | 0x10); | ||
726 | else if (p->u.qpsk.symbol_rate >= 4000000) | ||
727 | s5h1420_writereg(state, Post01, (1 << 6) | 0x10); | ||
728 | else | ||
729 | s5h1420_writereg(state, Post01, (3 << 6) | 0x10); | ||
730 | |||
731 | s5h1420_writereg(state, Monitor12, 0x00); /* unfreeze DC compensation */ | ||
732 | |||
733 | s5h1420_writereg(state, Sync01, 0x33); | ||
734 | s5h1420_writereg(state, Mpeg01, state->config->cdclk_polarity); | ||
735 | s5h1420_writereg(state, Mpeg02, 0x3d); /* Parallel output more, disabled -> enabled later */ | ||
736 | s5h1420_writereg(state, Err01, 0x03); /* 0x1d for s5h1420 */ | ||
737 | |||
738 | s5h1420_writereg(state, Vit06, 0x6e); /* 0x8e for s5h1420 */ | ||
739 | s5h1420_writereg(state, DiS03, 0x00); | ||
740 | s5h1420_writereg(state, Rf01, 0x61); /* Tuner i2c address - for the gate controller */ | ||
652 | 741 | ||
653 | /* set tuner PLL */ | 742 | /* set tuner PLL */ |
654 | if (fe->ops.tuner_ops.set_params) { | 743 | if (fe->ops.tuner_ops.set_params) { |
655 | fe->ops.tuner_ops.set_params(fe, p); | 744 | fe->ops.tuner_ops.set_params(fe, p); |
656 | if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 0); | 745 | if (fe->ops.i2c_gate_ctrl) |
746 | fe->ops.i2c_gate_ctrl(fe, 0); | ||
657 | s5h1420_setfreqoffset(state, 0); | 747 | s5h1420_setfreqoffset(state, 0); |
658 | } | 748 | } |
659 | 749 | ||
@@ -661,10 +751,15 @@ static int s5h1420_set_frontend(struct dvb_frontend* fe, | |||
661 | s5h1420_setsymbolrate(state, p); | 751 | s5h1420_setsymbolrate(state, p); |
662 | s5h1420_setfec_inversion(state, p); | 752 | s5h1420_setfec_inversion(state, p); |
663 | 753 | ||
754 | /* start QPSK */ | ||
755 | s5h1420_writereg(state, QPSK01, s5h1420_readreg(state, QPSK01) | 1); | ||
756 | |||
664 | state->fec_inner = p->u.qpsk.fec_inner; | 757 | state->fec_inner = p->u.qpsk.fec_inner; |
665 | state->symbol_rate = p->u.qpsk.symbol_rate; | 758 | state->symbol_rate = p->u.qpsk.symbol_rate; |
666 | state->postlocked = 0; | 759 | state->postlocked = 0; |
667 | state->tunedfreq = p->frequency; | 760 | state->tunedfreq = p->frequency; |
761 | |||
762 | dprintk("leave %s\n", __func__); | ||
668 | return 0; | 763 | return 0; |
669 | } | 764 | } |
670 | 765 | ||
@@ -717,11 +812,10 @@ static int s5h1420_i2c_gate_ctrl(struct dvb_frontend* fe, int enable) | |||
717 | { | 812 | { |
718 | struct s5h1420_state* state = fe->demodulator_priv; | 813 | struct s5h1420_state* state = fe->demodulator_priv; |
719 | 814 | ||
720 | if (enable) { | 815 | if (enable) |
721 | return s5h1420_writereg (state, 0x02, s5h1420_readreg(state,0x02) | 1); | 816 | return s5h1420_writereg(state, 0x02, state->CON_1_val | 1); |
722 | } else { | 817 | else |
723 | return s5h1420_writereg (state, 0x02, s5h1420_readreg(state,0x02) & 0xfe); | 818 | return s5h1420_writereg(state, 0x02, state->CON_1_val & 0xfe); |
724 | } | ||
725 | } | 819 | } |
726 | 820 | ||
727 | static int s5h1420_init (struct dvb_frontend* fe) | 821 | static int s5h1420_init (struct dvb_frontend* fe) |
@@ -729,7 +823,8 @@ static int s5h1420_init (struct dvb_frontend* fe) | |||
729 | struct s5h1420_state* state = fe->demodulator_priv; | 823 | struct s5h1420_state* state = fe->demodulator_priv; |
730 | 824 | ||
731 | /* disable power down and do reset */ | 825 | /* disable power down and do reset */ |
732 | s5h1420_writereg(state, 0x02, 0x10); | 826 | state->CON_1_val = 0x10; |
827 | s5h1420_writereg(state, 0x02, state->CON_1_val); | ||
733 | msleep(10); | 828 | msleep(10); |
734 | s5h1420_reset(state); | 829 | s5h1420_reset(state); |
735 | 830 | ||
@@ -739,26 +834,60 @@ static int s5h1420_init (struct dvb_frontend* fe) | |||
739 | static int s5h1420_sleep(struct dvb_frontend* fe) | 834 | static int s5h1420_sleep(struct dvb_frontend* fe) |
740 | { | 835 | { |
741 | struct s5h1420_state* state = fe->demodulator_priv; | 836 | struct s5h1420_state* state = fe->demodulator_priv; |
742 | 837 | state->CON_1_val = 0x12; | |
743 | return s5h1420_writereg(state, 0x02, 0x12); | 838 | return s5h1420_writereg(state, 0x02, state->CON_1_val); |
744 | } | 839 | } |
745 | 840 | ||
746 | static void s5h1420_release(struct dvb_frontend* fe) | 841 | static void s5h1420_release(struct dvb_frontend* fe) |
747 | { | 842 | { |
748 | struct s5h1420_state* state = fe->demodulator_priv; | 843 | struct s5h1420_state* state = fe->demodulator_priv; |
844 | i2c_del_adapter(&state->tuner_i2c_adapter); | ||
749 | kfree(state); | 845 | kfree(state); |
750 | } | 846 | } |
751 | 847 | ||
752 | static struct dvb_frontend_ops s5h1420_ops; | 848 | static u32 s5h1420_tuner_i2c_func(struct i2c_adapter *adapter) |
849 | { | ||
850 | return I2C_FUNC_I2C; | ||
851 | } | ||
852 | |||
853 | static int s5h1420_tuner_i2c_tuner_xfer(struct i2c_adapter *i2c_adap, struct i2c_msg msg[], int num) | ||
854 | { | ||
855 | struct s5h1420_state *state = i2c_get_adapdata(i2c_adap); | ||
856 | struct i2c_msg m[1 + num]; | ||
857 | u8 tx_open[2] = { CON_1, state->CON_1_val | 1 }; /* repeater stops once there was a stop condition */ | ||
858 | |||
859 | memset(m, 0, sizeof(struct i2c_msg) * (1 + num)); | ||
860 | |||
861 | m[0].addr = state->config->demod_address; | ||
862 | m[0].buf = tx_open; | ||
863 | m[0].len = 2; | ||
753 | 864 | ||
754 | struct dvb_frontend* s5h1420_attach(const struct s5h1420_config* config, | 865 | memcpy(&m[1], msg, sizeof(struct i2c_msg) * num); |
755 | struct i2c_adapter* i2c) | 866 | |
867 | return i2c_transfer(state->i2c, m, 1+num) == 1 + num ? num : -EIO; | ||
868 | } | ||
869 | |||
870 | static struct i2c_algorithm s5h1420_tuner_i2c_algo = { | ||
871 | .master_xfer = s5h1420_tuner_i2c_tuner_xfer, | ||
872 | .functionality = s5h1420_tuner_i2c_func, | ||
873 | }; | ||
874 | |||
875 | struct i2c_adapter *s5h1420_get_tuner_i2c_adapter(struct dvb_frontend *fe) | ||
756 | { | 876 | { |
757 | struct s5h1420_state* state = NULL; | 877 | struct s5h1420_state *state = fe->demodulator_priv; |
758 | u8 identity; | 878 | return &state->tuner_i2c_adapter; |
879 | } | ||
880 | EXPORT_SYMBOL(s5h1420_get_tuner_i2c_adapter); | ||
881 | |||
882 | static struct dvb_frontend_ops s5h1420_ops; | ||
759 | 883 | ||
884 | struct dvb_frontend *s5h1420_attach(const struct s5h1420_config *config, | ||
885 | struct i2c_adapter *i2c) | ||
886 | { | ||
760 | /* allocate memory for the internal state */ | 887 | /* allocate memory for the internal state */ |
761 | state = kmalloc(sizeof(struct s5h1420_state), GFP_KERNEL); | 888 | struct s5h1420_state *state = kzalloc(sizeof(struct s5h1420_state), GFP_KERNEL); |
889 | u8 i; | ||
890 | |||
762 | if (state == NULL) | 891 | if (state == NULL) |
763 | goto error; | 892 | goto error; |
764 | 893 | ||
@@ -772,24 +901,42 @@ struct dvb_frontend* s5h1420_attach(const struct s5h1420_config* config, | |||
772 | state->symbol_rate = 0; | 901 | state->symbol_rate = 0; |
773 | 902 | ||
774 | /* check if the demod is there + identify it */ | 903 | /* check if the demod is there + identify it */ |
775 | identity = s5h1420_readreg(state, 0x00); | 904 | i = s5h1420_readreg(state, ID01); |
776 | if (identity != 0x03) | 905 | if (i != 0x03) |
777 | goto error; | 906 | goto error; |
778 | 907 | ||
908 | memset(state->shadow, 0xff, sizeof(state->shadow)); | ||
909 | |||
910 | for (i = 0; i < 0x50; i++) | ||
911 | state->shadow[i] = s5h1420_readreg(state, i); | ||
912 | |||
779 | /* create dvb_frontend */ | 913 | /* create dvb_frontend */ |
780 | memcpy(&state->frontend.ops, &s5h1420_ops, sizeof(struct dvb_frontend_ops)); | 914 | memcpy(&state->frontend.ops, &s5h1420_ops, sizeof(struct dvb_frontend_ops)); |
781 | state->frontend.demodulator_priv = state; | 915 | state->frontend.demodulator_priv = state; |
916 | |||
917 | /* create tuner i2c adapter */ | ||
918 | strncpy(state->tuner_i2c_adapter.name, "S5H1420-PN1010 tuner I2C bus", I2C_NAME_SIZE); | ||
919 | state->tuner_i2c_adapter.class = I2C_CLASS_TV_DIGITAL, | ||
920 | state->tuner_i2c_adapter.algo = &s5h1420_tuner_i2c_algo; | ||
921 | state->tuner_i2c_adapter.algo_data = NULL; | ||
922 | i2c_set_adapdata(&state->tuner_i2c_adapter, state); | ||
923 | if (i2c_add_adapter(&state->tuner_i2c_adapter) < 0) { | ||
924 | printk(KERN_ERR "S5H1420/PN1010: tuner i2c bus could not be initialized\n"); | ||
925 | goto error; | ||
926 | } | ||
927 | |||
782 | return &state->frontend; | 928 | return &state->frontend; |
783 | 929 | ||
784 | error: | 930 | error: |
785 | kfree(state); | 931 | kfree(state); |
786 | return NULL; | 932 | return NULL; |
787 | } | 933 | } |
934 | EXPORT_SYMBOL(s5h1420_attach); | ||
788 | 935 | ||
789 | static struct dvb_frontend_ops s5h1420_ops = { | 936 | static struct dvb_frontend_ops s5h1420_ops = { |
790 | 937 | ||
791 | .info = { | 938 | .info = { |
792 | .name = "Samsung S5H1420 DVB-S", | 939 | .name = "Samsung S5H1420/PnpNetwork PN1010 DVB-S", |
793 | .type = FE_QPSK, | 940 | .type = FE_QPSK, |
794 | .frequency_min = 950000, | 941 | .frequency_min = 950000, |
795 | .frequency_max = 2150000, | 942 | .frequency_max = 2150000, |
@@ -826,10 +973,6 @@ static struct dvb_frontend_ops s5h1420_ops = { | |||
826 | .set_voltage = s5h1420_set_voltage, | 973 | .set_voltage = s5h1420_set_voltage, |
827 | }; | 974 | }; |
828 | 975 | ||
829 | module_param(debug, int, 0644); | 976 | MODULE_DESCRIPTION("Samsung S5H1420/PnpNetwork PN1010 DVB-S Demodulator driver"); |
830 | 977 | MODULE_AUTHOR("Andrew de Quincey, Patrick Boettcher"); | |
831 | MODULE_DESCRIPTION("Samsung S5H1420 DVB-S Demodulator driver"); | ||
832 | MODULE_AUTHOR("Andrew de Quincey"); | ||
833 | MODULE_LICENSE("GPL"); | 978 | MODULE_LICENSE("GPL"); |
834 | |||
835 | EXPORT_SYMBOL(s5h1420_attach); | ||
diff --git a/drivers/media/dvb/frontends/s5h1420.h b/drivers/media/dvb/frontends/s5h1420.h index 1555870f7226..4c913f142bc4 100644 --- a/drivers/media/dvb/frontends/s5h1420.h +++ b/drivers/media/dvb/frontends/s5h1420.h | |||
@@ -1,25 +1,26 @@ | |||
1 | /* | 1 | /* |
2 | Driver for S5H1420 QPSK Demodulators | 2 | * Driver for |
3 | 3 | * Samsung S5H1420 and | |
4 | Copyright (C) 2005 Andrew de Quincey <adq_dvb@lidskialf.net> | 4 | * PnpNetwork PN1010 QPSK Demodulator |
5 | 5 | * | |
6 | This program is free software; you can redistribute it and/or modify | 6 | * Copyright (C) 2005 Andrew de Quincey <adq_dvb@lidskialf.net> |
7 | it under the terms of the GNU General Public License as published by | 7 | * Copyright (C) 2005-8 Patrick Boettcher <pb@linuxtv.org> |
8 | the Free Software Foundation; either version 2 of the License, or | 8 | * |
9 | (at your option) any later version. | 9 | * This program is free software; you can redistribute it and/or modify |
10 | 10 | * it under the terms of the GNU General Public License as published by | |
11 | This program is distributed in the hope that it will be useful, | 11 | * the Free Software Foundation; either version 2 of the License, or |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 | * (at your option) any later version. |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 13 | * |
14 | 14 | * This program is distributed in the hope that it will be useful, | |
15 | GNU General Public License for more details. | 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
16 | 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 | You should have received a copy of the GNU General Public License | 17 | * |
18 | along with this program; if not, write to the Free Software | 18 | * GNU General Public License for more details. |
19 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | 19 | * |
20 | 20 | * You should have received a copy of the GNU General Public License | |
21 | */ | 21 | * along with this program; if not, write to the Free Software |
22 | 22 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | |
23 | */ | ||
23 | #ifndef S5H1420_H | 24 | #ifndef S5H1420_H |
24 | #define S5H1420_H | 25 | #define S5H1420_H |
25 | 26 | ||
@@ -31,17 +32,26 @@ struct s5h1420_config | |||
31 | u8 demod_address; | 32 | u8 demod_address; |
32 | 33 | ||
33 | /* does the inversion require inversion? */ | 34 | /* does the inversion require inversion? */ |
34 | u8 invert:1; | 35 | u8 invert : 1; |
36 | |||
37 | u8 repeated_start_workaround : 1; | ||
38 | u8 cdclk_polarity : 1; /* 1 == falling edge, 0 == raising edge */ | ||
35 | }; | 39 | }; |
36 | 40 | ||
37 | #if defined(CONFIG_DVB_S5H1420) || (defined(CONFIG_DVB_S5H1420_MODULE) && defined(MODULE)) | 41 | #if defined(CONFIG_DVB_S5H1420) || (defined(CONFIG_DVB_S5H1420_MODULE) && defined(MODULE)) |
38 | extern struct dvb_frontend* s5h1420_attach(const struct s5h1420_config* config, | 42 | extern struct dvb_frontend *s5h1420_attach(const struct s5h1420_config *config, |
39 | struct i2c_adapter* i2c); | 43 | struct i2c_adapter *i2c); |
44 | extern struct i2c_adapter *s5h1420_get_tuner_i2c_adapter(struct dvb_frontend *fe); | ||
40 | #else | 45 | #else |
41 | static inline struct dvb_frontend* s5h1420_attach(const struct s5h1420_config* config, | 46 | static inline struct dvb_frontend *s5h1420_attach(const struct s5h1420_config *config, |
42 | struct i2c_adapter* i2c) | 47 | struct i2c_adapter *i2c) |
48 | { | ||
49 | printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__); | ||
50 | return NULL; | ||
51 | } | ||
52 | |||
53 | static inline struct i2c_adapter *s5h1420_get_tuner_i2c_adapter(struct dvb_frontend *fe) | ||
43 | { | 54 | { |
44 | printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __FUNCTION__); | ||
45 | return NULL; | 55 | return NULL; |
46 | } | 56 | } |
47 | #endif // CONFIG_DVB_S5H1420 | 57 | #endif // CONFIG_DVB_S5H1420 |
diff --git a/drivers/media/dvb/frontends/s5h1420_priv.h b/drivers/media/dvb/frontends/s5h1420_priv.h new file mode 100644 index 000000000000..d9c58d281816 --- /dev/null +++ b/drivers/media/dvb/frontends/s5h1420_priv.h | |||
@@ -0,0 +1,102 @@ | |||
1 | /* | ||
2 | * Driver for | ||
3 | * Samsung S5H1420 and | ||
4 | * PnpNetwork PN1010 QPSK Demodulator | ||
5 | * | ||
6 | * Copyright (C) 2005 Andrew de Quincey <adq_dvb@lidskialf.net> | ||
7 | * Copyright (C) 2005 Patrick Boettcher <pb@linuxtv.org> | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or modify it | ||
10 | * under the terms of the GNU General Public License as published by the Free | ||
11 | * Software Foundation; either version 2 of the License, or (at your option) | ||
12 | * any later version. | ||
13 | * | ||
14 | * This program is distributed in the hope that it will be useful, but WITHOUT | ||
15 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
16 | * FITNESS FOR A PARTICULAR PURPOSE. See the | ||
17 | * | ||
18 | * GNU General Public License for more details. | ||
19 | * | ||
20 | * You should have received a copy of the GNU General Public License along with | ||
21 | * this program; if not, write to the Free Software Foundation, Inc., 675 Mass | ||
22 | * Ave, Cambridge, MA 02139, USA. | ||
23 | */ | ||
24 | #ifndef S5H1420_PRIV | ||
25 | #define S5H1420_PRIV | ||
26 | |||
27 | #include <asm/types.h> | ||
28 | |||
29 | enum s5h1420_register { | ||
30 | ID01 = 0x00, | ||
31 | CON_0 = 0x01, | ||
32 | CON_1 = 0x02, | ||
33 | PLL01 = 0x03, | ||
34 | PLL02 = 0x04, | ||
35 | QPSK01 = 0x05, | ||
36 | QPSK02 = 0x06, | ||
37 | Pre01 = 0x07, | ||
38 | Post01 = 0x08, | ||
39 | Loop01 = 0x09, | ||
40 | Loop02 = 0x0a, | ||
41 | Loop03 = 0x0b, | ||
42 | Loop04 = 0x0c, | ||
43 | Loop05 = 0x0d, | ||
44 | Pnco01 = 0x0e, | ||
45 | Pnco02 = 0x0f, | ||
46 | Pnco03 = 0x10, | ||
47 | Tnco01 = 0x11, | ||
48 | Tnco02 = 0x12, | ||
49 | Tnco03 = 0x13, | ||
50 | Monitor01 = 0x14, | ||
51 | Monitor02 = 0x15, | ||
52 | Monitor03 = 0x16, | ||
53 | Monitor04 = 0x17, | ||
54 | Monitor05 = 0x18, | ||
55 | Monitor06 = 0x19, | ||
56 | Monitor07 = 0x1a, | ||
57 | Monitor12 = 0x1f, | ||
58 | |||
59 | FEC01 = 0x22, | ||
60 | Soft01 = 0x23, | ||
61 | Soft02 = 0x24, | ||
62 | Soft03 = 0x25, | ||
63 | Soft04 = 0x26, | ||
64 | Soft05 = 0x27, | ||
65 | Soft06 = 0x28, | ||
66 | Vit01 = 0x29, | ||
67 | Vit02 = 0x2a, | ||
68 | Vit03 = 0x2b, | ||
69 | Vit04 = 0x2c, | ||
70 | Vit05 = 0x2d, | ||
71 | Vit06 = 0x2e, | ||
72 | Vit07 = 0x2f, | ||
73 | Vit08 = 0x30, | ||
74 | Vit09 = 0x31, | ||
75 | Vit10 = 0x32, | ||
76 | Vit11 = 0x33, | ||
77 | Vit12 = 0x34, | ||
78 | Sync01 = 0x35, | ||
79 | Sync02 = 0x36, | ||
80 | Rs01 = 0x37, | ||
81 | Mpeg01 = 0x38, | ||
82 | Mpeg02 = 0x39, | ||
83 | DiS01 = 0x3a, | ||
84 | DiS02 = 0x3b, | ||
85 | DiS03 = 0x3c, | ||
86 | DiS04 = 0x3d, | ||
87 | DiS05 = 0x3e, | ||
88 | DiS06 = 0x3f, | ||
89 | DiS07 = 0x40, | ||
90 | DiS08 = 0x41, | ||
91 | DiS09 = 0x42, | ||
92 | DiS10 = 0x43, | ||
93 | DiS11 = 0x44, | ||
94 | Rf01 = 0x45, | ||
95 | Err01 = 0x46, | ||
96 | Err02 = 0x47, | ||
97 | Err03 = 0x48, | ||
98 | Err04 = 0x49, | ||
99 | }; | ||
100 | |||
101 | |||
102 | #endif | ||
diff --git a/drivers/media/dvb/frontends/sp8870.c b/drivers/media/dvb/frontends/sp8870.c index da876f7bfe32..aa78aa14aad9 100644 --- a/drivers/media/dvb/frontends/sp8870.c +++ b/drivers/media/dvb/frontends/sp8870.c | |||
@@ -70,7 +70,7 @@ static int sp8870_writereg (struct sp8870_state* state, u16 reg, u16 data) | |||
70 | int err; | 70 | int err; |
71 | 71 | ||
72 | if ((err = i2c_transfer (state->i2c, &msg, 1)) != 1) { | 72 | if ((err = i2c_transfer (state->i2c, &msg, 1)) != 1) { |
73 | dprintk ("%s: writereg error (err == %i, reg == 0x%02x, data == 0x%02x)\n", __FUNCTION__, err, reg, data); | 73 | dprintk ("%s: writereg error (err == %i, reg == 0x%02x, data == 0x%02x)\n", __func__, err, reg, data); |
74 | return -EREMOTEIO; | 74 | return -EREMOTEIO; |
75 | } | 75 | } |
76 | 76 | ||
@@ -88,7 +88,7 @@ static int sp8870_readreg (struct sp8870_state* state, u16 reg) | |||
88 | ret = i2c_transfer (state->i2c, msg, 2); | 88 | ret = i2c_transfer (state->i2c, msg, 2); |
89 | 89 | ||
90 | if (ret != 2) { | 90 | if (ret != 2) { |
91 | dprintk("%s: readreg error (ret == %i)\n", __FUNCTION__, ret); | 91 | dprintk("%s: readreg error (ret == %i)\n", __func__, ret); |
92 | return -1; | 92 | return -1; |
93 | } | 93 | } |
94 | 94 | ||
@@ -104,7 +104,7 @@ static int sp8870_firmware_upload (struct sp8870_state* state, const struct firm | |||
104 | int tx_len; | 104 | int tx_len; |
105 | int err = 0; | 105 | int err = 0; |
106 | 106 | ||
107 | dprintk ("%s: ...\n", __FUNCTION__); | 107 | dprintk ("%s: ...\n", __func__); |
108 | 108 | ||
109 | if (fw->size < SP8870_FIRMWARE_SIZE + SP8870_FIRMWARE_OFFSET) | 109 | if (fw->size < SP8870_FIRMWARE_SIZE + SP8870_FIRMWARE_OFFSET) |
110 | return -EINVAL; | 110 | return -EINVAL; |
@@ -131,14 +131,14 @@ static int sp8870_firmware_upload (struct sp8870_state* state, const struct firm | |||
131 | msg.buf = tx_buf; | 131 | msg.buf = tx_buf; |
132 | msg.len = tx_len + 2; | 132 | msg.len = tx_len + 2; |
133 | if ((err = i2c_transfer (state->i2c, &msg, 1)) != 1) { | 133 | if ((err = i2c_transfer (state->i2c, &msg, 1)) != 1) { |
134 | printk("%s: firmware upload failed!\n", __FUNCTION__); | 134 | printk("%s: firmware upload failed!\n", __func__); |
135 | printk ("%s: i2c error (err == %i)\n", __FUNCTION__, err); | 135 | printk ("%s: i2c error (err == %i)\n", __func__, err); |
136 | return err; | 136 | return err; |
137 | } | 137 | } |
138 | fw_pos += tx_len; | 138 | fw_pos += tx_len; |
139 | } | 139 | } |
140 | 140 | ||
141 | dprintk ("%s: done!\n", __FUNCTION__); | 141 | dprintk ("%s: done!\n", __func__); |
142 | return 0; | 142 | return 0; |
143 | }; | 143 | }; |
144 | 144 | ||
@@ -310,7 +310,7 @@ static int sp8870_init (struct dvb_frontend* fe) | |||
310 | if (state->initialised) return 0; | 310 | if (state->initialised) return 0; |
311 | state->initialised = 1; | 311 | state->initialised = 1; |
312 | 312 | ||
313 | dprintk ("%s\n", __FUNCTION__); | 313 | dprintk ("%s\n", __func__); |
314 | 314 | ||
315 | 315 | ||
316 | /* request the firmware, this will block until someone uploads it */ | 316 | /* request the firmware, this will block until someone uploads it */ |
@@ -449,15 +449,15 @@ static int sp8870_read_uncorrected_blocks (struct dvb_frontend* fe, u32* ublocks | |||
449 | return 0; | 449 | return 0; |
450 | } | 450 | } |
451 | 451 | ||
452 | // number of trials to recover from lockup | 452 | /* number of trials to recover from lockup */ |
453 | #define MAXTRIALS 5 | 453 | #define MAXTRIALS 5 |
454 | // maximum checks for data valid signal | 454 | /* maximum checks for data valid signal */ |
455 | #define MAXCHECKS 100 | 455 | #define MAXCHECKS 100 |
456 | 456 | ||
457 | // only for debugging: counter for detected lockups | 457 | /* only for debugging: counter for detected lockups */ |
458 | static int lockups = 0; | 458 | static int lockups; |
459 | // only for debugging: counter for channel switches | 459 | /* only for debugging: counter for channel switches */ |
460 | static int switches = 0; | 460 | static int switches; |
461 | 461 | ||
462 | static int sp8870_set_frontend (struct dvb_frontend* fe, struct dvb_frontend_parameters *p) | 462 | static int sp8870_set_frontend (struct dvb_frontend* fe, struct dvb_frontend_parameters *p) |
463 | { | 463 | { |
@@ -475,7 +475,7 @@ static int sp8870_set_frontend (struct dvb_frontend* fe, struct dvb_frontend_par | |||
475 | int trials = 0; | 475 | int trials = 0; |
476 | int check_count = 0; | 476 | int check_count = 0; |
477 | 477 | ||
478 | dprintk("%s: frequency = %i\n", __FUNCTION__, p->frequency); | 478 | dprintk("%s: frequency = %i\n", __func__, p->frequency); |
479 | 479 | ||
480 | for (trials = 1; trials <= MAXTRIALS; trials++) { | 480 | for (trials = 1; trials <= MAXTRIALS; trials++) { |
481 | 481 | ||
@@ -487,7 +487,7 @@ static int sp8870_set_frontend (struct dvb_frontend* fe, struct dvb_frontend_par | |||
487 | valid = sp8870_read_data_valid_signal(state); | 487 | valid = sp8870_read_data_valid_signal(state); |
488 | if (valid) { | 488 | if (valid) { |
489 | dprintk("%s: delay = %i usec\n", | 489 | dprintk("%s: delay = %i usec\n", |
490 | __FUNCTION__, check_count * 10); | 490 | __func__, check_count * 10); |
491 | break; | 491 | break; |
492 | } | 492 | } |
493 | udelay(10); | 493 | udelay(10); |
@@ -497,20 +497,20 @@ static int sp8870_set_frontend (struct dvb_frontend* fe, struct dvb_frontend_par | |||
497 | } | 497 | } |
498 | 498 | ||
499 | if (!valid) { | 499 | if (!valid) { |
500 | printk("%s: firmware crash!!!!!!\n", __FUNCTION__); | 500 | printk("%s: firmware crash!!!!!!\n", __func__); |
501 | return -EIO; | 501 | return -EIO; |
502 | } | 502 | } |
503 | 503 | ||
504 | if (debug) { | 504 | if (debug) { |
505 | if (valid) { | 505 | if (valid) { |
506 | if (trials > 1) { | 506 | if (trials > 1) { |
507 | printk("%s: firmware lockup!!!\n", __FUNCTION__); | 507 | printk("%s: firmware lockup!!!\n", __func__); |
508 | printk("%s: recovered after %i trial(s))\n", __FUNCTION__, trials - 1); | 508 | printk("%s: recovered after %i trial(s))\n", __func__, trials - 1); |
509 | lockups++; | 509 | lockups++; |
510 | } | 510 | } |
511 | } | 511 | } |
512 | switches++; | 512 | switches++; |
513 | printk("%s: switches = %i lockups = %i\n", __FUNCTION__, switches, lockups); | 513 | printk("%s: switches = %i lockups = %i\n", __func__, switches, lockups); |
514 | } | 514 | } |
515 | 515 | ||
516 | return 0; | 516 | return 0; |
diff --git a/drivers/media/dvb/frontends/sp8870.h b/drivers/media/dvb/frontends/sp8870.h index 909cefe7139e..a764a793c7d8 100644 --- a/drivers/media/dvb/frontends/sp8870.h +++ b/drivers/media/dvb/frontends/sp8870.h | |||
@@ -42,7 +42,7 @@ extern struct dvb_frontend* sp8870_attach(const struct sp8870_config* config, | |||
42 | static inline struct dvb_frontend* sp8870_attach(const struct sp8870_config* config, | 42 | static inline struct dvb_frontend* sp8870_attach(const struct sp8870_config* config, |
43 | struct i2c_adapter* i2c) | 43 | struct i2c_adapter* i2c) |
44 | { | 44 | { |
45 | printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __FUNCTION__); | 45 | printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__); |
46 | return NULL; | 46 | return NULL; |
47 | } | 47 | } |
48 | #endif // CONFIG_DVB_SP8870 | 48 | #endif // CONFIG_DVB_SP8870 |
diff --git a/drivers/media/dvb/frontends/sp887x.c b/drivers/media/dvb/frontends/sp887x.c index 1aa2539f5099..49f55877f513 100644 --- a/drivers/media/dvb/frontends/sp887x.c +++ b/drivers/media/dvb/frontends/sp887x.c | |||
@@ -43,7 +43,7 @@ static int i2c_writebytes (struct sp887x_state* state, u8 *buf, u8 len) | |||
43 | 43 | ||
44 | if ((err = i2c_transfer (state->i2c, &msg, 1)) != 1) { | 44 | if ((err = i2c_transfer (state->i2c, &msg, 1)) != 1) { |
45 | printk ("%s: i2c write error (addr %02x, err == %i)\n", | 45 | printk ("%s: i2c write error (addr %02x, err == %i)\n", |
46 | __FUNCTION__, state->config->demod_address, err); | 46 | __func__, state->config->demod_address, err); |
47 | return -EREMOTEIO; | 47 | return -EREMOTEIO; |
48 | } | 48 | } |
49 | 49 | ||
@@ -65,7 +65,7 @@ static int sp887x_writereg (struct sp887x_state* state, u16 reg, u16 data) | |||
65 | { | 65 | { |
66 | printk("%s: writereg error " | 66 | printk("%s: writereg error " |
67 | "(reg %03x, data %03x, ret == %i)\n", | 67 | "(reg %03x, data %03x, ret == %i)\n", |
68 | __FUNCTION__, reg & 0xffff, data & 0xffff, ret); | 68 | __func__, reg & 0xffff, data & 0xffff, ret); |
69 | return ret; | 69 | return ret; |
70 | } | 70 | } |
71 | } | 71 | } |
@@ -82,7 +82,7 @@ static int sp887x_readreg (struct sp887x_state* state, u16 reg) | |||
82 | { .addr = state->config->demod_address, .flags = I2C_M_RD, .buf = b1, .len = 2 }}; | 82 | { .addr = state->config->demod_address, .flags = I2C_M_RD, .buf = b1, .len = 2 }}; |
83 | 83 | ||
84 | if ((ret = i2c_transfer(state->i2c, msg, 2)) != 2) { | 84 | if ((ret = i2c_transfer(state->i2c, msg, 2)) != 2) { |
85 | printk("%s: readreg error (ret == %i)\n", __FUNCTION__, ret); | 85 | printk("%s: readreg error (ret == %i)\n", __func__, ret); |
86 | return -1; | 86 | return -1; |
87 | } | 87 | } |
88 | 88 | ||
@@ -91,7 +91,7 @@ static int sp887x_readreg (struct sp887x_state* state, u16 reg) | |||
91 | 91 | ||
92 | static void sp887x_microcontroller_stop (struct sp887x_state* state) | 92 | static void sp887x_microcontroller_stop (struct sp887x_state* state) |
93 | { | 93 | { |
94 | dprintk("%s\n", __FUNCTION__); | 94 | dprintk("%s\n", __func__); |
95 | sp887x_writereg(state, 0xf08, 0x000); | 95 | sp887x_writereg(state, 0xf08, 0x000); |
96 | sp887x_writereg(state, 0xf09, 0x000); | 96 | sp887x_writereg(state, 0xf09, 0x000); |
97 | 97 | ||
@@ -101,7 +101,7 @@ static void sp887x_microcontroller_stop (struct sp887x_state* state) | |||
101 | 101 | ||
102 | static void sp887x_microcontroller_start (struct sp887x_state* state) | 102 | static void sp887x_microcontroller_start (struct sp887x_state* state) |
103 | { | 103 | { |
104 | dprintk("%s\n", __FUNCTION__); | 104 | dprintk("%s\n", __func__); |
105 | sp887x_writereg(state, 0xf08, 0x000); | 105 | sp887x_writereg(state, 0xf08, 0x000); |
106 | sp887x_writereg(state, 0xf09, 0x000); | 106 | sp887x_writereg(state, 0xf09, 0x000); |
107 | 107 | ||
@@ -112,7 +112,7 @@ static void sp887x_microcontroller_start (struct sp887x_state* state) | |||
112 | static void sp887x_setup_agc (struct sp887x_state* state) | 112 | static void sp887x_setup_agc (struct sp887x_state* state) |
113 | { | 113 | { |
114 | /* setup AGC parameters */ | 114 | /* setup AGC parameters */ |
115 | dprintk("%s\n", __FUNCTION__); | 115 | dprintk("%s\n", __func__); |
116 | sp887x_writereg(state, 0x33c, 0x054); | 116 | sp887x_writereg(state, 0x33c, 0x054); |
117 | sp887x_writereg(state, 0x33b, 0x04c); | 117 | sp887x_writereg(state, 0x33b, 0x04c); |
118 | sp887x_writereg(state, 0x328, 0x000); | 118 | sp887x_writereg(state, 0x328, 0x000); |
@@ -142,7 +142,7 @@ static int sp887x_initial_setup (struct dvb_frontend* fe, const struct firmware | |||
142 | int fw_size = fw->size; | 142 | int fw_size = fw->size; |
143 | unsigned char *mem = fw->data; | 143 | unsigned char *mem = fw->data; |
144 | 144 | ||
145 | dprintk("%s\n", __FUNCTION__); | 145 | dprintk("%s\n", __func__); |
146 | 146 | ||
147 | /* ignore the first 10 bytes, then we expect 0x4000 bytes of firmware */ | 147 | /* ignore the first 10 bytes, then we expect 0x4000 bytes of firmware */ |
148 | if (fw_size < FW_SIZE+10) | 148 | if (fw_size < FW_SIZE+10) |
@@ -155,7 +155,7 @@ static int sp887x_initial_setup (struct dvb_frontend* fe, const struct firmware | |||
155 | 155 | ||
156 | sp887x_microcontroller_stop (state); | 156 | sp887x_microcontroller_stop (state); |
157 | 157 | ||
158 | printk ("%s: firmware upload... ", __FUNCTION__); | 158 | printk ("%s: firmware upload... ", __func__); |
159 | 159 | ||
160 | /* setup write pointer to -1 (end of memory) */ | 160 | /* setup write pointer to -1 (end of memory) */ |
161 | /* bit 0x8000 in address is set to enable 13bit mode */ | 161 | /* bit 0x8000 in address is set to enable 13bit mode */ |
@@ -181,7 +181,7 @@ static int sp887x_initial_setup (struct dvb_frontend* fe, const struct firmware | |||
181 | 181 | ||
182 | if ((err = i2c_writebytes (state, buf, c+2)) < 0) { | 182 | if ((err = i2c_writebytes (state, buf, c+2)) < 0) { |
183 | printk ("failed.\n"); | 183 | printk ("failed.\n"); |
184 | printk ("%s: i2c error (err == %i)\n", __FUNCTION__, err); | 184 | printk ("%s: i2c error (err == %i)\n", __func__, err); |
185 | return err; | 185 | return err; |
186 | } | 186 | } |
187 | } | 187 | } |
diff --git a/drivers/media/dvb/frontends/sp887x.h b/drivers/media/dvb/frontends/sp887x.h index 7ee78d7d916d..04eff6e0eef3 100644 --- a/drivers/media/dvb/frontends/sp887x.h +++ b/drivers/media/dvb/frontends/sp887x.h | |||
@@ -24,7 +24,7 @@ extern struct dvb_frontend* sp887x_attach(const struct sp887x_config* config, | |||
24 | static inline struct dvb_frontend* sp887x_attach(const struct sp887x_config* config, | 24 | static inline struct dvb_frontend* sp887x_attach(const struct sp887x_config* config, |
25 | struct i2c_adapter* i2c) | 25 | struct i2c_adapter* i2c) |
26 | { | 26 | { |
27 | printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __FUNCTION__); | 27 | printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__); |
28 | return NULL; | 28 | return NULL; |
29 | } | 29 | } |
30 | #endif // CONFIG_DVB_SP887X | 30 | #endif // CONFIG_DVB_SP887X |
diff --git a/drivers/media/dvb/frontends/stv0297.c b/drivers/media/dvb/frontends/stv0297.c index 7c23775f77db..62caf802ed99 100644 --- a/drivers/media/dvb/frontends/stv0297.c +++ b/drivers/media/dvb/frontends/stv0297.c | |||
@@ -58,7 +58,7 @@ static int stv0297_writereg(struct stv0297_state *state, u8 reg, u8 data) | |||
58 | 58 | ||
59 | if (ret != 1) | 59 | if (ret != 1) |
60 | dprintk("%s: writereg error (reg == 0x%02x, val == 0x%02x, " | 60 | dprintk("%s: writereg error (reg == 0x%02x, val == 0x%02x, " |
61 | "ret == %i)\n", __FUNCTION__, reg, data, ret); | 61 | "ret == %i)\n", __func__, reg, data, ret); |
62 | 62 | ||
63 | return (ret != 1) ? -1 : 0; | 63 | return (ret != 1) ? -1 : 0; |
64 | } | 64 | } |
@@ -75,16 +75,16 @@ static int stv0297_readreg(struct stv0297_state *state, u8 reg) | |||
75 | // this device needs a STOP between the register and data | 75 | // this device needs a STOP between the register and data |
76 | if (state->config->stop_during_read) { | 76 | if (state->config->stop_during_read) { |
77 | if ((ret = i2c_transfer(state->i2c, &msg[0], 1)) != 1) { | 77 | if ((ret = i2c_transfer(state->i2c, &msg[0], 1)) != 1) { |
78 | dprintk("%s: readreg error (reg == 0x%02x, ret == %i)\n", __FUNCTION__, reg, ret); | 78 | dprintk("%s: readreg error (reg == 0x%02x, ret == %i)\n", __func__, reg, ret); |
79 | return -1; | 79 | return -1; |
80 | } | 80 | } |
81 | if ((ret = i2c_transfer(state->i2c, &msg[1], 1)) != 1) { | 81 | if ((ret = i2c_transfer(state->i2c, &msg[1], 1)) != 1) { |
82 | dprintk("%s: readreg error (reg == 0x%02x, ret == %i)\n", __FUNCTION__, reg, ret); | 82 | dprintk("%s: readreg error (reg == 0x%02x, ret == %i)\n", __func__, reg, ret); |
83 | return -1; | 83 | return -1; |
84 | } | 84 | } |
85 | } else { | 85 | } else { |
86 | if ((ret = i2c_transfer(state->i2c, msg, 2)) != 2) { | 86 | if ((ret = i2c_transfer(state->i2c, msg, 2)) != 2) { |
87 | dprintk("%s: readreg error (reg == 0x%02x, ret == %i)\n", __FUNCTION__, reg, ret); | 87 | dprintk("%s: readreg error (reg == 0x%02x, ret == %i)\n", __func__, reg, ret); |
88 | return -1; | 88 | return -1; |
89 | } | 89 | } |
90 | } | 90 | } |
@@ -115,16 +115,16 @@ static int stv0297_readregs(struct stv0297_state *state, u8 reg1, u8 * b, u8 len | |||
115 | // this device needs a STOP between the register and data | 115 | // this device needs a STOP between the register and data |
116 | if (state->config->stop_during_read) { | 116 | if (state->config->stop_during_read) { |
117 | if ((ret = i2c_transfer(state->i2c, &msg[0], 1)) != 1) { | 117 | if ((ret = i2c_transfer(state->i2c, &msg[0], 1)) != 1) { |
118 | dprintk("%s: readreg error (reg == 0x%02x, ret == %i)\n", __FUNCTION__, reg1, ret); | 118 | dprintk("%s: readreg error (reg == 0x%02x, ret == %i)\n", __func__, reg1, ret); |
119 | return -1; | 119 | return -1; |
120 | } | 120 | } |
121 | if ((ret = i2c_transfer(state->i2c, &msg[1], 1)) != 1) { | 121 | if ((ret = i2c_transfer(state->i2c, &msg[1], 1)) != 1) { |
122 | dprintk("%s: readreg error (reg == 0x%02x, ret == %i)\n", __FUNCTION__, reg1, ret); | 122 | dprintk("%s: readreg error (reg == 0x%02x, ret == %i)\n", __func__, reg1, ret); |
123 | return -1; | 123 | return -1; |
124 | } | 124 | } |
125 | } else { | 125 | } else { |
126 | if ((ret = i2c_transfer(state->i2c, msg, 2)) != 2) { | 126 | if ((ret = i2c_transfer(state->i2c, msg, 2)) != 2) { |
127 | dprintk("%s: readreg error (reg == 0x%02x, ret == %i)\n", __FUNCTION__, reg1, ret); | 127 | dprintk("%s: readreg error (reg == 0x%02x, ret == %i)\n", __func__, reg1, ret); |
128 | return -1; | 128 | return -1; |
129 | } | 129 | } |
130 | } | 130 | } |
diff --git a/drivers/media/dvb/frontends/stv0297.h b/drivers/media/dvb/frontends/stv0297.h index 69f4515df2b9..3f8f9468f387 100644 --- a/drivers/media/dvb/frontends/stv0297.h +++ b/drivers/media/dvb/frontends/stv0297.h | |||
@@ -49,7 +49,7 @@ extern struct dvb_frontend* stv0297_attach(const struct stv0297_config* config, | |||
49 | static inline struct dvb_frontend* stv0297_attach(const struct stv0297_config* config, | 49 | static inline struct dvb_frontend* stv0297_attach(const struct stv0297_config* config, |
50 | struct i2c_adapter* i2c) | 50 | struct i2c_adapter* i2c) |
51 | { | 51 | { |
52 | printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __FUNCTION__); | 52 | printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__); |
53 | return NULL; | 53 | return NULL; |
54 | } | 54 | } |
55 | #endif // CONFIG_DVB_STV0297 | 55 | #endif // CONFIG_DVB_STV0297 |
diff --git a/drivers/media/dvb/frontends/stv0299.c b/drivers/media/dvb/frontends/stv0299.c index 035dd7ba6519..17556183e871 100644 --- a/drivers/media/dvb/frontends/stv0299.c +++ b/drivers/media/dvb/frontends/stv0299.c | |||
@@ -86,7 +86,7 @@ static int stv0299_writeregI (struct stv0299_state* state, u8 reg, u8 data) | |||
86 | 86 | ||
87 | if (ret != 1) | 87 | if (ret != 1) |
88 | dprintk("%s: writereg error (reg == 0x%02x, val == 0x%02x, " | 88 | dprintk("%s: writereg error (reg == 0x%02x, val == 0x%02x, " |
89 | "ret == %i)\n", __FUNCTION__, reg, data, ret); | 89 | "ret == %i)\n", __func__, reg, data, ret); |
90 | 90 | ||
91 | return (ret != 1) ? -EREMOTEIO : 0; | 91 | return (ret != 1) ? -EREMOTEIO : 0; |
92 | } | 92 | } |
@@ -113,7 +113,7 @@ static u8 stv0299_readreg (struct stv0299_state* state, u8 reg) | |||
113 | 113 | ||
114 | if (ret != 2) | 114 | if (ret != 2) |
115 | dprintk("%s: readreg error (reg == 0x%02x, ret == %i)\n", | 115 | dprintk("%s: readreg error (reg == 0x%02x, ret == %i)\n", |
116 | __FUNCTION__, reg, ret); | 116 | __func__, reg, ret); |
117 | 117 | ||
118 | return b1[0]; | 118 | return b1[0]; |
119 | } | 119 | } |
@@ -127,14 +127,14 @@ static int stv0299_readregs (struct stv0299_state* state, u8 reg1, u8 *b, u8 len | |||
127 | ret = i2c_transfer (state->i2c, msg, 2); | 127 | ret = i2c_transfer (state->i2c, msg, 2); |
128 | 128 | ||
129 | if (ret != 2) | 129 | if (ret != 2) |
130 | dprintk("%s: readreg error (ret == %i)\n", __FUNCTION__, ret); | 130 | dprintk("%s: readreg error (ret == %i)\n", __func__, ret); |
131 | 131 | ||
132 | return ret == 2 ? 0 : ret; | 132 | return ret == 2 ? 0 : ret; |
133 | } | 133 | } |
134 | 134 | ||
135 | static int stv0299_set_FEC (struct stv0299_state* state, fe_code_rate_t fec) | 135 | static int stv0299_set_FEC (struct stv0299_state* state, fe_code_rate_t fec) |
136 | { | 136 | { |
137 | dprintk ("%s\n", __FUNCTION__); | 137 | dprintk ("%s\n", __func__); |
138 | 138 | ||
139 | switch (fec) { | 139 | switch (fec) { |
140 | case FEC_AUTO: | 140 | case FEC_AUTO: |
@@ -174,7 +174,7 @@ static fe_code_rate_t stv0299_get_fec (struct stv0299_state* state) | |||
174 | FEC_7_8, FEC_1_2 }; | 174 | FEC_7_8, FEC_1_2 }; |
175 | u8 index; | 175 | u8 index; |
176 | 176 | ||
177 | dprintk ("%s\n", __FUNCTION__); | 177 | dprintk ("%s\n", __func__); |
178 | 178 | ||
179 | index = stv0299_readreg (state, 0x1b); | 179 | index = stv0299_readreg (state, 0x1b); |
180 | index &= 0x7; | 180 | index &= 0x7; |
@@ -189,11 +189,11 @@ static int stv0299_wait_diseqc_fifo (struct stv0299_state* state, int timeout) | |||
189 | { | 189 | { |
190 | unsigned long start = jiffies; | 190 | unsigned long start = jiffies; |
191 | 191 | ||
192 | dprintk ("%s\n", __FUNCTION__); | 192 | dprintk ("%s\n", __func__); |
193 | 193 | ||
194 | while (stv0299_readreg(state, 0x0a) & 1) { | 194 | while (stv0299_readreg(state, 0x0a) & 1) { |
195 | if (jiffies - start > timeout) { | 195 | if (jiffies - start > timeout) { |
196 | dprintk ("%s: timeout!!\n", __FUNCTION__); | 196 | dprintk ("%s: timeout!!\n", __func__); |
197 | return -ETIMEDOUT; | 197 | return -ETIMEDOUT; |
198 | } | 198 | } |
199 | msleep(10); | 199 | msleep(10); |
@@ -206,11 +206,11 @@ static int stv0299_wait_diseqc_idle (struct stv0299_state* state, int timeout) | |||
206 | { | 206 | { |
207 | unsigned long start = jiffies; | 207 | unsigned long start = jiffies; |
208 | 208 | ||
209 | dprintk ("%s\n", __FUNCTION__); | 209 | dprintk ("%s\n", __func__); |
210 | 210 | ||
211 | while ((stv0299_readreg(state, 0x0a) & 3) != 2 ) { | 211 | while ((stv0299_readreg(state, 0x0a) & 3) != 2 ) { |
212 | if (jiffies - start > timeout) { | 212 | if (jiffies - start > timeout) { |
213 | dprintk ("%s: timeout!!\n", __FUNCTION__); | 213 | dprintk ("%s: timeout!!\n", __func__); |
214 | return -ETIMEDOUT; | 214 | return -ETIMEDOUT; |
215 | } | 215 | } |
216 | msleep(10); | 216 | msleep(10); |
@@ -245,7 +245,7 @@ static int stv0299_get_symbolrate (struct stv0299_state* state) | |||
245 | u8 sfr[3]; | 245 | u8 sfr[3]; |
246 | s8 rtf; | 246 | s8 rtf; |
247 | 247 | ||
248 | dprintk ("%s\n", __FUNCTION__); | 248 | dprintk ("%s\n", __func__); |
249 | 249 | ||
250 | stv0299_readregs (state, 0x1f, sfr, 3); | 250 | stv0299_readregs (state, 0x1f, sfr, 3); |
251 | stv0299_readregs (state, 0x1a, (u8 *)&rtf, 1); | 251 | stv0299_readregs (state, 0x1a, (u8 *)&rtf, 1); |
@@ -257,8 +257,8 @@ static int stv0299_get_symbolrate (struct stv0299_state* state) | |||
257 | offset = (s32) rtf * (srate / 4096L); | 257 | offset = (s32) rtf * (srate / 4096L); |
258 | offset /= 128; | 258 | offset /= 128; |
259 | 259 | ||
260 | dprintk ("%s : srate = %i\n", __FUNCTION__, srate); | 260 | dprintk ("%s : srate = %i\n", __func__, srate); |
261 | dprintk ("%s : ofset = %i\n", __FUNCTION__, offset); | 261 | dprintk ("%s : ofset = %i\n", __func__, offset); |
262 | 262 | ||
263 | srate += offset; | 263 | srate += offset; |
264 | 264 | ||
@@ -276,7 +276,7 @@ static int stv0299_send_diseqc_msg (struct dvb_frontend* fe, | |||
276 | u8 val; | 276 | u8 val; |
277 | int i; | 277 | int i; |
278 | 278 | ||
279 | dprintk ("%s\n", __FUNCTION__); | 279 | dprintk ("%s\n", __func__); |
280 | 280 | ||
281 | if (stv0299_wait_diseqc_idle (state, 100) < 0) | 281 | if (stv0299_wait_diseqc_idle (state, 100) < 0) |
282 | return -ETIMEDOUT; | 282 | return -ETIMEDOUT; |
@@ -305,7 +305,7 @@ static int stv0299_send_diseqc_burst (struct dvb_frontend* fe, fe_sec_mini_cmd_t | |||
305 | struct stv0299_state* state = fe->demodulator_priv; | 305 | struct stv0299_state* state = fe->demodulator_priv; |
306 | u8 val; | 306 | u8 val; |
307 | 307 | ||
308 | dprintk ("%s\n", __FUNCTION__); | 308 | dprintk ("%s\n", __func__); |
309 | 309 | ||
310 | if (stv0299_wait_diseqc_idle (state, 100) < 0) | 310 | if (stv0299_wait_diseqc_idle (state, 100) < 0) |
311 | return -ETIMEDOUT; | 311 | return -ETIMEDOUT; |
@@ -355,7 +355,7 @@ static int stv0299_set_voltage (struct dvb_frontend* fe, fe_sec_voltage_t voltag | |||
355 | u8 reg0x08; | 355 | u8 reg0x08; |
356 | u8 reg0x0c; | 356 | u8 reg0x0c; |
357 | 357 | ||
358 | dprintk("%s: %s\n", __FUNCTION__, | 358 | dprintk("%s: %s\n", __func__, |
359 | voltage == SEC_VOLTAGE_13 ? "SEC_VOLTAGE_13" : | 359 | voltage == SEC_VOLTAGE_13 ? "SEC_VOLTAGE_13" : |
360 | voltage == SEC_VOLTAGE_18 ? "SEC_VOLTAGE_18" : "??"); | 360 | voltage == SEC_VOLTAGE_18 ? "SEC_VOLTAGE_18" : "??"); |
361 | 361 | ||
@@ -366,26 +366,32 @@ static int stv0299_set_voltage (struct dvb_frontend* fe, fe_sec_voltage_t voltag | |||
366 | * H/V switching over OP0, OP1 and OP2 are LNB power enable bits | 366 | * H/V switching over OP0, OP1 and OP2 are LNB power enable bits |
367 | */ | 367 | */ |
368 | reg0x0c &= 0x0f; | 368 | reg0x0c &= 0x0f; |
369 | 369 | reg0x08 = (reg0x08 & 0x3f) | (state->config->lock_output << 6); | |
370 | if (voltage == SEC_VOLTAGE_OFF) { | ||
371 | stv0299_writeregI (state, 0x0c, 0x00); /* LNB power off! */ | ||
372 | return stv0299_writeregI (state, 0x08, 0x00); /* LNB power off! */ | ||
373 | } | ||
374 | |||
375 | stv0299_writeregI (state, 0x08, (reg0x08 & 0x3f) | (state->config->lock_output << 6)); | ||
376 | 370 | ||
377 | switch (voltage) { | 371 | switch (voltage) { |
378 | case SEC_VOLTAGE_13: | 372 | case SEC_VOLTAGE_13: |
379 | if (state->config->volt13_op0_op1 == STV0299_VOLT13_OP0) reg0x0c |= 0x10; | 373 | if (state->config->volt13_op0_op1 == STV0299_VOLT13_OP0) |
380 | else reg0x0c |= 0x40; | 374 | reg0x0c |= 0x10; /* OP1 off, OP0 on */ |
381 | 375 | else | |
382 | return stv0299_writeregI(state, 0x0c, reg0x0c); | 376 | reg0x0c |= 0x40; /* OP1 on, OP0 off */ |
383 | 377 | break; | |
384 | case SEC_VOLTAGE_18: | 378 | case SEC_VOLTAGE_18: |
385 | return stv0299_writeregI(state, 0x0c, reg0x0c | 0x50); | 379 | reg0x0c |= 0x50; /* OP1 on, OP0 on */ |
380 | break; | ||
381 | case SEC_VOLTAGE_OFF: | ||
382 | /* LNB power off! */ | ||
383 | reg0x08 = 0x00; | ||
384 | reg0x0c = 0x00; | ||
385 | break; | ||
386 | default: | 386 | default: |
387 | return -EINVAL; | 387 | return -EINVAL; |
388 | }; | 388 | }; |
389 | |||
390 | if (state->config->op0_off) | ||
391 | reg0x0c &= ~0x10; | ||
392 | |||
393 | stv0299_writeregI(state, 0x08, reg0x08); | ||
394 | return stv0299_writeregI(state, 0x0c, reg0x0c); | ||
389 | } | 395 | } |
390 | 396 | ||
391 | static int stv0299_send_legacy_dish_cmd (struct dvb_frontend* fe, unsigned long cmd) | 397 | static int stv0299_send_legacy_dish_cmd (struct dvb_frontend* fe, unsigned long cmd) |
@@ -408,7 +414,7 @@ static int stv0299_send_legacy_dish_cmd (struct dvb_frontend* fe, unsigned long | |||
408 | 414 | ||
409 | cmd = cmd << 1; | 415 | cmd = cmd << 1; |
410 | if (debug_legacy_dish_switch) | 416 | if (debug_legacy_dish_switch) |
411 | printk ("%s switch command: 0x%04lx\n",__FUNCTION__, cmd); | 417 | printk ("%s switch command: 0x%04lx\n",__func__, cmd); |
412 | 418 | ||
413 | do_gettimeofday (&nexttime); | 419 | do_gettimeofday (&nexttime); |
414 | if (debug_legacy_dish_switch) | 420 | if (debug_legacy_dish_switch) |
@@ -433,7 +439,7 @@ static int stv0299_send_legacy_dish_cmd (struct dvb_frontend* fe, unsigned long | |||
433 | } | 439 | } |
434 | if (debug_legacy_dish_switch) { | 440 | if (debug_legacy_dish_switch) { |
435 | printk ("%s(%d): switch delay (should be 32k followed by all 8k\n", | 441 | printk ("%s(%d): switch delay (should be 32k followed by all 8k\n", |
436 | __FUNCTION__, fe->dvb->num); | 442 | __func__, fe->dvb->num); |
437 | for (i = 1; i < 10; i++) | 443 | for (i = 1; i < 10; i++) |
438 | printk ("%d: %d\n", i, timeval_usec_diff(tv[i-1] , tv[i])); | 444 | printk ("%d: %d\n", i, timeval_usec_diff(tv[i-1] , tv[i])); |
439 | } | 445 | } |
@@ -445,11 +451,20 @@ static int stv0299_init (struct dvb_frontend* fe) | |||
445 | { | 451 | { |
446 | struct stv0299_state* state = fe->demodulator_priv; | 452 | struct stv0299_state* state = fe->demodulator_priv; |
447 | int i; | 453 | int i; |
454 | u8 reg; | ||
455 | u8 val; | ||
448 | 456 | ||
449 | dprintk("stv0299: init chip\n"); | 457 | dprintk("stv0299: init chip\n"); |
450 | 458 | ||
451 | for (i=0; !(state->config->inittab[i] == 0xff && state->config->inittab[i+1] == 0xff); i+=2) | 459 | for (i = 0; ; i += 2) { |
452 | stv0299_writeregI(state, state->config->inittab[i], state->config->inittab[i+1]); | 460 | reg = state->config->inittab[i]; |
461 | val = state->config->inittab[i+1]; | ||
462 | if (reg == 0xff && val == 0xff) | ||
463 | break; | ||
464 | if (reg == 0x0c && state->config->op0_off) | ||
465 | val &= ~0x10; | ||
466 | stv0299_writeregI(state, reg, val); | ||
467 | } | ||
453 | 468 | ||
454 | return 0; | 469 | return 0; |
455 | } | 470 | } |
@@ -461,7 +476,7 @@ static int stv0299_read_status(struct dvb_frontend* fe, fe_status_t* status) | |||
461 | u8 signal = 0xff - stv0299_readreg (state, 0x18); | 476 | u8 signal = 0xff - stv0299_readreg (state, 0x18); |
462 | u8 sync = stv0299_readreg (state, 0x1b); | 477 | u8 sync = stv0299_readreg (state, 0x1b); |
463 | 478 | ||
464 | dprintk ("%s : FE_READ_STATUS : VSTATUS: 0x%02x\n", __FUNCTION__, sync); | 479 | dprintk ("%s : FE_READ_STATUS : VSTATUS: 0x%02x\n", __func__, sync); |
465 | *status = 0; | 480 | *status = 0; |
466 | 481 | ||
467 | if (signal > 10) | 482 | if (signal > 10) |
@@ -499,7 +514,7 @@ static int stv0299_read_signal_strength(struct dvb_frontend* fe, u16* strength) | |||
499 | s32 signal = 0xffff - ((stv0299_readreg (state, 0x18) << 8) | 514 | s32 signal = 0xffff - ((stv0299_readreg (state, 0x18) << 8) |
500 | | stv0299_readreg (state, 0x19)); | 515 | | stv0299_readreg (state, 0x19)); |
501 | 516 | ||
502 | dprintk ("%s : FE_READ_SIGNAL_STRENGTH : AGC2I: 0x%02x%02x, signal=0x%04x\n", __FUNCTION__, | 517 | dprintk ("%s : FE_READ_SIGNAL_STRENGTH : AGC2I: 0x%02x%02x, signal=0x%04x\n", __func__, |
503 | stv0299_readreg (state, 0x18), | 518 | stv0299_readreg (state, 0x18), |
504 | stv0299_readreg (state, 0x19), (int) signal); | 519 | stv0299_readreg (state, 0x19), (int) signal); |
505 | 520 | ||
@@ -536,7 +551,7 @@ static int stv0299_set_frontend(struct dvb_frontend* fe, struct dvb_frontend_par | |||
536 | struct stv0299_state* state = fe->demodulator_priv; | 551 | struct stv0299_state* state = fe->demodulator_priv; |
537 | int invval = 0; | 552 | int invval = 0; |
538 | 553 | ||
539 | dprintk ("%s : FE_SET_FRONTEND\n", __FUNCTION__); | 554 | dprintk ("%s : FE_SET_FRONTEND\n", __func__); |
540 | 555 | ||
541 | // set the inversion | 556 | // set the inversion |
542 | if (p->inversion == INVERSION_OFF) invval = 0; | 557 | if (p->inversion == INVERSION_OFF) invval = 0; |
diff --git a/drivers/media/dvb/frontends/stv0299.h b/drivers/media/dvb/frontends/stv0299.h index 33df9495908f..3282f43022f5 100644 --- a/drivers/media/dvb/frontends/stv0299.h +++ b/drivers/media/dvb/frontends/stv0299.h | |||
@@ -48,10 +48,10 @@ | |||
48 | #include <linux/dvb/frontend.h> | 48 | #include <linux/dvb/frontend.h> |
49 | #include "dvb_frontend.h" | 49 | #include "dvb_frontend.h" |
50 | 50 | ||
51 | #define STV0229_LOCKOUTPUT_0 0 | 51 | #define STV0299_LOCKOUTPUT_0 0 |
52 | #define STV0229_LOCKOUTPUT_1 1 | 52 | #define STV0299_LOCKOUTPUT_1 1 |
53 | #define STV0229_LOCKOUTPUT_CF 2 | 53 | #define STV0299_LOCKOUTPUT_CF 2 |
54 | #define STV0229_LOCKOUTPUT_LK 3 | 54 | #define STV0299_LOCKOUTPUT_LK 3 |
55 | 55 | ||
56 | #define STV0299_VOLT13_OP0 0 | 56 | #define STV0299_VOLT13_OP0 0 |
57 | #define STV0299_VOLT13_OP1 1 | 57 | #define STV0299_VOLT13_OP1 1 |
@@ -82,6 +82,9 @@ struct stv0299_config | |||
82 | /* Is 13v controlled by OP0 or OP1? */ | 82 | /* Is 13v controlled by OP0 or OP1? */ |
83 | u8 volt13_op0_op1:1; | 83 | u8 volt13_op0_op1:1; |
84 | 84 | ||
85 | /* Turn-off OP0? */ | ||
86 | u8 op0_off:1; | ||
87 | |||
85 | /* minimum delay before retuning */ | 88 | /* minimum delay before retuning */ |
86 | int min_delay_ms; | 89 | int min_delay_ms; |
87 | 90 | ||
@@ -96,7 +99,7 @@ extern struct dvb_frontend* stv0299_attach(const struct stv0299_config* config, | |||
96 | static inline struct dvb_frontend* stv0299_attach(const struct stv0299_config* config, | 99 | static inline struct dvb_frontend* stv0299_attach(const struct stv0299_config* config, |
97 | struct i2c_adapter* i2c) | 100 | struct i2c_adapter* i2c) |
98 | { | 101 | { |
99 | printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __FUNCTION__); | 102 | printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__); |
100 | return NULL; | 103 | return NULL; |
101 | } | 104 | } |
102 | #endif // CONFIG_DVB_STV0299 | 105 | #endif // CONFIG_DVB_STV0299 |
diff --git a/drivers/media/dvb/frontends/tda10021.c b/drivers/media/dvb/frontends/tda10021.c index 45137d2ebfb9..f648fdb64bb7 100644 --- a/drivers/media/dvb/frontends/tda10021.c +++ b/drivers/media/dvb/frontends/tda10021.c | |||
@@ -79,7 +79,7 @@ static int _tda10021_writereg (struct tda10021_state* state, u8 reg, u8 data) | |||
79 | if (ret != 1) | 79 | if (ret != 1) |
80 | printk("DVB: TDA10021(%d): %s, writereg error " | 80 | printk("DVB: TDA10021(%d): %s, writereg error " |
81 | "(reg == 0x%02x, val == 0x%02x, ret == %i)\n", | 81 | "(reg == 0x%02x, val == 0x%02x, ret == %i)\n", |
82 | state->frontend.dvb->num, __FUNCTION__, reg, data, ret); | 82 | state->frontend.dvb->num, __func__, reg, data, ret); |
83 | 83 | ||
84 | msleep(10); | 84 | msleep(10); |
85 | return (ret != 1) ? -EREMOTEIO : 0; | 85 | return (ret != 1) ? -EREMOTEIO : 0; |
@@ -97,7 +97,7 @@ static u8 tda10021_readreg (struct tda10021_state* state, u8 reg) | |||
97 | // Don't print an error message if the id is read. | 97 | // Don't print an error message if the id is read. |
98 | if (ret != 2 && reg != 0x1a) | 98 | if (ret != 2 && reg != 0x1a) |
99 | printk("DVB: TDA10021: %s: readreg error (ret == %i)\n", | 99 | printk("DVB: TDA10021: %s: readreg error (ret == %i)\n", |
100 | __FUNCTION__, ret); | 100 | __func__, ret); |
101 | return b1[0]; | 101 | return b1[0]; |
102 | } | 102 | } |
103 | 103 | ||
diff --git a/drivers/media/dvb/frontends/tda10023.c b/drivers/media/dvb/frontends/tda10023.c index 364bc01971a0..0727b80bc4d2 100644 --- a/drivers/media/dvb/frontends/tda10023.c +++ b/drivers/media/dvb/frontends/tda10023.c | |||
@@ -118,7 +118,7 @@ static u8 tda10023_readreg (struct tda10023_state* state, u8 reg) | |||
118 | ret = i2c_transfer (state->i2c, msg, 2); | 118 | ret = i2c_transfer (state->i2c, msg, 2); |
119 | if (ret != 2) | 119 | if (ret != 2) |
120 | printk("DVB: TDA10023: %s: readreg error (ret == %i)\n", | 120 | printk("DVB: TDA10023: %s: readreg error (ret == %i)\n", |
121 | __FUNCTION__, ret); | 121 | __func__, ret); |
122 | return b1[0]; | 122 | return b1[0]; |
123 | } | 123 | } |
124 | 124 | ||
@@ -132,7 +132,7 @@ static int tda10023_writereg (struct tda10023_state* state, u8 reg, u8 data) | |||
132 | if (ret != 1) | 132 | if (ret != 1) |
133 | printk("DVB: TDA10023(%d): %s, writereg error " | 133 | printk("DVB: TDA10023(%d): %s, writereg error " |
134 | "(reg == 0x%02x, val == 0x%02x, ret == %i)\n", | 134 | "(reg == 0x%02x, val == 0x%02x, ret == %i)\n", |
135 | state->frontend.dvb->num, __FUNCTION__, reg, data, ret); | 135 | state->frontend.dvb->num, __func__, reg, data, ret); |
136 | 136 | ||
137 | return (ret != 1) ? -EREMOTEIO : 0; | 137 | return (ret != 1) ? -EREMOTEIO : 0; |
138 | } | 138 | } |
diff --git a/drivers/media/dvb/frontends/tda1002x.h b/drivers/media/dvb/frontends/tda1002x.h index e9094d8123f6..1bcc0d44b90b 100644 --- a/drivers/media/dvb/frontends/tda1002x.h +++ b/drivers/media/dvb/frontends/tda1002x.h | |||
@@ -40,7 +40,7 @@ extern struct dvb_frontend* tda10021_attach(const struct tda1002x_config* config | |||
40 | static inline struct dvb_frontend* tda10021_attach(const struct tda1002x_config* config, | 40 | static inline struct dvb_frontend* tda10021_attach(const struct tda1002x_config* config, |
41 | struct i2c_adapter* i2c, u8 pwm) | 41 | struct i2c_adapter* i2c, u8 pwm) |
42 | { | 42 | { |
43 | printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __FUNCTION__); | 43 | printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__); |
44 | return NULL; | 44 | return NULL; |
45 | } | 45 | } |
46 | #endif // CONFIG_DVB_TDA10021 | 46 | #endif // CONFIG_DVB_TDA10021 |
@@ -52,7 +52,7 @@ extern struct dvb_frontend* tda10023_attach(const struct tda1002x_config* config | |||
52 | static inline struct dvb_frontend* tda10023_attach(const struct tda1002x_config* config, | 52 | static inline struct dvb_frontend* tda10023_attach(const struct tda1002x_config* config, |
53 | struct i2c_adapter* i2c, u8 pwm) | 53 | struct i2c_adapter* i2c, u8 pwm) |
54 | { | 54 | { |
55 | printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __FUNCTION__); | 55 | printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__); |
56 | return NULL; | 56 | return NULL; |
57 | } | 57 | } |
58 | #endif // CONFIG_DVB_TDA10023 | 58 | #endif // CONFIG_DVB_TDA10023 |
diff --git a/drivers/media/dvb/frontends/tda10048.c b/drivers/media/dvb/frontends/tda10048.c new file mode 100644 index 000000000000..090fb7dd93c6 --- /dev/null +++ b/drivers/media/dvb/frontends/tda10048.c | |||
@@ -0,0 +1,841 @@ | |||
1 | /* | ||
2 | NXP TDA10048HN DVB OFDM demodulator driver | ||
3 | |||
4 | Copyright (C) 2008 Steven Toth <stoth@hauppauge.com> | ||
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 | GNU General Public License for more details. | ||
15 | |||
16 | You should have received a copy of the GNU General Public License | ||
17 | along with this program; if not, write to the Free Software | ||
18 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
19 | |||
20 | */ | ||
21 | |||
22 | #include <linux/kernel.h> | ||
23 | #include <linux/init.h> | ||
24 | #include <linux/module.h> | ||
25 | #include <linux/string.h> | ||
26 | #include <linux/slab.h> | ||
27 | #include <linux/delay.h> | ||
28 | #include "dvb_frontend.h" | ||
29 | #include "dvb_math.h" | ||
30 | #include "tda10048.h" | ||
31 | |||
32 | #define TDA10048_DEFAULT_FIRMWARE "dvb-fe-tda10048-1.0.fw" | ||
33 | #define TDA10048_DEFAULT_FIRMWARE_SIZE 24878 | ||
34 | |||
35 | /* Register name definitions */ | ||
36 | #define TDA10048_IDENTITY 0x00 | ||
37 | #define TDA10048_VERSION 0x01 | ||
38 | #define TDA10048_DSP_CODE_CPT 0x0C | ||
39 | #define TDA10048_DSP_CODE_IN 0x0E | ||
40 | #define TDA10048_IN_CONF1 0x10 | ||
41 | #define TDA10048_IN_CONF2 0x11 | ||
42 | #define TDA10048_IN_CONF3 0x12 | ||
43 | #define TDA10048_OUT_CONF1 0x14 | ||
44 | #define TDA10048_OUT_CONF2 0x15 | ||
45 | #define TDA10048_OUT_CONF3 0x16 | ||
46 | #define TDA10048_AUTO 0x18 | ||
47 | #define TDA10048_SYNC_STATUS 0x1A | ||
48 | #define TDA10048_CONF_C4_1 0x1E | ||
49 | #define TDA10048_CONF_C4_2 0x1F | ||
50 | #define TDA10048_CODE_IN_RAM 0x20 | ||
51 | #define TDA10048_CHANNEL_INFO_1_R 0x22 | ||
52 | #define TDA10048_CHANNEL_INFO_2_R 0x23 | ||
53 | #define TDA10048_CHANNEL_INFO1 0x24 | ||
54 | #define TDA10048_CHANNEL_INFO2 0x25 | ||
55 | #define TDA10048_TIME_ERROR_R 0x26 | ||
56 | #define TDA10048_TIME_ERROR 0x27 | ||
57 | #define TDA10048_FREQ_ERROR_LSB_R 0x28 | ||
58 | #define TDA10048_FREQ_ERROR_MSB_R 0x29 | ||
59 | #define TDA10048_FREQ_ERROR_LSB 0x2A | ||
60 | #define TDA10048_FREQ_ERROR_MSB 0x2B | ||
61 | #define TDA10048_IT_SEL 0x30 | ||
62 | #define TDA10048_IT_STAT 0x32 | ||
63 | #define TDA10048_DSP_AD_LSB 0x3C | ||
64 | #define TDA10048_DSP_AD_MSB 0x3D | ||
65 | #define TDA10048_DSP_REF_LSB 0x3E | ||
66 | #define TDA10048_DSP_REF_MSB 0x3F | ||
67 | #define TDA10048_CONF_TRISTATE1 0x44 | ||
68 | #define TDA10048_CONF_TRISTATE2 0x45 | ||
69 | #define TDA10048_CONF_POLARITY 0x46 | ||
70 | #define TDA10048_GPIO_SP_DS0 0x48 | ||
71 | #define TDA10048_GPIO_SP_DS1 0x49 | ||
72 | #define TDA10048_GPIO_SP_DS2 0x4A | ||
73 | #define TDA10048_GPIO_SP_DS3 0x4B | ||
74 | #define TDA10048_GPIO_OUT_SEL 0x4C | ||
75 | #define TDA10048_GPIO_SELECT 0x4D | ||
76 | #define TDA10048_IC_MODE 0x4E | ||
77 | #define TDA10048_CONF_XO 0x50 | ||
78 | #define TDA10048_CONF_PLL1 0x51 | ||
79 | #define TDA10048_CONF_PLL2 0x52 | ||
80 | #define TDA10048_CONF_PLL3 0x53 | ||
81 | #define TDA10048_CONF_ADC 0x54 | ||
82 | #define TDA10048_CONF_ADC_2 0x55 | ||
83 | #define TDA10048_CONF_C1_1 0x60 | ||
84 | #define TDA10048_CONF_C1_3 0x62 | ||
85 | #define TDA10048_AGC_CONF 0x70 | ||
86 | #define TDA10048_AGC_THRESHOLD_LSB 0x72 | ||
87 | #define TDA10048_AGC_THRESHOLD_MSB 0x73 | ||
88 | #define TDA10048_AGC_RENORM 0x74 | ||
89 | #define TDA10048_AGC_GAINS 0x76 | ||
90 | #define TDA10048_AGC_TUN_MIN 0x78 | ||
91 | #define TDA10048_AGC_TUN_MAX 0x79 | ||
92 | #define TDA10048_AGC_IF_MIN 0x7A | ||
93 | #define TDA10048_AGC_IF_MAX 0x7B | ||
94 | #define TDA10048_AGC_TUN_LEVEL 0x7E | ||
95 | #define TDA10048_AGC_IF_LEVEL 0x7F | ||
96 | #define TDA10048_DIG_AGC_LEVEL 0x81 | ||
97 | #define TDA10048_FREQ_PHY2_LSB 0x86 | ||
98 | #define TDA10048_FREQ_PHY2_MSB 0x87 | ||
99 | #define TDA10048_TIME_INVWREF_LSB 0x88 | ||
100 | #define TDA10048_TIME_INVWREF_MSB 0x89 | ||
101 | #define TDA10048_TIME_WREF_LSB 0x8A | ||
102 | #define TDA10048_TIME_WREF_MID1 0x8B | ||
103 | #define TDA10048_TIME_WREF_MID2 0x8C | ||
104 | #define TDA10048_TIME_WREF_MSB 0x8D | ||
105 | #define TDA10048_NP_OUT 0xA2 | ||
106 | #define TDA10048_CELL_ID_LSB 0xA4 | ||
107 | #define TDA10048_CELL_ID_MSB 0xA5 | ||
108 | #define TDA10048_EXTTPS_ODD 0xAA | ||
109 | #define TDA10048_EXTTPS_EVEN 0xAB | ||
110 | #define TDA10048_TPS_LENGTH 0xAC | ||
111 | #define TDA10048_FREE_REG_1 0xB2 | ||
112 | #define TDA10048_FREE_REG_2 0xB3 | ||
113 | #define TDA10048_CONF_C3_1 0xC0 | ||
114 | #define TDA10048_CYBER_CTRL 0xC2 | ||
115 | #define TDA10048_CBER_NMAX_LSB 0xC4 | ||
116 | #define TDA10048_CBER_NMAX_MSB 0xC5 | ||
117 | #define TDA10048_CBER_LSB 0xC6 | ||
118 | #define TDA10048_CBER_MSB 0xC7 | ||
119 | #define TDA10048_VBER_LSB 0xC8 | ||
120 | #define TDA10048_VBER_MID 0xC9 | ||
121 | #define TDA10048_VBER_MSB 0xCA | ||
122 | #define TDA10048_CYBER_LUT 0xCC | ||
123 | #define TDA10048_UNCOR_CTRL 0xCD | ||
124 | #define TDA10048_UNCOR_CPT_LSB 0xCE | ||
125 | #define TDA10048_UNCOR_CPT_MSB 0xCF | ||
126 | #define TDA10048_SOFT_IT_C3 0xD6 | ||
127 | #define TDA10048_CONF_TS2 0xE0 | ||
128 | #define TDA10048_CONF_TS1 0xE1 | ||
129 | |||
130 | static unsigned int debug; | ||
131 | |||
132 | #define dprintk(level, fmt, arg...)\ | ||
133 | do { if (debug >= level)\ | ||
134 | printk(KERN_DEBUG "tda10048: " fmt, ## arg);\ | ||
135 | } while (0) | ||
136 | |||
137 | struct tda10048_state { | ||
138 | |||
139 | struct i2c_adapter *i2c; | ||
140 | |||
141 | /* configuration settings */ | ||
142 | const struct tda10048_config *config; | ||
143 | struct dvb_frontend frontend; | ||
144 | |||
145 | int fwloaded; | ||
146 | }; | ||
147 | |||
148 | static struct init_tab { | ||
149 | u8 reg; | ||
150 | u16 data; | ||
151 | } init_tab[] = { | ||
152 | { TDA10048_CONF_PLL1, 0x08 }, | ||
153 | { TDA10048_CONF_ADC_2, 0x00 }, | ||
154 | { TDA10048_CONF_C4_1, 0x00 }, | ||
155 | { TDA10048_CONF_PLL1, 0x0f }, | ||
156 | { TDA10048_CONF_PLL2, 0x0a }, | ||
157 | { TDA10048_CONF_PLL3, 0x43 }, | ||
158 | { TDA10048_FREQ_PHY2_LSB, 0x02 }, | ||
159 | { TDA10048_FREQ_PHY2_MSB, 0x0a }, | ||
160 | { TDA10048_TIME_WREF_LSB, 0xbd }, | ||
161 | { TDA10048_TIME_WREF_MID1, 0xe4 }, | ||
162 | { TDA10048_TIME_WREF_MID2, 0xa8 }, | ||
163 | { TDA10048_TIME_WREF_MSB, 0x02 }, | ||
164 | { TDA10048_TIME_INVWREF_LSB, 0x04 }, | ||
165 | { TDA10048_TIME_INVWREF_MSB, 0x06 }, | ||
166 | { TDA10048_CONF_C4_1, 0x00 }, | ||
167 | { TDA10048_CONF_C1_1, 0xa8 }, | ||
168 | { TDA10048_AGC_CONF, 0x16 }, | ||
169 | { TDA10048_CONF_C1_3, 0x0b }, | ||
170 | { TDA10048_AGC_TUN_MIN, 0x00 }, | ||
171 | { TDA10048_AGC_TUN_MAX, 0xff }, | ||
172 | { TDA10048_AGC_IF_MIN, 0x00 }, | ||
173 | { TDA10048_AGC_IF_MAX, 0xff }, | ||
174 | { TDA10048_AGC_THRESHOLD_MSB, 0x00 }, | ||
175 | { TDA10048_AGC_THRESHOLD_LSB, 0x70 }, | ||
176 | { TDA10048_CYBER_CTRL, 0x38 }, | ||
177 | { TDA10048_AGC_GAINS, 0x12 }, | ||
178 | { TDA10048_CONF_XO, 0x00 }, | ||
179 | { TDA10048_CONF_TS1, 0x07 }, | ||
180 | { TDA10048_IC_MODE, 0x00 }, | ||
181 | { TDA10048_CONF_TS2, 0xc0 }, | ||
182 | { TDA10048_CONF_TRISTATE1, 0x21 }, | ||
183 | { TDA10048_CONF_TRISTATE2, 0x00 }, | ||
184 | { TDA10048_CONF_POLARITY, 0x00 }, | ||
185 | { TDA10048_CONF_C4_2, 0x04 }, | ||
186 | { TDA10048_CONF_ADC, 0x60 }, | ||
187 | { TDA10048_CONF_ADC_2, 0x10 }, | ||
188 | { TDA10048_CONF_ADC, 0x60 }, | ||
189 | { TDA10048_CONF_ADC_2, 0x00 }, | ||
190 | { TDA10048_CONF_C1_1, 0xa8 }, | ||
191 | { TDA10048_UNCOR_CTRL, 0x00 }, | ||
192 | { TDA10048_CONF_C4_2, 0x04 }, | ||
193 | }; | ||
194 | |||
195 | static int tda10048_writereg(struct tda10048_state *state, u8 reg, u8 data) | ||
196 | { | ||
197 | int ret; | ||
198 | u8 buf [] = { reg, data }; | ||
199 | struct i2c_msg msg = { | ||
200 | .addr = state->config->demod_address, | ||
201 | .flags = 0, .buf = buf, .len = 2 }; | ||
202 | |||
203 | dprintk(2, "%s(reg = 0x%02x, data = 0x%02x)\n", __func__, reg, data); | ||
204 | |||
205 | ret = i2c_transfer(state->i2c, &msg, 1); | ||
206 | |||
207 | if (ret != 1) | ||
208 | printk("%s: writereg error (ret == %i)\n", __func__, ret); | ||
209 | |||
210 | return (ret != 1) ? -1 : 0; | ||
211 | } | ||
212 | |||
213 | static u8 tda10048_readreg(struct tda10048_state *state, u8 reg) | ||
214 | { | ||
215 | int ret; | ||
216 | u8 b0 [] = { reg }; | ||
217 | u8 b1 [] = { 0 }; | ||
218 | struct i2c_msg msg [] = { | ||
219 | { .addr = state->config->demod_address, | ||
220 | .flags = 0, .buf = b0, .len = 1 }, | ||
221 | { .addr = state->config->demod_address, | ||
222 | .flags = I2C_M_RD, .buf = b1, .len = 1 } }; | ||
223 | |||
224 | dprintk(2, "%s(reg = 0x%02x)\n", __func__, reg); | ||
225 | |||
226 | ret = i2c_transfer(state->i2c, msg, 2); | ||
227 | |||
228 | if (ret != 2) | ||
229 | printk(KERN_ERR "%s: readreg error (ret == %i)\n", | ||
230 | __func__, ret); | ||
231 | |||
232 | return b1[0]; | ||
233 | } | ||
234 | |||
235 | static int tda10048_writeregbulk(struct tda10048_state *state, u8 reg, | ||
236 | u8 *data, u16 len) | ||
237 | { | ||
238 | int ret = -EREMOTEIO; | ||
239 | struct i2c_msg msg; | ||
240 | u8 *buf; | ||
241 | |||
242 | dprintk(2, "%s(%d, ?, len = %d)\n", __func__, reg, len); | ||
243 | |||
244 | buf = kmalloc(len + 1, GFP_KERNEL); | ||
245 | if (buf == NULL) { | ||
246 | ret = -ENOMEM; | ||
247 | goto error; | ||
248 | } | ||
249 | |||
250 | *buf = reg; | ||
251 | memcpy(buf + 1, data, len); | ||
252 | |||
253 | msg.addr = state->config->demod_address; | ||
254 | msg.flags = 0; | ||
255 | msg.buf = buf; | ||
256 | msg.len = len + 1; | ||
257 | |||
258 | dprintk(2, "%s(): write len = %d\n", | ||
259 | __func__, msg.len); | ||
260 | |||
261 | ret = i2c_transfer(state->i2c, &msg, 1); | ||
262 | if (ret != 1) { | ||
263 | printk(KERN_ERR "%s(): writereg error err %i\n", | ||
264 | __func__, ret); | ||
265 | ret = -EREMOTEIO; | ||
266 | } | ||
267 | |||
268 | error: | ||
269 | kfree(buf); | ||
270 | |||
271 | return ret; | ||
272 | } | ||
273 | |||
274 | static int tda10048_firmware_upload(struct dvb_frontend *fe) | ||
275 | { | ||
276 | struct tda10048_state *state = fe->demodulator_priv; | ||
277 | const struct firmware *fw; | ||
278 | int ret; | ||
279 | int pos = 0; | ||
280 | int cnt; | ||
281 | u8 wlen = state->config->fwbulkwritelen; | ||
282 | |||
283 | if ((wlen != TDA10048_BULKWRITE_200) && (wlen != TDA10048_BULKWRITE_50)) | ||
284 | wlen = TDA10048_BULKWRITE_200; | ||
285 | |||
286 | /* request the firmware, this will block and timeout */ | ||
287 | printk(KERN_INFO "%s: waiting for firmware upload (%s)...\n", | ||
288 | __func__, | ||
289 | TDA10048_DEFAULT_FIRMWARE); | ||
290 | |||
291 | ret = request_firmware(&fw, TDA10048_DEFAULT_FIRMWARE, | ||
292 | &state->i2c->dev); | ||
293 | if (ret) { | ||
294 | printk(KERN_ERR "%s: Upload failed. (file not found?)\n", | ||
295 | __func__); | ||
296 | return -EIO; | ||
297 | } else { | ||
298 | printk(KERN_INFO "%s: firmware read %Zu bytes.\n", | ||
299 | __func__, | ||
300 | fw->size); | ||
301 | ret = 0; | ||
302 | } | ||
303 | |||
304 | if (fw->size != TDA10048_DEFAULT_FIRMWARE_SIZE) { | ||
305 | printk(KERN_ERR "%s: firmware incorrect size\n", __func__); | ||
306 | return -EIO; | ||
307 | } else { | ||
308 | printk(KERN_INFO "%s: firmware uploading\n", __func__); | ||
309 | |||
310 | /* Soft reset */ | ||
311 | tda10048_writereg(state, TDA10048_CONF_TRISTATE1, | ||
312 | tda10048_readreg(state, TDA10048_CONF_TRISTATE1) | ||
313 | & 0xfe); | ||
314 | tda10048_writereg(state, TDA10048_CONF_TRISTATE1, | ||
315 | tda10048_readreg(state, TDA10048_CONF_TRISTATE1) | ||
316 | | 0x01); | ||
317 | |||
318 | /* Put the demod into host download mode */ | ||
319 | tda10048_writereg(state, TDA10048_CONF_C4_1, | ||
320 | tda10048_readreg(state, TDA10048_CONF_C4_1) & 0xf9); | ||
321 | |||
322 | /* Boot the DSP */ | ||
323 | tda10048_writereg(state, TDA10048_CONF_C4_1, | ||
324 | tda10048_readreg(state, TDA10048_CONF_C4_1) | 0x08); | ||
325 | |||
326 | /* Prepare for download */ | ||
327 | tda10048_writereg(state, TDA10048_DSP_CODE_CPT, 0); | ||
328 | |||
329 | /* Download the firmware payload */ | ||
330 | while (pos < fw->size) { | ||
331 | |||
332 | if ((fw->size - pos) > wlen) | ||
333 | cnt = wlen; | ||
334 | else | ||
335 | cnt = fw->size - pos; | ||
336 | |||
337 | tda10048_writeregbulk(state, TDA10048_DSP_CODE_IN, | ||
338 | &fw->data[pos], cnt); | ||
339 | |||
340 | pos += cnt; | ||
341 | } | ||
342 | |||
343 | ret = -EIO; | ||
344 | /* Wait up to 250ms for the DSP to boot */ | ||
345 | for (cnt = 0; cnt < 250 ; cnt += 10) { | ||
346 | |||
347 | msleep(10); | ||
348 | |||
349 | if (tda10048_readreg(state, TDA10048_SYNC_STATUS) | ||
350 | & 0x40) { | ||
351 | ret = 0; | ||
352 | break; | ||
353 | } | ||
354 | } | ||
355 | } | ||
356 | |||
357 | release_firmware(fw); | ||
358 | |||
359 | if (ret == 0) { | ||
360 | printk(KERN_INFO "%s: firmware uploaded\n", __func__); | ||
361 | state->fwloaded = 1; | ||
362 | } else | ||
363 | printk(KERN_ERR "%s: firmware upload failed\n", __func__); | ||
364 | |||
365 | return ret; | ||
366 | } | ||
367 | |||
368 | static int tda10048_set_inversion(struct dvb_frontend *fe, int inversion) | ||
369 | { | ||
370 | struct tda10048_state *state = fe->demodulator_priv; | ||
371 | |||
372 | dprintk(1, "%s(%d)\n", __func__, inversion); | ||
373 | |||
374 | if (inversion == TDA10048_INVERSION_ON) | ||
375 | tda10048_writereg(state, TDA10048_CONF_C1_1, | ||
376 | tda10048_readreg(state, TDA10048_CONF_C1_1) | 0x20); | ||
377 | else | ||
378 | tda10048_writereg(state, TDA10048_CONF_C1_1, | ||
379 | tda10048_readreg(state, TDA10048_CONF_C1_1) & 0xdf); | ||
380 | |||
381 | return 0; | ||
382 | } | ||
383 | |||
384 | /* Retrieve the demod settings */ | ||
385 | static int tda10048_get_tps(struct tda10048_state *state, | ||
386 | struct dvb_ofdm_parameters *p) | ||
387 | { | ||
388 | u8 val; | ||
389 | |||
390 | /* Make sure the TPS regs are valid */ | ||
391 | if (!(tda10048_readreg(state, TDA10048_AUTO) & 0x01)) | ||
392 | return -EAGAIN; | ||
393 | |||
394 | val = tda10048_readreg(state, TDA10048_OUT_CONF2); | ||
395 | switch ((val & 0x60) >> 5) { | ||
396 | case 0: p->constellation = QPSK; break; | ||
397 | case 1: p->constellation = QAM_16; break; | ||
398 | case 2: p->constellation = QAM_64; break; | ||
399 | } | ||
400 | switch ((val & 0x18) >> 3) { | ||
401 | case 0: p->hierarchy_information = HIERARCHY_NONE; break; | ||
402 | case 1: p->hierarchy_information = HIERARCHY_1; break; | ||
403 | case 2: p->hierarchy_information = HIERARCHY_2; break; | ||
404 | case 3: p->hierarchy_information = HIERARCHY_4; break; | ||
405 | } | ||
406 | switch (val & 0x07) { | ||
407 | case 0: p->code_rate_HP = FEC_1_2; break; | ||
408 | case 1: p->code_rate_HP = FEC_2_3; break; | ||
409 | case 2: p->code_rate_HP = FEC_3_4; break; | ||
410 | case 3: p->code_rate_HP = FEC_5_6; break; | ||
411 | case 4: p->code_rate_HP = FEC_7_8; break; | ||
412 | } | ||
413 | |||
414 | val = tda10048_readreg(state, TDA10048_OUT_CONF3); | ||
415 | switch (val & 0x07) { | ||
416 | case 0: p->code_rate_LP = FEC_1_2; break; | ||
417 | case 1: p->code_rate_LP = FEC_2_3; break; | ||
418 | case 2: p->code_rate_LP = FEC_3_4; break; | ||
419 | case 3: p->code_rate_LP = FEC_5_6; break; | ||
420 | case 4: p->code_rate_LP = FEC_7_8; break; | ||
421 | } | ||
422 | |||
423 | val = tda10048_readreg(state, TDA10048_OUT_CONF1); | ||
424 | switch ((val & 0x0c) >> 2) { | ||
425 | case 0: p->guard_interval = GUARD_INTERVAL_1_32; break; | ||
426 | case 1: p->guard_interval = GUARD_INTERVAL_1_16; break; | ||
427 | case 2: p->guard_interval = GUARD_INTERVAL_1_8; break; | ||
428 | case 3: p->guard_interval = GUARD_INTERVAL_1_4; break; | ||
429 | } | ||
430 | switch (val & 0x02) { | ||
431 | case 0: p->transmission_mode = TRANSMISSION_MODE_2K; break; | ||
432 | case 1: p->transmission_mode = TRANSMISSION_MODE_8K; break; | ||
433 | } | ||
434 | |||
435 | return 0; | ||
436 | } | ||
437 | |||
438 | static int tda10048_i2c_gate_ctrl(struct dvb_frontend *fe, int enable) | ||
439 | { | ||
440 | struct tda10048_state *state = fe->demodulator_priv; | ||
441 | dprintk(1, "%s(%d)\n", __func__, enable); | ||
442 | |||
443 | if (enable) | ||
444 | return tda10048_writereg(state, TDA10048_CONF_C4_1, | ||
445 | tda10048_readreg(state, TDA10048_CONF_C4_1) | 0x02); | ||
446 | else | ||
447 | return tda10048_writereg(state, TDA10048_CONF_C4_1, | ||
448 | tda10048_readreg(state, TDA10048_CONF_C4_1) & 0xfd); | ||
449 | } | ||
450 | |||
451 | static int tda10048_output_mode(struct dvb_frontend *fe, int serial) | ||
452 | { | ||
453 | struct tda10048_state *state = fe->demodulator_priv; | ||
454 | dprintk(1, "%s(%d)\n", __func__, serial); | ||
455 | |||
456 | /* Ensure pins are out of tri-state */ | ||
457 | tda10048_writereg(state, TDA10048_CONF_TRISTATE1, 0x21); | ||
458 | tda10048_writereg(state, TDA10048_CONF_TRISTATE2, 0x00); | ||
459 | |||
460 | if (serial) { | ||
461 | tda10048_writereg(state, TDA10048_IC_MODE, 0x80 | 0x20); | ||
462 | tda10048_writereg(state, TDA10048_CONF_TS2, 0xc0); | ||
463 | } else { | ||
464 | tda10048_writereg(state, TDA10048_IC_MODE, 0x00); | ||
465 | tda10048_writereg(state, TDA10048_CONF_TS2, 0x01); | ||
466 | } | ||
467 | |||
468 | return 0; | ||
469 | } | ||
470 | |||
471 | /* Talk to the demod, set the FEC, GUARD, QAM settings etc */ | ||
472 | /* TODO: Support manual tuning with specific params */ | ||
473 | static int tda10048_set_frontend(struct dvb_frontend *fe, | ||
474 | struct dvb_frontend_parameters *p) | ||
475 | { | ||
476 | struct tda10048_state *state = fe->demodulator_priv; | ||
477 | |||
478 | dprintk(1, "%s(frequency=%d)\n", __func__, p->frequency); | ||
479 | |||
480 | if (fe->ops.tuner_ops.set_params) { | ||
481 | |||
482 | if (fe->ops.i2c_gate_ctrl) | ||
483 | fe->ops.i2c_gate_ctrl(fe, 1); | ||
484 | |||
485 | fe->ops.tuner_ops.set_params(fe, p); | ||
486 | |||
487 | if (fe->ops.i2c_gate_ctrl) | ||
488 | fe->ops.i2c_gate_ctrl(fe, 0); | ||
489 | } | ||
490 | |||
491 | /* Enable demod TPS auto detection and begin acquisition */ | ||
492 | tda10048_writereg(state, TDA10048_AUTO, 0x57); | ||
493 | |||
494 | return 0; | ||
495 | } | ||
496 | |||
497 | /* Establish sane defaults and load firmware. */ | ||
498 | static int tda10048_init(struct dvb_frontend *fe) | ||
499 | { | ||
500 | struct tda10048_state *state = fe->demodulator_priv; | ||
501 | int ret = 0, i; | ||
502 | |||
503 | dprintk(1, "%s()\n", __func__); | ||
504 | |||
505 | /* Apply register defaults */ | ||
506 | for (i = 0; i < ARRAY_SIZE(init_tab); i++) | ||
507 | tda10048_writereg(state, init_tab[i].reg, init_tab[i].data); | ||
508 | |||
509 | if (state->fwloaded == 0) | ||
510 | ret = tda10048_firmware_upload(fe); | ||
511 | |||
512 | /* Set either serial or parallel */ | ||
513 | tda10048_output_mode(fe, state->config->output_mode); | ||
514 | |||
515 | /* set inversion */ | ||
516 | tda10048_set_inversion(fe, state->config->inversion); | ||
517 | |||
518 | /* Ensure we leave the gate closed */ | ||
519 | tda10048_i2c_gate_ctrl(fe, 0); | ||
520 | |||
521 | return ret; | ||
522 | } | ||
523 | |||
524 | static int tda10048_read_status(struct dvb_frontend *fe, fe_status_t *status) | ||
525 | { | ||
526 | struct tda10048_state *state = fe->demodulator_priv; | ||
527 | u8 reg; | ||
528 | |||
529 | *status = 0; | ||
530 | |||
531 | reg = tda10048_readreg(state, TDA10048_SYNC_STATUS); | ||
532 | |||
533 | dprintk(1, "%s() status =0x%02x\n", __func__, reg); | ||
534 | |||
535 | if (reg & 0x02) | ||
536 | *status |= FE_HAS_CARRIER; | ||
537 | |||
538 | if (reg & 0x04) | ||
539 | *status |= FE_HAS_SIGNAL; | ||
540 | |||
541 | if (reg & 0x08) { | ||
542 | *status |= FE_HAS_LOCK; | ||
543 | *status |= FE_HAS_VITERBI; | ||
544 | *status |= FE_HAS_SYNC; | ||
545 | } | ||
546 | |||
547 | return 0; | ||
548 | } | ||
549 | |||
550 | static int tda10048_read_ber(struct dvb_frontend *fe, u32 *ber) | ||
551 | { | ||
552 | struct tda10048_state *state = fe->demodulator_priv; | ||
553 | |||
554 | dprintk(1, "%s()\n", __func__); | ||
555 | |||
556 | /* TODO: A reset may be required here */ | ||
557 | *ber = tda10048_readreg(state, TDA10048_CBER_MSB) << 8 | | ||
558 | tda10048_readreg(state, TDA10048_CBER_LSB); | ||
559 | |||
560 | return 0; | ||
561 | } | ||
562 | |||
563 | static int tda10048_read_signal_strength(struct dvb_frontend *fe, | ||
564 | u16 *signal_strength) | ||
565 | { | ||
566 | struct tda10048_state *state = fe->demodulator_priv; | ||
567 | u8 v; | ||
568 | |||
569 | dprintk(1, "%s()\n", __func__); | ||
570 | |||
571 | *signal_strength = 65535; | ||
572 | |||
573 | v = tda10048_readreg(state, TDA10048_NP_OUT); | ||
574 | if (v > 0) | ||
575 | *signal_strength -= (v << 8) | v; | ||
576 | |||
577 | return 0; | ||
578 | } | ||
579 | |||
580 | /* SNR lookup table */ | ||
581 | static struct snr_tab { | ||
582 | u8 val; | ||
583 | u8 data; | ||
584 | } snr_tab[] = { | ||
585 | { 0, 0 }, | ||
586 | { 1, 246 }, | ||
587 | { 2, 215 }, | ||
588 | { 3, 198 }, | ||
589 | { 4, 185 }, | ||
590 | { 5, 176 }, | ||
591 | { 6, 168 }, | ||
592 | { 7, 161 }, | ||
593 | { 8, 155 }, | ||
594 | { 9, 150 }, | ||
595 | { 10, 146 }, | ||
596 | { 11, 141 }, | ||
597 | { 12, 138 }, | ||
598 | { 13, 134 }, | ||
599 | { 14, 131 }, | ||
600 | { 15, 128 }, | ||
601 | { 16, 125 }, | ||
602 | { 17, 122 }, | ||
603 | { 18, 120 }, | ||
604 | { 19, 118 }, | ||
605 | { 20, 115 }, | ||
606 | { 21, 113 }, | ||
607 | { 22, 111 }, | ||
608 | { 23, 109 }, | ||
609 | { 24, 107 }, | ||
610 | { 25, 106 }, | ||
611 | { 26, 104 }, | ||
612 | { 27, 102 }, | ||
613 | { 28, 101 }, | ||
614 | { 29, 99 }, | ||
615 | { 30, 98 }, | ||
616 | { 31, 96 }, | ||
617 | { 32, 95 }, | ||
618 | { 33, 94 }, | ||
619 | { 34, 92 }, | ||
620 | { 35, 91 }, | ||
621 | { 36, 90 }, | ||
622 | { 37, 89 }, | ||
623 | { 38, 88 }, | ||
624 | { 39, 86 }, | ||
625 | { 40, 85 }, | ||
626 | { 41, 84 }, | ||
627 | { 42, 83 }, | ||
628 | { 43, 82 }, | ||
629 | { 44, 81 }, | ||
630 | { 45, 80 }, | ||
631 | { 46, 79 }, | ||
632 | { 47, 78 }, | ||
633 | { 48, 77 }, | ||
634 | { 49, 76 }, | ||
635 | { 50, 76 }, | ||
636 | { 51, 75 }, | ||
637 | { 52, 74 }, | ||
638 | { 53, 73 }, | ||
639 | { 54, 72 }, | ||
640 | { 56, 71 }, | ||
641 | { 57, 70 }, | ||
642 | { 58, 69 }, | ||
643 | { 60, 68 }, | ||
644 | { 61, 67 }, | ||
645 | { 63, 66 }, | ||
646 | { 64, 65 }, | ||
647 | { 66, 64 }, | ||
648 | { 67, 63 }, | ||
649 | { 68, 62 }, | ||
650 | { 69, 62 }, | ||
651 | { 70, 61 }, | ||
652 | { 72, 60 }, | ||
653 | { 74, 59 }, | ||
654 | { 75, 58 }, | ||
655 | { 77, 57 }, | ||
656 | { 79, 56 }, | ||
657 | { 81, 55 }, | ||
658 | { 83, 54 }, | ||
659 | { 85, 53 }, | ||
660 | { 87, 52 }, | ||
661 | { 89, 51 }, | ||
662 | { 91, 50 }, | ||
663 | { 93, 49 }, | ||
664 | { 95, 48 }, | ||
665 | { 97, 47 }, | ||
666 | { 100, 46 }, | ||
667 | { 102, 45 }, | ||
668 | { 104, 44 }, | ||
669 | { 107, 43 }, | ||
670 | { 109, 42 }, | ||
671 | { 112, 41 }, | ||
672 | { 114, 40 }, | ||
673 | { 117, 39 }, | ||
674 | { 120, 38 }, | ||
675 | { 123, 37 }, | ||
676 | { 125, 36 }, | ||
677 | { 128, 35 }, | ||
678 | { 131, 34 }, | ||
679 | { 134, 33 }, | ||
680 | { 138, 32 }, | ||
681 | { 141, 31 }, | ||
682 | { 144, 30 }, | ||
683 | { 147, 29 }, | ||
684 | { 151, 28 }, | ||
685 | { 154, 27 }, | ||
686 | { 158, 26 }, | ||
687 | { 162, 25 }, | ||
688 | { 165, 24 }, | ||
689 | { 169, 23 }, | ||
690 | { 173, 22 }, | ||
691 | { 177, 21 }, | ||
692 | { 181, 20 }, | ||
693 | { 186, 19 }, | ||
694 | { 190, 18 }, | ||
695 | { 194, 17 }, | ||
696 | { 199, 16 }, | ||
697 | { 204, 15 }, | ||
698 | { 208, 14 }, | ||
699 | { 213, 13 }, | ||
700 | { 218, 12 }, | ||
701 | { 223, 11 }, | ||
702 | { 229, 10 }, | ||
703 | { 234, 9 }, | ||
704 | { 239, 8 }, | ||
705 | { 245, 7 }, | ||
706 | { 251, 6 }, | ||
707 | { 255, 5 }, | ||
708 | }; | ||
709 | |||
710 | static int tda10048_read_snr(struct dvb_frontend *fe, u16 *snr) | ||
711 | { | ||
712 | struct tda10048_state *state = fe->demodulator_priv; | ||
713 | u8 v; | ||
714 | int i, ret = -EINVAL; | ||
715 | |||
716 | dprintk(1, "%s()\n", __func__); | ||
717 | |||
718 | v = tda10048_readreg(state, TDA10048_NP_OUT); | ||
719 | for (i = 0; i < ARRAY_SIZE(snr_tab); i++) { | ||
720 | if (v <= snr_tab[i].val) { | ||
721 | *snr = snr_tab[i].data; | ||
722 | ret = 0; | ||
723 | break; | ||
724 | } | ||
725 | } | ||
726 | |||
727 | return ret; | ||
728 | } | ||
729 | |||
730 | static int tda10048_read_ucblocks(struct dvb_frontend *fe, u32 *ucblocks) | ||
731 | { | ||
732 | struct tda10048_state *state = fe->demodulator_priv; | ||
733 | |||
734 | dprintk(1, "%s()\n", __func__); | ||
735 | |||
736 | *ucblocks = tda10048_readreg(state, TDA10048_UNCOR_CPT_MSB) << 8 | | ||
737 | tda10048_readreg(state, TDA10048_UNCOR_CPT_LSB); | ||
738 | |||
739 | return 0; | ||
740 | } | ||
741 | |||
742 | static int tda10048_get_frontend(struct dvb_frontend *fe, | ||
743 | struct dvb_frontend_parameters *p) | ||
744 | { | ||
745 | struct tda10048_state *state = fe->demodulator_priv; | ||
746 | |||
747 | dprintk(1, "%s()\n", __func__); | ||
748 | |||
749 | p->inversion = tda10048_readreg(state, TDA10048_CONF_C1_1) | ||
750 | & 0x20 ? INVERSION_ON : INVERSION_OFF; | ||
751 | |||
752 | return tda10048_get_tps(state, &p->u.ofdm); | ||
753 | } | ||
754 | |||
755 | static int tda10048_get_tune_settings(struct dvb_frontend *fe, | ||
756 | struct dvb_frontend_tune_settings *tune) | ||
757 | { | ||
758 | tune->min_delay_ms = 1000; | ||
759 | return 0; | ||
760 | } | ||
761 | |||
762 | static void tda10048_release(struct dvb_frontend *fe) | ||
763 | { | ||
764 | struct tda10048_state *state = fe->demodulator_priv; | ||
765 | dprintk(1, "%s()\n", __func__); | ||
766 | kfree(state); | ||
767 | } | ||
768 | |||
769 | static struct dvb_frontend_ops tda10048_ops; | ||
770 | |||
771 | struct dvb_frontend *tda10048_attach(const struct tda10048_config *config, | ||
772 | struct i2c_adapter *i2c) | ||
773 | { | ||
774 | struct tda10048_state *state = NULL; | ||
775 | |||
776 | dprintk(1, "%s()\n", __func__); | ||
777 | |||
778 | /* allocate memory for the internal state */ | ||
779 | state = kmalloc(sizeof(struct tda10048_state), GFP_KERNEL); | ||
780 | if (state == NULL) | ||
781 | goto error; | ||
782 | |||
783 | /* setup the state */ | ||
784 | state->config = config; | ||
785 | state->i2c = i2c; | ||
786 | state->fwloaded = 0; | ||
787 | |||
788 | /* check if the demod is present */ | ||
789 | if (tda10048_readreg(state, TDA10048_IDENTITY) != 0x048) | ||
790 | goto error; | ||
791 | |||
792 | /* create dvb_frontend */ | ||
793 | memcpy(&state->frontend.ops, &tda10048_ops, | ||
794 | sizeof(struct dvb_frontend_ops)); | ||
795 | state->frontend.demodulator_priv = state; | ||
796 | |||
797 | /* Leave the gate closed */ | ||
798 | tda10048_i2c_gate_ctrl(&state->frontend, 0); | ||
799 | |||
800 | return &state->frontend; | ||
801 | |||
802 | error: | ||
803 | kfree(state); | ||
804 | return NULL; | ||
805 | } | ||
806 | EXPORT_SYMBOL(tda10048_attach); | ||
807 | |||
808 | static struct dvb_frontend_ops tda10048_ops = { | ||
809 | |||
810 | .info = { | ||
811 | .name = "NXP TDA10048HN DVB-T", | ||
812 | .type = FE_OFDM, | ||
813 | .frequency_min = 177000000, | ||
814 | .frequency_max = 858000000, | ||
815 | .frequency_stepsize = 166666, | ||
816 | .caps = FE_CAN_FEC_1_2 | FE_CAN_FEC_2_3 | FE_CAN_FEC_3_4 | | ||
817 | FE_CAN_FEC_5_6 | FE_CAN_FEC_7_8 | FE_CAN_FEC_AUTO | | ||
818 | FE_CAN_QPSK | FE_CAN_QAM_16 | FE_CAN_QAM_64 | FE_CAN_QAM_AUTO | | ||
819 | FE_CAN_HIERARCHY_AUTO | FE_CAN_GUARD_INTERVAL_AUTO | | ||
820 | FE_CAN_TRANSMISSION_MODE_AUTO | FE_CAN_RECOVER | ||
821 | }, | ||
822 | |||
823 | .release = tda10048_release, | ||
824 | .init = tda10048_init, | ||
825 | .i2c_gate_ctrl = tda10048_i2c_gate_ctrl, | ||
826 | .set_frontend = tda10048_set_frontend, | ||
827 | .get_frontend = tda10048_get_frontend, | ||
828 | .get_tune_settings = tda10048_get_tune_settings, | ||
829 | .read_status = tda10048_read_status, | ||
830 | .read_ber = tda10048_read_ber, | ||
831 | .read_signal_strength = tda10048_read_signal_strength, | ||
832 | .read_snr = tda10048_read_snr, | ||
833 | .read_ucblocks = tda10048_read_ucblocks, | ||
834 | }; | ||
835 | |||
836 | module_param(debug, int, 0644); | ||
837 | MODULE_PARM_DESC(debug, "Enable verbose debug messages"); | ||
838 | |||
839 | MODULE_DESCRIPTION("NXP TDA10048HN DVB-T Demodulator driver"); | ||
840 | MODULE_AUTHOR("Steven Toth"); | ||
841 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/media/dvb/frontends/tda10048.h b/drivers/media/dvb/frontends/tda10048.h new file mode 100644 index 000000000000..2b5c78e62c86 --- /dev/null +++ b/drivers/media/dvb/frontends/tda10048.h | |||
@@ -0,0 +1,63 @@ | |||
1 | /* | ||
2 | NXP TDA10048HN DVB OFDM demodulator driver | ||
3 | |||
4 | Copyright (C) 2008 Steven Toth <stoth@hauppauge.com> | ||
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 | GNU General Public License for more details. | ||
15 | |||
16 | You should have received a copy of the GNU General Public License | ||
17 | along with this program; if not, write to the Free Software | ||
18 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
19 | |||
20 | */ | ||
21 | |||
22 | #ifndef TDA10048_H | ||
23 | #define TDA10048_H | ||
24 | |||
25 | #include <linux/dvb/frontend.h> | ||
26 | #include <linux/firmware.h> | ||
27 | |||
28 | struct tda10048_config { | ||
29 | |||
30 | /* the demodulator's i2c address */ | ||
31 | u8 demod_address; | ||
32 | |||
33 | /* serial/parallel output */ | ||
34 | #define TDA10048_PARALLEL_OUTPUT 0 | ||
35 | #define TDA10048_SERIAL_OUTPUT 1 | ||
36 | u8 output_mode; | ||
37 | |||
38 | #define TDA10048_BULKWRITE_200 200 | ||
39 | #define TDA10048_BULKWRITE_50 50 | ||
40 | u8 fwbulkwritelen; | ||
41 | |||
42 | /* Spectral Inversion */ | ||
43 | #define TDA10048_INVERSION_OFF 0 | ||
44 | #define TDA10048_INVERSION_ON 1 | ||
45 | u8 inversion; | ||
46 | }; | ||
47 | |||
48 | #if defined(CONFIG_DVB_TDA10048) || \ | ||
49 | (defined(CONFIG_DVB_TDA10048_MODULE) && defined(MODULE)) | ||
50 | extern struct dvb_frontend *tda10048_attach( | ||
51 | const struct tda10048_config *config, | ||
52 | struct i2c_adapter *i2c); | ||
53 | #else | ||
54 | static inline struct dvb_frontend *tda10048_attach( | ||
55 | const struct tda10048_config *config, | ||
56 | struct i2c_adapter *i2c) | ||
57 | { | ||
58 | printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__); | ||
59 | return NULL; | ||
60 | } | ||
61 | #endif /* CONFIG_DVB_TDA10048 */ | ||
62 | |||
63 | #endif /* TDA10048_H */ | ||
diff --git a/drivers/media/dvb/frontends/tda1004x.c b/drivers/media/dvb/frontends/tda1004x.c index 8415a8a5247a..49973846373e 100644 --- a/drivers/media/dvb/frontends/tda1004x.c +++ b/drivers/media/dvb/frontends/tda1004x.c | |||
@@ -131,16 +131,16 @@ static int tda1004x_write_byteI(struct tda1004x_state *state, int reg, int data) | |||
131 | u8 buf[] = { reg, data }; | 131 | u8 buf[] = { reg, data }; |
132 | struct i2c_msg msg = { .flags = 0, .buf = buf, .len = 2 }; | 132 | struct i2c_msg msg = { .flags = 0, .buf = buf, .len = 2 }; |
133 | 133 | ||
134 | dprintk("%s: reg=0x%x, data=0x%x\n", __FUNCTION__, reg, data); | 134 | dprintk("%s: reg=0x%x, data=0x%x\n", __func__, reg, data); |
135 | 135 | ||
136 | msg.addr = state->config->demod_address; | 136 | msg.addr = state->config->demod_address; |
137 | ret = i2c_transfer(state->i2c, &msg, 1); | 137 | ret = i2c_transfer(state->i2c, &msg, 1); |
138 | 138 | ||
139 | if (ret != 1) | 139 | if (ret != 1) |
140 | dprintk("%s: error reg=0x%x, data=0x%x, ret=%i\n", | 140 | dprintk("%s: error reg=0x%x, data=0x%x, ret=%i\n", |
141 | __FUNCTION__, reg, data, ret); | 141 | __func__, reg, data, ret); |
142 | 142 | ||
143 | dprintk("%s: success reg=0x%x, data=0x%x, ret=%i\n", __FUNCTION__, | 143 | dprintk("%s: success reg=0x%x, data=0x%x, ret=%i\n", __func__, |
144 | reg, data, ret); | 144 | reg, data, ret); |
145 | return (ret != 1) ? -1 : 0; | 145 | return (ret != 1) ? -1 : 0; |
146 | } | 146 | } |
@@ -153,19 +153,19 @@ static int tda1004x_read_byte(struct tda1004x_state *state, int reg) | |||
153 | struct i2c_msg msg[] = {{ .flags = 0, .buf = b0, .len = 1 }, | 153 | struct i2c_msg msg[] = {{ .flags = 0, .buf = b0, .len = 1 }, |
154 | { .flags = I2C_M_RD, .buf = b1, .len = 1 }}; | 154 | { .flags = I2C_M_RD, .buf = b1, .len = 1 }}; |
155 | 155 | ||
156 | dprintk("%s: reg=0x%x\n", __FUNCTION__, reg); | 156 | dprintk("%s: reg=0x%x\n", __func__, reg); |
157 | 157 | ||
158 | msg[0].addr = state->config->demod_address; | 158 | msg[0].addr = state->config->demod_address; |
159 | msg[1].addr = state->config->demod_address; | 159 | msg[1].addr = state->config->demod_address; |
160 | ret = i2c_transfer(state->i2c, msg, 2); | 160 | ret = i2c_transfer(state->i2c, msg, 2); |
161 | 161 | ||
162 | if (ret != 2) { | 162 | if (ret != 2) { |
163 | dprintk("%s: error reg=0x%x, ret=%i\n", __FUNCTION__, reg, | 163 | dprintk("%s: error reg=0x%x, ret=%i\n", __func__, reg, |
164 | ret); | 164 | ret); |
165 | return -1; | 165 | return -1; |
166 | } | 166 | } |
167 | 167 | ||
168 | dprintk("%s: success reg=0x%x, data=0x%x, ret=%i\n", __FUNCTION__, | 168 | dprintk("%s: success reg=0x%x, data=0x%x, ret=%i\n", __func__, |
169 | reg, b1[0], ret); | 169 | reg, b1[0], ret); |
170 | return b1[0]; | 170 | return b1[0]; |
171 | } | 171 | } |
@@ -173,7 +173,7 @@ static int tda1004x_read_byte(struct tda1004x_state *state, int reg) | |||
173 | static int tda1004x_write_mask(struct tda1004x_state *state, int reg, int mask, int data) | 173 | static int tda1004x_write_mask(struct tda1004x_state *state, int reg, int mask, int data) |
174 | { | 174 | { |
175 | int val; | 175 | int val; |
176 | dprintk("%s: reg=0x%x, mask=0x%x, data=0x%x\n", __FUNCTION__, reg, | 176 | dprintk("%s: reg=0x%x, mask=0x%x, data=0x%x\n", __func__, reg, |
177 | mask, data); | 177 | mask, data); |
178 | 178 | ||
179 | // read a byte and check | 179 | // read a byte and check |
@@ -194,7 +194,7 @@ static int tda1004x_write_buf(struct tda1004x_state *state, int reg, unsigned ch | |||
194 | int i; | 194 | int i; |
195 | int result; | 195 | int result; |
196 | 196 | ||
197 | dprintk("%s: reg=0x%x, len=0x%x\n", __FUNCTION__, reg, len); | 197 | dprintk("%s: reg=0x%x, len=0x%x\n", __func__, reg, len); |
198 | 198 | ||
199 | result = 0; | 199 | result = 0; |
200 | for (i = 0; i < len; i++) { | 200 | for (i = 0; i < len; i++) { |
@@ -209,7 +209,7 @@ static int tda1004x_write_buf(struct tda1004x_state *state, int reg, unsigned ch | |||
209 | static int tda1004x_enable_tuner_i2c(struct tda1004x_state *state) | 209 | static int tda1004x_enable_tuner_i2c(struct tda1004x_state *state) |
210 | { | 210 | { |
211 | int result; | 211 | int result; |
212 | dprintk("%s\n", __FUNCTION__); | 212 | dprintk("%s\n", __func__); |
213 | 213 | ||
214 | result = tda1004x_write_mask(state, TDA1004X_CONFC4, 2, 2); | 214 | result = tda1004x_write_mask(state, TDA1004X_CONFC4, 2, 2); |
215 | msleep(20); | 215 | msleep(20); |
@@ -218,7 +218,7 @@ static int tda1004x_enable_tuner_i2c(struct tda1004x_state *state) | |||
218 | 218 | ||
219 | static int tda1004x_disable_tuner_i2c(struct tda1004x_state *state) | 219 | static int tda1004x_disable_tuner_i2c(struct tda1004x_state *state) |
220 | { | 220 | { |
221 | dprintk("%s\n", __FUNCTION__); | 221 | dprintk("%s\n", __func__); |
222 | 222 | ||
223 | return tda1004x_write_mask(state, TDA1004X_CONFC4, 2, 0); | 223 | return tda1004x_write_mask(state, TDA1004X_CONFC4, 2, 0); |
224 | } | 224 | } |
@@ -345,7 +345,7 @@ static int tda1004x_do_upload(struct tda1004x_state *state, | |||
345 | } | 345 | } |
346 | pos += tx_size; | 346 | pos += tx_size; |
347 | 347 | ||
348 | dprintk("%s: fw_pos=0x%x\n", __FUNCTION__, pos); | 348 | dprintk("%s: fw_pos=0x%x\n", __func__, pos); |
349 | } | 349 | } |
350 | // give the DSP a chance to settle 03/10/05 Hac | 350 | // give the DSP a chance to settle 03/10/05 Hac |
351 | msleep(100); | 351 | msleep(100); |
@@ -444,10 +444,10 @@ static void tda10046_init_plls(struct dvb_frontend* fe) | |||
444 | tda1004x_write_byteI(state, TDA10046H_CONFPLL2, 0x03); // PLL M = 3 | 444 | tda1004x_write_byteI(state, TDA10046H_CONFPLL2, 0x03); // PLL M = 3 |
445 | } | 445 | } |
446 | if (state->config->xtal_freq == TDA10046_XTAL_4M ) { | 446 | if (state->config->xtal_freq == TDA10046_XTAL_4M ) { |
447 | dprintk("%s: setting up PLLs for a 4 MHz Xtal\n", __FUNCTION__); | 447 | dprintk("%s: setting up PLLs for a 4 MHz Xtal\n", __func__); |
448 | tda1004x_write_byteI(state, TDA10046H_CONFPLL3, 0); // PLL P = N = 0 | 448 | tda1004x_write_byteI(state, TDA10046H_CONFPLL3, 0); // PLL P = N = 0 |
449 | } else { | 449 | } else { |
450 | dprintk("%s: setting up PLLs for a 16 MHz Xtal\n", __FUNCTION__); | 450 | dprintk("%s: setting up PLLs for a 16 MHz Xtal\n", __func__); |
451 | tda1004x_write_byteI(state, TDA10046H_CONFPLL3, 3); // PLL P = 0, N = 3 | 451 | tda1004x_write_byteI(state, TDA10046H_CONFPLL3, 3); // PLL P = 0, N = 3 |
452 | } | 452 | } |
453 | if(tda10046_clk53m) | 453 | if(tda10046_clk53m) |
@@ -488,7 +488,7 @@ static int tda10046_fwupload(struct dvb_frontend* fe) | |||
488 | if (state->config->xtal_freq == TDA10046_XTAL_4M) { | 488 | if (state->config->xtal_freq == TDA10046_XTAL_4M) { |
489 | tda1004x_write_byteI(state, TDA1004X_CONFC4, 0); | 489 | tda1004x_write_byteI(state, TDA1004X_CONFC4, 0); |
490 | } else { | 490 | } else { |
491 | dprintk("%s: 16MHz Xtal, reducing I2C speed\n", __FUNCTION__); | 491 | dprintk("%s: 16MHz Xtal, reducing I2C speed\n", __func__); |
492 | tda1004x_write_byteI(state, TDA1004X_CONFC4, 0x80); | 492 | tda1004x_write_byteI(state, TDA1004X_CONFC4, 0x80); |
493 | } | 493 | } |
494 | tda1004x_write_mask(state, TDA10046H_CONF_TRISTATE1, 1, 0); | 494 | tda1004x_write_mask(state, TDA10046H_CONF_TRISTATE1, 1, 0); |
@@ -594,7 +594,7 @@ static int tda10045_init(struct dvb_frontend* fe) | |||
594 | { | 594 | { |
595 | struct tda1004x_state* state = fe->demodulator_priv; | 595 | struct tda1004x_state* state = fe->demodulator_priv; |
596 | 596 | ||
597 | dprintk("%s\n", __FUNCTION__); | 597 | dprintk("%s\n", __func__); |
598 | 598 | ||
599 | if (tda10045_fwupload(fe)) { | 599 | if (tda10045_fwupload(fe)) { |
600 | printk("tda1004x: firmware upload failed\n"); | 600 | printk("tda1004x: firmware upload failed\n"); |
@@ -624,7 +624,7 @@ static int tda10045_init(struct dvb_frontend* fe) | |||
624 | static int tda10046_init(struct dvb_frontend* fe) | 624 | static int tda10046_init(struct dvb_frontend* fe) |
625 | { | 625 | { |
626 | struct tda1004x_state* state = fe->demodulator_priv; | 626 | struct tda1004x_state* state = fe->demodulator_priv; |
627 | dprintk("%s\n", __FUNCTION__); | 627 | dprintk("%s\n", __func__); |
628 | 628 | ||
629 | if (tda10046_fwupload(fe)) { | 629 | if (tda10046_fwupload(fe)) { |
630 | printk("tda1004x: firmware upload failed\n"); | 630 | printk("tda1004x: firmware upload failed\n"); |
@@ -686,7 +686,7 @@ static int tda1004x_set_fe(struct dvb_frontend* fe, | |||
686 | int tmp; | 686 | int tmp; |
687 | int inversion; | 687 | int inversion; |
688 | 688 | ||
689 | dprintk("%s\n", __FUNCTION__); | 689 | dprintk("%s\n", __func__); |
690 | 690 | ||
691 | if (state->demod_type == TDA1004X_DEMOD_TDA10046) { | 691 | if (state->demod_type == TDA1004X_DEMOD_TDA10046) { |
692 | // setup auto offset | 692 | // setup auto offset |
@@ -881,7 +881,7 @@ static int tda1004x_get_fe(struct dvb_frontend* fe, struct dvb_frontend_paramete | |||
881 | { | 881 | { |
882 | struct tda1004x_state* state = fe->demodulator_priv; | 882 | struct tda1004x_state* state = fe->demodulator_priv; |
883 | 883 | ||
884 | dprintk("%s\n", __FUNCTION__); | 884 | dprintk("%s\n", __func__); |
885 | 885 | ||
886 | // inversion status | 886 | // inversion status |
887 | fe_params->inversion = INVERSION_OFF; | 887 | fe_params->inversion = INVERSION_OFF; |
@@ -989,7 +989,7 @@ static int tda1004x_read_status(struct dvb_frontend* fe, fe_status_t * fe_status | |||
989 | int cber; | 989 | int cber; |
990 | int vber; | 990 | int vber; |
991 | 991 | ||
992 | dprintk("%s\n", __FUNCTION__); | 992 | dprintk("%s\n", __func__); |
993 | 993 | ||
994 | // read status | 994 | // read status |
995 | status = tda1004x_read_byte(state, TDA1004X_STATUS_CD); | 995 | status = tda1004x_read_byte(state, TDA1004X_STATUS_CD); |
@@ -1048,7 +1048,7 @@ static int tda1004x_read_status(struct dvb_frontend* fe, fe_status_t * fe_status | |||
1048 | } | 1048 | } |
1049 | 1049 | ||
1050 | // success | 1050 | // success |
1051 | dprintk("%s: fe_status=0x%x\n", __FUNCTION__, *fe_status); | 1051 | dprintk("%s: fe_status=0x%x\n", __func__, *fe_status); |
1052 | return 0; | 1052 | return 0; |
1053 | } | 1053 | } |
1054 | 1054 | ||
@@ -1058,7 +1058,7 @@ static int tda1004x_read_signal_strength(struct dvb_frontend* fe, u16 * signal) | |||
1058 | int tmp; | 1058 | int tmp; |
1059 | int reg = 0; | 1059 | int reg = 0; |
1060 | 1060 | ||
1061 | dprintk("%s\n", __FUNCTION__); | 1061 | dprintk("%s\n", __func__); |
1062 | 1062 | ||
1063 | // determine the register to use | 1063 | // determine the register to use |
1064 | switch (state->demod_type) { | 1064 | switch (state->demod_type) { |
@@ -1077,7 +1077,7 @@ static int tda1004x_read_signal_strength(struct dvb_frontend* fe, u16 * signal) | |||
1077 | return -EIO; | 1077 | return -EIO; |
1078 | 1078 | ||
1079 | *signal = (tmp << 8) | tmp; | 1079 | *signal = (tmp << 8) | tmp; |
1080 | dprintk("%s: signal=0x%x\n", __FUNCTION__, *signal); | 1080 | dprintk("%s: signal=0x%x\n", __func__, *signal); |
1081 | return 0; | 1081 | return 0; |
1082 | } | 1082 | } |
1083 | 1083 | ||
@@ -1086,7 +1086,7 @@ static int tda1004x_read_snr(struct dvb_frontend* fe, u16 * snr) | |||
1086 | struct tda1004x_state* state = fe->demodulator_priv; | 1086 | struct tda1004x_state* state = fe->demodulator_priv; |
1087 | int tmp; | 1087 | int tmp; |
1088 | 1088 | ||
1089 | dprintk("%s\n", __FUNCTION__); | 1089 | dprintk("%s\n", __func__); |
1090 | 1090 | ||
1091 | // read it | 1091 | // read it |
1092 | tmp = tda1004x_read_byte(state, TDA1004X_SNR); | 1092 | tmp = tda1004x_read_byte(state, TDA1004X_SNR); |
@@ -1095,7 +1095,7 @@ static int tda1004x_read_snr(struct dvb_frontend* fe, u16 * snr) | |||
1095 | tmp = 255 - tmp; | 1095 | tmp = 255 - tmp; |
1096 | 1096 | ||
1097 | *snr = ((tmp << 8) | tmp); | 1097 | *snr = ((tmp << 8) | tmp); |
1098 | dprintk("%s: snr=0x%x\n", __FUNCTION__, *snr); | 1098 | dprintk("%s: snr=0x%x\n", __func__, *snr); |
1099 | return 0; | 1099 | return 0; |
1100 | } | 1100 | } |
1101 | 1101 | ||
@@ -1106,7 +1106,7 @@ static int tda1004x_read_ucblocks(struct dvb_frontend* fe, u32* ucblocks) | |||
1106 | int tmp2; | 1106 | int tmp2; |
1107 | int counter; | 1107 | int counter; |
1108 | 1108 | ||
1109 | dprintk("%s\n", __FUNCTION__); | 1109 | dprintk("%s\n", __func__); |
1110 | 1110 | ||
1111 | // read the UCBLOCKS and reset | 1111 | // read the UCBLOCKS and reset |
1112 | counter = 0; | 1112 | counter = 0; |
@@ -1132,7 +1132,7 @@ static int tda1004x_read_ucblocks(struct dvb_frontend* fe, u32* ucblocks) | |||
1132 | else | 1132 | else |
1133 | *ucblocks = 0xffffffff; | 1133 | *ucblocks = 0xffffffff; |
1134 | 1134 | ||
1135 | dprintk("%s: ucblocks=0x%x\n", __FUNCTION__, *ucblocks); | 1135 | dprintk("%s: ucblocks=0x%x\n", __func__, *ucblocks); |
1136 | return 0; | 1136 | return 0; |
1137 | } | 1137 | } |
1138 | 1138 | ||
@@ -1141,7 +1141,7 @@ static int tda1004x_read_ber(struct dvb_frontend* fe, u32* ber) | |||
1141 | struct tda1004x_state* state = fe->demodulator_priv; | 1141 | struct tda1004x_state* state = fe->demodulator_priv; |
1142 | int tmp; | 1142 | int tmp; |
1143 | 1143 | ||
1144 | dprintk("%s\n", __FUNCTION__); | 1144 | dprintk("%s\n", __func__); |
1145 | 1145 | ||
1146 | // read it in | 1146 | // read it in |
1147 | tmp = tda1004x_read_byte(state, TDA1004X_CBER_LSB); | 1147 | tmp = tda1004x_read_byte(state, TDA1004X_CBER_LSB); |
@@ -1155,7 +1155,7 @@ static int tda1004x_read_ber(struct dvb_frontend* fe, u32* ber) | |||
1155 | // The address 0x20 should be read to cope with a TDA10046 bug | 1155 | // The address 0x20 should be read to cope with a TDA10046 bug |
1156 | tda1004x_read_byte(state, TDA1004X_CBER_RESET); | 1156 | tda1004x_read_byte(state, TDA1004X_CBER_RESET); |
1157 | 1157 | ||
1158 | dprintk("%s: ber=0x%x\n", __FUNCTION__, *ber); | 1158 | dprintk("%s: ber=0x%x\n", __func__, *ber); |
1159 | return 0; | 1159 | return 0; |
1160 | } | 1160 | } |
1161 | 1161 | ||
diff --git a/drivers/media/dvb/frontends/tda1004x.h b/drivers/media/dvb/frontends/tda1004x.h index abae84350142..4e27ffb0f14e 100644 --- a/drivers/media/dvb/frontends/tda1004x.h +++ b/drivers/media/dvb/frontends/tda1004x.h | |||
@@ -94,7 +94,6 @@ struct tda1004x_config | |||
94 | 94 | ||
95 | /* slave address and configuration of the tuner */ | 95 | /* slave address and configuration of the tuner */ |
96 | u8 tuner_address; | 96 | u8 tuner_address; |
97 | u8 tuner_config; | ||
98 | u8 antenna_switch; | 97 | u8 antenna_switch; |
99 | 98 | ||
100 | /* if the board uses another I2c Bridge (tda8290), its address */ | 99 | /* if the board uses another I2c Bridge (tda8290), its address */ |
@@ -128,13 +127,13 @@ extern struct dvb_frontend* tda10046_attach(const struct tda1004x_config* config | |||
128 | static inline struct dvb_frontend* tda10045_attach(const struct tda1004x_config* config, | 127 | static inline struct dvb_frontend* tda10045_attach(const struct tda1004x_config* config, |
129 | struct i2c_adapter* i2c) | 128 | struct i2c_adapter* i2c) |
130 | { | 129 | { |
131 | printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __FUNCTION__); | 130 | printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__); |
132 | return NULL; | 131 | return NULL; |
133 | } | 132 | } |
134 | static inline struct dvb_frontend* tda10046_attach(const struct tda1004x_config* config, | 133 | static inline struct dvb_frontend* tda10046_attach(const struct tda1004x_config* config, |
135 | struct i2c_adapter* i2c) | 134 | struct i2c_adapter* i2c) |
136 | { | 135 | { |
137 | printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __FUNCTION__); | 136 | printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__); |
138 | return NULL; | 137 | return NULL; |
139 | } | 138 | } |
140 | #endif // CONFIG_DVB_TDA1004X | 139 | #endif // CONFIG_DVB_TDA1004X |
diff --git a/drivers/media/dvb/frontends/tda10086.c b/drivers/media/dvb/frontends/tda10086.c index 0d2b69a99ad4..a17ce3c4ad86 100644 --- a/drivers/media/dvb/frontends/tda10086.c +++ b/drivers/media/dvb/frontends/tda10086.c | |||
@@ -43,7 +43,7 @@ struct tda10086_state { | |||
43 | bool has_lock; | 43 | bool has_lock; |
44 | }; | 44 | }; |
45 | 45 | ||
46 | static int debug = 0; | 46 | static int debug; |
47 | #define dprintk(args...) \ | 47 | #define dprintk(args...) \ |
48 | do { \ | 48 | do { \ |
49 | if (debug) printk(KERN_DEBUG "tda10086: " args); \ | 49 | if (debug) printk(KERN_DEBUG "tda10086: " args); \ |
@@ -60,7 +60,7 @@ static int tda10086_write_byte(struct tda10086_state *state, int reg, int data) | |||
60 | 60 | ||
61 | if (ret != 1) | 61 | if (ret != 1) |
62 | dprintk("%s: error reg=0x%x, data=0x%x, ret=%i\n", | 62 | dprintk("%s: error reg=0x%x, data=0x%x, ret=%i\n", |
63 | __FUNCTION__, reg, data, ret); | 63 | __func__, reg, data, ret); |
64 | 64 | ||
65 | return (ret != 1) ? ret : 0; | 65 | return (ret != 1) ? ret : 0; |
66 | } | 66 | } |
@@ -78,7 +78,7 @@ static int tda10086_read_byte(struct tda10086_state *state, int reg) | |||
78 | ret = i2c_transfer(state->i2c, msg, 2); | 78 | ret = i2c_transfer(state->i2c, msg, 2); |
79 | 79 | ||
80 | if (ret != 2) { | 80 | if (ret != 2) { |
81 | dprintk("%s: error reg=0x%x, ret=%i\n", __FUNCTION__, reg, | 81 | dprintk("%s: error reg=0x%x, ret=%i\n", __func__, reg, |
82 | ret); | 82 | ret); |
83 | return ret; | 83 | return ret; |
84 | } | 84 | } |
@@ -90,16 +90,16 @@ static int tda10086_write_mask(struct tda10086_state *state, int reg, int mask, | |||
90 | { | 90 | { |
91 | int val; | 91 | int val; |
92 | 92 | ||
93 | // read a byte and check | 93 | /* read a byte and check */ |
94 | val = tda10086_read_byte(state, reg); | 94 | val = tda10086_read_byte(state, reg); |
95 | if (val < 0) | 95 | if (val < 0) |
96 | return val; | 96 | return val; |
97 | 97 | ||
98 | // mask if off | 98 | /* mask if off */ |
99 | val = val & ~mask; | 99 | val = val & ~mask; |
100 | val |= data & 0xff; | 100 | val |= data & 0xff; |
101 | 101 | ||
102 | // write it out again | 102 | /* write it out again */ |
103 | return tda10086_write_byte(state, reg, val); | 103 | return tda10086_write_byte(state, reg, val); |
104 | } | 104 | } |
105 | 105 | ||
@@ -108,62 +108,67 @@ static int tda10086_init(struct dvb_frontend* fe) | |||
108 | struct tda10086_state* state = fe->demodulator_priv; | 108 | struct tda10086_state* state = fe->demodulator_priv; |
109 | u8 t22k_off = 0x80; | 109 | u8 t22k_off = 0x80; |
110 | 110 | ||
111 | dprintk ("%s\n", __FUNCTION__); | 111 | dprintk ("%s\n", __func__); |
112 | 112 | ||
113 | if (state->config->diseqc_tone) | 113 | if (state->config->diseqc_tone) |
114 | t22k_off = 0; | 114 | t22k_off = 0; |
115 | // reset | 115 | /* reset */ |
116 | tda10086_write_byte(state, 0x00, 0x00); | 116 | tda10086_write_byte(state, 0x00, 0x00); |
117 | msleep(10); | 117 | msleep(10); |
118 | 118 | ||
119 | // misc setup | 119 | /* misc setup */ |
120 | tda10086_write_byte(state, 0x01, 0x94); | 120 | tda10086_write_byte(state, 0x01, 0x94); |
121 | tda10086_write_byte(state, 0x02, 0x35); // NOTE: TT drivers appear to disable CSWP | 121 | tda10086_write_byte(state, 0x02, 0x35); /* NOTE: TT drivers appear to disable CSWP */ |
122 | tda10086_write_byte(state, 0x03, 0xe4); | 122 | tda10086_write_byte(state, 0x03, 0xe4); |
123 | tda10086_write_byte(state, 0x04, 0x43); | 123 | tda10086_write_byte(state, 0x04, 0x43); |
124 | tda10086_write_byte(state, 0x0c, 0x0c); | 124 | tda10086_write_byte(state, 0x0c, 0x0c); |
125 | tda10086_write_byte(state, 0x1b, 0xb0); // noise threshold | 125 | tda10086_write_byte(state, 0x1b, 0xb0); /* noise threshold */ |
126 | tda10086_write_byte(state, 0x20, 0x89); // misc | 126 | tda10086_write_byte(state, 0x20, 0x89); /* misc */ |
127 | tda10086_write_byte(state, 0x30, 0x04); // acquisition period length | 127 | tda10086_write_byte(state, 0x30, 0x04); /* acquisition period length */ |
128 | tda10086_write_byte(state, 0x32, 0x00); // irq off | 128 | tda10086_write_byte(state, 0x32, 0x00); /* irq off */ |
129 | tda10086_write_byte(state, 0x31, 0x56); // setup AFC | 129 | tda10086_write_byte(state, 0x31, 0x56); /* setup AFC */ |
130 | 130 | ||
131 | // setup PLL (assumes 16Mhz XIN) | 131 | /* setup PLL (this assumes SACLK = 96MHz) */ |
132 | tda10086_write_byte(state, 0x55, 0x2c); // misc PLL setup | 132 | tda10086_write_byte(state, 0x55, 0x2c); /* misc PLL setup */ |
133 | tda10086_write_byte(state, 0x3a, 0x0b); // M=12 | 133 | if (state->config->xtal_freq == TDA10086_XTAL_16M) { |
134 | tda10086_write_byte(state, 0x3b, 0x01); // P=2 | 134 | tda10086_write_byte(state, 0x3a, 0x0b); /* M=12 */ |
135 | tda10086_write_mask(state, 0x55, 0x20, 0x00); // powerup PLL | 135 | tda10086_write_byte(state, 0x3b, 0x01); /* P=2 */ |
136 | 136 | } else { | |
137 | // setup TS interface | 137 | tda10086_write_byte(state, 0x3a, 0x17); /* M=24 */ |
138 | tda10086_write_byte(state, 0x3b, 0x00); /* P=1 */ | ||
139 | } | ||
140 | tda10086_write_mask(state, 0x55, 0x20, 0x00); /* powerup PLL */ | ||
141 | |||
142 | /* setup TS interface */ | ||
138 | tda10086_write_byte(state, 0x11, 0x81); | 143 | tda10086_write_byte(state, 0x11, 0x81); |
139 | tda10086_write_byte(state, 0x12, 0x81); | 144 | tda10086_write_byte(state, 0x12, 0x81); |
140 | tda10086_write_byte(state, 0x19, 0x40); // parallel mode A + MSBFIRST | 145 | tda10086_write_byte(state, 0x19, 0x40); /* parallel mode A + MSBFIRST */ |
141 | tda10086_write_byte(state, 0x56, 0x80); // powerdown WPLL - unused in the mode we use | 146 | tda10086_write_byte(state, 0x56, 0x80); /* powerdown WPLL - unused in the mode we use */ |
142 | tda10086_write_byte(state, 0x57, 0x08); // bypass WPLL - unused in the mode we use | 147 | tda10086_write_byte(state, 0x57, 0x08); /* bypass WPLL - unused in the mode we use */ |
143 | tda10086_write_byte(state, 0x10, 0x2a); | 148 | tda10086_write_byte(state, 0x10, 0x2a); |
144 | 149 | ||
145 | // setup ADC | 150 | /* setup ADC */ |
146 | tda10086_write_byte(state, 0x58, 0x61); // ADC setup | 151 | tda10086_write_byte(state, 0x58, 0x61); /* ADC setup */ |
147 | tda10086_write_mask(state, 0x58, 0x01, 0x00); // powerup ADC | 152 | tda10086_write_mask(state, 0x58, 0x01, 0x00); /* powerup ADC */ |
148 | 153 | ||
149 | // setup AGC | 154 | /* setup AGC */ |
150 | tda10086_write_byte(state, 0x05, 0x0B); | 155 | tda10086_write_byte(state, 0x05, 0x0B); |
151 | tda10086_write_byte(state, 0x37, 0x63); | 156 | tda10086_write_byte(state, 0x37, 0x63); |
152 | tda10086_write_byte(state, 0x3f, 0x0a); // NOTE: flydvb varies it | 157 | tda10086_write_byte(state, 0x3f, 0x0a); /* NOTE: flydvb varies it */ |
153 | tda10086_write_byte(state, 0x40, 0x64); | 158 | tda10086_write_byte(state, 0x40, 0x64); |
154 | tda10086_write_byte(state, 0x41, 0x4f); | 159 | tda10086_write_byte(state, 0x41, 0x4f); |
155 | tda10086_write_byte(state, 0x42, 0x43); | 160 | tda10086_write_byte(state, 0x42, 0x43); |
156 | 161 | ||
157 | // setup viterbi | 162 | /* setup viterbi */ |
158 | tda10086_write_byte(state, 0x1a, 0x11); // VBER 10^6, DVB, QPSK | 163 | tda10086_write_byte(state, 0x1a, 0x11); /* VBER 10^6, DVB, QPSK */ |
159 | 164 | ||
160 | // setup carrier recovery | 165 | /* setup carrier recovery */ |
161 | tda10086_write_byte(state, 0x3d, 0x80); | 166 | tda10086_write_byte(state, 0x3d, 0x80); |
162 | 167 | ||
163 | // setup SEC | 168 | /* setup SEC */ |
164 | tda10086_write_byte(state, 0x36, t22k_off); // all SEC off, 22k tone | 169 | tda10086_write_byte(state, 0x36, t22k_off); /* all SEC off, 22k tone */ |
165 | tda10086_write_byte(state, 0x34, (((1<<19) * (22000/1000)) / (SACLK/1000))); // } tone frequency | 170 | tda10086_write_byte(state, 0x34, (((1<<19) * (22000/1000)) / (SACLK/1000))); |
166 | tda10086_write_byte(state, 0x35, (((1<<19) * (22000/1000)) / (SACLK/1000)) >> 8); // } | 171 | tda10086_write_byte(state, 0x35, (((1<<19) * (22000/1000)) / (SACLK/1000)) >> 8); |
167 | 172 | ||
168 | return 0; | 173 | return 0; |
169 | } | 174 | } |
@@ -173,7 +178,7 @@ static void tda10086_diseqc_wait(struct tda10086_state *state) | |||
173 | unsigned long timeout = jiffies + msecs_to_jiffies(200); | 178 | unsigned long timeout = jiffies + msecs_to_jiffies(200); |
174 | while (!(tda10086_read_byte(state, 0x50) & 0x01)) { | 179 | while (!(tda10086_read_byte(state, 0x50) & 0x01)) { |
175 | if(time_after(jiffies, timeout)) { | 180 | if(time_after(jiffies, timeout)) { |
176 | printk("%s: diseqc queue not ready, command may be lost.\n", __FUNCTION__); | 181 | printk("%s: diseqc queue not ready, command may be lost.\n", __func__); |
177 | break; | 182 | break; |
178 | } | 183 | } |
179 | msleep(10); | 184 | msleep(10); |
@@ -185,7 +190,7 @@ static int tda10086_set_tone (struct dvb_frontend* fe, fe_sec_tone_mode_t tone) | |||
185 | struct tda10086_state* state = fe->demodulator_priv; | 190 | struct tda10086_state* state = fe->demodulator_priv; |
186 | u8 t22k_off = 0x80; | 191 | u8 t22k_off = 0x80; |
187 | 192 | ||
188 | dprintk ("%s\n", __FUNCTION__); | 193 | dprintk ("%s\n", __func__); |
189 | 194 | ||
190 | if (state->config->diseqc_tone) | 195 | if (state->config->diseqc_tone) |
191 | t22k_off = 0; | 196 | t22k_off = 0; |
@@ -211,7 +216,7 @@ static int tda10086_send_master_cmd (struct dvb_frontend* fe, | |||
211 | u8 oldval; | 216 | u8 oldval; |
212 | u8 t22k_off = 0x80; | 217 | u8 t22k_off = 0x80; |
213 | 218 | ||
214 | dprintk ("%s\n", __FUNCTION__); | 219 | dprintk ("%s\n", __func__); |
215 | 220 | ||
216 | if (state->config->diseqc_tone) | 221 | if (state->config->diseqc_tone) |
217 | t22k_off = 0; | 222 | t22k_off = 0; |
@@ -239,7 +244,7 @@ static int tda10086_send_burst (struct dvb_frontend* fe, fe_sec_mini_cmd_t minic | |||
239 | u8 oldval = tda10086_read_byte(state, 0x36); | 244 | u8 oldval = tda10086_read_byte(state, 0x36); |
240 | u8 t22k_off = 0x80; | 245 | u8 t22k_off = 0x80; |
241 | 246 | ||
242 | dprintk ("%s\n", __FUNCTION__); | 247 | dprintk ("%s\n", __func__); |
243 | 248 | ||
244 | if (state->config->diseqc_tone) | 249 | if (state->config->diseqc_tone) |
245 | t22k_off = 0; | 250 | t22k_off = 0; |
@@ -266,7 +271,7 @@ static int tda10086_set_inversion(struct tda10086_state *state, | |||
266 | { | 271 | { |
267 | u8 invval = 0x80; | 272 | u8 invval = 0x80; |
268 | 273 | ||
269 | dprintk ("%s %i %i\n", __FUNCTION__, fe_params->inversion, state->config->invert); | 274 | dprintk ("%s %i %i\n", __func__, fe_params->inversion, state->config->invert); |
270 | 275 | ||
271 | switch(fe_params->inversion) { | 276 | switch(fe_params->inversion) { |
272 | case INVERSION_OFF: | 277 | case INVERSION_OFF: |
@@ -300,9 +305,9 @@ static int tda10086_set_symbol_rate(struct tda10086_state *state, | |||
300 | u32 bdri; | 305 | u32 bdri; |
301 | u32 symbol_rate = fe_params->u.qpsk.symbol_rate; | 306 | u32 symbol_rate = fe_params->u.qpsk.symbol_rate; |
302 | 307 | ||
303 | dprintk ("%s %i\n", __FUNCTION__, symbol_rate); | 308 | dprintk ("%s %i\n", __func__, symbol_rate); |
304 | 309 | ||
305 | // setup the decimation and anti-aliasing filters.. | 310 | /* setup the decimation and anti-aliasing filters.. */ |
306 | if (symbol_rate < (u32) (SACLK * 0.0137)) { | 311 | if (symbol_rate < (u32) (SACLK * 0.0137)) { |
307 | dfn=4; | 312 | dfn=4; |
308 | afs=1; | 313 | afs=1; |
@@ -339,13 +344,13 @@ static int tda10086_set_symbol_rate(struct tda10086_state *state, | |||
339 | byp=1; | 344 | byp=1; |
340 | } | 345 | } |
341 | 346 | ||
342 | // calculate BDR | 347 | /* calculate BDR */ |
343 | big = (1ULL<<21) * ((u64) symbol_rate/1000ULL) * (1ULL<<dfn); | 348 | big = (1ULL<<21) * ((u64) symbol_rate/1000ULL) * (1ULL<<dfn); |
344 | big += ((SACLK/1000ULL)-1ULL); | 349 | big += ((SACLK/1000ULL)-1ULL); |
345 | do_div(big, (SACLK/1000ULL)); | 350 | do_div(big, (SACLK/1000ULL)); |
346 | bdr = big & 0xfffff; | 351 | bdr = big & 0xfffff; |
347 | 352 | ||
348 | // calculate BDRI | 353 | /* calculate BDRI */ |
349 | tmp = (1<<dfn)*(symbol_rate/1000); | 354 | tmp = (1<<dfn)*(symbol_rate/1000); |
350 | bdri = ((32 * (SACLK/1000)) + (tmp-1)) / tmp; | 355 | bdri = ((32 * (SACLK/1000)) + (tmp-1)) / tmp; |
351 | 356 | ||
@@ -366,7 +371,7 @@ static int tda10086_set_fec(struct tda10086_state *state, | |||
366 | { | 371 | { |
367 | u8 fecval; | 372 | u8 fecval; |
368 | 373 | ||
369 | dprintk ("%s %i\n", __FUNCTION__, fe_params->u.qpsk.fec_inner); | 374 | dprintk ("%s %i\n", __func__, fe_params->u.qpsk.fec_inner); |
370 | 375 | ||
371 | switch(fe_params->u.qpsk.fec_inner) { | 376 | switch(fe_params->u.qpsk.fec_inner) { |
372 | case FEC_1_2: | 377 | case FEC_1_2: |
@@ -412,13 +417,13 @@ static int tda10086_set_frontend(struct dvb_frontend* fe, | |||
412 | u32 freq = 0; | 417 | u32 freq = 0; |
413 | int freqoff; | 418 | int freqoff; |
414 | 419 | ||
415 | dprintk ("%s\n", __FUNCTION__); | 420 | dprintk ("%s\n", __func__); |
416 | 421 | ||
417 | // modify parameters for tuning | 422 | /* modify parameters for tuning */ |
418 | tda10086_write_byte(state, 0x02, 0x35); | 423 | tda10086_write_byte(state, 0x02, 0x35); |
419 | state->has_lock = false; | 424 | state->has_lock = false; |
420 | 425 | ||
421 | // set params | 426 | /* set params */ |
422 | if (fe->ops.tuner_ops.set_params) { | 427 | if (fe->ops.tuner_ops.set_params) { |
423 | fe->ops.tuner_ops.set_params(fe, fe_params); | 428 | fe->ops.tuner_ops.set_params(fe, fe_params); |
424 | if (fe->ops.i2c_gate_ctrl) | 429 | if (fe->ops.i2c_gate_ctrl) |
@@ -430,7 +435,7 @@ static int tda10086_set_frontend(struct dvb_frontend* fe, | |||
430 | fe->ops.i2c_gate_ctrl(fe, 0); | 435 | fe->ops.i2c_gate_ctrl(fe, 0); |
431 | } | 436 | } |
432 | 437 | ||
433 | // calcluate the frequency offset (in *Hz* not kHz) | 438 | /* calcluate the frequency offset (in *Hz* not kHz) */ |
434 | freqoff = fe_params->frequency - freq; | 439 | freqoff = fe_params->frequency - freq; |
435 | freqoff = ((1<<16) * freqoff) / (SACLK/1000); | 440 | freqoff = ((1<<16) * freqoff) / (SACLK/1000); |
436 | tda10086_write_byte(state, 0x3d, 0x80 | ((freqoff >> 8) & 0x7f)); | 441 | tda10086_write_byte(state, 0x3d, 0x80 | ((freqoff >> 8) & 0x7f)); |
@@ -443,7 +448,7 @@ static int tda10086_set_frontend(struct dvb_frontend* fe, | |||
443 | if ((ret = tda10086_set_fec(state, fe_params)) < 0) | 448 | if ((ret = tda10086_set_fec(state, fe_params)) < 0) |
444 | return ret; | 449 | return ret; |
445 | 450 | ||
446 | // soft reset + disable TS output until lock | 451 | /* soft reset + disable TS output until lock */ |
447 | tda10086_write_mask(state, 0x10, 0x40, 0x40); | 452 | tda10086_write_mask(state, 0x10, 0x40, 0x40); |
448 | tda10086_write_mask(state, 0x00, 0x01, 0x00); | 453 | tda10086_write_mask(state, 0x00, 0x01, 0x00); |
449 | 454 | ||
@@ -459,13 +464,13 @@ static int tda10086_get_frontend(struct dvb_frontend* fe, struct dvb_frontend_pa | |||
459 | int tmp; | 464 | int tmp; |
460 | u64 tmp64; | 465 | u64 tmp64; |
461 | 466 | ||
462 | dprintk ("%s\n", __FUNCTION__); | 467 | dprintk ("%s\n", __func__); |
463 | 468 | ||
464 | // check for invalid symbol rate | 469 | /* check for invalid symbol rate */ |
465 | if (fe_params->u.qpsk.symbol_rate < 500000) | 470 | if (fe_params->u.qpsk.symbol_rate < 500000) |
466 | return -EINVAL; | 471 | return -EINVAL; |
467 | 472 | ||
468 | // calculate the updated frequency (note: we convert from Hz->kHz) | 473 | /* calculate the updated frequency (note: we convert from Hz->kHz) */ |
469 | tmp64 = tda10086_read_byte(state, 0x52); | 474 | tmp64 = tda10086_read_byte(state, 0x52); |
470 | tmp64 |= (tda10086_read_byte(state, 0x51) << 8); | 475 | tmp64 |= (tda10086_read_byte(state, 0x51) << 8); |
471 | if (tmp64 & 0x8000) | 476 | if (tmp64 & 0x8000) |
@@ -474,7 +479,7 @@ static int tda10086_get_frontend(struct dvb_frontend* fe, struct dvb_frontend_pa | |||
474 | do_div(tmp64, (1ULL<<15) * (1ULL<<1)); | 479 | do_div(tmp64, (1ULL<<15) * (1ULL<<1)); |
475 | fe_params->frequency = (int) state->frequency + (int) tmp64; | 480 | fe_params->frequency = (int) state->frequency + (int) tmp64; |
476 | 481 | ||
477 | // the inversion | 482 | /* the inversion */ |
478 | val = tda10086_read_byte(state, 0x0c); | 483 | val = tda10086_read_byte(state, 0x0c); |
479 | if (val & 0x80) { | 484 | if (val & 0x80) { |
480 | switch(val & 0x40) { | 485 | switch(val & 0x40) { |
@@ -505,7 +510,7 @@ static int tda10086_get_frontend(struct dvb_frontend* fe, struct dvb_frontend_pa | |||
505 | } | 510 | } |
506 | } | 511 | } |
507 | 512 | ||
508 | // calculate the updated symbol rate | 513 | /* calculate the updated symbol rate */ |
509 | tmp = tda10086_read_byte(state, 0x1d); | 514 | tmp = tda10086_read_byte(state, 0x1d); |
510 | if (tmp & 0x80) | 515 | if (tmp & 0x80) |
511 | tmp |= 0xffffff00; | 516 | tmp |= 0xffffff00; |
@@ -513,7 +518,7 @@ static int tda10086_get_frontend(struct dvb_frontend* fe, struct dvb_frontend_pa | |||
513 | tmp = ((state->symbol_rate/1000) * tmp) / (1000000/1000); | 518 | tmp = ((state->symbol_rate/1000) * tmp) / (1000000/1000); |
514 | fe_params->u.qpsk.symbol_rate = state->symbol_rate + tmp; | 519 | fe_params->u.qpsk.symbol_rate = state->symbol_rate + tmp; |
515 | 520 | ||
516 | // the FEC | 521 | /* the FEC */ |
517 | val = (tda10086_read_byte(state, 0x0d) & 0x70) >> 4; | 522 | val = (tda10086_read_byte(state, 0x0d) & 0x70) >> 4; |
518 | switch(val) { | 523 | switch(val) { |
519 | case 0x00: | 524 | case 0x00: |
@@ -550,7 +555,7 @@ static int tda10086_read_status(struct dvb_frontend* fe, fe_status_t *fe_status) | |||
550 | struct tda10086_state* state = fe->demodulator_priv; | 555 | struct tda10086_state* state = fe->demodulator_priv; |
551 | u8 val; | 556 | u8 val; |
552 | 557 | ||
553 | dprintk ("%s\n", __FUNCTION__); | 558 | dprintk ("%s\n", __func__); |
554 | 559 | ||
555 | val = tda10086_read_byte(state, 0x0e); | 560 | val = tda10086_read_byte(state, 0x0e); |
556 | *fe_status = 0; | 561 | *fe_status = 0; |
@@ -566,7 +571,7 @@ static int tda10086_read_status(struct dvb_frontend* fe, fe_status_t *fe_status) | |||
566 | *fe_status |= FE_HAS_LOCK; | 571 | *fe_status |= FE_HAS_LOCK; |
567 | if (!state->has_lock) { | 572 | if (!state->has_lock) { |
568 | state->has_lock = true; | 573 | state->has_lock = true; |
569 | // modify parameters for stable reception | 574 | /* modify parameters for stable reception */ |
570 | tda10086_write_byte(state, 0x02, 0x00); | 575 | tda10086_write_byte(state, 0x02, 0x00); |
571 | } | 576 | } |
572 | } | 577 | } |
@@ -579,7 +584,7 @@ static int tda10086_read_signal_strength(struct dvb_frontend* fe, u16 * signal) | |||
579 | struct tda10086_state* state = fe->demodulator_priv; | 584 | struct tda10086_state* state = fe->demodulator_priv; |
580 | u8 _str; | 585 | u8 _str; |
581 | 586 | ||
582 | dprintk ("%s\n", __FUNCTION__); | 587 | dprintk ("%s\n", __func__); |
583 | 588 | ||
584 | _str = 0xff - tda10086_read_byte(state, 0x43); | 589 | _str = 0xff - tda10086_read_byte(state, 0x43); |
585 | *signal = (_str << 8) | _str; | 590 | *signal = (_str << 8) | _str; |
@@ -592,7 +597,7 @@ static int tda10086_read_snr(struct dvb_frontend* fe, u16 * snr) | |||
592 | struct tda10086_state* state = fe->demodulator_priv; | 597 | struct tda10086_state* state = fe->demodulator_priv; |
593 | u8 _snr; | 598 | u8 _snr; |
594 | 599 | ||
595 | dprintk ("%s\n", __FUNCTION__); | 600 | dprintk ("%s\n", __func__); |
596 | 601 | ||
597 | _snr = 0xff - tda10086_read_byte(state, 0x1c); | 602 | _snr = 0xff - tda10086_read_byte(state, 0x1c); |
598 | *snr = (_snr << 8) | _snr; | 603 | *snr = (_snr << 8) | _snr; |
@@ -604,12 +609,12 @@ static int tda10086_read_ucblocks(struct dvb_frontend* fe, u32* ucblocks) | |||
604 | { | 609 | { |
605 | struct tda10086_state* state = fe->demodulator_priv; | 610 | struct tda10086_state* state = fe->demodulator_priv; |
606 | 611 | ||
607 | dprintk ("%s\n", __FUNCTION__); | 612 | dprintk ("%s\n", __func__); |
608 | 613 | ||
609 | // read it | 614 | /* read it */ |
610 | *ucblocks = tda10086_read_byte(state, 0x18) & 0x7f; | 615 | *ucblocks = tda10086_read_byte(state, 0x18) & 0x7f; |
611 | 616 | ||
612 | // reset counter | 617 | /* reset counter */ |
613 | tda10086_write_byte(state, 0x18, 0x00); | 618 | tda10086_write_byte(state, 0x18, 0x00); |
614 | tda10086_write_byte(state, 0x18, 0x80); | 619 | tda10086_write_byte(state, 0x18, 0x80); |
615 | 620 | ||
@@ -620,9 +625,9 @@ static int tda10086_read_ber(struct dvb_frontend* fe, u32* ber) | |||
620 | { | 625 | { |
621 | struct tda10086_state* state = fe->demodulator_priv; | 626 | struct tda10086_state* state = fe->demodulator_priv; |
622 | 627 | ||
623 | dprintk ("%s\n", __FUNCTION__); | 628 | dprintk ("%s\n", __func__); |
624 | 629 | ||
625 | // read it | 630 | /* read it */ |
626 | *ber = 0; | 631 | *ber = 0; |
627 | *ber |= tda10086_read_byte(state, 0x15); | 632 | *ber |= tda10086_read_byte(state, 0x15); |
628 | *ber |= tda10086_read_byte(state, 0x16) << 8; | 633 | *ber |= tda10086_read_byte(state, 0x16) << 8; |
@@ -635,7 +640,7 @@ static int tda10086_sleep(struct dvb_frontend* fe) | |||
635 | { | 640 | { |
636 | struct tda10086_state* state = fe->demodulator_priv; | 641 | struct tda10086_state* state = fe->demodulator_priv; |
637 | 642 | ||
638 | dprintk ("%s\n", __FUNCTION__); | 643 | dprintk ("%s\n", __func__); |
639 | 644 | ||
640 | tda10086_write_mask(state, 0x00, 0x08, 0x08); | 645 | tda10086_write_mask(state, 0x00, 0x08, 0x08); |
641 | 646 | ||
@@ -646,7 +651,7 @@ static int tda10086_i2c_gate_ctrl(struct dvb_frontend* fe, int enable) | |||
646 | { | 651 | { |
647 | struct tda10086_state* state = fe->demodulator_priv; | 652 | struct tda10086_state* state = fe->demodulator_priv; |
648 | 653 | ||
649 | dprintk ("%s\n", __FUNCTION__); | 654 | dprintk ("%s\n", __func__); |
650 | 655 | ||
651 | if (enable) { | 656 | if (enable) { |
652 | tda10086_write_mask(state, 0x00, 0x10, 0x10); | 657 | tda10086_write_mask(state, 0x00, 0x10, 0x10); |
@@ -737,7 +742,7 @@ struct dvb_frontend* tda10086_attach(const struct tda10086_config* config, | |||
737 | { | 742 | { |
738 | struct tda10086_state *state; | 743 | struct tda10086_state *state; |
739 | 744 | ||
740 | dprintk ("%s\n", __FUNCTION__); | 745 | dprintk ("%s\n", __func__); |
741 | 746 | ||
742 | /* allocate memory for the internal state */ | 747 | /* allocate memory for the internal state */ |
743 | state = kmalloc(sizeof(struct tda10086_state), GFP_KERNEL); | 748 | state = kmalloc(sizeof(struct tda10086_state), GFP_KERNEL); |
diff --git a/drivers/media/dvb/frontends/tda10086.h b/drivers/media/dvb/frontends/tda10086.h index eeceaeee78ff..61148c558d8d 100644 --- a/drivers/media/dvb/frontends/tda10086.h +++ b/drivers/media/dvb/frontends/tda10086.h | |||
@@ -26,6 +26,11 @@ | |||
26 | #include <linux/dvb/frontend.h> | 26 | #include <linux/dvb/frontend.h> |
27 | #include <linux/firmware.h> | 27 | #include <linux/firmware.h> |
28 | 28 | ||
29 | enum tda10086_xtal { | ||
30 | TDA10086_XTAL_16M, | ||
31 | TDA10086_XTAL_4M | ||
32 | }; | ||
33 | |||
29 | struct tda10086_config | 34 | struct tda10086_config |
30 | { | 35 | { |
31 | /* the demodulator's i2c address */ | 36 | /* the demodulator's i2c address */ |
@@ -36,6 +41,9 @@ struct tda10086_config | |||
36 | 41 | ||
37 | /* do we need the diseqc signal with carrier? */ | 42 | /* do we need the diseqc signal with carrier? */ |
38 | u8 diseqc_tone; | 43 | u8 diseqc_tone; |
44 | |||
45 | /* frequency of the reference xtal */ | ||
46 | enum tda10086_xtal xtal_freq; | ||
39 | }; | 47 | }; |
40 | 48 | ||
41 | #if defined(CONFIG_DVB_TDA10086) || (defined(CONFIG_DVB_TDA10086_MODULE) && defined(MODULE)) | 49 | #if defined(CONFIG_DVB_TDA10086) || (defined(CONFIG_DVB_TDA10086_MODULE) && defined(MODULE)) |
@@ -45,9 +53,9 @@ extern struct dvb_frontend* tda10086_attach(const struct tda10086_config* config | |||
45 | static inline struct dvb_frontend* tda10086_attach(const struct tda10086_config* config, | 53 | static inline struct dvb_frontend* tda10086_attach(const struct tda10086_config* config, |
46 | struct i2c_adapter* i2c) | 54 | struct i2c_adapter* i2c) |
47 | { | 55 | { |
48 | printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __FUNCTION__); | 56 | printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__); |
49 | return NULL; | 57 | return NULL; |
50 | } | 58 | } |
51 | #endif // CONFIG_DVB_TDA10086 | 59 | #endif /* CONFIG_DVB_TDA10086 */ |
52 | 60 | ||
53 | #endif // TDA10086_H | 61 | #endif /* TDA10086_H */ |
diff --git a/drivers/media/dvb/frontends/tda18271-common.c b/drivers/media/dvb/frontends/tda18271-common.c index bca570990613..e27a7620a32f 100644 --- a/drivers/media/dvb/frontends/tda18271-common.c +++ b/drivers/media/dvb/frontends/tda18271-common.c | |||
@@ -125,16 +125,16 @@ int tda18271_read_regs(struct dvb_frontend *fe) | |||
125 | unsigned char buf = 0x00; | 125 | unsigned char buf = 0x00; |
126 | int ret; | 126 | int ret; |
127 | struct i2c_msg msg[] = { | 127 | struct i2c_msg msg[] = { |
128 | { .addr = priv->i2c_addr, .flags = 0, | 128 | { .addr = priv->i2c_props.addr, .flags = 0, |
129 | .buf = &buf, .len = 1 }, | 129 | .buf = &buf, .len = 1 }, |
130 | { .addr = priv->i2c_addr, .flags = I2C_M_RD, | 130 | { .addr = priv->i2c_props.addr, .flags = I2C_M_RD, |
131 | .buf = regs, .len = 16 } | 131 | .buf = regs, .len = 16 } |
132 | }; | 132 | }; |
133 | 133 | ||
134 | tda18271_i2c_gate_ctrl(fe, 1); | 134 | tda18271_i2c_gate_ctrl(fe, 1); |
135 | 135 | ||
136 | /* read all registers */ | 136 | /* read all registers */ |
137 | ret = i2c_transfer(priv->i2c_adap, msg, 2); | 137 | ret = i2c_transfer(priv->i2c_props.adap, msg, 2); |
138 | 138 | ||
139 | tda18271_i2c_gate_ctrl(fe, 0); | 139 | tda18271_i2c_gate_ctrl(fe, 0); |
140 | 140 | ||
@@ -155,16 +155,16 @@ int tda18271_read_extended(struct dvb_frontend *fe) | |||
155 | unsigned char buf = 0x00; | 155 | unsigned char buf = 0x00; |
156 | int ret, i; | 156 | int ret, i; |
157 | struct i2c_msg msg[] = { | 157 | struct i2c_msg msg[] = { |
158 | { .addr = priv->i2c_addr, .flags = 0, | 158 | { .addr = priv->i2c_props.addr, .flags = 0, |
159 | .buf = &buf, .len = 1 }, | 159 | .buf = &buf, .len = 1 }, |
160 | { .addr = priv->i2c_addr, .flags = I2C_M_RD, | 160 | { .addr = priv->i2c_props.addr, .flags = I2C_M_RD, |
161 | .buf = regdump, .len = TDA18271_NUM_REGS } | 161 | .buf = regdump, .len = TDA18271_NUM_REGS } |
162 | }; | 162 | }; |
163 | 163 | ||
164 | tda18271_i2c_gate_ctrl(fe, 1); | 164 | tda18271_i2c_gate_ctrl(fe, 1); |
165 | 165 | ||
166 | /* read all registers */ | 166 | /* read all registers */ |
167 | ret = i2c_transfer(priv->i2c_adap, msg, 2); | 167 | ret = i2c_transfer(priv->i2c_props.adap, msg, 2); |
168 | 168 | ||
169 | tda18271_i2c_gate_ctrl(fe, 0); | 169 | tda18271_i2c_gate_ctrl(fe, 0); |
170 | 170 | ||
@@ -192,7 +192,7 @@ int tda18271_write_regs(struct dvb_frontend *fe, int idx, int len) | |||
192 | struct tda18271_priv *priv = fe->tuner_priv; | 192 | struct tda18271_priv *priv = fe->tuner_priv; |
193 | unsigned char *regs = priv->tda18271_regs; | 193 | unsigned char *regs = priv->tda18271_regs; |
194 | unsigned char buf[TDA18271_NUM_REGS + 1]; | 194 | unsigned char buf[TDA18271_NUM_REGS + 1]; |
195 | struct i2c_msg msg = { .addr = priv->i2c_addr, .flags = 0, | 195 | struct i2c_msg msg = { .addr = priv->i2c_props.addr, .flags = 0, |
196 | .buf = buf, .len = len + 1 }; | 196 | .buf = buf, .len = len + 1 }; |
197 | int i, ret; | 197 | int i, ret; |
198 | 198 | ||
@@ -205,7 +205,7 @@ int tda18271_write_regs(struct dvb_frontend *fe, int idx, int len) | |||
205 | tda18271_i2c_gate_ctrl(fe, 1); | 205 | tda18271_i2c_gate_ctrl(fe, 1); |
206 | 206 | ||
207 | /* write registers */ | 207 | /* write registers */ |
208 | ret = i2c_transfer(priv->i2c_adap, &msg, 1); | 208 | ret = i2c_transfer(priv->i2c_props.adap, &msg, 1); |
209 | 209 | ||
210 | tda18271_i2c_gate_ctrl(fe, 0); | 210 | tda18271_i2c_gate_ctrl(fe, 0); |
211 | 211 | ||
@@ -217,13 +217,29 @@ int tda18271_write_regs(struct dvb_frontend *fe, int idx, int len) | |||
217 | 217 | ||
218 | /*---------------------------------------------------------------------*/ | 218 | /*---------------------------------------------------------------------*/ |
219 | 219 | ||
220 | int tda18271_charge_pump_source(struct dvb_frontend *fe, | ||
221 | enum tda18271_pll pll, int force) | ||
222 | { | ||
223 | struct tda18271_priv *priv = fe->tuner_priv; | ||
224 | unsigned char *regs = priv->tda18271_regs; | ||
225 | |||
226 | int r_cp = (pll == TDA18271_CAL_PLL) ? R_EB7 : R_EB4; | ||
227 | |||
228 | regs[r_cp] &= ~0x20; | ||
229 | regs[r_cp] |= ((force & 1) << 5); | ||
230 | tda18271_write_regs(fe, r_cp, 1); | ||
231 | |||
232 | return 0; | ||
233 | } | ||
234 | |||
220 | int tda18271_init_regs(struct dvb_frontend *fe) | 235 | int tda18271_init_regs(struct dvb_frontend *fe) |
221 | { | 236 | { |
222 | struct tda18271_priv *priv = fe->tuner_priv; | 237 | struct tda18271_priv *priv = fe->tuner_priv; |
223 | unsigned char *regs = priv->tda18271_regs; | 238 | unsigned char *regs = priv->tda18271_regs; |
224 | 239 | ||
225 | tda_dbg("initializing registers for device @ %d-%04x\n", | 240 | tda_dbg("initializing registers for device @ %d-%04x\n", |
226 | i2c_adapter_id(priv->i2c_adap), priv->i2c_addr); | 241 | i2c_adapter_id(priv->i2c_props.adap), |
242 | priv->i2c_props.addr); | ||
227 | 243 | ||
228 | /* initialize registers */ | 244 | /* initialize registers */ |
229 | switch (priv->id) { | 245 | switch (priv->id) { |
@@ -310,7 +326,12 @@ int tda18271_init_regs(struct dvb_frontend *fe) | |||
310 | regs[R_EB22] = 0x48; | 326 | regs[R_EB22] = 0x48; |
311 | regs[R_EB23] = 0xb0; | 327 | regs[R_EB23] = 0xb0; |
312 | 328 | ||
313 | tda18271_write_regs(fe, 0x00, TDA18271_NUM_REGS); | 329 | if (priv->small_i2c) { |
330 | tda18271_write_regs(fe, 0x00, 0x10); | ||
331 | tda18271_write_regs(fe, 0x10, 0x10); | ||
332 | tda18271_write_regs(fe, 0x20, 0x07); | ||
333 | } else | ||
334 | tda18271_write_regs(fe, 0x00, TDA18271_NUM_REGS); | ||
314 | 335 | ||
315 | /* setup agc1 gain */ | 336 | /* setup agc1 gain */ |
316 | regs[R_EB17] = 0x00; | 337 | regs[R_EB17] = 0x00; |
@@ -349,24 +370,15 @@ int tda18271_init_regs(struct dvb_frontend *fe) | |||
349 | regs[R_MD2] = 0x08; | 370 | regs[R_MD2] = 0x08; |
350 | regs[R_MD3] = 0x00; | 371 | regs[R_MD3] = 0x00; |
351 | 372 | ||
352 | switch (priv->id) { | 373 | tda18271_write_regs(fe, R_EP3, 11); |
353 | case TDA18271HDC1: | ||
354 | tda18271_write_regs(fe, R_EP3, 11); | ||
355 | break; | ||
356 | case TDA18271HDC2: | ||
357 | tda18271_write_regs(fe, R_EP3, 12); | ||
358 | break; | ||
359 | }; | ||
360 | 374 | ||
361 | if ((priv->id) == TDA18271HDC2) { | 375 | if ((priv->id) == TDA18271HDC2) { |
362 | /* main pll cp source on */ | 376 | /* main pll cp source on */ |
363 | regs[R_EB4] = 0x61; | 377 | tda18271_charge_pump_source(fe, TDA18271_MAIN_PLL, 1); |
364 | tda18271_write_regs(fe, R_EB4, 1); | ||
365 | msleep(1); | 378 | msleep(1); |
366 | 379 | ||
367 | /* main pll cp source off */ | 380 | /* main pll cp source off */ |
368 | regs[R_EB4] = 0x41; | 381 | tda18271_charge_pump_source(fe, TDA18271_MAIN_PLL, 0); |
369 | tda18271_write_regs(fe, R_EB4, 1); | ||
370 | } | 382 | } |
371 | 383 | ||
372 | msleep(5); /* pll locking */ | 384 | msleep(5); /* pll locking */ |
@@ -398,6 +410,7 @@ int tda18271_init_regs(struct dvb_frontend *fe) | |||
398 | tda18271_write_regs(fe, R_EP3, 11); | 410 | tda18271_write_regs(fe, R_EP3, 11); |
399 | msleep(5); /* pll locking */ | 411 | msleep(5); /* pll locking */ |
400 | 412 | ||
413 | /* launch detector */ | ||
401 | tda18271_write_regs(fe, R_EP1, 1); | 414 | tda18271_write_regs(fe, R_EP1, 1); |
402 | msleep(5); /* wanted mid measurement */ | 415 | msleep(5); /* wanted mid measurement */ |
403 | 416 | ||
diff --git a/drivers/media/dvb/frontends/tda18271-fe.c b/drivers/media/dvb/frontends/tda18271-fe.c index dfe72aaec380..b262100ae897 100644 --- a/drivers/media/dvb/frontends/tda18271-fe.c +++ b/drivers/media/dvb/frontends/tda18271-fe.c | |||
@@ -31,30 +31,23 @@ static int tda18271_cal_on_startup; | |||
31 | module_param_named(cal, tda18271_cal_on_startup, int, 0644); | 31 | module_param_named(cal, tda18271_cal_on_startup, int, 0644); |
32 | MODULE_PARM_DESC(cal, "perform RF tracking filter calibration on startup"); | 32 | MODULE_PARM_DESC(cal, "perform RF tracking filter calibration on startup"); |
33 | 33 | ||
34 | static LIST_HEAD(tda18271_list); | ||
35 | static DEFINE_MUTEX(tda18271_list_mutex); | 34 | static DEFINE_MUTEX(tda18271_list_mutex); |
35 | static LIST_HEAD(hybrid_tuner_instance_list); | ||
36 | 36 | ||
37 | /*---------------------------------------------------------------------*/ | 37 | /*---------------------------------------------------------------------*/ |
38 | 38 | ||
39 | static int tda18271_ir_cal_init(struct dvb_frontend *fe) | 39 | static inline int charge_pump_source(struct dvb_frontend *fe, int force) |
40 | { | 40 | { |
41 | struct tda18271_priv *priv = fe->tuner_priv; | 41 | struct tda18271_priv *priv = fe->tuner_priv; |
42 | unsigned char *regs = priv->tda18271_regs; | 42 | return tda18271_charge_pump_source(fe, |
43 | 43 | (priv->role == TDA18271_SLAVE) ? | |
44 | tda18271_read_regs(fe); | 44 | TDA18271_CAL_PLL : |
45 | 45 | TDA18271_MAIN_PLL, force); | |
46 | /* test IR_CAL_OK to see if we need init */ | ||
47 | if ((regs[R_EP1] & 0x08) == 0) | ||
48 | tda18271_init_regs(fe); | ||
49 | |||
50 | return 0; | ||
51 | } | 46 | } |
52 | 47 | ||
53 | /* ------------------------------------------------------------------ */ | ||
54 | |||
55 | static int tda18271_channel_configuration(struct dvb_frontend *fe, | 48 | static int tda18271_channel_configuration(struct dvb_frontend *fe, |
56 | u32 ifc, u32 freq, u32 bw, u8 std, | 49 | struct tda18271_std_map_item *map, |
57 | int radio) | 50 | u32 freq, u32 bw) |
58 | { | 51 | { |
59 | struct tda18271_priv *priv = fe->tuner_priv; | 52 | struct tda18271_priv *priv = fe->tuner_priv; |
60 | unsigned char *regs = priv->tda18271_regs; | 53 | unsigned char *regs = priv->tda18271_regs; |
@@ -64,38 +57,34 @@ static int tda18271_channel_configuration(struct dvb_frontend *fe, | |||
64 | 57 | ||
65 | /* set standard */ | 58 | /* set standard */ |
66 | regs[R_EP3] &= ~0x1f; /* clear std bits */ | 59 | regs[R_EP3] &= ~0x1f; /* clear std bits */ |
67 | regs[R_EP3] |= std; | 60 | regs[R_EP3] |= (map->agc_mode << 3) | map->std; |
61 | |||
62 | /* set rfagc to high speed mode */ | ||
63 | regs[R_EP3] &= ~0x04; | ||
68 | 64 | ||
69 | /* set cal mode to normal */ | 65 | /* set cal mode to normal */ |
70 | regs[R_EP4] &= ~0x03; | 66 | regs[R_EP4] &= ~0x03; |
71 | 67 | ||
72 | /* update IF output level & IF notch frequency */ | 68 | /* update IF output level & IF notch frequency */ |
73 | regs[R_EP4] &= ~0x1c; /* clear if level bits */ | 69 | regs[R_EP4] &= ~0x1c; /* clear if level bits */ |
70 | regs[R_EP4] |= (map->if_lvl << 2); | ||
74 | 71 | ||
75 | switch (priv->mode) { | 72 | switch (priv->mode) { |
76 | case TDA18271_ANALOG: | 73 | case TDA18271_ANALOG: |
77 | regs[R_MPD] &= ~0x80; /* IF notch = 0 */ | 74 | regs[R_MPD] &= ~0x80; /* IF notch = 0 */ |
78 | break; | 75 | break; |
79 | case TDA18271_DIGITAL: | 76 | case TDA18271_DIGITAL: |
80 | regs[R_EP4] |= 0x04; /* IF level = 1 */ | ||
81 | regs[R_MPD] |= 0x80; /* IF notch = 1 */ | 77 | regs[R_MPD] |= 0x80; /* IF notch = 1 */ |
82 | break; | 78 | break; |
83 | } | 79 | } |
84 | 80 | ||
85 | if (radio) | 81 | /* update FM_RFn */ |
86 | regs[R_EP4] |= 0x80; | 82 | regs[R_EP4] &= ~0x80; |
87 | else | 83 | regs[R_EP4] |= map->fm_rfn << 7; |
88 | regs[R_EP4] &= ~0x80; | ||
89 | 84 | ||
90 | /* update RF_TOP / IF_TOP */ | 85 | /* update rf top / if top */ |
91 | switch (priv->mode) { | 86 | regs[R_EB22] = 0x00; |
92 | case TDA18271_ANALOG: | 87 | regs[R_EB22] |= map->rfagc_top; |
93 | regs[R_EB22] = 0x2c; | ||
94 | break; | ||
95 | case TDA18271_DIGITAL: | ||
96 | regs[R_EB22] = 0x37; | ||
97 | break; | ||
98 | } | ||
99 | tda18271_write_regs(fe, R_EB22, 1); | 88 | tda18271_write_regs(fe, R_EB22, 1); |
100 | 89 | ||
101 | /* --------------------------------------------------------------- */ | 90 | /* --------------------------------------------------------------- */ |
@@ -117,8 +106,14 @@ static int tda18271_channel_configuration(struct dvb_frontend *fe, | |||
117 | 106 | ||
118 | /* dual tuner and agc1 extra configuration */ | 107 | /* dual tuner and agc1 extra configuration */ |
119 | 108 | ||
120 | /* main vco when Master, cal vco when slave */ | 109 | switch (priv->role) { |
121 | regs[R_EB1] |= 0x04; /* FIXME: assumes master */ | 110 | case TDA18271_MASTER: |
111 | regs[R_EB1] |= 0x04; /* main vco */ | ||
112 | break; | ||
113 | case TDA18271_SLAVE: | ||
114 | regs[R_EB1] &= ~0x04; /* cal vco */ | ||
115 | break; | ||
116 | } | ||
122 | 117 | ||
123 | /* agc1 always active */ | 118 | /* agc1 always active */ |
124 | regs[R_EB1] &= ~0x02; | 119 | regs[R_EB1] &= ~0x02; |
@@ -130,25 +125,40 @@ static int tda18271_channel_configuration(struct dvb_frontend *fe, | |||
130 | 125 | ||
131 | /* --------------------------------------------------------------- */ | 126 | /* --------------------------------------------------------------- */ |
132 | 127 | ||
133 | N = freq + ifc; | 128 | N = map->if_freq * 1000 + freq; |
134 | 129 | ||
135 | /* FIXME: assumes master */ | 130 | switch (priv->role) { |
136 | tda18271_calc_main_pll(fe, N); | 131 | case TDA18271_MASTER: |
137 | tda18271_write_regs(fe, R_MPD, 4); | 132 | tda18271_calc_main_pll(fe, N); |
133 | tda18271_write_regs(fe, R_MPD, 4); | ||
134 | break; | ||
135 | case TDA18271_SLAVE: | ||
136 | tda18271_calc_cal_pll(fe, N); | ||
137 | tda18271_write_regs(fe, R_CPD, 4); | ||
138 | |||
139 | regs[R_MPD] = regs[R_CPD] & 0x7f; | ||
140 | tda18271_write_regs(fe, R_MPD, 1); | ||
141 | break; | ||
142 | } | ||
138 | 143 | ||
139 | tda18271_write_regs(fe, R_TM, 7); | 144 | tda18271_write_regs(fe, R_TM, 7); |
140 | 145 | ||
141 | /* main pll charge pump source */ | 146 | /* force charge pump source */ |
142 | regs[R_EB4] |= 0x20; | 147 | charge_pump_source(fe, 1); |
143 | tda18271_write_regs(fe, R_EB4, 1); | ||
144 | 148 | ||
145 | msleep(1); | 149 | msleep(1); |
146 | 150 | ||
147 | /* normal operation for the main pll */ | 151 | /* return pll to normal operation */ |
148 | regs[R_EB4] &= ~0x20; | 152 | charge_pump_source(fe, 0); |
149 | tda18271_write_regs(fe, R_EB4, 1); | ||
150 | 153 | ||
151 | msleep(5); | 154 | msleep(20); |
155 | |||
156 | /* set rfagc to normal speed mode */ | ||
157 | if (map->fm_rfn) | ||
158 | regs[R_EP3] &= ~0x04; | ||
159 | else | ||
160 | regs[R_EP3] |= 0x04; | ||
161 | tda18271_write_regs(fe, R_EP3, 1); | ||
152 | 162 | ||
153 | return 0; | 163 | return 0; |
154 | } | 164 | } |
@@ -195,8 +205,10 @@ static int tda18271_read_thermometer(struct dvb_frontend *fe) | |||
195 | return tm; | 205 | return tm; |
196 | } | 206 | } |
197 | 207 | ||
198 | static int tda18271_rf_tracking_filters_correction(struct dvb_frontend *fe, | 208 | /* ------------------------------------------------------------------ */ |
199 | u32 freq) | 209 | |
210 | static int tda18271c2_rf_tracking_filters_correction(struct dvb_frontend *fe, | ||
211 | u32 freq) | ||
200 | { | 212 | { |
201 | struct tda18271_priv *priv = fe->tuner_priv; | 213 | struct tda18271_priv *priv = fe->tuner_priv; |
202 | struct tda18271_rf_tracking_filter_cal *map = priv->rf_cal_state; | 214 | struct tda18271_rf_tracking_filter_cal *map = priv->rf_cal_state; |
@@ -296,12 +308,10 @@ static int tda18271_calibrate_rf(struct dvb_frontend *fe, u32 freq) | |||
296 | tda18271_write_regs(fe, R_EB13, 1); | 308 | tda18271_write_regs(fe, R_EB13, 1); |
297 | 309 | ||
298 | /* main pll charge pump source */ | 310 | /* main pll charge pump source */ |
299 | regs[R_EB4] |= 0x20; | 311 | tda18271_charge_pump_source(fe, TDA18271_MAIN_PLL, 1); |
300 | tda18271_write_regs(fe, R_EB4, 1); | ||
301 | 312 | ||
302 | /* cal pll charge pump source */ | 313 | /* cal pll charge pump source */ |
303 | regs[R_EB7] |= 0x20; | 314 | tda18271_charge_pump_source(fe, TDA18271_CAL_PLL, 1); |
304 | tda18271_write_regs(fe, R_EB7, 1); | ||
305 | 315 | ||
306 | /* force dcdc converter to 0 V */ | 316 | /* force dcdc converter to 0 V */ |
307 | regs[R_EB14] = 0x00; | 317 | regs[R_EB14] = 0x00; |
@@ -320,8 +330,8 @@ static int tda18271_calibrate_rf(struct dvb_frontend *fe, u32 freq) | |||
320 | /* set the internal calibration signal */ | 330 | /* set the internal calibration signal */ |
321 | N = freq; | 331 | N = freq; |
322 | 332 | ||
323 | tda18271_calc_main_pll(fe, N); | 333 | tda18271_calc_cal_pll(fe, N); |
324 | tda18271_write_regs(fe, R_MPD, 4); | 334 | tda18271_write_regs(fe, R_CPD, 4); |
325 | 335 | ||
326 | /* downconvert internal calibration */ | 336 | /* downconvert internal calibration */ |
327 | N += 1000000; | 337 | N += 1000000; |
@@ -339,14 +349,12 @@ static int tda18271_calibrate_rf(struct dvb_frontend *fe, u32 freq) | |||
339 | /* --------------------------------------------------------------- */ | 349 | /* --------------------------------------------------------------- */ |
340 | 350 | ||
341 | /* normal operation for the main pll */ | 351 | /* normal operation for the main pll */ |
342 | regs[R_EB4] &= ~0x20; | 352 | tda18271_charge_pump_source(fe, TDA18271_MAIN_PLL, 0); |
343 | tda18271_write_regs(fe, R_EB4, 1); | ||
344 | 353 | ||
345 | /* normal operation for the cal pll */ | 354 | /* normal operation for the cal pll */ |
346 | regs[R_EB7] &= ~0x20; | 355 | tda18271_charge_pump_source(fe, TDA18271_CAL_PLL, 0); |
347 | tda18271_write_regs(fe, R_EB7, 1); | ||
348 | 356 | ||
349 | msleep(5); /* plls locking */ | 357 | msleep(10); /* plls locking */ |
350 | 358 | ||
351 | /* launch the rf tracking filters calibration */ | 359 | /* launch the rf tracking filters calibration */ |
352 | regs[R_EB20] |= 0x20; | 360 | regs[R_EB20] |= 0x20; |
@@ -443,7 +451,7 @@ static int tda18271_powerscan(struct dvb_frontend *fe, | |||
443 | 451 | ||
444 | count += 200; | 452 | count += 200; |
445 | 453 | ||
446 | if (count < count_limit) | 454 | if (count <= count_limit) |
447 | continue; | 455 | continue; |
448 | 456 | ||
449 | if (sgn <= 0) | 457 | if (sgn <= 0) |
@@ -587,7 +595,7 @@ static int tda18271_calc_rf_filter_curve(struct dvb_frontend *fe) | |||
587 | 595 | ||
588 | /* ------------------------------------------------------------------ */ | 596 | /* ------------------------------------------------------------------ */ |
589 | 597 | ||
590 | static int tda18271_rf_cal_init(struct dvb_frontend *fe) | 598 | static int tda18271c2_rf_cal_init(struct dvb_frontend *fe) |
591 | { | 599 | { |
592 | struct tda18271_priv *priv = fe->tuner_priv; | 600 | struct tda18271_priv *priv = fe->tuner_priv; |
593 | unsigned char *regs = priv->tda18271_regs; | 601 | unsigned char *regs = priv->tda18271_regs; |
@@ -610,63 +618,13 @@ static int tda18271_rf_cal_init(struct dvb_frontend *fe) | |||
610 | return 0; | 618 | return 0; |
611 | } | 619 | } |
612 | 620 | ||
613 | static int tda18271_init(struct dvb_frontend *fe) | 621 | static int tda18271c1_rf_tracking_filter_calibration(struct dvb_frontend *fe, |
614 | { | 622 | u32 freq, u32 bw) |
615 | struct tda18271_priv *priv = fe->tuner_priv; | ||
616 | |||
617 | mutex_lock(&priv->lock); | ||
618 | |||
619 | /* power up */ | ||
620 | tda18271_set_standby_mode(fe, 0, 0, 0); | ||
621 | |||
622 | /* initialization */ | ||
623 | tda18271_ir_cal_init(fe); | ||
624 | |||
625 | if (priv->id == TDA18271HDC2) | ||
626 | tda18271_rf_cal_init(fe); | ||
627 | |||
628 | mutex_unlock(&priv->lock); | ||
629 | |||
630 | return 0; | ||
631 | } | ||
632 | |||
633 | static int tda18271c2_tune(struct dvb_frontend *fe, | ||
634 | u32 ifc, u32 freq, u32 bw, u8 std, int radio) | ||
635 | { | ||
636 | struct tda18271_priv *priv = fe->tuner_priv; | ||
637 | |||
638 | tda_dbg("freq = %d, ifc = %d\n", freq, ifc); | ||
639 | |||
640 | tda18271_init(fe); | ||
641 | |||
642 | mutex_lock(&priv->lock); | ||
643 | |||
644 | tda18271_rf_tracking_filters_correction(fe, freq); | ||
645 | |||
646 | tda18271_channel_configuration(fe, ifc, freq, bw, std, radio); | ||
647 | |||
648 | mutex_unlock(&priv->lock); | ||
649 | |||
650 | return 0; | ||
651 | } | ||
652 | |||
653 | /* ------------------------------------------------------------------ */ | ||
654 | |||
655 | static int tda18271c1_tune(struct dvb_frontend *fe, | ||
656 | u32 ifc, u32 freq, u32 bw, u8 std, int radio) | ||
657 | { | 623 | { |
658 | struct tda18271_priv *priv = fe->tuner_priv; | 624 | struct tda18271_priv *priv = fe->tuner_priv; |
659 | unsigned char *regs = priv->tda18271_regs; | 625 | unsigned char *regs = priv->tda18271_regs; |
660 | u32 N = 0; | 626 | u32 N = 0; |
661 | 627 | ||
662 | tda18271_init(fe); | ||
663 | |||
664 | mutex_lock(&priv->lock); | ||
665 | |||
666 | tda_dbg("freq = %d, ifc = %d\n", freq, ifc); | ||
667 | |||
668 | /* RF tracking filter calibration */ | ||
669 | |||
670 | /* calculate bp filter */ | 628 | /* calculate bp filter */ |
671 | tda18271_calc_bp_filter(fe, &freq); | 629 | tda18271_calc_bp_filter(fe, &freq); |
672 | tda18271_write_regs(fe, R_EP1, 1); | 630 | tda18271_write_regs(fe, R_EP1, 1); |
@@ -737,7 +695,7 @@ static int tda18271c1_tune(struct dvb_frontend *fe, | |||
737 | 695 | ||
738 | regs[R_EB7] = 0x40; | 696 | regs[R_EB7] = 0x40; |
739 | tda18271_write_regs(fe, R_EB7, 1); | 697 | tda18271_write_regs(fe, R_EB7, 1); |
740 | msleep(10); | 698 | msleep(10); /* pll locking */ |
741 | 699 | ||
742 | regs[R_EB20] = 0xec; | 700 | regs[R_EB20] = 0xec; |
743 | tda18271_write_regs(fe, R_EB20, 1); | 701 | tda18271_write_regs(fe, R_EB20, 1); |
@@ -752,74 +710,70 @@ static int tda18271c1_tune(struct dvb_frontend *fe, | |||
752 | if (0 == tda18271_calc_rf_cal(fe, &freq)) | 710 | if (0 == tda18271_calc_rf_cal(fe, &freq)) |
753 | tda18271_write_regs(fe, R_EB14, 1); | 711 | tda18271_write_regs(fe, R_EB14, 1); |
754 | 712 | ||
755 | /* Channel Configuration */ | 713 | return 0; |
714 | } | ||
756 | 715 | ||
757 | switch (priv->mode) { | 716 | /* ------------------------------------------------------------------ */ |
758 | case TDA18271_ANALOG: | ||
759 | regs[R_EB22] = 0x2c; | ||
760 | break; | ||
761 | case TDA18271_DIGITAL: | ||
762 | regs[R_EB22] = 0x37; | ||
763 | break; | ||
764 | } | ||
765 | tda18271_write_regs(fe, R_EB22, 1); | ||
766 | 717 | ||
767 | regs[R_EP1] |= 0x40; /* set dis power level on */ | 718 | static int tda18271_ir_cal_init(struct dvb_frontend *fe) |
719 | { | ||
720 | struct tda18271_priv *priv = fe->tuner_priv; | ||
721 | unsigned char *regs = priv->tda18271_regs; | ||
768 | 722 | ||
769 | /* set standard */ | 723 | tda18271_read_regs(fe); |
770 | regs[R_EP3] &= ~0x1f; /* clear std bits */ | ||
771 | 724 | ||
772 | /* see table 22 */ | 725 | /* test IR_CAL_OK to see if we need init */ |
773 | regs[R_EP3] |= std; | 726 | if ((regs[R_EP1] & 0x08) == 0) |
727 | tda18271_init_regs(fe); | ||
774 | 728 | ||
775 | regs[R_EP4] &= ~0x03; /* set cal mode to normal */ | 729 | return 0; |
730 | } | ||
776 | 731 | ||
777 | regs[R_EP4] &= ~0x1c; /* clear if level bits */ | 732 | static int tda18271_init(struct dvb_frontend *fe) |
778 | switch (priv->mode) { | 733 | { |
779 | case TDA18271_ANALOG: | 734 | struct tda18271_priv *priv = fe->tuner_priv; |
780 | regs[R_MPD] &= ~0x80; /* IF notch = 0 */ | ||
781 | break; | ||
782 | case TDA18271_DIGITAL: | ||
783 | regs[R_EP4] |= 0x04; | ||
784 | regs[R_MPD] |= 0x80; | ||
785 | break; | ||
786 | } | ||
787 | 735 | ||
788 | if (radio) | 736 | mutex_lock(&priv->lock); |
789 | regs[R_EP4] |= 0x80; | ||
790 | else | ||
791 | regs[R_EP4] &= ~0x80; | ||
792 | 737 | ||
793 | /* image rejection validity */ | 738 | /* power up */ |
794 | tda18271_calc_ir_measure(fe, &freq); | 739 | tda18271_set_standby_mode(fe, 0, 0, 0); |
795 | 740 | ||
796 | /* calculate MAIN PLL */ | 741 | /* initialization */ |
797 | N = freq + ifc; | 742 | tda18271_ir_cal_init(fe); |
798 | 743 | ||
799 | tda18271_calc_main_pll(fe, N); | 744 | if (priv->id == TDA18271HDC2) |
745 | tda18271c2_rf_cal_init(fe); | ||
800 | 746 | ||
801 | tda18271_write_regs(fe, R_TM, 15); | ||
802 | msleep(5); | ||
803 | mutex_unlock(&priv->lock); | 747 | mutex_unlock(&priv->lock); |
804 | 748 | ||
805 | return 0; | 749 | return 0; |
806 | } | 750 | } |
807 | 751 | ||
808 | static inline int tda18271_tune(struct dvb_frontend *fe, | 752 | static int tda18271_tune(struct dvb_frontend *fe, |
809 | u32 ifc, u32 freq, u32 bw, u8 std, int radio) | 753 | struct tda18271_std_map_item *map, u32 freq, u32 bw) |
810 | { | 754 | { |
811 | struct tda18271_priv *priv = fe->tuner_priv; | 755 | struct tda18271_priv *priv = fe->tuner_priv; |
812 | int ret = -EINVAL; | 756 | |
757 | tda_dbg("freq = %d, ifc = %d, bw = %d, agc_mode = %d, std = %d\n", | ||
758 | freq, map->if_freq, bw, map->agc_mode, map->std); | ||
759 | |||
760 | tda18271_init(fe); | ||
761 | |||
762 | mutex_lock(&priv->lock); | ||
813 | 763 | ||
814 | switch (priv->id) { | 764 | switch (priv->id) { |
815 | case TDA18271HDC1: | 765 | case TDA18271HDC1: |
816 | ret = tda18271c1_tune(fe, ifc, freq, bw, std, radio); | 766 | tda18271c1_rf_tracking_filter_calibration(fe, freq, bw); |
817 | break; | 767 | break; |
818 | case TDA18271HDC2: | 768 | case TDA18271HDC2: |
819 | ret = tda18271c2_tune(fe, ifc, freq, bw, std, radio); | 769 | tda18271c2_rf_tracking_filters_correction(fe, freq); |
820 | break; | 770 | break; |
821 | } | 771 | } |
822 | return ret; | 772 | tda18271_channel_configuration(fe, map, freq, bw); |
773 | |||
774 | mutex_unlock(&priv->lock); | ||
775 | |||
776 | return 0; | ||
823 | } | 777 | } |
824 | 778 | ||
825 | /* ------------------------------------------------------------------ */ | 779 | /* ------------------------------------------------------------------ */ |
@@ -829,9 +783,8 @@ static int tda18271_set_params(struct dvb_frontend *fe, | |||
829 | { | 783 | { |
830 | struct tda18271_priv *priv = fe->tuner_priv; | 784 | struct tda18271_priv *priv = fe->tuner_priv; |
831 | struct tda18271_std_map *std_map = &priv->std; | 785 | struct tda18271_std_map *std_map = &priv->std; |
786 | struct tda18271_std_map_item *map; | ||
832 | int ret; | 787 | int ret; |
833 | u8 std; | ||
834 | u16 sgIF; | ||
835 | u32 bw, freq = params->frequency; | 788 | u32 bw, freq = params->frequency; |
836 | 789 | ||
837 | priv->mode = TDA18271_DIGITAL; | 790 | priv->mode = TDA18271_DIGITAL; |
@@ -840,13 +793,11 @@ static int tda18271_set_params(struct dvb_frontend *fe, | |||
840 | switch (params->u.vsb.modulation) { | 793 | switch (params->u.vsb.modulation) { |
841 | case VSB_8: | 794 | case VSB_8: |
842 | case VSB_16: | 795 | case VSB_16: |
843 | std = std_map->atsc_6.std_bits; | 796 | map = &std_map->atsc_6; |
844 | sgIF = std_map->atsc_6.if_freq; | ||
845 | break; | 797 | break; |
846 | case QAM_64: | 798 | case QAM_64: |
847 | case QAM_256: | 799 | case QAM_256: |
848 | std = std_map->qam_6.std_bits; | 800 | map = &std_map->qam_6; |
849 | sgIF = std_map->qam_6.if_freq; | ||
850 | break; | 801 | break; |
851 | default: | 802 | default: |
852 | tda_warn("modulation not set!\n"); | 803 | tda_warn("modulation not set!\n"); |
@@ -861,18 +812,15 @@ static int tda18271_set_params(struct dvb_frontend *fe, | |||
861 | switch (params->u.ofdm.bandwidth) { | 812 | switch (params->u.ofdm.bandwidth) { |
862 | case BANDWIDTH_6_MHZ: | 813 | case BANDWIDTH_6_MHZ: |
863 | bw = 6000000; | 814 | bw = 6000000; |
864 | std = std_map->dvbt_6.std_bits; | 815 | map = &std_map->dvbt_6; |
865 | sgIF = std_map->dvbt_6.if_freq; | ||
866 | break; | 816 | break; |
867 | case BANDWIDTH_7_MHZ: | 817 | case BANDWIDTH_7_MHZ: |
868 | bw = 7000000; | 818 | bw = 7000000; |
869 | std = std_map->dvbt_7.std_bits; | 819 | map = &std_map->dvbt_7; |
870 | sgIF = std_map->dvbt_7.if_freq; | ||
871 | break; | 820 | break; |
872 | case BANDWIDTH_8_MHZ: | 821 | case BANDWIDTH_8_MHZ: |
873 | bw = 8000000; | 822 | bw = 8000000; |
874 | std = std_map->dvbt_8.std_bits; | 823 | map = &std_map->dvbt_8; |
875 | sgIF = std_map->dvbt_8.if_freq; | ||
876 | break; | 824 | break; |
877 | default: | 825 | default: |
878 | tda_warn("bandwidth not set!\n"); | 826 | tda_warn("bandwidth not set!\n"); |
@@ -887,7 +835,7 @@ static int tda18271_set_params(struct dvb_frontend *fe, | |||
887 | if (fe->ops.analog_ops.standby) | 835 | if (fe->ops.analog_ops.standby) |
888 | fe->ops.analog_ops.standby(fe); | 836 | fe->ops.analog_ops.standby(fe); |
889 | 837 | ||
890 | ret = tda18271_tune(fe, sgIF * 1000, freq, bw, std, 0); | 838 | ret = tda18271_tune(fe, map, freq, bw); |
891 | 839 | ||
892 | if (ret < 0) | 840 | if (ret < 0) |
893 | goto fail; | 841 | goto fail; |
@@ -904,57 +852,46 @@ static int tda18271_set_analog_params(struct dvb_frontend *fe, | |||
904 | { | 852 | { |
905 | struct tda18271_priv *priv = fe->tuner_priv; | 853 | struct tda18271_priv *priv = fe->tuner_priv; |
906 | struct tda18271_std_map *std_map = &priv->std; | 854 | struct tda18271_std_map *std_map = &priv->std; |
855 | struct tda18271_std_map_item *map; | ||
907 | char *mode; | 856 | char *mode; |
908 | int ret, radio = 0; | 857 | int ret; |
909 | u8 std; | ||
910 | u16 sgIF; | ||
911 | u32 freq = params->frequency * 62500; | 858 | u32 freq = params->frequency * 62500; |
912 | 859 | ||
913 | priv->mode = TDA18271_ANALOG; | 860 | priv->mode = TDA18271_ANALOG; |
914 | 861 | ||
915 | if (params->mode == V4L2_TUNER_RADIO) { | 862 | if (params->mode == V4L2_TUNER_RADIO) { |
916 | radio = 1; | ||
917 | freq = freq / 1000; | 863 | freq = freq / 1000; |
918 | std = std_map->fm_radio.std_bits; | 864 | map = &std_map->fm_radio; |
919 | sgIF = std_map->fm_radio.if_freq; | ||
920 | mode = "fm"; | 865 | mode = "fm"; |
921 | } else if (params->std & V4L2_STD_MN) { | 866 | } else if (params->std & V4L2_STD_MN) { |
922 | std = std_map->atv_mn.std_bits; | 867 | map = &std_map->atv_mn; |
923 | sgIF = std_map->atv_mn.if_freq; | ||
924 | mode = "MN"; | 868 | mode = "MN"; |
925 | } else if (params->std & V4L2_STD_B) { | 869 | } else if (params->std & V4L2_STD_B) { |
926 | std = std_map->atv_b.std_bits; | 870 | map = &std_map->atv_b; |
927 | sgIF = std_map->atv_b.if_freq; | ||
928 | mode = "B"; | 871 | mode = "B"; |
929 | } else if (params->std & V4L2_STD_GH) { | 872 | } else if (params->std & V4L2_STD_GH) { |
930 | std = std_map->atv_gh.std_bits; | 873 | map = &std_map->atv_gh; |
931 | sgIF = std_map->atv_gh.if_freq; | ||
932 | mode = "GH"; | 874 | mode = "GH"; |
933 | } else if (params->std & V4L2_STD_PAL_I) { | 875 | } else if (params->std & V4L2_STD_PAL_I) { |
934 | std = std_map->atv_i.std_bits; | 876 | map = &std_map->atv_i; |
935 | sgIF = std_map->atv_i.if_freq; | ||
936 | mode = "I"; | 877 | mode = "I"; |
937 | } else if (params->std & V4L2_STD_DK) { | 878 | } else if (params->std & V4L2_STD_DK) { |
938 | std = std_map->atv_dk.std_bits; | 879 | map = &std_map->atv_dk; |
939 | sgIF = std_map->atv_dk.if_freq; | ||
940 | mode = "DK"; | 880 | mode = "DK"; |
941 | } else if (params->std & V4L2_STD_SECAM_L) { | 881 | } else if (params->std & V4L2_STD_SECAM_L) { |
942 | std = std_map->atv_l.std_bits; | 882 | map = &std_map->atv_l; |
943 | sgIF = std_map->atv_l.if_freq; | ||
944 | mode = "L"; | 883 | mode = "L"; |
945 | } else if (params->std & V4L2_STD_SECAM_LC) { | 884 | } else if (params->std & V4L2_STD_SECAM_LC) { |
946 | std = std_map->atv_lc.std_bits; | 885 | map = &std_map->atv_lc; |
947 | sgIF = std_map->atv_lc.if_freq; | ||
948 | mode = "L'"; | 886 | mode = "L'"; |
949 | } else { | 887 | } else { |
950 | std = std_map->atv_i.std_bits; | 888 | map = &std_map->atv_i; |
951 | sgIF = std_map->atv_i.if_freq; | ||
952 | mode = "xx"; | 889 | mode = "xx"; |
953 | } | 890 | } |
954 | 891 | ||
955 | tda_dbg("setting tda18271 to system %s\n", mode); | 892 | tda_dbg("setting tda18271 to system %s\n", mode); |
956 | 893 | ||
957 | ret = tda18271_tune(fe, sgIF * 1000, freq, 0, std, radio); | 894 | ret = tda18271_tune(fe, map, freq, 0); |
958 | 895 | ||
959 | if (ret < 0) | 896 | if (ret < 0) |
960 | goto fail; | 897 | goto fail; |
@@ -986,16 +923,9 @@ static int tda18271_release(struct dvb_frontend *fe) | |||
986 | 923 | ||
987 | mutex_lock(&tda18271_list_mutex); | 924 | mutex_lock(&tda18271_list_mutex); |
988 | 925 | ||
989 | priv->count--; | 926 | if (priv) |
927 | hybrid_tuner_release_state(priv); | ||
990 | 928 | ||
991 | if (!priv->count) { | ||
992 | tda_dbg("destroying instance @ %d-%04x\n", | ||
993 | i2c_adapter_id(priv->i2c_adap), | ||
994 | priv->i2c_addr); | ||
995 | list_del(&priv->tda18271_list); | ||
996 | |||
997 | kfree(priv); | ||
998 | } | ||
999 | mutex_unlock(&tda18271_list_mutex); | 929 | mutex_unlock(&tda18271_list_mutex); |
1000 | 930 | ||
1001 | fe->tuner_priv = NULL; | 931 | fe->tuner_priv = NULL; |
@@ -1020,15 +950,20 @@ static int tda18271_get_bandwidth(struct dvb_frontend *fe, u32 *bandwidth) | |||
1020 | /* ------------------------------------------------------------------ */ | 950 | /* ------------------------------------------------------------------ */ |
1021 | 951 | ||
1022 | #define tda18271_update_std(std_cfg, name) do { \ | 952 | #define tda18271_update_std(std_cfg, name) do { \ |
1023 | if (map->std_cfg.if_freq + map->std_cfg.std_bits > 0) { \ | 953 | if (map->std_cfg.if_freq + \ |
954 | map->std_cfg.agc_mode + map->std_cfg.std + \ | ||
955 | map->std_cfg.if_lvl + map->std_cfg.rfagc_top > 0) { \ | ||
1024 | tda_dbg("Using custom std config for %s\n", name); \ | 956 | tda_dbg("Using custom std config for %s\n", name); \ |
1025 | memcpy(&std->std_cfg, &map->std_cfg, \ | 957 | memcpy(&std->std_cfg, &map->std_cfg, \ |
1026 | sizeof(struct tda18271_std_map_item)); \ | 958 | sizeof(struct tda18271_std_map_item)); \ |
1027 | } } while (0) | 959 | } } while (0) |
1028 | 960 | ||
1029 | #define tda18271_dump_std_item(std_cfg, name) do { \ | 961 | #define tda18271_dump_std_item(std_cfg, name) do { \ |
1030 | tda_dbg("(%s) if freq = %d, std bits = 0x%02x\n", \ | 962 | tda_dbg("(%s) if_freq = %d, agc_mode = %d, std = %d, " \ |
1031 | name, std->std_cfg.if_freq, std->std_cfg.std_bits); \ | 963 | "if_lvl = %d, rfagc_top = 0x%02x\n", \ |
964 | name, std->std_cfg.if_freq, \ | ||
965 | std->std_cfg.agc_mode, std->std_cfg.std, \ | ||
966 | std->std_cfg.if_lvl, std->std_cfg.rfagc_top); \ | ||
1032 | } while (0) | 967 | } while (0) |
1033 | 968 | ||
1034 | static int tda18271_dump_std_map(struct dvb_frontend *fe) | 969 | static int tda18271_dump_std_map(struct dvb_frontend *fe) |
@@ -1037,20 +972,20 @@ static int tda18271_dump_std_map(struct dvb_frontend *fe) | |||
1037 | struct tda18271_std_map *std = &priv->std; | 972 | struct tda18271_std_map *std = &priv->std; |
1038 | 973 | ||
1039 | tda_dbg("========== STANDARD MAP SETTINGS ==========\n"); | 974 | tda_dbg("========== STANDARD MAP SETTINGS ==========\n"); |
1040 | tda18271_dump_std_item(fm_radio, "fm"); | 975 | tda18271_dump_std_item(fm_radio, " fm "); |
1041 | tda18271_dump_std_item(atv_b, "pal b"); | 976 | tda18271_dump_std_item(atv_b, "atv b "); |
1042 | tda18271_dump_std_item(atv_dk, "pal dk"); | 977 | tda18271_dump_std_item(atv_dk, "atv dk"); |
1043 | tda18271_dump_std_item(atv_gh, "pal gh"); | 978 | tda18271_dump_std_item(atv_gh, "atv gh"); |
1044 | tda18271_dump_std_item(atv_i, "pal i"); | 979 | tda18271_dump_std_item(atv_i, "atv i "); |
1045 | tda18271_dump_std_item(atv_l, "pal l"); | 980 | tda18271_dump_std_item(atv_l, "atv l "); |
1046 | tda18271_dump_std_item(atv_lc, "pal l'"); | 981 | tda18271_dump_std_item(atv_lc, "atv l'"); |
1047 | tda18271_dump_std_item(atv_mn, "atv mn"); | 982 | tda18271_dump_std_item(atv_mn, "atv mn"); |
1048 | tda18271_dump_std_item(atsc_6, "atsc 6"); | 983 | tda18271_dump_std_item(atsc_6, "atsc 6"); |
1049 | tda18271_dump_std_item(dvbt_6, "dvbt 6"); | 984 | tda18271_dump_std_item(dvbt_6, "dvbt 6"); |
1050 | tda18271_dump_std_item(dvbt_7, "dvbt 7"); | 985 | tda18271_dump_std_item(dvbt_7, "dvbt 7"); |
1051 | tda18271_dump_std_item(dvbt_8, "dvbt 8"); | 986 | tda18271_dump_std_item(dvbt_8, "dvbt 8"); |
1052 | tda18271_dump_std_item(qam_6, "qam 6"); | 987 | tda18271_dump_std_item(qam_6, "qam 6 "); |
1053 | tda18271_dump_std_item(qam_8, "qam 8"); | 988 | tda18271_dump_std_item(qam_8, "qam 8 "); |
1054 | 989 | ||
1055 | return 0; | 990 | return 0; |
1056 | } | 991 | } |
@@ -1109,7 +1044,8 @@ static int tda18271_get_id(struct dvb_frontend *fe) | |||
1109 | } | 1044 | } |
1110 | 1045 | ||
1111 | tda_info("%s detected @ %d-%04x%s\n", name, | 1046 | tda_info("%s detected @ %d-%04x%s\n", name, |
1112 | i2c_adapter_id(priv->i2c_adap), priv->i2c_addr, | 1047 | i2c_adapter_id(priv->i2c_props.adap), |
1048 | priv->i2c_props.addr, | ||
1113 | (0 == ret) ? "" : ", device not supported."); | 1049 | (0 == ret) ? "" : ", device not supported."); |
1114 | 1050 | ||
1115 | return ret; | 1051 | return ret; |
@@ -1136,45 +1072,28 @@ struct dvb_frontend *tda18271_attach(struct dvb_frontend *fe, u8 addr, | |||
1136 | struct tda18271_config *cfg) | 1072 | struct tda18271_config *cfg) |
1137 | { | 1073 | { |
1138 | struct tda18271_priv *priv = NULL; | 1074 | struct tda18271_priv *priv = NULL; |
1139 | int state_found = 0; | 1075 | int instance; |
1140 | 1076 | ||
1141 | mutex_lock(&tda18271_list_mutex); | 1077 | mutex_lock(&tda18271_list_mutex); |
1142 | 1078 | ||
1143 | list_for_each_entry(priv, &tda18271_list, tda18271_list) { | 1079 | instance = hybrid_tuner_request_state(struct tda18271_priv, priv, |
1144 | if ((i2c_adapter_id(priv->i2c_adap) == i2c_adapter_id(i2c)) && | 1080 | hybrid_tuner_instance_list, |
1145 | (priv->i2c_addr == addr)) { | 1081 | i2c, addr, "tda18271"); |
1146 | tda_dbg("attaching existing tuner @ %d-%04x\n", | 1082 | switch (instance) { |
1147 | i2c_adapter_id(priv->i2c_adap), | 1083 | case 0: |
1148 | priv->i2c_addr); | 1084 | goto fail; |
1149 | priv->count++; | 1085 | break; |
1150 | fe->tuner_priv = priv; | 1086 | case 1: |
1151 | state_found = 1; | 1087 | /* new tuner instance */ |
1152 | /* allow dvb driver to override i2c gate setting */ | ||
1153 | if ((cfg) && (cfg->gate != TDA18271_GATE_ANALOG)) | ||
1154 | priv->gate = cfg->gate; | ||
1155 | break; | ||
1156 | } | ||
1157 | } | ||
1158 | if (state_found == 0) { | ||
1159 | tda_dbg("creating new tuner instance @ %d-%04x\n", | ||
1160 | i2c_adapter_id(i2c), addr); | ||
1161 | |||
1162 | priv = kzalloc(sizeof(struct tda18271_priv), GFP_KERNEL); | ||
1163 | if (priv == NULL) { | ||
1164 | mutex_unlock(&tda18271_list_mutex); | ||
1165 | return NULL; | ||
1166 | } | ||
1167 | |||
1168 | priv->i2c_addr = addr; | ||
1169 | priv->i2c_adap = i2c; | ||
1170 | priv->gate = (cfg) ? cfg->gate : TDA18271_GATE_AUTO; | 1088 | priv->gate = (cfg) ? cfg->gate : TDA18271_GATE_AUTO; |
1089 | priv->role = (cfg) ? cfg->role : TDA18271_MASTER; | ||
1171 | priv->cal_initialized = false; | 1090 | priv->cal_initialized = false; |
1172 | mutex_init(&priv->lock); | 1091 | mutex_init(&priv->lock); |
1173 | priv->count++; | ||
1174 | 1092 | ||
1175 | fe->tuner_priv = priv; | 1093 | fe->tuner_priv = priv; |
1176 | 1094 | ||
1177 | list_add_tail(&priv->tda18271_list, &tda18271_list); | 1095 | if (cfg) |
1096 | priv->small_i2c = cfg->small_i2c; | ||
1178 | 1097 | ||
1179 | if (tda18271_get_id(fe) < 0) | 1098 | if (tda18271_get_id(fe) < 0) |
1180 | goto fail; | 1099 | goto fail; |
@@ -1186,9 +1105,18 @@ struct dvb_frontend *tda18271_attach(struct dvb_frontend *fe, u8 addr, | |||
1186 | tda18271_init_regs(fe); | 1105 | tda18271_init_regs(fe); |
1187 | 1106 | ||
1188 | if ((tda18271_cal_on_startup) && (priv->id == TDA18271HDC2)) | 1107 | if ((tda18271_cal_on_startup) && (priv->id == TDA18271HDC2)) |
1189 | tda18271_rf_cal_init(fe); | 1108 | tda18271c2_rf_cal_init(fe); |
1190 | 1109 | ||
1191 | mutex_unlock(&priv->lock); | 1110 | mutex_unlock(&priv->lock); |
1111 | break; | ||
1112 | default: | ||
1113 | /* existing tuner instance */ | ||
1114 | fe->tuner_priv = priv; | ||
1115 | |||
1116 | /* allow dvb driver to override i2c gate setting */ | ||
1117 | if ((cfg) && (cfg->gate != TDA18271_GATE_ANALOG)) | ||
1118 | priv->gate = cfg->gate; | ||
1119 | break; | ||
1192 | } | 1120 | } |
1193 | 1121 | ||
1194 | /* override default std map with values in config struct */ | 1122 | /* override default std map with values in config struct */ |
@@ -1200,7 +1128,7 @@ struct dvb_frontend *tda18271_attach(struct dvb_frontend *fe, u8 addr, | |||
1200 | memcpy(&fe->ops.tuner_ops, &tda18271_tuner_ops, | 1128 | memcpy(&fe->ops.tuner_ops, &tda18271_tuner_ops, |
1201 | sizeof(struct dvb_tuner_ops)); | 1129 | sizeof(struct dvb_tuner_ops)); |
1202 | 1130 | ||
1203 | if (tda18271_debug & DBG_MAP) | 1131 | if (tda18271_debug & (DBG_MAP | DBG_ADV)) |
1204 | tda18271_dump_std_map(fe); | 1132 | tda18271_dump_std_map(fe); |
1205 | 1133 | ||
1206 | return fe; | 1134 | return fe; |
@@ -1214,7 +1142,7 @@ EXPORT_SYMBOL_GPL(tda18271_attach); | |||
1214 | MODULE_DESCRIPTION("NXP TDA18271HD analog / digital tuner driver"); | 1142 | MODULE_DESCRIPTION("NXP TDA18271HD analog / digital tuner driver"); |
1215 | MODULE_AUTHOR("Michael Krufky <mkrufky@linuxtv.org>"); | 1143 | MODULE_AUTHOR("Michael Krufky <mkrufky@linuxtv.org>"); |
1216 | MODULE_LICENSE("GPL"); | 1144 | MODULE_LICENSE("GPL"); |
1217 | MODULE_VERSION("0.2"); | 1145 | MODULE_VERSION("0.3"); |
1218 | 1146 | ||
1219 | /* | 1147 | /* |
1220 | * Overrides for Emacs so that we follow Linus's tabbing style. | 1148 | * Overrides for Emacs so that we follow Linus's tabbing style. |
diff --git a/drivers/media/dvb/frontends/tda18271-priv.h b/drivers/media/dvb/frontends/tda18271-priv.h index 7b939a5325fb..2bc5eb368ea2 100644 --- a/drivers/media/dvb/frontends/tda18271-priv.h +++ b/drivers/media/dvb/frontends/tda18271-priv.h | |||
@@ -24,6 +24,7 @@ | |||
24 | #include <linux/kernel.h> | 24 | #include <linux/kernel.h> |
25 | #include <linux/types.h> | 25 | #include <linux/types.h> |
26 | #include <linux/mutex.h> | 26 | #include <linux/mutex.h> |
27 | #include "tuner-i2c.h" | ||
27 | #include "tda18271.h" | 28 | #include "tda18271.h" |
28 | 29 | ||
29 | #define R_ID 0x00 /* ID byte */ | 30 | #define R_ID 0x00 /* ID byte */ |
@@ -85,6 +86,11 @@ struct tda18271_rf_tracking_filter_cal { | |||
85 | int rf_b2; | 86 | int rf_b2; |
86 | }; | 87 | }; |
87 | 88 | ||
89 | enum tda18271_pll { | ||
90 | TDA18271_MAIN_PLL, | ||
91 | TDA18271_CAL_PLL, | ||
92 | }; | ||
93 | |||
88 | enum tda18271_mode { | 94 | enum tda18271_mode { |
89 | TDA18271_ANALOG, | 95 | TDA18271_ANALOG, |
90 | TDA18271_DIGITAL, | 96 | TDA18271_DIGITAL, |
@@ -98,19 +104,19 @@ enum tda18271_ver { | |||
98 | }; | 104 | }; |
99 | 105 | ||
100 | struct tda18271_priv { | 106 | struct tda18271_priv { |
101 | u8 i2c_addr; | ||
102 | struct i2c_adapter *i2c_adap; | ||
103 | unsigned char tda18271_regs[TDA18271_NUM_REGS]; | 107 | unsigned char tda18271_regs[TDA18271_NUM_REGS]; |
104 | 108 | ||
105 | struct list_head tda18271_list; | 109 | struct list_head hybrid_tuner_instance_list; |
110 | struct tuner_i2c_props i2c_props; | ||
106 | 111 | ||
107 | enum tda18271_mode mode; | 112 | enum tda18271_mode mode; |
113 | enum tda18271_role role; | ||
108 | enum tda18271_i2c_gate gate; | 114 | enum tda18271_i2c_gate gate; |
109 | enum tda18271_ver id; | 115 | enum tda18271_ver id; |
110 | 116 | ||
111 | unsigned int count; | ||
112 | unsigned int tm_rfcal; | 117 | unsigned int tm_rfcal; |
113 | unsigned int cal_initialized:1; | 118 | unsigned int cal_initialized:1; |
119 | unsigned int small_i2c:1; | ||
114 | 120 | ||
115 | struct tda18271_map_layout *maps; | 121 | struct tda18271_map_layout *maps; |
116 | struct tda18271_std_map std; | 122 | struct tda18271_std_map std; |
@@ -133,7 +139,7 @@ extern int tda18271_debug; | |||
133 | #define DBG_CAL 16 | 139 | #define DBG_CAL 16 |
134 | 140 | ||
135 | #define tda_printk(kern, fmt, arg...) \ | 141 | #define tda_printk(kern, fmt, arg...) \ |
136 | printk(kern "%s: " fmt, __FUNCTION__, ##arg) | 142 | printk(kern "%s: " fmt, __func__, ##arg) |
137 | 143 | ||
138 | #define dprintk(kern, lvl, fmt, arg...) do {\ | 144 | #define dprintk(kern, lvl, fmt, arg...) do {\ |
139 | if (tda18271_debug & lvl) \ | 145 | if (tda18271_debug & lvl) \ |
@@ -188,6 +194,8 @@ extern int tda18271_read_extended(struct dvb_frontend *fe); | |||
188 | extern int tda18271_write_regs(struct dvb_frontend *fe, int idx, int len); | 194 | extern int tda18271_write_regs(struct dvb_frontend *fe, int idx, int len); |
189 | extern int tda18271_init_regs(struct dvb_frontend *fe); | 195 | extern int tda18271_init_regs(struct dvb_frontend *fe); |
190 | 196 | ||
197 | extern int tda18271_charge_pump_source(struct dvb_frontend *fe, | ||
198 | enum tda18271_pll pll, int force); | ||
191 | extern int tda18271_set_standby_mode(struct dvb_frontend *fe, | 199 | extern int tda18271_set_standby_mode(struct dvb_frontend *fe, |
192 | int sm, int sm_lt, int sm_xt); | 200 | int sm, int sm_lt, int sm_xt); |
193 | 201 | ||
diff --git a/drivers/media/dvb/frontends/tda18271-tables.c b/drivers/media/dvb/frontends/tda18271-tables.c index e94afcfdc5bc..83e7561960c1 100644 --- a/drivers/media/dvb/frontends/tda18271-tables.c +++ b/drivers/media/dvb/frontends/tda18271-tables.c | |||
@@ -1187,37 +1187,65 @@ fail: | |||
1187 | /*---------------------------------------------------------------------*/ | 1187 | /*---------------------------------------------------------------------*/ |
1188 | 1188 | ||
1189 | static struct tda18271_std_map tda18271c1_std_map = { | 1189 | static struct tda18271_std_map tda18271c1_std_map = { |
1190 | .fm_radio = { .if_freq = 1250, .std_bits = 0x18 }, | 1190 | .fm_radio = { .if_freq = 1250, .fm_rfn = 1, .agc_mode = 3, .std = 0, |
1191 | .atv_b = { .if_freq = 6750, .std_bits = 0x0e }, | 1191 | .if_lvl = 0, .rfagc_top = 0x2c, }, /* EP3[4:0] 0x18 */ |
1192 | .atv_dk = { .if_freq = 7750, .std_bits = 0x0f }, | 1192 | .atv_b = { .if_freq = 6750, .fm_rfn = 0, .agc_mode = 1, .std = 6, |
1193 | .atv_gh = { .if_freq = 7750, .std_bits = 0x0f }, | 1193 | .if_lvl = 0, .rfagc_top = 0x2c, }, /* EP3[4:0] 0x0e */ |
1194 | .atv_i = { .if_freq = 7750, .std_bits = 0x0f }, | 1194 | .atv_dk = { .if_freq = 7750, .fm_rfn = 0, .agc_mode = 1, .std = 7, |
1195 | .atv_l = { .if_freq = 7750, .std_bits = 0x0f }, | 1195 | .if_lvl = 0, .rfagc_top = 0x2c, }, /* EP3[4:0] 0x0f */ |
1196 | .atv_lc = { .if_freq = 1250, .std_bits = 0x0f }, | 1196 | .atv_gh = { .if_freq = 7750, .fm_rfn = 0, .agc_mode = 1, .std = 7, |
1197 | .atv_mn = { .if_freq = 5750, .std_bits = 0x0d }, | 1197 | .if_lvl = 0, .rfagc_top = 0x2c, }, /* EP3[4:0] 0x0f */ |
1198 | .atsc_6 = { .if_freq = 3250, .std_bits = 0x1c }, | 1198 | .atv_i = { .if_freq = 7750, .fm_rfn = 0, .agc_mode = 1, .std = 7, |
1199 | .dvbt_6 = { .if_freq = 3300, .std_bits = 0x1c }, | 1199 | .if_lvl = 0, .rfagc_top = 0x2c, }, /* EP3[4:0] 0x0f */ |
1200 | .dvbt_7 = { .if_freq = 3800, .std_bits = 0x1d }, | 1200 | .atv_l = { .if_freq = 7750, .fm_rfn = 0, .agc_mode = 1, .std = 7, |
1201 | .dvbt_8 = { .if_freq = 4300, .std_bits = 0x1e }, | 1201 | .if_lvl = 0, .rfagc_top = 0x2c, }, /* EP3[4:0] 0x0f */ |
1202 | .qam_6 = { .if_freq = 4000, .std_bits = 0x1d }, | 1202 | .atv_lc = { .if_freq = 1250, .fm_rfn = 0, .agc_mode = 1, .std = 7, |
1203 | .qam_8 = { .if_freq = 5000, .std_bits = 0x1f }, | 1203 | .if_lvl = 0, .rfagc_top = 0x2c, }, /* EP3[4:0] 0x0f */ |
1204 | .atv_mn = { .if_freq = 5750, .fm_rfn = 0, .agc_mode = 1, .std = 5, | ||
1205 | .if_lvl = 0, .rfagc_top = 0x2c, }, /* EP3[4:0] 0x0d */ | ||
1206 | .atsc_6 = { .if_freq = 3250, .fm_rfn = 0, .agc_mode = 3, .std = 4, | ||
1207 | .if_lvl = 1, .rfagc_top = 0x37, }, /* EP3[4:0] 0x1c */ | ||
1208 | .dvbt_6 = { .if_freq = 3300, .fm_rfn = 0, .agc_mode = 3, .std = 4, | ||
1209 | .if_lvl = 1, .rfagc_top = 0x37, }, /* EP3[4:0] 0x1c */ | ||
1210 | .dvbt_7 = { .if_freq = 3800, .fm_rfn = 0, .agc_mode = 3, .std = 5, | ||
1211 | .if_lvl = 1, .rfagc_top = 0x37, }, /* EP3[4:0] 0x1d */ | ||
1212 | .dvbt_8 = { .if_freq = 4300, .fm_rfn = 0, .agc_mode = 3, .std = 6, | ||
1213 | .if_lvl = 1, .rfagc_top = 0x37, }, /* EP3[4:0] 0x1e */ | ||
1214 | .qam_6 = { .if_freq = 4000, .fm_rfn = 0, .agc_mode = 3, .std = 5, | ||
1215 | .if_lvl = 1, .rfagc_top = 0x37, }, /* EP3[4:0] 0x1d */ | ||
1216 | .qam_8 = { .if_freq = 5000, .fm_rfn = 0, .agc_mode = 3, .std = 7, | ||
1217 | .if_lvl = 1, .rfagc_top = 0x37, }, /* EP3[4:0] 0x1f */ | ||
1204 | }; | 1218 | }; |
1205 | 1219 | ||
1206 | static struct tda18271_std_map tda18271c2_std_map = { | 1220 | static struct tda18271_std_map tda18271c2_std_map = { |
1207 | .fm_radio = { .if_freq = 1250, .std_bits = 0x18 }, | 1221 | .fm_radio = { .if_freq = 1250, .fm_rfn = 1, .agc_mode = 3, .std = 0, |
1208 | .atv_b = { .if_freq = 6000, .std_bits = 0x0d }, | 1222 | .if_lvl = 0, .rfagc_top = 0x2c, }, /* EP3[4:0] 0x18 */ |
1209 | .atv_dk = { .if_freq = 6900, .std_bits = 0x0e }, | 1223 | .atv_b = { .if_freq = 6000, .fm_rfn = 0, .agc_mode = 1, .std = 5, |
1210 | .atv_gh = { .if_freq = 7100, .std_bits = 0x0e }, | 1224 | .if_lvl = 0, .rfagc_top = 0x2c, }, /* EP3[4:0] 0x0d */ |
1211 | .atv_i = { .if_freq = 7250, .std_bits = 0x0e }, | 1225 | .atv_dk = { .if_freq = 6900, .fm_rfn = 0, .agc_mode = 1, .std = 6, |
1212 | .atv_l = { .if_freq = 6900, .std_bits = 0x0e }, | 1226 | .if_lvl = 0, .rfagc_top = 0x2c, }, /* EP3[4:0] 0x0e */ |
1213 | .atv_lc = { .if_freq = 1250, .std_bits = 0x0e }, | 1227 | .atv_gh = { .if_freq = 7100, .fm_rfn = 0, .agc_mode = 1, .std = 6, |
1214 | .atv_mn = { .if_freq = 5400, .std_bits = 0x0c }, | 1228 | .if_lvl = 0, .rfagc_top = 0x2c, }, /* EP3[4:0] 0x0e */ |
1215 | .atsc_6 = { .if_freq = 3250, .std_bits = 0x1c }, | 1229 | .atv_i = { .if_freq = 7250, .fm_rfn = 0, .agc_mode = 1, .std = 6, |
1216 | .dvbt_6 = { .if_freq = 3300, .std_bits = 0x1c }, | 1230 | .if_lvl = 0, .rfagc_top = 0x2c, }, /* EP3[4:0] 0x0e */ |
1217 | .dvbt_7 = { .if_freq = 3500, .std_bits = 0x1c }, | 1231 | .atv_l = { .if_freq = 6900, .fm_rfn = 0, .agc_mode = 1, .std = 6, |
1218 | .dvbt_8 = { .if_freq = 4000, .std_bits = 0x1d }, | 1232 | .if_lvl = 0, .rfagc_top = 0x2c, }, /* EP3[4:0] 0x0e */ |
1219 | .qam_6 = { .if_freq = 4000, .std_bits = 0x1d }, | 1233 | .atv_lc = { .if_freq = 1250, .fm_rfn = 0, .agc_mode = 1, .std = 6, |
1220 | .qam_8 = { .if_freq = 5000, .std_bits = 0x1f }, | 1234 | .if_lvl = 0, .rfagc_top = 0x2c, }, /* EP3[4:0] 0x0e */ |
1235 | .atv_mn = { .if_freq = 5400, .fm_rfn = 0, .agc_mode = 1, .std = 4, | ||
1236 | .if_lvl = 0, .rfagc_top = 0x2c, }, /* EP3[4:0] 0x0c */ | ||
1237 | .atsc_6 = { .if_freq = 3250, .fm_rfn = 0, .agc_mode = 3, .std = 4, | ||
1238 | .if_lvl = 1, .rfagc_top = 0x37, }, /* EP3[4:0] 0x1c */ | ||
1239 | .dvbt_6 = { .if_freq = 3300, .fm_rfn = 0, .agc_mode = 3, .std = 4, | ||
1240 | .if_lvl = 1, .rfagc_top = 0x37, }, /* EP3[4:0] 0x1c */ | ||
1241 | .dvbt_7 = { .if_freq = 3500, .fm_rfn = 0, .agc_mode = 3, .std = 4, | ||
1242 | .if_lvl = 1, .rfagc_top = 0x37, }, /* EP3[4:0] 0x1c */ | ||
1243 | .dvbt_8 = { .if_freq = 4000, .fm_rfn = 0, .agc_mode = 3, .std = 5, | ||
1244 | .if_lvl = 1, .rfagc_top = 0x37, }, /* EP3[4:0] 0x1d */ | ||
1245 | .qam_6 = { .if_freq = 4000, .fm_rfn = 0, .agc_mode = 3, .std = 5, | ||
1246 | .if_lvl = 1, .rfagc_top = 0x37, }, /* EP3[4:0] 0x1d */ | ||
1247 | .qam_8 = { .if_freq = 5000, .fm_rfn = 0, .agc_mode = 3, .std = 7, | ||
1248 | .if_lvl = 1, .rfagc_top = 0x37, }, /* EP3[4:0] 0x1f */ | ||
1221 | }; | 1249 | }; |
1222 | 1250 | ||
1223 | /*---------------------------------------------------------------------*/ | 1251 | /*---------------------------------------------------------------------*/ |
diff --git a/drivers/media/dvb/frontends/tda18271.h b/drivers/media/dvb/frontends/tda18271.h index 24b0e35a2ab3..0e7af8d05a38 100644 --- a/drivers/media/dvb/frontends/tda18271.h +++ b/drivers/media/dvb/frontends/tda18271.h | |||
@@ -26,7 +26,17 @@ | |||
26 | 26 | ||
27 | struct tda18271_std_map_item { | 27 | struct tda18271_std_map_item { |
28 | u16 if_freq; | 28 | u16 if_freq; |
29 | u8 std_bits; | 29 | |
30 | /* EP3[4:3] */ | ||
31 | unsigned int agc_mode:2; | ||
32 | /* EP3[2:0] */ | ||
33 | unsigned int std:3; | ||
34 | /* EP4[7] */ | ||
35 | unsigned int fm_rfn:1; | ||
36 | /* EP4[4:2] */ | ||
37 | unsigned int if_lvl:3; | ||
38 | /* EB22[6:0] */ | ||
39 | unsigned int rfagc_top:7; | ||
30 | }; | 40 | }; |
31 | 41 | ||
32 | struct tda18271_std_map { | 42 | struct tda18271_std_map { |
@@ -46,6 +56,11 @@ struct tda18271_std_map { | |||
46 | struct tda18271_std_map_item qam_8; | 56 | struct tda18271_std_map_item qam_8; |
47 | }; | 57 | }; |
48 | 58 | ||
59 | enum tda18271_role { | ||
60 | TDA18271_MASTER = 0, | ||
61 | TDA18271_SLAVE, | ||
62 | }; | ||
63 | |||
49 | enum tda18271_i2c_gate { | 64 | enum tda18271_i2c_gate { |
50 | TDA18271_GATE_AUTO = 0, | 65 | TDA18271_GATE_AUTO = 0, |
51 | TDA18271_GATE_ANALOG, | 66 | TDA18271_GATE_ANALOG, |
@@ -56,8 +71,14 @@ struct tda18271_config { | |||
56 | /* override default if freq / std settings (optional) */ | 71 | /* override default if freq / std settings (optional) */ |
57 | struct tda18271_std_map *std_map; | 72 | struct tda18271_std_map *std_map; |
58 | 73 | ||
74 | /* master / slave tuner: master uses main pll, slave uses cal pll */ | ||
75 | enum tda18271_role role; | ||
76 | |||
59 | /* use i2c gate provided by analog or digital demod */ | 77 | /* use i2c gate provided by analog or digital demod */ |
60 | enum tda18271_i2c_gate gate; | 78 | enum tda18271_i2c_gate gate; |
79 | |||
80 | /* some i2c providers cant write all 39 registers at once */ | ||
81 | unsigned int small_i2c:1; | ||
61 | }; | 82 | }; |
62 | 83 | ||
63 | #if defined(CONFIG_DVB_TDA18271) || (defined(CONFIG_DVB_TDA18271_MODULE) && defined(MODULE)) | 84 | #if defined(CONFIG_DVB_TDA18271) || (defined(CONFIG_DVB_TDA18271_MODULE) && defined(MODULE)) |
@@ -70,7 +91,7 @@ static inline struct dvb_frontend *tda18271_attach(struct dvb_frontend *fe, | |||
70 | struct i2c_adapter *i2c, | 91 | struct i2c_adapter *i2c, |
71 | struct tda18271_config *cfg) | 92 | struct tda18271_config *cfg) |
72 | { | 93 | { |
73 | printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __FUNCTION__); | 94 | printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__); |
74 | return NULL; | 95 | return NULL; |
75 | } | 96 | } |
76 | #endif | 97 | #endif |
diff --git a/drivers/media/dvb/frontends/tda8083.c b/drivers/media/dvb/frontends/tda8083.c index 011b74f798a0..5b843b2e67e8 100644 --- a/drivers/media/dvb/frontends/tda8083.c +++ b/drivers/media/dvb/frontends/tda8083.c | |||
@@ -68,7 +68,7 @@ static int tda8083_writereg (struct tda8083_state* state, u8 reg, u8 data) | |||
68 | 68 | ||
69 | if (ret != 1) | 69 | if (ret != 1) |
70 | dprintk ("%s: writereg error (reg %02x, ret == %i)\n", | 70 | dprintk ("%s: writereg error (reg %02x, ret == %i)\n", |
71 | __FUNCTION__, reg, ret); | 71 | __func__, reg, ret); |
72 | 72 | ||
73 | return (ret != 1) ? -1 : 0; | 73 | return (ret != 1) ? -1 : 0; |
74 | } | 74 | } |
@@ -83,7 +83,7 @@ static int tda8083_readregs (struct tda8083_state* state, u8 reg1, u8 *b, u8 len | |||
83 | 83 | ||
84 | if (ret != 2) | 84 | if (ret != 2) |
85 | dprintk ("%s: readreg error (reg %02x, ret == %i)\n", | 85 | dprintk ("%s: readreg error (reg %02x, ret == %i)\n", |
86 | __FUNCTION__, reg1, ret); | 86 | __func__, reg1, ret); |
87 | 87 | ||
88 | return ret == 2 ? 0 : -1; | 88 | return ret == 2 ? 0 : -1; |
89 | } | 89 | } |
diff --git a/drivers/media/dvb/frontends/tda8083.h b/drivers/media/dvb/frontends/tda8083.h index 2d3307999f21..5a03c14a10e8 100644 --- a/drivers/media/dvb/frontends/tda8083.h +++ b/drivers/media/dvb/frontends/tda8083.h | |||
@@ -42,7 +42,7 @@ extern struct dvb_frontend* tda8083_attach(const struct tda8083_config* config, | |||
42 | static inline struct dvb_frontend* tda8083_attach(const struct tda8083_config* config, | 42 | static inline struct dvb_frontend* tda8083_attach(const struct tda8083_config* config, |
43 | struct i2c_adapter* i2c) | 43 | struct i2c_adapter* i2c) |
44 | { | 44 | { |
45 | printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __FUNCTION__); | 45 | printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__); |
46 | return NULL; | 46 | return NULL; |
47 | } | 47 | } |
48 | #endif // CONFIG_DVB_TDA8083 | 48 | #endif // CONFIG_DVB_TDA8083 |
diff --git a/drivers/media/dvb/frontends/tda826x.c b/drivers/media/dvb/frontends/tda826x.c index bd3ebc284835..a051554b5e25 100644 --- a/drivers/media/dvb/frontends/tda826x.c +++ b/drivers/media/dvb/frontends/tda826x.c | |||
@@ -26,7 +26,7 @@ | |||
26 | 26 | ||
27 | #include "tda826x.h" | 27 | #include "tda826x.h" |
28 | 28 | ||
29 | static int debug = 0; | 29 | static int debug; |
30 | #define dprintk(args...) \ | 30 | #define dprintk(args...) \ |
31 | do { \ | 31 | do { \ |
32 | if (debug) printk(KERN_DEBUG "tda826x: " args); \ | 32 | if (debug) printk(KERN_DEBUG "tda826x: " args); \ |
@@ -54,7 +54,7 @@ static int tda826x_sleep(struct dvb_frontend *fe) | |||
54 | u8 buf [] = { 0x00, 0x8d }; | 54 | u8 buf [] = { 0x00, 0x8d }; |
55 | struct i2c_msg msg = { .addr = priv->i2c_address, .flags = 0, .buf = buf, .len = 2 }; | 55 | struct i2c_msg msg = { .addr = priv->i2c_address, .flags = 0, .buf = buf, .len = 2 }; |
56 | 56 | ||
57 | dprintk("%s:\n", __FUNCTION__); | 57 | dprintk("%s:\n", __func__); |
58 | 58 | ||
59 | if (!priv->has_loopthrough) | 59 | if (!priv->has_loopthrough) |
60 | buf[1] = 0xad; | 60 | buf[1] = 0xad; |
@@ -62,7 +62,7 @@ static int tda826x_sleep(struct dvb_frontend *fe) | |||
62 | if (fe->ops.i2c_gate_ctrl) | 62 | if (fe->ops.i2c_gate_ctrl) |
63 | fe->ops.i2c_gate_ctrl(fe, 1); | 63 | fe->ops.i2c_gate_ctrl(fe, 1); |
64 | if ((ret = i2c_transfer (priv->i2c, &msg, 1)) != 1) { | 64 | if ((ret = i2c_transfer (priv->i2c, &msg, 1)) != 1) { |
65 | dprintk("%s: i2c error\n", __FUNCTION__); | 65 | dprintk("%s: i2c error\n", __func__); |
66 | } | 66 | } |
67 | if (fe->ops.i2c_gate_ctrl) | 67 | if (fe->ops.i2c_gate_ctrl) |
68 | fe->ops.i2c_gate_ctrl(fe, 0); | 68 | fe->ops.i2c_gate_ctrl(fe, 0); |
@@ -75,13 +75,24 @@ static int tda826x_set_params(struct dvb_frontend *fe, struct dvb_frontend_param | |||
75 | struct tda826x_priv *priv = fe->tuner_priv; | 75 | struct tda826x_priv *priv = fe->tuner_priv; |
76 | int ret; | 76 | int ret; |
77 | u32 div; | 77 | u32 div; |
78 | u32 ksyms; | ||
79 | u32 bandwidth; | ||
78 | u8 buf [11]; | 80 | u8 buf [11]; |
79 | struct i2c_msg msg = { .addr = priv->i2c_address, .flags = 0, .buf = buf, .len = 11 }; | 81 | struct i2c_msg msg = { .addr = priv->i2c_address, .flags = 0, .buf = buf, .len = 11 }; |
80 | 82 | ||
81 | dprintk("%s:\n", __FUNCTION__); | 83 | dprintk("%s:\n", __func__); |
82 | 84 | ||
83 | div = (params->frequency + (1000-1)) / 1000; | 85 | div = (params->frequency + (1000-1)) / 1000; |
84 | 86 | ||
87 | /* BW = ((1 + RO) * SR/2 + 5) * 1.3 [SR in MSPS, BW in MHz] */ | ||
88 | /* with R0 = 0.35 and some transformations: */ | ||
89 | ksyms = params->u.qpsk.symbol_rate / 1000; | ||
90 | bandwidth = (878 * ksyms + 6500000) / 1000000 + 1; | ||
91 | if (bandwidth < 5) | ||
92 | bandwidth = 5; | ||
93 | else if (bandwidth > 36) | ||
94 | bandwidth = 36; | ||
95 | |||
85 | buf[0] = 0x00; // subaddress | 96 | buf[0] = 0x00; // subaddress |
86 | buf[1] = 0x09; // powerdown RSSI + the magic value 1 | 97 | buf[1] = 0x09; // powerdown RSSI + the magic value 1 |
87 | if (!priv->has_loopthrough) | 98 | if (!priv->has_loopthrough) |
@@ -89,7 +100,7 @@ static int tda826x_set_params(struct dvb_frontend *fe, struct dvb_frontend_param | |||
89 | buf[2] = (1<<5) | 0x0b; // 1Mhz + 0.45 VCO | 100 | buf[2] = (1<<5) | 0x0b; // 1Mhz + 0.45 VCO |
90 | buf[3] = div >> 7; | 101 | buf[3] = div >> 7; |
91 | buf[4] = div << 1; | 102 | buf[4] = div << 1; |
92 | buf[5] = 0x77; // baseband cut-off 19 MHz | 103 | buf[5] = ((bandwidth - 5) << 3) | 7; /* baseband cut-off */ |
93 | buf[6] = 0xfe; // baseband gain 9 db + no RF attenuation | 104 | buf[6] = 0xfe; // baseband gain 9 db + no RF attenuation |
94 | buf[7] = 0x83; // charge pumps at high, tests off | 105 | buf[7] = 0x83; // charge pumps at high, tests off |
95 | buf[8] = 0x80; // recommended value 4 for AMPVCO + disable ports. | 106 | buf[8] = 0x80; // recommended value 4 for AMPVCO + disable ports. |
@@ -99,7 +110,7 @@ static int tda826x_set_params(struct dvb_frontend *fe, struct dvb_frontend_param | |||
99 | if (fe->ops.i2c_gate_ctrl) | 110 | if (fe->ops.i2c_gate_ctrl) |
100 | fe->ops.i2c_gate_ctrl(fe, 1); | 111 | fe->ops.i2c_gate_ctrl(fe, 1); |
101 | if ((ret = i2c_transfer (priv->i2c, &msg, 1)) != 1) { | 112 | if ((ret = i2c_transfer (priv->i2c, &msg, 1)) != 1) { |
102 | dprintk("%s: i2c error\n", __FUNCTION__); | 113 | dprintk("%s: i2c error\n", __func__); |
103 | } | 114 | } |
104 | if (fe->ops.i2c_gate_ctrl) | 115 | if (fe->ops.i2c_gate_ctrl) |
105 | fe->ops.i2c_gate_ctrl(fe, 0); | 116 | fe->ops.i2c_gate_ctrl(fe, 0); |
@@ -138,7 +149,7 @@ struct dvb_frontend *tda826x_attach(struct dvb_frontend *fe, int addr, struct i2 | |||
138 | }; | 149 | }; |
139 | int ret; | 150 | int ret; |
140 | 151 | ||
141 | dprintk("%s:\n", __FUNCTION__); | 152 | dprintk("%s:\n", __func__); |
142 | 153 | ||
143 | if (fe->ops.i2c_gate_ctrl) | 154 | if (fe->ops.i2c_gate_ctrl) |
144 | fe->ops.i2c_gate_ctrl(fe, 1); | 155 | fe->ops.i2c_gate_ctrl(fe, 1); |
diff --git a/drivers/media/dvb/frontends/tda826x.h b/drivers/media/dvb/frontends/tda826x.h index ad9981195961..89e97926ab23 100644 --- a/drivers/media/dvb/frontends/tda826x.h +++ b/drivers/media/dvb/frontends/tda826x.h | |||
@@ -45,7 +45,7 @@ static inline struct dvb_frontend* tda826x_attach(struct dvb_frontend *fe, | |||
45 | struct i2c_adapter *i2c, | 45 | struct i2c_adapter *i2c, |
46 | int has_loopthrough) | 46 | int has_loopthrough) |
47 | { | 47 | { |
48 | printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __FUNCTION__); | 48 | printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__); |
49 | return NULL; | 49 | return NULL; |
50 | } | 50 | } |
51 | #endif // CONFIG_DVB_TDA826X | 51 | #endif // CONFIG_DVB_TDA826X |
diff --git a/drivers/media/dvb/frontends/tda827x.c b/drivers/media/dvb/frontends/tda827x.c index 229b11987a58..d30d2c9094d9 100644 --- a/drivers/media/dvb/frontends/tda827x.c +++ b/drivers/media/dvb/frontends/tda827x.c | |||
@@ -25,7 +25,7 @@ | |||
25 | 25 | ||
26 | #include "tda827x.h" | 26 | #include "tda827x.h" |
27 | 27 | ||
28 | static int debug = 0; | 28 | static int debug; |
29 | module_param(debug, int, 0644); | 29 | module_param(debug, int, 0644); |
30 | MODULE_PARM_DESC(debug, "Turn on/off frontend debugging (default:off)."); | 30 | MODULE_PARM_DESC(debug, "Turn on/off frontend debugging (default:off)."); |
31 | 31 | ||
@@ -142,7 +142,7 @@ static int tda827xo_set_params(struct dvb_frontend *fe, | |||
142 | int i, tuner_freq, if_freq; | 142 | int i, tuner_freq, if_freq; |
143 | u32 N; | 143 | u32 N; |
144 | 144 | ||
145 | dprintk("%s:\n", __FUNCTION__); | 145 | dprintk("%s:\n", __func__); |
146 | switch (params->u.ofdm.bandwidth) { | 146 | switch (params->u.ofdm.bandwidth) { |
147 | case BANDWIDTH_6_MHZ: | 147 | case BANDWIDTH_6_MHZ: |
148 | if_freq = 4000000; | 148 | if_freq = 4000000; |
@@ -186,7 +186,7 @@ static int tda827xo_set_params(struct dvb_frontend *fe, | |||
186 | fe->ops.i2c_gate_ctrl(fe, 1); | 186 | fe->ops.i2c_gate_ctrl(fe, 1); |
187 | if (i2c_transfer(priv->i2c_adap, &msg, 1) != 1) { | 187 | if (i2c_transfer(priv->i2c_adap, &msg, 1) != 1) { |
188 | printk("%s: could not write to tuner at addr: 0x%02x\n", | 188 | printk("%s: could not write to tuner at addr: 0x%02x\n", |
189 | __FUNCTION__, priv->i2c_addr << 1); | 189 | __func__, priv->i2c_addr << 1); |
190 | return -EIO; | 190 | return -EIO; |
191 | } | 191 | } |
192 | msleep(500); | 192 | msleep(500); |
@@ -212,7 +212,7 @@ static int tda827xo_sleep(struct dvb_frontend *fe) | |||
212 | struct i2c_msg msg = { .addr = priv->i2c_addr, .flags = 0, | 212 | struct i2c_msg msg = { .addr = priv->i2c_addr, .flags = 0, |
213 | .buf = buf, .len = sizeof(buf) }; | 213 | .buf = buf, .len = sizeof(buf) }; |
214 | 214 | ||
215 | dprintk("%s:\n", __FUNCTION__); | 215 | dprintk("%s:\n", __func__); |
216 | if (fe->ops.i2c_gate_ctrl) | 216 | if (fe->ops.i2c_gate_ctrl) |
217 | fe->ops.i2c_gate_ctrl(fe, 1); | 217 | fe->ops.i2c_gate_ctrl(fe, 1); |
218 | i2c_transfer(priv->i2c_adap, &msg, 1); | 218 | i2c_transfer(priv->i2c_adap, &msg, 1); |
@@ -389,6 +389,79 @@ static struct tda827xa_data tda827xa_analog[] = { | |||
389 | { .lomax = 0, .svco = 0, .spd = 0, .scr = 0, .sbs = 0, .gc3 = 0} | 389 | { .lomax = 0, .svco = 0, .spd = 0, .scr = 0, .sbs = 0, .gc3 = 0} |
390 | }; | 390 | }; |
391 | 391 | ||
392 | static int tda827xa_sleep(struct dvb_frontend *fe) | ||
393 | { | ||
394 | struct tda827x_priv *priv = fe->tuner_priv; | ||
395 | static u8 buf[] = { 0x30, 0x90 }; | ||
396 | struct i2c_msg msg = { .addr = priv->i2c_addr, .flags = 0, | ||
397 | .buf = buf, .len = sizeof(buf) }; | ||
398 | |||
399 | dprintk("%s:\n", __func__); | ||
400 | if (fe->ops.i2c_gate_ctrl) | ||
401 | fe->ops.i2c_gate_ctrl(fe, 1); | ||
402 | |||
403 | i2c_transfer(priv->i2c_adap, &msg, 1); | ||
404 | |||
405 | if (fe->ops.i2c_gate_ctrl) | ||
406 | fe->ops.i2c_gate_ctrl(fe, 0); | ||
407 | |||
408 | if (priv->cfg && priv->cfg->sleep) | ||
409 | priv->cfg->sleep(fe); | ||
410 | |||
411 | return 0; | ||
412 | } | ||
413 | |||
414 | static void tda827xa_lna_gain(struct dvb_frontend *fe, int high, | ||
415 | struct analog_parameters *params) | ||
416 | { | ||
417 | struct tda827x_priv *priv = fe->tuner_priv; | ||
418 | unsigned char buf[] = {0x22, 0x01}; | ||
419 | int arg; | ||
420 | int gp_func; | ||
421 | struct i2c_msg msg = { .addr = priv->cfg->switch_addr, .flags = 0, | ||
422 | .buf = buf, .len = sizeof(buf) }; | ||
423 | |||
424 | if (NULL == priv->cfg) { | ||
425 | dprintk("tda827x_config not defined, cannot set LNA gain!\n"); | ||
426 | return; | ||
427 | } | ||
428 | if (priv->cfg->config) { | ||
429 | if (high) | ||
430 | dprintk("setting LNA to high gain\n"); | ||
431 | else | ||
432 | dprintk("setting LNA to low gain\n"); | ||
433 | } | ||
434 | switch (priv->cfg->config) { | ||
435 | case 0: /* no LNA */ | ||
436 | break; | ||
437 | case 1: /* switch is GPIO 0 of tda8290 */ | ||
438 | case 2: | ||
439 | if (params == NULL) { | ||
440 | gp_func = 0; | ||
441 | arg = 0; | ||
442 | } else { | ||
443 | /* turn Vsync on */ | ||
444 | gp_func = 1; | ||
445 | if (params->std & V4L2_STD_MN) | ||
446 | arg = 1; | ||
447 | else | ||
448 | arg = 0; | ||
449 | } | ||
450 | if (priv->cfg->tuner_callback) | ||
451 | priv->cfg->tuner_callback(priv->i2c_adap->algo_data, | ||
452 | gp_func, arg); | ||
453 | buf[1] = high ? 0 : 1; | ||
454 | if (priv->cfg->config == 2) | ||
455 | buf[1] = high ? 1 : 0; | ||
456 | i2c_transfer(priv->i2c_adap, &msg, 1); | ||
457 | break; | ||
458 | case 3: /* switch with GPIO of saa713x */ | ||
459 | if (priv->cfg->tuner_callback) | ||
460 | priv->cfg->tuner_callback(priv->i2c_adap->algo_data, 0, high); | ||
461 | break; | ||
462 | } | ||
463 | } | ||
464 | |||
392 | static int tda827xa_set_params(struct dvb_frontend *fe, | 465 | static int tda827xa_set_params(struct dvb_frontend *fe, |
393 | struct dvb_frontend_parameters *params) | 466 | struct dvb_frontend_parameters *params) |
394 | { | 467 | { |
@@ -401,9 +474,9 @@ static int tda827xa_set_params(struct dvb_frontend *fe, | |||
401 | int i, tuner_freq, if_freq; | 474 | int i, tuner_freq, if_freq; |
402 | u32 N; | 475 | u32 N; |
403 | 476 | ||
404 | dprintk("%s:\n", __FUNCTION__); | 477 | dprintk("%s:\n", __func__); |
405 | if (priv->cfg && priv->cfg->lna_gain) | 478 | |
406 | priv->cfg->lna_gain(fe, 1); | 479 | tda827xa_lna_gain(fe, 1, NULL); |
407 | msleep(20); | 480 | msleep(20); |
408 | 481 | ||
409 | switch (params->u.ofdm.bandwidth) { | 482 | switch (params->u.ofdm.bandwidth) { |
@@ -444,7 +517,7 @@ static int tda827xa_set_params(struct dvb_frontend *fe, | |||
444 | fe->ops.i2c_gate_ctrl(fe, 1); | 517 | fe->ops.i2c_gate_ctrl(fe, 1); |
445 | if (i2c_transfer(priv->i2c_adap, &msg, 1) != 1) { | 518 | if (i2c_transfer(priv->i2c_adap, &msg, 1) != 1) { |
446 | printk("%s: could not write to tuner at addr: 0x%02x\n", | 519 | printk("%s: could not write to tuner at addr: 0x%02x\n", |
447 | __FUNCTION__, priv->i2c_addr << 1); | 520 | __func__, priv->i2c_addr << 1); |
448 | return -EIO; | 521 | return -EIO; |
449 | } | 522 | } |
450 | buf[0] = 0x90; | 523 | buf[0] = 0x90; |
@@ -474,8 +547,7 @@ static int tda827xa_set_params(struct dvb_frontend *fe, | |||
474 | buf[1] >>= 4; | 547 | buf[1] >>= 4; |
475 | dprintk("tda8275a AGC2 gain is: %d\n", buf[1]); | 548 | dprintk("tda8275a AGC2 gain is: %d\n", buf[1]); |
476 | if ((buf[1]) < 2) { | 549 | if ((buf[1]) < 2) { |
477 | if (priv->cfg && priv->cfg->lna_gain) | 550 | tda827xa_lna_gain(fe, 0, NULL); |
478 | priv->cfg->lna_gain(fe, 0); | ||
479 | buf[0] = 0x60; | 551 | buf[0] = 0x60; |
480 | buf[1] = 0x0c; | 552 | buf[1] = 0x0c; |
481 | if (fe->ops.i2c_gate_ctrl) | 553 | if (fe->ops.i2c_gate_ctrl) |
@@ -523,75 +595,6 @@ static int tda827xa_set_params(struct dvb_frontend *fe, | |||
523 | return 0; | 595 | return 0; |
524 | } | 596 | } |
525 | 597 | ||
526 | static int tda827xa_sleep(struct dvb_frontend *fe) | ||
527 | { | ||
528 | struct tda827x_priv *priv = fe->tuner_priv; | ||
529 | static u8 buf[] = { 0x30, 0x90 }; | ||
530 | struct i2c_msg msg = { .addr = priv->i2c_addr, .flags = 0, | ||
531 | .buf = buf, .len = sizeof(buf) }; | ||
532 | |||
533 | dprintk("%s:\n", __FUNCTION__); | ||
534 | if (fe->ops.i2c_gate_ctrl) | ||
535 | fe->ops.i2c_gate_ctrl(fe, 1); | ||
536 | |||
537 | i2c_transfer(priv->i2c_adap, &msg, 1); | ||
538 | |||
539 | if (fe->ops.i2c_gate_ctrl) | ||
540 | fe->ops.i2c_gate_ctrl(fe, 0); | ||
541 | |||
542 | if (priv->cfg && priv->cfg->sleep) | ||
543 | priv->cfg->sleep(fe); | ||
544 | |||
545 | return 0; | ||
546 | } | ||
547 | |||
548 | /* ------------------------------------------------------------------ */ | ||
549 | |||
550 | static void tda827xa_lna_gain(struct dvb_frontend *fe, int high, | ||
551 | struct analog_parameters *params) | ||
552 | { | ||
553 | struct tda827x_priv *priv = fe->tuner_priv; | ||
554 | unsigned char buf[] = {0x22, 0x01}; | ||
555 | int arg; | ||
556 | struct i2c_msg msg = { .addr = priv->i2c_addr, .flags = 0, | ||
557 | .buf = buf, .len = sizeof(buf) }; | ||
558 | |||
559 | if (NULL == priv->cfg) { | ||
560 | dprintk("tda827x_config not defined, cannot set LNA gain!\n"); | ||
561 | return; | ||
562 | } | ||
563 | |||
564 | if (priv->cfg->config) { | ||
565 | if (high) | ||
566 | dprintk("setting LNA to high gain\n"); | ||
567 | else | ||
568 | dprintk("setting LNA to low gain\n"); | ||
569 | } | ||
570 | switch (*priv->cfg->config) { | ||
571 | case 0: /* no LNA */ | ||
572 | break; | ||
573 | case 1: /* switch is GPIO 0 of tda8290 */ | ||
574 | case 2: | ||
575 | /* turn Vsync on */ | ||
576 | if (params->std & V4L2_STD_MN) | ||
577 | arg = 1; | ||
578 | else | ||
579 | arg = 0; | ||
580 | if (priv->cfg->tuner_callback) | ||
581 | priv->cfg->tuner_callback(priv->i2c_adap->algo_data, | ||
582 | 1, arg); | ||
583 | buf[1] = high ? 0 : 1; | ||
584 | if (*priv->cfg->config == 2) | ||
585 | buf[1] = high ? 1 : 0; | ||
586 | i2c_transfer(priv->i2c_adap, &msg, 1); | ||
587 | break; | ||
588 | case 3: /* switch with GPIO of saa713x */ | ||
589 | if (priv->cfg->tuner_callback) | ||
590 | priv->cfg->tuner_callback(priv->i2c_adap->algo_data, | ||
591 | 0, high); | ||
592 | break; | ||
593 | } | ||
594 | } | ||
595 | 598 | ||
596 | static int tda827xa_set_analog_params(struct dvb_frontend *fe, | 599 | static int tda827xa_set_analog_params(struct dvb_frontend *fe, |
597 | struct analog_parameters *params) | 600 | struct analog_parameters *params) |
@@ -726,7 +729,7 @@ static int tda827x_get_bandwidth(struct dvb_frontend *fe, u32 *bandwidth) | |||
726 | static int tda827x_init(struct dvb_frontend *fe) | 729 | static int tda827x_init(struct dvb_frontend *fe) |
727 | { | 730 | { |
728 | struct tda827x_priv *priv = fe->tuner_priv; | 731 | struct tda827x_priv *priv = fe->tuner_priv; |
729 | dprintk("%s:\n", __FUNCTION__); | 732 | dprintk("%s:\n", __func__); |
730 | if (priv->cfg && priv->cfg->init) | 733 | if (priv->cfg && priv->cfg->init) |
731 | priv->cfg->init(fe); | 734 | priv->cfg->init(fe); |
732 | 735 | ||
@@ -794,7 +797,7 @@ static int tda827x_probe_version(struct dvb_frontend *fe) | |||
794 | fe->ops.i2c_gate_ctrl(fe, 1); | 797 | fe->ops.i2c_gate_ctrl(fe, 1); |
795 | if (i2c_transfer(priv->i2c_adap, &msg, 1) != 1) { | 798 | if (i2c_transfer(priv->i2c_adap, &msg, 1) != 1) { |
796 | printk("%s: could not read from tuner at addr: 0x%02x\n", | 799 | printk("%s: could not read from tuner at addr: 0x%02x\n", |
797 | __FUNCTION__, msg.addr << 1); | 800 | __func__, msg.addr << 1); |
798 | return -EIO; | 801 | return -EIO; |
799 | } | 802 | } |
800 | if ((data & 0x3c) == 0) { | 803 | if ((data & 0x3c) == 0) { |
@@ -818,7 +821,7 @@ struct dvb_frontend *tda827x_attach(struct dvb_frontend *fe, int addr, | |||
818 | { | 821 | { |
819 | struct tda827x_priv *priv = NULL; | 822 | struct tda827x_priv *priv = NULL; |
820 | 823 | ||
821 | dprintk("%s:\n", __FUNCTION__); | 824 | dprintk("%s:\n", __func__); |
822 | priv = kzalloc(sizeof(struct tda827x_priv), GFP_KERNEL); | 825 | priv = kzalloc(sizeof(struct tda827x_priv), GFP_KERNEL); |
823 | if (priv == NULL) | 826 | if (priv == NULL) |
824 | return NULL; | 827 | return NULL; |
diff --git a/drivers/media/dvb/frontends/tda827x.h b/drivers/media/dvb/frontends/tda827x.h index 92eb65b4012b..b73c23570dab 100644 --- a/drivers/media/dvb/frontends/tda827x.h +++ b/drivers/media/dvb/frontends/tda827x.h | |||
@@ -30,12 +30,12 @@ | |||
30 | struct tda827x_config | 30 | struct tda827x_config |
31 | { | 31 | { |
32 | /* saa7134 - provided callbacks */ | 32 | /* saa7134 - provided callbacks */ |
33 | void (*lna_gain) (struct dvb_frontend *fe, int high); | ||
34 | int (*init) (struct dvb_frontend *fe); | 33 | int (*init) (struct dvb_frontend *fe); |
35 | int (*sleep) (struct dvb_frontend *fe); | 34 | int (*sleep) (struct dvb_frontend *fe); |
36 | 35 | ||
37 | /* interface to tda829x driver */ | 36 | /* interface to tda829x driver */ |
38 | unsigned int *config; | 37 | unsigned int config; |
38 | int switch_addr; | ||
39 | int (*tuner_callback) (void *dev, int command, int arg); | 39 | int (*tuner_callback) (void *dev, int command, int arg); |
40 | 40 | ||
41 | void (*agcf)(struct dvb_frontend *fe); | 41 | void (*agcf)(struct dvb_frontend *fe); |
@@ -61,7 +61,7 @@ static inline struct dvb_frontend* tda827x_attach(struct dvb_frontend *fe, | |||
61 | struct i2c_adapter *i2c, | 61 | struct i2c_adapter *i2c, |
62 | struct tda827x_config *cfg) | 62 | struct tda827x_config *cfg) |
63 | { | 63 | { |
64 | printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __FUNCTION__); | 64 | printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__); |
65 | return NULL; | 65 | return NULL; |
66 | } | 66 | } |
67 | #endif // CONFIG_DVB_TDA827X | 67 | #endif // CONFIG_DVB_TDA827X |
diff --git a/drivers/media/dvb/frontends/tua6100.c b/drivers/media/dvb/frontends/tua6100.c index 6ba0029dcf2e..1790baee014c 100644 --- a/drivers/media/dvb/frontends/tua6100.c +++ b/drivers/media/dvb/frontends/tua6100.c | |||
@@ -58,7 +58,7 @@ static int tua6100_sleep(struct dvb_frontend *fe) | |||
58 | if (fe->ops.i2c_gate_ctrl) | 58 | if (fe->ops.i2c_gate_ctrl) |
59 | fe->ops.i2c_gate_ctrl(fe, 1); | 59 | fe->ops.i2c_gate_ctrl(fe, 1); |
60 | if ((ret = i2c_transfer (priv->i2c, &msg, 1)) != 1) { | 60 | if ((ret = i2c_transfer (priv->i2c, &msg, 1)) != 1) { |
61 | printk("%s: i2c error\n", __FUNCTION__); | 61 | printk("%s: i2c error\n", __func__); |
62 | } | 62 | } |
63 | if (fe->ops.i2c_gate_ctrl) | 63 | if (fe->ops.i2c_gate_ctrl) |
64 | fe->ops.i2c_gate_ctrl(fe, 0); | 64 | fe->ops.i2c_gate_ctrl(fe, 0); |
diff --git a/drivers/media/dvb/frontends/tua6100.h b/drivers/media/dvb/frontends/tua6100.h index 03a665e7df6d..f83dbd5e42ae 100644 --- a/drivers/media/dvb/frontends/tua6100.h +++ b/drivers/media/dvb/frontends/tua6100.h | |||
@@ -39,7 +39,7 @@ extern struct dvb_frontend *tua6100_attach(struct dvb_frontend *fe, int addr, st | |||
39 | #else | 39 | #else |
40 | static inline struct dvb_frontend* tua6100_attach(struct dvb_frontend *fe, int addr, struct i2c_adapter *i2c) | 40 | static inline struct dvb_frontend* tua6100_attach(struct dvb_frontend *fe, int addr, struct i2c_adapter *i2c) |
41 | { | 41 | { |
42 | printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __FUNCTION__); | 42 | printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__); |
43 | return NULL; | 43 | return NULL; |
44 | } | 44 | } |
45 | #endif // CONFIG_DVB_TUA6100 | 45 | #endif // CONFIG_DVB_TUA6100 |
diff --git a/drivers/media/dvb/frontends/ves1820.c b/drivers/media/dvb/frontends/ves1820.c index 8791701c8f25..a184597f1d9b 100644 --- a/drivers/media/dvb/frontends/ves1820.c +++ b/drivers/media/dvb/frontends/ves1820.c | |||
@@ -66,7 +66,7 @@ static int ves1820_writereg(struct ves1820_state *state, u8 reg, u8 data) | |||
66 | 66 | ||
67 | if (ret != 1) | 67 | if (ret != 1) |
68 | printk("ves1820: %s(): writereg error (reg == 0x%02x, " | 68 | printk("ves1820: %s(): writereg error (reg == 0x%02x, " |
69 | "val == 0x%02x, ret == %i)\n", __FUNCTION__, reg, data, ret); | 69 | "val == 0x%02x, ret == %i)\n", __func__, reg, data, ret); |
70 | 70 | ||
71 | return (ret != 1) ? -EREMOTEIO : 0; | 71 | return (ret != 1) ? -EREMOTEIO : 0; |
72 | } | 72 | } |
@@ -85,7 +85,7 @@ static u8 ves1820_readreg(struct ves1820_state *state, u8 reg) | |||
85 | 85 | ||
86 | if (ret != 2) | 86 | if (ret != 2) |
87 | printk("ves1820: %s(): readreg error (reg == 0x%02x, " | 87 | printk("ves1820: %s(): readreg error (reg == 0x%02x, " |
88 | "ret == %i)\n", __FUNCTION__, reg, ret); | 88 | "ret == %i)\n", __func__, reg, ret); |
89 | 89 | ||
90 | return b1[0]; | 90 | return b1[0]; |
91 | } | 91 | } |
diff --git a/drivers/media/dvb/frontends/ves1820.h b/drivers/media/dvb/frontends/ves1820.h index e4a2a324046a..e902ed634ec3 100644 --- a/drivers/media/dvb/frontends/ves1820.h +++ b/drivers/media/dvb/frontends/ves1820.h | |||
@@ -48,7 +48,7 @@ extern struct dvb_frontend* ves1820_attach(const struct ves1820_config* config, | |||
48 | static inline struct dvb_frontend* ves1820_attach(const struct ves1820_config* config, | 48 | static inline struct dvb_frontend* ves1820_attach(const struct ves1820_config* config, |
49 | struct i2c_adapter* i2c, u8 pwm) | 49 | struct i2c_adapter* i2c, u8 pwm) |
50 | { | 50 | { |
51 | printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __FUNCTION__); | 51 | printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__); |
52 | return NULL; | 52 | return NULL; |
53 | } | 53 | } |
54 | #endif // CONFIG_DVB_VES1820 | 54 | #endif // CONFIG_DVB_VES1820 |
diff --git a/drivers/media/dvb/frontends/ves1x93.c b/drivers/media/dvb/frontends/ves1x93.c index 23fd0303c91b..bd558960bd87 100644 --- a/drivers/media/dvb/frontends/ves1x93.c +++ b/drivers/media/dvb/frontends/ves1x93.c | |||
@@ -48,7 +48,7 @@ struct ves1x93_state { | |||
48 | u8 demod_type; | 48 | u8 demod_type; |
49 | }; | 49 | }; |
50 | 50 | ||
51 | static int debug = 0; | 51 | static int debug; |
52 | #define dprintk if (debug) printk | 52 | #define dprintk if (debug) printk |
53 | 53 | ||
54 | #define DEMOD_VES1893 0 | 54 | #define DEMOD_VES1893 0 |
@@ -98,7 +98,7 @@ static int ves1x93_writereg (struct ves1x93_state* state, u8 reg, u8 data) | |||
98 | int err; | 98 | int err; |
99 | 99 | ||
100 | if ((err = i2c_transfer (state->i2c, &msg, 1)) != 1) { | 100 | if ((err = i2c_transfer (state->i2c, &msg, 1)) != 1) { |
101 | dprintk ("%s: writereg error (err == %i, reg == 0x%02x, data == 0x%02x)\n", __FUNCTION__, err, reg, data); | 101 | dprintk ("%s: writereg error (err == %i, reg == 0x%02x, data == 0x%02x)\n", __func__, err, reg, data); |
102 | return -EREMOTEIO; | 102 | return -EREMOTEIO; |
103 | } | 103 | } |
104 | 104 | ||
@@ -179,7 +179,7 @@ static int ves1x93_set_symbolrate (struct ves1x93_state* state, u32 srate) | |||
179 | u32 tmp; | 179 | u32 tmp; |
180 | u32 FIN; | 180 | u32 FIN; |
181 | 181 | ||
182 | dprintk("%s: srate == %d\n", __FUNCTION__, (unsigned int) srate); | 182 | dprintk("%s: srate == %d\n", __func__, (unsigned int) srate); |
183 | 183 | ||
184 | if (srate > state->config->xin/2) | 184 | if (srate > state->config->xin/2) |
185 | srate = state->config->xin/2; | 185 | srate = state->config->xin/2; |
@@ -266,7 +266,7 @@ static int ves1x93_init (struct dvb_frontend* fe) | |||
266 | int i; | 266 | int i; |
267 | int val; | 267 | int val; |
268 | 268 | ||
269 | dprintk("%s: init chip\n", __FUNCTION__); | 269 | dprintk("%s: init chip\n", __func__); |
270 | 270 | ||
271 | for (i = 0; i < state->tab_size; i++) { | 271 | for (i = 0; i < state->tab_size; i++) { |
272 | if (state->init_1x93_wtab[i]) { | 272 | if (state->init_1x93_wtab[i]) { |
diff --git a/drivers/media/dvb/frontends/ves1x93.h b/drivers/media/dvb/frontends/ves1x93.h index d507f8966f81..8a5a49e808f6 100644 --- a/drivers/media/dvb/frontends/ves1x93.h +++ b/drivers/media/dvb/frontends/ves1x93.h | |||
@@ -47,7 +47,7 @@ extern struct dvb_frontend* ves1x93_attach(const struct ves1x93_config* config, | |||
47 | static inline struct dvb_frontend* ves1x93_attach(const struct ves1x93_config* config, | 47 | static inline struct dvb_frontend* ves1x93_attach(const struct ves1x93_config* config, |
48 | struct i2c_adapter* i2c) | 48 | struct i2c_adapter* i2c) |
49 | { | 49 | { |
50 | printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __FUNCTION__); | 50 | printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__); |
51 | return NULL; | 51 | return NULL; |
52 | } | 52 | } |
53 | #endif // CONFIG_DVB_VES1X93 | 53 | #endif // CONFIG_DVB_VES1X93 |
diff --git a/drivers/media/dvb/frontends/xc5000.c b/drivers/media/dvb/frontends/xc5000.c index f642ca200b59..43d35bdb221f 100644 --- a/drivers/media/dvb/frontends/xc5000.c +++ b/drivers/media/dvb/frontends/xc5000.c | |||
@@ -151,7 +151,7 @@ typedef struct { | |||
151 | #define FM_Radio_INPUT2 21 | 151 | #define FM_Radio_INPUT2 21 |
152 | #define FM_Radio_INPUT1 22 | 152 | #define FM_Radio_INPUT1 22 |
153 | 153 | ||
154 | XC_TV_STANDARD XC5000_Standard[MAX_TV_STANDARD] = { | 154 | static XC_TV_STANDARD XC5000_Standard[MAX_TV_STANDARD] = { |
155 | {"M/N-NTSC/PAL-BTSC", 0x0400, 0x8020}, | 155 | {"M/N-NTSC/PAL-BTSC", 0x0400, 0x8020}, |
156 | {"M/N-NTSC/PAL-A2", 0x0600, 0x8020}, | 156 | {"M/N-NTSC/PAL-A2", 0x0600, 0x8020}, |
157 | {"M/N-NTSC/PAL-EIAJ", 0x0440, 0x8020}, | 157 | {"M/N-NTSC/PAL-EIAJ", 0x0440, 0x8020}, |
@@ -209,7 +209,7 @@ static void xc5000_TunerReset(struct dvb_frontend *fe) | |||
209 | struct xc5000_priv *priv = fe->tuner_priv; | 209 | struct xc5000_priv *priv = fe->tuner_priv; |
210 | int ret; | 210 | int ret; |
211 | 211 | ||
212 | dprintk(1, "%s()\n", __FUNCTION__); | 212 | dprintk(1, "%s()\n", __func__); |
213 | 213 | ||
214 | if (priv->cfg->tuner_callback) { | 214 | if (priv->cfg->tuner_callback) { |
215 | ret = priv->cfg->tuner_callback(priv->cfg->priv, | 215 | ret = priv->cfg->tuner_callback(priv->cfg->priv, |
@@ -330,7 +330,7 @@ static int xc_load_i2c_sequence(struct dvb_frontend *fe, u8 i2c_sequence[]) | |||
330 | 330 | ||
331 | static int xc_initialize(struct xc5000_priv *priv) | 331 | static int xc_initialize(struct xc5000_priv *priv) |
332 | { | 332 | { |
333 | dprintk(1, "%s()\n", __FUNCTION__); | 333 | dprintk(1, "%s()\n", __func__); |
334 | return xc_write_reg(priv, XREG_INIT, 0); | 334 | return xc_write_reg(priv, XREG_INIT, 0); |
335 | } | 335 | } |
336 | 336 | ||
@@ -338,9 +338,9 @@ static int xc_SetTVStandard(struct xc5000_priv *priv, | |||
338 | u16 VideoMode, u16 AudioMode) | 338 | u16 VideoMode, u16 AudioMode) |
339 | { | 339 | { |
340 | int ret; | 340 | int ret; |
341 | dprintk(1, "%s(0x%04x,0x%04x)\n", __FUNCTION__, VideoMode, AudioMode); | 341 | dprintk(1, "%s(0x%04x,0x%04x)\n", __func__, VideoMode, AudioMode); |
342 | dprintk(1, "%s() Standard = %s\n", | 342 | dprintk(1, "%s() Standard = %s\n", |
343 | __FUNCTION__, | 343 | __func__, |
344 | XC5000_Standard[priv->video_standard].Name); | 344 | XC5000_Standard[priv->video_standard].Name); |
345 | 345 | ||
346 | ret = xc_write_reg(priv, XREG_VIDEO_MODE, VideoMode); | 346 | ret = xc_write_reg(priv, XREG_VIDEO_MODE, VideoMode); |
@@ -361,7 +361,7 @@ static int xc_shutdown(struct xc5000_priv *priv) | |||
361 | 361 | ||
362 | static int xc_SetSignalSource(struct xc5000_priv *priv, u16 rf_mode) | 362 | static int xc_SetSignalSource(struct xc5000_priv *priv, u16 rf_mode) |
363 | { | 363 | { |
364 | dprintk(1, "%s(%d) Source = %s\n", __FUNCTION__, rf_mode, | 364 | dprintk(1, "%s(%d) Source = %s\n", __func__, rf_mode, |
365 | rf_mode == XC_RF_MODE_AIR ? "ANTENNA" : "CABLE"); | 365 | rf_mode == XC_RF_MODE_AIR ? "ANTENNA" : "CABLE"); |
366 | 366 | ||
367 | if ((rf_mode != XC_RF_MODE_AIR) && (rf_mode != XC_RF_MODE_CABLE)) | 367 | if ((rf_mode != XC_RF_MODE_AIR) && (rf_mode != XC_RF_MODE_CABLE)) |
@@ -369,7 +369,7 @@ static int xc_SetSignalSource(struct xc5000_priv *priv, u16 rf_mode) | |||
369 | rf_mode = XC_RF_MODE_CABLE; | 369 | rf_mode = XC_RF_MODE_CABLE; |
370 | printk(KERN_ERR | 370 | printk(KERN_ERR |
371 | "%s(), Invalid mode, defaulting to CABLE", | 371 | "%s(), Invalid mode, defaulting to CABLE", |
372 | __FUNCTION__); | 372 | __func__); |
373 | } | 373 | } |
374 | return xc_write_reg(priv, XREG_SIGNALSOURCE, rf_mode); | 374 | return xc_write_reg(priv, XREG_SIGNALSOURCE, rf_mode); |
375 | } | 375 | } |
@@ -380,7 +380,7 @@ static int xc_set_RF_frequency(struct xc5000_priv *priv, u32 freq_hz) | |||
380 | { | 380 | { |
381 | u16 freq_code; | 381 | u16 freq_code; |
382 | 382 | ||
383 | dprintk(1, "%s(%u)\n", __FUNCTION__, freq_hz); | 383 | dprintk(1, "%s(%u)\n", __func__, freq_hz); |
384 | 384 | ||
385 | if ((freq_hz > xc5000_tuner_ops.info.frequency_max) || | 385 | if ((freq_hz > xc5000_tuner_ops.info.frequency_max) || |
386 | (freq_hz < xc5000_tuner_ops.info.frequency_min)) | 386 | (freq_hz < xc5000_tuner_ops.info.frequency_min)) |
@@ -396,7 +396,7 @@ static int xc_set_IF_frequency(struct xc5000_priv *priv, u32 freq_khz) | |||
396 | { | 396 | { |
397 | u32 freq_code = (freq_khz * 1024)/1000; | 397 | u32 freq_code = (freq_khz * 1024)/1000; |
398 | dprintk(1, "%s(freq_khz = %d) freq_code = 0x%x\n", | 398 | dprintk(1, "%s(freq_khz = %d) freq_code = 0x%x\n", |
399 | __FUNCTION__, freq_khz, freq_code); | 399 | __func__, freq_khz, freq_code); |
400 | 400 | ||
401 | return xc_write_reg(priv, XREG_IF_OUT, freq_code); | 401 | return xc_write_reg(priv, XREG_IF_OUT, freq_code); |
402 | } | 402 | } |
@@ -488,7 +488,7 @@ static int xc_tune_channel(struct xc5000_priv *priv, u32 freq_hz) | |||
488 | { | 488 | { |
489 | int found = 0; | 489 | int found = 0; |
490 | 490 | ||
491 | dprintk(1, "%s(%u)\n", __FUNCTION__, freq_hz); | 491 | dprintk(1, "%s(%u)\n", __func__, freq_hz); |
492 | 492 | ||
493 | if (xc_set_RF_frequency(priv, freq_hz) != XC_RESULT_SUCCESS) | 493 | if (xc_set_RF_frequency(priv, freq_hz) != XC_RESULT_SUCCESS) |
494 | return 0; | 494 | return 0; |
@@ -627,12 +627,12 @@ static int xc5000_set_params(struct dvb_frontend *fe, | |||
627 | struct xc5000_priv *priv = fe->tuner_priv; | 627 | struct xc5000_priv *priv = fe->tuner_priv; |
628 | int ret; | 628 | int ret; |
629 | 629 | ||
630 | dprintk(1, "%s() frequency=%d (Hz)\n", __FUNCTION__, params->frequency); | 630 | dprintk(1, "%s() frequency=%d (Hz)\n", __func__, params->frequency); |
631 | 631 | ||
632 | switch(params->u.vsb.modulation) { | 632 | switch(params->u.vsb.modulation) { |
633 | case VSB_8: | 633 | case VSB_8: |
634 | case VSB_16: | 634 | case VSB_16: |
635 | dprintk(1, "%s() VSB modulation\n", __FUNCTION__); | 635 | dprintk(1, "%s() VSB modulation\n", __func__); |
636 | priv->rf_mode = XC_RF_MODE_AIR; | 636 | priv->rf_mode = XC_RF_MODE_AIR; |
637 | priv->freq_hz = params->frequency - 1750000; | 637 | priv->freq_hz = params->frequency - 1750000; |
638 | priv->bandwidth = BANDWIDTH_6_MHZ; | 638 | priv->bandwidth = BANDWIDTH_6_MHZ; |
@@ -641,7 +641,7 @@ static int xc5000_set_params(struct dvb_frontend *fe, | |||
641 | case QAM_64: | 641 | case QAM_64: |
642 | case QAM_256: | 642 | case QAM_256: |
643 | case QAM_AUTO: | 643 | case QAM_AUTO: |
644 | dprintk(1, "%s() QAM modulation\n", __FUNCTION__); | 644 | dprintk(1, "%s() QAM modulation\n", __func__); |
645 | priv->rf_mode = XC_RF_MODE_CABLE; | 645 | priv->rf_mode = XC_RF_MODE_CABLE; |
646 | priv->freq_hz = params->frequency - 1750000; | 646 | priv->freq_hz = params->frequency - 1750000; |
647 | priv->bandwidth = BANDWIDTH_6_MHZ; | 647 | priv->bandwidth = BANDWIDTH_6_MHZ; |
@@ -652,7 +652,7 @@ static int xc5000_set_params(struct dvb_frontend *fe, | |||
652 | } | 652 | } |
653 | 653 | ||
654 | dprintk(1, "%s() frequency=%d (compensated)\n", | 654 | dprintk(1, "%s() frequency=%d (compensated)\n", |
655 | __FUNCTION__, priv->freq_hz); | 655 | __func__, priv->freq_hz); |
656 | 656 | ||
657 | ret = xc_SetSignalSource(priv, priv->rf_mode); | 657 | ret = xc_SetSignalSource(priv, priv->rf_mode); |
658 | if (ret != XC_RESULT_SUCCESS) { | 658 | if (ret != XC_RESULT_SUCCESS) { |
@@ -697,7 +697,7 @@ static int xc5000_set_analog_params(struct dvb_frontend *fe, | |||
697 | xc_load_fw_and_init_tuner(fe); | 697 | xc_load_fw_and_init_tuner(fe); |
698 | 698 | ||
699 | dprintk(1, "%s() frequency=%d (in units of 62.5khz)\n", | 699 | dprintk(1, "%s() frequency=%d (in units of 62.5khz)\n", |
700 | __FUNCTION__, params->frequency); | 700 | __func__, params->frequency); |
701 | 701 | ||
702 | priv->rf_mode = XC_RF_MODE_CABLE; /* Fix me: it could be air. */ | 702 | priv->rf_mode = XC_RF_MODE_CABLE; /* Fix me: it could be air. */ |
703 | 703 | ||
@@ -775,7 +775,7 @@ tune_channel: | |||
775 | static int xc5000_get_frequency(struct dvb_frontend *fe, u32 *freq) | 775 | static int xc5000_get_frequency(struct dvb_frontend *fe, u32 *freq) |
776 | { | 776 | { |
777 | struct xc5000_priv *priv = fe->tuner_priv; | 777 | struct xc5000_priv *priv = fe->tuner_priv; |
778 | dprintk(1, "%s()\n", __FUNCTION__); | 778 | dprintk(1, "%s()\n", __func__); |
779 | *freq = priv->freq_hz; | 779 | *freq = priv->freq_hz; |
780 | return 0; | 780 | return 0; |
781 | } | 781 | } |
@@ -783,7 +783,7 @@ static int xc5000_get_frequency(struct dvb_frontend *fe, u32 *freq) | |||
783 | static int xc5000_get_bandwidth(struct dvb_frontend *fe, u32 *bw) | 783 | static int xc5000_get_bandwidth(struct dvb_frontend *fe, u32 *bw) |
784 | { | 784 | { |
785 | struct xc5000_priv *priv = fe->tuner_priv; | 785 | struct xc5000_priv *priv = fe->tuner_priv; |
786 | dprintk(1, "%s()\n", __FUNCTION__); | 786 | dprintk(1, "%s()\n", __func__); |
787 | 787 | ||
788 | *bw = priv->bandwidth; | 788 | *bw = priv->bandwidth; |
789 | return 0; | 789 | return 0; |
@@ -796,7 +796,7 @@ static int xc5000_get_status(struct dvb_frontend *fe, u32 *status) | |||
796 | 796 | ||
797 | xc_get_lock_status(priv, &lock_status); | 797 | xc_get_lock_status(priv, &lock_status); |
798 | 798 | ||
799 | dprintk(1, "%s() lock_status = 0x%08x\n", __FUNCTION__, lock_status); | 799 | dprintk(1, "%s() lock_status = 0x%08x\n", __func__, lock_status); |
800 | 800 | ||
801 | *status = lock_status; | 801 | *status = lock_status; |
802 | 802 | ||
@@ -836,7 +836,7 @@ static int xc5000_sleep(struct dvb_frontend *fe) | |||
836 | struct xc5000_priv *priv = fe->tuner_priv; | 836 | struct xc5000_priv *priv = fe->tuner_priv; |
837 | int ret; | 837 | int ret; |
838 | 838 | ||
839 | dprintk(1, "%s()\n", __FUNCTION__); | 839 | dprintk(1, "%s()\n", __func__); |
840 | 840 | ||
841 | /* On Pinnacle PCTV HD 800i, the tuner cannot be reinitialized | 841 | /* On Pinnacle PCTV HD 800i, the tuner cannot be reinitialized |
842 | * once shutdown without reloading the driver. Maybe I am not | 842 | * once shutdown without reloading the driver. Maybe I am not |
@@ -848,7 +848,7 @@ static int xc5000_sleep(struct dvb_frontend *fe) | |||
848 | if(ret != XC_RESULT_SUCCESS) { | 848 | if(ret != XC_RESULT_SUCCESS) { |
849 | printk(KERN_ERR | 849 | printk(KERN_ERR |
850 | "xc5000: %s() unable to shutdown tuner\n", | 850 | "xc5000: %s() unable to shutdown tuner\n", |
851 | __FUNCTION__); | 851 | __func__); |
852 | return -EREMOTEIO; | 852 | return -EREMOTEIO; |
853 | } | 853 | } |
854 | else { | 854 | else { |
@@ -860,7 +860,7 @@ static int xc5000_sleep(struct dvb_frontend *fe) | |||
860 | static int xc5000_init(struct dvb_frontend *fe) | 860 | static int xc5000_init(struct dvb_frontend *fe) |
861 | { | 861 | { |
862 | struct xc5000_priv *priv = fe->tuner_priv; | 862 | struct xc5000_priv *priv = fe->tuner_priv; |
863 | dprintk(1, "%s()\n", __FUNCTION__); | 863 | dprintk(1, "%s()\n", __func__); |
864 | 864 | ||
865 | if (xc_load_fw_and_init_tuner(fe) != XC_RESULT_SUCCESS) { | 865 | if (xc_load_fw_and_init_tuner(fe) != XC_RESULT_SUCCESS) { |
866 | printk(KERN_ERR "xc5000: Unable to initialise tuner\n"); | 866 | printk(KERN_ERR "xc5000: Unable to initialise tuner\n"); |
@@ -875,7 +875,7 @@ static int xc5000_init(struct dvb_frontend *fe) | |||
875 | 875 | ||
876 | static int xc5000_release(struct dvb_frontend *fe) | 876 | static int xc5000_release(struct dvb_frontend *fe) |
877 | { | 877 | { |
878 | dprintk(1, "%s()\n", __FUNCTION__); | 878 | dprintk(1, "%s()\n", __func__); |
879 | kfree(fe->tuner_priv); | 879 | kfree(fe->tuner_priv); |
880 | fe->tuner_priv = NULL; | 880 | fe->tuner_priv = NULL; |
881 | return 0; | 881 | return 0; |
@@ -907,7 +907,7 @@ struct dvb_frontend * xc5000_attach(struct dvb_frontend *fe, | |||
907 | struct xc5000_priv *priv = NULL; | 907 | struct xc5000_priv *priv = NULL; |
908 | u16 id = 0; | 908 | u16 id = 0; |
909 | 909 | ||
910 | dprintk(1, "%s()\n", __FUNCTION__); | 910 | dprintk(1, "%s()\n", __func__); |
911 | 911 | ||
912 | priv = kzalloc(sizeof(struct xc5000_priv), GFP_KERNEL); | 912 | priv = kzalloc(sizeof(struct xc5000_priv), GFP_KERNEL); |
913 | if (priv == NULL) | 913 | if (priv == NULL) |
diff --git a/drivers/media/dvb/frontends/xc5000.h b/drivers/media/dvb/frontends/xc5000.h index 32a5f1c86a16..b890883a0cdc 100644 --- a/drivers/media/dvb/frontends/xc5000.h +++ b/drivers/media/dvb/frontends/xc5000.h | |||
@@ -55,7 +55,7 @@ static inline struct dvb_frontend* xc5000_attach(struct dvb_frontend *fe, | |||
55 | struct i2c_adapter *i2c, | 55 | struct i2c_adapter *i2c, |
56 | struct xc5000_config *cfg) | 56 | struct xc5000_config *cfg) |
57 | { | 57 | { |
58 | printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __FUNCTION__); | 58 | printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__); |
59 | return NULL; | 59 | return NULL; |
60 | } | 60 | } |
61 | #endif // CONFIG_DVB_TUNER_XC5000 | 61 | #endif // CONFIG_DVB_TUNER_XC5000 |
diff --git a/drivers/media/dvb/frontends/zl10353.c b/drivers/media/dvb/frontends/zl10353.c index 276e3b631dc2..36a5a1c101d5 100644 --- a/drivers/media/dvb/frontends/zl10353.c +++ b/drivers/media/dvb/frontends/zl10353.c | |||
@@ -46,7 +46,7 @@ static int debug; | |||
46 | if (debug) printk(KERN_DEBUG "zl10353: " args); \ | 46 | if (debug) printk(KERN_DEBUG "zl10353: " args); \ |
47 | } while (0) | 47 | } while (0) |
48 | 48 | ||
49 | static int debug_regs = 0; | 49 | static int debug_regs; |
50 | 50 | ||
51 | static int zl10353_single_write(struct dvb_frontend *fe, u8 reg, u8 val) | 51 | static int zl10353_single_write(struct dvb_frontend *fe, u8 reg, u8 val) |
52 | { | 52 | { |
@@ -88,7 +88,7 @@ static int zl10353_read_register(struct zl10353_state *state, u8 reg) | |||
88 | 88 | ||
89 | if (ret != 2) { | 89 | if (ret != 2) { |
90 | printk("%s: readreg error (reg=%d, ret==%i)\n", | 90 | printk("%s: readreg error (reg=%d, ret==%i)\n", |
91 | __FUNCTION__, reg, ret); | 91 | __func__, reg, ret); |
92 | return ret; | 92 | return ret; |
93 | } | 93 | } |
94 | 94 | ||
@@ -152,7 +152,7 @@ static void zl10353_calc_nominal_rate(struct dvb_frontend *fe, | |||
152 | *nominal_rate = value; | 152 | *nominal_rate = value; |
153 | 153 | ||
154 | dprintk("%s: bw %d, adc_clock %d => 0x%x\n", | 154 | dprintk("%s: bw %d, adc_clock %d => 0x%x\n", |
155 | __FUNCTION__, bw, adc_clock, *nominal_rate); | 155 | __func__, bw, adc_clock, *nominal_rate); |
156 | } | 156 | } |
157 | 157 | ||
158 | static void zl10353_calc_input_freq(struct dvb_frontend *fe, | 158 | static void zl10353_calc_input_freq(struct dvb_frontend *fe, |
@@ -181,7 +181,7 @@ static void zl10353_calc_input_freq(struct dvb_frontend *fe, | |||
181 | *input_freq = -value; | 181 | *input_freq = -value; |
182 | 182 | ||
183 | dprintk("%s: if2 %d, ife %d, adc_clock %d => %d / 0x%x\n", | 183 | dprintk("%s: if2 %d, ife %d, adc_clock %d => %d / 0x%x\n", |
184 | __FUNCTION__, if2, ife, adc_clock, -(int)value, *input_freq); | 184 | __func__, if2, ife, adc_clock, -(int)value, *input_freq); |
185 | } | 185 | } |
186 | 186 | ||
187 | static int zl10353_sleep(struct dvb_frontend *fe) | 187 | static int zl10353_sleep(struct dvb_frontend *fe) |
diff --git a/drivers/media/dvb/frontends/zl10353.h b/drivers/media/dvb/frontends/zl10353.h index fc734c22b5fa..fdbb88ff75fe 100644 --- a/drivers/media/dvb/frontends/zl10353.h +++ b/drivers/media/dvb/frontends/zl10353.h | |||
@@ -47,7 +47,7 @@ extern struct dvb_frontend* zl10353_attach(const struct zl10353_config *config, | |||
47 | static inline struct dvb_frontend* zl10353_attach(const struct zl10353_config *config, | 47 | static inline struct dvb_frontend* zl10353_attach(const struct zl10353_config *config, |
48 | struct i2c_adapter *i2c) | 48 | struct i2c_adapter *i2c) |
49 | { | 49 | { |
50 | printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __FUNCTION__); | 50 | printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__); |
51 | return NULL; | 51 | return NULL; |
52 | } | 52 | } |
53 | #endif /* CONFIG_DVB_ZL10353 */ | 53 | #endif /* CONFIG_DVB_ZL10353 */ |
diff --git a/drivers/media/dvb/pluto2/pluto2.c b/drivers/media/dvb/pluto2/pluto2.c index 08a2599ed74a..960ed5763ae1 100644 --- a/drivers/media/dvb/pluto2/pluto2.c +++ b/drivers/media/dvb/pluto2/pluto2.c | |||
@@ -39,6 +39,8 @@ | |||
39 | #include "dvbdev.h" | 39 | #include "dvbdev.h" |
40 | #include "tda1004x.h" | 40 | #include "tda1004x.h" |
41 | 41 | ||
42 | DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); | ||
43 | |||
42 | #define DRIVER_NAME "pluto2" | 44 | #define DRIVER_NAME "pluto2" |
43 | 45 | ||
44 | #define REG_PIDn(n) ((n) << 2) /* PID n pattern registers */ | 46 | #define REG_PIDn(n) ((n) << 2) /* PID n pattern registers */ |
@@ -662,7 +664,8 @@ static int __devinit pluto2_probe(struct pci_dev *pdev, | |||
662 | goto err_pluto_hw_exit; | 664 | goto err_pluto_hw_exit; |
663 | 665 | ||
664 | /* dvb */ | 666 | /* dvb */ |
665 | ret = dvb_register_adapter(&pluto->dvb_adapter, DRIVER_NAME, THIS_MODULE, &pdev->dev); | 667 | ret = dvb_register_adapter(&pluto->dvb_adapter, DRIVER_NAME, |
668 | THIS_MODULE, &pdev->dev, adapter_nr); | ||
666 | if (ret < 0) | 669 | if (ret < 0) |
667 | goto err_i2c_del_adapter; | 670 | goto err_i2c_del_adapter; |
668 | 671 | ||
diff --git a/drivers/media/dvb/ttpci/av7110.c b/drivers/media/dvb/ttpci/av7110.c index 0e5701bdff19..747e7f1a6267 100644 --- a/drivers/media/dvb/ttpci/av7110.c +++ b/drivers/media/dvb/ttpci/av7110.c | |||
@@ -112,6 +112,8 @@ MODULE_PARM_DESC(wss_cfg_16_9, "WSS 16:9 - default 0x0007 - bit 15: disable, 14: | |||
112 | module_param(tv_standard, int, 0444); | 112 | module_param(tv_standard, int, 0444); |
113 | MODULE_PARM_DESC(tv_standard, "TV standard: 0 PAL (default), 1 NTSC"); | 113 | MODULE_PARM_DESC(tv_standard, "TV standard: 0 PAL (default), 1 NTSC"); |
114 | 114 | ||
115 | DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); | ||
116 | |||
115 | static void restart_feeds(struct av7110 *av7110); | 117 | static void restart_feeds(struct av7110 *av7110); |
116 | 118 | ||
117 | static int av7110_num; | 119 | static int av7110_num; |
@@ -359,7 +361,7 @@ static inline void start_debi_dma(struct av7110 *av7110, int dir, | |||
359 | { | 361 | { |
360 | dprintk(8, "%c %08lx %u\n", dir == DEBI_READ ? 'R' : 'W', addr, len); | 362 | dprintk(8, "%c %08lx %u\n", dir == DEBI_READ ? 'R' : 'W', addr, len); |
361 | if (saa7146_wait_for_debi_done(av7110->dev, 0)) { | 363 | if (saa7146_wait_for_debi_done(av7110->dev, 0)) { |
362 | printk(KERN_ERR "%s: saa7146_wait_for_debi_done timed out\n", __FUNCTION__); | 364 | printk(KERN_ERR "%s: saa7146_wait_for_debi_done timed out\n", __func__); |
363 | return; | 365 | return; |
364 | } | 366 | } |
365 | 367 | ||
@@ -497,7 +499,7 @@ static void gpioirq(unsigned long data) | |||
497 | saa7146_read(av7110->dev, SSR)); | 499 | saa7146_read(av7110->dev, SSR)); |
498 | 500 | ||
499 | if (saa7146_wait_for_debi_done(av7110->dev, 0)) { | 501 | if (saa7146_wait_for_debi_done(av7110->dev, 0)) { |
500 | printk(KERN_ERR "%s: saa7146_wait_for_debi_done timed out\n", __FUNCTION__); | 502 | printk(KERN_ERR "%s: saa7146_wait_for_debi_done timed out\n", __func__); |
501 | BUG(); /* maybe we should try resetting the debi? */ | 503 | BUG(); /* maybe we should try resetting the debi? */ |
502 | } | 504 | } |
503 | 505 | ||
@@ -827,7 +829,7 @@ static int StartHWFilter(struct dvb_demux_filter *dvbdmxfilter) | |||
827 | if (ret != 0 || handle >= 32) { | 829 | if (ret != 0 || handle >= 32) { |
828 | printk("dvb-ttpci: %s error buf %04x %04x %04x %04x " | 830 | printk("dvb-ttpci: %s error buf %04x %04x %04x %04x " |
829 | "ret %d handle %04x\n", | 831 | "ret %d handle %04x\n", |
830 | __FUNCTION__, buf[0], buf[1], buf[2], buf[3], | 832 | __func__, buf[0], buf[1], buf[2], buf[3], |
831 | ret, handle); | 833 | ret, handle); |
832 | dvbdmxfilter->hw_handle = 0xffff; | 834 | dvbdmxfilter->hw_handle = 0xffff; |
833 | if (!ret) | 835 | if (!ret) |
@@ -854,7 +856,7 @@ static int StopHWFilter(struct dvb_demux_filter *dvbdmxfilter) | |||
854 | handle = dvbdmxfilter->hw_handle; | 856 | handle = dvbdmxfilter->hw_handle; |
855 | if (handle >= 32) { | 857 | if (handle >= 32) { |
856 | printk("%s tried to stop invalid filter %04x, filter type = %x\n", | 858 | printk("%s tried to stop invalid filter %04x, filter type = %x\n", |
857 | __FUNCTION__, handle, dvbdmxfilter->type); | 859 | __func__, handle, dvbdmxfilter->type); |
858 | return -EINVAL; | 860 | return -EINVAL; |
859 | } | 861 | } |
860 | 862 | ||
@@ -867,7 +869,7 @@ static int StopHWFilter(struct dvb_demux_filter *dvbdmxfilter) | |||
867 | if (ret != 0 || answ[1] != handle) { | 869 | if (ret != 0 || answ[1] != handle) { |
868 | printk("dvb-ttpci: %s error cmd %04x %04x %04x ret %x " | 870 | printk("dvb-ttpci: %s error cmd %04x %04x %04x ret %x " |
869 | "resp %04x %04x pid %d\n", | 871 | "resp %04x %04x pid %d\n", |
870 | __FUNCTION__, buf[0], buf[1], buf[2], ret, | 872 | __func__, buf[0], buf[1], buf[2], ret, |
871 | answ[0], answ[1], dvbdmxfilter->feed->pid); | 873 | answ[0], answ[1], dvbdmxfilter->feed->pid); |
872 | if (!ret) | 874 | if (!ret) |
873 | ret = -1; | 875 | ret = -1; |
@@ -1122,7 +1124,7 @@ static int dvb_get_stc(struct dmx_demux *demux, unsigned int num, | |||
1122 | 1124 | ||
1123 | ret = av7110_fw_request(av7110, &tag, 0, fwstc, 4); | 1125 | ret = av7110_fw_request(av7110, &tag, 0, fwstc, 4); |
1124 | if (ret) { | 1126 | if (ret) { |
1125 | printk(KERN_ERR "%s: av7110_fw_request error\n", __FUNCTION__); | 1127 | printk(KERN_ERR "%s: av7110_fw_request error\n", __func__); |
1126 | return ret; | 1128 | return ret; |
1127 | } | 1129 | } |
1128 | dprintk(2, "fwstc = %04hx %04hx %04hx %04hx\n", | 1130 | dprintk(2, "fwstc = %04hx %04hx %04hx %04hx\n", |
@@ -2461,7 +2463,7 @@ static int __devinit av7110_attach(struct saa7146_dev* dev, | |||
2461 | goto err_kfree_0; | 2463 | goto err_kfree_0; |
2462 | 2464 | ||
2463 | ret = dvb_register_adapter(&av7110->dvb_adapter, av7110->card_name, | 2465 | ret = dvb_register_adapter(&av7110->dvb_adapter, av7110->card_name, |
2464 | THIS_MODULE, &dev->pci->dev); | 2466 | THIS_MODULE, &dev->pci->dev, adapter_nr); |
2465 | if (ret < 0) | 2467 | if (ret < 0) |
2466 | goto err_put_firmware_1; | 2468 | goto err_put_firmware_1; |
2467 | 2469 | ||
diff --git a/drivers/media/dvb/ttpci/av7110.h b/drivers/media/dvb/ttpci/av7110.h index 39fbf7d5cffb..e494e04eeee8 100644 --- a/drivers/media/dvb/ttpci/av7110.h +++ b/drivers/media/dvb/ttpci/av7110.h | |||
@@ -40,7 +40,7 @@ | |||
40 | extern int av7110_debug; | 40 | extern int av7110_debug; |
41 | 41 | ||
42 | #define dprintk(level,args...) \ | 42 | #define dprintk(level,args...) \ |
43 | do { if ((av7110_debug & level)) { printk("dvb-ttpci: %s(): ", __FUNCTION__); printk(args); } } while (0) | 43 | do { if ((av7110_debug & level)) { printk("dvb-ttpci: %s(): ", __func__); printk(args); } } while (0) |
44 | 44 | ||
45 | #define MAXFILT 32 | 45 | #define MAXFILT 32 |
46 | 46 | ||
diff --git a/drivers/media/dvb/ttpci/av7110_hw.c b/drivers/media/dvb/ttpci/av7110_hw.c index a468aa2e4854..9d81074b31df 100644 --- a/drivers/media/dvb/ttpci/av7110_hw.c +++ b/drivers/media/dvb/ttpci/av7110_hw.c | |||
@@ -53,11 +53,11 @@ int av7110_debiwrite(struct av7110 *av7110, u32 config, | |||
53 | struct saa7146_dev *dev = av7110->dev; | 53 | struct saa7146_dev *dev = av7110->dev; |
54 | 54 | ||
55 | if (count <= 0 || count > 32764) { | 55 | if (count <= 0 || count > 32764) { |
56 | printk("%s: invalid count %d\n", __FUNCTION__, count); | 56 | printk("%s: invalid count %d\n", __func__, count); |
57 | return -1; | 57 | return -1; |
58 | } | 58 | } |
59 | if (saa7146_wait_for_debi_done(av7110->dev, 0) < 0) { | 59 | if (saa7146_wait_for_debi_done(av7110->dev, 0) < 0) { |
60 | printk("%s: wait_for_debi_done failed\n", __FUNCTION__); | 60 | printk("%s: wait_for_debi_done failed\n", __func__); |
61 | return -1; | 61 | return -1; |
62 | } | 62 | } |
63 | saa7146_write(dev, DEBI_CONFIG, config); | 63 | saa7146_write(dev, DEBI_CONFIG, config); |
@@ -76,11 +76,11 @@ u32 av7110_debiread(struct av7110 *av7110, u32 config, int addr, int count) | |||
76 | u32 result = 0; | 76 | u32 result = 0; |
77 | 77 | ||
78 | if (count > 32764 || count <= 0) { | 78 | if (count > 32764 || count <= 0) { |
79 | printk("%s: invalid count %d\n", __FUNCTION__, count); | 79 | printk("%s: invalid count %d\n", __func__, count); |
80 | return 0; | 80 | return 0; |
81 | } | 81 | } |
82 | if (saa7146_wait_for_debi_done(av7110->dev, 0) < 0) { | 82 | if (saa7146_wait_for_debi_done(av7110->dev, 0) < 0) { |
83 | printk("%s: wait_for_debi_done #1 failed\n", __FUNCTION__); | 83 | printk("%s: wait_for_debi_done #1 failed\n", __func__); |
84 | return 0; | 84 | return 0; |
85 | } | 85 | } |
86 | saa7146_write(dev, DEBI_AD, av7110->debi_bus); | 86 | saa7146_write(dev, DEBI_AD, av7110->debi_bus); |
@@ -91,7 +91,7 @@ u32 av7110_debiread(struct av7110 *av7110, u32 config, int addr, int count) | |||
91 | if (count > 4) | 91 | if (count > 4) |
92 | return count; | 92 | return count; |
93 | if (saa7146_wait_for_debi_done(av7110->dev, 0) < 0) { | 93 | if (saa7146_wait_for_debi_done(av7110->dev, 0) < 0) { |
94 | printk("%s: wait_for_debi_done #2 failed\n", __FUNCTION__); | 94 | printk("%s: wait_for_debi_done #2 failed\n", __func__); |
95 | return 0; | 95 | return 0; |
96 | } | 96 | } |
97 | 97 | ||
@@ -332,7 +332,7 @@ int av7110_wait_msgstate(struct av7110 *av7110, u16 flags) | |||
332 | break; | 332 | break; |
333 | if (err) { | 333 | if (err) { |
334 | printk(KERN_ERR "%s: timeout waiting for MSGSTATE %04x\n", | 334 | printk(KERN_ERR "%s: timeout waiting for MSGSTATE %04x\n", |
335 | __FUNCTION__, stat & flags); | 335 | __func__, stat & flags); |
336 | return -ETIMEDOUT; | 336 | return -ETIMEDOUT; |
337 | } | 337 | } |
338 | msleep(1); | 338 | msleep(1); |
@@ -362,7 +362,7 @@ static int __av7110_send_fw_cmd(struct av7110 *av7110, u16* buf, int length) | |||
362 | if (rdebi(av7110, DEBINOSWAP, COMMAND, 0, 2) == 0) | 362 | if (rdebi(av7110, DEBINOSWAP, COMMAND, 0, 2) == 0) |
363 | break; | 363 | break; |
364 | if (err) { | 364 | if (err) { |
365 | printk(KERN_ERR "dvb-ttpci: %s(): timeout waiting for COMMAND idle\n", __FUNCTION__); | 365 | printk(KERN_ERR "dvb-ttpci: %s(): timeout waiting for COMMAND idle\n", __func__); |
366 | av7110->arm_errors++; | 366 | av7110->arm_errors++; |
367 | return -ETIMEDOUT; | 367 | return -ETIMEDOUT; |
368 | } | 368 | } |
@@ -379,7 +379,7 @@ static int __av7110_send_fw_cmd(struct av7110 *av7110, u16* buf, int length) | |||
379 | if (rdebi(av7110, DEBINOSWAP, HANDSHAKE_REG, 0, 2) == 0) | 379 | if (rdebi(av7110, DEBINOSWAP, HANDSHAKE_REG, 0, 2) == 0) |
380 | break; | 380 | break; |
381 | if (err) { | 381 | if (err) { |
382 | printk(KERN_ERR "dvb-ttpci: %s(): timeout waiting for HANDSHAKE_REG\n", __FUNCTION__); | 382 | printk(KERN_ERR "dvb-ttpci: %s(): timeout waiting for HANDSHAKE_REG\n", __func__); |
383 | return -ETIMEDOUT; | 383 | return -ETIMEDOUT; |
384 | } | 384 | } |
385 | msleep(1); | 385 | msleep(1); |
@@ -419,14 +419,14 @@ static int __av7110_send_fw_cmd(struct av7110 *av7110, u16* buf, int length) | |||
419 | stat = rdebi(av7110, DEBINOSWAP, MSGSTATE, 0, 2); | 419 | stat = rdebi(av7110, DEBINOSWAP, MSGSTATE, 0, 2); |
420 | if (stat & flags[0]) { | 420 | if (stat & flags[0]) { |
421 | printk(KERN_ERR "%s: %s QUEUE overflow\n", | 421 | printk(KERN_ERR "%s: %s QUEUE overflow\n", |
422 | __FUNCTION__, type); | 422 | __func__, type); |
423 | return -1; | 423 | return -1; |
424 | } | 424 | } |
425 | if ((stat & flags[1]) == 0) | 425 | if ((stat & flags[1]) == 0) |
426 | break; | 426 | break; |
427 | if (err) { | 427 | if (err) { |
428 | printk(KERN_ERR "%s: timeout waiting on busy %s QUEUE\n", | 428 | printk(KERN_ERR "%s: timeout waiting on busy %s QUEUE\n", |
429 | __FUNCTION__, type); | 429 | __func__, type); |
430 | return -ETIMEDOUT; | 430 | return -ETIMEDOUT; |
431 | } | 431 | } |
432 | msleep(1); | 432 | msleep(1); |
@@ -454,7 +454,7 @@ static int __av7110_send_fw_cmd(struct av7110 *av7110, u16* buf, int length) | |||
454 | break; | 454 | break; |
455 | if (err) { | 455 | if (err) { |
456 | printk(KERN_ERR "dvb-ttpci: %s(): timeout waiting for COMMAND %d to complete\n", | 456 | printk(KERN_ERR "dvb-ttpci: %s(): timeout waiting for COMMAND %d to complete\n", |
457 | __FUNCTION__, (buf[0] >> 8) & 0xff); | 457 | __func__, (buf[0] >> 8) & 0xff); |
458 | return -ETIMEDOUT; | 458 | return -ETIMEDOUT; |
459 | } | 459 | } |
460 | msleep(1); | 460 | msleep(1); |
@@ -462,11 +462,11 @@ static int __av7110_send_fw_cmd(struct av7110 *av7110, u16* buf, int length) | |||
462 | 462 | ||
463 | stat = rdebi(av7110, DEBINOSWAP, MSGSTATE, 0, 2); | 463 | stat = rdebi(av7110, DEBINOSWAP, MSGSTATE, 0, 2); |
464 | if (stat & GPMQOver) { | 464 | if (stat & GPMQOver) { |
465 | printk(KERN_ERR "dvb-ttpci: %s(): GPMQOver\n", __FUNCTION__); | 465 | printk(KERN_ERR "dvb-ttpci: %s(): GPMQOver\n", __func__); |
466 | return -ENOSPC; | 466 | return -ENOSPC; |
467 | } | 467 | } |
468 | else if (stat & OSDQOver) { | 468 | else if (stat & OSDQOver) { |
469 | printk(KERN_ERR "dvb-ttpci: %s(): OSDQOver\n", __FUNCTION__); | 469 | printk(KERN_ERR "dvb-ttpci: %s(): OSDQOver\n", __func__); |
470 | return -ENOSPC; | 470 | return -ENOSPC; |
471 | } | 471 | } |
472 | #endif | 472 | #endif |
@@ -491,7 +491,7 @@ static int av7110_send_fw_cmd(struct av7110 *av7110, u16* buf, int length) | |||
491 | mutex_unlock(&av7110->dcomlock); | 491 | mutex_unlock(&av7110->dcomlock); |
492 | if (ret && ret!=-ERESTARTSYS) | 492 | if (ret && ret!=-ERESTARTSYS) |
493 | printk(KERN_ERR "dvb-ttpci: %s(): av7110_send_fw_cmd error %d\n", | 493 | printk(KERN_ERR "dvb-ttpci: %s(): av7110_send_fw_cmd error %d\n", |
494 | __FUNCTION__, ret); | 494 | __func__, ret); |
495 | return ret; | 495 | return ret; |
496 | } | 496 | } |
497 | 497 | ||
@@ -575,7 +575,7 @@ int av7110_fw_request(struct av7110 *av7110, u16 *request_buf, | |||
575 | if (rdebi(av7110, DEBINOSWAP, COMMAND, 0, 2) == 0) | 575 | if (rdebi(av7110, DEBINOSWAP, COMMAND, 0, 2) == 0) |
576 | break; | 576 | break; |
577 | if (err) { | 577 | if (err) { |
578 | printk(KERN_ERR "%s: timeout waiting for COMMAND to complete\n", __FUNCTION__); | 578 | printk(KERN_ERR "%s: timeout waiting for COMMAND to complete\n", __func__); |
579 | mutex_unlock(&av7110->dcomlock); | 579 | mutex_unlock(&av7110->dcomlock); |
580 | return -ETIMEDOUT; | 580 | return -ETIMEDOUT; |
581 | } | 581 | } |
@@ -591,7 +591,7 @@ int av7110_fw_request(struct av7110 *av7110, u16 *request_buf, | |||
591 | if (rdebi(av7110, DEBINOSWAP, HANDSHAKE_REG, 0, 2) == 0) | 591 | if (rdebi(av7110, DEBINOSWAP, HANDSHAKE_REG, 0, 2) == 0) |
592 | break; | 592 | break; |
593 | if (err) { | 593 | if (err) { |
594 | printk(KERN_ERR "%s: timeout waiting for HANDSHAKE_REG\n", __FUNCTION__); | 594 | printk(KERN_ERR "%s: timeout waiting for HANDSHAKE_REG\n", __func__); |
595 | mutex_unlock(&av7110->dcomlock); | 595 | mutex_unlock(&av7110->dcomlock); |
596 | return -ETIMEDOUT; | 596 | return -ETIMEDOUT; |
597 | } | 597 | } |
@@ -602,12 +602,12 @@ int av7110_fw_request(struct av7110 *av7110, u16 *request_buf, | |||
602 | #ifdef COM_DEBUG | 602 | #ifdef COM_DEBUG |
603 | stat = rdebi(av7110, DEBINOSWAP, MSGSTATE, 0, 2); | 603 | stat = rdebi(av7110, DEBINOSWAP, MSGSTATE, 0, 2); |
604 | if (stat & GPMQOver) { | 604 | if (stat & GPMQOver) { |
605 | printk(KERN_ERR "%s: GPMQOver\n", __FUNCTION__); | 605 | printk(KERN_ERR "%s: GPMQOver\n", __func__); |
606 | mutex_unlock(&av7110->dcomlock); | 606 | mutex_unlock(&av7110->dcomlock); |
607 | return -1; | 607 | return -1; |
608 | } | 608 | } |
609 | else if (stat & OSDQOver) { | 609 | else if (stat & OSDQOver) { |
610 | printk(KERN_ERR "%s: OSDQOver\n", __FUNCTION__); | 610 | printk(KERN_ERR "%s: OSDQOver\n", __func__); |
611 | mutex_unlock(&av7110->dcomlock); | 611 | mutex_unlock(&av7110->dcomlock); |
612 | return -1; | 612 | return -1; |
613 | } | 613 | } |
@@ -741,7 +741,7 @@ static int FlushText(struct av7110 *av7110) | |||
741 | break; | 741 | break; |
742 | if (err) { | 742 | if (err) { |
743 | printk(KERN_ERR "dvb-ttpci: %s(): timeout waiting for BUFF1_BASE == 0\n", | 743 | printk(KERN_ERR "dvb-ttpci: %s(): timeout waiting for BUFF1_BASE == 0\n", |
744 | __FUNCTION__); | 744 | __func__); |
745 | mutex_unlock(&av7110->dcomlock); | 745 | mutex_unlock(&av7110->dcomlock); |
746 | return -ETIMEDOUT; | 746 | return -ETIMEDOUT; |
747 | } | 747 | } |
@@ -768,7 +768,7 @@ static int WriteText(struct av7110 *av7110, u8 win, u16 x, u16 y, char *buf) | |||
768 | break; | 768 | break; |
769 | if (ret) { | 769 | if (ret) { |
770 | printk(KERN_ERR "dvb-ttpci: %s: timeout waiting for BUFF1_BASE == 0\n", | 770 | printk(KERN_ERR "dvb-ttpci: %s: timeout waiting for BUFF1_BASE == 0\n", |
771 | __FUNCTION__); | 771 | __func__); |
772 | mutex_unlock(&av7110->dcomlock); | 772 | mutex_unlock(&av7110->dcomlock); |
773 | return -ETIMEDOUT; | 773 | return -ETIMEDOUT; |
774 | } | 774 | } |
@@ -782,7 +782,7 @@ static int WriteText(struct av7110 *av7110, u8 win, u16 x, u16 y, char *buf) | |||
782 | break; | 782 | break; |
783 | if (ret) { | 783 | if (ret) { |
784 | printk(KERN_ERR "dvb-ttpci: %s: timeout waiting for HANDSHAKE_REG\n", | 784 | printk(KERN_ERR "dvb-ttpci: %s: timeout waiting for HANDSHAKE_REG\n", |
785 | __FUNCTION__); | 785 | __func__); |
786 | mutex_unlock(&av7110->dcomlock); | 786 | mutex_unlock(&av7110->dcomlock); |
787 | return -ETIMEDOUT; | 787 | return -ETIMEDOUT; |
788 | } | 788 | } |
diff --git a/drivers/media/dvb/ttpci/av7110_ir.c b/drivers/media/dvb/ttpci/av7110_ir.c index a283e1de83fa..23a1c6380d3f 100644 --- a/drivers/media/dvb/ttpci/av7110_ir.c +++ b/drivers/media/dvb/ttpci/av7110_ir.c | |||
@@ -133,7 +133,7 @@ static void av7110_emit_key(unsigned long parm) | |||
133 | break; | 133 | break; |
134 | 134 | ||
135 | default: | 135 | default: |
136 | printk("%s invalid protocol %x\n", __FUNCTION__, ir->protocol); | 136 | printk("%s invalid protocol %x\n", __func__, ir->protocol); |
137 | return; | 137 | return; |
138 | } | 138 | } |
139 | 139 | ||
@@ -143,7 +143,7 @@ static void av7110_emit_key(unsigned long parm) | |||
143 | keycode = ir->key_map[data]; | 143 | keycode = ir->key_map[data]; |
144 | 144 | ||
145 | dprintk(16, "%s: code %08x -> addr %i data 0x%02x -> keycode %i\n", | 145 | dprintk(16, "%s: code %08x -> addr %i data 0x%02x -> keycode %i\n", |
146 | __FUNCTION__, ircom, addr, data, keycode); | 146 | __func__, ircom, addr, data, keycode); |
147 | 147 | ||
148 | /* check device address */ | 148 | /* check device address */ |
149 | if (!(ir->device_mask & (1 << addr))) | 149 | if (!(ir->device_mask & (1 << addr))) |
@@ -151,7 +151,7 @@ static void av7110_emit_key(unsigned long parm) | |||
151 | 151 | ||
152 | if (!keycode) { | 152 | if (!keycode) { |
153 | printk ("%s: code %08x -> addr %i data 0x%02x -> unknown key!\n", | 153 | printk ("%s: code %08x -> addr %i data 0x%02x -> unknown key!\n", |
154 | __FUNCTION__, ircom, addr, data); | 154 | __func__, ircom, addr, data); |
155 | return; | 155 | return; |
156 | } | 156 | } |
157 | 157 | ||
diff --git a/drivers/media/dvb/ttpci/av7110_v4l.c b/drivers/media/dvb/ttpci/av7110_v4l.c index e2f066fb7967..b4a0cc5dc935 100644 --- a/drivers/media/dvb/ttpci/av7110_v4l.c +++ b/drivers/media/dvb/ttpci/av7110_v4l.c | |||
@@ -573,7 +573,7 @@ static int av7110_vbi_reset(struct inode *inode, struct file *file) | |||
573 | struct saa7146_dev *dev = fh->dev; | 573 | struct saa7146_dev *dev = fh->dev; |
574 | struct av7110 *av7110 = (struct av7110*) dev->ext_priv; | 574 | struct av7110 *av7110 = (struct av7110*) dev->ext_priv; |
575 | 575 | ||
576 | dprintk(2, "%s\n", __FUNCTION__); | 576 | dprintk(2, "%s\n", __func__); |
577 | av7110->wssMode = 0; | 577 | av7110->wssMode = 0; |
578 | av7110->wssData = 0; | 578 | av7110->wssData = 0; |
579 | if (FW_VERSION(av7110->arm_app) < 0x2623) | 579 | if (FW_VERSION(av7110->arm_app) < 0x2623) |
@@ -590,7 +590,7 @@ static ssize_t av7110_vbi_write(struct file *file, const char __user *data, size | |||
590 | struct v4l2_sliced_vbi_data d; | 590 | struct v4l2_sliced_vbi_data d; |
591 | int rc; | 591 | int rc; |
592 | 592 | ||
593 | dprintk(2, "%s\n", __FUNCTION__); | 593 | dprintk(2, "%s\n", __func__); |
594 | if (FW_VERSION(av7110->arm_app) < 0x2623 || !av7110->wssMode || count != sizeof d) | 594 | if (FW_VERSION(av7110->arm_app) < 0x2623 || !av7110->wssMode || count != sizeof d) |
595 | return -EINVAL; | 595 | return -EINVAL; |
596 | if (copy_from_user(&d, data, count)) | 596 | if (copy_from_user(&d, data, count)) |
diff --git a/drivers/media/dvb/ttpci/budget-av.c b/drivers/media/dvb/ttpci/budget-av.c index 2d64d557b977..b30a5288e484 100644 --- a/drivers/media/dvb/ttpci/budget-av.c +++ b/drivers/media/dvb/ttpci/budget-av.c | |||
@@ -178,7 +178,7 @@ static int ciintf_read_cam_control(struct dvb_ca_en50221 *ca, int slot, u8 addre | |||
178 | udelay(1); | 178 | udelay(1); |
179 | 179 | ||
180 | result = ttpci_budget_debiread(&budget_av->budget, DEBICICAM, address & 3, 1, 0, 0); | 180 | result = ttpci_budget_debiread(&budget_av->budget, DEBICICAM, address & 3, 1, 0, 0); |
181 | if ((result == -ETIMEDOUT) || ((result == 0xff) && ((address & 3) < 2))) { | 181 | if (result == -ETIMEDOUT) { |
182 | ciintf_slot_shutdown(ca, slot); | 182 | ciintf_slot_shutdown(ca, slot); |
183 | printk(KERN_INFO "budget-av: cam ejected 3\n"); | 183 | printk(KERN_INFO "budget-av: cam ejected 3\n"); |
184 | return -ETIMEDOUT; | 184 | return -ETIMEDOUT; |
@@ -577,7 +577,7 @@ static struct stv0299_config typhoon_config = { | |||
577 | .mclk = 88000000UL, | 577 | .mclk = 88000000UL, |
578 | .invert = 0, | 578 | .invert = 0, |
579 | .skip_reinit = 0, | 579 | .skip_reinit = 0, |
580 | .lock_output = STV0229_LOCKOUTPUT_1, | 580 | .lock_output = STV0299_LOCKOUTPUT_1, |
581 | .volt13_op0_op1 = STV0299_VOLT13_OP0, | 581 | .volt13_op0_op1 = STV0299_VOLT13_OP0, |
582 | .min_delay_ms = 100, | 582 | .min_delay_ms = 100, |
583 | .set_symbol_rate = philips_su1278_ty_ci_set_symbol_rate, | 583 | .set_symbol_rate = philips_su1278_ty_ci_set_symbol_rate, |
@@ -590,7 +590,7 @@ static struct stv0299_config cinergy_1200s_config = { | |||
590 | .mclk = 88000000UL, | 590 | .mclk = 88000000UL, |
591 | .invert = 0, | 591 | .invert = 0, |
592 | .skip_reinit = 0, | 592 | .skip_reinit = 0, |
593 | .lock_output = STV0229_LOCKOUTPUT_0, | 593 | .lock_output = STV0299_LOCKOUTPUT_0, |
594 | .volt13_op0_op1 = STV0299_VOLT13_OP0, | 594 | .volt13_op0_op1 = STV0299_VOLT13_OP0, |
595 | .min_delay_ms = 100, | 595 | .min_delay_ms = 100, |
596 | .set_symbol_rate = philips_su1278_ty_ci_set_symbol_rate, | 596 | .set_symbol_rate = philips_su1278_ty_ci_set_symbol_rate, |
@@ -602,7 +602,7 @@ static struct stv0299_config cinergy_1200s_1894_0010_config = { | |||
602 | .mclk = 88000000UL, | 602 | .mclk = 88000000UL, |
603 | .invert = 1, | 603 | .invert = 1, |
604 | .skip_reinit = 0, | 604 | .skip_reinit = 0, |
605 | .lock_output = STV0229_LOCKOUTPUT_1, | 605 | .lock_output = STV0299_LOCKOUTPUT_1, |
606 | .volt13_op0_op1 = STV0299_VOLT13_OP0, | 606 | .volt13_op0_op1 = STV0299_VOLT13_OP0, |
607 | .min_delay_ms = 100, | 607 | .min_delay_ms = 100, |
608 | .set_symbol_rate = philips_su1278_ty_ci_set_symbol_rate, | 608 | .set_symbol_rate = philips_su1278_ty_ci_set_symbol_rate, |
@@ -869,7 +869,7 @@ static struct stv0299_config philips_sd1878_config = { | |||
869 | .mclk = 88000000UL, | 869 | .mclk = 88000000UL, |
870 | .invert = 0, | 870 | .invert = 0, |
871 | .skip_reinit = 0, | 871 | .skip_reinit = 0, |
872 | .lock_output = STV0229_LOCKOUTPUT_1, | 872 | .lock_output = STV0299_LOCKOUTPUT_1, |
873 | .volt13_op0_op1 = STV0299_VOLT13_OP0, | 873 | .volt13_op0_op1 = STV0299_VOLT13_OP0, |
874 | .min_delay_ms = 100, | 874 | .min_delay_ms = 100, |
875 | .set_symbol_rate = philips_sd1878_ci_set_symbol_rate, | 875 | .set_symbol_rate = philips_sd1878_ci_set_symbol_rate, |
@@ -941,6 +941,12 @@ static void frontend_init(struct budget_av *budget_av) | |||
941 | switch (saa->pci->subsystem_device) { | 941 | switch (saa->pci->subsystem_device) { |
942 | 942 | ||
943 | case SUBID_DVBS_KNC1: | 943 | case SUBID_DVBS_KNC1: |
944 | /* | ||
945 | * maybe that setting is needed for other dvb-s cards as well, | ||
946 | * but so far it has been only confirmed for this type | ||
947 | */ | ||
948 | budget_av->reinitialise_demod = 1; | ||
949 | /* fall through */ | ||
944 | case SUBID_DVBS_KNC1_PLUS: | 950 | case SUBID_DVBS_KNC1_PLUS: |
945 | case SUBID_DVBS_EASYWATCH_1: | 951 | case SUBID_DVBS_EASYWATCH_1: |
946 | if (saa->pci->subsystem_vendor == 0x1894) { | 952 | if (saa->pci->subsystem_vendor == 0x1894) { |
diff --git a/drivers/media/dvb/ttpci/budget-ci.c b/drivers/media/dvb/ttpci/budget-ci.c index 509349211d4f..6530323d5406 100644 --- a/drivers/media/dvb/ttpci/budget-ci.c +++ b/drivers/media/dvb/ttpci/budget-ci.c | |||
@@ -86,7 +86,7 @@ static int rc5_device = -1; | |||
86 | module_param(rc5_device, int, 0644); | 86 | module_param(rc5_device, int, 0644); |
87 | MODULE_PARM_DESC(rc5_device, "only IR commands to given RC5 device (device = 0 - 31, any device = 255, default: autodetect)"); | 87 | MODULE_PARM_DESC(rc5_device, "only IR commands to given RC5 device (device = 0 - 31, any device = 255, default: autodetect)"); |
88 | 88 | ||
89 | static int ir_debug = 0; | 89 | static int ir_debug; |
90 | module_param(ir_debug, int, 0644); | 90 | module_param(ir_debug, int, 0644); |
91 | MODULE_PARM_DESC(ir_debug, "enable debugging information for IR decoding"); | 91 | MODULE_PARM_DESC(ir_debug, "enable debugging information for IR decoding"); |
92 | 92 | ||
@@ -728,7 +728,7 @@ static struct stv0299_config philips_su1278_tt_config = { | |||
728 | .mclk = 64000000UL, | 728 | .mclk = 64000000UL, |
729 | .invert = 0, | 729 | .invert = 0, |
730 | .skip_reinit = 1, | 730 | .skip_reinit = 1, |
731 | .lock_output = STV0229_LOCKOUTPUT_1, | 731 | .lock_output = STV0299_LOCKOUTPUT_1, |
732 | .volt13_op0_op1 = STV0299_VOLT13_OP1, | 732 | .volt13_op0_op1 = STV0299_VOLT13_OP1, |
733 | .min_delay_ms = 50, | 733 | .min_delay_ms = 50, |
734 | .set_symbol_rate = philips_su1278_tt_set_symbol_rate, | 734 | .set_symbol_rate = philips_su1278_tt_set_symbol_rate, |
@@ -1121,7 +1121,7 @@ static void frontend_init(struct budget_ci *budget_ci) | |||
1121 | 1121 | ||
1122 | budget_ci->budget.dvb_frontend->ops.dishnetwork_send_legacy_command = NULL; | 1122 | budget_ci->budget.dvb_frontend->ops.dishnetwork_send_legacy_command = NULL; |
1123 | if (dvb_attach(lnbp21_attach, budget_ci->budget.dvb_frontend, &budget_ci->budget.i2c_adap, LNBP21_LLC, 0) == NULL) { | 1123 | if (dvb_attach(lnbp21_attach, budget_ci->budget.dvb_frontend, &budget_ci->budget.i2c_adap, LNBP21_LLC, 0) == NULL) { |
1124 | printk("%s: No LNBP21 found!\n", __FUNCTION__); | 1124 | printk("%s: No LNBP21 found!\n", __func__); |
1125 | dvb_frontend_detach(budget_ci->budget.dvb_frontend); | 1125 | dvb_frontend_detach(budget_ci->budget.dvb_frontend); |
1126 | budget_ci->budget.dvb_frontend = NULL; | 1126 | budget_ci->budget.dvb_frontend = NULL; |
1127 | } | 1127 | } |
diff --git a/drivers/media/dvb/ttpci/budget-core.c b/drivers/media/dvb/ttpci/budget-core.c index 0252081f013c..18cac4b12ab2 100644 --- a/drivers/media/dvb/ttpci/budget-core.c +++ b/drivers/media/dvb/ttpci/budget-core.c | |||
@@ -57,6 +57,8 @@ module_param_named(bufsize, dma_buffer_size, int, 0444); | |||
57 | MODULE_PARM_DESC(debug, "Turn on/off budget debugging (default:off)."); | 57 | MODULE_PARM_DESC(debug, "Turn on/off budget debugging (default:off)."); |
58 | MODULE_PARM_DESC(bufsize, "DMA buffer size in KB, default: 188, min: 188, max: 1410 (Activy: 564)"); | 58 | MODULE_PARM_DESC(bufsize, "DMA buffer size in KB, default: 188, min: 188, max: 1410 (Activy: 564)"); |
59 | 59 | ||
60 | DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); | ||
61 | |||
60 | /**************************************************************************** | 62 | /**************************************************************************** |
61 | * TT budget / WinTV Nova | 63 | * TT budget / WinTV Nova |
62 | ****************************************************************************/ | 64 | ****************************************************************************/ |
@@ -223,7 +225,7 @@ static void vpeirq(unsigned long data) | |||
223 | 225 | ||
224 | if (budget->buffer_warnings && time_after(jiffies, budget->buffer_warning_time)) { | 226 | if (budget->buffer_warnings && time_after(jiffies, budget->buffer_warning_time)) { |
225 | printk("%s %s: used %d times >80%% of buffer (%u bytes now)\n", | 227 | printk("%s %s: used %d times >80%% of buffer (%u bytes now)\n", |
226 | budget->dev->name, __FUNCTION__, budget->buffer_warnings, count); | 228 | budget->dev->name, __func__, budget->buffer_warnings, count); |
227 | budget->buffer_warning_time = jiffies + BUFFER_WARNING_WAIT; | 229 | budget->buffer_warning_time = jiffies + BUFFER_WARNING_WAIT; |
228 | budget->buffer_warnings = 0; | 230 | budget->buffer_warnings = 0; |
229 | } | 231 | } |
@@ -471,9 +473,10 @@ int ttpci_budget_init(struct budget *budget, struct saa7146_dev *dev, | |||
471 | budget->buffer_width, budget->buffer_height); | 473 | budget->buffer_width, budget->buffer_height); |
472 | printk("%s: dma buffer size %u\n", budget->dev->name, budget->buffer_size); | 474 | printk("%s: dma buffer size %u\n", budget->dev->name, budget->buffer_size); |
473 | 475 | ||
474 | if ((ret = dvb_register_adapter(&budget->dvb_adapter, budget->card->name, owner, &budget->dev->pci->dev)) < 0) { | 476 | ret = dvb_register_adapter(&budget->dvb_adapter, budget->card->name, |
477 | owner, &budget->dev->pci->dev, adapter_nr); | ||
478 | if (ret < 0) | ||
475 | return ret; | 479 | return ret; |
476 | } | ||
477 | 480 | ||
478 | /* set dd1 stream a & b */ | 481 | /* set dd1 stream a & b */ |
479 | saa7146_write(dev, DD1_STREAM_B, 0x00000000); | 482 | saa7146_write(dev, DD1_STREAM_B, 0x00000000); |
diff --git a/drivers/media/dvb/ttpci/budget.c b/drivers/media/dvb/ttpci/budget.c index 14b00f57b5de..2293d80c6e51 100644 --- a/drivers/media/dvb/ttpci/budget.c +++ b/drivers/media/dvb/ttpci/budget.c | |||
@@ -45,6 +45,7 @@ | |||
45 | #include "tda826x.h" | 45 | #include "tda826x.h" |
46 | #include "lnbp21.h" | 46 | #include "lnbp21.h" |
47 | #include "bsru6.h" | 47 | #include "bsru6.h" |
48 | #include "bsbe1.h" | ||
48 | 49 | ||
49 | static int diseqc_method; | 50 | static int diseqc_method; |
50 | module_param(diseqc_method, int, 0444); | 51 | module_param(diseqc_method, int, 0444); |
@@ -257,11 +258,17 @@ static struct ves1820_config alps_tdbe2_config = { | |||
257 | 258 | ||
258 | static int grundig_29504_401_tuner_set_params(struct dvb_frontend* fe, struct dvb_frontend_parameters* params) | 259 | static int grundig_29504_401_tuner_set_params(struct dvb_frontend* fe, struct dvb_frontend_parameters* params) |
259 | { | 260 | { |
260 | struct budget* budget = (struct budget*) fe->dvb->priv; | 261 | struct budget *budget = fe->dvb->priv; |
262 | u8 *tuner_addr = fe->tuner_priv; | ||
261 | u32 div; | 263 | u32 div; |
262 | u8 cfg, cpump, band_select; | 264 | u8 cfg, cpump, band_select; |
263 | u8 data[4]; | 265 | u8 data[4]; |
264 | struct i2c_msg msg = { .addr = 0x61, .flags = 0, .buf = data, .len = sizeof(data) }; | 266 | struct i2c_msg msg = { .flags = 0, .buf = data, .len = sizeof(data) }; |
267 | |||
268 | if (tuner_addr) | ||
269 | msg.addr = *tuner_addr; | ||
270 | else | ||
271 | msg.addr = 0x61; | ||
265 | 272 | ||
266 | div = (36125000 + params->frequency) / 166666; | 273 | div = (36125000 + params->frequency) / 166666; |
267 | 274 | ||
@@ -292,6 +299,12 @@ static struct l64781_config grundig_29504_401_config = { | |||
292 | .demod_address = 0x55, | 299 | .demod_address = 0x55, |
293 | }; | 300 | }; |
294 | 301 | ||
302 | static struct l64781_config grundig_29504_401_config_activy = { | ||
303 | .demod_address = 0x54, | ||
304 | }; | ||
305 | |||
306 | static u8 tuner_address_grundig_29504_401_activy = 0x60; | ||
307 | |||
295 | static int grundig_29504_451_tuner_set_params(struct dvb_frontend* fe, struct dvb_frontend_parameters* params) | 308 | static int grundig_29504_451_tuner_set_params(struct dvb_frontend* fe, struct dvb_frontend_parameters* params) |
296 | { | 309 | { |
297 | struct budget* budget = (struct budget*) fe->dvb->priv; | 310 | struct budget* budget = (struct budget*) fe->dvb->priv; |
@@ -346,14 +359,48 @@ static int s5h1420_tuner_set_params(struct dvb_frontend* fe, struct dvb_frontend | |||
346 | static struct s5h1420_config s5h1420_config = { | 359 | static struct s5h1420_config s5h1420_config = { |
347 | .demod_address = 0x53, | 360 | .demod_address = 0x53, |
348 | .invert = 1, | 361 | .invert = 1, |
362 | .cdclk_polarity = 1, | ||
349 | }; | 363 | }; |
350 | 364 | ||
351 | static struct tda10086_config tda10086_config = { | 365 | static struct tda10086_config tda10086_config = { |
352 | .demod_address = 0x0e, | 366 | .demod_address = 0x0e, |
353 | .invert = 0, | 367 | .invert = 0, |
354 | .diseqc_tone = 1, | 368 | .diseqc_tone = 1, |
369 | .xtal_freq = TDA10086_XTAL_16M, | ||
355 | }; | 370 | }; |
356 | 371 | ||
372 | static struct stv0299_config alps_bsru6_config_activy = { | ||
373 | .demod_address = 0x68, | ||
374 | .inittab = alps_bsru6_inittab, | ||
375 | .mclk = 88000000UL, | ||
376 | .invert = 1, | ||
377 | .op0_off = 1, | ||
378 | .min_delay_ms = 100, | ||
379 | .set_symbol_rate = alps_bsru6_set_symbol_rate, | ||
380 | }; | ||
381 | |||
382 | static struct stv0299_config alps_bsbe1_config_activy = { | ||
383 | .demod_address = 0x68, | ||
384 | .inittab = alps_bsbe1_inittab, | ||
385 | .mclk = 88000000UL, | ||
386 | .invert = 1, | ||
387 | .op0_off = 1, | ||
388 | .min_delay_ms = 100, | ||
389 | .set_symbol_rate = alps_bsbe1_set_symbol_rate, | ||
390 | }; | ||
391 | |||
392 | |||
393 | static int i2c_readreg(struct i2c_adapter *i2c, u8 adr, u8 reg) | ||
394 | { | ||
395 | u8 val; | ||
396 | struct i2c_msg msg[] = { | ||
397 | { .addr = adr, .flags = 0, .buf = ®, .len = 1 }, | ||
398 | { .addr = adr, .flags = I2C_M_RD, .buf = &val, .len = 1 } | ||
399 | }; | ||
400 | |||
401 | return (i2c_transfer(i2c, msg, 2) != 2) ? -EIO : val; | ||
402 | } | ||
403 | |||
357 | static u8 read_pwm(struct budget* budget) | 404 | static u8 read_pwm(struct budget* budget) |
358 | { | 405 | { |
359 | u8 b = 0xff; | 406 | u8 b = 0xff; |
@@ -369,6 +416,8 @@ static u8 read_pwm(struct budget* budget) | |||
369 | 416 | ||
370 | static void frontend_init(struct budget *budget) | 417 | static void frontend_init(struct budget *budget) |
371 | { | 418 | { |
419 | (void)alps_bsbe1_config; /* avoid warning */ | ||
420 | |||
372 | switch(budget->dev->pci->subsystem_device) { | 421 | switch(budget->dev->pci->subsystem_device) { |
373 | case 0x1003: // Hauppauge/TT Nova budget (stv0299/ALPS BSRU6(tsa5059) OR ves1893/ALPS BSRV2(sp5659)) | 422 | case 0x1003: // Hauppauge/TT Nova budget (stv0299/ALPS BSRU6(tsa5059) OR ves1893/ALPS BSRV2(sp5659)) |
374 | case 0x1013: | 423 | case 0x1013: |
@@ -414,15 +463,43 @@ static void frontend_init(struct budget *budget) | |||
414 | } | 463 | } |
415 | break; | 464 | break; |
416 | 465 | ||
417 | case 0x4f60: // Fujitsu Siemens Activy Budget-S PCI rev AL (stv0299/ALPS BSRU6(tsa5059)) | 466 | case 0x4f60: /* Fujitsu Siemens Activy Budget-S PCI rev AL (stv0299/tsa5059) */ |
418 | budget->dvb_frontend = dvb_attach(stv0299_attach, &alps_bsru6_config, &budget->i2c_adap); | 467 | { |
419 | if (budget->dvb_frontend) { | 468 | int subtype = i2c_readreg(&budget->i2c_adap, 0x50, 0x67); |
420 | budget->dvb_frontend->ops.tuner_ops.set_params = alps_bsru6_tuner_set_params; | 469 | |
421 | budget->dvb_frontend->tuner_priv = &budget->i2c_adap; | 470 | if (subtype < 0) |
422 | budget->dvb_frontend->ops.set_voltage = siemens_budget_set_voltage; | 471 | break; |
423 | budget->dvb_frontend->ops.dishnetwork_send_legacy_command = NULL; | 472 | /* fixme: find a better way to identify the card */ |
473 | if (subtype < 0x36) { | ||
474 | /* assume ALPS BSRU6 */ | ||
475 | budget->dvb_frontend = dvb_attach(stv0299_attach, &alps_bsru6_config_activy, &budget->i2c_adap); | ||
476 | if (budget->dvb_frontend) { | ||
477 | printk(KERN_INFO "budget: tuner ALPS BSRU6 detected\n"); | ||
478 | budget->dvb_frontend->ops.tuner_ops.set_params = alps_bsru6_tuner_set_params; | ||
479 | budget->dvb_frontend->tuner_priv = &budget->i2c_adap; | ||
480 | budget->dvb_frontend->ops.set_voltage = siemens_budget_set_voltage; | ||
481 | budget->dvb_frontend->ops.dishnetwork_send_legacy_command = NULL; | ||
482 | break; | ||
483 | } | ||
484 | } else { | ||
485 | /* assume ALPS BSBE1 */ | ||
486 | /* reset tuner */ | ||
487 | saa7146_setgpio(budget->dev, 3, SAA7146_GPIO_OUTLO); | ||
488 | msleep(50); | ||
489 | saa7146_setgpio(budget->dev, 3, SAA7146_GPIO_OUTHI); | ||
490 | msleep(250); | ||
491 | budget->dvb_frontend = dvb_attach(stv0299_attach, &alps_bsbe1_config_activy, &budget->i2c_adap); | ||
492 | if (budget->dvb_frontend) { | ||
493 | printk(KERN_INFO "budget: tuner ALPS BSBE1 detected\n"); | ||
494 | budget->dvb_frontend->ops.tuner_ops.set_params = alps_bsbe1_tuner_set_params; | ||
495 | budget->dvb_frontend->tuner_priv = &budget->i2c_adap; | ||
496 | budget->dvb_frontend->ops.set_voltage = siemens_budget_set_voltage; | ||
497 | budget->dvb_frontend->ops.dishnetwork_send_legacy_command = NULL; | ||
498 | break; | ||
499 | } | ||
424 | } | 500 | } |
425 | break; | 501 | break; |
502 | } | ||
426 | 503 | ||
427 | case 0x4f61: // Fujitsu Siemens Activy Budget-S PCI rev GR (tda8083/Grundig 29504-451(tsa5522)) | 504 | case 0x4f61: // Fujitsu Siemens Activy Budget-S PCI rev GR (tda8083/Grundig 29504-451(tsa5522)) |
428 | budget->dvb_frontend = dvb_attach(tda8083_attach, &grundig_29504_451_config, &budget->i2c_adap); | 505 | budget->dvb_frontend = dvb_attach(tda8083_attach, &grundig_29504_451_config, &budget->i2c_adap); |
@@ -433,12 +510,20 @@ static void frontend_init(struct budget *budget) | |||
433 | } | 510 | } |
434 | break; | 511 | break; |
435 | 512 | ||
513 | case 0x5f61: /* Fujitsu Siemens Activy Budget-T PCI rev GR (L64781/Grundig 29504-401(tsa5060)) */ | ||
514 | budget->dvb_frontend = dvb_attach(l64781_attach, &grundig_29504_401_config_activy, &budget->i2c_adap); | ||
515 | if (budget->dvb_frontend) { | ||
516 | budget->dvb_frontend->tuner_priv = &tuner_address_grundig_29504_401_activy; | ||
517 | budget->dvb_frontend->ops.tuner_ops.set_params = grundig_29504_401_tuner_set_params; | ||
518 | } | ||
519 | break; | ||
520 | |||
436 | case 0x1016: // Hauppauge/TT Nova-S SE (samsung s5h1420/????(tda8260)) | 521 | case 0x1016: // Hauppauge/TT Nova-S SE (samsung s5h1420/????(tda8260)) |
437 | budget->dvb_frontend = dvb_attach(s5h1420_attach, &s5h1420_config, &budget->i2c_adap); | 522 | budget->dvb_frontend = dvb_attach(s5h1420_attach, &s5h1420_config, &budget->i2c_adap); |
438 | if (budget->dvb_frontend) { | 523 | if (budget->dvb_frontend) { |
439 | budget->dvb_frontend->ops.tuner_ops.set_params = s5h1420_tuner_set_params; | 524 | budget->dvb_frontend->ops.tuner_ops.set_params = s5h1420_tuner_set_params; |
440 | if (dvb_attach(lnbp21_attach, budget->dvb_frontend, &budget->i2c_adap, 0, 0) == NULL) { | 525 | if (dvb_attach(lnbp21_attach, budget->dvb_frontend, &budget->i2c_adap, 0, 0) == NULL) { |
441 | printk("%s: No LNBP21 found!\n", __FUNCTION__); | 526 | printk("%s: No LNBP21 found!\n", __func__); |
442 | goto error_out; | 527 | goto error_out; |
443 | } | 528 | } |
444 | break; | 529 | break; |
@@ -454,9 +539,9 @@ static void frontend_init(struct budget *budget) | |||
454 | budget->dvb_frontend = dvb_attach(tda10086_attach, &tda10086_config, &budget->i2c_adap); | 539 | budget->dvb_frontend = dvb_attach(tda10086_attach, &tda10086_config, &budget->i2c_adap); |
455 | if (budget->dvb_frontend) { | 540 | if (budget->dvb_frontend) { |
456 | if (dvb_attach(tda826x_attach, budget->dvb_frontend, 0x60, &budget->i2c_adap, 0) == NULL) | 541 | if (dvb_attach(tda826x_attach, budget->dvb_frontend, 0x60, &budget->i2c_adap, 0) == NULL) |
457 | printk("%s: No tda826x found!\n", __FUNCTION__); | 542 | printk("%s: No tda826x found!\n", __func__); |
458 | if (dvb_attach(lnbp21_attach, budget->dvb_frontend, &budget->i2c_adap, 0, 0) == NULL) { | 543 | if (dvb_attach(lnbp21_attach, budget->dvb_frontend, &budget->i2c_adap, 0, 0) == NULL) { |
459 | printk("%s: No LNBP21 found!\n", __FUNCTION__); | 544 | printk("%s: No LNBP21 found!\n", __func__); |
460 | goto error_out; | 545 | goto error_out; |
461 | } | 546 | } |
462 | break; | 547 | break; |
@@ -537,6 +622,7 @@ MAKE_BUDGET_INFO(satel, "SATELCO Multimedia PCI", BUDGET_TT_HW_DISEQC); | |||
537 | MAKE_BUDGET_INFO(ttbs1401, "TT-Budget-S-1401 PCI", BUDGET_TT); | 622 | MAKE_BUDGET_INFO(ttbs1401, "TT-Budget-S-1401 PCI", BUDGET_TT); |
538 | MAKE_BUDGET_INFO(fsacs0, "Fujitsu Siemens Activy Budget-S PCI (rev GR/grundig frontend)", BUDGET_FS_ACTIVY); | 623 | MAKE_BUDGET_INFO(fsacs0, "Fujitsu Siemens Activy Budget-S PCI (rev GR/grundig frontend)", BUDGET_FS_ACTIVY); |
539 | MAKE_BUDGET_INFO(fsacs1, "Fujitsu Siemens Activy Budget-S PCI (rev AL/alps frontend)", BUDGET_FS_ACTIVY); | 624 | MAKE_BUDGET_INFO(fsacs1, "Fujitsu Siemens Activy Budget-S PCI (rev AL/alps frontend)", BUDGET_FS_ACTIVY); |
625 | MAKE_BUDGET_INFO(fsact, "Fujitsu Siemens Activy Budget-T PCI (rev GR/Grundig frontend)", BUDGET_FS_ACTIVY); | ||
540 | 626 | ||
541 | static struct pci_device_id pci_tbl[] = { | 627 | static struct pci_device_id pci_tbl[] = { |
542 | MAKE_EXTENSION_PCI(ttbs, 0x13c2, 0x1003), | 628 | MAKE_EXTENSION_PCI(ttbs, 0x13c2, 0x1003), |
@@ -547,6 +633,7 @@ static struct pci_device_id pci_tbl[] = { | |||
547 | MAKE_EXTENSION_PCI(ttbs1401, 0x13c2, 0x1018), | 633 | MAKE_EXTENSION_PCI(ttbs1401, 0x13c2, 0x1018), |
548 | MAKE_EXTENSION_PCI(fsacs1,0x1131, 0x4f60), | 634 | MAKE_EXTENSION_PCI(fsacs1,0x1131, 0x4f60), |
549 | MAKE_EXTENSION_PCI(fsacs0,0x1131, 0x4f61), | 635 | MAKE_EXTENSION_PCI(fsacs0,0x1131, 0x4f61), |
636 | MAKE_EXTENSION_PCI(fsact, 0x1131, 0x5f61), | ||
550 | { | 637 | { |
551 | .vendor = 0, | 638 | .vendor = 0, |
552 | } | 639 | } |
diff --git a/drivers/media/dvb/ttpci/budget.h b/drivers/media/dvb/ttpci/budget.h index d764ffa728b0..dd450b739bff 100644 --- a/drivers/media/dvb/ttpci/budget.h +++ b/drivers/media/dvb/ttpci/budget.h | |||
@@ -1,3 +1,4 @@ | |||
1 | |||
1 | #ifndef __BUDGET_DVB__ | 2 | #ifndef __BUDGET_DVB__ |
2 | #define __BUDGET_DVB__ | 3 | #define __BUDGET_DVB__ |
3 | 4 | ||
@@ -21,7 +22,7 @@ extern int budget_debug; | |||
21 | #endif | 22 | #endif |
22 | 23 | ||
23 | #define dprintk(level,args...) \ | 24 | #define dprintk(level,args...) \ |
24 | do { if ((budget_debug & level)) { printk("%s: %s(): ", KBUILD_MODNAME, __FUNCTION__); printk(args); } } while (0) | 25 | do { if ((budget_debug & level)) { printk("%s: %s(): ", KBUILD_MODNAME, __func__); printk(args); } } while (0) |
25 | 26 | ||
26 | struct budget_info { | 27 | struct budget_info { |
27 | char *name; | 28 | char *name; |
diff --git a/drivers/media/dvb/ttpci/ttpci-eeprom.c b/drivers/media/dvb/ttpci/ttpci-eeprom.c index 1f31e91195b0..7dd54b3026a2 100644 --- a/drivers/media/dvb/ttpci/ttpci-eeprom.c +++ b/drivers/media/dvb/ttpci/ttpci-eeprom.c | |||
@@ -95,7 +95,7 @@ static int ttpci_eeprom_read_encodedMAC(struct i2c_adapter *adapter, u8 * encode | |||
95 | { .addr = 0x50, .flags = I2C_M_RD, .buf = encodedMAC, .len = 20 } | 95 | { .addr = 0x50, .flags = I2C_M_RD, .buf = encodedMAC, .len = 20 } |
96 | }; | 96 | }; |
97 | 97 | ||
98 | /* dprintk("%s\n", __FUNCTION__); */ | 98 | /* dprintk("%s\n", __func__); */ |
99 | 99 | ||
100 | ret = i2c_transfer(adapter, msg, 2); | 100 | ret = i2c_transfer(adapter, msg, 2); |
101 | 101 | ||
diff --git a/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c b/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c index 7902ae1d9a18..732ce4de512e 100644 --- a/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c +++ b/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c | |||
@@ -56,10 +56,11 @@ | |||
56 | */ | 56 | */ |
57 | 57 | ||
58 | static int debug; | 58 | static int debug; |
59 | |||
60 | module_param(debug, int, 0644); | 59 | module_param(debug, int, 0644); |
61 | MODULE_PARM_DESC(debug, "Turn on/off debugging (default:off)."); | 60 | MODULE_PARM_DESC(debug, "Turn on/off debugging (default:off)."); |
62 | 61 | ||
62 | DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); | ||
63 | |||
63 | #define dprintk(x...) do { if (debug) printk(KERN_DEBUG x); } while (0) | 64 | #define dprintk(x...) do { if (debug) printk(KERN_DEBUG x); } while (0) |
64 | 65 | ||
65 | #define ISO_BUF_COUNT 4 | 66 | #define ISO_BUF_COUNT 4 |
@@ -153,12 +154,12 @@ static int ttusb_cmd(struct ttusb *ttusb, | |||
153 | (u8 *) data, len, &actual_len, 1000); | 154 | (u8 *) data, len, &actual_len, 1000); |
154 | if (err != 0) { | 155 | if (err != 0) { |
155 | dprintk("%s: usb_bulk_msg(send) failed, err == %i!\n", | 156 | dprintk("%s: usb_bulk_msg(send) failed, err == %i!\n", |
156 | __FUNCTION__, err); | 157 | __func__, err); |
157 | mutex_unlock(&ttusb->semusb); | 158 | mutex_unlock(&ttusb->semusb); |
158 | return err; | 159 | return err; |
159 | } | 160 | } |
160 | if (actual_len != len) { | 161 | if (actual_len != len) { |
161 | dprintk("%s: only wrote %d of %d bytes\n", __FUNCTION__, | 162 | dprintk("%s: only wrote %d of %d bytes\n", __func__, |
162 | actual_len, len); | 163 | actual_len, len); |
163 | mutex_unlock(&ttusb->semusb); | 164 | mutex_unlock(&ttusb->semusb); |
164 | return -1; | 165 | return -1; |
@@ -168,7 +169,7 @@ static int ttusb_cmd(struct ttusb *ttusb, | |||
168 | ttusb->last_result, 32, &actual_len, 1000); | 169 | ttusb->last_result, 32, &actual_len, 1000); |
169 | 170 | ||
170 | if (err != 0) { | 171 | if (err != 0) { |
171 | printk("%s: failed, receive error %d\n", __FUNCTION__, | 172 | printk("%s: failed, receive error %d\n", __func__, |
172 | err); | 173 | err); |
173 | mutex_unlock(&ttusb->semusb); | 174 | mutex_unlock(&ttusb->semusb); |
174 | return err; | 175 | return err; |
@@ -229,7 +230,7 @@ static int ttusb_i2c_msg(struct ttusb *ttusb, | |||
229 | if (err || b[0] != 0x55 || b[1] != id) { | 230 | if (err || b[0] != 0x55 || b[1] != id) { |
230 | dprintk | 231 | dprintk |
231 | ("%s: usb_bulk_msg(recv) failed, err == %i, id == %02x, b == ", | 232 | ("%s: usb_bulk_msg(recv) failed, err == %i, id == %02x, b == ", |
232 | __FUNCTION__, err, id); | 233 | __func__, err, id); |
233 | return -EREMOTEIO; | 234 | return -EREMOTEIO; |
234 | } | 235 | } |
235 | 236 | ||
@@ -273,7 +274,7 @@ static int master_xfer(struct i2c_adapter* adapter, struct i2c_msg *msg, int num | |||
273 | snd_buf, snd_len, rcv_buf, rcv_len); | 274 | snd_buf, snd_len, rcv_buf, rcv_len); |
274 | 275 | ||
275 | if (err < rcv_len) { | 276 | if (err < rcv_len) { |
276 | dprintk("%s: i == %i\n", __FUNCTION__, i); | 277 | dprintk("%s: i == %i\n", __func__, i); |
277 | break; | 278 | break; |
278 | } | 279 | } |
279 | 280 | ||
@@ -327,7 +328,7 @@ static int ttusb_boot_dsp(struct ttusb *ttusb) | |||
327 | done: | 328 | done: |
328 | if (err) { | 329 | if (err) { |
329 | dprintk("%s: usb_bulk_msg() failed, return value %i!\n", | 330 | dprintk("%s: usb_bulk_msg() failed, return value %i!\n", |
330 | __FUNCTION__, err); | 331 | __func__, err); |
331 | } | 332 | } |
332 | 333 | ||
333 | return err; | 334 | return err; |
@@ -427,7 +428,7 @@ static int ttusb_init_controller(struct ttusb *ttusb) | |||
427 | if ((err = ttusb_result(ttusb, get_version, sizeof(get_version)))) | 428 | if ((err = ttusb_result(ttusb, get_version, sizeof(get_version)))) |
428 | return err; | 429 | return err; |
429 | 430 | ||
430 | dprintk("%s: stc-version: %c%c%c%c%c\n", __FUNCTION__, | 431 | dprintk("%s: stc-version: %c%c%c%c%c\n", __func__, |
431 | get_version[4], get_version[5], get_version[6], | 432 | get_version[4], get_version[5], get_version[6], |
432 | get_version[7], get_version[8]); | 433 | get_version[7], get_version[8]); |
433 | 434 | ||
@@ -437,7 +438,7 @@ static int ttusb_init_controller(struct ttusb *ttusb) | |||
437 | memcmp(get_version + 4, "V 2.2", 5)) { | 438 | memcmp(get_version + 4, "V 2.2", 5)) { |
438 | printk | 439 | printk |
439 | ("%s: unknown STC version %c%c%c%c%c, please report!\n", | 440 | ("%s: unknown STC version %c%c%c%c%c, please report!\n", |
440 | __FUNCTION__, get_version[4], get_version[5], | 441 | __func__, get_version[4], get_version[5], |
441 | get_version[6], get_version[7], get_version[8]); | 442 | get_version[6], get_version[7], get_version[8]); |
442 | } | 443 | } |
443 | 444 | ||
@@ -453,7 +454,7 @@ static int ttusb_init_controller(struct ttusb *ttusb) | |||
453 | ttusb_result(ttusb, get_dsp_version, sizeof(get_dsp_version)); | 454 | ttusb_result(ttusb, get_dsp_version, sizeof(get_dsp_version)); |
454 | if (err) | 455 | if (err) |
455 | return err; | 456 | return err; |
456 | printk("%s: dsp-version: %c%c%c\n", __FUNCTION__, | 457 | printk("%s: dsp-version: %c%c%c\n", __func__, |
457 | get_dsp_version[4], get_dsp_version[5], get_dsp_version[6]); | 458 | get_dsp_version[4], get_dsp_version[5], get_dsp_version[6]); |
458 | return 0; | 459 | return 0; |
459 | } | 460 | } |
@@ -476,7 +477,7 @@ static int ttusb_send_diseqc(struct dvb_frontend* fe, | |||
476 | /* Diseqc */ | 477 | /* Diseqc */ |
477 | if ((err = ttusb_cmd(ttusb, b, 4 + b[3], 0))) { | 478 | if ((err = ttusb_cmd(ttusb, b, 4 + b[3], 0))) { |
478 | dprintk("%s: usb_bulk_msg() failed, return value %i!\n", | 479 | dprintk("%s: usb_bulk_msg() failed, return value %i!\n", |
479 | __FUNCTION__, err); | 480 | __func__, err); |
480 | } | 481 | } |
481 | 482 | ||
482 | return err; | 483 | return err; |
@@ -494,7 +495,7 @@ static int ttusb_update_lnb(struct ttusb *ttusb) | |||
494 | /* SetLNB */ | 495 | /* SetLNB */ |
495 | if ((err = ttusb_cmd(ttusb, b, sizeof(b), 0))) { | 496 | if ((err = ttusb_cmd(ttusb, b, sizeof(b), 0))) { |
496 | dprintk("%s: usb_bulk_msg() failed, return value %i!\n", | 497 | dprintk("%s: usb_bulk_msg() failed, return value %i!\n", |
497 | __FUNCTION__, err); | 498 | __func__, err); |
498 | } | 499 | } |
499 | 500 | ||
500 | return err; | 501 | return err; |
@@ -528,7 +529,7 @@ static void ttusb_set_led_freq(struct ttusb *ttusb, u8 freq) | |||
528 | err = ttusb_cmd(ttusb, b, sizeof(b), 0); | 529 | err = ttusb_cmd(ttusb, b, sizeof(b), 0); |
529 | if (err) { | 530 | if (err) { |
530 | dprintk("%s: usb_bulk_msg() failed, return value %i!\n", | 531 | dprintk("%s: usb_bulk_msg() failed, return value %i!\n", |
531 | __FUNCTION__, err); | 532 | __func__, err); |
532 | } | 533 | } |
533 | } | 534 | } |
534 | #endif | 535 | #endif |
@@ -542,7 +543,7 @@ static void ttusb_handle_sec_data(struct ttusb_channel *channel, | |||
542 | const u8 * data, int len); | 543 | const u8 * data, int len); |
543 | #endif | 544 | #endif |
544 | 545 | ||
545 | static int numpkt = 0, numts, numstuff, numsec, numinvalid; | 546 | static int numpkt, numts, numstuff, numsec, numinvalid; |
546 | static unsigned long lastj; | 547 | static unsigned long lastj; |
547 | 548 | ||
548 | static void ttusb_process_muxpack(struct ttusb *ttusb, const u8 * muxpack, | 549 | static void ttusb_process_muxpack(struct ttusb *ttusb, const u8 * muxpack, |
@@ -554,7 +555,7 @@ static void ttusb_process_muxpack(struct ttusb *ttusb, const u8 * muxpack, | |||
554 | csum ^= le16_to_cpup((u16 *) (muxpack + i)); | 555 | csum ^= le16_to_cpup((u16 *) (muxpack + i)); |
555 | if (csum) { | 556 | if (csum) { |
556 | printk("%s: muxpack with incorrect checksum, ignoring\n", | 557 | printk("%s: muxpack with incorrect checksum, ignoring\n", |
557 | __FUNCTION__); | 558 | __func__); |
558 | numinvalid++; | 559 | numinvalid++; |
559 | return; | 560 | return; |
560 | } | 561 | } |
@@ -563,7 +564,7 @@ static void ttusb_process_muxpack(struct ttusb *ttusb, const u8 * muxpack, | |||
563 | cc &= 0x7FFF; | 564 | cc &= 0x7FFF; |
564 | if ((cc != ttusb->cc) && (ttusb->cc != -1)) | 565 | if ((cc != ttusb->cc) && (ttusb->cc != -1)) |
565 | printk("%s: cc discontinuity (%d frames missing)\n", | 566 | printk("%s: cc discontinuity (%d frames missing)\n", |
566 | __FUNCTION__, (cc - ttusb->cc) & 0x7FFF); | 567 | __func__, (cc - ttusb->cc) & 0x7FFF); |
567 | ttusb->cc = (cc + 1) & 0x7FFF; | 568 | ttusb->cc = (cc + 1) & 0x7FFF; |
568 | if (muxpack[0] & 0x80) { | 569 | if (muxpack[0] & 0x80) { |
569 | #ifdef TTUSB_HWSECTIONS | 570 | #ifdef TTUSB_HWSECTIONS |
@@ -613,7 +614,7 @@ static void ttusb_process_frame(struct ttusb *ttusb, u8 * data, int len) | |||
613 | int maxwork = 1024; | 614 | int maxwork = 1024; |
614 | while (len) { | 615 | while (len) { |
615 | if (!(maxwork--)) { | 616 | if (!(maxwork--)) { |
616 | printk("%s: too much work\n", __FUNCTION__); | 617 | printk("%s: too much work\n", __func__); |
617 | break; | 618 | break; |
618 | } | 619 | } |
619 | 620 | ||
@@ -632,7 +633,7 @@ static void ttusb_process_frame(struct ttusb *ttusb, u8 * data, int len) | |||
632 | #else | 633 | #else |
633 | if (ttusb->insync) { | 634 | if (ttusb->insync) { |
634 | printk("%s: lost sync.\n", | 635 | printk("%s: lost sync.\n", |
635 | __FUNCTION__); | 636 | __func__); |
636 | ttusb->insync = 0; | 637 | ttusb->insync = 0; |
637 | } | 638 | } |
638 | #endif | 639 | #endif |
@@ -691,7 +692,7 @@ static void ttusb_process_frame(struct ttusb *ttusb, u8 * data, int len) | |||
691 | else { | 692 | else { |
692 | dprintk | 693 | dprintk |
693 | ("%s: invalid state: first byte is %x\n", | 694 | ("%s: invalid state: first byte is %x\n", |
694 | __FUNCTION__, | 695 | __func__, |
695 | ttusb->muxpack[0]); | 696 | ttusb->muxpack[0]); |
696 | ttusb->mux_state = 0; | 697 | ttusb->mux_state = 0; |
697 | } | 698 | } |
@@ -740,7 +741,7 @@ static void ttusb_iso_irq(struct urb *urb) | |||
740 | 741 | ||
741 | #if 0 | 742 | #if 0 |
742 | printk("%s: status %d, errcount == %d, length == %i\n", | 743 | printk("%s: status %d, errcount == %d, length == %i\n", |
743 | __FUNCTION__, | 744 | __func__, |
744 | urb->status, urb->error_count, urb->actual_length); | 745 | urb->status, urb->error_count, urb->actual_length); |
745 | #endif | 746 | #endif |
746 | 747 | ||
@@ -833,7 +834,7 @@ static int ttusb_start_iso_xfer(struct ttusb *ttusb) | |||
833 | int i, j, err, buffer_offset = 0; | 834 | int i, j, err, buffer_offset = 0; |
834 | 835 | ||
835 | if (ttusb->iso_streaming) { | 836 | if (ttusb->iso_streaming) { |
836 | printk("%s: iso xfer already running!\n", __FUNCTION__); | 837 | printk("%s: iso xfer already running!\n", __func__); |
837 | return 0; | 838 | return 0; |
838 | } | 839 | } |
839 | 840 | ||
@@ -869,7 +870,7 @@ static int ttusb_start_iso_xfer(struct ttusb *ttusb) | |||
869 | ttusb_stop_iso_xfer(ttusb); | 870 | ttusb_stop_iso_xfer(ttusb); |
870 | printk | 871 | printk |
871 | ("%s: failed urb submission (%i: err = %i)!\n", | 872 | ("%s: failed urb submission (%i: err = %i)!\n", |
872 | __FUNCTION__, i, err); | 873 | __func__, i, err); |
873 | return err; | 874 | return err; |
874 | } | 875 | } |
875 | } | 876 | } |
@@ -1005,7 +1006,7 @@ static int stc_release(struct inode *inode, struct file *file) | |||
1005 | return 0; | 1006 | return 0; |
1006 | } | 1007 | } |
1007 | 1008 | ||
1008 | static struct file_operations stc_fops = { | 1009 | static const struct file_operations stc_fops = { |
1009 | .owner = THIS_MODULE, | 1010 | .owner = THIS_MODULE, |
1010 | .read = stc_read, | 1011 | .read = stc_read, |
1011 | .open = stc_open, | 1012 | .open = stc_open, |
@@ -1313,7 +1314,7 @@ static struct stv0299_config alps_stv0299_config = { | |||
1313 | .mclk = 88000000UL, | 1314 | .mclk = 88000000UL, |
1314 | .invert = 1, | 1315 | .invert = 1, |
1315 | .skip_reinit = 0, | 1316 | .skip_reinit = 0, |
1316 | .lock_output = STV0229_LOCKOUTPUT_1, | 1317 | .lock_output = STV0299_LOCKOUTPUT_1, |
1317 | .volt13_op0_op1 = STV0299_VOLT13_OP1, | 1318 | .volt13_op0_op1 = STV0299_VOLT13_OP1, |
1318 | .min_delay_ms = 100, | 1319 | .min_delay_ms = 100, |
1319 | .set_symbol_rate = alps_stv0299_set_symbol_rate, | 1320 | .set_symbol_rate = alps_stv0299_set_symbol_rate, |
@@ -1643,7 +1644,7 @@ static int ttusb_probe(struct usb_interface *intf, const struct usb_device_id *i | |||
1643 | struct ttusb *ttusb; | 1644 | struct ttusb *ttusb; |
1644 | int result; | 1645 | int result; |
1645 | 1646 | ||
1646 | dprintk("%s: TTUSB DVB connected\n", __FUNCTION__); | 1647 | dprintk("%s: TTUSB DVB connected\n", __func__); |
1647 | 1648 | ||
1648 | udev = interface_to_usbdev(intf); | 1649 | udev = interface_to_usbdev(intf); |
1649 | 1650 | ||
@@ -1669,7 +1670,10 @@ static int ttusb_probe(struct usb_interface *intf, const struct usb_device_id *i | |||
1669 | 1670 | ||
1670 | mutex_unlock(&ttusb->semi2c); | 1671 | mutex_unlock(&ttusb->semi2c); |
1671 | 1672 | ||
1672 | if ((result = dvb_register_adapter(&ttusb->adapter, "Technotrend/Hauppauge Nova-USB", THIS_MODULE, &udev->dev)) < 0) { | 1673 | result = dvb_register_adapter(&ttusb->adapter, |
1674 | "Technotrend/Hauppauge Nova-USB", | ||
1675 | THIS_MODULE, &udev->dev, adapter_nr); | ||
1676 | if (result < 0) { | ||
1673 | ttusb_free_iso_urbs(ttusb); | 1677 | ttusb_free_iso_urbs(ttusb); |
1674 | kfree(ttusb); | 1678 | kfree(ttusb); |
1675 | return result; | 1679 | return result; |
@@ -1773,7 +1777,7 @@ static void ttusb_disconnect(struct usb_interface *intf) | |||
1773 | 1777 | ||
1774 | kfree(ttusb); | 1778 | kfree(ttusb); |
1775 | 1779 | ||
1776 | dprintk("%s: TTUSB DVB disconnected\n", __FUNCTION__); | 1780 | dprintk("%s: TTUSB DVB disconnected\n", __func__); |
1777 | } | 1781 | } |
1778 | 1782 | ||
1779 | static struct usb_device_id ttusb_table[] = { | 1783 | static struct usb_device_id ttusb_table[] = { |
diff --git a/drivers/media/dvb/ttusb-dec/ttusb_dec.c b/drivers/media/dvb/ttusb-dec/ttusb_dec.c index 1ec981d98b91..42eee04daa5d 100644 --- a/drivers/media/dvb/ttusb-dec/ttusb_dec.c +++ b/drivers/media/dvb/ttusb-dec/ttusb_dec.c | |||
@@ -52,6 +52,8 @@ MODULE_PARM_DESC(output_pva, "Output PVA from dvr device (default:off)"); | |||
52 | module_param(enable_rc, int, 0644); | 52 | module_param(enable_rc, int, 0644); |
53 | MODULE_PARM_DESC(enable_rc, "Turn on/off IR remote control(default: off)"); | 53 | MODULE_PARM_DESC(enable_rc, "Turn on/off IR remote control(default: off)"); |
54 | 54 | ||
55 | DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); | ||
56 | |||
55 | #define dprintk if (debug) printk | 57 | #define dprintk if (debug) printk |
56 | 58 | ||
57 | #define DRIVER_NAME "TechnoTrend/Hauppauge DEC USB" | 59 | #define DRIVER_NAME "TechnoTrend/Hauppauge DEC USB" |
@@ -217,11 +219,11 @@ static void ttusb_dec_handle_irq( struct urb *urb) | |||
217 | case -ETIME: | 219 | case -ETIME: |
218 | /* this urb is dead, cleanup */ | 220 | /* this urb is dead, cleanup */ |
219 | dprintk("%s:urb shutting down with status: %d\n", | 221 | dprintk("%s:urb shutting down with status: %d\n", |
220 | __FUNCTION__, urb->status); | 222 | __func__, urb->status); |
221 | return; | 223 | return; |
222 | default: | 224 | default: |
223 | dprintk("%s:nonzero status received: %d\n", | 225 | dprintk("%s:nonzero status received: %d\n", |
224 | __FUNCTION__,urb->status); | 226 | __func__,urb->status); |
225 | goto exit; | 227 | goto exit; |
226 | } | 228 | } |
227 | 229 | ||
@@ -235,7 +237,7 @@ static void ttusb_dec_handle_irq( struct urb *urb) | |||
235 | * keyrepeat signal is recieved for lets say 200ms. | 237 | * keyrepeat signal is recieved for lets say 200ms. |
236 | * this should/could be added later ... | 238 | * this should/could be added later ... |
237 | * for now lets report each signal as a key down and up*/ | 239 | * for now lets report each signal as a key down and up*/ |
238 | dprintk("%s:rc signal:%d\n", __FUNCTION__, buffer[4]); | 240 | dprintk("%s:rc signal:%d\n", __func__, buffer[4]); |
239 | input_report_key(dec->rc_input_dev, rc_keys[buffer[4] - 1], 1); | 241 | input_report_key(dec->rc_input_dev, rc_keys[buffer[4] - 1], 1); |
240 | input_sync(dec->rc_input_dev); | 242 | input_sync(dec->rc_input_dev); |
241 | input_report_key(dec->rc_input_dev, rc_keys[buffer[4] - 1], 0); | 243 | input_report_key(dec->rc_input_dev, rc_keys[buffer[4] - 1], 0); |
@@ -245,7 +247,7 @@ static void ttusb_dec_handle_irq( struct urb *urb) | |||
245 | exit: retval = usb_submit_urb(urb, GFP_ATOMIC); | 247 | exit: retval = usb_submit_urb(urb, GFP_ATOMIC); |
246 | if(retval) | 248 | if(retval) |
247 | printk("%s - usb_commit_urb failed with result: %d\n", | 249 | printk("%s - usb_commit_urb failed with result: %d\n", |
248 | __FUNCTION__, retval); | 250 | __func__, retval); |
249 | } | 251 | } |
250 | 252 | ||
251 | static u16 crc16(u16 crc, const u8 *buf, size_t len) | 253 | static u16 crc16(u16 crc, const u8 *buf, size_t len) |
@@ -268,7 +270,7 @@ static int ttusb_dec_send_command(struct ttusb_dec *dec, const u8 command, | |||
268 | int result, actual_len, i; | 270 | int result, actual_len, i; |
269 | u8 *b; | 271 | u8 *b; |
270 | 272 | ||
271 | dprintk("%s\n", __FUNCTION__); | 273 | dprintk("%s\n", __func__); |
272 | 274 | ||
273 | b = kmalloc(COMMAND_PACKET_SIZE + 4, GFP_KERNEL); | 275 | b = kmalloc(COMMAND_PACKET_SIZE + 4, GFP_KERNEL); |
274 | if (!b) | 276 | if (!b) |
@@ -276,7 +278,7 @@ static int ttusb_dec_send_command(struct ttusb_dec *dec, const u8 command, | |||
276 | 278 | ||
277 | if ((result = mutex_lock_interruptible(&dec->usb_mutex))) { | 279 | if ((result = mutex_lock_interruptible(&dec->usb_mutex))) { |
278 | kfree(b); | 280 | kfree(b); |
279 | printk("%s: Failed to lock usb mutex.\n", __FUNCTION__); | 281 | printk("%s: Failed to lock usb mutex.\n", __func__); |
280 | return result; | 282 | return result; |
281 | } | 283 | } |
282 | 284 | ||
@@ -289,7 +291,7 @@ static int ttusb_dec_send_command(struct ttusb_dec *dec, const u8 command, | |||
289 | memcpy(&b[4], params, param_length); | 291 | memcpy(&b[4], params, param_length); |
290 | 292 | ||
291 | if (debug) { | 293 | if (debug) { |
292 | printk("%s: command: ", __FUNCTION__); | 294 | printk("%s: command: ", __func__); |
293 | for (i = 0; i < param_length + 4; i++) | 295 | for (i = 0; i < param_length + 4; i++) |
294 | printk("0x%02X ", b[i]); | 296 | printk("0x%02X ", b[i]); |
295 | printk("\n"); | 297 | printk("\n"); |
@@ -300,7 +302,7 @@ static int ttusb_dec_send_command(struct ttusb_dec *dec, const u8 command, | |||
300 | 302 | ||
301 | if (result) { | 303 | if (result) { |
302 | printk("%s: command bulk message failed: error %d\n", | 304 | printk("%s: command bulk message failed: error %d\n", |
303 | __FUNCTION__, result); | 305 | __func__, result); |
304 | mutex_unlock(&dec->usb_mutex); | 306 | mutex_unlock(&dec->usb_mutex); |
305 | kfree(b); | 307 | kfree(b); |
306 | return result; | 308 | return result; |
@@ -311,13 +313,13 @@ static int ttusb_dec_send_command(struct ttusb_dec *dec, const u8 command, | |||
311 | 313 | ||
312 | if (result) { | 314 | if (result) { |
313 | printk("%s: result bulk message failed: error %d\n", | 315 | printk("%s: result bulk message failed: error %d\n", |
314 | __FUNCTION__, result); | 316 | __func__, result); |
315 | mutex_unlock(&dec->usb_mutex); | 317 | mutex_unlock(&dec->usb_mutex); |
316 | kfree(b); | 318 | kfree(b); |
317 | return result; | 319 | return result; |
318 | } else { | 320 | } else { |
319 | if (debug) { | 321 | if (debug) { |
320 | printk("%s: result: ", __FUNCTION__); | 322 | printk("%s: result: ", __func__); |
321 | for (i = 0; i < actual_len; i++) | 323 | for (i = 0; i < actual_len; i++) |
322 | printk("0x%02X ", b[i]); | 324 | printk("0x%02X ", b[i]); |
323 | printk("\n"); | 325 | printk("\n"); |
@@ -343,7 +345,7 @@ static int ttusb_dec_get_stb_state (struct ttusb_dec *dec, unsigned int *mode, | |||
343 | int result; | 345 | int result; |
344 | unsigned int tmp; | 346 | unsigned int tmp; |
345 | 347 | ||
346 | dprintk("%s\n", __FUNCTION__); | 348 | dprintk("%s\n", __func__); |
347 | 349 | ||
348 | result = ttusb_dec_send_command(dec, 0x08, 0, NULL, &c_length, c); | 350 | result = ttusb_dec_send_command(dec, 0x08, 0, NULL, &c_length, c); |
349 | if (result) | 351 | if (result) |
@@ -400,7 +402,7 @@ static void ttusb_dec_set_pids(struct ttusb_dec *dec) | |||
400 | u16 audio = htons(dec->pid[DMX_PES_AUDIO]); | 402 | u16 audio = htons(dec->pid[DMX_PES_AUDIO]); |
401 | u16 video = htons(dec->pid[DMX_PES_VIDEO]); | 403 | u16 video = htons(dec->pid[DMX_PES_VIDEO]); |
402 | 404 | ||
403 | dprintk("%s\n", __FUNCTION__); | 405 | dprintk("%s\n", __func__); |
404 | 406 | ||
405 | memcpy(&b[0], &pcr, 2); | 407 | memcpy(&b[0], &pcr, 2); |
406 | memcpy(&b[2], &audio, 2); | 408 | memcpy(&b[2], &audio, 2); |
@@ -419,12 +421,12 @@ static void ttusb_dec_set_pids(struct ttusb_dec *dec) | |||
419 | static void ttusb_dec_process_pva(struct ttusb_dec *dec, u8 *pva, int length) | 421 | static void ttusb_dec_process_pva(struct ttusb_dec *dec, u8 *pva, int length) |
420 | { | 422 | { |
421 | if (length < 8) { | 423 | if (length < 8) { |
422 | printk("%s: packet too short - discarding\n", __FUNCTION__); | 424 | printk("%s: packet too short - discarding\n", __func__); |
423 | return; | 425 | return; |
424 | } | 426 | } |
425 | 427 | ||
426 | if (length > 8 + MAX_PVA_LENGTH) { | 428 | if (length > 8 + MAX_PVA_LENGTH) { |
427 | printk("%s: packet too long - discarding\n", __FUNCTION__); | 429 | printk("%s: packet too long - discarding\n", __func__); |
428 | return; | 430 | return; |
429 | } | 431 | } |
430 | 432 | ||
@@ -507,7 +509,7 @@ static void ttusb_dec_process_pva(struct ttusb_dec *dec, u8 *pva, int length) | |||
507 | break; | 509 | break; |
508 | 510 | ||
509 | default: | 511 | default: |
510 | printk("%s: unknown PVA type: %02x.\n", __FUNCTION__, | 512 | printk("%s: unknown PVA type: %02x.\n", __func__, |
511 | pva[2]); | 513 | pva[2]); |
512 | break; | 514 | break; |
513 | } | 515 | } |
@@ -546,7 +548,7 @@ static void ttusb_dec_process_packet(struct ttusb_dec *dec) | |||
546 | u16 packet_id; | 548 | u16 packet_id; |
547 | 549 | ||
548 | if (dec->packet_length % 2) { | 550 | if (dec->packet_length % 2) { |
549 | printk("%s: odd sized packet - discarding\n", __FUNCTION__); | 551 | printk("%s: odd sized packet - discarding\n", __func__); |
550 | return; | 552 | return; |
551 | } | 553 | } |
552 | 554 | ||
@@ -554,7 +556,7 @@ static void ttusb_dec_process_packet(struct ttusb_dec *dec) | |||
554 | csum ^= ((dec->packet[i] << 8) + dec->packet[i + 1]); | 556 | csum ^= ((dec->packet[i] << 8) + dec->packet[i + 1]); |
555 | 557 | ||
556 | if (csum) { | 558 | if (csum) { |
557 | printk("%s: checksum failed - discarding\n", __FUNCTION__); | 559 | printk("%s: checksum failed - discarding\n", __func__); |
558 | return; | 560 | return; |
559 | } | 561 | } |
560 | 562 | ||
@@ -563,7 +565,7 @@ static void ttusb_dec_process_packet(struct ttusb_dec *dec) | |||
563 | 565 | ||
564 | if ((packet_id != dec->next_packet_id) && dec->next_packet_id) { | 566 | if ((packet_id != dec->next_packet_id) && dec->next_packet_id) { |
565 | printk("%s: warning: lost packets between %u and %u\n", | 567 | printk("%s: warning: lost packets between %u and %u\n", |
566 | __FUNCTION__, dec->next_packet_id - 1, packet_id); | 568 | __func__, dec->next_packet_id - 1, packet_id); |
567 | } | 569 | } |
568 | 570 | ||
569 | if (packet_id == 0xffff) | 571 | if (packet_id == 0xffff) |
@@ -652,7 +654,7 @@ static void ttusb_dec_process_urb_frame(struct ttusb_dec *dec, u8 *b, | |||
652 | dec->packet_state = 7; | 654 | dec->packet_state = 7; |
653 | } else { | 655 | } else { |
654 | printk("%s: unknown packet type: " | 656 | printk("%s: unknown packet type: " |
655 | "%02x%02x\n", __FUNCTION__, | 657 | "%02x%02x\n", __func__, |
656 | dec->packet[0], dec->packet[1]); | 658 | dec->packet[0], dec->packet[1]); |
657 | dec->packet_state = 0; | 659 | dec->packet_state = 0; |
658 | } | 660 | } |
@@ -724,7 +726,7 @@ static void ttusb_dec_process_urb_frame(struct ttusb_dec *dec, u8 *b, | |||
724 | 726 | ||
725 | default: | 727 | default: |
726 | printk("%s: illegal packet state encountered.\n", | 728 | printk("%s: illegal packet state encountered.\n", |
727 | __FUNCTION__); | 729 | __func__); |
728 | dec->packet_state = 0; | 730 | dec->packet_state = 0; |
729 | } | 731 | } |
730 | } | 732 | } |
@@ -792,7 +794,7 @@ static void ttusb_dec_process_urb(struct urb *urb) | |||
792 | } else { | 794 | } else { |
793 | /* -ENOENT is expected when unlinking urbs */ | 795 | /* -ENOENT is expected when unlinking urbs */ |
794 | if (urb->status != -ENOENT) | 796 | if (urb->status != -ENOENT) |
795 | dprintk("%s: urb error: %d\n", __FUNCTION__, | 797 | dprintk("%s: urb error: %d\n", __func__, |
796 | urb->status); | 798 | urb->status); |
797 | } | 799 | } |
798 | 800 | ||
@@ -804,7 +806,7 @@ static void ttusb_dec_setup_urbs(struct ttusb_dec *dec) | |||
804 | { | 806 | { |
805 | int i, j, buffer_offset = 0; | 807 | int i, j, buffer_offset = 0; |
806 | 808 | ||
807 | dprintk("%s\n", __FUNCTION__); | 809 | dprintk("%s\n", __func__); |
808 | 810 | ||
809 | for (i = 0; i < ISO_BUF_COUNT; i++) { | 811 | for (i = 0; i < ISO_BUF_COUNT; i++) { |
810 | int frame_offset = 0; | 812 | int frame_offset = 0; |
@@ -834,7 +836,7 @@ static void ttusb_dec_stop_iso_xfer(struct ttusb_dec *dec) | |||
834 | { | 836 | { |
835 | int i; | 837 | int i; |
836 | 838 | ||
837 | dprintk("%s\n", __FUNCTION__); | 839 | dprintk("%s\n", __func__); |
838 | 840 | ||
839 | if (mutex_lock_interruptible(&dec->iso_mutex)) | 841 | if (mutex_lock_interruptible(&dec->iso_mutex)) |
840 | return; | 842 | return; |
@@ -889,7 +891,7 @@ static int ttusb_dec_start_iso_xfer(struct ttusb_dec *dec) | |||
889 | { | 891 | { |
890 | int i, result; | 892 | int i, result; |
891 | 893 | ||
892 | dprintk("%s\n", __FUNCTION__); | 894 | dprintk("%s\n", __func__); |
893 | 895 | ||
894 | if (mutex_lock_interruptible(&dec->iso_mutex)) | 896 | if (mutex_lock_interruptible(&dec->iso_mutex)) |
895 | return -EAGAIN; | 897 | return -EAGAIN; |
@@ -905,7 +907,7 @@ static int ttusb_dec_start_iso_xfer(struct ttusb_dec *dec) | |||
905 | if ((result = usb_submit_urb(dec->iso_urb[i], | 907 | if ((result = usb_submit_urb(dec->iso_urb[i], |
906 | GFP_ATOMIC))) { | 908 | GFP_ATOMIC))) { |
907 | printk("%s: failed urb submission %d: " | 909 | printk("%s: failed urb submission %d: " |
908 | "error %d\n", __FUNCTION__, i, result); | 910 | "error %d\n", __func__, i, result); |
909 | 911 | ||
910 | while (i) { | 912 | while (i) { |
911 | usb_kill_urb(dec->iso_urb[i - 1]); | 913 | usb_kill_urb(dec->iso_urb[i - 1]); |
@@ -932,7 +934,7 @@ static int ttusb_dec_start_ts_feed(struct dvb_demux_feed *dvbdmxfeed) | |||
932 | u8 b0[] = { 0x05 }; | 934 | u8 b0[] = { 0x05 }; |
933 | int result = 0; | 935 | int result = 0; |
934 | 936 | ||
935 | dprintk("%s\n", __FUNCTION__); | 937 | dprintk("%s\n", __func__); |
936 | 938 | ||
937 | dprintk(" ts_type:"); | 939 | dprintk(" ts_type:"); |
938 | 940 | ||
@@ -1012,7 +1014,7 @@ static int ttusb_dec_start_sec_feed(struct dvb_demux_feed *dvbdmxfeed) | |||
1012 | unsigned long flags; | 1014 | unsigned long flags; |
1013 | u8 x = 1; | 1015 | u8 x = 1; |
1014 | 1016 | ||
1015 | dprintk("%s\n", __FUNCTION__); | 1017 | dprintk("%s\n", __func__); |
1016 | 1018 | ||
1017 | pid = htons(dvbdmxfeed->pid); | 1019 | pid = htons(dvbdmxfeed->pid); |
1018 | memcpy(&b0[0], &pid, 2); | 1020 | memcpy(&b0[0], &pid, 2); |
@@ -1052,7 +1054,7 @@ static int ttusb_dec_start_feed(struct dvb_demux_feed *dvbdmxfeed) | |||
1052 | { | 1054 | { |
1053 | struct dvb_demux *dvbdmx = dvbdmxfeed->demux; | 1055 | struct dvb_demux *dvbdmx = dvbdmxfeed->demux; |
1054 | 1056 | ||
1055 | dprintk("%s\n", __FUNCTION__); | 1057 | dprintk("%s\n", __func__); |
1056 | 1058 | ||
1057 | if (!dvbdmx->dmx.frontend) | 1059 | if (!dvbdmx->dmx.frontend) |
1058 | return -EINVAL; | 1060 | return -EINVAL; |
@@ -1113,7 +1115,7 @@ static int ttusb_dec_stop_sec_feed(struct dvb_demux_feed *dvbdmxfeed) | |||
1113 | 1115 | ||
1114 | static int ttusb_dec_stop_feed(struct dvb_demux_feed *dvbdmxfeed) | 1116 | static int ttusb_dec_stop_feed(struct dvb_demux_feed *dvbdmxfeed) |
1115 | { | 1117 | { |
1116 | dprintk("%s\n", __FUNCTION__); | 1118 | dprintk("%s\n", __func__); |
1117 | 1119 | ||
1118 | switch (dvbdmxfeed->type) { | 1120 | switch (dvbdmxfeed->type) { |
1119 | case DMX_TYPE_TS: | 1121 | case DMX_TYPE_TS: |
@@ -1132,7 +1134,7 @@ static void ttusb_dec_free_iso_urbs(struct ttusb_dec *dec) | |||
1132 | { | 1134 | { |
1133 | int i; | 1135 | int i; |
1134 | 1136 | ||
1135 | dprintk("%s\n", __FUNCTION__); | 1137 | dprintk("%s\n", __func__); |
1136 | 1138 | ||
1137 | for (i = 0; i < ISO_BUF_COUNT; i++) | 1139 | for (i = 0; i < ISO_BUF_COUNT; i++) |
1138 | usb_free_urb(dec->iso_urb[i]); | 1140 | usb_free_urb(dec->iso_urb[i]); |
@@ -1147,7 +1149,7 @@ static int ttusb_dec_alloc_iso_urbs(struct ttusb_dec *dec) | |||
1147 | { | 1149 | { |
1148 | int i; | 1150 | int i; |
1149 | 1151 | ||
1150 | dprintk("%s\n", __FUNCTION__); | 1152 | dprintk("%s\n", __func__); |
1151 | 1153 | ||
1152 | dec->iso_buffer = pci_alloc_consistent(NULL, | 1154 | dec->iso_buffer = pci_alloc_consistent(NULL, |
1153 | ISO_FRAME_SIZE * | 1155 | ISO_FRAME_SIZE * |
@@ -1214,7 +1216,7 @@ static int ttusb_init_rc( struct ttusb_dec *dec) | |||
1214 | 1216 | ||
1215 | dec->rc_input_dev = input_dev; | 1217 | dec->rc_input_dev = input_dev; |
1216 | if (usb_submit_urb(dec->irq_urb, GFP_KERNEL)) | 1218 | if (usb_submit_urb(dec->irq_urb, GFP_KERNEL)) |
1217 | printk("%s: usb_submit_urb failed\n",__FUNCTION__); | 1219 | printk("%s: usb_submit_urb failed\n",__func__); |
1218 | /* enable irq pipe */ | 1220 | /* enable irq pipe */ |
1219 | ttusb_dec_send_command(dec,0xb0,sizeof(b),b,NULL,NULL); | 1221 | ttusb_dec_send_command(dec,0xb0,sizeof(b),b,NULL,NULL); |
1220 | 1222 | ||
@@ -1223,7 +1225,7 @@ static int ttusb_init_rc( struct ttusb_dec *dec) | |||
1223 | 1225 | ||
1224 | static void ttusb_dec_init_v_pes(struct ttusb_dec *dec) | 1226 | static void ttusb_dec_init_v_pes(struct ttusb_dec *dec) |
1225 | { | 1227 | { |
1226 | dprintk("%s\n", __FUNCTION__); | 1228 | dprintk("%s\n", __func__); |
1227 | 1229 | ||
1228 | dec->v_pes[0] = 0x00; | 1230 | dec->v_pes[0] = 0x00; |
1229 | dec->v_pes[1] = 0x00; | 1231 | dec->v_pes[1] = 0x00; |
@@ -1233,7 +1235,7 @@ static void ttusb_dec_init_v_pes(struct ttusb_dec *dec) | |||
1233 | 1235 | ||
1234 | static int ttusb_dec_init_usb(struct ttusb_dec *dec) | 1236 | static int ttusb_dec_init_usb(struct ttusb_dec *dec) |
1235 | { | 1237 | { |
1236 | dprintk("%s\n", __FUNCTION__); | 1238 | dprintk("%s\n", __func__); |
1237 | 1239 | ||
1238 | mutex_init(&dec->usb_mutex); | 1240 | mutex_init(&dec->usb_mutex); |
1239 | mutex_init(&dec->iso_mutex); | 1241 | mutex_init(&dec->iso_mutex); |
@@ -1281,11 +1283,11 @@ static int ttusb_dec_boot_dsp(struct ttusb_dec *dec) | |||
1281 | u32 crc32_csum, crc32_check, tmp; | 1283 | u32 crc32_csum, crc32_check, tmp; |
1282 | const struct firmware *fw_entry = NULL; | 1284 | const struct firmware *fw_entry = NULL; |
1283 | 1285 | ||
1284 | dprintk("%s\n", __FUNCTION__); | 1286 | dprintk("%s\n", __func__); |
1285 | 1287 | ||
1286 | if (request_firmware(&fw_entry, dec->firmware_name, &dec->udev->dev)) { | 1288 | if (request_firmware(&fw_entry, dec->firmware_name, &dec->udev->dev)) { |
1287 | printk(KERN_ERR "%s: Firmware (%s) unavailable.\n", | 1289 | printk(KERN_ERR "%s: Firmware (%s) unavailable.\n", |
1288 | __FUNCTION__, dec->firmware_name); | 1290 | __func__, dec->firmware_name); |
1289 | return 1; | 1291 | return 1; |
1290 | } | 1292 | } |
1291 | 1293 | ||
@@ -1294,7 +1296,7 @@ static int ttusb_dec_boot_dsp(struct ttusb_dec *dec) | |||
1294 | 1296 | ||
1295 | if (firmware_size < 60) { | 1297 | if (firmware_size < 60) { |
1296 | printk("%s: firmware size too small for DSP code (%zu < 60).\n", | 1298 | printk("%s: firmware size too small for DSP code (%zu < 60).\n", |
1297 | __FUNCTION__, firmware_size); | 1299 | __func__, firmware_size); |
1298 | release_firmware(fw_entry); | 1300 | release_firmware(fw_entry); |
1299 | return -1; | 1301 | return -1; |
1300 | } | 1302 | } |
@@ -1308,7 +1310,7 @@ static int ttusb_dec_boot_dsp(struct ttusb_dec *dec) | |||
1308 | if (crc32_csum != crc32_check) { | 1310 | if (crc32_csum != crc32_check) { |
1309 | printk("%s: crc32 check of DSP code failed (calculated " | 1311 | printk("%s: crc32 check of DSP code failed (calculated " |
1310 | "0x%08x != 0x%08x in file), file invalid.\n", | 1312 | "0x%08x != 0x%08x in file), file invalid.\n", |
1311 | __FUNCTION__, crc32_csum, crc32_check); | 1313 | __func__, crc32_csum, crc32_check); |
1312 | release_firmware(fw_entry); | 1314 | release_firmware(fw_entry); |
1313 | return -1; | 1315 | return -1; |
1314 | } | 1316 | } |
@@ -1376,7 +1378,7 @@ static int ttusb_dec_init_stb(struct ttusb_dec *dec) | |||
1376 | int result; | 1378 | int result; |
1377 | unsigned int mode, model, version; | 1379 | unsigned int mode, model, version; |
1378 | 1380 | ||
1379 | dprintk("%s\n", __FUNCTION__); | 1381 | dprintk("%s\n", __func__); |
1380 | 1382 | ||
1381 | result = ttusb_dec_get_stb_state(dec, &mode, &model, &version); | 1383 | result = ttusb_dec_get_stb_state(dec, &mode, &model, &version); |
1382 | 1384 | ||
@@ -1415,7 +1417,7 @@ static int ttusb_dec_init_stb(struct ttusb_dec *dec) | |||
1415 | default: | 1417 | default: |
1416 | printk(KERN_ERR "%s: unknown model returned " | 1418 | printk(KERN_ERR "%s: unknown model returned " |
1417 | "by firmware (%08x) - please report\n", | 1419 | "by firmware (%08x) - please report\n", |
1418 | __FUNCTION__, model); | 1420 | __func__, model); |
1419 | return -1; | 1421 | return -1; |
1420 | break; | 1422 | break; |
1421 | } | 1423 | } |
@@ -1434,12 +1436,14 @@ static int ttusb_dec_init_dvb(struct ttusb_dec *dec) | |||
1434 | { | 1436 | { |
1435 | int result; | 1437 | int result; |
1436 | 1438 | ||
1437 | dprintk("%s\n", __FUNCTION__); | 1439 | dprintk("%s\n", __func__); |
1438 | 1440 | ||
1439 | if ((result = dvb_register_adapter(&dec->adapter, | 1441 | if ((result = dvb_register_adapter(&dec->adapter, |
1440 | dec->model_name, THIS_MODULE, &dec->udev->dev)) < 0) { | 1442 | dec->model_name, THIS_MODULE, |
1443 | &dec->udev->dev, | ||
1444 | adapter_nr)) < 0) { | ||
1441 | printk("%s: dvb_register_adapter failed: error %d\n", | 1445 | printk("%s: dvb_register_adapter failed: error %d\n", |
1442 | __FUNCTION__, result); | 1446 | __func__, result); |
1443 | 1447 | ||
1444 | return result; | 1448 | return result; |
1445 | } | 1449 | } |
@@ -1454,7 +1458,7 @@ static int ttusb_dec_init_dvb(struct ttusb_dec *dec) | |||
1454 | dec->demux.write_to_decoder = NULL; | 1458 | dec->demux.write_to_decoder = NULL; |
1455 | 1459 | ||
1456 | if ((result = dvb_dmx_init(&dec->demux)) < 0) { | 1460 | if ((result = dvb_dmx_init(&dec->demux)) < 0) { |
1457 | printk("%s: dvb_dmx_init failed: error %d\n", __FUNCTION__, | 1461 | printk("%s: dvb_dmx_init failed: error %d\n", __func__, |
1458 | result); | 1462 | result); |
1459 | 1463 | ||
1460 | dvb_unregister_adapter(&dec->adapter); | 1464 | dvb_unregister_adapter(&dec->adapter); |
@@ -1468,7 +1472,7 @@ static int ttusb_dec_init_dvb(struct ttusb_dec *dec) | |||
1468 | 1472 | ||
1469 | if ((result = dvb_dmxdev_init(&dec->dmxdev, &dec->adapter)) < 0) { | 1473 | if ((result = dvb_dmxdev_init(&dec->dmxdev, &dec->adapter)) < 0) { |
1470 | printk("%s: dvb_dmxdev_init failed: error %d\n", | 1474 | printk("%s: dvb_dmxdev_init failed: error %d\n", |
1471 | __FUNCTION__, result); | 1475 | __func__, result); |
1472 | 1476 | ||
1473 | dvb_dmx_release(&dec->demux); | 1477 | dvb_dmx_release(&dec->demux); |
1474 | dvb_unregister_adapter(&dec->adapter); | 1478 | dvb_unregister_adapter(&dec->adapter); |
@@ -1480,7 +1484,7 @@ static int ttusb_dec_init_dvb(struct ttusb_dec *dec) | |||
1480 | 1484 | ||
1481 | if ((result = dec->demux.dmx.add_frontend(&dec->demux.dmx, | 1485 | if ((result = dec->demux.dmx.add_frontend(&dec->demux.dmx, |
1482 | &dec->frontend)) < 0) { | 1486 | &dec->frontend)) < 0) { |
1483 | printk("%s: dvb_dmx_init failed: error %d\n", __FUNCTION__, | 1487 | printk("%s: dvb_dmx_init failed: error %d\n", __func__, |
1484 | result); | 1488 | result); |
1485 | 1489 | ||
1486 | dvb_dmxdev_release(&dec->dmxdev); | 1490 | dvb_dmxdev_release(&dec->dmxdev); |
@@ -1492,7 +1496,7 @@ static int ttusb_dec_init_dvb(struct ttusb_dec *dec) | |||
1492 | 1496 | ||
1493 | if ((result = dec->demux.dmx.connect_frontend(&dec->demux.dmx, | 1497 | if ((result = dec->demux.dmx.connect_frontend(&dec->demux.dmx, |
1494 | &dec->frontend)) < 0) { | 1498 | &dec->frontend)) < 0) { |
1495 | printk("%s: dvb_dmx_init failed: error %d\n", __FUNCTION__, | 1499 | printk("%s: dvb_dmx_init failed: error %d\n", __func__, |
1496 | result); | 1500 | result); |
1497 | 1501 | ||
1498 | dec->demux.dmx.remove_frontend(&dec->demux.dmx, &dec->frontend); | 1502 | dec->demux.dmx.remove_frontend(&dec->demux.dmx, &dec->frontend); |
@@ -1510,7 +1514,7 @@ static int ttusb_dec_init_dvb(struct ttusb_dec *dec) | |||
1510 | 1514 | ||
1511 | static void ttusb_dec_exit_dvb(struct ttusb_dec *dec) | 1515 | static void ttusb_dec_exit_dvb(struct ttusb_dec *dec) |
1512 | { | 1516 | { |
1513 | dprintk("%s\n", __FUNCTION__); | 1517 | dprintk("%s\n", __func__); |
1514 | 1518 | ||
1515 | dvb_net_release(&dec->dvb_net); | 1519 | dvb_net_release(&dec->dvb_net); |
1516 | dec->demux.dmx.close(&dec->demux.dmx); | 1520 | dec->demux.dmx.close(&dec->demux.dmx); |
@@ -1528,7 +1532,7 @@ static void ttusb_dec_exit_dvb(struct ttusb_dec *dec) | |||
1528 | static void ttusb_dec_exit_rc(struct ttusb_dec *dec) | 1532 | static void ttusb_dec_exit_rc(struct ttusb_dec *dec) |
1529 | { | 1533 | { |
1530 | 1534 | ||
1531 | dprintk("%s\n", __FUNCTION__); | 1535 | dprintk("%s\n", __func__); |
1532 | /* we have to check whether the irq URB is already submitted. | 1536 | /* we have to check whether the irq URB is already submitted. |
1533 | * As the irq is submitted after the interface is changed, | 1537 | * As the irq is submitted after the interface is changed, |
1534 | * this is the best method i figured out. | 1538 | * this is the best method i figured out. |
@@ -1552,7 +1556,7 @@ static void ttusb_dec_exit_usb(struct ttusb_dec *dec) | |||
1552 | { | 1556 | { |
1553 | int i; | 1557 | int i; |
1554 | 1558 | ||
1555 | dprintk("%s\n", __FUNCTION__); | 1559 | dprintk("%s\n", __func__); |
1556 | 1560 | ||
1557 | dec->iso_stream_count = 0; | 1561 | dec->iso_stream_count = 0; |
1558 | 1562 | ||
@@ -1612,12 +1616,12 @@ static int ttusb_dec_probe(struct usb_interface *intf, | |||
1612 | struct usb_device *udev; | 1616 | struct usb_device *udev; |
1613 | struct ttusb_dec *dec; | 1617 | struct ttusb_dec *dec; |
1614 | 1618 | ||
1615 | dprintk("%s\n", __FUNCTION__); | 1619 | dprintk("%s\n", __func__); |
1616 | 1620 | ||
1617 | udev = interface_to_usbdev(intf); | 1621 | udev = interface_to_usbdev(intf); |
1618 | 1622 | ||
1619 | if (!(dec = kzalloc(sizeof(struct ttusb_dec), GFP_KERNEL))) { | 1623 | if (!(dec = kzalloc(sizeof(struct ttusb_dec), GFP_KERNEL))) { |
1620 | printk("%s: couldn't allocate memory.\n", __FUNCTION__); | 1624 | printk("%s: couldn't allocate memory.\n", __func__); |
1621 | return -ENOMEM; | 1625 | return -ENOMEM; |
1622 | } | 1626 | } |
1623 | 1627 | ||
@@ -1692,7 +1696,7 @@ static void ttusb_dec_disconnect(struct usb_interface *intf) | |||
1692 | 1696 | ||
1693 | usb_set_intfdata(intf, NULL); | 1697 | usb_set_intfdata(intf, NULL); |
1694 | 1698 | ||
1695 | dprintk("%s\n", __FUNCTION__); | 1699 | dprintk("%s\n", __func__); |
1696 | 1700 | ||
1697 | if (dec->active) { | 1701 | if (dec->active) { |
1698 | ttusb_dec_exit_tasklet(dec); | 1702 | ttusb_dec_exit_tasklet(dec); |
@@ -1749,7 +1753,7 @@ static int __init ttusb_dec_init(void) | |||
1749 | int result; | 1753 | int result; |
1750 | 1754 | ||
1751 | if ((result = usb_register(&ttusb_dec_driver)) < 0) { | 1755 | if ((result = usb_register(&ttusb_dec_driver)) < 0) { |
1752 | printk("%s: initialisation failed: error %d.\n", __FUNCTION__, | 1756 | printk("%s: initialisation failed: error %d.\n", __func__, |
1753 | result); | 1757 | result); |
1754 | return result; | 1758 | return result; |
1755 | } | 1759 | } |
diff --git a/drivers/media/dvb/ttusb-dec/ttusbdecfe.c b/drivers/media/dvb/ttusb-dec/ttusbdecfe.c index a6fb1d6a7b5d..eb5eaeccd7c4 100644 --- a/drivers/media/dvb/ttusb-dec/ttusbdecfe.c +++ b/drivers/media/dvb/ttusb-dec/ttusbdecfe.c | |||
@@ -53,7 +53,7 @@ static int ttusbdecfe_read_status(struct dvb_frontend* fe, fe_status_t* status) | |||
53 | return ret; | 53 | return ret; |
54 | 54 | ||
55 | if(len != 4) { | 55 | if(len != 4) { |
56 | printk(KERN_ERR "%s: unexpected reply\n", __FUNCTION__); | 56 | printk(KERN_ERR "%s: unexpected reply\n", __func__); |
57 | return -EIO; | 57 | return -EIO; |
58 | } | 58 | } |
59 | 59 | ||
@@ -70,7 +70,7 @@ static int ttusbdecfe_read_status(struct dvb_frontend* fe, fe_status_t* status) | |||
70 | break; | 70 | break; |
71 | default: | 71 | default: |
72 | pr_info("%s: returned unknown value: %d\n", | 72 | pr_info("%s: returned unknown value: %d\n", |
73 | __FUNCTION__, result[3]); | 73 | __func__, result[3]); |
74 | return -EIO; | 74 | return -EIO; |
75 | } | 75 | } |
76 | 76 | ||