Lines Matching +full:pll +full:- +full:out

1 // SPDX-License-Identifier: GPL-2.0-only
5 * Copyright (C) 2010-2011 Texas Instruments Incorporated - https://www.ti.com/
27 #include <sound/omap-hdmi-audio.h>
46 r = pm_runtime_get_sync(&hdmi->pdev->dev); in hdmi_runtime_get()
48 pm_runtime_put_noidle(&hdmi->pdev->dev); in hdmi_runtime_get()
60 r = pm_runtime_put_sync(&hdmi->pdev->dev); in hdmi_runtime_put()
61 WARN_ON(r < 0 && r != -ENOSYS); in hdmi_runtime_put()
67 struct hdmi_wp_data *wp = &hdmi->wp; in hdmi_irq_handler()
93 u32 intr4 = hdmi_read_reg(hdmi->core.base, HDMI_CORE_SYS_INTR4); in hdmi_irq_handler()
95 hdmi_write_reg(hdmi->core.base, HDMI_CORE_SYS_INTR4, intr4); in hdmi_irq_handler()
97 hdmi4_cec_irq(&hdmi->core); in hdmi_irq_handler()
107 if (hdmi->core.core_pwr_cnt++) in hdmi_power_on_core()
110 r = regulator_enable(hdmi->vdda_reg); in hdmi_power_on_core()
118 hdmi4_core_powerdown_disable(&hdmi->core); in hdmi_power_on_core()
121 dss_select_hdmi_venc_clk_source(hdmi->dss, DSS_HDMI_M_PCLK); in hdmi_power_on_core()
123 hdmi->core_enabled = true; in hdmi_power_on_core()
128 regulator_disable(hdmi->vdda_reg); in hdmi_power_on_core()
130 hdmi->core.core_pwr_cnt--; in hdmi_power_on_core()
137 if (--hdmi->core.core_pwr_cnt) in hdmi_power_off_core()
140 hdmi->core_enabled = false; in hdmi_power_off_core()
143 regulator_disable(hdmi->vdda_reg); in hdmi_power_off_core()
150 struct hdmi_wp_data *wp = &hdmi->wp; in hdmi_power_on_full()
162 vm = &hdmi->cfg.vm; in hdmi_power_on_full()
164 DSSDBG("hdmi_power_on hactive= %d vactive = %d\n", vm->hactive, in hdmi_power_on_full()
165 vm->vactive); in hdmi_power_on_full()
167 pc = vm->pixelclock; in hdmi_power_on_full()
168 if (vm->flags & DISPLAY_FLAGS_DOUBLECLK) in hdmi_power_on_full()
174 dss_pll_calc_b(&hdmi->pll.pll, clk_get_rate(hdmi->pll.pll.clkin), in hdmi_power_on_full()
177 r = dss_pll_enable(&hdmi->pll.pll); in hdmi_power_on_full()
179 DSSERR("Failed to enable PLL\n"); in hdmi_power_on_full()
183 r = dss_pll_set_config(&hdmi->pll.pll, &hdmi_cinfo); in hdmi_power_on_full()
185 DSSERR("Failed to configure PLL\n"); in hdmi_power_on_full()
189 r = hdmi_phy_configure(&hdmi->phy, hdmi_cinfo.clkdco, in hdmi_power_on_full()
200 hdmi4_configure(&hdmi->core, &hdmi->wp, &hdmi->cfg); in hdmi_power_on_full()
202 r = dss_mgr_enable(&hdmi->output); in hdmi_power_on_full()
206 r = hdmi_wp_video_start(&hdmi->wp); in hdmi_power_on_full()
216 dss_mgr_disable(&hdmi->output); in hdmi_power_on_full()
218 hdmi_wp_set_phy_pwr(&hdmi->wp, HDMI_PHYPWRCMD_OFF); in hdmi_power_on_full()
222 dss_pll_disable(&hdmi->pll.pll); in hdmi_power_on_full()
225 return -EIO; in hdmi_power_on_full()
230 hdmi_wp_clear_irqenable(&hdmi->wp, ~HDMI_IRQ_CORE); in hdmi_power_off_full()
232 hdmi_wp_video_stop(&hdmi->wp); in hdmi_power_off_full()
234 dss_mgr_disable(&hdmi->output); in hdmi_power_off_full()
236 hdmi_wp_set_phy_pwr(&hdmi->wp, HDMI_PHYPWRCMD_OFF); in hdmi_power_off_full()
238 dss_pll_disable(&hdmi->pll.pll); in hdmi_power_off_full()
245 struct omap_hdmi *hdmi = s->private; in hdmi_dump_regs()
247 mutex_lock(&hdmi->lock); in hdmi_dump_regs()
250 mutex_unlock(&hdmi->lock); in hdmi_dump_regs()
254 hdmi_wp_dump(&hdmi->wp, s); in hdmi_dump_regs()
255 hdmi_pll_dump(&hdmi->pll, s); in hdmi_dump_regs()
256 hdmi_phy_dump(&hdmi->phy, s); in hdmi_dump_regs()
257 hdmi4_core_dump(&hdmi->core, s); in hdmi_dump_regs()
260 mutex_unlock(&hdmi->lock); in hdmi_dump_regs()
266 hdmi_wp_audio_enable(&hd->wp, true); in hdmi_start_audio_stream()
267 hdmi4_audio_start(&hd->core, &hd->wp); in hdmi_start_audio_stream()
272 hdmi4_audio_stop(&hd->core, &hd->wp); in hdmi_stop_audio_stream()
273 hdmi_wp_audio_enable(&hd->wp, false); in hdmi_stop_audio_stream()
283 mutex_lock(&hdmi->lock); in hdmi4_core_enable()
291 mutex_unlock(&hdmi->lock); in hdmi4_core_enable()
295 mutex_unlock(&hdmi->lock); in hdmi4_core_enable()
305 mutex_lock(&hdmi->lock); in hdmi4_core_disable()
309 mutex_unlock(&hdmi->lock); in hdmi4_core_disable()
312 /* -----------------------------------------------------------------------------
322 return -EINVAL; in hdmi4_bridge_attach()
324 return drm_bridge_attach(bridge->encoder, hdmi->output.next_bridge, in hdmi4_bridge_attach()
334 mutex_lock(&hdmi->lock); in hdmi4_bridge_mode_set()
336 drm_display_mode_to_videomode(adjusted_mode, &hdmi->cfg.vm); in hdmi4_bridge_mode_set()
338 dispc_set_tv_pclk(hdmi->dss->dispc, adjusted_mode->clock * 1000); in hdmi4_bridge_mode_set()
340 mutex_unlock(&hdmi->lock); in hdmi4_bridge_mode_set()
347 struct drm_atomic_state *state = bridge_state->base.state; in hdmi4_bridge_enable()
359 bridge->encoder); in hdmi4_bridge_enable()
365 crtc_state = drm_atomic_get_new_crtc_state(state, conn_state->crtc); in hdmi4_bridge_enable()
369 hdmi->cfg.hdmi_dvi_mode = connector->display_info.is_hdmi in hdmi4_bridge_enable()
372 if (connector->display_info.is_hdmi) { in hdmi4_bridge_enable()
376 mode = &crtc_state->adjusted_mode; in hdmi4_bridge_enable()
380 hdmi->cfg.infoframe = avi; in hdmi4_bridge_enable()
383 mutex_lock(&hdmi->lock); in hdmi4_bridge_enable()
391 if (hdmi->audio_configured) { in hdmi4_bridge_enable()
392 ret = hdmi4_audio_config(&hdmi->core, &hdmi->wp, in hdmi4_bridge_enable()
393 &hdmi->audio_config, in hdmi4_bridge_enable()
394 hdmi->cfg.vm.pixelclock); in hdmi4_bridge_enable()
397 hdmi->audio_abort_cb(&hdmi->pdev->dev); in hdmi4_bridge_enable()
398 hdmi->audio_configured = false; in hdmi4_bridge_enable()
402 spin_lock_irqsave(&hdmi->audio_playing_lock, flags); in hdmi4_bridge_enable()
403 if (hdmi->audio_configured && hdmi->audio_playing) in hdmi4_bridge_enable()
405 hdmi->display_enabled = true; in hdmi4_bridge_enable()
406 spin_unlock_irqrestore(&hdmi->audio_playing_lock, flags); in hdmi4_bridge_enable()
409 mutex_unlock(&hdmi->lock); in hdmi4_bridge_enable()
418 mutex_lock(&hdmi->lock); in hdmi4_bridge_disable()
420 spin_lock_irqsave(&hdmi->audio_playing_lock, flags); in hdmi4_bridge_disable()
422 hdmi->display_enabled = false; in hdmi4_bridge_disable()
423 spin_unlock_irqrestore(&hdmi->audio_playing_lock, flags); in hdmi4_bridge_disable()
427 mutex_unlock(&hdmi->lock); in hdmi4_bridge_disable()
436 hdmi4_cec_set_phys_addr(&hdmi->core, CEC_PHYS_ADDR_INVALID); in hdmi4_bridge_hpd_notify()
448 need_enable = hdmi->core_enabled == false; in hdmi4_bridge_edid_read()
451 r = hdmi4_core_enable(&hdmi->core); in hdmi4_bridge_edid_read()
456 mutex_lock(&hdmi->lock); in hdmi4_bridge_edid_read()
460 r = hdmi4_core_ddc_init(&hdmi->core); in hdmi4_bridge_edid_read()
464 drm_edid = drm_edid_read_custom(connector, hdmi4_core_ddc_read, &hdmi->core); in hdmi4_bridge_edid_read()
468 mutex_unlock(&hdmi->lock); in hdmi4_bridge_edid_read()
473 * hdmi4_cec_set_phys_addr(&hdmi->core, in hdmi4_bridge_edid_read()
474 * connector->display_info.source_physical_address) from a path in hdmi4_bridge_edid_read()
479 unsigned int len = (edid->extensions + 1) * EDID_LENGTH; in hdmi4_bridge_edid_read()
486 hdmi4_cec_set_phys_addr(&hdmi->core, cec_addr); in hdmi4_bridge_edid_read()
489 hdmi4_core_disable(&hdmi->core); in hdmi4_bridge_edid_read()
508 hdmi->bridge.funcs = &hdmi4_bridge_funcs; in hdmi4_bridge_init()
509 hdmi->bridge.of_node = hdmi->pdev->dev.of_node; in hdmi4_bridge_init()
510 hdmi->bridge.ops = DRM_BRIDGE_OP_EDID; in hdmi4_bridge_init()
511 hdmi->bridge.type = DRM_MODE_CONNECTOR_HDMIA; in hdmi4_bridge_init()
513 drm_bridge_add(&hdmi->bridge); in hdmi4_bridge_init()
518 drm_bridge_remove(&hdmi->bridge); in hdmi4_bridge_cleanup()
521 /* -----------------------------------------------------------------------------
530 mutex_lock(&hd->lock); in hdmi_audio_startup()
532 WARN_ON(hd->audio_abort_cb != NULL); in hdmi_audio_startup()
534 hd->audio_abort_cb = abort_cb; in hdmi_audio_startup()
536 mutex_unlock(&hd->lock); in hdmi_audio_startup()
545 mutex_lock(&hd->lock); in hdmi_audio_shutdown()
546 hd->audio_abort_cb = NULL; in hdmi_audio_shutdown()
547 hd->audio_configured = false; in hdmi_audio_shutdown()
548 hd->audio_playing = false; in hdmi_audio_shutdown()
549 mutex_unlock(&hd->lock); in hdmi_audio_shutdown()
559 spin_lock_irqsave(&hd->audio_playing_lock, flags); in hdmi_audio_start()
561 if (hd->display_enabled) { in hdmi_audio_start()
562 if (!hdmi_mode_has_audio(&hd->cfg)) in hdmi_audio_start()
567 hd->audio_playing = true; in hdmi_audio_start()
569 spin_unlock_irqrestore(&hd->audio_playing_lock, flags); in hdmi_audio_start()
578 WARN_ON(!hdmi_mode_has_audio(&hd->cfg)); in hdmi_audio_stop()
580 spin_lock_irqsave(&hd->audio_playing_lock, flags); in hdmi_audio_stop()
582 if (hd->display_enabled) in hdmi_audio_stop()
584 hd->audio_playing = false; in hdmi_audio_stop()
586 spin_unlock_irqrestore(&hd->audio_playing_lock, flags); in hdmi_audio_stop()
595 mutex_lock(&hd->lock); in hdmi_audio_config()
597 if (hd->display_enabled) { in hdmi_audio_config()
598 ret = hdmi4_audio_config(&hd->core, &hd->wp, dss_audio, in hdmi_audio_config()
599 hd->cfg.vm.pixelclock); in hdmi_audio_config()
601 goto out; in hdmi_audio_config()
604 hd->audio_configured = true; in hdmi_audio_config()
605 hd->audio_config = *dss_audio; in hdmi_audio_config()
606 out: in hdmi_audio_config()
607 mutex_unlock(&hd->lock); in hdmi_audio_config()
623 .dev = &hdmi->pdev->dev, in hdmi_audio_register()
625 .audio_dma_addr = hdmi_wp_get_audio_dma_addr(&hdmi->wp), in hdmi_audio_register()
629 hdmi->audio_pdev = platform_device_register_data( in hdmi_audio_register()
630 &hdmi->pdev->dev, "omap-hdmi-audio", PLATFORM_DEVID_AUTO, in hdmi_audio_register()
633 if (IS_ERR(hdmi->audio_pdev)) in hdmi_audio_register()
634 return PTR_ERR(hdmi->audio_pdev); in hdmi_audio_register()
639 /* -----------------------------------------------------------------------------
649 hdmi->dss = dss; in hdmi4_bind()
655 r = hdmi_pll_init(dss, hdmi->pdev, &hdmi->pll, &hdmi->wp); in hdmi4_bind()
659 r = hdmi4_cec_init(hdmi->pdev, &hdmi->core, &hdmi->wp); in hdmi4_bind()
669 hdmi->debugfs = dss_debugfs_create_file(dss, "hdmi", hdmi_dump_regs, in hdmi4_bind()
677 hdmi4_cec_uninit(&hdmi->core); in hdmi4_bind()
679 hdmi_pll_uninit(&hdmi->pll); in hdmi4_bind()
689 dss_debugfs_remove_file(hdmi->debugfs); in hdmi4_unbind()
691 if (hdmi->audio_pdev) in hdmi4_unbind()
692 platform_device_unregister(hdmi->audio_pdev); in hdmi4_unbind()
694 hdmi4_cec_uninit(&hdmi->core); in hdmi4_unbind()
695 hdmi_pll_uninit(&hdmi->pll); in hdmi4_unbind()
703 /* -----------------------------------------------------------------------------
709 struct omap_dss_device *out = &hdmi->output; in hdmi4_init_output() local
714 out->dev = &hdmi->pdev->dev; in hdmi4_init_output()
715 out->id = OMAP_DSS_OUTPUT_HDMI; in hdmi4_init_output()
716 out->type = OMAP_DISPLAY_TYPE_HDMI; in hdmi4_init_output()
717 out->name = "hdmi.0"; in hdmi4_init_output()
718 out->dispc_channel = OMAP_DSS_CHANNEL_DIGIT; in hdmi4_init_output()
719 out->of_port = 0; in hdmi4_init_output()
721 r = omapdss_device_init_output(out, &hdmi->bridge); in hdmi4_init_output()
727 omapdss_device_register(out); in hdmi4_init_output()
734 struct omap_dss_device *out = &hdmi->output; in hdmi4_uninit_output() local
736 omapdss_device_unregister(out); in hdmi4_uninit_output()
737 omapdss_device_cleanup_output(out); in hdmi4_uninit_output()
744 struct platform_device *pdev = hdmi->pdev; in hdmi4_probe_of()
745 struct device_node *node = pdev->dev.of_node; in hdmi4_probe_of()
753 r = hdmi_parse_lanes_of(pdev, ep, &hdmi->phy); in hdmi4_probe_of()
766 return -ENOMEM; in hdmi4_probe()
768 hdmi->pdev = pdev; in hdmi4_probe()
770 dev_set_drvdata(&pdev->dev, hdmi); in hdmi4_probe()
772 mutex_init(&hdmi->lock); in hdmi4_probe()
773 spin_lock_init(&hdmi->audio_playing_lock); in hdmi4_probe()
779 r = hdmi_wp_init(pdev, &hdmi->wp, 4); in hdmi4_probe()
783 r = hdmi_phy_init(pdev, &hdmi->phy, 4); in hdmi4_probe()
787 r = hdmi4_core_init(pdev, &hdmi->core); in hdmi4_probe()
794 r = -ENODEV; in hdmi4_probe()
798 r = devm_request_threaded_irq(&pdev->dev, irq, in hdmi4_probe()
806 hdmi->vdda_reg = devm_regulator_get(&pdev->dev, "vdda"); in hdmi4_probe()
807 if (IS_ERR(hdmi->vdda_reg)) { in hdmi4_probe()
808 r = PTR_ERR(hdmi->vdda_reg); in hdmi4_probe()
809 if (r != -EPROBE_DEFER) in hdmi4_probe()
814 pm_runtime_enable(&pdev->dev); in hdmi4_probe()
820 r = component_add(&pdev->dev, &hdmi4_component_ops); in hdmi4_probe()
829 pm_runtime_disable(&pdev->dev); in hdmi4_probe()
839 component_del(&pdev->dev, &hdmi4_component_ops); in hdmi4_remove()
843 pm_runtime_disable(&pdev->dev); in hdmi4_remove()
849 { .compatible = "ti,omap4-hdmi", },