aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb/frontends/dib3000mc.c
diff options
context:
space:
mode:
authorOlivier DANET <odanet@caramail.com>2006-08-08 14:48:09 -0400
committerMauro Carvalho Chehab <mchehab@infradead.org>2006-09-26 10:53:41 -0400
commita16bf5d5603184dc1db88f37051881b2eeacfd17 (patch)
treedbb50cc4d2e8ec9d7e57853e391181735b2ae809 /drivers/media/dvb/frontends/dib3000mc.c
parent47922e9c3f583adf05a23842ff98f3b0bf7eec6d (diff)
V4L/DVB: Adding support for MT2060 and thus for some DVB-USB-devices based on it
- MT2060 tuner driver - Added support for some USB DVB-T devices based on Dib3000P Signed-off-by: Olivier DANET <odanet@caramail.com> Signed-off-by: Patrick Boettcher <pb@linuxtv.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/dvb/frontends/dib3000mc.c')
-rw-r--r--drivers/media/dvb/frontends/dib3000mc.c21
1 files changed, 14 insertions, 7 deletions
diff --git a/drivers/media/dvb/frontends/dib3000mc.c b/drivers/media/dvb/frontends/dib3000mc.c
index 98673474a140..66b30edad2e4 100644
--- a/drivers/media/dvb/frontends/dib3000mc.c
+++ b/drivers/media/dvb/frontends/dib3000mc.c
@@ -20,6 +20,7 @@
20 * see Documentation/dvb/README.dibusb for more information 20 * see Documentation/dvb/README.dibusb for more information
21 * 21 *
22 */ 22 */
23#include <linux/config.h>
23#include <linux/kernel.h> 24#include <linux/kernel.h>
24#include <linux/module.h> 25#include <linux/module.h>
25#include <linux/moduleparam.h> 26#include <linux/moduleparam.h>
@@ -461,9 +462,8 @@ static int dib3000mc_set_frontend(struct dvb_frontend* fe,
461 int search_state,auto_val; 462 int search_state,auto_val;
462 u16 val; 463 u16 val;
463 464
464 if (tuner && fe->ops.tuner_ops.set_params) { /* initial call from dvb */ 465 if (tuner && state->config.pll_set) { /* initial call from dvb */
465 fe->ops.tuner_ops.set_params(fe, fep); 466 state->config.pll_set(fe,fep);
466 if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 0);
467 467
468 state->last_tuned_freq = fep->frequency; 468 state->last_tuned_freq = fep->frequency;
469 // if (!scanboost) { 469 // if (!scanboost) {
@@ -558,6 +558,7 @@ static int dib3000mc_set_frontend(struct dvb_frontend* fe,
558static int dib3000mc_fe_init(struct dvb_frontend* fe, int mobile_mode) 558static int dib3000mc_fe_init(struct dvb_frontend* fe, int mobile_mode)
559{ 559{
560 struct dib3000_state *state = fe->demodulator_priv; 560 struct dib3000_state *state = fe->demodulator_priv;
561 int AGCtuner=(int)fe->misc_priv;
561 deb_info("init start\n"); 562 deb_info("init start\n");
562 563
563 state->timing_offset = 0; 564 state->timing_offset = 0;
@@ -583,10 +584,11 @@ static int dib3000mc_fe_init(struct dvb_frontend* fe, int mobile_mode)
583 /* mobile mode - portable reception */ 584 /* mobile mode - portable reception */
584 wr_foreach(dib3000mc_reg_mobile_mode,dib3000mc_mobile_mode[1]); 585 wr_foreach(dib3000mc_reg_mobile_mode,dib3000mc_mobile_mode[1]);
585 586
586/* TUNER_PANASONIC_ENV57H12D5: */ 587/* TUNER_PANASONIC_ENV57H12D5 or TUNER_MICROTUNE_MT2060. Sets agc_tuner accordingly */
587 wr_foreach(dib3000mc_reg_agc_bandwidth,dib3000mc_agc_bandwidth); 588 wr_foreach(dib3000mc_reg_agc_bandwidth,dib3000mc_agc_bandwidth);
588 wr_foreach(dib3000mc_reg_agc_bandwidth_general,dib3000mc_agc_bandwidth_general); 589 wr_foreach(dib3000mc_reg_agc_bandwidth_general,dib3000mc_agc_bandwidth_general);
589 wr_foreach(dib3000mc_reg_agc,dib3000mc_agc_tuner[1]); 590 if (AGCtuner<0 || AGCtuner>=DIB3000MC_AGC_TUNER_COUNT) AGCtuner=1;
591 wr_foreach(dib3000mc_reg_agc,dib3000mc_agc_tuner[AGCtuner]);
590 592
591 wr(DIB3000MC_REG_UNK_110,DIB3000MC_UNK_110); 593 wr(DIB3000MC_REG_UNK_110,DIB3000MC_UNK_110);
592 wr(26,0x6680); 594 wr(26,0x6680);
@@ -642,6 +644,9 @@ static int dib3000mc_fe_init(struct dvb_frontend* fe, int mobile_mode)
642 644
643 set_or(DIB3000MC_REG_CLK_CFG_7,DIB3000MC_CLK_CFG_7_DIV_IN_OFF); 645 set_or(DIB3000MC_REG_CLK_CFG_7,DIB3000MC_CLK_CFG_7_DIV_IN_OFF);
644 646
647 if (state->config.pll_init)
648 state->config.pll_init(fe);
649
645 deb_info("init end\n"); 650 deb_info("init end\n");
646 return 0; 651 return 0;
647} 652}
@@ -836,6 +841,7 @@ struct dvb_frontend* dib3000mc_attach(const struct dib3000_config* config,
836 /* setup the state */ 841 /* setup the state */
837 state->i2c = i2c; 842 state->i2c = i2c;
838 memcpy(&state->config,config,sizeof(struct dib3000_config)); 843 memcpy(&state->config,config,sizeof(struct dib3000_config));
844 memcpy(&state->ops, &dib3000mc_ops, sizeof(struct dvb_frontend_ops));
839 845
840 /* check for the correct demod */ 846 /* check for the correct demod */
841 if (rd(DIB3000_REG_MANUFACTOR_ID) != DIB3000_I2C_ID_DIBCOM) 847 if (rd(DIB3000_REG_MANUFACTOR_ID) != DIB3000_I2C_ID_DIBCOM)
@@ -855,7 +861,7 @@ struct dvb_frontend* dib3000mc_attach(const struct dib3000_config* config,
855 } 861 }
856 862
857 /* create dvb_frontend */ 863 /* create dvb_frontend */
858 memcpy(&state->frontend.ops, &dib3000mc_ops, sizeof(struct dvb_frontend_ops)); 864 state->frontend.ops = &state->ops;
859 state->frontend.demodulator_priv = state; 865 state->frontend.demodulator_priv = state;
860 866
861 /* set the xfer operations */ 867 /* set the xfer operations */
@@ -872,7 +878,6 @@ error:
872 kfree(state); 878 kfree(state);
873 return NULL; 879 return NULL;
874} 880}
875EXPORT_SYMBOL(dib3000mc_attach);
876 881
877static struct dvb_frontend_ops dib3000mc_ops = { 882static struct dvb_frontend_ops dib3000mc_ops = {
878 883
@@ -911,3 +916,5 @@ static struct dvb_frontend_ops dib3000mc_ops = {
911MODULE_AUTHOR(DRIVER_AUTHOR); 916MODULE_AUTHOR(DRIVER_AUTHOR);
912MODULE_DESCRIPTION(DRIVER_DESC); 917MODULE_DESCRIPTION(DRIVER_DESC);
913MODULE_LICENSE("GPL"); 918MODULE_LICENSE("GPL");
919
920EXPORT_SYMBOL(dib3000mc_attach);