static int imx_hdmi_dai_probe(struct platform_device *pdev) { struct imx_hdmi *hdmi_data; int ret = 0; if (!hdmi_get_registered()) return -ENOMEM; hdmi_data = kzalloc(sizeof(*hdmi_data), GFP_KERNEL); if (!hdmi_data) return -ENOMEM; dev_set_drvdata(&pdev->dev, hdmi_data); hdmi_data->pdev = pdev; hdmi_data->irq = platform_get_irq(pdev, 0); if (hdmi_data->irq <= 0) { dev_err(&pdev->dev, "MXC hdmi: invalid irq number (%d)\n", hdmi_data->irq); goto e_reg_dai; } ret = snd_soc_register_dai(&pdev->dev, &imx_hdmi_dai); if (ret) { dev_err(&pdev->dev, "register DAI failed\n"); goto e_reg_dai; } hdmi_data->soc_platform_pdev = platform_device_alloc("imx-hdmi-soc-audio", 0); if (!hdmi_data->soc_platform_pdev) { dev_err(&pdev->dev, "failed platform_device_alloc\n"); goto e_alloc_dai; } platform_set_drvdata(hdmi_data->soc_platform_pdev, hdmi_data); ret = platform_device_add(hdmi_data->soc_platform_pdev); if (ret) { dev_err(&pdev->dev, "failed to add platform device\n"); platform_device_put(hdmi_data->soc_platform_pdev); goto e_pdev_add; } return 0; e_pdev_add: platform_device_put(hdmi_data->soc_platform_pdev); e_alloc_dai: snd_soc_unregister_dai(&pdev->dev); e_reg_dai: kfree(hdmi_data); return ret; }
static int mxc_hdmi_codec_soc_probe(struct snd_soc_codec *codec) { struct mxc_hdmi_priv *hdmi_priv; int ret = 0; if (!hdmi_get_registered()) return -ENOMEM; hdmi_priv = kzalloc(sizeof(struct mxc_hdmi_priv), GFP_KERNEL); if (hdmi_priv == NULL) return -ENOMEM; hdmi_priv->isfr_clk = clk_get(NULL, "hdmi_isfr_clk"); if (IS_ERR(hdmi_priv->isfr_clk)) { ret = PTR_ERR(hdmi_priv->isfr_clk); pr_err("%s Unable to get HDMI isfr clk: %d\n", __func__, ret); goto e_clk_get1; } hdmi_priv->iahb_clk = clk_get(NULL, "hdmi_iahb_clk"); if (IS_ERR(hdmi_priv->iahb_clk)) { ret = PTR_ERR(hdmi_priv->iahb_clk); pr_err("%s Unable to get HDMI iahb clk: %d\n", __func__, ret); goto e_clk_get2; } ret = snd_soc_add_controls(codec, mxc_hdmi_ctrls, ARRAY_SIZE(mxc_hdmi_ctrls)); if (ret) goto e_add_ctrls; snd_soc_codec_set_drvdata(codec, hdmi_priv); return 0; e_add_ctrls: clk_put(hdmi_priv->iahb_clk); e_clk_get2: clk_put(hdmi_priv->isfr_clk); e_clk_get1: kfree(hdmi_priv); return ret; }