diff options
-rw-r--r-- | linux/drivers/media/dvb/av7110/av7110.c | 41 | ||||
-rw-r--r-- | linux/include/linux/dvb/audio.h | 15 |
2 files changed, 33 insertions, 23 deletions
diff --git a/linux/drivers/media/dvb/av7110/av7110.c b/linux/drivers/media/dvb/av7110/av7110.c index 919721e13..d42704a3f 100644 --- a/linux/drivers/media/dvb/av7110/av7110.c +++ b/linux/drivers/media/dvb/av7110/av7110.c @@ -1554,29 +1554,38 @@ SendDAC(av7110_t *av7110, u8 addr, u8 data) static int SetVolume(av7110_t *av7110, int volleft, int volright) { - int err; + int err=0; + int chleft, chright; switch (av7110->adac_type) { case DVB_ADAC_TI: - volleft=(volleft*256)/946; - volright=(volright*256)/946; - if (volleft > 0x45) - volleft=0x45; - if (volright > 0x45) - volright=0x45; - err=SendDAC(av7110, 3, 0x80 + volleft); + chleft=(volleft*256)/946; + chright=(volright*256)/946; + if (chleft > 0x45) + chleft=0x45; + if (chright > 0x45) + chright=0x45; + err=SendDAC(av7110, 3, 0x80 + chleft); if (err) return err; - return SendDAC(av7110, 4, volright); + err=SendDAC(av7110, 4, chright); + break; case DVB_ADAC_CRYSTAL: - volleft=127-volleft/2; - volright=127-volright/2; - i2c_writereg(av7110, 0x20, 0x03, volleft); - i2c_writereg(av7110, 0x20, 0x04, volright); - return 0; + chleft=127-volleft/2; + chright=127-volright/2; + i2c_writereg(av7110, 0x20, 0x03, chleft); + i2c_writereg(av7110, 0x20, 0x04, chright); + + default: + err = -1; } - return 0; + + if(!err) { + av7110->audiostate.mixer_state.volume_left = volleft; + av7110->audiostate.mixer_state.volume_right = volright; + } + return err; } #ifdef CONFIG_DVB_AV7110_OSD @@ -4271,7 +4280,7 @@ dvb_audio_ioctl(struct inode *inode, struct file *file, { struct audio_mixer *amix=(struct audio_mixer *)parg; - SetVolume(av7110, amix->volume_left, amix->volume_right); + ret=SetVolume(av7110, amix->volume_left, amix->volume_right); break; } case AUDIO_SET_STREAMTYPE: diff --git a/linux/include/linux/dvb/audio.h b/linux/include/linux/dvb/audio.h index d0ce5e27b..a816be111 100644 --- a/linux/include/linux/dvb/audio.h +++ b/linux/include/linux/dvb/audio.h @@ -51,6 +51,13 @@ typedef enum { } audio_channel_select_t; +typedef struct audio_mixer { + unsigned int volume_left; + unsigned int volume_right; + // what else do we need? bass, pass-through, ... +} audio_mixer_t; + + typedef struct audio_status { int AV_sync_state; /* sync audio and video? */ int mute_state; /* audio is muted */ @@ -58,16 +65,10 @@ typedef struct audio_status { audio_stream_source_t stream_source; /* current stream source */ audio_channel_select_t channel_select; /* currently selected channel */ int bypass_mode; /* pass on audio data to */ + audio_mixer_t mixer_state; /* current mixer state */ } audio_status_t; /* separate decoder hardware */ -typedef struct audio_mixer { - unsigned int volume_left; - unsigned int volume_right; - // what else do we need? bass, pass-through, ... -} audio_mixer_t; - - typedef struct audio_karaoke{ /* if Vocal1 or Vocal2 are non-zero, they get mixed */ int vocal1; /* into left and right t at 70% each */ |