aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/au0828/au0828-video.c
diff options
context:
space:
mode:
authorDevin Heitmueller <dheitmueller@linuxtv.org>2009-03-11 02:00:47 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2009-03-30 11:43:25 -0400
commitf1add5b5ec2a6efaa0f5648d0dc2c56d83a3ecf8 (patch)
tree2d44c29f61576e3b6ac88219a726415d9edd3a3b /drivers/media/video/au0828/au0828-video.c
parent4ff5ed44f84aed6727ec226853a1c6b03c36db5e (diff)
V4L/DVB (11070): au0828: Rework the way the analog video binding occurs
Rework the way boards are managed so that we can change the board description based on the Hauppauge eeprom (modeled after cx88-cards.c). Also, make sure that we don't load the analog stack if there are no analog inputs defined in the board profile. Thanks to Michael Krufky <mkrufky@linuxtv.org> for providing information on the various ways different Hauppauge boards can be configured. Signed-off-by: Devin Heitmueller <dheitmueller@linuxtv.org> Signed-off-by: Michael Krufky <mkrufky@linuxtv.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/au0828/au0828-video.c')
-rw-r--r--drivers/media/video/au0828/au0828-video.c40
1 files changed, 16 insertions, 24 deletions
diff --git a/drivers/media/video/au0828/au0828-video.c b/drivers/media/video/au0828/au0828-video.c
index e34464f81f36..064de23a3ce1 100644
--- a/drivers/media/video/au0828/au0828-video.c
+++ b/drivers/media/video/au0828/au0828-video.c
@@ -1013,7 +1013,7 @@ static int vidioc_querycap(struct file *file, void *priv,
1013 1013
1014 memset(cap, 0, sizeof(*cap)); 1014 memset(cap, 0, sizeof(*cap));
1015 strlcpy(cap->driver, "au0828", sizeof(cap->driver)); 1015 strlcpy(cap->driver, "au0828", sizeof(cap->driver));
1016 strlcpy(cap->card, au0828_boards[dev->board].name, sizeof(cap->card)); 1016 strlcpy(cap->card, dev->board.name, sizeof(cap->card));
1017 strlcpy(cap->bus_info, dev->usbdev->dev.bus_id, sizeof(cap->bus_info)); 1017 strlcpy(cap->bus_info, dev->usbdev->dev.bus_id, sizeof(cap->bus_info));
1018 1018
1019 cap->version = AU0828_VERSION_CODE; 1019 cap->version = AU0828_VERSION_CODE;
@@ -1127,14 +1127,14 @@ static int vidioc_enum_input(struct file *file, void *priv,
1127 1127
1128 if(tmp > AU0828_MAX_INPUT) 1128 if(tmp > AU0828_MAX_INPUT)
1129 return -EINVAL; 1129 return -EINVAL;
1130 if(AUVI_INPUT(tmp)->type == 0) 1130 if(AUVI_INPUT(tmp).type == 0)
1131 return -EINVAL; 1131 return -EINVAL;
1132 1132
1133 memset(input, 0, sizeof(*input)); 1133 memset(input, 0, sizeof(*input));
1134 input->index = tmp; 1134 input->index = tmp;
1135 strcpy(input->name, inames[AUVI_INPUT(tmp)->type]); 1135 strcpy(input->name, inames[AUVI_INPUT(tmp).type]);
1136 if((AUVI_INPUT(tmp)->type == AU0828_VMUX_TELEVISION) || 1136 if((AUVI_INPUT(tmp).type == AU0828_VMUX_TELEVISION) ||
1137 (AUVI_INPUT(tmp)->type == AU0828_VMUX_CABLE)) 1137 (AUVI_INPUT(tmp).type == AU0828_VMUX_CABLE))
1138 input->type |= V4L2_INPUT_TYPE_TUNER; 1138 input->type |= V4L2_INPUT_TYPE_TUNER;
1139 else 1139 else
1140 input->type |= V4L2_INPUT_TYPE_CAMERA; 1140 input->type |= V4L2_INPUT_TYPE_CAMERA;
@@ -1163,11 +1163,11 @@ static int vidioc_s_input(struct file *file, void *priv, unsigned int index)
1163 index); 1163 index);
1164 if(index >= AU0828_MAX_INPUT) 1164 if(index >= AU0828_MAX_INPUT)
1165 return -EINVAL; 1165 return -EINVAL;
1166 if(AUVI_INPUT(index)->type == 0) 1166 if(AUVI_INPUT(index).type == 0)
1167 return -EINVAL; 1167 return -EINVAL;
1168 dev->ctrl_input = index; 1168 dev->ctrl_input = index;
1169 1169
1170 switch(AUVI_INPUT(index)->type) { 1170 switch(AUVI_INPUT(index).type) {
1171 case AU0828_VMUX_SVIDEO: 1171 case AU0828_VMUX_SVIDEO:
1172 { 1172 {
1173 dev->input_type = AU0828_VMUX_SVIDEO; 1173 dev->input_type = AU0828_VMUX_SVIDEO;
@@ -1187,13 +1187,13 @@ static int vidioc_s_input(struct file *file, void *priv, unsigned int index)
1187 ; 1187 ;
1188 } 1188 }
1189 1189
1190 route.input = AUVI_INPUT(index)->vmux; 1190 route.input = AUVI_INPUT(index).vmux;
1191 route.output = 0; 1191 route.output = 0;
1192 au0828_call_i2c_clients(dev, VIDIOC_INT_S_VIDEO_ROUTING, &route); 1192 au0828_call_i2c_clients(dev, VIDIOC_INT_S_VIDEO_ROUTING, &route);
1193 1193
1194 for (i = 0; i < AU0828_MAX_INPUT; i++) { 1194 for (i = 0; i < AU0828_MAX_INPUT; i++) {
1195 int enable = 0; 1195 int enable = 0;
1196 if (AUVI_INPUT(i)->audio_setup == NULL) { 1196 if (AUVI_INPUT(i).audio_setup == NULL) {
1197 continue; 1197 continue;
1198 } 1198 }
1199 1199
@@ -1202,18 +1202,18 @@ static int vidioc_s_input(struct file *file, void *priv, unsigned int index)
1202 else 1202 else
1203 enable = 0; 1203 enable = 0;
1204 if (enable) { 1204 if (enable) {
1205 (AUVI_INPUT(i)->audio_setup)(dev, enable); 1205 (AUVI_INPUT(i).audio_setup)(dev, enable);
1206 } else { 1206 } else {
1207 /* Make sure we leave it turned on if some 1207 /* Make sure we leave it turned on if some
1208 other input is routed to this callback */ 1208 other input is routed to this callback */
1209 if ((AUVI_INPUT(i)->audio_setup) != 1209 if ((AUVI_INPUT(i).audio_setup) !=
1210 ((AUVI_INPUT(index)->audio_setup))) { 1210 ((AUVI_INPUT(index).audio_setup))) {
1211 (AUVI_INPUT(i)->audio_setup)(dev, enable); 1211 (AUVI_INPUT(i).audio_setup)(dev, enable);
1212 } 1212 }
1213 } 1213 }
1214 } 1214 }
1215 1215
1216 route.input = AUVI_INPUT(index)->amux; 1216 route.input = AUVI_INPUT(index).amux;
1217 au0828_call_i2c_clients(dev, VIDIOC_INT_S_AUDIO_ROUTING, 1217 au0828_call_i2c_clients(dev, VIDIOC_INT_S_AUDIO_ROUTING,
1218 &route); 1218 &route);
1219 return 0; 1219 return 0;
@@ -1419,10 +1419,10 @@ static int vidioc_streamoff(struct file *file, void *priv,
1419 } 1419 }
1420 1420
1421 for (i = 0; i < AU0828_MAX_INPUT; i++) { 1421 for (i = 0; i < AU0828_MAX_INPUT; i++) {
1422 if (AUVI_INPUT(i)->audio_setup == NULL) { 1422 if (AUVI_INPUT(i).audio_setup == NULL) {
1423 continue; 1423 continue;
1424 } 1424 }
1425 (AUVI_INPUT(i)->audio_setup)(dev, 0); 1425 (AUVI_INPUT(i).audio_setup)(dev, 0);
1426 } 1426 }
1427 1427
1428 mutex_lock(&dev->lock); 1428 mutex_lock(&dev->lock);
@@ -1603,14 +1603,6 @@ int au0828_analog_register(struct au0828_dev *dev)
1603 1603
1604 dprintk(1, "au0828_analog_register called!\n"); 1604 dprintk(1, "au0828_analog_register called!\n");
1605 1605
1606 /* Load the analog demodulator driver (note this would need to be
1607 abstracted out if we ever need to support a different demod) */
1608 request_module("au8522");
1609
1610 /* Load the tuner module, which results in i2c enumeration and
1611 attachment of whatever tuner is on the bus */
1612 request_module("tuner");
1613
1614 init_waitqueue_head(&dev->open); 1606 init_waitqueue_head(&dev->open);
1615 spin_lock_init(&dev->slock); 1607 spin_lock_init(&dev->slock);
1616 mutex_init(&dev->lock); 1608 mutex_init(&dev->lock);