diff options
Diffstat (limited to 'drivers/video')
-rw-r--r-- | drivers/video/omap2/dss/hdmi.c | 88 |
1 files changed, 74 insertions, 14 deletions
diff --git a/drivers/video/omap2/dss/hdmi.c b/drivers/video/omap2/dss/hdmi.c index 0cdb11976091..09fdbf8714ea 100644 --- a/drivers/video/omap2/dss/hdmi.c +++ b/drivers/video/omap2/dss/hdmi.c | |||
@@ -558,6 +558,7 @@ static void hdmi_put_clocks(void) | |||
558 | int hdmi_compute_acr(u32 sample_freq, u32 *n, u32 *cts) | 558 | int hdmi_compute_acr(u32 sample_freq, u32 *n, u32 *cts) |
559 | { | 559 | { |
560 | u32 deep_color; | 560 | u32 deep_color; |
561 | bool deep_color_correct = false; | ||
561 | u32 pclk = hdmi.ip_data.cfg.timings.pixel_clock; | 562 | u32 pclk = hdmi.ip_data.cfg.timings.pixel_clock; |
562 | 563 | ||
563 | if (n == NULL || cts == NULL) | 564 | if (n == NULL || cts == NULL) |
@@ -566,29 +567,88 @@ int hdmi_compute_acr(u32 sample_freq, u32 *n, u32 *cts) | |||
566 | /* TODO: When implemented, query deep color mode here. */ | 567 | /* TODO: When implemented, query deep color mode here. */ |
567 | deep_color = 100; | 568 | deep_color = 100; |
568 | 569 | ||
570 | /* | ||
571 | * When using deep color, the default N value (as in the HDMI | ||
572 | * specification) yields to an non-integer CTS. Hence, we | ||
573 | * modify it while keeping the restrictions described in | ||
574 | * section 7.2.1 of the HDMI 1.4a specification. | ||
575 | */ | ||
569 | switch (sample_freq) { | 576 | switch (sample_freq) { |
570 | case 32000: | 577 | case 32000: |
571 | if ((deep_color == 125) && ((pclk == 54054) || | 578 | case 48000: |
572 | (pclk == 74250))) | 579 | case 96000: |
573 | *n = 8192; | 580 | case 192000: |
574 | else | 581 | if (deep_color == 125) |
575 | *n = 4096; | 582 | if (pclk == 27027 || pclk == 74250) |
583 | deep_color_correct = true; | ||
584 | if (deep_color == 150) | ||
585 | if (pclk == 27027) | ||
586 | deep_color_correct = true; | ||
576 | break; | 587 | break; |
577 | case 44100: | 588 | case 44100: |
578 | *n = 6272; | 589 | case 88200: |
579 | break; | 590 | case 176400: |
580 | case 48000: | 591 | if (deep_color == 125) |
581 | if ((deep_color == 125) && ((pclk == 54054) || | 592 | if (pclk == 27027) |
582 | (pclk == 74250))) | 593 | deep_color_correct = true; |
583 | *n = 8192; | ||
584 | else | ||
585 | *n = 6144; | ||
586 | break; | 594 | break; |
587 | default: | 595 | default: |
588 | *n = 0; | ||
589 | return -EINVAL; | 596 | return -EINVAL; |
590 | } | 597 | } |
591 | 598 | ||
599 | if (deep_color_correct) { | ||
600 | switch (sample_freq) { | ||
601 | case 32000: | ||
602 | *n = 8192; | ||
603 | break; | ||
604 | case 44100: | ||
605 | *n = 12544; | ||
606 | break; | ||
607 | case 48000: | ||
608 | *n = 8192; | ||
609 | break; | ||
610 | case 88200: | ||
611 | *n = 25088; | ||
612 | break; | ||
613 | case 96000: | ||
614 | *n = 16384; | ||
615 | break; | ||
616 | case 176400: | ||
617 | *n = 50176; | ||
618 | break; | ||
619 | case 192000: | ||
620 | *n = 32768; | ||
621 | break; | ||
622 | default: | ||
623 | return -EINVAL; | ||
624 | } | ||
625 | } else { | ||
626 | switch (sample_freq) { | ||
627 | case 32000: | ||
628 | *n = 4096; | ||
629 | break; | ||
630 | case 44100: | ||
631 | *n = 6272; | ||
632 | break; | ||
633 | case 48000: | ||
634 | *n = 6144; | ||
635 | break; | ||
636 | case 88200: | ||
637 | *n = 12544; | ||
638 | break; | ||
639 | case 96000: | ||
640 | *n = 12288; | ||
641 | break; | ||
642 | case 176400: | ||
643 | *n = 25088; | ||
644 | break; | ||
645 | case 192000: | ||
646 | *n = 24576; | ||
647 | break; | ||
648 | default: | ||
649 | return -EINVAL; | ||
650 | } | ||
651 | } | ||
592 | /* Calculate CTS. See HDMI 1.3a or 1.4a specifications */ | 652 | /* Calculate CTS. See HDMI 1.3a or 1.4a specifications */ |
593 | *cts = pclk * (*n / 128) * deep_color / (sample_freq / 10); | 653 | *cts = pclk * (*n / 128) * deep_color / (sample_freq / 10); |
594 | 654 | ||