summaryrefslogtreecommitdiffstats
path: root/drivers/media/video/em28xx/em28xx-core.c
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@redhat.com>2008-11-20 13:39:39 -0300
committerMauro Carvalho Chehab <mchehab@redhat.com>2008-12-29 17:53:37 -0200
commite879b8ebb000298f8124fc8fae570afc9eb37cbb (patch)
treebab36de8b6415335809fe01350423e97c541b48e /drivers/media/video/em28xx/em28xx-core.c
parent209acc02249d831e7f2e3d8083b6b562dde5fc6f (diff)
downloadop-kernel-dev-e879b8ebb000298f8124fc8fae570afc9eb37cbb.zip
op-kernel-dev-e879b8ebb000298f8124fc8fae570afc9eb37cbb.tar.gz
V4L/DVB (9672): Allow opening more than one output at the same time
Some devices use more than one AC97 outputs. This patch allows such devices to properly work. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/em28xx/em28xx-core.c')
-rw-r--r--drivers/media/video/em28xx/em28xx-core.c33
1 files changed, 20 insertions, 13 deletions
diff --git a/drivers/media/video/em28xx/em28xx-core.c b/drivers/media/video/em28xx/em28xx-core.c
index cb60864..413428a 100644
--- a/drivers/media/video/em28xx/em28xx-core.c
+++ b/drivers/media/video/em28xx/em28xx-core.c
@@ -304,12 +304,12 @@ static int em28xx_write_ac97(struct em28xx *dev, u8 reg, u16 val)
return 0;
}
-struct em28xx_input_table {
- enum em28xx_amux amux;
+struct em28xx_vol_table {
+ enum em28xx_amux mux;
u8 reg;
};
-static struct em28xx_input_table inputs[] = {
+static struct em28xx_vol_table inputs[] = {
{ EM28XX_AMUX_VIDEO, AC97_VIDEO_VOL },
{ EM28XX_AMUX_LINE_IN, AC97_LINEIN_VOL },
{ EM28XX_AMUX_PHONE, AC97_PHONE_VOL },
@@ -332,7 +332,7 @@ static int set_ac97_input(struct em28xx *dev)
/* Mute all entres but the one that were selected */
for (i = 0; i < ARRAY_SIZE(inputs); i++) {
- if (amux == inputs[i].amux)
+ if (amux == inputs[i].mux)
ret = em28xx_write_ac97(dev, inputs[i].reg, 0x0808);
else
ret = em28xx_write_ac97(dev, inputs[i].reg, 0x8000);
@@ -388,12 +388,12 @@ static int em28xx_set_audio_source(struct em28xx *dev)
return ret;
}
-static int outputs[] = {
- [EM28XX_AOUT_MASTER] = AC97_MASTER_VOL,
- [EM28XX_AOUT_LINE] = AC97_LINE_LEVEL_VOL,
- [EM28XX_AOUT_MONO] = AC97_MASTER_MONO_VOL,
- [EM28XX_AOUT_LFE] = AC97_LFE_MASTER_VOL,
- [EM28XX_AOUT_SURR] = AC97_SURR_MASTER_VOL,
+struct em28xx_vol_table outputs[] = {
+ { EM28XX_AOUT_MASTER, AC97_MASTER_VOL },
+ { EM28XX_AOUT_LINE, AC97_LINE_LEVEL_VOL },
+ { EM28XX_AOUT_MONO, AC97_MASTER_MONO_VOL },
+ { EM28XX_AOUT_LFE, AC97_LFE_MASTER_VOL },
+ { EM28XX_AOUT_SURR, AC97_SURR_MASTER_VOL },
};
int em28xx_audio_analog_set(struct em28xx *dev)
@@ -410,10 +410,10 @@ int em28xx_audio_analog_set(struct em28xx *dev)
if (dev->audio_mode.ac97 != EM28XX_NO_AC97) {
/* Mute all outputs */
for (i = 0; i < ARRAY_SIZE(outputs); i++) {
- ret = em28xx_write_ac97(dev, outputs[i], 0x8000);
+ ret = em28xx_write_ac97(dev, outputs[i].reg, 0x8000);
if (ret < 0)
em28xx_warn("couldn't setup AC97 register %d\n",
- outputs[i]);
+ outputs[i].reg);
}
}
@@ -443,7 +443,14 @@ int em28xx_audio_analog_set(struct em28xx *dev)
vol |= 0x8000;
/* Sets volume */
- ret = em28xx_write_ac97(dev, outputs[dev->ctl_aoutput], vol);
+ for (i = 0; i < ARRAY_SIZE(outputs); i++) {
+ if (dev->ctl_aoutput & outputs[i].mux)
+ ret = em28xx_write_ac97(dev, outputs[i].reg,
+ vol);
+ if (ret < 0)
+ em28xx_warn("couldn't setup AC97 register %d\n",
+ outputs[i].reg);
+ }
}
return ret;
OpenPOWER on IntegriCloud