Lines Matching refs:hdmi

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