diff options
author | Linus Torvalds <torvalds@g5.osdl.org> | 2006-09-30 12:39:15 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-09-30 12:39:15 -0400 |
commit | 5ffd1a6aaacc25be8cd0770a51ec6d46add3a276 (patch) | |
tree | 5b076c44f8b7ff88dba9a554d7748c6f083c9071 /drivers/media/dvb/dvb-usb/dibusb-common.c | |
parent | 0cd43f83d381c4246a08cd775834833d6fd64805 (diff) | |
parent | 8dd86eebc5315910ebfd9f30f1674254308be4b3 (diff) |
Merge master.kernel.org:/pub/scm/linux/kernel/git/mchehab/v4l-dvb
* master.kernel.org:/pub/scm/linux/kernel/git/mchehab/v4l-dvb: (180 commits)
V4L/DVB (4641): Trivial: use lowercase letters in hex subsystem ids
V4L/DVB (4639): Cx88: add autodetection for alternate revision of Leadtek PVR
V4L/DVB (4638): Basic DVB-T and analog TV support for the HVR1300.
V4L/DVB (4637): Add a default method for VIDIOC_G_PARM
V4L/DVB (4635): Extend bttv and saa7134 to check for both AGP and PCI PCI failure case
V4L/DVB (4634): Zr36120: implement pcipci checks
V4L/DVB (4632): Zoran: Implement pcipci failure check
V4L/DVB (4631): Av7110: remove V4L2_CAP_VBI_CAPTURE flag
V4L/DVB (4630): Av7110: FW_LOADER depemdency fixed
V4L/DVB (4629): Saa7134: add card support for Proteus Pro 2309
V4L/DVB (4628): Fix VIDIOC_ENUMSTD ioctl in videodev.c
V4L/DVB (4627): Vivi crashes with mplayer
V4L/DVB (4626): On saa7111/7113, LUMA_CTRL need a different value
V4L/DVB (4624): Tvaudio: Replaced kernel_thread() with kthread_run()
V4L/DVB (4622): Copy-paste bug in videodev.c
V4L/DVB (4620): Fix AGC configuration for MOD3000P-based boards
V4L/DVB (4619): Fixes some I2C dependencies on V4L devices
V4L/DVB (4617): Problem with dibusb-mb.c USB IDs
V4L/DVB (4616): [PATCH] Nebula DigiTV USB RC support
V4L/DVB (4614): Export symbol saa7134_tvaudio_setmute from saa7134 for saa7134-alsa
...
Diffstat (limited to 'drivers/media/dvb/dvb-usb/dibusb-common.c')
-rw-r--r-- | drivers/media/dvb/dvb-usb/dibusb-common.c | 200 |
1 files changed, 182 insertions, 18 deletions
diff --git a/drivers/media/dvb/dvb-usb/dibusb-common.c b/drivers/media/dvb/dvb-usb/dibusb-common.c index abd75b4a350d..124e25ac53b3 100644 --- a/drivers/media/dvb/dvb-usb/dibusb-common.c +++ b/drivers/media/dvb/dvb-usb/dibusb-common.c | |||
@@ -131,9 +131,6 @@ static int dibusb_i2c_xfer(struct i2c_adapter *adap,struct i2c_msg msg[],int num | |||
131 | if (mutex_lock_interruptible(&d->i2c_mutex) < 0) | 131 | if (mutex_lock_interruptible(&d->i2c_mutex) < 0) |
132 | return -EAGAIN; | 132 | return -EAGAIN; |
133 | 133 | ||
134 | if (num > 2) | ||
135 | warn("more than 2 i2c messages at a time is not handled yet. TODO."); | ||
136 | |||
137 | for (i = 0; i < num; i++) { | 134 | for (i = 0; i < num; i++) { |
138 | /* write/read request */ | 135 | /* write/read request */ |
139 | if (i+1 < num && (msg[i+1].flags & I2C_M_RD)) { | 136 | if (i+1 < num && (msg[i+1].flags & I2C_M_RD)) { |
@@ -168,31 +165,137 @@ int dibusb_read_eeprom_byte(struct dvb_usb_device *d, u8 offs, u8 *val) | |||
168 | } | 165 | } |
169 | EXPORT_SYMBOL(dibusb_read_eeprom_byte); | 166 | EXPORT_SYMBOL(dibusb_read_eeprom_byte); |
170 | 167 | ||
168 | /* 3000MC/P stuff */ | ||
169 | // Config Adjacent channels Perf -cal22 | ||
170 | static struct dibx000_agc_config dib3000p_mt2060_agc_config = { | ||
171 | .band_caps = BAND_VHF | BAND_UHF, | ||
172 | .setup = (0 << 15) | (0 << 14) | (1 << 13) | (1 << 12) | (29 << 0), | ||
173 | |||
174 | .agc1_max = 48497, | ||
175 | .agc1_min = 23593, | ||
176 | .agc2_max = 46531, | ||
177 | .agc2_min = 24904, | ||
178 | |||
179 | .agc1_pt1 = 0x65, | ||
180 | .agc1_pt2 = 0x69, | ||
181 | |||
182 | .agc1_slope1 = 0x51, | ||
183 | .agc1_slope2 = 0x27, | ||
184 | |||
185 | .agc2_pt1 = 0, | ||
186 | .agc2_pt2 = 0x33, | ||
187 | |||
188 | .agc2_slope1 = 0x35, | ||
189 | .agc2_slope2 = 0x37, | ||
190 | }; | ||
191 | |||
192 | static struct dib3000mc_config stk3000p_dib3000p_config = { | ||
193 | &dib3000p_mt2060_agc_config, | ||
194 | |||
195 | .max_time = 0x196, | ||
196 | .ln_adc_level = 0x1cc7, | ||
197 | |||
198 | .output_mpeg2_in_188_bytes = 1, | ||
199 | }; | ||
200 | |||
201 | static struct dibx000_agc_config dib3000p_panasonic_agc_config = { | ||
202 | .setup = (0 << 15) | (0 << 14) | (1 << 13) | (1 << 12) | (29 << 0), | ||
203 | |||
204 | .agc1_max = 56361, | ||
205 | .agc1_min = 22282, | ||
206 | .agc2_max = 47841, | ||
207 | .agc2_min = 36045, | ||
208 | |||
209 | .agc1_pt1 = 0x3b, | ||
210 | .agc1_pt2 = 0x6b, | ||
211 | |||
212 | .agc1_slope1 = 0x55, | ||
213 | .agc1_slope2 = 0x1d, | ||
214 | |||
215 | .agc2_pt1 = 0, | ||
216 | .agc2_pt2 = 0x0a, | ||
217 | |||
218 | .agc2_slope1 = 0x95, | ||
219 | .agc2_slope2 = 0x1e, | ||
220 | }; | ||
221 | |||
222 | static struct dib3000mc_config mod3000p_dib3000p_config = { | ||
223 | &dib3000p_panasonic_agc_config, | ||
224 | |||
225 | .max_time = 0x51, | ||
226 | .ln_adc_level = 0x1cc7, | ||
227 | |||
228 | .output_mpeg2_in_188_bytes = 1, | ||
229 | }; | ||
230 | |||
171 | int dibusb_dib3000mc_frontend_attach(struct dvb_usb_device *d) | 231 | int dibusb_dib3000mc_frontend_attach(struct dvb_usb_device *d) |
172 | { | 232 | { |
173 | struct dib3000_config demod_cfg; | 233 | if (dib3000mc_attach(&d->i2c_adap, 1, DEFAULT_DIB3000P_I2C_ADDRESS, 0, &mod3000p_dib3000p_config, &d->fe) == 0 || |
174 | struct dibusb_state *st = d->priv; | 234 | dib3000mc_attach(&d->i2c_adap, 1, DEFAULT_DIB3000MC_I2C_ADDRESS, 0, &mod3000p_dib3000p_config, &d->fe) == 0) { |
175 | 235 | if (d->priv != NULL) { | |
176 | for (demod_cfg.demod_address = 0x8; demod_cfg.demod_address < 0xd; demod_cfg.demod_address++) | 236 | struct dibusb_state *st = d->priv; |
177 | if ((d->fe = dib3000mc_attach(&demod_cfg,&d->i2c_adap,&st->ops)) != NULL) { | 237 | st->ops.pid_parse = dib3000mc_pid_parse; |
178 | d->fe->ops.tuner_ops.init = dvb_usb_tuner_init_i2c; | 238 | st->ops.pid_ctrl = dib3000mc_pid_control; |
179 | d->fe->ops.tuner_ops.set_params = dvb_usb_tuner_set_params_i2c; | ||
180 | d->tuner_pass_ctrl = st->ops.tuner_pass_ctrl; | ||
181 | return 0; | ||
182 | } | 239 | } |
183 | 240 | return 0; | |
241 | } | ||
184 | return -ENODEV; | 242 | return -ENODEV; |
185 | } | 243 | } |
186 | EXPORT_SYMBOL(dibusb_dib3000mc_frontend_attach); | 244 | EXPORT_SYMBOL(dibusb_dib3000mc_frontend_attach); |
187 | 245 | ||
246 | static struct mt2060_config stk3000p_mt2060_config = { | ||
247 | 0x60 | ||
248 | }; | ||
249 | |||
188 | int dibusb_dib3000mc_tuner_attach (struct dvb_usb_device *d) | 250 | int dibusb_dib3000mc_tuner_attach (struct dvb_usb_device *d) |
189 | { | 251 | { |
190 | d->pll_addr = 0x60; | 252 | struct dibusb_state *st = d->priv; |
191 | d->pll_desc = &dvb_pll_env57h1xd5; | 253 | int ret; |
192 | 254 | u8 a,b; | |
193 | d->fe->ops.tuner_ops.init = dvb_usb_tuner_init_i2c; | 255 | u16 if1 = 1220; |
194 | d->fe->ops.tuner_ops.set_params = dvb_usb_tuner_set_params_i2c; | 256 | struct i2c_adapter *tun_i2c; |
257 | |||
258 | // First IF calibration for Liteon Sticks | ||
259 | if (d->udev->descriptor.idVendor == USB_VID_LITEON && | ||
260 | d->udev->descriptor.idProduct == USB_PID_LITEON_DVB_T_WARM) { | ||
261 | |||
262 | dibusb_read_eeprom_byte(d,0x7E,&a); | ||
263 | dibusb_read_eeprom_byte(d,0x7F,&b); | ||
264 | |||
265 | if (a == 0x00) | ||
266 | if1 += b; | ||
267 | else if (a == 0x80) | ||
268 | if1 -= b; | ||
269 | else | ||
270 | warn("LITE-ON DVB-T: Strange IF1 calibration :%2X %2X\n", a, b); | ||
271 | |||
272 | } else if (d->udev->descriptor.idVendor == USB_VID_DIBCOM && | ||
273 | d->udev->descriptor.idProduct == USB_PID_DIBCOM_MOD3001_WARM) { | ||
274 | u8 desc; | ||
275 | dibusb_read_eeprom_byte(d, 7, &desc); | ||
276 | if (desc == 2) { | ||
277 | a = 127; | ||
278 | do { | ||
279 | dibusb_read_eeprom_byte(d, a, &desc); | ||
280 | a--; | ||
281 | } while (a > 7 && (desc == 0xff || desc == 0x00)); | ||
282 | if (desc & 0x80) | ||
283 | if1 -= (0xff - desc); | ||
284 | else | ||
285 | if1 += desc; | ||
286 | } | ||
287 | } | ||
195 | 288 | ||
289 | tun_i2c = dib3000mc_get_tuner_i2c_master(d->fe, 1); | ||
290 | if ((ret = mt2060_attach(d->fe, tun_i2c, &stk3000p_mt2060_config, if1)) != 0) { | ||
291 | /* not found - use panasonic pll parameters */ | ||
292 | if (dvb_pll_attach(d->fe, 0x60, tun_i2c, &dvb_pll_env57h1xd5) == NULL) | ||
293 | return -ENOMEM; | ||
294 | } else { | ||
295 | st->mt2060_present = 1; | ||
296 | /* set the correct parameters for the dib3000p */ | ||
297 | dib3000mc_set_config(d->fe, &stk3000p_dib3000p_config); | ||
298 | } | ||
196 | return 0; | 299 | return 0; |
197 | } | 300 | } |
198 | EXPORT_SYMBOL(dibusb_dib3000mc_tuner_attach); | 301 | EXPORT_SYMBOL(dibusb_dib3000mc_tuner_attach); |
@@ -267,6 +370,67 @@ struct dvb_usb_rc_key dibusb_rc_keys[] = { | |||
267 | { 0x86, 0x1e, KEY_DOWN }, | 370 | { 0x86, 0x1e, KEY_DOWN }, |
268 | { 0x86, 0x1f, KEY_LEFT }, | 371 | { 0x86, 0x1f, KEY_LEFT }, |
269 | { 0x86, 0x1b, KEY_RIGHT }, | 372 | { 0x86, 0x1b, KEY_RIGHT }, |
373 | |||
374 | /* Key codes for the DiBcom MOD3000 remote. */ | ||
375 | { 0x80, 0x00, KEY_MUTE }, | ||
376 | { 0x80, 0x01, KEY_TEXT }, | ||
377 | { 0x80, 0x02, KEY_HOME }, | ||
378 | { 0x80, 0x03, KEY_POWER }, | ||
379 | |||
380 | { 0x80, 0x04, KEY_RED }, | ||
381 | { 0x80, 0x05, KEY_GREEN }, | ||
382 | { 0x80, 0x06, KEY_YELLOW }, | ||
383 | { 0x80, 0x07, KEY_BLUE }, | ||
384 | |||
385 | { 0x80, 0x08, KEY_DVD }, | ||
386 | { 0x80, 0x09, KEY_AUDIO }, | ||
387 | { 0x80, 0x0a, KEY_MEDIA }, /* Pictures */ | ||
388 | { 0x80, 0x0b, KEY_VIDEO }, | ||
389 | |||
390 | { 0x80, 0x0c, KEY_BACK }, | ||
391 | { 0x80, 0x0d, KEY_UP }, | ||
392 | { 0x80, 0x0e, KEY_RADIO }, | ||
393 | { 0x80, 0x0f, KEY_EPG }, | ||
394 | |||
395 | { 0x80, 0x10, KEY_LEFT }, | ||
396 | { 0x80, 0x11, KEY_OK }, | ||
397 | { 0x80, 0x12, KEY_RIGHT }, | ||
398 | { 0x80, 0x13, KEY_UNKNOWN }, /* SAP */ | ||
399 | |||
400 | { 0x80, 0x14, KEY_TV }, | ||
401 | { 0x80, 0x15, KEY_DOWN }, | ||
402 | { 0x80, 0x16, KEY_MENU }, /* DVD Menu */ | ||
403 | { 0x80, 0x17, KEY_LAST }, | ||
404 | |||
405 | { 0x80, 0x18, KEY_RECORD }, | ||
406 | { 0x80, 0x19, KEY_STOP }, | ||
407 | { 0x80, 0x1a, KEY_PAUSE }, | ||
408 | { 0x80, 0x1b, KEY_PLAY }, | ||
409 | |||
410 | { 0x80, 0x1c, KEY_PREVIOUS }, | ||
411 | { 0x80, 0x1d, KEY_REWIND }, | ||
412 | { 0x80, 0x1e, KEY_FASTFORWARD }, | ||
413 | { 0x80, 0x1f, KEY_NEXT}, | ||
414 | |||
415 | { 0x80, 0x40, KEY_1 }, | ||
416 | { 0x80, 0x41, KEY_2 }, | ||
417 | { 0x80, 0x42, KEY_3 }, | ||
418 | { 0x80, 0x43, KEY_CHANNELUP }, | ||
419 | |||
420 | { 0x80, 0x44, KEY_4 }, | ||
421 | { 0x80, 0x45, KEY_5 }, | ||
422 | { 0x80, 0x46, KEY_6 }, | ||
423 | { 0x80, 0x47, KEY_CHANNELDOWN }, | ||
424 | |||
425 | { 0x80, 0x48, KEY_7 }, | ||
426 | { 0x80, 0x49, KEY_8 }, | ||
427 | { 0x80, 0x4a, KEY_9 }, | ||
428 | { 0x80, 0x4b, KEY_VOLUMEUP }, | ||
429 | |||
430 | { 0x80, 0x4c, KEY_CLEAR }, | ||
431 | { 0x80, 0x4d, KEY_0 }, | ||
432 | { 0x80, 0x4e, KEY_ENTER }, | ||
433 | { 0x80, 0x4f, KEY_VOLUMEDOWN }, | ||
270 | }; | 434 | }; |
271 | EXPORT_SYMBOL(dibusb_rc_keys); | 435 | EXPORT_SYMBOL(dibusb_rc_keys); |
272 | 436 | ||