Lines Matching refs:hdmi

31 #include <sound/omap-hdmi-audio.h>
40 static int hdmi_runtime_get(struct omap_hdmi *hdmi)
46 r = pm_runtime_get_sync(&hdmi->pdev->dev);
54 static void hdmi_runtime_put(struct omap_hdmi *hdmi)
60 r = pm_runtime_put_sync(&hdmi->pdev->dev);
66 struct omap_hdmi *hdmi = data;
67 struct hdmi_wp_data *wp = &hdmi->wp;
90 v = hdmi_read_reg(hdmi->phy.base, HDMI_TXPHY_PAD_CFG_CTRL);
93 hdmi_write_reg(hdmi->phy.base, HDMI_TXPHY_PAD_CFG_CTRL, v);
100 REG_FLD_MOD(hdmi->phy.base, HDMI_TXPHY_PAD_CFG_CTRL, 0, 15, 15);
111 static int hdmi_power_on_core(struct omap_hdmi *hdmi)
115 r = regulator_enable(hdmi->vdda_reg);
119 r = hdmi_runtime_get(hdmi);
124 dss_select_hdmi_venc_clk_source(hdmi->dss, DSS_HDMI_M_PCLK);
126 hdmi->core_enabled = true;
131 regulator_disable(hdmi->vdda_reg);
136 static void hdmi_power_off_core(struct omap_hdmi *hdmi)
138 hdmi->core_enabled = false;
140 hdmi_runtime_put(hdmi);
141 regulator_disable(hdmi->vdda_reg);
144 static int hdmi_power_on_full(struct omap_hdmi *hdmi)
151 r = hdmi_power_on_core(hdmi);
155 vm = &hdmi->cfg.vm;
167 dss_pll_calc_b(&hdmi->pll.pll, clk_get_rate(hdmi->pll.pll.clkin),
171 hdmi_wp_clear_irqenable(&hdmi->wp, 0xffffffff);
172 hdmi_wp_set_irqstatus(&hdmi->wp,
173 hdmi_wp_get_irqstatus(&hdmi->wp));
175 r = dss_pll_enable(&hdmi->pll.pll);
181 r = dss_pll_set_config(&hdmi->pll.pll, &hdmi_cinfo);
187 r = hdmi_phy_configure(&hdmi->phy, hdmi_cinfo.clkdco,
194 r = hdmi_wp_set_phy_pwr(&hdmi->wp, HDMI_PHYPWRCMD_LDOON);
198 hdmi5_configure(&hdmi->core, &hdmi->wp, &hdmi->cfg);
200 r = dss_mgr_enable(&hdmi->output);
204 r = hdmi_wp_video_start(&hdmi->wp);
208 hdmi_wp_set_irqenable(&hdmi->wp,
214 dss_mgr_disable(&hdmi->output);
216 hdmi_wp_set_phy_pwr(&hdmi->wp, HDMI_PHYPWRCMD_OFF);
220 dss_pll_disable(&hdmi->pll.pll);
222 hdmi_power_off_core(hdmi);
226 static void hdmi_power_off_full(struct omap_hdmi *hdmi)
228 hdmi_wp_clear_irqenable(&hdmi->wp, 0xffffffff);
230 hdmi_wp_video_stop(&hdmi->wp);
232 dss_mgr_disable(&hdmi->output);
234 hdmi_wp_set_phy_pwr(&hdmi->wp, HDMI_PHYPWRCMD_OFF);
236 dss_pll_disable(&hdmi->pll.pll);
238 hdmi_power_off_core(hdmi);
243 struct omap_hdmi *hdmi = s->private;
245 mutex_lock(&hdmi->lock);
247 if (hdmi_runtime_get(hdmi)) {
248 mutex_unlock(&hdmi->lock);
252 hdmi_wp_dump(&hdmi->wp, s);
253 hdmi_pll_dump(&hdmi->pll, s);
254 hdmi_phy_dump(&hdmi->phy, s);
255 hdmi5_core_dump(&hdmi->core, s);
257 hdmi_runtime_put(hdmi);
258 mutex_unlock(&hdmi->lock);
276 static int hdmi_core_enable(struct omap_hdmi *hdmi)
282 mutex_lock(&hdmi->lock);
284 r = hdmi_power_on_core(hdmi);
290 mutex_unlock(&hdmi->lock);
294 mutex_unlock(&hdmi->lock);
298 static void hdmi_core_disable(struct omap_hdmi *hdmi)
302 mutex_lock(&hdmi->lock);
304 hdmi_power_off_core(hdmi);
306 mutex_unlock(&hdmi->lock);
316 struct omap_hdmi *hdmi = drm_bridge_to_hdmi(bridge);
321 return drm_bridge_attach(bridge->encoder, hdmi->output.next_bridge,
329 struct omap_hdmi *hdmi = drm_bridge_to_hdmi(bridge);
331 mutex_lock(&hdmi->lock);
333 drm_display_mode_to_videomode(adjusted_mode, &hdmi->cfg.vm);
335 dispc_set_tv_pclk(hdmi->dss->dispc, adjusted_mode->clock * 1000);
337 mutex_unlock(&hdmi->lock);
343 struct omap_hdmi *hdmi = drm_bridge_to_hdmi(bridge);
366 hdmi->cfg.hdmi_dvi_mode = connector->display_info.is_hdmi
377 hdmi->cfg.infoframe = avi;
380 mutex_lock(&hdmi->lock);
382 ret = hdmi_power_on_full(hdmi);
388 if (hdmi->audio_configured) {
389 ret = hdmi5_audio_config(&hdmi->core, &hdmi->wp,
390 &hdmi->audio_config,
391 hdmi->cfg.vm.pixelclock);
394 hdmi->audio_abort_cb(&hdmi->pdev->dev);
395 hdmi->audio_configured = false;
399 spin_lock_irqsave(&hdmi->audio_playing_lock, flags);
400 if (hdmi->audio_configured && hdmi->audio_playing)
401 hdmi_start_audio_stream(hdmi);
402 hdmi->display_enabled = true;
403 spin_unlock_irqrestore(&hdmi->audio_playing_lock, flags);
406 mutex_unlock(&hdmi->lock);
412 struct omap_hdmi *hdmi = drm_bridge_to_hdmi(bridge);
415 mutex_lock(&hdmi->lock);
417 spin_lock_irqsave(&hdmi->audio_playing_lock, flags);
418 hdmi_stop_audio_stream(hdmi);
419 hdmi->display_enabled = false;
420 spin_unlock_irqrestore(&hdmi->audio_playing_lock, flags);
422 hdmi_power_off_full(hdmi);
424 mutex_unlock(&hdmi->lock);
430 struct omap_hdmi *hdmi = drm_bridge_to_hdmi(bridge);
436 need_enable = hdmi->core_enabled == false;
439 r = hdmi_core_enable(hdmi);
444 mutex_lock(&hdmi->lock);
445 r = hdmi_runtime_get(hdmi);
448 idlemode = REG_GET(hdmi->wp.base, HDMI_WP_SYSCONFIG, 3, 2);
450 REG_FLD_MOD(hdmi->wp.base, HDMI_WP_SYSCONFIG, 1, 3, 2);
452 hdmi5_core_ddc_init(&hdmi->core);
454 edid = drm_do_get_edid(connector, hdmi5_core_ddc_read, &hdmi->core);
456 hdmi5_core_ddc_uninit(&hdmi->core);
458 REG_FLD_MOD(hdmi->wp.base, HDMI_WP_SYSCONFIG, idlemode, 3, 2);
460 hdmi_runtime_put(hdmi);
461 mutex_unlock(&hdmi->lock);
464 hdmi_core_disable(hdmi);
480 static void hdmi5_bridge_init(struct omap_hdmi *hdmi)
482 hdmi->bridge.funcs = &hdmi5_bridge_funcs;
483 hdmi->bridge.of_node = hdmi->pdev->dev.of_node;
484 hdmi->bridge.ops = DRM_BRIDGE_OP_EDID;
485 hdmi->bridge.type = DRM_MODE_CONNECTOR_HDMIA;
487 drm_bridge_add(&hdmi->bridge);
490 static void hdmi5_bridge_cleanup(struct omap_hdmi *hdmi)
492 drm_bridge_remove(&hdmi->bridge);
595 static int hdmi_audio_register(struct omap_hdmi *hdmi)
598 .dev = &hdmi->pdev->dev,
600 .audio_dma_addr = hdmi_wp_get_audio_dma_addr(&hdmi->wp),
604 hdmi->audio_pdev = platform_device_register_data(
605 &hdmi->pdev->dev, "omap-hdmi-audio", PLATFORM_DEVID_AUTO,
608 if (IS_ERR(hdmi->audio_pdev))
609 return PTR_ERR(hdmi->audio_pdev);
611 hdmi_runtime_get(hdmi);
612 hdmi->wp_idlemode =
613 REG_GET(hdmi->wp.base, HDMI_WP_SYSCONFIG, 3, 2);
614 hdmi_runtime_put(hdmi);
626 struct omap_hdmi *hdmi = dev_get_drvdata(dev);
629 hdmi->dss = dss;
631 r = hdmi_pll_init(dss, hdmi->pdev, &hdmi->pll, &hdmi->wp);
635 r = hdmi_audio_register(hdmi);
641 hdmi->debugfs = dss_debugfs_create_file(dss, "hdmi", hdmi_dump_regs,
642 hdmi);
647 hdmi_pll_uninit(&hdmi->pll);
653 struct omap_hdmi *hdmi = dev_get_drvdata(dev);
655 dss_debugfs_remove_file(hdmi->debugfs);
657 if (hdmi->audio_pdev)
658 platform_device_unregister(hdmi->audio_pdev);
660 hdmi_pll_uninit(&hdmi->pll);
672 static int hdmi5_init_output(struct omap_hdmi *hdmi)
674 struct omap_dss_device *out = &hdmi->output;
677 hdmi5_bridge_init(hdmi);
679 out->dev = &hdmi->pdev->dev;
682 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);
816 { .compatible = "ti,omap5-hdmi", },
817 { .compatible = "ti,dra7-hdmi", },