aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/em28xx/em28xx-video.c
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@redhat.com>2008-11-20 10:40:51 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2008-12-29 14:53:37 -0500
commit35ae6f04ad3e4c3ed8a83382b6511bd9beb5c768 (patch)
treeac482c50af4af87bab959b6e839a8383811d8daa /drivers/media/video/em28xx/em28xx-video.c
parentf1990a9c39d957e6896fc506fc5388b7f302c429 (diff)
V4L/DVB (9670): em28xx: allow specifying audio output
Some boards use different AC97 setups for output. This patch adds the capability of specifying the output to be used. Currently, only one output is selected, but the better is to allow user to select it via a mixer, on alsa driver. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/em28xx/em28xx-video.c')
-rw-r--r--drivers/media/video/em28xx/em28xx-video.c42
1 files changed, 30 insertions, 12 deletions
diff --git a/drivers/media/video/em28xx/em28xx-video.c b/drivers/media/video/em28xx/em28xx-video.c
index 6b7d44a7117f..bea74fd9a520 100644
--- a/drivers/media/video/em28xx/em28xx-video.c
+++ b/drivers/media/video/em28xx/em28xx-video.c
@@ -566,6 +566,7 @@ static void video_mux(struct em28xx *dev, int index)
566 route.output = 0; 566 route.output = 0;
567 dev->ctl_input = index; 567 dev->ctl_input = index;
568 dev->ctl_ainput = INPUT(index)->amux; 568 dev->ctl_ainput = INPUT(index)->amux;
569 dev->ctl_aoutput = INPUT(index)->aout;
569 570
570 em28xx_i2c_call_clients(dev, VIDIOC_INT_S_VIDEO_ROUTING, &route); 571 em28xx_i2c_call_clients(dev, VIDIOC_INT_S_VIDEO_ROUTING, &route);
571 572
@@ -928,20 +929,38 @@ static int vidioc_g_audio(struct file *file, void *priv, struct v4l2_audio *a)
928{ 929{
929 struct em28xx_fh *fh = priv; 930 struct em28xx_fh *fh = priv;
930 struct em28xx *dev = fh->dev; 931 struct em28xx *dev = fh->dev;
931 unsigned int index = a->index;
932 932
933 if (a->index > 1) 933 switch (a->index) {
934 return -EINVAL; 934 case EM28XX_AMUX_VIDEO:
935
936 index = dev->ctl_ainput;
937
938 if (index == 0)
939 strcpy(a->name, "Television"); 935 strcpy(a->name, "Television");
940 else 936 break;
937 case EM28XX_AMUX_LINE_IN:
941 strcpy(a->name, "Line In"); 938 strcpy(a->name, "Line In");
939 break;
940 case EM28XX_AMUX_VIDEO2:
941 strcpy(a->name, "Television alt");
942 break;
943 case EM28XX_AMUX_PHONE:
944 strcpy(a->name, "Phone");
945 break;
946 case EM28XX_AMUX_MIC:
947 strcpy(a->name, "Mic");
948 break;
949 case EM28XX_AMUX_CD:
950 strcpy(a->name, "CD");
951 break;
952 case EM28XX_AMUX_AUX:
953 strcpy(a->name, "Aux");
954 break;
955 case EM28XX_AMUX_PCM_OUT:
956 strcpy(a->name, "PCM");
957 break;
958 default:
959 return -EINVAL;
960 }
942 961
962 a->index = dev->ctl_ainput;
943 a->capability = V4L2_AUDCAP_STEREO; 963 a->capability = V4L2_AUDCAP_STEREO;
944 a->index = index;
945 964
946 return 0; 965 return 0;
947} 966}
@@ -951,9 +970,8 @@ static int vidioc_s_audio(struct file *file, void *priv, struct v4l2_audio *a)
951 struct em28xx_fh *fh = priv; 970 struct em28xx_fh *fh = priv;
952 struct em28xx *dev = fh->dev; 971 struct em28xx *dev = fh->dev;
953 972
954 if (a->index != dev->ctl_ainput) 973 dev->ctl_ainput = INPUT(a->index)->amux;
955 return -EINVAL; 974 dev->ctl_aoutput = INPUT(a->index)->aout;
956
957 return 0; 975 return 0;
958} 976}
959 977