aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video/omap2/dss/hdmi.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/video/omap2/dss/hdmi.c')
-rw-r--r--drivers/video/omap2/dss/hdmi.c42
1 files changed, 42 insertions, 0 deletions
diff --git a/drivers/video/omap2/dss/hdmi.c b/drivers/video/omap2/dss/hdmi.c
index 0f8efc961e6b..0cdb11976091 100644
--- a/drivers/video/omap2/dss/hdmi.c
+++ b/drivers/video/omap2/dss/hdmi.c
@@ -554,6 +554,48 @@ static void hdmi_put_clocks(void)
554 clk_put(hdmi.sys_clk); 554 clk_put(hdmi.sys_clk);
555} 555}
556 556
557#if defined(CONFIG_OMAP4_DSS_HDMI_AUDIO)
558int hdmi_compute_acr(u32 sample_freq, u32 *n, u32 *cts)
559{
560 u32 deep_color;
561 u32 pclk = hdmi.ip_data.cfg.timings.pixel_clock;
562
563 if (n == NULL || cts == NULL)
564 return -EINVAL;
565
566 /* TODO: When implemented, query deep color mode here. */
567 deep_color = 100;
568
569 switch (sample_freq) {
570 case 32000:
571 if ((deep_color == 125) && ((pclk == 54054) ||
572 (pclk == 74250)))
573 *n = 8192;
574 else
575 *n = 4096;
576 break;
577 case 44100:
578 *n = 6272;
579 break;
580 case 48000:
581 if ((deep_color == 125) && ((pclk == 54054) ||
582 (pclk == 74250)))
583 *n = 8192;
584 else
585 *n = 6144;
586 break;
587 default:
588 *n = 0;
589 return -EINVAL;
590 }
591
592 /* Calculate CTS. See HDMI 1.3a or 1.4a specifications */
593 *cts = pclk * (*n / 128) * deep_color / (sample_freq / 10);
594
595 return 0;
596}
597#endif
598
557static void __init hdmi_probe_pdata(struct platform_device *pdev) 599static void __init hdmi_probe_pdata(struct platform_device *pdev)
558{ 600{
559 struct omap_dss_board_info *pdata = pdev->dev.platform_data; 601 struct omap_dss_board_info *pdata = pdev->dev.platform_data;