aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@redhat.com>2009-01-12 19:50:52 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2009-01-29 05:35:39 -0500
commit8866f9cf8d85f3614855a49b9d9056f265d0cd33 (patch)
treec855dbd6ae345a05cdffb4f974d3161aaa122bc4 /drivers/media
parentfc96ab730268b8b652ae2494088e8bd4572f58aa (diff)
V4L/DVB (10228): em28xx: fix audio output PCM IN selection
Some em28xx devices use the PCM IN AC 97 PIN for digital audio. However, currently, the PCM IN selection is not set by the driver. This patch allows specifying the PCM IN expected output, via board description table. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/video/em28xx/em28xx-core.c9
-rw-r--r--drivers/media/video/em28xx/em28xx.h19
2 files changed, 28 insertions, 0 deletions
diff --git a/drivers/media/video/em28xx/em28xx-core.c b/drivers/media/video/em28xx/em28xx-core.c
index eb5fb05fab22..69ce78867a49 100644
--- a/drivers/media/video/em28xx/em28xx-core.c
+++ b/drivers/media/video/em28xx/em28xx-core.c
@@ -454,6 +454,15 @@ int em28xx_audio_analog_set(struct em28xx *dev)
454 em28xx_warn("couldn't setup AC97 register %d\n", 454 em28xx_warn("couldn't setup AC97 register %d\n",
455 outputs[i].reg); 455 outputs[i].reg);
456 } 456 }
457
458 if (dev->ctl_aoutput & EM28XX_AOUT_PCM_IN) {
459 int sel = ac97_return_record_select(dev->ctl_aoutput);
460
461 /* Use the same input for both left and right channels */
462 sel |= (sel << 8);
463
464 em28xx_write_ac97(dev, AC97_RECORD_SELECT, sel);
465 }
457 } 466 }
458 467
459 return ret; 468 return ret;
diff --git a/drivers/media/video/em28xx/em28xx.h b/drivers/media/video/em28xx/em28xx.h
index 6c6b94aa05b2..23d1482df2d1 100644
--- a/drivers/media/video/em28xx/em28xx.h
+++ b/drivers/media/video/em28xx/em28xx.h
@@ -300,13 +300,32 @@ enum em28xx_amux {
300}; 300};
301 301
302enum em28xx_aout { 302enum em28xx_aout {
303 /* AC97 outputs */
303 EM28XX_AOUT_MASTER = 1 << 0, 304 EM28XX_AOUT_MASTER = 1 << 0,
304 EM28XX_AOUT_LINE = 1 << 1, 305 EM28XX_AOUT_LINE = 1 << 1,
305 EM28XX_AOUT_MONO = 1 << 2, 306 EM28XX_AOUT_MONO = 1 << 2,
306 EM28XX_AOUT_LFE = 1 << 3, 307 EM28XX_AOUT_LFE = 1 << 3,
307 EM28XX_AOUT_SURR = 1 << 4, 308 EM28XX_AOUT_SURR = 1 << 4,
309
310 /* PCM IN Mixer - used by AC97_RECORD_SELECT register */
311 EM28XX_AOUT_PCM_IN = 1 << 7,
312
313 /* Bits 10-8 are used to indicate the PCM IN record select */
314 EM28XX_AOUT_PCM_MIC_PCM = 0 << 8,
315 EM28XX_AOUT_PCM_CD = 1 << 8,
316 EM28XX_AOUT_PCM_VIDEO = 2 << 8,
317 EM28XX_AOUT_PCM_AUX = 3 << 8,
318 EM28XX_AOUT_PCM_LINE = 4 << 8,
319 EM28XX_AOUT_PCM_STEREO = 5 << 8,
320 EM28XX_AOUT_PCM_MONO = 6 << 8,
321 EM28XX_AOUT_PCM_PHONE = 7 << 8,
308}; 322};
309 323
324static int ac97_return_record_select(int a_out)
325{
326 return (a_out & 0x700) >> 8;
327}
328
310struct em28xx_reg_seq { 329struct em28xx_reg_seq {
311 int reg; 330 int reg;
312 unsigned char val, mask; 331 unsigned char val, mask;