From 7cad8c117a08fb052d6124b2ea8b1cbc5c1124ad Mon Sep 17 00:00:00 2001 From: Steven Toth Date: Mon, 10 Oct 2011 11:09:56 -0300 Subject: [PATCH] --- yaml --- r: 271973 b: refs/heads/master c: fa1e0fd3718417ad1e1058172fafd8cc2f480618 h: refs/heads/master i: 271971: e11a504fd34d741ac262e07ea1a1552ace2e4f59 v: v3 --- [refs] | 2 +- .../media/video/cx23885/cx23885-video.c | 40 ++++++++++++------- 2 files changed, 26 insertions(+), 16 deletions(-) diff --git a/[refs] b/[refs] index c4d092de6fc0..ad3a5e5cee41 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: fc1a889df78dea08e522310c9eb6110448dc61f0 +refs/heads/master: fa1e0fd3718417ad1e1058172fafd8cc2f480618 diff --git a/trunk/drivers/media/video/cx23885/cx23885-video.c b/trunk/drivers/media/video/cx23885/cx23885-video.c index 9726f2a0ef6c..396fa4e23acb 100644 --- a/trunk/drivers/media/video/cx23885/cx23885-video.c +++ b/trunk/drivers/media/video/cx23885/cx23885-video.c @@ -521,13 +521,22 @@ static int cx23885_audio_mux(struct cx23885_dev *dev, unsigned int input) { dprintk(1, "%s(input=%d)\n", __func__, input); - if ((dev->board == CX23885_BOARD_HAUPPAUGE_HVR1800) || - (dev->board == CX23885_BOARD_MPX885)) { - - if (INPUT(input)->amux == CX25840_AUDIO7) - cx23885_flatiron_mux(dev, 1); - else if (INPUT(input)->amux == CX25840_AUDIO6) - cx23885_flatiron_mux(dev, 2); + /* The baseband video core of the cx23885 has two audio inputs. + * LR1 and LR2. In almost every single case so far only HVR1xxx + * cards we've only ever supported LR1. Time to support LR2, + * which is available via the optional white breakout header on + * the board. + * We'll use a could of existing enums in the card struct to allow + * devs to specify which baseband input they need, or just default + * to what we've always used. + */ + if (INPUT(input)->amux == CX25840_AUDIO7) + cx23885_flatiron_mux(dev, 1); + else if (INPUT(input)->amux == CX25840_AUDIO6) + cx23885_flatiron_mux(dev, 2); + else { + /* Not specifically defined, assume the default. */ + cx23885_flatiron_mux(dev, 1); } return 0; @@ -1305,6 +1314,10 @@ static int vidioc_s_input(struct file *file, void *priv, unsigned int i) mutex_lock(&dev->lock); cx23885_video_mux(dev, i); + + /* By default establish the default audio input for the card also */ + /* Caller is free to use VIDIOC_S_AUDIO to override afterwards */ + cx23885_audio_mux(dev, i); mutex_unlock(&dev->lock); return 0; } @@ -1369,20 +1382,16 @@ static int vidioc_s_audinput(struct file *file, void *priv, struct v4l2_audio *i) { struct cx23885_dev *dev = ((struct cx23885_fh *)priv)->dev; - - /* cx23885 offers 2 different audio inputs on the A/V core, LR1 and LR2. - * By default the driver has always used LR1 and we need support for - * switching. This isn't board specific, is part of the base silicon. - */ if (i->index >= 2) return -EINVAL; dprintk(1, "%s(%d)\n", __func__, i->index); - mutex_lock(&dev->lock); dev->audinput = i->index; - cx23885_audio_mux(dev, dev->audinput); - mutex_unlock(&dev->lock); + + /* Skip the audio defaults from the cards struct, caller wants + * directly touch the audio mux hardware. */ + cx23885_flatiron_mux(dev, dev->audinput + 1); return 0; } @@ -1780,6 +1789,7 @@ int cx23885_video_register(struct cx23885_dev *dev) cx23885_set_tvnorm(dev, dev->tvnorm); init_controls(dev); cx23885_video_mux(dev, 0); + cx23885_audio_mux(dev, 0); mutex_unlock(&dev->lock); return 0;