diff options
author | Patrick Boettcher <pb@linuxtv.org> | 2006-08-08 14:48:09 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2006-09-26 10:53:41 -0400 |
commit | e4d6c1f74aaac1bbe5be50e7368e5ac99d54e5a2 (patch) | |
tree | df1106a211770b6c5c13ae32703cece73ef0e6fe /drivers/media/dvb/dvb-usb/dibusb-common.c | |
parent | a16bf5d5603184dc1db88f37051881b2eeacfd17 (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/dvb-usb/dibusb-common.c')
-rw-r--r-- | drivers/media/dvb/dvb-usb/dibusb-common.c | 69 |
1 files changed, 36 insertions, 33 deletions
diff --git a/drivers/media/dvb/dvb-usb/dibusb-common.c b/drivers/media/dvb/dvb-usb/dibusb-common.c index 4d3d0d3dab95..e079ba95d384 100644 --- a/drivers/media/dvb/dvb-usb/dibusb-common.c +++ b/drivers/media/dvb/dvb-usb/dibusb-common.c | |||
@@ -168,63 +168,61 @@ int dibusb_read_eeprom_byte(struct dvb_usb_device *d, u8 offs, u8 *val) | |||
168 | } | 168 | } |
169 | EXPORT_SYMBOL(dibusb_read_eeprom_byte); | 169 | EXPORT_SYMBOL(dibusb_read_eeprom_byte); |
170 | 170 | ||
171 | static struct mt2060_config default_mt2060_config = { | 171 | static struct mt2060_config stk3000p_mt2060_config = { |
172 | .i2c_address = 0x60, | 172 | .i2c_address = 0x60, |
173 | }; | 173 | }; |
174 | 174 | ||
175 | static int dibusb_tuner_init(struct dvb_frontend *fe) | 175 | static int dibusb_tuner_init(struct dvb_frontend *fe) |
176 | { | 176 | { |
177 | int ret; | ||
178 | struct dvb_usb_device *d = fe->dvb->priv; | 177 | struct dvb_usb_device *d = fe->dvb->priv; |
179 | struct dibusb_state *st = d->priv; | 178 | struct dibusb_state *st = d->priv; |
180 | 179 | ||
181 | if (d->tuner_pass_ctrl) { | 180 | if (d->tuner_pass_ctrl && st->mt2060_present) { |
182 | if ((int)d->fe->misc_priv==DIBUSB_TUNER_MT2060) { // Microtune MT2060 | 181 | int ret; |
183 | d->tuner_pass_ctrl(d->fe,1,default_mt2060_config.i2c_address); | 182 | d->tuner_pass_ctrl(d->fe, 1, stk3000p_mt2060_config.i2c_address); |
184 | ret=mt2060_init(&st->mt2060); | 183 | ret = mt2060_init(&st->mt2060); |
185 | } | 184 | d->tuner_pass_ctrl(d->fe, 0, 0); |
186 | else { // Panasonic whatever | ||
187 | d->tuner_pass_ctrl(d->fe,1,d->pll_addr); | ||
188 | ret=dvb_usb_pll_init_i2c(fe); | ||
189 | } | ||
190 | d->tuner_pass_ctrl(d->fe,0,0); | ||
191 | return ret; | 185 | return ret; |
192 | } | 186 | } |
193 | return -ENODEV; | 187 | return dvb_usb_pll_init_i2c(fe); |
194 | } | 188 | } |
195 | 189 | ||
196 | static int dibusb_tuner_set(struct dvb_frontend *fe, struct dvb_frontend_parameters *fep) | 190 | static int dibusb_tuner_set(struct dvb_frontend *fe, struct dvb_frontend_parameters *fep) |
197 | { | 191 | { |
198 | int ret; | ||
199 | struct dvb_usb_device *d = fe->dvb->priv; | 192 | struct dvb_usb_device *d = fe->dvb->priv; |
200 | struct dibusb_state *st = d->priv; | 193 | struct dibusb_state *st = d->priv; |
201 | 194 | ||
202 | if (d->tuner_pass_ctrl) { | 195 | if (d->tuner_pass_ctrl && st->mt2060_present) { |
203 | if ((int)d->fe->misc_priv==DIBUSB_TUNER_MT2060) { | 196 | int ret; |
204 | d->tuner_pass_ctrl(d->fe,1,default_mt2060_config.i2c_address); | 197 | d->tuner_pass_ctrl(d->fe, 1, stk3000p_mt2060_config.i2c_address); |
205 | ret=mt2060_set(&st->mt2060,fep); | 198 | ret = mt2060_set(&st->mt2060,fep); |
206 | } | ||
207 | else { | ||
208 | d->tuner_pass_ctrl(d->fe,1,d->pll_addr); | ||
209 | ret=dvb_usb_pll_set_i2c(fe,fep); | ||
210 | } | ||
211 | d->tuner_pass_ctrl(d->fe,0,0); | 199 | d->tuner_pass_ctrl(d->fe,0,0); |
212 | return ret; | 200 | return ret; |
213 | } | 201 | } |
214 | return -ENODEV; | 202 | return dvb_usb_pll_set_i2c(fe,fep); |
215 | } | 203 | } |
216 | 204 | ||
205 | static const struct dib3000p_agc_config dib3000p_agc_panasonic_env57h1xd5 = { | ||
206 | { 0x51, 0x301d, 0x0, 0x1cc7, 0xdc29, 0x570a, | ||
207 | 0xbae1, 0x8ccd, 0x3b6d, 0x551d, 0xa, 0x951e } | ||
208 | }; | ||
209 | |||
210 | static const struct dib3000p_agc_config dib3000p_agc_microtune_mt2060 = { | ||
211 | { 0x196, 0x301d, 0x0, 0x1cc7, 0xffff, 0x5c29, | ||
212 | 0xa8f6, 0x5eb8, 0x65ff, 0x40ff, 0x8a, 0x1114 } | ||
213 | }; | ||
214 | |||
217 | int dibusb_dib3000mc_frontend_attach(struct dvb_usb_device *d) | 215 | int dibusb_dib3000mc_frontend_attach(struct dvb_usb_device *d) |
218 | { | 216 | { |
219 | struct dib3000_config demod_cfg; | 217 | struct dib3000_config demod_cfg; |
220 | struct dibusb_state *st = d->priv; | 218 | struct dibusb_state *st = d->priv; |
221 | 219 | ||
222 | demod_cfg.pll_set = dibusb_tuner_set; | 220 | demod_cfg.agc = &dib3000p_agc_panasonic_env57h1xd5; |
221 | demod_cfg.pll_set = dibusb_tuner_set; | ||
223 | demod_cfg.pll_init = dibusb_tuner_init; | 222 | demod_cfg.pll_init = dibusb_tuner_init; |
224 | 223 | ||
225 | for (demod_cfg.demod_address = 0x8; demod_cfg.demod_address < 0xd; demod_cfg.demod_address++) | 224 | for (demod_cfg.demod_address = 0x8; demod_cfg.demod_address < 0xd; demod_cfg.demod_address++) |
226 | if ((d->fe = dib3000mc_attach(&demod_cfg,&d->i2c_adap,&st->ops)) != NULL) { | 225 | if ((d->fe = dib3000mc_attach(&demod_cfg,&d->i2c_adap,&st->ops)) != NULL) { |
227 | d->fe->misc_priv=(void *)DIBUSB_TUNER_DEFAULT; | ||
228 | d->tuner_pass_ctrl = st->ops.tuner_pass_ctrl; | 226 | d->tuner_pass_ctrl = st->ops.tuner_pass_ctrl; |
229 | return 0; | 227 | return 0; |
230 | } | 228 | } |
@@ -236,18 +234,23 @@ EXPORT_SYMBOL(dibusb_dib3000mc_frontend_attach); | |||
236 | int dibusb_dib3000mc_tuner_attach (struct dvb_usb_device *d) | 234 | int dibusb_dib3000mc_tuner_attach (struct dvb_usb_device *d) |
237 | { | 235 | { |
238 | int ret; | 236 | int ret; |
239 | d->pll_addr = 0x60; | 237 | |
240 | d->pll_desc = &dvb_pll_env57h1xd5; | ||
241 | if (d->tuner_pass_ctrl) { | 238 | if (d->tuner_pass_ctrl) { |
242 | struct dibusb_state *st = d->priv; | 239 | struct dibusb_state *st = d->priv; |
243 | d->tuner_pass_ctrl(d->fe,1,default_mt2060_config.i2c_address); | 240 | d->tuner_pass_ctrl(d->fe, 1, stk3000p_mt2060_config.i2c_address); |
244 | if ((ret = mt2060_attach(&st->mt2060,&default_mt2060_config, &d->i2c_adap)) == 0) { | 241 | /* check for mt2060 */ |
245 | d->fe->misc_priv=(void *)DIBUSB_TUNER_MT2060; | 242 | if ((ret = mt2060_attach(&st->mt2060,&stk3000p_mt2060_config, &d->i2c_adap)) != 0) { |
243 | /* not found - use panasonic pll parameters */ | ||
244 | d->pll_addr = 0x60; | ||
245 | d->pll_desc = &dvb_pll_env57h1xd5; | ||
246 | } else { | ||
247 | st->mt2060_present = 1; | ||
248 | /* set the correct agc parameters for the dib3000p */ | ||
249 | dib3000mc_set_agc_config(d->fe, &dib3000p_agc_microtune_mt2060); | ||
246 | } | 250 | } |
247 | d->tuner_pass_ctrl(d->fe,0,0); | 251 | d->tuner_pass_ctrl(d->fe,0,0); |
248 | return 0; | ||
249 | } | 252 | } |
250 | return -ENODEV; | 253 | return 0; |
251 | } | 254 | } |
252 | EXPORT_SYMBOL(dibusb_dib3000mc_tuner_attach); | 255 | EXPORT_SYMBOL(dibusb_dib3000mc_tuner_attach); |
253 | 256 | ||