aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb/frontends
diff options
context:
space:
mode:
authorPatrick Boettcher <pb@linuxtv.org>2006-08-08 14:48:09 -0400
committerMauro Carvalho Chehab <mchehab@infradead.org>2006-09-26 10:53:41 -0400
commite4d6c1f74aaac1bbe5be50e7368e5ac99d54e5a2 (patch)
treedf1106a211770b6c5c13ae32703cece73ef0e6fe /drivers/media/dvb/frontends
parenta16bf5d5603184dc1db88f37051881b2eeacfd17 (diff)
V4L/DVB: Cleanups for mt2060-integration
- some coding style fixes for newly added mt2060 - moved agc-config from fixed values in dib3000mc to configurable ones - whitespace clean-ups for usb-id-file Signed-off-by: Patrick Boettcher <pb@linuxtv.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/dvb/frontends')
-rw-r--r--drivers/media/dvb/frontends/dib3000.h29
-rw-r--r--drivers/media/dvb/frontends/dib3000mc.c31
-rw-r--r--drivers/media/dvb/frontends/dib3000mc_priv.h35
3 files changed, 36 insertions, 59 deletions
diff --git a/drivers/media/dvb/frontends/dib3000.h b/drivers/media/dvb/frontends/dib3000.h
index d2ab7479012a..bd0e663cf6f3 100644
--- a/drivers/media/dvb/frontends/dib3000.h
+++ b/drivers/media/dvb/frontends/dib3000.h
@@ -26,10 +26,20 @@
26 26
27#include <linux/dvb/frontend.h> 27#include <linux/dvb/frontend.h>
28 28
29struct dib3000p_agc_config {
30 u16 val[12];
31};
32
29struct dib3000_config 33struct dib3000_config
30{ 34{
31 /* the demodulator's i2c address */ 35 /* the demodulator's i2c address */
32 u8 demod_address; 36 u8 demod_address;
37
38 const struct dib3000p_agc_config *agc;
39
40 /* PLL maintenance and the i2c address of the PLL */
41 int (*pll_init)(struct dvb_frontend *fe);
42 int (*pll_set)(struct dvb_frontend *fe, struct dvb_frontend_parameters* params);
33}; 43};
34 44
35struct dib_fe_xfer_ops 45struct dib_fe_xfer_ops
@@ -41,28 +51,11 @@ struct dib_fe_xfer_ops
41 int (*tuner_pass_ctrl)(struct dvb_frontend *fe, int onoff, u8 pll_ctrl); 51 int (*tuner_pass_ctrl)(struct dvb_frontend *fe, int onoff, u8 pll_ctrl);
42}; 52};
43 53
44#if defined(CONFIG_DVB_DIB3000MB) || defined(CONFIG_DVB_DIB3000MB_MODULE)
45extern struct dvb_frontend* dib3000mb_attach(const struct dib3000_config* config, 54extern struct dvb_frontend* dib3000mb_attach(const struct dib3000_config* config,
46 struct i2c_adapter* i2c, struct dib_fe_xfer_ops *xfer_ops); 55 struct i2c_adapter* i2c, struct dib_fe_xfer_ops *xfer_ops);
47#else
48static inline struct dvb_frontend* dib3000mb_attach(const struct dib3000_config* config,
49 struct i2c_adapter* i2c, struct dib_fe_xfer_ops *xfer_ops)
50{
51 printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __FUNCTION__);
52 return NULL;
53}
54#endif // CONFIG_DVB_DIB3000MB
55 56
56#if defined(CONFIG_DVB_DIB3000MC) || defined(CONFIG_DVB_DIB3000MC_MODULE)
57extern struct dvb_frontend* dib3000mc_attach(const struct dib3000_config* config, 57extern struct dvb_frontend* dib3000mc_attach(const struct dib3000_config* config,
58 struct i2c_adapter* i2c, struct dib_fe_xfer_ops *xfer_ops); 58 struct i2c_adapter* i2c, struct dib_fe_xfer_ops *xfer_ops);
59#else
60static inline struct dvb_frontend* dib3000mc_attach(const struct dib3000_config* config,
61 struct i2c_adapter* i2c, struct dib_fe_xfer_ops *xfer_ops)
62{
63 printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __FUNCTION__);
64 return NULL;
65}
66#endif // CONFIG_DVB_DIB3000MC
67 59
60extern int dib3000mc_set_agc_config(struct dvb_frontend *fe, const struct dib3000p_agc_config *agc);
68#endif // DIB3000_H 61#endif // DIB3000_H
diff --git a/drivers/media/dvb/frontends/dib3000mc.c b/drivers/media/dvb/frontends/dib3000mc.c
index 66b30edad2e4..41710f43975a 100644
--- a/drivers/media/dvb/frontends/dib3000mc.c
+++ b/drivers/media/dvb/frontends/dib3000mc.c
@@ -558,7 +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 const struct dib3000p_agc_config *agc = state->config.agc;
562 deb_info("init start\n"); 562 deb_info("init start\n");
563 563
564 state->timing_offset = 0; 564 state->timing_offset = 0;
@@ -584,11 +584,24 @@ static int dib3000mc_fe_init(struct dvb_frontend* fe, int mobile_mode)
584 /* mobile mode - portable reception */ 584 /* mobile mode - portable reception */
585 wr_foreach(dib3000mc_reg_mobile_mode,dib3000mc_mobile_mode[1]); 585 wr_foreach(dib3000mc_reg_mobile_mode,dib3000mc_mobile_mode[1]);
586 586
587/* TUNER_PANASONIC_ENV57H12D5 or TUNER_MICROTUNE_MT2060. Sets agc_tuner accordingly */ 587 /* AGC settings for all tuners */
588 wr_foreach(dib3000mc_reg_agc_bandwidth,dib3000mc_agc_bandwidth); 588 wr_foreach(dib3000mc_reg_agc_bandwidth,dib3000mc_agc_bandwidth);
589 wr_foreach(dib3000mc_reg_agc_bandwidth_general,dib3000mc_agc_bandwidth_general); 589 wr_foreach(dib3000mc_reg_agc_bandwidth_general,dib3000mc_agc_bandwidth_general);
590 if (AGCtuner<0 || AGCtuner>=DIB3000MC_AGC_TUNER_COUNT) AGCtuner=1; 590
591 wr_foreach(dib3000mc_reg_agc,dib3000mc_agc_tuner[AGCtuner]); 591 /* AGC setting - specific to the tuners */
592 wr(36, agc->val[0]);
593 wr(37, agc->val[1]);
594 wr(38, agc->val[2]);
595 wr(39, agc->val[3]);
596
597 wr(42, agc->val[4]);
598 wr(43, agc->val[5]);
599 wr(44, agc->val[6]);
600 wr(45, agc->val[7]);
601 wr(46, agc->val[8]);
602 wr(47, agc->val[9]);
603 wr(48, agc->val[10]);
604 wr(49, agc->val[11]);
592 605
593 wr(DIB3000MC_REG_UNK_110,DIB3000MC_UNK_110); 606 wr(DIB3000MC_REG_UNK_110,DIB3000MC_UNK_110);
594 wr(26,0x6680); 607 wr(26,0x6680);
@@ -824,6 +837,13 @@ static int dib3000mc_demod_init(struct dib3000_state *state)
824 return 0; 837 return 0;
825} 838}
826 839
840int dib3000mc_set_agc_config(struct dvb_frontend *fe, const struct dib3000p_agc_config *agc)
841{
842 struct dib3000_state *st = fe->demodulator_priv;
843 st->config.agc = agc;
844 return 0;
845}
846EXPORT_SYMBOL(dib3000mc_set_agc_config);
827 847
828static struct dvb_frontend_ops dib3000mc_ops; 848static struct dvb_frontend_ops dib3000mc_ops;
829 849
@@ -878,6 +898,7 @@ error:
878 kfree(state); 898 kfree(state);
879 return NULL; 899 return NULL;
880} 900}
901EXPORT_SYMBOL(dib3000mc_attach);
881 902
882static struct dvb_frontend_ops dib3000mc_ops = { 903static struct dvb_frontend_ops dib3000mc_ops = {
883 904
@@ -916,5 +937,3 @@ static struct dvb_frontend_ops dib3000mc_ops = {
916MODULE_AUTHOR(DRIVER_AUTHOR); 937MODULE_AUTHOR(DRIVER_AUTHOR);
917MODULE_DESCRIPTION(DRIVER_DESC); 938MODULE_DESCRIPTION(DRIVER_DESC);
918MODULE_LICENSE("GPL"); 939MODULE_LICENSE("GPL");
919
920EXPORT_SYMBOL(dib3000mc_attach);
diff --git a/drivers/media/dvb/frontends/dib3000mc_priv.h b/drivers/media/dvb/frontends/dib3000mc_priv.h
index e1d0c98cf914..a0c8f1c911de 100644
--- a/drivers/media/dvb/frontends/dib3000mc_priv.h
+++ b/drivers/media/dvb/frontends/dib3000mc_priv.h
@@ -155,41 +155,6 @@ static u16 dib3000mc_imp_noise_ctl[][2] = {
155 { 0x1294, 0x1ff8 }, /* mode 4 */ 155 { 0x1294, 0x1ff8 }, /* mode 4 */
156}; 156};
157 157
158/* AGC registers */
159static u16 dib3000mc_reg_agc[] = {
160 36,37,38,39,42,43,44,45,46,47,48,49
161};
162/* AGC settings. Don't change the ordering of the entries */
163#define DIB3000MC_AGC_TUNER_COUNT 5
164
165static u16 dib3000mc_agc_tuner[][12] = {
166/* 0*/ { 0x0051, 0x301d, 0x0000, 0x1cc7, 0xcf5c, 0x6666,
167 0xbae1, 0xa148, 0x3b5e, 0x3c1c, 0x001a, 0x2019
168 }, /* TUNER_PANASONIC_ENV77H04D5, */
169
170/* 1*/ { 0x0051, 0x301d, 0x0000, 0x1cc7, 0xdc29, 0x570a,
171 0xbae1, 0x8ccd, 0x3b6d, 0x551d, 0x000a, 0x951e
172 }, /* TUNER_PANASONIC_ENV57H13D5, TUNER_PANASONIC_ENV57H12D5 */
173
174/* 2*/ { 0x0051, 0x301d, 0x0000, 0x1cc7, 0xffff, 0xffff,
175 0xffff, 0x0000, 0xfdfd, 0x4040, 0x00fd, 0x4040
176 }, /* TUNER_SAMSUNG_DTOS333IH102, TUNER_RFAGCIN_UNKNOWN */
177
178/* 3*/ { 0x0196, 0x301d, 0x0000, 0x1cc7, 0xbd71, 0x5c29,
179 0xb5c3, 0x6148, 0x6569, 0x5127, 0x0033, 0x3537
180 }, /* TUNER_PROVIDER_X */
181
182/* 4*/ { 0x0196, 0x301d, 0x0000, 0x1cc7, 0xffff, 0x5c29,
183 0xa8f6, 0x5eb8, 0x65ff, 0x40ff, 0x008a, 0x1114
184 }, /* TUNER_MT2060 ( as in DibCom driver )*/
185
186/* { 0x0196, 0x301d, 0x0000, 0x1cc7, 0xbd71, 0x5c29,
187 0xb5c3, 0x6148, 0x0045, 0x5127, 0x0033, 0x3437
188 },*//* TUNER_MT2060 ( as in LITE-ON driver )*/
189
190 /* TODO TUNER_PANASONIC_ENV57H10D8, TUNER_PANASONIC_ENV57H11D8 */
191};
192
193/* AGC loop bandwidth */ 158/* AGC loop bandwidth */
194static u16 dib3000mc_reg_agc_bandwidth[] = { 40,41 }; 159static u16 dib3000mc_reg_agc_bandwidth[] = { 40,41 };
195static u16 dib3000mc_agc_bandwidth[] = { 0x119,0x330 }; 160static u16 dib3000mc_agc_bandwidth[] = { 0x119,0x330 };