aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorRicardo Neri <ricardo.neri@ti.com>2012-03-20 23:02:01 -0400
committerTomi Valkeinen <tomi.valkeinen@ti.com>2012-05-11 08:17:06 -0400
commit35547626f3cc527d5e899bbfbac6b9e373f47aa0 (patch)
tree8b80136667c91e48c601fab95fb24b12361478b4 /drivers
parentc1164ed87ea592c2001a0040ffbf9a75cf501d1c (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')
-rw-r--r--drivers/video/omap2/dss/hdmi.c42
-rw-r--r--drivers/video/omap2/dss/ti_hdmi.h1
-rw-r--r--drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c57
-rw-r--r--drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h2
4 files changed, 43 insertions, 59 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;
diff --git a/drivers/video/omap2/dss/ti_hdmi.h b/drivers/video/omap2/dss/ti_hdmi.h
index 6aedb898a918..852a8033ddcc 100644
--- a/drivers/video/omap2/dss/ti_hdmi.h
+++ b/drivers/video/omap2/dss/ti_hdmi.h
@@ -190,6 +190,7 @@ void ti_hdmi_4xxx_pll_dump(struct hdmi_ip_data *ip_data, struct seq_file *s);
190void ti_hdmi_4xxx_core_dump(struct hdmi_ip_data *ip_data, struct seq_file *s); 190void ti_hdmi_4xxx_core_dump(struct hdmi_ip_data *ip_data, struct seq_file *s);
191void ti_hdmi_4xxx_phy_dump(struct hdmi_ip_data *ip_data, struct seq_file *s); 191void ti_hdmi_4xxx_phy_dump(struct hdmi_ip_data *ip_data, struct seq_file *s);
192#if defined(CONFIG_OMAP4_DSS_HDMI_AUDIO) 192#if defined(CONFIG_OMAP4_DSS_HDMI_AUDIO)
193int hdmi_compute_acr(u32 sample_freq, u32 *n, u32 *cts);
193int ti_hdmi_4xxx_wp_audio_enable(struct hdmi_ip_data *ip_data); 194int ti_hdmi_4xxx_wp_audio_enable(struct hdmi_ip_data *ip_data);
194void ti_hdmi_4xxx_wp_audio_disable(struct hdmi_ip_data *ip_data); 195void ti_hdmi_4xxx_wp_audio_disable(struct hdmi_ip_data *ip_data);
195int ti_hdmi_4xxx_audio_start(struct hdmi_ip_data *ip_data); 196int ti_hdmi_4xxx_audio_start(struct hdmi_ip_data *ip_data);
diff --git a/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c b/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c
index b572101c1d03..6178bdac3842 100644
--- a/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c
+++ b/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c
@@ -1202,63 +1202,6 @@ void hdmi_core_audio_infoframe_config(struct hdmi_ip_data *ip_data,
1202 */ 1202 */
1203} 1203}
1204 1204
1205int hdmi_config_audio_acr(struct hdmi_ip_data *ip_data,
1206 u32 sample_freq, u32 *n, u32 *cts)
1207{
1208 u32 r;
1209 u32 deep_color = 0;
1210 u32 pclk = ip_data->cfg.timings.pixel_clock;
1211
1212 if (n == NULL || cts == NULL)
1213 return -EINVAL;
1214 /*
1215 * Obtain current deep color configuration. This needed
1216 * to calculate the TMDS clock based on the pixel clock.
1217 */
1218 r = REG_GET(hdmi_wp_base(ip_data), HDMI_WP_VIDEO_CFG, 1, 0);
1219 switch (r) {
1220 case 1: /* No deep color selected */
1221 deep_color = 100;
1222 break;
1223 case 2: /* 10-bit deep color selected */
1224 deep_color = 125;
1225 break;
1226 case 3: /* 12-bit deep color selected */
1227 deep_color = 150;
1228 break;
1229 default:
1230 return -EINVAL;
1231 }
1232
1233 switch (sample_freq) {
1234 case 32000:
1235 if ((deep_color == 125) && ((pclk == 54054)
1236 || (pclk == 74250)))
1237 *n = 8192;
1238 else
1239 *n = 4096;
1240 break;
1241 case 44100:
1242 *n = 6272;
1243 break;
1244 case 48000:
1245 if ((deep_color == 125) && ((pclk == 54054)
1246 || (pclk == 74250)))
1247 *n = 8192;
1248 else
1249 *n = 6144;
1250 break;
1251 default:
1252 *n = 0;
1253 return -EINVAL;
1254 }
1255
1256 /* Calculate CTS. See HDMI 1.3a or 1.4a specifications */
1257 *cts = pclk * (*n / 128) * deep_color / (sample_freq / 10);
1258
1259 return 0;
1260}
1261
1262int ti_hdmi_4xxx_wp_audio_enable(struct hdmi_ip_data *ip_data) 1205int ti_hdmi_4xxx_wp_audio_enable(struct hdmi_ip_data *ip_data)
1263{ 1206{
1264 REG_FLD_MOD(hdmi_wp_base(ip_data), 1207 REG_FLD_MOD(hdmi_wp_base(ip_data),
diff --git a/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h b/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h
index 4510edba4406..819d056c89d7 100644
--- a/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h
+++ b/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h
@@ -434,8 +434,6 @@ struct hdmi_core_audio_config {
434}; 434};
435 435
436#if defined(CONFIG_OMAP4_DSS_HDMI_AUDIO) 436#if defined(CONFIG_OMAP4_DSS_HDMI_AUDIO)
437int hdmi_config_audio_acr(struct hdmi_ip_data *ip_data,
438 u32 sample_freq, u32 *n, u32 *cts);
439void hdmi_core_audio_infoframe_config(struct hdmi_ip_data *ip_data, 437void hdmi_core_audio_infoframe_config(struct hdmi_ip_data *ip_data,
440 struct snd_cea_861_aud_if *info_aud); 438 struct snd_cea_861_aud_if *info_aud);
441void hdmi_core_audio_config(struct hdmi_ip_data *ip_data, 439void hdmi_core_audio_config(struct hdmi_ip_data *ip_data,