diff options
author | Steven Toth <stoth@kernellabs.com> | 2011-10-10 10:09:56 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2011-10-14 16:21:14 -0400 |
commit | fa1e0fd3718417ad1e1058172fafd8cc2f480618 (patch) | |
tree | 7396bb8d28846f8d2091d6ce42881d3507e09f1c /drivers/media/video/cx23885 | |
parent | fc1a889df78dea08e522310c9eb6110448dc61f0 (diff) |
[media] cx23885: hook the audio selection functions into the main driver
Ensure audio is established at driver start.
Ensure the correct defaults are established for the audio path if
the cards struct has nothing defined.
Allow the caller to select one of the two baseband input paths.
Signed-off-by: Steven Toth <stoth@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/cx23885')
-rw-r--r-- | drivers/media/video/cx23885/cx23885-video.c | 40 |
1 files changed, 25 insertions, 15 deletions
diff --git a/drivers/media/video/cx23885/cx23885-video.c b/drivers/media/video/cx23885/cx23885-video.c index 9726f2a0ef6c..396fa4e23acb 100644 --- a/drivers/media/video/cx23885/cx23885-video.c +++ b/drivers/media/video/cx23885/cx23885-video.c | |||
@@ -521,13 +521,22 @@ static int cx23885_audio_mux(struct cx23885_dev *dev, unsigned int input) | |||
521 | { | 521 | { |
522 | dprintk(1, "%s(input=%d)\n", __func__, input); | 522 | dprintk(1, "%s(input=%d)\n", __func__, input); |
523 | 523 | ||
524 | if ((dev->board == CX23885_BOARD_HAUPPAUGE_HVR1800) || | 524 | /* The baseband video core of the cx23885 has two audio inputs. |
525 | (dev->board == CX23885_BOARD_MPX885)) { | 525 | * LR1 and LR2. In almost every single case so far only HVR1xxx |
526 | 526 | * cards we've only ever supported LR1. Time to support LR2, | |
527 | if (INPUT(input)->amux == CX25840_AUDIO7) | 527 | * which is available via the optional white breakout header on |
528 | cx23885_flatiron_mux(dev, 1); | 528 | * the board. |
529 | else if (INPUT(input)->amux == CX25840_AUDIO6) | 529 | * We'll use a could of existing enums in the card struct to allow |
530 | cx23885_flatiron_mux(dev, 2); | 530 | * devs to specify which baseband input they need, or just default |
531 | * to what we've always used. | ||
532 | */ | ||
533 | if (INPUT(input)->amux == CX25840_AUDIO7) | ||
534 | cx23885_flatiron_mux(dev, 1); | ||
535 | else if (INPUT(input)->amux == CX25840_AUDIO6) | ||
536 | cx23885_flatiron_mux(dev, 2); | ||
537 | else { | ||
538 | /* Not specifically defined, assume the default. */ | ||
539 | cx23885_flatiron_mux(dev, 1); | ||
531 | } | 540 | } |
532 | 541 | ||
533 | return 0; | 542 | return 0; |
@@ -1305,6 +1314,10 @@ static int vidioc_s_input(struct file *file, void *priv, unsigned int i) | |||
1305 | 1314 | ||
1306 | mutex_lock(&dev->lock); | 1315 | mutex_lock(&dev->lock); |
1307 | cx23885_video_mux(dev, i); | 1316 | cx23885_video_mux(dev, i); |
1317 | |||
1318 | /* By default establish the default audio input for the card also */ | ||
1319 | /* Caller is free to use VIDIOC_S_AUDIO to override afterwards */ | ||
1320 | cx23885_audio_mux(dev, i); | ||
1308 | mutex_unlock(&dev->lock); | 1321 | mutex_unlock(&dev->lock); |
1309 | return 0; | 1322 | return 0; |
1310 | } | 1323 | } |
@@ -1369,20 +1382,16 @@ static int vidioc_s_audinput(struct file *file, void *priv, | |||
1369 | struct v4l2_audio *i) | 1382 | struct v4l2_audio *i) |
1370 | { | 1383 | { |
1371 | struct cx23885_dev *dev = ((struct cx23885_fh *)priv)->dev; | 1384 | struct cx23885_dev *dev = ((struct cx23885_fh *)priv)->dev; |
1372 | |||
1373 | /* cx23885 offers 2 different audio inputs on the A/V core, LR1 and LR2. | ||
1374 | * By default the driver has always used LR1 and we need support for | ||
1375 | * switching. This isn't board specific, is part of the base silicon. | ||
1376 | */ | ||
1377 | if (i->index >= 2) | 1385 | if (i->index >= 2) |
1378 | return -EINVAL; | 1386 | return -EINVAL; |
1379 | 1387 | ||
1380 | dprintk(1, "%s(%d)\n", __func__, i->index); | 1388 | dprintk(1, "%s(%d)\n", __func__, i->index); |
1381 | 1389 | ||
1382 | mutex_lock(&dev->lock); | ||
1383 | dev->audinput = i->index; | 1390 | dev->audinput = i->index; |
1384 | cx23885_audio_mux(dev, dev->audinput); | 1391 | |
1385 | mutex_unlock(&dev->lock); | 1392 | /* Skip the audio defaults from the cards struct, caller wants |
1393 | * directly touch the audio mux hardware. */ | ||
1394 | cx23885_flatiron_mux(dev, dev->audinput + 1); | ||
1386 | return 0; | 1395 | return 0; |
1387 | } | 1396 | } |
1388 | 1397 | ||
@@ -1780,6 +1789,7 @@ int cx23885_video_register(struct cx23885_dev *dev) | |||
1780 | cx23885_set_tvnorm(dev, dev->tvnorm); | 1789 | cx23885_set_tvnorm(dev, dev->tvnorm); |
1781 | init_controls(dev); | 1790 | init_controls(dev); |
1782 | cx23885_video_mux(dev, 0); | 1791 | cx23885_video_mux(dev, 0); |
1792 | cx23885_audio_mux(dev, 0); | ||
1783 | mutex_unlock(&dev->lock); | 1793 | mutex_unlock(&dev->lock); |
1784 | 1794 | ||
1785 | return 0; | 1795 | return 0; |