static int hdmi_audio_register(struct device *dev) { struct omap_hdmi_audio_pdata pdata = { .dev = dev, .dss_version = omapdss_get_version(), .audio_dma_addr = hdmi_wp_get_audio_dma_addr(&hdmi.wp), .ops = &hdmi_audio_ops, }; hdmi.audio_pdev = platform_device_register_data( dev, "omap-hdmi-audio", PLATFORM_DEVID_AUTO, &pdata, sizeof(pdata)); if (IS_ERR(hdmi.audio_pdev)) return PTR_ERR(hdmi.audio_pdev); hdmi_runtime_get(); hdmi.wp_idlemode = REG_GET(hdmi.wp.base, HDMI_WP_SYSCONFIG, 3, 2); hdmi_runtime_put(); return 0; } /* HDMI HW IP initialisation */ static int hdmi5_bind(struct device *dev, struct device *master, void *data) { struct platform_device *pdev = to_platform_device(dev); int r; int irq; hdmi.pdev = pdev; dev_set_drvdata(&pdev->dev, &hdmi); mutex_init(&hdmi.lock); spin_lock_init(&hdmi.audio_playing_lock); if (pdev->dev.of_node) { r = hdmi_probe_of(pdev); if (r) return r; } r = hdmi_wp_init(pdev, &hdmi.wp); if (r) return r; r = hdmi_pll_init(pdev, &hdmi.pll, &hdmi.wp); if (r) return r; r = hdmi_phy_init(pdev, &hdmi.phy); if (r) goto err; r = hdmi5_core_init(pdev, &hdmi.core); if (r) goto err; irq = platform_get_irq(pdev, 0); if (irq < 0) { DSSERR("platform_get_irq failed\n"); r = -ENODEV; goto err; } r = devm_request_threaded_irq(&pdev->dev, irq, NULL, hdmi_irq_handler, IRQF_ONESHOT, "OMAP HDMI", &hdmi.wp); if (r) { DSSERR("HDMI IRQ request failed\n"); goto err; } pm_runtime_enable(&pdev->dev); hdmi_init_output(pdev); r = hdmi_audio_register(&pdev->dev); if (r) { DSSERR("Registering HDMI audio failed %d\n", r); hdmi_uninit_output(pdev); pm_runtime_disable(&pdev->dev); return r; } dss_debugfs_create_file("hdmi", hdmi_dump_regs); return 0; err: hdmi_pll_uninit(&hdmi.pll); return r; } static void hdmi5_unbind(struct device *dev, struct device *master, void *data) { struct platform_device *pdev = to_platform_device(dev); if (hdmi.audio_pdev) platform_device_unregister(hdmi.audio_pdev); hdmi_uninit_output(pdev); hdmi_pll_uninit(&hdmi.pll); pm_runtime_disable(&pdev->dev); } static const struct component_ops hdmi5_component_ops = { .bind = hdmi5_bind, .unbind = hdmi5_unbind, }; static int hdmi5_probe(struct platform_device *pdev) { return component_add(&pdev->dev, &hdmi5_component_ops); } static int hdmi5_remove(struct platform_device *pdev) { component_del(&pdev->dev, &hdmi5_component_ops); return 0; }
static int hdmi_audio_register(struct device *dev) { struct omap_hdmi_audio_pdata pdata = { .dev = dev, .dss_version = omapdss_get_version(), .audio_dma_addr = hdmi_wp_get_audio_dma_addr(&hdmi.wp), .ops = &hdmi_audio_ops, }; hdmi.audio_pdev = platform_device_register_data( dev, "omap-hdmi-audio", PLATFORM_DEVID_AUTO, &pdata, sizeof(pdata)); if (IS_ERR(hdmi.audio_pdev)) return PTR_ERR(hdmi.audio_pdev); return 0; } /* HDMI HW IP initialisation */ static int omapdss_hdmihw_probe(struct platform_device *pdev) { int r; int irq; hdmi.pdev = pdev; dev_set_drvdata(&pdev->dev, &hdmi); mutex_init(&hdmi.lock); if (pdev->dev.of_node) { r = hdmi_probe_of(pdev); if (r) return r; } r = hdmi_wp_init(pdev, &hdmi.wp); if (r) return r; r = hdmi_pll_init(pdev, &hdmi.pll, &hdmi.wp); if (r) return r; r = hdmi_phy_init(pdev, &hdmi.phy); if (r) goto err; r = hdmi5_core_init(pdev, &hdmi.core); if (r) goto err; irq = platform_get_irq(pdev, 0); if (irq < 0) { DSSERR("platform_get_irq failed\n"); r = -ENODEV; goto err; } r = devm_request_threaded_irq(&pdev->dev, irq, NULL, hdmi_irq_handler, IRQF_ONESHOT, "OMAP HDMI", &hdmi.wp); if (r) { DSSERR("HDMI IRQ request failed\n"); goto err; } pm_runtime_enable(&pdev->dev); hdmi_init_output(pdev); r = hdmi_audio_register(&pdev->dev); if (r) { DSSERR("Registering HDMI audio failed %d\n", r); hdmi_uninit_output(pdev); pm_runtime_disable(&pdev->dev); return r; } dss_debugfs_create_file("hdmi", hdmi_dump_regs); return 0; err: hdmi_pll_uninit(&hdmi.pll); return r; }