Lines Matching full:hdmi
2 * HDMI driver for OMAP5
25 #define DSS_SUBSYS_NAME "HDMI"
43 #include <sound/omap-hdmi-audio.h>
49 static int hdmi_runtime_get(struct omap_hdmi *hdmi) in hdmi_runtime_get() argument
55 r = pm_runtime_get_sync(&hdmi->pdev->dev); in hdmi_runtime_get()
63 static void hdmi_runtime_put(struct omap_hdmi *hdmi) in hdmi_runtime_put() argument
69 r = pm_runtime_put_sync(&hdmi->pdev->dev); in hdmi_runtime_put()
75 struct omap_hdmi *hdmi = data; in hdmi_irq_handler() local
76 struct hdmi_wp_data *wp = &hdmi->wp; in hdmi_irq_handler()
99 v = hdmi_read_reg(hdmi->phy.base, HDMI_TXPHY_PAD_CFG_CTRL); in hdmi_irq_handler()
102 hdmi_write_reg(hdmi->phy.base, HDMI_TXPHY_PAD_CFG_CTRL, v); in hdmi_irq_handler()
109 REG_FLD_MOD(hdmi->phy.base, HDMI_TXPHY_PAD_CFG_CTRL, 0, 15, 15); in hdmi_irq_handler()
120 static int hdmi_init_regulator(struct omap_hdmi *hdmi) in hdmi_init_regulator() argument
124 if (hdmi->vdda_reg != NULL) in hdmi_init_regulator()
127 reg = devm_regulator_get(&hdmi->pdev->dev, "vdda"); in hdmi_init_regulator()
133 hdmi->vdda_reg = reg; in hdmi_init_regulator()
138 static int hdmi_power_on_core(struct omap_hdmi *hdmi) in hdmi_power_on_core() argument
142 r = regulator_enable(hdmi->vdda_reg); in hdmi_power_on_core()
146 r = hdmi_runtime_get(hdmi); in hdmi_power_on_core()
150 /* Make selection of HDMI in DSS */ in hdmi_power_on_core()
151 dss_select_hdmi_venc_clk_source(hdmi->dss, DSS_HDMI_M_PCLK); in hdmi_power_on_core()
153 hdmi->core_enabled = true; in hdmi_power_on_core()
158 regulator_disable(hdmi->vdda_reg); in hdmi_power_on_core()
163 static void hdmi_power_off_core(struct omap_hdmi *hdmi) in hdmi_power_off_core() argument
165 hdmi->core_enabled = false; in hdmi_power_off_core()
167 hdmi_runtime_put(hdmi); in hdmi_power_off_core()
168 regulator_disable(hdmi->vdda_reg); in hdmi_power_off_core()
171 static int hdmi_power_on_full(struct omap_hdmi *hdmi) in hdmi_power_on_full() argument
178 r = hdmi_power_on_core(hdmi); in hdmi_power_on_full()
182 vm = &hdmi->cfg.vm; in hdmi_power_on_full()
194 dss_pll_calc_b(&hdmi->pll.pll, clk_get_rate(hdmi->pll.pll.clkin), in hdmi_power_on_full()
198 hdmi_wp_clear_irqenable(&hdmi->wp, 0xffffffff); in hdmi_power_on_full()
199 hdmi_wp_set_irqstatus(&hdmi->wp, in hdmi_power_on_full()
200 hdmi_wp_get_irqstatus(&hdmi->wp)); in hdmi_power_on_full()
202 r = dss_pll_enable(&hdmi->pll.pll); in hdmi_power_on_full()
208 r = dss_pll_set_config(&hdmi->pll.pll, &hdmi_cinfo); in hdmi_power_on_full()
214 r = hdmi_phy_configure(&hdmi->phy, hdmi_cinfo.clkdco, in hdmi_power_on_full()
221 r = hdmi_wp_set_phy_pwr(&hdmi->wp, HDMI_PHYPWRCMD_LDOON); in hdmi_power_on_full()
225 hdmi5_configure(&hdmi->core, &hdmi->wp, &hdmi->cfg); in hdmi_power_on_full()
228 dss_mgr_set_timings(&hdmi->output, vm); in hdmi_power_on_full()
230 r = dss_mgr_enable(&hdmi->output); in hdmi_power_on_full()
234 r = hdmi_wp_video_start(&hdmi->wp); in hdmi_power_on_full()
238 hdmi_wp_set_irqenable(&hdmi->wp, in hdmi_power_on_full()
244 dss_mgr_disable(&hdmi->output); in hdmi_power_on_full()
246 hdmi_wp_set_phy_pwr(&hdmi->wp, HDMI_PHYPWRCMD_OFF); in hdmi_power_on_full()
250 dss_pll_disable(&hdmi->pll.pll); in hdmi_power_on_full()
252 hdmi_power_off_core(hdmi); in hdmi_power_on_full()
256 static void hdmi_power_off_full(struct omap_hdmi *hdmi) in hdmi_power_off_full() argument
258 hdmi_wp_clear_irqenable(&hdmi->wp, 0xffffffff); in hdmi_power_off_full()
260 hdmi_wp_video_stop(&hdmi->wp); in hdmi_power_off_full()
262 dss_mgr_disable(&hdmi->output); in hdmi_power_off_full()
264 hdmi_wp_set_phy_pwr(&hdmi->wp, HDMI_PHYPWRCMD_OFF); in hdmi_power_off_full()
266 dss_pll_disable(&hdmi->pll.pll); in hdmi_power_off_full()
268 hdmi_power_off_core(hdmi); in hdmi_power_off_full()
274 struct omap_hdmi *hdmi = dssdev_to_hdmi(dssdev); in hdmi_display_check_timing() local
276 if (!dispc_mgr_timings_ok(hdmi->dss->dispc, dssdev->dispc_channel, vm)) in hdmi_display_check_timing()
285 struct omap_hdmi *hdmi = dssdev_to_hdmi(dssdev); in hdmi_display_set_timing() local
287 mutex_lock(&hdmi->lock); in hdmi_display_set_timing()
289 hdmi->cfg.vm = *vm; in hdmi_display_set_timing()
291 dispc_set_tv_pclk(hdmi->dss->dispc, vm->pixelclock); in hdmi_display_set_timing()
293 mutex_unlock(&hdmi->lock); in hdmi_display_set_timing()
299 struct omap_hdmi *hdmi = dssdev_to_hdmi(dssdev); in hdmi_display_get_timings() local
301 *vm = hdmi->cfg.vm; in hdmi_display_get_timings()
306 struct omap_hdmi *hdmi = s->private; in hdmi_dump_regs() local
308 mutex_lock(&hdmi->lock); in hdmi_dump_regs()
310 if (hdmi_runtime_get(hdmi)) { in hdmi_dump_regs()
311 mutex_unlock(&hdmi->lock); in hdmi_dump_regs()
315 hdmi_wp_dump(&hdmi->wp, s); in hdmi_dump_regs()
316 hdmi_pll_dump(&hdmi->pll, s); in hdmi_dump_regs()
317 hdmi_phy_dump(&hdmi->phy, s); in hdmi_dump_regs()
318 hdmi5_core_dump(&hdmi->core, s); in hdmi_dump_regs()
320 hdmi_runtime_put(hdmi); in hdmi_dump_regs()
321 mutex_unlock(&hdmi->lock); in hdmi_dump_regs()
325 static int read_edid(struct omap_hdmi *hdmi, u8 *buf, int len) in read_edid() argument
330 mutex_lock(&hdmi->lock); in read_edid()
332 r = hdmi_runtime_get(hdmi); in read_edid()
335 idlemode = REG_GET(hdmi->wp.base, HDMI_WP_SYSCONFIG, 3, 2); in read_edid()
337 REG_FLD_MOD(hdmi->wp.base, HDMI_WP_SYSCONFIG, 1, 3, 2); in read_edid()
339 r = hdmi5_read_edid(&hdmi->core, buf, len); in read_edid()
341 REG_FLD_MOD(hdmi->wp.base, HDMI_WP_SYSCONFIG, idlemode, 3, 2); in read_edid()
343 hdmi_runtime_put(hdmi); in read_edid()
344 mutex_unlock(&hdmi->lock); in read_edid()
365 struct omap_hdmi *hdmi = dssdev_to_hdmi(dssdev); in hdmi_display_enable() local
371 mutex_lock(&hdmi->lock); in hdmi_display_enable()
379 r = hdmi_power_on_full(hdmi); in hdmi_display_enable()
385 if (hdmi->audio_configured) { in hdmi_display_enable()
386 r = hdmi5_audio_config(&hdmi->core, &hdmi->wp, in hdmi_display_enable()
387 &hdmi->audio_config, in hdmi_display_enable()
388 hdmi->cfg.vm.pixelclock); in hdmi_display_enable()
391 hdmi->audio_abort_cb(&hdmi->pdev->dev); in hdmi_display_enable()
392 hdmi->audio_configured = false; in hdmi_display_enable()
396 spin_lock_irqsave(&hdmi->audio_playing_lock, flags); in hdmi_display_enable()
397 if (hdmi->audio_configured && hdmi->audio_playing) in hdmi_display_enable()
398 hdmi_start_audio_stream(hdmi); in hdmi_display_enable()
399 hdmi->display_enabled = true; in hdmi_display_enable()
400 spin_unlock_irqrestore(&hdmi->audio_playing_lock, flags); in hdmi_display_enable()
402 mutex_unlock(&hdmi->lock); in hdmi_display_enable()
406 mutex_unlock(&hdmi->lock); in hdmi_display_enable()
412 struct omap_hdmi *hdmi = dssdev_to_hdmi(dssdev); in hdmi_display_disable() local
417 mutex_lock(&hdmi->lock); in hdmi_display_disable()
419 spin_lock_irqsave(&hdmi->audio_playing_lock, flags); in hdmi_display_disable()
420 hdmi_stop_audio_stream(hdmi); in hdmi_display_disable()
421 hdmi->display_enabled = false; in hdmi_display_disable()
422 spin_unlock_irqrestore(&hdmi->audio_playing_lock, flags); in hdmi_display_disable()
424 hdmi_power_off_full(hdmi); in hdmi_display_disable()
426 mutex_unlock(&hdmi->lock); in hdmi_display_disable()
429 static int hdmi_core_enable(struct omap_hdmi *hdmi) in hdmi_core_enable() argument
435 mutex_lock(&hdmi->lock); in hdmi_core_enable()
437 r = hdmi_power_on_core(hdmi); in hdmi_core_enable()
443 mutex_unlock(&hdmi->lock); in hdmi_core_enable()
447 mutex_unlock(&hdmi->lock); in hdmi_core_enable()
451 static void hdmi_core_disable(struct omap_hdmi *hdmi) in hdmi_core_disable() argument
455 mutex_lock(&hdmi->lock); in hdmi_core_disable()
457 hdmi_power_off_core(hdmi); in hdmi_core_disable()
459 mutex_unlock(&hdmi->lock); in hdmi_core_disable()
465 struct omap_hdmi *hdmi = dssdev_to_hdmi(dssdev); in hdmi_connect() local
468 r = hdmi_init_regulator(hdmi); in hdmi_connect()
472 r = dss_mgr_connect(&hdmi->output, dssdev); in hdmi_connect()
480 dss_mgr_disconnect(&hdmi->output, dssdev); in hdmi_connect()
490 struct omap_hdmi *hdmi = dssdev_to_hdmi(dssdev); in hdmi_disconnect() local
499 dss_mgr_disconnect(&hdmi->output, dssdev); in hdmi_disconnect()
505 struct omap_hdmi *hdmi = dssdev_to_hdmi(dssdev); in hdmi_read_edid() local
509 need_enable = hdmi->core_enabled == false; in hdmi_read_edid()
512 r = hdmi_core_enable(hdmi); in hdmi_read_edid()
517 r = read_edid(hdmi, edid, len); in hdmi_read_edid()
520 hdmi_core_disable(hdmi); in hdmi_read_edid()
528 struct omap_hdmi *hdmi = dssdev_to_hdmi(dssdev); in hdmi_set_infoframe() local
530 hdmi->cfg.infoframe = *avi; in hdmi_set_infoframe()
537 struct omap_hdmi *hdmi = dssdev_to_hdmi(dssdev); in hdmi_set_hdmi_mode() local
539 hdmi->cfg.hdmi_dvi_mode = hdmi_mode ? HDMI_HDMI : HDMI_DVI; in hdmi_set_hdmi_mode()
559 static void hdmi_init_output(struct omap_hdmi *hdmi) in hdmi_init_output() argument
561 struct omap_dss_device *out = &hdmi->output; in hdmi_init_output()
563 out->dev = &hdmi->pdev->dev; in hdmi_init_output()
566 out->name = "hdmi.0"; in hdmi_init_output()
568 out->ops.hdmi = &hdmi_ops; in hdmi_init_output()
574 static void hdmi_uninit_output(struct omap_hdmi *hdmi) in hdmi_uninit_output() argument
576 struct omap_dss_device *out = &hdmi->output; in hdmi_uninit_output()
581 static int hdmi_probe_of(struct omap_hdmi *hdmi) in hdmi_probe_of() argument
583 struct platform_device *pdev = hdmi->pdev; in hdmi_probe_of()
592 r = hdmi_parse_lanes_of(pdev, ep, &hdmi->phy); in hdmi_probe_of()
701 static int hdmi_audio_register(struct omap_hdmi *hdmi) in hdmi_audio_register() argument
704 .dev = &hdmi->pdev->dev, in hdmi_audio_register()
706 .audio_dma_addr = hdmi_wp_get_audio_dma_addr(&hdmi->wp), in hdmi_audio_register()
710 hdmi->audio_pdev = platform_device_register_data( in hdmi_audio_register()
711 &hdmi->pdev->dev, "omap-hdmi-audio", PLATFORM_DEVID_AUTO, in hdmi_audio_register()
714 if (IS_ERR(hdmi->audio_pdev)) in hdmi_audio_register()
715 return PTR_ERR(hdmi->audio_pdev); in hdmi_audio_register()
717 hdmi_runtime_get(hdmi); in hdmi_audio_register()
718 hdmi->wp_idlemode = in hdmi_audio_register()
719 REG_GET(hdmi->wp.base, HDMI_WP_SYSCONFIG, 3, 2); in hdmi_audio_register()
720 hdmi_runtime_put(hdmi); in hdmi_audio_register()
725 /* HDMI HW IP initialisation */
730 struct omap_hdmi *hdmi; in hdmi5_bind() local
734 hdmi = kzalloc(sizeof(*hdmi), GFP_KERNEL); in hdmi5_bind()
735 if (!hdmi) in hdmi5_bind()
738 hdmi->pdev = pdev; in hdmi5_bind()
739 hdmi->dss = dss; in hdmi5_bind()
740 dev_set_drvdata(&pdev->dev, hdmi); in hdmi5_bind()
742 mutex_init(&hdmi->lock); in hdmi5_bind()
743 spin_lock_init(&hdmi->audio_playing_lock); in hdmi5_bind()
745 r = hdmi_probe_of(hdmi); in hdmi5_bind()
749 r = hdmi_wp_init(pdev, &hdmi->wp, 5); in hdmi5_bind()
753 r = hdmi_pll_init(dss, pdev, &hdmi->pll, &hdmi->wp); in hdmi5_bind()
757 r = hdmi_phy_init(pdev, &hdmi->phy, 5); in hdmi5_bind()
761 r = hdmi5_core_init(pdev, &hdmi->core); in hdmi5_bind()
774 IRQF_ONESHOT, "OMAP HDMI", hdmi); in hdmi5_bind()
776 DSSERR("HDMI IRQ request failed\n"); in hdmi5_bind()
782 hdmi_init_output(hdmi); in hdmi5_bind()
784 r = hdmi_audio_register(hdmi); in hdmi5_bind()
786 DSSERR("Registering HDMI audio failed %d\n", r); in hdmi5_bind()
787 hdmi_uninit_output(hdmi); in hdmi5_bind()
792 hdmi->debugfs = dss_debugfs_create_file(dss, "hdmi", hdmi_dump_regs, in hdmi5_bind()
793 hdmi); in hdmi5_bind()
798 hdmi_pll_uninit(&hdmi->pll); in hdmi5_bind()
800 kfree(hdmi); in hdmi5_bind()
806 struct omap_hdmi *hdmi = dev_get_drvdata(dev); in hdmi5_unbind() local
808 dss_debugfs_remove_file(hdmi->debugfs); in hdmi5_unbind()
810 if (hdmi->audio_pdev) in hdmi5_unbind()
811 platform_device_unregister(hdmi->audio_pdev); in hdmi5_unbind()
813 hdmi_uninit_output(hdmi); in hdmi5_unbind()
815 hdmi_pll_uninit(&hdmi->pll); in hdmi5_unbind()
819 kfree(hdmi); in hdmi5_unbind()
840 struct omap_hdmi *hdmi = dev_get_drvdata(dev); in hdmi_runtime_suspend() local
842 dispc_runtime_put(hdmi->dss->dispc); in hdmi_runtime_suspend()
849 struct omap_hdmi *hdmi = dev_get_drvdata(dev); in hdmi_runtime_resume() local
852 r = dispc_runtime_get(hdmi->dss->dispc); in hdmi_runtime_resume()
865 { .compatible = "ti,omap5-hdmi", },
866 { .compatible = "ti,dra7-hdmi", },