diff options
-rw-r--r-- | linux/drivers/media/dvb/ttpci/av7110.c | 110 | ||||
-rw-r--r-- | linux/drivers/media/dvb/ttpci/av7110.h | 1 | ||||
-rw-r--r-- | linux/drivers/media/dvb/ttpci/av7110_av.c | 5 |
3 files changed, 68 insertions, 48 deletions
diff --git a/linux/drivers/media/dvb/ttpci/av7110.c b/linux/drivers/media/dvb/ttpci/av7110.c index fbb8578ee..3a2d1d23a 100644 --- a/linux/drivers/media/dvb/ttpci/av7110.c +++ b/linux/drivers/media/dvb/ttpci/av7110.c @@ -82,8 +82,63 @@ static int adac = DVB_ADAC_TI; static int hw_sections = 0; static int rgb_on = 0; +/* initial volume */ +static int volume = 255; + int av7110_num = 0; +static void init_av7110_av(struct av7110 *av7110) +{ + struct saa7146_dev *dev=av7110->dev; + + /* set internal volume control to maximum */ + av7110->adac_type = DVB_ADAC_TI; + av7110_set_volume(av7110, av7110->mixer.volume_left, av7110->mixer.volume_right); + + av7710_set_video_mode(av7110, vidmode); + + /* handle different card types */ + /* remaining inits according to card and frontend type */ + av7110->has_analog_tuner = 0; + av7110->current_input = 0; + if (i2c_writereg(av7110, 0x20, 0x00, 0x00) == 1) { + printk ("av7110(%d): Crystal audio DAC detected\n", + av7110->dvb_adapter->num); + av7110->adac_type = DVB_ADAC_CRYSTAL; + i2c_writereg(av7110, 0x20, 0x01, 0xd2); + i2c_writereg(av7110, 0x20, 0x02, 0x49); + i2c_writereg(av7110, 0x20, 0x03, 0x00); + i2c_writereg(av7110, 0x20, 0x04, 0x00); + + /** + * some special handling for the Siemens DVB-C cards... + */ + } else if (0 == av7110_init_analog_module(av7110)) { + /* done. */ + } + else if (dev->pci->subsystem_vendor == 0x110a) { + printk("av7110(%d): DVB-C w/o analog module detected\n", + av7110->dvb_adapter->num); + av7110->adac_type = DVB_ADAC_NONE; + } + else { + av7110->adac_type = adac; + printk("av7110(%d): adac type set to %d\n", + av7110->dvb_adapter->num, av7110->adac_type); + } + + if (av7110->adac_type == DVB_ADAC_NONE || av7110->adac_type == DVB_ADAC_MSP) { + // switch DVB SCART on + av7110_fw_cmd(av7110, COMTYPE_AUDIODAC, MainSwitch, 1, 0); + av7110_fw_cmd(av7110, COMTYPE_AUDIODAC, ADSwitch, 1, 1); + if (rgb_on) + saa7146_setgpio(dev, 1, SAA7146_GPIO_OUTHI); // RGB on, SCART pin 16 + //saa7146_setgpio(dev, 3, SAA7146_GPIO_OUTLO); // SCARTpin 8 + } + + av7110_set_volume(av7110, av7110->mixer.volume_left, av7110->mixer.volume_right); + av7110_setup_irc_config(av7110, 0); +} static void recover_arm(struct av7110 *av7110) { @@ -107,6 +162,7 @@ static void arm_error(struct av7110 *av7110) static int arm_thread(void *data) { struct av7110 *av7110 = data; + unsigned long timeout; u16 newloops = 0; @@ -138,6 +194,8 @@ static int arm_thread(void *data) arm_error(av7110); av7710_set_video_mode(av7110, vidmode); + init_av7110_av(av7110); + if (down_interruptible(&av7110->dcomlock)) break; @@ -1497,54 +1555,12 @@ static int av7110_attach(struct saa7146_dev* dev, struct saa7146_pci_extension_d goto err2; } - /* set internal volume control to maximum */ - av7110->adac_type = DVB_ADAC_TI; - av7110_set_volume(av7110, 0xff, 0xff); - - av7710_set_video_mode(av7110, vidmode); + /* set initial volume in mixer struct */ + av7110->mixer.volume_left = volume; + av7110->mixer.volume_right = volume; - /* handle different card types */ - /* remaining inits according to card and frontend type */ - av7110->has_analog_tuner = 0; - av7110->current_input = 0; - if (i2c_writereg(av7110, 0x20, 0x00, 0x00) == 1) { - printk ("av7110(%d): Crystal audio DAC detected\n", - av7110->dvb_adapter->num); - av7110->adac_type = DVB_ADAC_CRYSTAL; - i2c_writereg(av7110, 0x20, 0x01, 0xd2); - i2c_writereg(av7110, 0x20, 0x02, 0x49); - i2c_writereg(av7110, 0x20, 0x03, 0x00); - i2c_writereg(av7110, 0x20, 0x04, 0x00); + init_av7110_av(av7110); - /** - * some special handling for the Siemens DVB-C cards... - */ - } else if (0 == av7110_init_analog_module(av7110)) { - /* done. */ - } - else if (dev->pci->subsystem_vendor == 0x110a) { - printk("av7110(%d): DVB-C w/o analog module detected\n", - av7110->dvb_adapter->num); - av7110->adac_type = DVB_ADAC_NONE; - } - else { - av7110->adac_type = adac; - printk("av7110(%d): adac type set to %d\n", - av7110->dvb_adapter->num, av7110->adac_type); - } - - if (av7110->adac_type == DVB_ADAC_NONE || av7110->adac_type == DVB_ADAC_MSP) { - // switch DVB SCART on - av7110_fw_cmd(av7110, COMTYPE_AUDIODAC, MainSwitch, 1, 0); - av7110_fw_cmd(av7110, COMTYPE_AUDIODAC, ADSwitch, 1, 1); - if (rgb_on) - saa7146_setgpio(dev, 1, SAA7146_GPIO_OUTHI); // RGB on, SCART pin 16 - //saa7146_setgpio(dev, 3, SAA7146_GPIO_OUTLO); // SCARTpin 8 - } - - av7110_set_volume(av7110, 0xff, 0xff); - - av7110_setup_irc_config(av7110, 0); av7110_register(av7110); /* special case DVB-C: these cards have an analog tuner @@ -1754,3 +1770,5 @@ MODULE_PARM_DESC(hw_sections, "0 use software section filter, 1 use hardware"); MODULE_PARM(rgb_on, "i"); MODULE_PARM_DESC(rgb_on, "For Siemens DVB-C cards only: Enable RGB control" " signal on SCART pin 16 to switch SCART video mode from CVBS to RGB"); +MODULE_PARM(volume, "i"); +MODULE_PARM_DESC(volume, "initial volume: default 255 (range 0-255)"); diff --git a/linux/drivers/media/dvb/ttpci/av7110.h b/linux/drivers/media/dvb/ttpci/av7110.h index c0875cb69..013af1982 100644 --- a/linux/drivers/media/dvb/ttpci/av7110.h +++ b/linux/drivers/media/dvb/ttpci/av7110.h @@ -190,6 +190,7 @@ struct av7110 { struct dvb_ringbuffer ci_rbuffer; struct dvb_ringbuffer ci_wbuffer; + struct audio_mixer mixer; struct dvb_adapter *dvb_adapter; struct dvb_device *video_dev; diff --git a/linux/drivers/media/dvb/ttpci/av7110_av.c b/linux/drivers/media/dvb/ttpci/av7110_av.c index 054e2e90d..bb663a66e 100644 --- a/linux/drivers/media/dvb/ttpci/av7110_av.c +++ b/linux/drivers/media/dvb/ttpci/av7110_av.c @@ -93,7 +93,6 @@ extern int av7110_debug; #define PIECE_RATE 0x40 #define SEAM_SPLICE 0x20 - static void p_to_t(u8 const *buf, long int length, u16 pid, u8 *counter, struct dvb_demux_feed *feed); @@ -285,13 +284,15 @@ int av7110_pes_play(void *dest, struct dvb_ringbuffer *buf, int dlen) return blen; } - int av7110_set_volume(struct av7110 *av7110, int volleft, int volright) { int err, vol, val, balance = 0; DEB_EE(("av7110: %p\n", av7110)); + av7110->mixer.volume_left = volleft; + av7110->mixer.volume_left = volright; + switch (av7110->adac_type) { case DVB_ADAC_TI: volleft = (volleft * 256) / 1036; |