diff options
author | Ricardo Neri <ricardo.neri@ti.com> | 2012-03-20 21:02:01 -0600 |
---|---|---|
committer | Tomi Valkeinen <tomi.valkeinen@ti.com> | 2012-05-11 15:17:06 +0300 |
commit | 35547626f3cc527d5e899bbfbac6b9e373f47aa0 (patch) | |
tree | 8b80136667c91e48c601fab95fb24b12361478b4 /drivers/video/omap2/dss/hdmi.c | |
parent | c1164ed87ea592c2001a0040ffbf9a75cf501d1c (diff) |
OMAPDSS: HDMI: Relocate N/CTS calculation
The N and CTS parameters are relevant to all HDMI implementations and
not specific to a given IP. Hence, the calculation is relocated
into the generic HDMI driver.
Also, deep color is not queried but it is still considered in the
calculation of N. This is to be changed when deep color functionality is
implemented in the driver.
Signed-off-by: Ricardo Neri <ricardo.neri@ti.com>
Diffstat (limited to 'drivers/video/omap2/dss/hdmi.c')
-rw-r--r-- | drivers/video/omap2/dss/hdmi.c | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/drivers/video/omap2/dss/hdmi.c b/drivers/video/omap2/dss/hdmi.c index 0f8efc961e6..0cdb1197609 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) clk_put(hdmi.sys_clk); } +#if defined(CONFIG_OMAP4_DSS_HDMI_AUDIO) +int hdmi_compute_acr(u32 sample_freq, u32 *n, u32 *cts) +{ + u32 deep_color; + u32 pclk = hdmi.ip_data.cfg.timings.pixel_clock; + + if (n == NULL || cts == NULL) + return -EINVAL; + + /* TODO: When implemented, query deep color mode here. */ + deep_color = 100; + + switch (sample_freq) { + case 32000: + if ((deep_color == 125) && ((pclk == 54054) || + (pclk == 74250))) + *n = 8192; + else + *n = 4096; + break; + case 44100: + *n = 6272; + break; + case 48000: + if ((deep_color == 125) && ((pclk == 54054) || + (pclk == 74250))) + *n = 8192; + else + *n = 6144; + break; + default: + *n = 0; + return -EINVAL; + } + + /* Calculate CTS. See HDMI 1.3a or 1.4a specifications */ + *cts = pclk * (*n / 128) * deep_color / (sample_freq / 10); + + return 0; +} +#endif + static void __init hdmi_probe_pdata(struct platform_device *pdev) { struct omap_dss_board_info *pdata = pdev->dev.platform_data; |