diff options
author | Trent Piepho <xyzzy@speakeasy.org> | 2007-06-02 15:30:46 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2007-07-18 13:24:15 -0400 |
commit | 4ce15678926cef4886df46964142fc2520c216cd (patch) | |
tree | 6f3b02ff93f688646a2b53f4d9af7157306b7c16 /drivers/media | |
parent | b784e526a8333db57d1b9f385a12553066bdba64 (diff) |
V4L/DVB (5777): Dvb-pll digitv dvb-usb: Eliminate last user of dvb_pll_configure
The last user of dvb_pll_configure was the dvb-usb function
dvb_usb_tuner_calc_regs(), which was nothing more than a wrapper around
dvb_pll_configure(). It's just a copy of the functionality provided by
the tuner_ops calc_regs method, and can be deleted.
There were two users of dvb_usb_tuner_calc_regs().
One was dvb_usb_tuner_set_params_i2c(), which is converted to use
fe->ops.tuner_ops.calc_regs().
The other was the digitv driver. This driver can use one of two demods,
mt352 or nxt6000.
For the mt352, the driver would set tuner_ops.calc_regs to
dvb_usb_tuner_calc_regs().
We can just attach dvb_pll and use the tuner_ops.calc_regs() provided by
that module. For the nxt600, the driver would set tuner_ops.set_params
to digitv_nxt6000_tuner_set_params.
That function would in turn use dvb_usb_tuner_calc_regs().
We convert it to use tuner_ops.calc_regs() instead, and use
dvb_pll_attach.
The digitv_tuner_attach() needs to know which frontend was attached by
digitv_frontend_attach(), since the nxt6000 needs tuner_ops.set_params()
to be overridden with digitv_nxt6000_tuner_set_params().
So, to do this a digitv_state that says which frontend was used is added
to the dvb_usb_device private state field.
Signed-off-by: Trent Piepho <xyzzy@speakeasy.org>
Signed-off-by: Michael Krufky <mkrufky@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media')
-rw-r--r-- | drivers/media/dvb/dvb-usb/digitv.c | 21 | ||||
-rw-r--r-- | drivers/media/dvb/dvb-usb/digitv.h | 4 | ||||
-rw-r--r-- | drivers/media/dvb/dvb-usb/dvb-usb-i2c.c | 22 | ||||
-rw-r--r-- | drivers/media/dvb/dvb-usb/dvb-usb.h | 1 | ||||
-rw-r--r-- | drivers/media/dvb/frontends/dvb-pll.c | 4 | ||||
-rw-r--r-- | drivers/media/dvb/frontends/dvb-pll.h | 3 |
6 files changed, 23 insertions, 32 deletions
diff --git a/drivers/media/dvb/dvb-usb/digitv.c b/drivers/media/dvb/dvb-usb/digitv.c index b5acb11c0bc9..36e0f8fee37a 100644 --- a/drivers/media/dvb/dvb-usb/digitv.c +++ b/drivers/media/dvb/dvb-usb/digitv.c | |||
@@ -118,7 +118,8 @@ static int digitv_nxt6000_tuner_set_params(struct dvb_frontend *fe, struct dvb_f | |||
118 | { | 118 | { |
119 | struct dvb_usb_adapter *adap = fe->dvb->priv; | 119 | struct dvb_usb_adapter *adap = fe->dvb->priv; |
120 | u8 b[5]; | 120 | u8 b[5]; |
121 | dvb_usb_tuner_calc_regs(fe,fep,b, 5); | 121 | |
122 | fe->ops.tuner_ops.calc_regs(fe, fep, b, sizeof(b)); | ||
122 | if (fe->ops.i2c_gate_ctrl) | 123 | if (fe->ops.i2c_gate_ctrl) |
123 | fe->ops.i2c_gate_ctrl(fe, 1); | 124 | fe->ops.i2c_gate_ctrl(fe, 1); |
124 | return digitv_ctrl_msg(adap->dev, USB_WRITE_TUNER, 0, &b[1], 4, NULL, 0); | 125 | return digitv_ctrl_msg(adap->dev, USB_WRITE_TUNER, 0, &b[1], 4, NULL, 0); |
@@ -130,12 +131,14 @@ static struct nxt6000_config digitv_nxt6000_config = { | |||
130 | 131 | ||
131 | static int digitv_frontend_attach(struct dvb_usb_adapter *adap) | 132 | static int digitv_frontend_attach(struct dvb_usb_adapter *adap) |
132 | { | 133 | { |
134 | struct digitv_state *st = adap->dev->priv; | ||
135 | |||
133 | if ((adap->fe = dvb_attach(mt352_attach, &digitv_mt352_config, &adap->dev->i2c_adap)) != NULL) { | 136 | if ((adap->fe = dvb_attach(mt352_attach, &digitv_mt352_config, &adap->dev->i2c_adap)) != NULL) { |
134 | adap->fe->ops.tuner_ops.calc_regs = dvb_usb_tuner_calc_regs; | 137 | st->is_nxt6000 = 0; |
135 | return 0; | 138 | return 0; |
136 | } | 139 | } |
137 | if ((adap->fe = dvb_attach(nxt6000_attach, &digitv_nxt6000_config, &adap->dev->i2c_adap)) != NULL) { | 140 | if ((adap->fe = dvb_attach(nxt6000_attach, &digitv_nxt6000_config, &adap->dev->i2c_adap)) != NULL) { |
138 | adap->fe->ops.tuner_ops.set_params = digitv_nxt6000_tuner_set_params; | 141 | st->is_nxt6000 = 1; |
139 | return 0; | 142 | return 0; |
140 | } | 143 | } |
141 | return -EIO; | 144 | return -EIO; |
@@ -143,8 +146,14 @@ static int digitv_frontend_attach(struct dvb_usb_adapter *adap) | |||
143 | 146 | ||
144 | static int digitv_tuner_attach(struct dvb_usb_adapter *adap) | 147 | static int digitv_tuner_attach(struct dvb_usb_adapter *adap) |
145 | { | 148 | { |
146 | adap->pll_addr = 0x60; | 149 | struct digitv_state *st = adap->dev->priv; |
147 | adap->pll_desc = &dvb_pll_tded4; | 150 | |
151 | if (!dvb_attach(dvb_pll_attach, adap->fe, 0x60, NULL, &dvb_pll_tded4)) | ||
152 | return -ENODEV; | ||
153 | |||
154 | if (st->is_nxt6000) | ||
155 | adap->fe->ops.tuner_ops.set_params = digitv_nxt6000_tuner_set_params; | ||
156 | |||
148 | return 0; | 157 | return 0; |
149 | } | 158 | } |
150 | 159 | ||
@@ -273,6 +282,8 @@ static struct dvb_usb_device_properties digitv_properties = { | |||
273 | .usb_ctrl = CYPRESS_FX2, | 282 | .usb_ctrl = CYPRESS_FX2, |
274 | .firmware = "dvb-usb-digitv-02.fw", | 283 | .firmware = "dvb-usb-digitv-02.fw", |
275 | 284 | ||
285 | .size_of_priv = sizeof(struct digitv_state), | ||
286 | |||
276 | .num_adapters = 1, | 287 | .num_adapters = 1, |
277 | .adapter = { | 288 | .adapter = { |
278 | { | 289 | { |
diff --git a/drivers/media/dvb/dvb-usb/digitv.h b/drivers/media/dvb/dvb-usb/digitv.h index 477ee428a70e..8b43e3db8691 100644 --- a/drivers/media/dvb/dvb-usb/digitv.h +++ b/drivers/media/dvb/dvb-usb/digitv.h | |||
@@ -4,6 +4,10 @@ | |||
4 | #define DVB_USB_LOG_PREFIX "digitv" | 4 | #define DVB_USB_LOG_PREFIX "digitv" |
5 | #include "dvb-usb.h" | 5 | #include "dvb-usb.h" |
6 | 6 | ||
7 | struct digitv_state { | ||
8 | int is_nxt6000; | ||
9 | }; | ||
10 | |||
7 | extern int dvb_usb_digitv_debug; | 11 | extern int dvb_usb_digitv_debug; |
8 | #define deb_rc(args...) dprintk(dvb_usb_digitv_debug,0x01,args) | 12 | #define deb_rc(args...) dprintk(dvb_usb_digitv_debug,0x01,args) |
9 | 13 | ||
diff --git a/drivers/media/dvb/dvb-usb/dvb-usb-i2c.c b/drivers/media/dvb/dvb-usb/dvb-usb-i2c.c index 4c80823d8d07..5792951b990e 100644 --- a/drivers/media/dvb/dvb-usb/dvb-usb-i2c.c +++ b/drivers/media/dvb/dvb-usb/dvb-usb-i2c.c | |||
@@ -78,26 +78,6 @@ int dvb_usb_tuner_init_i2c(struct dvb_frontend *fe) | |||
78 | } | 78 | } |
79 | EXPORT_SYMBOL(dvb_usb_tuner_init_i2c); | 79 | EXPORT_SYMBOL(dvb_usb_tuner_init_i2c); |
80 | 80 | ||
81 | int dvb_usb_tuner_calc_regs(struct dvb_frontend *fe, struct dvb_frontend_parameters *fep, u8 *b, int buf_len) | ||
82 | { | ||
83 | struct dvb_usb_adapter *adap = fe->dvb->priv; | ||
84 | |||
85 | if (buf_len != 5) | ||
86 | return -EINVAL; | ||
87 | if (adap->pll_desc == NULL) | ||
88 | return 0; | ||
89 | |||
90 | deb_pll("pll addr: %x, freq: %d %p\n",adap->pll_addr, fep->frequency, adap->pll_desc); | ||
91 | |||
92 | b[0] = adap->pll_addr; | ||
93 | dvb_pll_configure(adap->pll_desc, &b[1], fep); | ||
94 | |||
95 | deb_pll("pll-buf: %x %x %x %x %x\n",b[0],b[1],b[2],b[3],b[4]); | ||
96 | |||
97 | return 5; | ||
98 | } | ||
99 | EXPORT_SYMBOL(dvb_usb_tuner_calc_regs); | ||
100 | |||
101 | int dvb_usb_tuner_set_params_i2c(struct dvb_frontend *fe, struct dvb_frontend_parameters *fep) | 81 | int dvb_usb_tuner_set_params_i2c(struct dvb_frontend *fe, struct dvb_frontend_parameters *fep) |
102 | { | 82 | { |
103 | struct dvb_usb_adapter *adap = fe->dvb->priv; | 83 | struct dvb_usb_adapter *adap = fe->dvb->priv; |
@@ -105,7 +85,7 @@ int dvb_usb_tuner_set_params_i2c(struct dvb_frontend *fe, struct dvb_frontend_pa | |||
105 | u8 b[5]; | 85 | u8 b[5]; |
106 | struct i2c_msg msg = { .addr = adap->pll_addr, .flags = 0, .buf = &b[1], .len = 4 }; | 86 | struct i2c_msg msg = { .addr = adap->pll_addr, .flags = 0, .buf = &b[1], .len = 4 }; |
107 | 87 | ||
108 | dvb_usb_tuner_calc_regs(fe,fep,b,5); | 88 | fe->ops.tuner_ops.calc_regs(fe, fep, b, sizeof(b)); |
109 | 89 | ||
110 | if (adap->tuner_pass_ctrl) | 90 | if (adap->tuner_pass_ctrl) |
111 | adap->tuner_pass_ctrl(fe, 1, adap->pll_addr); | 91 | adap->tuner_pass_ctrl(fe, 1, adap->pll_addr); |
diff --git a/drivers/media/dvb/dvb-usb/dvb-usb.h b/drivers/media/dvb/dvb-usb/dvb-usb.h index 6f824a569e14..d008a24c247a 100644 --- a/drivers/media/dvb/dvb-usb/dvb-usb.h +++ b/drivers/media/dvb/dvb-usb/dvb-usb.h | |||
@@ -390,7 +390,6 @@ extern int dvb_usb_nec_rc_key_to_event(struct dvb_usb_device *, u8[], u32 *, int | |||
390 | 390 | ||
391 | /* commonly used pll init and set functions */ | 391 | /* commonly used pll init and set functions */ |
392 | extern int dvb_usb_tuner_init_i2c(struct dvb_frontend *); | 392 | extern int dvb_usb_tuner_init_i2c(struct dvb_frontend *); |
393 | extern int dvb_usb_tuner_calc_regs(struct dvb_frontend *, struct dvb_frontend_parameters *, u8 *buf, int buf_len); | ||
394 | extern int dvb_usb_tuner_set_params_i2c(struct dvb_frontend *, struct dvb_frontend_parameters *); | 393 | extern int dvb_usb_tuner_set_params_i2c(struct dvb_frontend *, struct dvb_frontend_parameters *); |
395 | 394 | ||
396 | /* commonly used firmware download types and function */ | 395 | /* commonly used firmware download types and function */ |
diff --git a/drivers/media/dvb/frontends/dvb-pll.c b/drivers/media/dvb/frontends/dvb-pll.c index 9fb4decebd95..5c26fa112983 100644 --- a/drivers/media/dvb/frontends/dvb-pll.c +++ b/drivers/media/dvb/frontends/dvb-pll.c | |||
@@ -522,8 +522,8 @@ static int debug = 0; | |||
522 | module_param(debug, int, 0644); | 522 | module_param(debug, int, 0644); |
523 | MODULE_PARM_DESC(debug, "enable verbose debug messages"); | 523 | MODULE_PARM_DESC(debug, "enable verbose debug messages"); |
524 | 524 | ||
525 | int dvb_pll_configure(struct dvb_pll_desc *desc, u8 *buf, | 525 | static int dvb_pll_configure(struct dvb_pll_desc *desc, u8 *buf, |
526 | const struct dvb_frontend_parameters *params) | 526 | const struct dvb_frontend_parameters *params) |
527 | { | 527 | { |
528 | u32 div; | 528 | u32 div; |
529 | int i; | 529 | int i; |
diff --git a/drivers/media/dvb/frontends/dvb-pll.h b/drivers/media/dvb/frontends/dvb-pll.h index 83f1279da77f..a88ec86bd3b2 100644 --- a/drivers/media/dvb/frontends/dvb-pll.h +++ b/drivers/media/dvb/frontends/dvb-pll.h | |||
@@ -50,9 +50,6 @@ extern struct dvb_pll_desc dvb_pll_philips_td1316; | |||
50 | extern struct dvb_pll_desc dvb_pll_thomson_fe6600; | 50 | extern struct dvb_pll_desc dvb_pll_thomson_fe6600; |
51 | extern struct dvb_pll_desc dvb_pll_opera1; | 51 | extern struct dvb_pll_desc dvb_pll_opera1; |
52 | 52 | ||
53 | extern int dvb_pll_configure(struct dvb_pll_desc *desc, u8 *buf, | ||
54 | const struct dvb_frontend_parameters *params); | ||
55 | |||
56 | /** | 53 | /** |
57 | * Attach a dvb-pll to the supplied frontend structure. | 54 | * Attach a dvb-pll to the supplied frontend structure. |
58 | * | 55 | * |