diff options
Diffstat (limited to 'drivers/media/video/cx88/cx88-video.c')
-rw-r--r-- | drivers/media/video/cx88/cx88-video.c | 57 |
1 files changed, 28 insertions, 29 deletions
diff --git a/drivers/media/video/cx88/cx88-video.c b/drivers/media/video/cx88/cx88-video.c index 073494ceab0f..6c97aa740d27 100644 --- a/drivers/media/video/cx88/cx88-video.c +++ b/drivers/media/video/cx88/cx88-video.c | |||
@@ -227,7 +227,7 @@ static struct cx88_ctrl cx8800_ctls[] = { | |||
227 | .minimum = 0x00, | 227 | .minimum = 0x00, |
228 | .maximum = 0xff, | 228 | .maximum = 0xff, |
229 | .step = 1, | 229 | .step = 1, |
230 | .default_value = 0, | 230 | .default_value = 0x7f, |
231 | .type = V4L2_CTRL_TYPE_INTEGER, | 231 | .type = V4L2_CTRL_TYPE_INTEGER, |
232 | }, | 232 | }, |
233 | .off = 128, | 233 | .off = 128, |
@@ -255,7 +255,7 @@ static struct cx88_ctrl cx8800_ctls[] = { | |||
255 | .minimum = 0, | 255 | .minimum = 0, |
256 | .maximum = 0xff, | 256 | .maximum = 0xff, |
257 | .step = 1, | 257 | .step = 1, |
258 | .default_value = 0, | 258 | .default_value = 0x7f, |
259 | .type = V4L2_CTRL_TYPE_INTEGER, | 259 | .type = V4L2_CTRL_TYPE_INTEGER, |
260 | }, | 260 | }, |
261 | .off = 128, | 261 | .off = 128, |
@@ -300,7 +300,7 @@ static struct cx88_ctrl cx8800_ctls[] = { | |||
300 | .minimum = 0, | 300 | .minimum = 0, |
301 | .maximum = 0x3f, | 301 | .maximum = 0x3f, |
302 | .step = 1, | 302 | .step = 1, |
303 | .default_value = 0x1f, | 303 | .default_value = 0x3f, |
304 | .type = V4L2_CTRL_TYPE_INTEGER, | 304 | .type = V4L2_CTRL_TYPE_INTEGER, |
305 | }, | 305 | }, |
306 | .reg = AUD_VOL_CTL, | 306 | .reg = AUD_VOL_CTL, |
@@ -336,17 +336,17 @@ static int res_get(struct cx8800_dev *dev, struct cx8800_fh *fh, unsigned int bi | |||
336 | return 1; | 336 | return 1; |
337 | 337 | ||
338 | /* is it free? */ | 338 | /* is it free? */ |
339 | down(&core->lock); | 339 | mutex_lock(&core->lock); |
340 | if (dev->resources & bit) { | 340 | if (dev->resources & bit) { |
341 | /* no, someone else uses it */ | 341 | /* no, someone else uses it */ |
342 | up(&core->lock); | 342 | mutex_unlock(&core->lock); |
343 | return 0; | 343 | return 0; |
344 | } | 344 | } |
345 | /* it's free, grab it */ | 345 | /* it's free, grab it */ |
346 | fh->resources |= bit; | 346 | fh->resources |= bit; |
347 | dev->resources |= bit; | 347 | dev->resources |= bit; |
348 | dprintk(1,"res: get %d\n",bit); | 348 | dprintk(1,"res: get %d\n",bit); |
349 | up(&core->lock); | 349 | mutex_unlock(&core->lock); |
350 | return 1; | 350 | return 1; |
351 | } | 351 | } |
352 | 352 | ||
@@ -366,14 +366,13 @@ static | |||
366 | void res_free(struct cx8800_dev *dev, struct cx8800_fh *fh, unsigned int bits) | 366 | void res_free(struct cx8800_dev *dev, struct cx8800_fh *fh, unsigned int bits) |
367 | { | 367 | { |
368 | struct cx88_core *core = dev->core; | 368 | struct cx88_core *core = dev->core; |
369 | if ((fh->resources & bits) != bits) | 369 | BUG_ON((fh->resources & bits) != bits); |
370 | BUG(); | ||
371 | 370 | ||
372 | down(&core->lock); | 371 | mutex_lock(&core->lock); |
373 | fh->resources &= ~bits; | 372 | fh->resources &= ~bits; |
374 | dev->resources &= ~bits; | 373 | dev->resources &= ~bits; |
375 | dprintk(1,"res: put %d\n",bits); | 374 | dprintk(1,"res: put %d\n",bits); |
376 | up(&core->lock); | 375 | mutex_unlock(&core->lock); |
377 | } | 376 | } |
378 | 377 | ||
379 | /* ------------------------------------------------------------------ */ | 378 | /* ------------------------------------------------------------------ */ |
@@ -909,7 +908,8 @@ static int get_control(struct cx88_core *core, struct v4l2_control *ctl) | |||
909 | value = c->sreg ? cx_sread(c->sreg) : cx_read(c->reg); | 908 | value = c->sreg ? cx_sread(c->sreg) : cx_read(c->reg); |
910 | switch (ctl->id) { | 909 | switch (ctl->id) { |
911 | case V4L2_CID_AUDIO_BALANCE: | 910 | case V4L2_CID_AUDIO_BALANCE: |
912 | ctl->value = (value & 0x40) ? (value & 0x3f) : (0x40 - (value & 0x3f)); | 911 | ctl->value = ((value & 0x7f) < 0x40) ? ((value & 0x7f) + 0x40) |
912 | : (0x7f - (value & 0x7f)); | ||
913 | break; | 913 | break; |
914 | case V4L2_CID_AUDIO_VOLUME: | 914 | case V4L2_CID_AUDIO_VOLUME: |
915 | ctl->value = 0x3f - (value & 0x3f); | 915 | ctl->value = 0x3f - (value & 0x3f); |
@@ -918,9 +918,9 @@ static int get_control(struct cx88_core *core, struct v4l2_control *ctl) | |||
918 | ctl->value = ((value + (c->off << c->shift)) & c->mask) >> c->shift; | 918 | ctl->value = ((value + (c->off << c->shift)) & c->mask) >> c->shift; |
919 | break; | 919 | break; |
920 | } | 920 | } |
921 | printk("get_control id=0x%X reg=0x%02x val=0x%02x (mask 0x%02x)%s\n", | 921 | dprintk(1,"get_control id=0x%X(%s) ctrl=0x%02x, reg=0x%02x val=0x%02x (mask 0x%02x)%s\n", |
922 | ctl->id, c->reg, ctl->value, | 922 | ctl->id, c->v.name, ctl->value, c->reg, |
923 | c->mask, c->sreg ? " [shadowed]" : ""); | 923 | value,c->mask, c->sreg ? " [shadowed]" : ""); |
924 | return 0; | 924 | return 0; |
925 | } | 925 | } |
926 | 926 | ||
@@ -946,7 +946,7 @@ static int set_control(struct cx88_core *core, struct v4l2_control *ctl) | |||
946 | mask=c->mask; | 946 | mask=c->mask; |
947 | switch (ctl->id) { | 947 | switch (ctl->id) { |
948 | case V4L2_CID_AUDIO_BALANCE: | 948 | case V4L2_CID_AUDIO_BALANCE: |
949 | value = (ctl->value < 0x40) ? (0x40 - ctl->value) : ctl->value; | 949 | value = (ctl->value < 0x40) ? (0x7f - ctl->value) : (ctl->value - 0x40); |
950 | break; | 950 | break; |
951 | case V4L2_CID_AUDIO_VOLUME: | 951 | case V4L2_CID_AUDIO_VOLUME: |
952 | value = 0x3f - (ctl->value & 0x3f); | 952 | value = 0x3f - (ctl->value & 0x3f); |
@@ -969,9 +969,9 @@ static int set_control(struct cx88_core *core, struct v4l2_control *ctl) | |||
969 | value = ((ctl->value - c->off) << c->shift) & c->mask; | 969 | value = ((ctl->value - c->off) << c->shift) & c->mask; |
970 | break; | 970 | break; |
971 | } | 971 | } |
972 | printk("set_control id=0x%X reg=0x%02x val=0x%02x (mask 0x%02x)%s\n", | 972 | dprintk(1,"set_control id=0x%X(%s) ctrl=0x%02x, reg=0x%02x val=0x%02x (mask 0x%02x)%s\n", |
973 | ctl->id, c->reg, value, | 973 | ctl->id, c->v.name, ctl->value, c->reg, value, |
974 | mask, c->sreg ? " [shadowed]" : ""); | 974 | mask, c->sreg ? " [shadowed]" : ""); |
975 | if (c->sreg) { | 975 | if (c->sreg) { |
976 | cx_sandor(c->sreg, c->reg, mask, value); | 976 | cx_sandor(c->sreg, c->reg, mask, value); |
977 | } else { | 977 | } else { |
@@ -987,8 +987,7 @@ static void init_controls(struct cx88_core *core) | |||
987 | 987 | ||
988 | for (i = 0; i < CX8800_CTLS; i++) { | 988 | for (i = 0; i < CX8800_CTLS; i++) { |
989 | ctrl.id=cx8800_ctls[i].v.id; | 989 | ctrl.id=cx8800_ctls[i].v.id; |
990 | ctrl.value=cx8800_ctls[i].v.default_value | 990 | ctrl.value=cx8800_ctls[i].v.default_value; |
991 | +cx8800_ctls[i].off; | ||
992 | set_control(core, &ctrl); | 991 | set_control(core, &ctrl); |
993 | } | 992 | } |
994 | } | 993 | } |
@@ -1252,7 +1251,7 @@ int cx88_do_ioctl(struct inode *inode, struct file *file, int radio, | |||
1252 | { | 1251 | { |
1253 | int err; | 1252 | int err; |
1254 | 1253 | ||
1255 | dprintk( 1, "CORE IOCTL: 0x%x\n", cmd ); | 1254 | dprintk(2, "CORE IOCTL: 0x%x\n", cmd ); |
1256 | if (video_debug > 1) | 1255 | if (video_debug > 1) |
1257 | v4l_print_ioctl(core->name,cmd); | 1256 | v4l_print_ioctl(core->name,cmd); |
1258 | 1257 | ||
@@ -1291,9 +1290,9 @@ int cx88_do_ioctl(struct inode *inode, struct file *file, int radio, | |||
1291 | if (i == ARRAY_SIZE(tvnorms)) | 1290 | if (i == ARRAY_SIZE(tvnorms)) |
1292 | return -EINVAL; | 1291 | return -EINVAL; |
1293 | 1292 | ||
1294 | down(&core->lock); | 1293 | mutex_lock(&core->lock); |
1295 | cx88_set_tvnorm(core,&tvnorms[i]); | 1294 | cx88_set_tvnorm(core,&tvnorms[i]); |
1296 | up(&core->lock); | 1295 | mutex_unlock(&core->lock); |
1297 | return 0; | 1296 | return 0; |
1298 | } | 1297 | } |
1299 | 1298 | ||
@@ -1343,10 +1342,10 @@ int cx88_do_ioctl(struct inode *inode, struct file *file, int radio, | |||
1343 | 1342 | ||
1344 | if (*i >= 4) | 1343 | if (*i >= 4) |
1345 | return -EINVAL; | 1344 | return -EINVAL; |
1346 | down(&core->lock); | 1345 | mutex_lock(&core->lock); |
1347 | cx88_newstation(core); | 1346 | cx88_newstation(core); |
1348 | video_mux(core,*i); | 1347 | video_mux(core,*i); |
1349 | up(&core->lock); | 1348 | mutex_unlock(&core->lock); |
1350 | return 0; | 1349 | return 0; |
1351 | } | 1350 | } |
1352 | 1351 | ||
@@ -1438,7 +1437,7 @@ int cx88_do_ioctl(struct inode *inode, struct file *file, int radio, | |||
1438 | return -EINVAL; | 1437 | return -EINVAL; |
1439 | if (1 == radio && f->type != V4L2_TUNER_RADIO) | 1438 | if (1 == radio && f->type != V4L2_TUNER_RADIO) |
1440 | return -EINVAL; | 1439 | return -EINVAL; |
1441 | down(&core->lock); | 1440 | mutex_lock(&core->lock); |
1442 | core->freq = f->frequency; | 1441 | core->freq = f->frequency; |
1443 | cx88_newstation(core); | 1442 | cx88_newstation(core); |
1444 | cx88_call_i2c_clients(core,VIDIOC_S_FREQUENCY,f); | 1443 | cx88_call_i2c_clients(core,VIDIOC_S_FREQUENCY,f); |
@@ -1447,7 +1446,7 @@ int cx88_do_ioctl(struct inode *inode, struct file *file, int radio, | |||
1447 | msleep (10); | 1446 | msleep (10); |
1448 | cx88_set_tvaudio(core); | 1447 | cx88_set_tvaudio(core); |
1449 | 1448 | ||
1450 | up(&core->lock); | 1449 | mutex_unlock(&core->lock); |
1451 | return 0; | 1450 | return 0; |
1452 | } | 1451 | } |
1453 | 1452 | ||
@@ -1921,11 +1920,11 @@ static int __devinit cx8800_initdev(struct pci_dev *pci_dev, | |||
1921 | pci_set_drvdata(pci_dev,dev); | 1920 | pci_set_drvdata(pci_dev,dev); |
1922 | 1921 | ||
1923 | /* initial device configuration */ | 1922 | /* initial device configuration */ |
1924 | down(&core->lock); | 1923 | mutex_lock(&core->lock); |
1925 | cx88_set_tvnorm(core,tvnorms); | 1924 | cx88_set_tvnorm(core,tvnorms); |
1926 | init_controls(core); | 1925 | init_controls(core); |
1927 | video_mux(core,0); | 1926 | video_mux(core,0); |
1928 | up(&core->lock); | 1927 | mutex_unlock(&core->lock); |
1929 | 1928 | ||
1930 | /* start tvaudio thread */ | 1929 | /* start tvaudio thread */ |
1931 | if (core->tuner_type != TUNER_ABSENT) | 1930 | if (core->tuner_type != TUNER_ABSENT) |