diff options
Diffstat (limited to 'drivers/media/pci/cx25821/cx25821-medusa-video.c')
-rw-r--r-- | drivers/media/pci/cx25821/cx25821-medusa-video.c | 46 |
1 files changed, 1 insertions, 45 deletions
diff --git a/drivers/media/pci/cx25821/cx25821-medusa-video.c b/drivers/media/pci/cx25821/cx25821-medusa-video.c index 6a92e5c70c2a..22fa04415ccc 100644 --- a/drivers/media/pci/cx25821/cx25821-medusa-video.c +++ b/drivers/media/pci/cx25821/cx25821-medusa-video.c | |||
@@ -94,8 +94,6 @@ static int medusa_initialize_ntsc(struct cx25821_dev *dev) | |||
94 | u32 value = 0; | 94 | u32 value = 0; |
95 | u32 tmp = 0; | 95 | u32 tmp = 0; |
96 | 96 | ||
97 | mutex_lock(&dev->lock); | ||
98 | |||
99 | for (i = 0; i < MAX_DECODERS; i++) { | 97 | for (i = 0; i < MAX_DECODERS; i++) { |
100 | /* set video format NTSC-M */ | 98 | /* set video format NTSC-M */ |
101 | value = cx25821_i2c_read(&dev->i2c_bus[0], | 99 | value = cx25821_i2c_read(&dev->i2c_bus[0], |
@@ -222,8 +220,6 @@ static int medusa_initialize_ntsc(struct cx25821_dev *dev) | |||
222 | value |= 0x00080200; | 220 | value |= 0x00080200; |
223 | ret_val = cx25821_i2c_write(&dev->i2c_bus[0], BYP_AB_CTRL, value); | 221 | ret_val = cx25821_i2c_write(&dev->i2c_bus[0], BYP_AB_CTRL, value); |
224 | 222 | ||
225 | mutex_unlock(&dev->lock); | ||
226 | |||
227 | return ret_val; | 223 | return ret_val; |
228 | } | 224 | } |
229 | 225 | ||
@@ -265,8 +261,6 @@ static int medusa_initialize_pal(struct cx25821_dev *dev) | |||
265 | u32 value = 0; | 261 | u32 value = 0; |
266 | u32 tmp = 0; | 262 | u32 tmp = 0; |
267 | 263 | ||
268 | mutex_lock(&dev->lock); | ||
269 | |||
270 | for (i = 0; i < MAX_DECODERS; i++) { | 264 | for (i = 0; i < MAX_DECODERS; i++) { |
271 | /* set video format PAL-BDGHI */ | 265 | /* set video format PAL-BDGHI */ |
272 | value = cx25821_i2c_read(&dev->i2c_bus[0], | 266 | value = cx25821_i2c_read(&dev->i2c_bus[0], |
@@ -397,14 +391,12 @@ static int medusa_initialize_pal(struct cx25821_dev *dev) | |||
397 | value &= 0xFFF7FDFF; | 391 | value &= 0xFFF7FDFF; |
398 | ret_val = cx25821_i2c_write(&dev->i2c_bus[0], BYP_AB_CTRL, value); | 392 | ret_val = cx25821_i2c_write(&dev->i2c_bus[0], BYP_AB_CTRL, value); |
399 | 393 | ||
400 | mutex_unlock(&dev->lock); | ||
401 | |||
402 | return ret_val; | 394 | return ret_val; |
403 | } | 395 | } |
404 | 396 | ||
405 | int medusa_set_videostandard(struct cx25821_dev *dev) | 397 | int medusa_set_videostandard(struct cx25821_dev *dev) |
406 | { | 398 | { |
407 | int status = STATUS_SUCCESS; | 399 | int status = 0; |
408 | u32 value = 0, tmp = 0; | 400 | u32 value = 0, tmp = 0; |
409 | 401 | ||
410 | if (dev->tvnorm & V4L2_STD_PAL_BG || dev->tvnorm & V4L2_STD_PAL_DK) | 402 | if (dev->tvnorm & V4L2_STD_PAL_BG || dev->tvnorm & V4L2_STD_PAL_DK) |
@@ -434,8 +426,6 @@ void medusa_set_resolution(struct cx25821_dev *dev, int width, | |||
434 | u32 vscale = 0x0; | 426 | u32 vscale = 0x0; |
435 | const int MAX_WIDTH = 720; | 427 | const int MAX_WIDTH = 720; |
436 | 428 | ||
437 | mutex_lock(&dev->lock); | ||
438 | |||
439 | /* validate the width */ | 429 | /* validate the width */ |
440 | if (width > MAX_WIDTH) { | 430 | if (width > MAX_WIDTH) { |
441 | pr_info("%s(): width %d > MAX_WIDTH %d ! resetting to MAX_WIDTH\n", | 431 | pr_info("%s(): width %d > MAX_WIDTH %d ! resetting to MAX_WIDTH\n", |
@@ -485,8 +475,6 @@ void medusa_set_resolution(struct cx25821_dev *dev, int width, | |||
485 | cx25821_i2c_write(&dev->i2c_bus[0], | 475 | cx25821_i2c_write(&dev->i2c_bus[0], |
486 | VSCALE_CTRL + (0x200 * decoder), vscale); | 476 | VSCALE_CTRL + (0x200 * decoder), vscale); |
487 | } | 477 | } |
488 | |||
489 | mutex_unlock(&dev->lock); | ||
490 | } | 478 | } |
491 | 479 | ||
492 | static void medusa_set_decoderduration(struct cx25821_dev *dev, int decoder, | 480 | static void medusa_set_decoderduration(struct cx25821_dev *dev, int decoder, |
@@ -496,11 +484,8 @@ static void medusa_set_decoderduration(struct cx25821_dev *dev, int decoder, | |||
496 | u32 tmp = 0; | 484 | u32 tmp = 0; |
497 | u32 disp_cnt_reg = DISP_AB_CNT; | 485 | u32 disp_cnt_reg = DISP_AB_CNT; |
498 | 486 | ||
499 | mutex_lock(&dev->lock); | ||
500 | |||
501 | /* no support */ | 487 | /* no support */ |
502 | if (decoder < VDEC_A || decoder > VDEC_H) { | 488 | if (decoder < VDEC_A || decoder > VDEC_H) { |
503 | mutex_unlock(&dev->lock); | ||
504 | return; | 489 | return; |
505 | } | 490 | } |
506 | 491 | ||
@@ -535,8 +520,6 @@ static void medusa_set_decoderduration(struct cx25821_dev *dev, int decoder, | |||
535 | } | 520 | } |
536 | 521 | ||
537 | cx25821_i2c_write(&dev->i2c_bus[0], disp_cnt_reg, fld_cnt); | 522 | cx25821_i2c_write(&dev->i2c_bus[0], disp_cnt_reg, fld_cnt); |
538 | |||
539 | mutex_unlock(&dev->lock); | ||
540 | } | 523 | } |
541 | 524 | ||
542 | /* Map to Medusa register setting */ | 525 | /* Map to Medusa register setting */ |
@@ -587,10 +570,8 @@ int medusa_set_brightness(struct cx25821_dev *dev, int brightness, int decoder) | |||
587 | int value = 0; | 570 | int value = 0; |
588 | u32 val = 0, tmp = 0; | 571 | u32 val = 0, tmp = 0; |
589 | 572 | ||
590 | mutex_lock(&dev->lock); | ||
591 | if ((brightness > VIDEO_PROCAMP_MAX) || | 573 | if ((brightness > VIDEO_PROCAMP_MAX) || |
592 | (brightness < VIDEO_PROCAMP_MIN)) { | 574 | (brightness < VIDEO_PROCAMP_MIN)) { |
593 | mutex_unlock(&dev->lock); | ||
594 | return -1; | 575 | return -1; |
595 | } | 576 | } |
596 | ret_val = mapM(VIDEO_PROCAMP_MIN, VIDEO_PROCAMP_MAX, brightness, | 577 | ret_val = mapM(VIDEO_PROCAMP_MIN, VIDEO_PROCAMP_MAX, brightness, |
@@ -601,7 +582,6 @@ int medusa_set_brightness(struct cx25821_dev *dev, int brightness, int decoder) | |||
601 | val &= 0xFFFFFF00; | 582 | val &= 0xFFFFFF00; |
602 | ret_val |= cx25821_i2c_write(&dev->i2c_bus[0], | 583 | ret_val |= cx25821_i2c_write(&dev->i2c_bus[0], |
603 | VDEC_A_BRITE_CTRL + (0x200 * decoder), val | value); | 584 | VDEC_A_BRITE_CTRL + (0x200 * decoder), val | value); |
604 | mutex_unlock(&dev->lock); | ||
605 | return ret_val; | 585 | return ret_val; |
606 | } | 586 | } |
607 | 587 | ||
@@ -611,10 +591,7 @@ int medusa_set_contrast(struct cx25821_dev *dev, int contrast, int decoder) | |||
611 | int value = 0; | 591 | int value = 0; |
612 | u32 val = 0, tmp = 0; | 592 | u32 val = 0, tmp = 0; |
613 | 593 | ||
614 | mutex_lock(&dev->lock); | ||
615 | |||
616 | if ((contrast > VIDEO_PROCAMP_MAX) || (contrast < VIDEO_PROCAMP_MIN)) { | 594 | if ((contrast > VIDEO_PROCAMP_MAX) || (contrast < VIDEO_PROCAMP_MIN)) { |
617 | mutex_unlock(&dev->lock); | ||
618 | return -1; | 595 | return -1; |
619 | } | 596 | } |
620 | 597 | ||
@@ -626,7 +603,6 @@ int medusa_set_contrast(struct cx25821_dev *dev, int contrast, int decoder) | |||
626 | ret_val |= cx25821_i2c_write(&dev->i2c_bus[0], | 603 | ret_val |= cx25821_i2c_write(&dev->i2c_bus[0], |
627 | VDEC_A_CNTRST_CTRL + (0x200 * decoder), val | value); | 604 | VDEC_A_CNTRST_CTRL + (0x200 * decoder), val | value); |
628 | 605 | ||
629 | mutex_unlock(&dev->lock); | ||
630 | return ret_val; | 606 | return ret_val; |
631 | } | 607 | } |
632 | 608 | ||
@@ -636,10 +612,7 @@ int medusa_set_hue(struct cx25821_dev *dev, int hue, int decoder) | |||
636 | int value = 0; | 612 | int value = 0; |
637 | u32 val = 0, tmp = 0; | 613 | u32 val = 0, tmp = 0; |
638 | 614 | ||
639 | mutex_lock(&dev->lock); | ||
640 | |||
641 | if ((hue > VIDEO_PROCAMP_MAX) || (hue < VIDEO_PROCAMP_MIN)) { | 615 | if ((hue > VIDEO_PROCAMP_MAX) || (hue < VIDEO_PROCAMP_MIN)) { |
642 | mutex_unlock(&dev->lock); | ||
643 | return -1; | 616 | return -1; |
644 | } | 617 | } |
645 | 618 | ||
@@ -654,7 +627,6 @@ int medusa_set_hue(struct cx25821_dev *dev, int hue, int decoder) | |||
654 | ret_val |= cx25821_i2c_write(&dev->i2c_bus[0], | 627 | ret_val |= cx25821_i2c_write(&dev->i2c_bus[0], |
655 | VDEC_A_HUE_CTRL + (0x200 * decoder), val | value); | 628 | VDEC_A_HUE_CTRL + (0x200 * decoder), val | value); |
656 | 629 | ||
657 | mutex_unlock(&dev->lock); | ||
658 | return ret_val; | 630 | return ret_val; |
659 | } | 631 | } |
660 | 632 | ||
@@ -664,11 +636,8 @@ int medusa_set_saturation(struct cx25821_dev *dev, int saturation, int decoder) | |||
664 | int value = 0; | 636 | int value = 0; |
665 | u32 val = 0, tmp = 0; | 637 | u32 val = 0, tmp = 0; |
666 | 638 | ||
667 | mutex_lock(&dev->lock); | ||
668 | |||
669 | if ((saturation > VIDEO_PROCAMP_MAX) || | 639 | if ((saturation > VIDEO_PROCAMP_MAX) || |
670 | (saturation < VIDEO_PROCAMP_MIN)) { | 640 | (saturation < VIDEO_PROCAMP_MIN)) { |
671 | mutex_unlock(&dev->lock); | ||
672 | return -1; | 641 | return -1; |
673 | } | 642 | } |
674 | 643 | ||
@@ -687,7 +656,6 @@ int medusa_set_saturation(struct cx25821_dev *dev, int saturation, int decoder) | |||
687 | ret_val |= cx25821_i2c_write(&dev->i2c_bus[0], | 656 | ret_val |= cx25821_i2c_write(&dev->i2c_bus[0], |
688 | VDEC_A_VSAT_CTRL + (0x200 * decoder), val | value); | 657 | VDEC_A_VSAT_CTRL + (0x200 * decoder), val | value); |
689 | 658 | ||
690 | mutex_unlock(&dev->lock); | ||
691 | return ret_val; | 659 | return ret_val; |
692 | } | 660 | } |
693 | 661 | ||
@@ -699,8 +667,6 @@ int medusa_video_init(struct cx25821_dev *dev) | |||
699 | int ret_val = 0; | 667 | int ret_val = 0; |
700 | int i = 0; | 668 | int i = 0; |
701 | 669 | ||
702 | mutex_lock(&dev->lock); | ||
703 | |||
704 | _num_decoders = dev->_max_num_decoders; | 670 | _num_decoders = dev->_max_num_decoders; |
705 | 671 | ||
706 | /* disable Auto source selection on all video decoders */ | 672 | /* disable Auto source selection on all video decoders */ |
@@ -719,13 +685,9 @@ int medusa_video_init(struct cx25821_dev *dev) | |||
719 | if (ret_val < 0) | 685 | if (ret_val < 0) |
720 | goto error; | 686 | goto error; |
721 | 687 | ||
722 | mutex_unlock(&dev->lock); | ||
723 | |||
724 | for (i = 0; i < _num_decoders; i++) | 688 | for (i = 0; i < _num_decoders; i++) |
725 | medusa_set_decoderduration(dev, i, _display_field_cnt[i]); | 689 | medusa_set_decoderduration(dev, i, _display_field_cnt[i]); |
726 | 690 | ||
727 | mutex_lock(&dev->lock); | ||
728 | |||
729 | /* Select monitor as DENC A input, power up the DAC */ | 691 | /* Select monitor as DENC A input, power up the DAC */ |
730 | value = cx25821_i2c_read(&dev->i2c_bus[0], DENC_AB_CTRL, &tmp); | 692 | value = cx25821_i2c_read(&dev->i2c_bus[0], DENC_AB_CTRL, &tmp); |
731 | value &= 0xFF70FF70; | 693 | value &= 0xFF70FF70; |
@@ -774,14 +736,8 @@ int medusa_video_init(struct cx25821_dev *dev) | |||
774 | if (ret_val < 0) | 736 | if (ret_val < 0) |
775 | goto error; | 737 | goto error; |
776 | 738 | ||
777 | |||
778 | mutex_unlock(&dev->lock); | ||
779 | |||
780 | ret_val = medusa_set_videostandard(dev); | 739 | ret_val = medusa_set_videostandard(dev); |
781 | 740 | ||
782 | return ret_val; | ||
783 | |||
784 | error: | 741 | error: |
785 | mutex_unlock(&dev->lock); | ||
786 | return ret_val; | 742 | return ret_val; |
787 | } | 743 | } |