Lines Matching refs:hdmi

31 #include <sound/omap-hdmi-audio.h>
41 static int hdmi_runtime_get(struct omap_hdmi *hdmi)
47 r = pm_runtime_get_sync(&hdmi->pdev->dev);
49 pm_runtime_put_noidle(&hdmi->pdev->dev);
55 static void hdmi_runtime_put(struct omap_hdmi *hdmi)
61 r = pm_runtime_put_sync(&hdmi->pdev->dev);
67 struct omap_hdmi *hdmi = data;
68 struct hdmi_wp_data *wp = &hdmi->wp;
91 v = hdmi_read_reg(hdmi->phy.base, HDMI_TXPHY_PAD_CFG_CTRL);
94 hdmi_write_reg(hdmi->phy.base, HDMI_TXPHY_PAD_CFG_CTRL, v);
101 REG_FLD_MOD(hdmi->phy.base, HDMI_TXPHY_PAD_CFG_CTRL, 0, 15, 15);
112 static int hdmi_power_on_core(struct omap_hdmi *hdmi)
116 r = regulator_enable(hdmi->vdda_reg);
120 r = hdmi_runtime_get(hdmi);
125 dss_select_hdmi_venc_clk_source(hdmi->dss, DSS_HDMI_M_PCLK);
127 hdmi->core_enabled = true;
132 regulator_disable(hdmi->vdda_reg);
137 static void hdmi_power_off_core(struct omap_hdmi *hdmi)
139 hdmi->core_enabled = false;
141 hdmi_runtime_put(hdmi);
142 regulator_disable(hdmi->vdda_reg);
145 static int hdmi_power_on_full(struct omap_hdmi *hdmi)
152 r = hdmi_power_on_core(hdmi);
156 vm = &hdmi->cfg.vm;
168 dss_pll_calc_b(&hdmi->pll.pll, clk_get_rate(hdmi->pll.pll.clkin),
172 hdmi_wp_clear_irqenable(&hdmi->wp, 0xffffffff);
173 hdmi_wp_set_irqstatus(&hdmi->wp,
174 hdmi_wp_get_irqstatus(&hdmi->wp));
176 r = dss_pll_enable(&hdmi->pll.pll);
182 r = dss_pll_set_config(&hdmi->pll.pll, &hdmi_cinfo);
188 r = hdmi_phy_configure(&hdmi->phy, hdmi_cinfo.clkdco,
195 r = hdmi_wp_set_phy_pwr(&hdmi->wp, HDMI_PHYPWRCMD_LDOON);
199 hdmi5_configure(&hdmi->core, &hdmi->wp, &hdmi->cfg);
201 r = dss_mgr_enable(&hdmi->output);
205 r = hdmi_wp_video_start(&hdmi->wp);
209 hdmi_wp_set_irqenable(&hdmi->wp,
215 dss_mgr_disable(&hdmi->output);
217 hdmi_wp_set_phy_pwr(&hdmi->wp, HDMI_PHYPWRCMD_OFF);
221 dss_pll_disable(&hdmi->pll.pll);
223 hdmi_power_off_core(hdmi);
227 static void hdmi_power_off_full(struct omap_hdmi *hdmi)
229 hdmi_wp_clear_irqenable(&hdmi->wp, 0xffffffff);
231 hdmi_wp_video_stop(&hdmi->wp);
233 dss_mgr_disable(&hdmi->output);
235 hdmi_wp_set_phy_pwr(&hdmi->wp, HDMI_PHYPWRCMD_OFF);
237 dss_pll_disable(&hdmi->pll.pll);
239 hdmi_power_off_core(hdmi);
244 struct omap_hdmi *hdmi = s->private;
246 mutex_lock(&hdmi->lock);
248 if (hdmi_runtime_get(hdmi)) {
249 mutex_unlock(&hdmi->lock);
253 hdmi_wp_dump(&hdmi->wp, s);
254 hdmi_pll_dump(&hdmi->pll, s);
255 hdmi_phy_dump(&hdmi->phy, s);
256 hdmi5_core_dump(&hdmi->core, s);
258 hdmi_runtime_put(hdmi);
259 mutex_unlock(&hdmi->lock);
277 static int hdmi_core_enable(struct omap_hdmi *hdmi)
283 mutex_lock(&hdmi->lock);
285 r = hdmi_power_on_core(hdmi);
291 mutex_unlock(&hdmi->lock);
295 mutex_unlock(&hdmi->lock);
299 static void hdmi_core_disable(struct omap_hdmi *hdmi)
303 mutex_lock(&hdmi->lock);
305 hdmi_power_off_core(hdmi);
307 mutex_unlock(&hdmi->lock);
317 struct omap_hdmi *hdmi = drm_bridge_to_hdmi(bridge);
322 return drm_bridge_attach(bridge->encoder, hdmi->output.next_bridge,
330 struct omap_hdmi *hdmi = drm_bridge_to_hdmi(bridge);
332 mutex_lock(&hdmi->lock);
334 drm_display_mode_to_videomode(adjusted_mode, &hdmi->cfg.vm);
336 dispc_set_tv_pclk(hdmi->dss->dispc, adjusted_mode->clock * 1000);
338 mutex_unlock(&hdmi->lock);
344 struct omap_hdmi *hdmi = drm_bridge_to_hdmi(bridge);
367 hdmi->cfg.hdmi_dvi_mode = connector->display_info.is_hdmi
378 hdmi->cfg.infoframe = avi;
381 mutex_lock(&hdmi->lock);
383 ret = hdmi_power_on_full(hdmi);
389 if (hdmi->audio_configured) {
390 ret = hdmi5_audio_config(&hdmi->core, &hdmi->wp,
391 &hdmi->audio_config,
392 hdmi->cfg.vm.pixelclock);
395 hdmi->audio_abort_cb(&hdmi->pdev->dev);
396 hdmi->audio_configured = false;
400 spin_lock_irqsave(&hdmi->audio_playing_lock, flags);
401 if (hdmi->audio_configured && hdmi->audio_playing)
402 hdmi_start_audio_stream(hdmi);
403 hdmi->display_enabled = true;
404 spin_unlock_irqrestore(&hdmi->audio_playing_lock, flags);
407 mutex_unlock(&hdmi->lock);
413 struct omap_hdmi *hdmi = drm_bridge_to_hdmi(bridge);
416 mutex_lock(&hdmi->lock);
418 spin_lock_irqsave(&hdmi->audio_playing_lock, flags);
419 hdmi_stop_audio_stream(hdmi);
420 hdmi->display_enabled = false;
421 spin_unlock_irqrestore(&hdmi->audio_playing_lock, flags);
423 hdmi_power_off_full(hdmi);
425 mutex_unlock(&hdmi->lock);
431 struct omap_hdmi *hdmi = drm_bridge_to_hdmi(bridge);
437 need_enable = hdmi->core_enabled == false;
440 r = hdmi_core_enable(hdmi);
445 mutex_lock(&hdmi->lock);
446 r = hdmi_runtime_get(hdmi);
449 idlemode = REG_GET(hdmi->wp.base, HDMI_WP_SYSCONFIG, 3, 2);
451 REG_FLD_MOD(hdmi->wp.base, HDMI_WP_SYSCONFIG, 1, 3, 2);
453 hdmi5_core_ddc_init(&hdmi->core);
455 edid = drm_do_get_edid(connector, hdmi5_core_ddc_read, &hdmi->core);
457 hdmi5_core_ddc_uninit(&hdmi->core);
459 REG_FLD_MOD(hdmi->wp.base, HDMI_WP_SYSCONFIG, idlemode, 3, 2);
461 hdmi_runtime_put(hdmi);
462 mutex_unlock(&hdmi->lock);
465 hdmi_core_disable(hdmi);
481 static void hdmi5_bridge_init(struct omap_hdmi *hdmi)
483 hdmi->bridge.funcs = &hdmi5_bridge_funcs;
484 hdmi->bridge.of_node = hdmi->pdev->dev.of_node;
485 hdmi->bridge.ops = DRM_BRIDGE_OP_EDID;
486 hdmi->bridge.type = DRM_MODE_CONNECTOR_HDMIA;
488 drm_bridge_add(&hdmi->bridge);
491 static void hdmi5_bridge_cleanup(struct omap_hdmi *hdmi)
493 drm_bridge_remove(&hdmi->bridge);
596 static int hdmi_audio_register(struct omap_hdmi *hdmi)
599 .dev = &hdmi->pdev->dev,
601 .audio_dma_addr = hdmi_wp_get_audio_dma_addr(&hdmi->wp),
605 hdmi->audio_pdev = platform_device_register_data(
606 &hdmi->pdev->dev, "omap-hdmi-audio", PLATFORM_DEVID_AUTO,
609 if (IS_ERR(hdmi->audio_pdev))
610 return PTR_ERR(hdmi->audio_pdev);
612 hdmi_runtime_get(hdmi);
613 hdmi->wp_idlemode =
614 REG_GET(hdmi->wp.base, HDMI_WP_SYSCONFIG, 3, 2);
615 hdmi_runtime_put(hdmi);
627 struct omap_hdmi *hdmi = dev_get_drvdata(dev);
630 hdmi->dss = dss;
632 r = hdmi_pll_init(dss, hdmi->pdev, &hdmi->pll, &hdmi->wp);
636 r = hdmi_audio_register(hdmi);
642 hdmi->debugfs = dss_debugfs_create_file(dss, "hdmi", hdmi_dump_regs,
643 hdmi);
648 hdmi_pll_uninit(&hdmi->pll);
654 struct omap_hdmi *hdmi = dev_get_drvdata(dev);
656 dss_debugfs_remove_file(hdmi->debugfs);
658 if (hdmi->audio_pdev)
659 platform_device_unregister(hdmi->audio_pdev);
661 hdmi_pll_uninit(&hdmi->pll);
673 static int hdmi5_init_output(struct omap_hdmi *hdmi)
675 struct omap_dss_device *out = &hdmi->output;
678 hdmi5_bridge_init(hdmi);
680 out->dev = &hdmi->pdev->dev;
683 out->name = "hdmi.0";
687 r = omapdss_device_init_output(out, &hdmi->bridge);
689 hdmi5_bridge_cleanup(hdmi);
698 static void hdmi5_uninit_output(struct omap_hdmi *hdmi)
700 struct omap_dss_device *out = &hdmi->output;
705 hdmi5_bridge_cleanup(hdmi);
708 static int hdmi5_probe_of(struct omap_hdmi *hdmi)
710 struct platform_device *pdev = hdmi->pdev;
719 r = hdmi_parse_lanes_of(pdev, ep, &hdmi->phy);
726 struct omap_hdmi *hdmi;
730 hdmi = kzalloc(sizeof(*hdmi), GFP_KERNEL);
731 if (!hdmi)
734 hdmi->pdev = pdev;
736 dev_set_drvdata(&pdev->dev, hdmi);
738 mutex_init(&hdmi->lock);
739 spin_lock_init(&hdmi->audio_playing_lock);
741 r = hdmi5_probe_of(hdmi);
745 r = hdmi_wp_init(pdev, &hdmi->wp, 5);
749 r = hdmi_phy_init(pdev, &hdmi->phy, 5);
753 r = hdmi5_core_init(pdev, &hdmi->core);
766 IRQF_ONESHOT, "OMAP HDMI", hdmi);
772 hdmi->vdda_reg = devm_regulator_get(&pdev->dev, "vdda");
773 if (IS_ERR(hdmi->vdda_reg)) {
774 r = PTR_ERR(hdmi->vdda_reg);
782 r = hdmi5_init_output(hdmi);
793 hdmi5_uninit_output(hdmi);
797 kfree(hdmi);
803 struct omap_hdmi *hdmi = platform_get_drvdata(pdev);
807 hdmi5_uninit_output(hdmi);
811 kfree(hdmi);
815 { .compatible = "ti,omap5-hdmi", },
816 { .compatible = "ti,dra7-hdmi", },