Lines Matching +full:hdmi +full:- +full:out

1 // SPDX-License-Identifier: GPL-2.0-only
3 * HDMI interface DSS driver for TI's OMAP4 family of SoCs.
4 * Copyright (C) 2010-2011 Texas Instruments Incorporated - https://www.ti.com/
9 #define DSS_SUBSYS_NAME "HDMI"
27 #include <sound/omap-hdmi-audio.h>
32 #include "hdmi.h"
34 static struct omap_hdmi hdmi; variable
42 r = pm_runtime_resume_and_get(&hdmi.pdev->dev); in hdmi_runtime_get()
55 r = pm_runtime_put_sync(&hdmi.pdev->dev); in hdmi_runtime_put()
56 WARN_ON(r < 0 && r != -ENOSYS); in hdmi_runtime_put()
94 if (hdmi.vdda_reg != NULL) in hdmi_init_regulator()
97 reg = devm_regulator_get(&hdmi.pdev->dev, "vdda"); in hdmi_init_regulator()
100 if (PTR_ERR(reg) != -EPROBE_DEFER) in hdmi_init_regulator()
105 hdmi.vdda_reg = reg; in hdmi_init_regulator()
114 r = regulator_enable(hdmi.vdda_reg); in hdmi_power_on_core()
122 /* Make selection of HDMI in DSS */ in hdmi_power_on_core()
125 hdmi.core_enabled = true; in hdmi_power_on_core()
130 regulator_disable(hdmi.vdda_reg); in hdmi_power_on_core()
137 hdmi.core_enabled = false; in hdmi_power_off_core()
140 regulator_disable(hdmi.vdda_reg); in hdmi_power_off_core()
147 struct omap_overlay_manager *mgr = hdmi.output.manager; in hdmi_power_on_full()
148 struct hdmi_wp_data *wp = &hdmi.wp; in hdmi_power_on_full()
159 p = &hdmi.cfg.timings; in hdmi_power_on_full()
161 DSSDBG("hdmi_power_on x_res= %d y_res = %d\n", p->x_res, p->y_res); in hdmi_power_on_full()
163 hdmi_pll_compute(&hdmi.pll, p->pixelclock, &hdmi_cinfo); in hdmi_power_on_full()
165 r = dss_pll_enable(&hdmi.pll.pll); in hdmi_power_on_full()
171 r = dss_pll_set_config(&hdmi.pll.pll, &hdmi_cinfo); in hdmi_power_on_full()
177 r = hdmi_phy_configure(&hdmi.phy, hdmi_cinfo.clkdco, in hdmi_power_on_full()
188 hdmi4_configure(&hdmi.core, &hdmi.wp, &hdmi.cfg); in hdmi_power_on_full()
196 r = hdmi_wp_video_start(&hdmi.wp); in hdmi_power_on_full()
210 hdmi_wp_video_stop(&hdmi.wp); in hdmi_power_on_full()
212 hdmi_wp_set_phy_pwr(&hdmi.wp, HDMI_PHYPWRCMD_OFF); in hdmi_power_on_full()
216 dss_pll_disable(&hdmi.pll.pll); in hdmi_power_on_full()
219 return -EIO; in hdmi_power_on_full()
224 struct omap_overlay_manager *mgr = hdmi.output.manager; in hdmi_power_off_full()
226 hdmi_wp_clear_irqenable(&hdmi.wp, 0xffffffff); in hdmi_power_off_full()
230 hdmi_wp_video_stop(&hdmi.wp); in hdmi_power_off_full()
232 hdmi_wp_set_phy_pwr(&hdmi.wp, HDMI_PHYPWRCMD_OFF); in hdmi_power_off_full()
234 dss_pll_disable(&hdmi.pll.pll); in hdmi_power_off_full()
242 struct omap_dss_device *out = &hdmi.output; in hdmi_display_check_timing() local
244 if (!dispc_mgr_timings_ok(out->dispc_channel, timings)) in hdmi_display_check_timing()
245 return -EINVAL; in hdmi_display_check_timing()
253 mutex_lock(&hdmi.lock); in hdmi_display_set_timing()
255 hdmi.cfg.timings = *timings; in hdmi_display_set_timing()
257 dispc_set_tv_pclk(timings->pixelclock); in hdmi_display_set_timing()
259 mutex_unlock(&hdmi.lock); in hdmi_display_set_timing()
265 *timings = hdmi.cfg.timings; in hdmi_display_get_timings()
270 mutex_lock(&hdmi.lock); in hdmi_dump_regs()
273 mutex_unlock(&hdmi.lock); in hdmi_dump_regs()
277 hdmi_wp_dump(&hdmi.wp, s); in hdmi_dump_regs()
278 hdmi_pll_dump(&hdmi.pll, s); in hdmi_dump_regs()
279 hdmi_phy_dump(&hdmi.phy, s); in hdmi_dump_regs()
280 hdmi4_core_dump(&hdmi.core, s); in hdmi_dump_regs()
283 mutex_unlock(&hdmi.lock); in hdmi_dump_regs()
290 mutex_lock(&hdmi.lock); in read_edid()
295 r = hdmi4_read_edid(&hdmi.core, buf, len); in read_edid()
298 mutex_unlock(&hdmi.lock); in read_edid()
305 hdmi_wp_audio_enable(&hd->wp, true); in hdmi_start_audio_stream()
306 hdmi4_audio_start(&hd->core, &hd->wp); in hdmi_start_audio_stream()
311 hdmi4_audio_stop(&hd->core, &hd->wp); in hdmi_stop_audio_stream()
312 hdmi_wp_audio_enable(&hd->wp, false); in hdmi_stop_audio_stream()
317 struct omap_dss_device *out = &hdmi.output; in hdmi_display_enable() local
323 mutex_lock(&hdmi.lock); in hdmi_display_enable()
325 if (out->manager == NULL) { in hdmi_display_enable()
327 r = -ENODEV; in hdmi_display_enable()
337 if (hdmi.audio_configured) { in hdmi_display_enable()
338 r = hdmi4_audio_config(&hdmi.core, &hdmi.wp, &hdmi.audio_config, in hdmi_display_enable()
339 hdmi.cfg.timings.pixelclock); in hdmi_display_enable()
342 hdmi.audio_abort_cb(&hdmi.pdev->dev); in hdmi_display_enable()
343 hdmi.audio_configured = false; in hdmi_display_enable()
347 spin_lock_irqsave(&hdmi.audio_playing_lock, flags); in hdmi_display_enable()
348 if (hdmi.audio_configured && hdmi.audio_playing) in hdmi_display_enable()
349 hdmi_start_audio_stream(&hdmi); in hdmi_display_enable()
350 hdmi.display_enabled = true; in hdmi_display_enable()
351 spin_unlock_irqrestore(&hdmi.audio_playing_lock, flags); in hdmi_display_enable()
353 mutex_unlock(&hdmi.lock); in hdmi_display_enable()
357 mutex_unlock(&hdmi.lock); in hdmi_display_enable()
367 mutex_lock(&hdmi.lock); in hdmi_display_disable()
369 spin_lock_irqsave(&hdmi.audio_playing_lock, flags); in hdmi_display_disable()
370 hdmi_stop_audio_stream(&hdmi); in hdmi_display_disable()
371 hdmi.display_enabled = false; in hdmi_display_disable()
372 spin_unlock_irqrestore(&hdmi.audio_playing_lock, flags); in hdmi_display_disable()
376 mutex_unlock(&hdmi.lock); in hdmi_display_disable()
385 mutex_lock(&hdmi.lock); in hdmi_core_enable()
393 mutex_unlock(&hdmi.lock); in hdmi_core_enable()
397 mutex_unlock(&hdmi.lock); in hdmi_core_enable()
405 mutex_lock(&hdmi.lock); in hdmi_core_disable()
409 mutex_unlock(&hdmi.lock); in hdmi_core_disable()
422 mgr = omap_dss_get_overlay_manager(dssdev->dispc_channel); in hdmi_connect()
424 return -ENODEV; in hdmi_connect()
433 dst->name); in hdmi_connect()
444 WARN_ON(dst != dssdev->dst); in hdmi_disconnect()
446 if (dst != dssdev->dst) in hdmi_disconnect()
451 if (dssdev->manager) in hdmi_disconnect()
452 dss_mgr_disconnect(dssdev->manager, dssdev); in hdmi_disconnect()
458 bool need_enable = !hdmi.core_enabled; in hdmi_read_edid()
478 hdmi.cfg.infoframe = *avi; in hdmi_set_infoframe()
485 hdmi.cfg.hdmi_dvi_mode = hdmi_mode ? HDMI_HDMI : HDMI_DVI; in hdmi_set_hdmi_mode()
507 struct omap_dss_device *out = &hdmi.output; in hdmi_init_output() local
509 out->dev = &pdev->dev; in hdmi_init_output()
510 out->id = OMAP_DSS_OUTPUT_HDMI; in hdmi_init_output()
511 out->output_type = OMAP_DISPLAY_TYPE_HDMI; in hdmi_init_output()
512 out->name = "hdmi.0"; in hdmi_init_output()
513 out->dispc_channel = OMAP_DSS_CHANNEL_DIGIT; in hdmi_init_output()
514 out->ops.hdmi = &hdmi_ops; in hdmi_init_output()
515 out->owner = THIS_MODULE; in hdmi_init_output()
517 omapdss_register_output(out); in hdmi_init_output()
522 struct omap_dss_device *out = &hdmi.output; in hdmi_uninit_output() local
524 omapdss_unregister_output(out); in hdmi_uninit_output()
529 struct device_node *node = pdev->dev.of_node; in hdmi_probe_of()
533 ep = of_graph_get_endpoint_by_regs(node, 0, -1); in hdmi_probe_of()
537 r = hdmi_parse_lanes_of(pdev, ep, &hdmi.phy); in hdmi_probe_of()
556 mutex_lock(&hd->lock); in hdmi_audio_startup()
558 if (!hdmi_mode_has_audio(&hd->cfg) || !hd->display_enabled) { in hdmi_audio_startup()
559 ret = -EPERM; in hdmi_audio_startup()
560 goto out; in hdmi_audio_startup()
563 hd->audio_abort_cb = abort_cb; in hdmi_audio_startup()
565 out: in hdmi_audio_startup()
566 mutex_unlock(&hd->lock); in hdmi_audio_startup()
575 mutex_lock(&hd->lock); in hdmi_audio_shutdown()
576 hd->audio_abort_cb = NULL; in hdmi_audio_shutdown()
577 hd->audio_configured = false; in hdmi_audio_shutdown()
578 hd->audio_playing = false; in hdmi_audio_shutdown()
579 mutex_unlock(&hd->lock); in hdmi_audio_shutdown()
589 WARN_ON(!hdmi_mode_has_audio(&hd->cfg)); in hdmi_audio_start()
591 spin_lock_irqsave(&hd->audio_playing_lock, flags); in hdmi_audio_start()
593 if (hd->display_enabled) in hdmi_audio_start()
595 hd->audio_playing = true; in hdmi_audio_start()
597 spin_unlock_irqrestore(&hd->audio_playing_lock, flags); in hdmi_audio_start()
606 WARN_ON(!hdmi_mode_has_audio(&hd->cfg)); in hdmi_audio_stop()
608 spin_lock_irqsave(&hd->audio_playing_lock, flags); in hdmi_audio_stop()
610 if (hd->display_enabled) in hdmi_audio_stop()
612 hd->audio_playing = false; in hdmi_audio_stop()
614 spin_unlock_irqrestore(&hd->audio_playing_lock, flags); in hdmi_audio_stop()
623 mutex_lock(&hd->lock); in hdmi_audio_config()
625 if (!hdmi_mode_has_audio(&hd->cfg) || !hd->display_enabled) { in hdmi_audio_config()
626 ret = -EPERM; in hdmi_audio_config()
627 goto out; in hdmi_audio_config()
630 ret = hdmi4_audio_config(&hd->core, &hd->wp, dss_audio, in hdmi_audio_config()
631 hd->cfg.timings.pixelclock); in hdmi_audio_config()
633 hd->audio_configured = true; in hdmi_audio_config()
634 hd->audio_config = *dss_audio; in hdmi_audio_config()
636 out: in hdmi_audio_config()
637 mutex_unlock(&hd->lock); in hdmi_audio_config()
655 .audio_dma_addr = hdmi_wp_get_audio_dma_addr(&hdmi.wp), in hdmi_audio_register()
659 hdmi.audio_pdev = platform_device_register_data( in hdmi_audio_register()
660 dev, "omap-hdmi-audio", PLATFORM_DEVID_AUTO, in hdmi_audio_register()
663 return PTR_ERR_OR_ZERO(hdmi.audio_pdev); in hdmi_audio_register()
666 /* HDMI HW IP initialisation */
673 hdmi.pdev = pdev; in hdmi4_bind()
674 platform_set_drvdata(pdev, &hdmi); in hdmi4_bind()
676 mutex_init(&hdmi.lock); in hdmi4_bind()
677 spin_lock_init(&hdmi.audio_playing_lock); in hdmi4_bind()
679 if (pdev->dev.of_node) { in hdmi4_bind()
685 r = hdmi_wp_init(pdev, &hdmi.wp); in hdmi4_bind()
689 r = hdmi_pll_init(pdev, &hdmi.pll, &hdmi.wp); in hdmi4_bind()
693 r = hdmi_phy_init(pdev, &hdmi.phy); in hdmi4_bind()
697 r = hdmi4_core_init(pdev, &hdmi.core); in hdmi4_bind()
704 r = -ENODEV; in hdmi4_bind()
708 r = devm_request_threaded_irq(&pdev->dev, irq, in hdmi4_bind()
710 IRQF_ONESHOT, "OMAP HDMI", &hdmi.wp); in hdmi4_bind()
712 DSSERR("HDMI IRQ request failed\n"); in hdmi4_bind()
716 pm_runtime_enable(&pdev->dev); in hdmi4_bind()
720 r = hdmi_audio_register(&pdev->dev); in hdmi4_bind()
722 DSSERR("Registering HDMI audio failed\n"); in hdmi4_bind()
724 pm_runtime_disable(&pdev->dev); in hdmi4_bind()
728 dss_debugfs_create_file("hdmi", hdmi_dump_regs); in hdmi4_bind()
732 hdmi_pll_uninit(&hdmi.pll); in hdmi4_bind()
740 if (hdmi.audio_pdev) in hdmi4_unbind()
741 platform_device_unregister(hdmi.audio_pdev); in hdmi4_unbind()
745 hdmi_pll_uninit(&hdmi.pll); in hdmi4_unbind()
747 pm_runtime_disable(&pdev->dev); in hdmi4_unbind()
757 return component_add(&pdev->dev, &hdmi4_component_ops); in hdmi4_probe()
762 component_del(&pdev->dev, &hdmi4_component_ops); in hdmi4_remove()
789 { .compatible = "ti,omap4-hdmi", },