video: tegra: hdmi: serialize hotplug processing
Rakesh Iyer [Thu, 4 Apr 2013 00:23:51 +0000 (17:23 -0700)]
Serialize HDMI hot plug processing to handle boot init and spurious hotplugs.

Bug 1254317.

Change-Id: I7a695033eea659500c7b73da321ec3345084fa97
Signed-off-by: Rakesh Iyer <riyer@nvidia.com>
Reviewed-on: http://git-master/r/216321
Reviewed-by: Mrutyunjay Sawant <msawant@nvidia.com>
Tested-by: Mrutyunjay Sawant <msawant@nvidia.com>

drivers/video/tegra/dc/hdmi.c

index 2ec32bf..4d8b770 100644 (file)
@@ -874,9 +874,14 @@ static bool tegra_dc_hdmi_detect(struct tegra_dc *dc)
        struct fb_monspecs specs;
        int err;
 
+       mutex_lock(&dc->lock);
+
        if (!tegra_dc_hdmi_hpd(dc))
                goto fail;
 
+       if (dc->connected)
+               goto success;
+
        err = tegra_edid_get_monspecs(hdmi->edid, &specs);
        if (err < 0) {
                if (dc->out->n_modes)
@@ -904,9 +909,14 @@ static bool tegra_dc_hdmi_detect(struct tegra_dc *dc)
                tegra_dc_hdmi_detect_config(dc, &specs);
        }
 
+success:
+       mutex_unlock(&dc->lock);
+
        return true;
 
 fail:
+       mutex_unlock(&dc->lock);
+
        hdmi->eld_retrieved = false;
 #ifdef CONFIG_SWITCH
        switch_set_state(&hdmi->hpd_switch, 0);
@@ -926,7 +936,7 @@ static void tegra_dc_hdmi_detect_worker(struct work_struct *work)
        /* Set default videomode on dc before enabling it*/
        tegra_dc_set_default_videomode(dc);
 #endif
-       if (!tegra_dc_hdmi_detect(dc)) {
+       if (!tegra_dc_hdmi_detect(dc) && dc->connected) {
                dev_dbg(&dc->ndev->dev, "HDMI disconnect\n");
                dc->connected = false;
                tegra_dc_disable(dc);