Lines Matching defs:av7110
2 * av7110_v4l.c: av7110 video4linux interface for DVB and Siemens DVB-C analog module
35 #include "av7110.h"
39 int msp_writereg(struct av7110 *av7110, u8 dev, u16 reg, u16 val)
44 switch (av7110->adac_type) {
55 if (i2c_transfer(&av7110->i2c_adap, &msgs, 1) != 1) {
57 av7110->dvb_adapter.num, reg, val);
63 static int msp_readreg(struct av7110 *av7110, u8 dev, u16 reg, u16 *val)
72 switch (av7110->adac_type) {
85 if (i2c_transfer(&av7110->i2c_adap, &msgs[0], 2) != 2) {
87 av7110->dvb_adapter.num, reg);
132 struct av7110 *av7110 = dev->ext_priv;
138 if (1 != i2c_transfer(&av7110->i2c_adap, &msg, 1))
145 struct av7110 *av7110 = dev->ext_priv;
150 if (1 != i2c_transfer(&av7110->i2c_adap, &msg, 1))
186 struct av7110 *av7110 = (struct av7110*)dev->ext_priv;
207 if (av7110->fe->ops.i2c_gate_ctrl)
208 av7110->fe->ops.i2c_gate_ctrl(av7110->fe, 1);
228 struct av7110 *av7110 = (struct av7110*)dev->ext_priv;
232 dprintk(4, "%p\n", av7110);
243 if (0 != av7110->current_input) {
250 switch (av7110->current_input) {
253 msp_writereg(av7110, MSP_WR_DSP, 0x0008, 0x0000); // loudspeaker source
254 msp_writereg(av7110, MSP_WR_DSP, 0x0009, 0x0000); // headphone source
255 msp_writereg(av7110, MSP_WR_DSP, 0x000a, 0x0000); // SCART 1 source
256 msp_writereg(av7110, MSP_WR_DSP, 0x000e, 0x3000); // FM matrix, mono
257 msp_writereg(av7110, MSP_WR_DSP, 0x0000, 0x4f00); // loudspeaker + headphone
258 msp_writereg(av7110, MSP_WR_DSP, 0x0007, 0x4f00); // SCART 1 volume
260 if (av7110->analog_tuner_flags & ANALOG_TUNER_VES1820) {
263 } else if (av7110->analog_tuner_flags & ANALOG_TUNER_STV0297) {
267 if (i2c_writereg(av7110, 0x48, 0x02, 0xd0) != 1)
268 dprintk(1, "saa7113 write failed @ card %d", av7110->dvb_adapter.num);
272 if (i2c_writereg(av7110, 0x48, 0x02, 0xd2) != 1)
273 dprintk(1, "saa7113 write failed @ card %d", av7110->dvb_adapter.num);
277 if (i2c_writereg(av7110, 0x48, 0x02, 0xd9) != 1)
278 dprintk(1, "saa7113 write failed @ card %d", av7110->dvb_adapter.num);
289 msp_writereg(av7110, MSP_WR_DSP, 0x0008, 0x0220); // loudspeaker source
290 msp_writereg(av7110, MSP_WR_DSP, 0x0009, 0x0220); // headphone source
291 msp_writereg(av7110, MSP_WR_DSP, 0x000a, 0x0220); // SCART 1 source
292 msp_writereg(av7110, MSP_WR_DSP, 0x000e, 0x3000); // FM matrix, mono
293 msp_writereg(av7110, MSP_WR_DSP, 0x0000, 0x7f00); // loudspeaker + headphone
294 msp_writereg(av7110, MSP_WR_DSP, 0x0007, 0x7f00); // SCART 1 volume
296 if (av7110->analog_tuner_flags & ANALOG_TUNER_VES1820) {
299 } else if (av7110->analog_tuner_flags & ANALOG_TUNER_STV0297) {
306 if (av7110_fw_cmd(av7110, COMTYPE_AUDIODAC, ADSwitch, 1, adswitch))
322 struct av7110 *av7110 = (struct av7110 *)dev->ext_priv;
328 if (!av7110->analog_tuner_flags || t->index != 0)
342 msp_readreg(av7110, MSP_RD_DEM, 0x007e, &stereo_det);
344 msp_readreg(av7110, MSP_RD_DSP, 0x0018, &stereo_det);
364 struct av7110 *av7110 = (struct av7110 *)dev->ext_priv;
368 if (!av7110->analog_tuner_flags || av7110->current_input != 1)
398 msp_writereg(av7110, MSP_WR_DSP, 0x000e, fm_matrix);
399 msp_writereg(av7110, MSP_WR_DSP, 0x0008, src);
400 msp_writereg(av7110, MSP_WR_DSP, 0x0009, src);
401 msp_writereg(av7110, MSP_WR_DSP, 0x000a, src);
408 struct av7110 *av7110 = (struct av7110 *)dev->ext_priv;
412 if (!av7110->analog_tuner_flags || av7110->current_input != 1)
417 f->frequency = av7110->current_freq;
424 struct av7110 *av7110 = (struct av7110 *)dev->ext_priv;
428 if (!av7110->analog_tuner_flags || av7110->current_input != 1)
434 msp_writereg(av7110, MSP_WR_DSP, 0x0000, 0xffe0); /* fast mute */
435 msp_writereg(av7110, MSP_WR_DSP, 0x0007, 0xffe0);
438 if (av7110->analog_tuner_flags & ANALOG_TUNER_VES1820)
440 else if (av7110->analog_tuner_flags & ANALOG_TUNER_STV0297)
442 av7110->current_freq = f->frequency;
444 msp_writereg(av7110, MSP_WR_DSP, 0x0015, 0x003f); /* start stereo detection */
445 msp_writereg(av7110, MSP_WR_DSP, 0x0015, 0x0000);
446 msp_writereg(av7110, MSP_WR_DSP, 0x0000, 0x4f00); /* loudspeaker + headphone */
447 msp_writereg(av7110, MSP_WR_DSP, 0x0007, 0x4f00); /* SCART 1 volume */
454 struct av7110 *av7110 = (struct av7110 *)dev->ext_priv;
458 if (av7110->analog_tuner_flags) {
474 struct av7110 *av7110 = (struct av7110 *)dev->ext_priv;
476 *input = av7110->current_input;
484 struct av7110 *av7110 = (struct av7110 *)dev->ext_priv;
488 if (!av7110->analog_tuner_flags)
494 av7110->current_input = input;
517 struct av7110 *av7110 = (struct av7110 *)dev->ext_priv;
522 if (FW_VERSION(av7110->arm_app) >= 0x2623) {
533 struct av7110 *av7110 = (struct av7110 *)dev->ext_priv;
536 if (FW_VERSION(av7110->arm_app) < 0x2623)
539 if (av7110->wssMode) {
551 struct av7110 *av7110 = (struct av7110 *)dev->ext_priv;
554 if (FW_VERSION(av7110->arm_app) < 0x2623)
560 av7110->wssMode = 0;
561 av7110->wssData = 0;
562 return av7110_fw_cmd(av7110, COMTYPE_ENCODER,
570 av7110->wssMode = 1;
571 av7110->wssData = 0;
580 struct av7110 *av7110 = (struct av7110*) dev->ext_priv;
583 av7110->wssMode = 0;
584 av7110->wssData = 0;
585 if (FW_VERSION(av7110->arm_app) < 0x2623)
588 return av7110_fw_cmd(av7110, COMTYPE_ENCODER, SetWSSConfig, 1, 0);
595 struct av7110 *av7110 = (struct av7110*) dev->ext_priv;
600 if (FW_VERSION(av7110->arm_app) < 0x2623 || !av7110->wssMode || count != sizeof d)
607 av7110->wssData = ((d.data[1] << 8) & 0x3f00) | d.data[0];
609 av7110->wssData = 0x8000;
610 rc = av7110_fw_cmd(av7110, COMTYPE_ENCODER, SetWSSConfig, 2, 1, av7110->wssData);
680 int av7110_init_analog_module(struct av7110 *av7110)
684 if (i2c_writereg(av7110, 0x80, 0x0, 0x80) == 1 &&
685 i2c_writereg(av7110, 0x80, 0x0, 0) == 1) {
687 av7110->dvb_adapter.num);
688 av7110->adac_type = DVB_ADAC_MSP34x0;
689 } else if (i2c_writereg(av7110, 0x84, 0x0, 0x80) == 1 &&
690 i2c_writereg(av7110, 0x84, 0x0, 0) == 1) {
692 av7110->dvb_adapter.num);
693 av7110->adac_type = DVB_ADAC_MSP34x5;
698 msp_readreg(av7110, MSP_RD_DSP, 0x001e, &version1);
699 msp_readreg(av7110, MSP_RD_DSP, 0x001f, &version2);
701 av7110->dvb_adapter.num, version1, version2);
702 msp_writereg(av7110, MSP_WR_DSP, 0x0013, 0x0c00);
703 msp_writereg(av7110, MSP_WR_DSP, 0x0000, 0x7f00); // loudspeaker + headphone
704 msp_writereg(av7110, MSP_WR_DSP, 0x0008, 0x0220); // loudspeaker source
705 msp_writereg(av7110, MSP_WR_DSP, 0x0009, 0x0220); // headphone source
706 msp_writereg(av7110, MSP_WR_DSP, 0x0004, 0x7f00); // loudspeaker volume
707 msp_writereg(av7110, MSP_WR_DSP, 0x000a, 0x0220); // SCART 1 source
708 msp_writereg(av7110, MSP_WR_DSP, 0x0007, 0x7f00); // SCART 1 volume
709 msp_writereg(av7110, MSP_WR_DSP, 0x000d, 0x1900); // prescale SCART
711 if (i2c_writereg(av7110, 0x48, 0x01, 0x00)!=1) {
716 if ((av7110->dev->pci->subsystem_vendor == 0x110a) && (av7110->dev->pci->subsystem_device == 0x0000)) {
718 av7110->analog_tuner_flags |= ANALOG_TUNER_VES1820;
719 } else if ((av7110->dev->pci->subsystem_vendor == 0x13c2) && (av7110->dev->pci->subsystem_device == 0x0002)) {
721 av7110->analog_tuner_flags |= ANALOG_TUNER_VES1820;
722 } else if ((av7110->dev->pci->subsystem_vendor == 0x13c2) && (av7110->dev->pci->subsystem_device == 0x000A)) {
724 av7110->analog_tuner_flags |= ANALOG_TUNER_STV0297;
728 if (av7110->analog_tuner_flags & ANALOG_TUNER_VES1820) {
729 if (ves1820_writereg(av7110->dev, 0x09, 0x0f, 0x20))
731 } else if (av7110->analog_tuner_flags & ANALOG_TUNER_STV0297) {
732 saa7146_setgpio(av7110->dev, 1, SAA7146_GPIO_OUTLO); // TDA9819 pin9(STD)
733 saa7146_setgpio(av7110->dev, 3, SAA7146_GPIO_OUTLO); // TDA9819 pin30(VIF)
738 if (i2c_writereg(av7110, 0x48, i[0], i[1]) != 1) {
739 dprintk(1, "saa7113 initialization failed @ card %d", av7110->dvb_adapter.num);
745 msp_writereg(av7110, MSP_WR_DEM, 0x00bb, 0x02d0); // AD_CV
746 msp_writereg(av7110, MSP_WR_DEM, 0x0001, 3); // FIR1
747 msp_writereg(av7110, MSP_WR_DEM, 0x0001, 18); // FIR1
748 msp_writereg(av7110, MSP_WR_DEM, 0x0001, 27); // FIR1
749 msp_writereg(av7110, MSP_WR_DEM, 0x0001, 48); // FIR1
750 msp_writereg(av7110, MSP_WR_DEM, 0x0001, 66); // FIR1
751 msp_writereg(av7110, MSP_WR_DEM, 0x0001, 72); // FIR1
752 msp_writereg(av7110, MSP_WR_DEM, 0x0005, 4); // FIR2
753 msp_writereg(av7110, MSP_WR_DEM, 0x0005, 64); // FIR2
754 msp_writereg(av7110, MSP_WR_DEM, 0x0005, 0); // FIR2
755 msp_writereg(av7110, MSP_WR_DEM, 0x0005, 3); // FIR2
756 msp_writereg(av7110, MSP_WR_DEM, 0x0005, 18); // FIR2
757 msp_writereg(av7110, MSP_WR_DEM, 0x0005, 27); // FIR2
758 msp_writereg(av7110, MSP_WR_DEM, 0x0005, 48); // FIR2
759 msp_writereg(av7110, MSP_WR_DEM, 0x0005, 66); // FIR2
760 msp_writereg(av7110, MSP_WR_DEM, 0x0005, 72); // FIR2
761 msp_writereg(av7110, MSP_WR_DEM, 0x0083, 0xa000); // MODE_REG
762 msp_writereg(av7110, MSP_WR_DEM, 0x0093, 0x00aa); // DCO1_LO 5.74MHz
763 msp_writereg(av7110, MSP_WR_DEM, 0x009b, 0x04fc); // DCO1_HI
764 msp_writereg(av7110, MSP_WR_DEM, 0x00a3, 0x038e); // DCO2_LO 5.5MHz
765 msp_writereg(av7110, MSP_WR_DEM, 0x00ab, 0x04c6); // DCO2_HI
766 msp_writereg(av7110, MSP_WR_DEM, 0x0056, 0); // LOAD_REG 1/2
771 saa7146_write(av7110->dev, DD1_STREAM_B, 0x00000000);
772 saa7146_write(av7110->dev, DD1_INIT, 0x03000700);
773 saa7146_write(av7110->dev, MC2, (MASK_09 | MASK_25 | MASK_10 | MASK_26));
778 int av7110_init_v4l(struct av7110 *av7110)
780 struct saa7146_dev* dev = av7110->dev;
787 if (av7110->analog_tuner_flags)
810 if (saa7146_register_device(&av7110->v4l_dev, dev, "av7110", VFL_TYPE_GRABBER)) {
815 if (saa7146_register_device(&av7110->vbi_dev, dev, "av7110", VFL_TYPE_VBI))
820 int av7110_exit_v4l(struct av7110 *av7110)
822 struct saa7146_dev* dev = av7110->dev;
824 saa7146_unregister_device(&av7110->v4l_dev, av7110->dev);
825 saa7146_unregister_device(&av7110->vbi_dev, av7110->dev);
878 struct av7110 *av7110 = (struct av7110*) dev->ext_priv;
881 av7110->vidmode = AV7110_VIDEO_MODE_PAL;
882 av7110_set_vidmode(av7110, av7110->vidmode);
885 av7110->vidmode = AV7110_VIDEO_MODE_NTSC;
886 av7110_set_vidmode(av7110, av7110->vidmode);