diff options
author | Holger Waechtler <devnull@localhost> | 2003-04-23 15:25:01 +0000 |
---|---|---|
committer | Holger Waechtler <devnull@localhost> | 2003-04-23 15:25:01 +0000 |
commit | 92be13865e5eb89bb701ca3fb43157592411d9f6 (patch) | |
tree | 47809d6a36bc55593fcb55e14c31c98328129691 /linux | |
parent | c53fd657862cff4bf5e1c92b68d9ff539b463743 (diff) | |
download | mediapointer-dvb-s2-92be13865e5eb89bb701ca3fb43157592411d9f6.tar.gz mediapointer-dvb-s2-92be13865e5eb89bb701ca3fb43157592411d9f6.tar.bz2 |
volume control patch for msp3400 by Tobias Bratfisch <tobias.dvb@bratfisch.net>
Diffstat (limited to 'linux')
-rw-r--r-- | linux/drivers/media/dvb/ttpci/av7110.c | 45 | ||||
-rw-r--r-- | linux/drivers/media/dvb/ttpci/av7110.h | 1 |
2 files changed, 29 insertions, 17 deletions
diff --git a/linux/drivers/media/dvb/ttpci/av7110.c b/linux/drivers/media/dvb/ttpci/av7110.c index 22391bd9f..9bd6febd2 100644 --- a/linux/drivers/media/dvb/ttpci/av7110.c +++ b/linux/drivers/media/dvb/ttpci/av7110.c @@ -1338,6 +1338,19 @@ RequestParameter(av7110_t *av7110, u16 tag, u16* Buff, s16 length) * Firmware commands ****************************************************************************/ +static inline int +msp_writereg(av7110_t *av7110, u8 dev, u16 reg, u16 val) +{ + u8 msg[5]={ dev, reg>>8, reg&0xff, val>>8 , val&0xff }; + struct dvb_i2c_bus *i2c = av7110->i2c_bus; + struct i2c_msg msgs; + + msgs.flags=0; + msgs.addr=0x40; + msgs.len=5; + msgs.buf=msg; + return i2c->xfer(i2c, &msgs, 1); +} inline static int SendDAC(av7110_t *av7110, u8 addr, u8 data) @@ -1350,7 +1363,7 @@ SendDAC(av7110_t *av7110, u8 addr, u8 data) static int SetVolume(av7110_t *av7110, int volleft, int volright) { - int err; + int err, vol, val, chleft, chright, balance = 0; DEB_EE(("av7110: %p\n",av7110)); @@ -1372,6 +1385,17 @@ SetVolume(av7110_t *av7110, int volleft, int volright) i2c_writereg(av7110, 0x20, 0x03, volleft); i2c_writereg(av7110, 0x20, 0x04, volright); return 0; + + case DVB_ADAC_MSP: + vol = (volleft > volright) ? volleft : volright; + val = (vol * 0x73 / 255) << 8; + if (vol > 0) { + balance = ((volright-volleft) * 127) / vol; + } + msp_writereg(av7110, 0x12, 0x0001, balance << 8); + msp_writereg(av7110, 0x12, 0x0000, val); /* loudspeaker */ + msp_writereg(av7110, 0x12, 0x0006, val); /* headphonesr */ + return 0; } return 0; } @@ -2188,20 +2212,6 @@ i2c_writereg(av7110_t *av7110, u8 id, u8 reg, u8 val) return i2c->xfer (i2c, &msgs, 1); } -static inline int -msp_writereg(av7110_t *av7110, u8 dev, u16 reg, u16 val) -{ - u8 msg[5]={ dev, reg>>8, reg&0xff, val>>8 , val&0xff }; - struct dvb_i2c_bus *i2c = av7110->i2c_bus; - struct i2c_msg msgs; - - msgs.flags=0; - msgs.addr=0x40; - msgs.len=5; - msgs.buf=msg; - return i2c->xfer(i2c, &msgs, 1); -} - static inline u8 i2c_readreg(av7110_t *av7110, u8 id, u8 reg) { @@ -4289,6 +4299,7 @@ int av7110_attach (struct saa7146_dev* dev, struct saa7146_pci_extension_data *p i2c_writereg(av7110, 0x80, 0x0, 0); printk ("av7110: DVB-C analog module detected, " "initializing MSP3400\n"); + av7110->adac_type = DVB_ADAC_MSP; ddelay(100); msp_writereg(av7110, 0x12, 0x0013, 0x0c00); msp_writereg(av7110, 0x12, 0x0000, 0x7f00); // loudspeaker + headphone @@ -4297,7 +4308,8 @@ int av7110_attach (struct saa7146_dev* dev, struct saa7146_pci_extension_data *p msp_writereg(av7110, 0x12, 0x000a, 0x0220); // SCART 1 source msp_writereg(av7110, 0x12, 0x0007, 0x7f00); // SCART 1 volume msp_writereg(av7110, 0x12, 0x000d, 0x4800); // prescale SCART - } + } else + av7110->adac_type = DVB_ADAC_NONE; // switch DVB SCART on @@ -4305,7 +4317,6 @@ int av7110_attach (struct saa7146_dev* dev, struct saa7146_pci_extension_data *p outcom(av7110, COMTYPE_AUDIODAC, ADSwitch, 1, 1); //saa7146_setgpio(dev, 1, SAA7146_GPIO_OUTHI); // RGB on, SCART pin 16 //saa7146_setgpio(dev, 3, SAA7146_GPIO_OUTLO); // SCARTpin 8 - av7110->adac_type = DVB_ADAC_NONE; } av7110_setup_irc_config (av7110, 0); diff --git a/linux/drivers/media/dvb/ttpci/av7110.h b/linux/drivers/media/dvb/ttpci/av7110.h index 0128ba102..73964fafa 100644 --- a/linux/drivers/media/dvb/ttpci/av7110.h +++ b/linux/drivers/media/dvb/ttpci/av7110.h @@ -480,6 +480,7 @@ typedef struct av7110_s { int adac_type; /* audio DAC type */ #define DVB_ADAC_TI 0 #define DVB_ADAC_CRYSTAL 1 +#define DVB_ADAC_MSP 2 #define DVB_ADAC_NONE -1 |