From 9c6a9f5f4bb912cf1fe6cf58dadeee389a3c0578 Mon Sep 17 00:00:00 2001 From: Ricardo Neri Date: Tue, 6 Nov 2012 00:19:17 -0600 Subject: [PATCH] --- yaml --- r: 344629 b: refs/heads/master c: 14840b9a83c6a56629db2ba0ec247503e975f143 h: refs/heads/master i: 344627: 770ce2b5d629f0d26164dae72e870e04a0453811 v: v3 --- [refs] | 2 +- trunk/drivers/video/omap2/dss/hdmi.c | 62 ++++++++++++++++++++++++++++ 2 files changed, 63 insertions(+), 1 deletion(-) diff --git a/[refs] b/[refs] index c06bd66bc160..4b71bc7dfcf9 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: d7b6f4437fb7796af774c5423a4b9b486b19233f +refs/heads/master: 14840b9a83c6a56629db2ba0ec247503e975f143 diff --git a/trunk/drivers/video/omap2/dss/hdmi.c b/trunk/drivers/video/omap2/dss/hdmi.c index edc28842b9fd..0c2f35bd5028 100644 --- a/trunk/drivers/video/omap2/dss/hdmi.c +++ b/trunk/drivers/video/omap2/dss/hdmi.c @@ -60,6 +60,9 @@ static struct { struct mutex lock; struct platform_device *pdev; +#if defined(CONFIG_OMAP4_DSS_HDMI_AUDIO) + struct platform_device *audio_pdev; +#endif struct hdmi_ip_data ip_data; @@ -818,6 +821,54 @@ static void hdmi_put_clocks(void) } #if defined(CONFIG_OMAP4_DSS_HDMI_AUDIO) +static int hdmi_probe_audio(struct platform_device *pdev) +{ + struct resource *res; + struct platform_device *aud_pdev; + u32 port_offset, port_size; + struct resource aud_res[2] = { + DEFINE_RES_MEM(-1, -1), + DEFINE_RES_DMA(-1), + }; + + res = platform_get_resource(hdmi.pdev, IORESOURCE_MEM, 0); + if (!res) { + DSSERR("can't get IORESOURCE_MEM HDMI\n"); + return -EINVAL; + } + + /* + * Pass DMA audio port to audio drivers. + * Audio drivers should not ioremap it. + */ + hdmi.ip_data.ops->audio_get_dma_port(&port_offset, &port_size); + + aud_res[0].start = res->start + port_offset; + aud_res[0].end = aud_res[0].start + port_size - 1; + + res = platform_get_resource(hdmi.pdev, IORESOURCE_DMA, 0); + if (!res) { + DSSERR("can't get IORESOURCE_DMA HDMI\n"); + return -EINVAL; + } + + /* Pass the audio DMA request resource to audio drivers. */ + aud_res[1].start = res->start; + + /* create platform device for HDMI audio driver */ + aud_pdev = platform_device_register_simple("omap_hdmi_audio", + pdev->id, aud_res, + ARRAY_SIZE(aud_res)); + if (IS_ERR(aud_pdev)) { + DSSERR("Can't instantiate hdmi-audio\n"); + return -ENODEV; + } + + hdmi.audio_pdev = aud_pdev; + + return 0; +} + int hdmi_compute_acr(u32 sample_freq, u32 *n, u32 *cts) { u32 deep_color; @@ -1098,6 +1149,12 @@ static int __init omapdss_hdmihw_probe(struct platform_device *pdev) hdmi_probe_pdata(pdev); +#if defined(CONFIG_OMAP4_DSS_HDMI_AUDIO) + r = hdmi_probe_audio(pdev); + if (r) + DSSWARN("could not create platform device for audio"); +#endif + return 0; err_panel_init: @@ -1114,6 +1171,11 @@ static int __exit hdmi_remove_child(struct device *dev, void *data) static int __exit omapdss_hdmihw_remove(struct platform_device *pdev) { +#if defined(CONFIG_OMAP4_DSS_HDMI_AUDIO) + if (hdmi.audio_pdev != NULL) + platform_device_unregister(hdmi.audio_pdev); +#endif + device_for_each_child(&pdev->dev, NULL, hdmi_remove_child); dss_unregister_child_devices(&pdev->dev);