diff options
Diffstat (limited to 'drivers/video/omap2/dss/hdmi.c')
-rw-r--r-- | drivers/video/omap2/dss/hdmi.c | 107 |
1 files changed, 55 insertions, 52 deletions
diff --git a/drivers/video/omap2/dss/hdmi.c b/drivers/video/omap2/dss/hdmi.c index a109934c0478..e1c0992b522b 100644 --- a/drivers/video/omap2/dss/hdmi.c +++ b/drivers/video/omap2/dss/hdmi.c @@ -70,7 +70,7 @@ static struct { int ls_oe_gpio; int hpd_gpio; - struct omap_dss_output output; + struct omap_dss_device output; } hdmi; /* @@ -328,6 +328,29 @@ static void hdmi_runtime_put(void) WARN_ON(r < 0 && r != -ENOSYS); } +static int hdmi_init_regulator(void) +{ + struct regulator *reg; + + if (hdmi.vdda_hdmi_dac_reg != NULL) + return 0; + + reg = devm_regulator_get(&hdmi.pdev->dev, "vdda_hdmi_dac"); + + /* DT HACK: try VDAC to make omapdss work for o4 sdp/panda */ + if (IS_ERR(reg)) + reg = devm_regulator_get(&hdmi.pdev->dev, "VDAC"); + + if (IS_ERR(reg)) { + DSSERR("can't get VDDA_HDMI_DAC regulator\n"); + return PTR_ERR(reg); + } + + hdmi.vdda_hdmi_dac_reg = reg; + + return 0; +} + static int hdmi_init_display(struct omap_dss_device *dssdev) { int r; @@ -342,22 +365,9 @@ static int hdmi_init_display(struct omap_dss_device *dssdev) dss_init_hdmi_ip_ops(&hdmi.ip_data, omapdss_get_version()); - if (hdmi.vdda_hdmi_dac_reg == NULL) { - struct regulator *reg; - - reg = devm_regulator_get(&hdmi.pdev->dev, "vdda_hdmi_dac"); - - /* DT HACK: try VDAC to make omapdss work for o4 sdp/panda */ - if (IS_ERR(reg)) - reg = devm_regulator_get(&hdmi.pdev->dev, "VDAC"); - - if (IS_ERR(reg)) { - DSSERR("can't get VDDA_HDMI_DAC regulator\n"); - return PTR_ERR(reg); - } - - hdmi.vdda_hdmi_dac_reg = reg; - } + r = hdmi_init_regulator(); + if (r) + return r; r = gpio_request_array(gpios, ARRAY_SIZE(gpios)); if (r) @@ -455,12 +465,6 @@ end: return cm; } -unsigned long hdmi_get_pixel_clock(void) -{ - /* HDMI Pixel Clock in Mhz */ - return hdmi.ip_data.cfg.timings.pixel_clock * 1000; -} - static void hdmi_compute_pll(struct omap_dss_device *dssdev, int phy, struct hdmi_pll_info *pi) { @@ -550,7 +554,7 @@ static int hdmi_power_on_full(struct omap_dss_device *dssdev) { int r; struct omap_video_timings *p; - struct omap_overlay_manager *mgr = dssdev->output->manager; + struct omap_overlay_manager *mgr = hdmi.output.manager; unsigned long phy; r = hdmi_power_on_core(dssdev); @@ -613,7 +617,7 @@ err_pll_enable: static void hdmi_power_off_full(struct omap_dss_device *dssdev) { - struct omap_overlay_manager *mgr = dssdev->output->manager; + struct omap_overlay_manager *mgr = hdmi.output.manager; dss_mgr_disable(mgr); @@ -653,6 +657,8 @@ void omapdss_hdmi_display_set_timing(struct omap_dss_device *dssdev, if (t != NULL) hdmi.ip_data.cfg = *t; + dispc_set_tv_pclk(t->timings.pixel_clock * 1000); + mutex_unlock(&hdmi.lock); } @@ -700,7 +706,7 @@ bool omapdss_hdmi_detect(void) r = hdmi_runtime_get(); BUG_ON(r); - r = hdmi.ip_data.ops->detect(&hdmi.ip_data); + r = gpio_get_value(hdmi.hpd_gpio); hdmi_runtime_put(); mutex_unlock(&hdmi.lock); @@ -710,7 +716,7 @@ bool omapdss_hdmi_detect(void) int omapdss_hdmi_display_enable(struct omap_dss_device *dssdev) { - struct omap_dss_output *out = dssdev->output; + struct omap_dss_device *out = &hdmi.output; int r = 0; DSSDBG("ENTER hdmi_display_enable\n"); @@ -723,25 +729,15 @@ int omapdss_hdmi_display_enable(struct omap_dss_device *dssdev) goto err0; } - hdmi.ip_data.hpd_gpio = hdmi.hpd_gpio; - - r = omap_dss_start_device(dssdev); - if (r) { - DSSERR("failed to start device\n"); - goto err0; - } - r = hdmi_power_on_full(dssdev); if (r) { DSSERR("failed to power on device\n"); - goto err1; + goto err0; } mutex_unlock(&hdmi.lock); return 0; -err1: - omap_dss_stop_device(dssdev); err0: mutex_unlock(&hdmi.lock); return r; @@ -755,8 +751,6 @@ void omapdss_hdmi_display_disable(struct omap_dss_device *dssdev) hdmi_power_off_full(dssdev); - omap_dss_stop_device(dssdev); - mutex_unlock(&hdmi.lock); } @@ -768,8 +762,6 @@ int omapdss_hdmi_core_enable(struct omap_dss_device *dssdev) mutex_lock(&hdmi.lock); - hdmi.ip_data.hpd_gpio = hdmi.hpd_gpio; - r = hdmi_power_on_core(dssdev); if (r) { DSSERR("failed to power on device\n"); @@ -1035,20 +1027,21 @@ static int hdmi_probe_pdata(struct platform_device *pdev) static void hdmi_init_output(struct platform_device *pdev) { - struct omap_dss_output *out = &hdmi.output; + struct omap_dss_device *out = &hdmi.output; - out->pdev = pdev; + out->dev = &pdev->dev; out->id = OMAP_DSS_OUTPUT_HDMI; - out->type = OMAP_DISPLAY_TYPE_HDMI; + out->output_type = OMAP_DISPLAY_TYPE_HDMI; out->name = "hdmi.0"; out->dispc_channel = OMAP_DSS_CHANNEL_DIGIT; + out->owner = THIS_MODULE; dss_register_output(out); } static void __exit hdmi_uninit_output(struct platform_device *pdev) { - struct omap_dss_output *out = &hdmi.output; + struct omap_dss_device *out = &hdmi.output; dss_unregister_output(out); } @@ -1071,6 +1064,12 @@ static int omapdss_hdmihw_probe(struct platform_device *pdev) if (IS_ERR(hdmi.ip_data.base_wp)) return PTR_ERR(hdmi.ip_data.base_wp); + hdmi.ip_data.irq = platform_get_irq(pdev, 0); + if (hdmi.ip_data.irq < 0) { + DSSERR("platform_get_irq failed\n"); + return -ENODEV; + } + r = hdmi_get_clocks(pdev); if (r) { DSSERR("can't get clocks\n"); @@ -1094,15 +1093,19 @@ static int omapdss_hdmihw_probe(struct platform_device *pdev) dss_debugfs_create_file("hdmi", hdmi_dump_regs); - r = hdmi_probe_pdata(pdev); - if (r) { - hdmi_panel_exit(); - hdmi_uninit_output(pdev); - pm_runtime_disable(&pdev->dev); - return r; + if (pdev->dev.platform_data) { + r = hdmi_probe_pdata(pdev); + if (r) + goto err_probe; } return 0; + +err_probe: + hdmi_panel_exit(); + hdmi_uninit_output(pdev); + pm_runtime_disable(&pdev->dev); + return r; } static int __exit hdmi_remove_child(struct device *dev, void *data) |