diff options
author | Matt Doran <matt.doran@papercut.biz> | 2007-07-31 06:09:30 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2007-10-09 21:03:50 -0400 |
commit | 8f6956c7f9fa72c502bde47df4122bd32d0b86d5 (patch) | |
tree | b2ebe02557ee2bcf7644fd406f93bcdcc271c431 /drivers | |
parent | 8779737b8e01b95fe6f1e33dc90ea621281c7b67 (diff) |
V4L/DVB (5960): Add module parameter to enable SFN workaround
In some areas in the world the broadcasters are not using the same
cellid for each transmitter in a SFN. The DiBcom has problems with
that setup. The module parameter buggy_sfn_workaround makes it re-usable.
Signed-off-by: Matt Doran <matt.doran@papercut.biz>
Signed-off-by: Patrick Boettcher <pb@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/media/dvb/frontends/dib3000mc.c | 22 | ||||
-rw-r--r-- | drivers/media/dvb/frontends/dib7000p.c | 21 |
2 files changed, 36 insertions, 7 deletions
diff --git a/drivers/media/dvb/frontends/dib3000mc.c b/drivers/media/dvb/frontends/dib3000mc.c index 38d2322cbaf6..f0096de2279e 100644 --- a/drivers/media/dvb/frontends/dib3000mc.c +++ b/drivers/media/dvb/frontends/dib3000mc.c | |||
@@ -13,10 +13,6 @@ | |||
13 | 13 | ||
14 | #include <linux/kernel.h> | 14 | #include <linux/kernel.h> |
15 | #include <linux/i2c.h> | 15 | #include <linux/i2c.h> |
16 | //#include <linux/init.h> | ||
17 | //#include <linux/delay.h> | ||
18 | //#include <linux/string.h> | ||
19 | //#include <linux/slab.h> | ||
20 | 16 | ||
21 | #include "dvb_frontend.h" | 17 | #include "dvb_frontend.h" |
22 | 18 | ||
@@ -26,6 +22,10 @@ static int debug; | |||
26 | module_param(debug, int, 0644); | 22 | module_param(debug, int, 0644); |
27 | MODULE_PARM_DESC(debug, "turn on debugging (default: 0)"); | 23 | MODULE_PARM_DESC(debug, "turn on debugging (default: 0)"); |
28 | 24 | ||
25 | static int buggy_sfn_workaround; | ||
26 | module_param(buggy_sfn_workaround, int, 0644); | ||
27 | MODULE_PARM_DESC(debug, "Enable work-around for buggy SFNs (default: 0)"); | ||
28 | |||
29 | #define dprintk(args...) do { if (debug) { printk(KERN_DEBUG "DiB3000MC/P:"); printk(args); printk("\n"); } } while (0) | 29 | #define dprintk(args...) do { if (debug) { printk(KERN_DEBUG "DiB3000MC/P:"); printk(args); printk("\n"); } } while (0) |
30 | 30 | ||
31 | struct dib3000mc_state { | 31 | struct dib3000mc_state { |
@@ -42,6 +42,8 @@ struct dib3000mc_state { | |||
42 | fe_bandwidth_t current_bandwidth; | 42 | fe_bandwidth_t current_bandwidth; |
43 | 43 | ||
44 | u16 dev_id; | 44 | u16 dev_id; |
45 | |||
46 | u8 sfn_workaround_active :1; | ||
45 | }; | 47 | }; |
46 | 48 | ||
47 | static u16 dib3000mc_read_word(struct dib3000mc_state *state, u16 reg) | 49 | static u16 dib3000mc_read_word(struct dib3000mc_state *state, u16 reg) |
@@ -591,7 +593,14 @@ static int dib3000mc_tune(struct dvb_frontend *demod, struct dvb_frontend_parame | |||
591 | dib3000mc_set_channel_cfg(state, ch, 0); | 593 | dib3000mc_set_channel_cfg(state, ch, 0); |
592 | 594 | ||
593 | // activates isi | 595 | // activates isi |
594 | dib3000mc_write_word(state, 29, 0x1073); | 596 | if (state->sfn_workaround_active) { |
597 | dprintk("SFN workaround is active\n"); | ||
598 | dib3000mc_write_word(state, 29, 0x1273); | ||
599 | dib3000mc_write_word(state, 108, 0x4000); // P_pha3_force_pha_shift | ||
600 | } else { | ||
601 | dib3000mc_write_word(state, 29, 0x1073); | ||
602 | dib3000mc_write_word(state, 108, 0x0000); // P_pha3_force_pha_shift | ||
603 | } | ||
595 | 604 | ||
596 | dib3000mc_set_adp_cfg(state, (u8)ch->u.ofdm.constellation); | 605 | dib3000mc_set_adp_cfg(state, (u8)ch->u.ofdm.constellation); |
597 | if (ch->u.ofdm.transmission_mode == TRANSMISSION_MODE_8K) { | 606 | if (ch->u.ofdm.transmission_mode == TRANSMISSION_MODE_8K) { |
@@ -679,6 +688,9 @@ static int dib3000mc_set_frontend(struct dvb_frontend* fe, | |||
679 | state->current_bandwidth = fep->u.ofdm.bandwidth; | 688 | state->current_bandwidth = fep->u.ofdm.bandwidth; |
680 | dib3000mc_set_bandwidth(state, BANDWIDTH_TO_KHZ(fep->u.ofdm.bandwidth)); | 689 | dib3000mc_set_bandwidth(state, BANDWIDTH_TO_KHZ(fep->u.ofdm.bandwidth)); |
681 | 690 | ||
691 | /* maybe the parameter has been changed */ | ||
692 | state->sfn_workaround_active = buggy_sfn_workaround; | ||
693 | |||
682 | if (fe->ops.tuner_ops.set_params) { | 694 | if (fe->ops.tuner_ops.set_params) { |
683 | fe->ops.tuner_ops.set_params(fe, fep); | 695 | fe->ops.tuner_ops.set_params(fe, fep); |
684 | msleep(100); | 696 | msleep(100); |
diff --git a/drivers/media/dvb/frontends/dib7000p.c b/drivers/media/dvb/frontends/dib7000p.c index 1175ab9a4532..aa7dc4503323 100644 --- a/drivers/media/dvb/frontends/dib7000p.c +++ b/drivers/media/dvb/frontends/dib7000p.c | |||
@@ -18,6 +18,10 @@ static int debug; | |||
18 | module_param(debug, int, 0644); | 18 | module_param(debug, int, 0644); |
19 | MODULE_PARM_DESC(debug, "turn on debugging (default: 0)"); | 19 | MODULE_PARM_DESC(debug, "turn on debugging (default: 0)"); |
20 | 20 | ||
21 | static int buggy_sfn_workaround; | ||
22 | module_param(buggy_sfn_workaround, int, 0644); | ||
23 | MODULE_PARM_DESC(debug, "Enable work-around for buggy SFNs (default: 0)"); | ||
24 | |||
21 | #define dprintk(args...) do { if (debug) { printk(KERN_DEBUG "DiB7000P: "); printk(args); printk("\n"); } } while (0) | 25 | #define dprintk(args...) do { if (debug) { printk(KERN_DEBUG "DiB7000P: "); printk(args); printk("\n"); } } while (0) |
22 | 26 | ||
23 | struct dib7000p_state { | 27 | struct dib7000p_state { |
@@ -44,6 +48,8 @@ struct dib7000p_state { | |||
44 | 48 | ||
45 | u16 gpio_dir; | 49 | u16 gpio_dir; |
46 | u16 gpio_val; | 50 | u16 gpio_val; |
51 | |||
52 | u8 sfn_workaround_active :1; | ||
47 | }; | 53 | }; |
48 | 54 | ||
49 | enum dib7000p_power_mode { | 55 | enum dib7000p_power_mode { |
@@ -751,8 +757,8 @@ static void dib7000p_set_channel(struct dib7000p_state *state, struct dvb_fronte | |||
751 | 757 | ||
752 | /* offset loop parameters */ | 758 | /* offset loop parameters */ |
753 | dib7000p_write_word(state, 26, 0x6680); // timf(6xxx) | 759 | dib7000p_write_word(state, 26, 0x6680); // timf(6xxx) |
754 | dib7000p_write_word(state, 29, 0x1273); // isi inh1273 on1073 | ||
755 | dib7000p_write_word(state, 32, 0x0003); // pha_off_max(xxx3) | 760 | dib7000p_write_word(state, 32, 0x0003); // pha_off_max(xxx3) |
761 | dib7000p_write_word(state, 29, 0x1273); // isi | ||
756 | dib7000p_write_word(state, 33, 0x0005); // sfreq(xxx5) | 762 | dib7000p_write_word(state, 33, 0x0005); // sfreq(xxx5) |
757 | 763 | ||
758 | /* P_dvsy_sync_wait */ | 764 | /* P_dvsy_sync_wait */ |
@@ -959,7 +965,15 @@ static int dib7000p_tune(struct dvb_frontend *demod, struct dvb_frontend_paramet | |||
959 | msleep(45); | 965 | msleep(45); |
960 | 966 | ||
961 | /* P_ctrl_inh_cor=0, P_ctrl_alpha_cor=4, P_ctrl_inh_isi=0, P_ctrl_alpha_isi=3, P_ctrl_inh_cor4=1, P_ctrl_alpha_cor4=3 */ | 967 | /* P_ctrl_inh_cor=0, P_ctrl_alpha_cor=4, P_ctrl_inh_isi=0, P_ctrl_alpha_isi=3, P_ctrl_inh_cor4=1, P_ctrl_alpha_cor4=3 */ |
962 | dib7000p_write_word(state, 29, (0 << 14) | (4 << 10) | (0 << 9) | (3 << 5) | (1 << 4) | (0x3)); | 968 | tmp = (0 << 14) | (4 << 10) | (0 << 9) | (3 << 5) | (1 << 4) | (0x3); |
969 | if (state->sfn_workaround_active) { | ||
970 | dprintk( "SFN workaround is active"); | ||
971 | tmp |= (1 << 9); | ||
972 | dib7000p_write_word(state, 166, 0x4000); // P_pha3_force_pha_shift | ||
973 | } else { | ||
974 | dib7000p_write_word(state, 166, 0x0000); // P_pha3_force_pha_shift | ||
975 | } | ||
976 | dib7000p_write_word(state, 29, tmp); | ||
963 | 977 | ||
964 | // never achieved a lock with that bandwidth so far - wait for osc-freq to update | 978 | // never achieved a lock with that bandwidth so far - wait for osc-freq to update |
965 | if (state->timf == 0) | 979 | if (state->timf == 0) |
@@ -1119,6 +1133,9 @@ static int dib7000p_set_frontend(struct dvb_frontend* fe, | |||
1119 | state->current_bandwidth = fep->u.ofdm.bandwidth; | 1133 | state->current_bandwidth = fep->u.ofdm.bandwidth; |
1120 | dib7000p_set_bandwidth(state, BANDWIDTH_TO_KHZ(fep->u.ofdm.bandwidth)); | 1134 | dib7000p_set_bandwidth(state, BANDWIDTH_TO_KHZ(fep->u.ofdm.bandwidth)); |
1121 | 1135 | ||
1136 | /* maybe the parameter has been changed */ | ||
1137 | state->sfn_workaround_active = buggy_sfn_workaround; | ||
1138 | |||
1122 | if (fe->ops.tuner_ops.set_params) | 1139 | if (fe->ops.tuner_ops.set_params) |
1123 | fe->ops.tuner_ops.set_params(fe, fep); | 1140 | fe->ops.tuner_ops.set_params(fe, fep); |
1124 | 1141 | ||