diff options
Diffstat (limited to 'sound')
-rw-r--r-- | sound/soc/fsl/fsl_hdmi.c | 22 | ||||
-rw-r--r-- | sound/soc/fsl/imx-hdmi.c | 18 | ||||
-rw-r--r-- | sound/soc/fsl/imx-hdmi.h | 1 |
3 files changed, 21 insertions, 20 deletions
diff --git a/sound/soc/fsl/fsl_hdmi.c b/sound/soc/fsl/fsl_hdmi.c index 6d0143e34a0b..fb9e8526b81c 100644 --- a/sound/soc/fsl/fsl_hdmi.c +++ b/sound/soc/fsl/fsl_hdmi.c @@ -544,17 +544,32 @@ static int fsl_hdmi_dai_probe(struct platform_device *pdev) return ret; } - hdmi_data->dma_dev = platform_device_register_simple("imx-hdmi-audio", -1, NULL, 0); - if (IS_ERR(hdmi_data->dma_dev)) { + hdmi_data->codec_dev = platform_device_register_simple( + "hdmi-audio-codec", -1, NULL, 0); + if (IS_ERR(hdmi_data->codec_dev)) { dev_err(&pdev->dev, "failed to register HDMI audio codec\n"); - ret = PTR_ERR(hdmi_data->dma_dev); + ret = PTR_ERR(hdmi_data->codec_dev); goto fail; } + hdmi_data->dma_dev = platform_device_alloc("imx-hdmi-audio", -1); + if (IS_ERR(hdmi_data->dma_dev)) { + ret = PTR_ERR(hdmi_data->dma_dev); + goto fail_dma; + } + platform_set_drvdata(hdmi_data->dma_dev, hdmi_data); + ret = platform_device_add(hdmi_data->dma_dev); + if (ret) { + platform_device_put(hdmi_data->dma_dev); + goto fail_dma; + } + return 0; +fail_dma: + platform_device_unregister(hdmi_data->codec_dev); fail: snd_soc_unregister_component(&pdev->dev); @@ -566,6 +581,7 @@ static int fsl_hdmi_dai_remove(struct platform_device *pdev) struct imx_hdmi *hdmi_data = platform_get_drvdata(pdev); platform_device_unregister(hdmi_data->dma_dev); + platform_device_unregister(hdmi_data->codec_dev); snd_soc_unregister_component(&pdev->dev); return 0; diff --git a/sound/soc/fsl/imx-hdmi.c b/sound/soc/fsl/imx-hdmi.c index 04fcff8cca6e..c6b33b942fe9 100644 --- a/sound/soc/fsl/imx-hdmi.c +++ b/sound/soc/fsl/imx-hdmi.c @@ -37,8 +37,6 @@ static struct snd_soc_card snd_soc_card_imx_hdmi = { .num_links = 1, }; -static struct platform_device *codec_dev; - static int imx_hdmi_audio_probe(struct platform_device *pdev) { struct device_node *hdmi_np, *np = pdev->dev.of_node; @@ -65,26 +63,13 @@ static int imx_hdmi_audio_probe(struct platform_device *pdev) goto end; } - codec_dev = platform_device_register_simple("hdmi-audio-codec", -1, NULL, 0); - if (IS_ERR(codec_dev)) { - dev_err(&pdev->dev, "failed to register HDMI audio codec\n"); - ret = PTR_ERR(codec_dev); - goto end; - } - card->dev = &pdev->dev; card->dai_link->cpu_dai_name = dev_name(&hdmi_pdev->dev); ret = snd_soc_register_card(card); - if (ret) { + if (ret) dev_err(&pdev->dev, "failed to register card: %d\n", ret); - goto err_card; - } - - goto end; -err_card: - platform_device_unregister(codec_dev); end: if (hdmi_np) of_node_put(hdmi_np); @@ -96,7 +81,6 @@ static int imx_hdmi_audio_remove(struct platform_device *pdev) { struct snd_soc_card *card = &snd_soc_card_imx_hdmi; - platform_device_unregister(codec_dev); snd_soc_unregister_card(card); return 0; diff --git a/sound/soc/fsl/imx-hdmi.h b/sound/soc/fsl/imx-hdmi.h index e3288404cb1a..22b3dc5a6669 100644 --- a/sound/soc/fsl/imx-hdmi.h +++ b/sound/soc/fsl/imx-hdmi.h @@ -27,6 +27,7 @@ struct imx_hdmi_sdma_params { struct imx_hdmi { struct snd_soc_dai_driver cpu_dai_drv; + struct platform_device *codec_dev; struct platform_device *dma_dev; struct platform_device *pdev; struct clk *isfr_clk; |