aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb/ttpci/av7110_v4l.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/dvb/ttpci/av7110_v4l.c')
-rw-r--r--drivers/media/dvb/ttpci/av7110_v4l.c50
1 files changed, 40 insertions, 10 deletions
diff --git a/drivers/media/dvb/ttpci/av7110_v4l.c b/drivers/media/dvb/ttpci/av7110_v4l.c
index 603a22e4bfe2..64055461559d 100644
--- a/drivers/media/dvb/ttpci/av7110_v4l.c
+++ b/drivers/media/dvb/ttpci/av7110_v4l.c
@@ -42,7 +42,18 @@
42int msp_writereg(struct av7110 *av7110, u8 dev, u16 reg, u16 val) 42int msp_writereg(struct av7110 *av7110, u8 dev, u16 reg, u16 val)
43{ 43{
44 u8 msg[5] = { dev, reg >> 8, reg & 0xff, val >> 8 , val & 0xff }; 44 u8 msg[5] = { dev, reg >> 8, reg & 0xff, val >> 8 , val & 0xff };
45 struct i2c_msg msgs = { .flags = 0, .addr = 0x40, .len = 5, .buf = msg }; 45 struct i2c_msg msgs = { .flags = 0, .len = 5, .buf = msg };
46
47 switch (av7110->adac_type) {
48 case DVB_ADAC_MSP34x0:
49 msgs.addr = 0x40;
50 break;
51 case DVB_ADAC_MSP34x5:
52 msgs.addr = 0x42;
53 break;
54 default:
55 return 0;
56 }
46 57
47 if (i2c_transfer(&av7110->i2c_adap, &msgs, 1) != 1) { 58 if (i2c_transfer(&av7110->i2c_adap, &msgs, 1) != 1) {
48 dprintk(1, "dvb-ttpci: failed @ card %d, %u = %u\n", 59 dprintk(1, "dvb-ttpci: failed @ card %d, %u = %u\n",
@@ -57,10 +68,23 @@ static int msp_readreg(struct av7110 *av7110, u8 dev, u16 reg, u16 *val)
57 u8 msg1[3] = { dev, reg >> 8, reg & 0xff }; 68 u8 msg1[3] = { dev, reg >> 8, reg & 0xff };
58 u8 msg2[2]; 69 u8 msg2[2];
59 struct i2c_msg msgs[2] = { 70 struct i2c_msg msgs[2] = {
60 { .flags = 0, .addr = 0x40, .len = 3, .buf = msg1 }, 71 { .flags = 0 , .len = 3, .buf = msg1 },
61 { .flags = I2C_M_RD, .addr = 0x40, .len = 2, .buf = msg2 } 72 { .flags = I2C_M_RD, .len = 2, .buf = msg2 }
62 }; 73 };
63 74
75 switch (av7110->adac_type) {
76 case DVB_ADAC_MSP34x0:
77 msgs[0].addr = 0x40;
78 msgs[1].addr = 0x40;
79 break;
80 case DVB_ADAC_MSP34x5:
81 msgs[0].addr = 0x42;
82 msgs[1].addr = 0x42;
83 break;
84 default:
85 return 0;
86 }
87
64 if (i2c_transfer(&av7110->i2c_adap, &msgs[0], 2) != 2) { 88 if (i2c_transfer(&av7110->i2c_adap, &msgs[0], 2) != 2) {
65 dprintk(1, "dvb-ttpci: failed @ card %d, %u\n", 89 dprintk(1, "dvb-ttpci: failed @ card %d, %u\n",
66 av7110->dvb_adapter.num, reg); 90 av7110->dvb_adapter.num, reg);
@@ -678,17 +702,23 @@ int av7110_init_analog_module(struct av7110 *av7110)
678{ 702{
679 u16 version1, version2; 703 u16 version1, version2;
680 704
681 if (i2c_writereg(av7110, 0x80, 0x0, 0x80) != 1 705 if (i2c_writereg(av7110, 0x80, 0x0, 0x80) == 1 &&
682 || i2c_writereg(av7110, 0x80, 0x0, 0) != 1) 706 i2c_writereg(av7110, 0x80, 0x0, 0) == 1) {
707 printk("dvb-ttpci: DVB-C analog module @ card %d detected, initializing MSP3400\n",
708 av7110->dvb_adapter.num);
709 av7110->adac_type = DVB_ADAC_MSP34x0;
710 } else if (i2c_writereg(av7110, 0x84, 0x0, 0x80) == 1 &&
711 i2c_writereg(av7110, 0x84, 0x0, 0) == 1) {
712 printk("dvb-ttpci: DVB-C analog module @ card %d detected, initializing MSP3415\n",
713 av7110->dvb_adapter.num);
714 av7110->adac_type = DVB_ADAC_MSP34x5;
715 } else
683 return -ENODEV; 716 return -ENODEV;
684 717
685 printk("dvb-ttpci: DVB-C analog module @ card %d detected, initializing MSP3400\n",
686 av7110->dvb_adapter.num);
687 av7110->adac_type = DVB_ADAC_MSP34x0;
688 msleep(100); // the probing above resets the msp... 718 msleep(100); // the probing above resets the msp...
689 msp_readreg(av7110, MSP_RD_DSP, 0x001e, &version1); 719 msp_readreg(av7110, MSP_RD_DSP, 0x001e, &version1);
690 msp_readreg(av7110, MSP_RD_DSP, 0x001f, &version2); 720 msp_readreg(av7110, MSP_RD_DSP, 0x001f, &version2);
691 dprintk(1, "dvb-ttpci: @ card %d MSP3400 version 0x%04x 0x%04x\n", 721 dprintk(1, "dvb-ttpci: @ card %d MSP34xx version 0x%04x 0x%04x\n",
692 av7110->dvb_adapter.num, version1, version2); 722 av7110->dvb_adapter.num, version1, version2);
693 msp_writereg(av7110, MSP_WR_DSP, 0x0013, 0x0c00); 723 msp_writereg(av7110, MSP_WR_DSP, 0x0013, 0x0c00);
694 msp_writereg(av7110, MSP_WR_DSP, 0x0000, 0x7f00); // loudspeaker + headphone 724 msp_writereg(av7110, MSP_WR_DSP, 0x0000, 0x7f00); // loudspeaker + headphone
@@ -697,7 +727,7 @@ int av7110_init_analog_module(struct av7110 *av7110)
697 msp_writereg(av7110, MSP_WR_DSP, 0x0004, 0x7f00); // loudspeaker volume 727 msp_writereg(av7110, MSP_WR_DSP, 0x0004, 0x7f00); // loudspeaker volume
698 msp_writereg(av7110, MSP_WR_DSP, 0x000a, 0x0220); // SCART 1 source 728 msp_writereg(av7110, MSP_WR_DSP, 0x000a, 0x0220); // SCART 1 source
699 msp_writereg(av7110, MSP_WR_DSP, 0x0007, 0x7f00); // SCART 1 volume 729 msp_writereg(av7110, MSP_WR_DSP, 0x0007, 0x7f00); // SCART 1 volume
700 msp_writereg(av7110, MSP_WR_DSP, 0x000d, 0x4800); // prescale SCART 730 msp_writereg(av7110, MSP_WR_DSP, 0x000d, 0x1900); // prescale SCART
701 731
702 if (i2c_writereg(av7110, 0x48, 0x01, 0x00)!=1) { 732 if (i2c_writereg(av7110, 0x48, 0x01, 0x00)!=1) {
703 INFO(("saa7113 not accessible.\n")); 733 INFO(("saa7113 not accessible.\n"));