video: tegra: hdmi: Port the hpd_switch to the hdmi2.0 driver
Aly Hirani [Thu, 6 Nov 2014 00:07:14 +0000 (16:07 -0800)]
The HDMI driver had the hpd_switch which signals to the userspace
when the HDMI is ready (after EDID parsing). Android currently
uses this switch to figure out when a hot plug has occurred. This
is technically an abuse of the switch api and we should refactor
this to a cleaner implementation later.

Bug 1570417

Change-Id: I4b233fc29a506f576555b1b7e1bacc6b06c818e7
Signed-off-by: Aly Hirani <ahirani@nvidia.com>
Reviewed-on: http://git-master/r/594608
Reviewed-by: Jon Mayo <jmayo@nvidia.com>
Tested-by: Jon Mayo <jmayo@nvidia.com>

drivers/video/tegra/dc/hdmi2.0.c
drivers/video/tegra/dc/hdmi2.0.h

index 0b3d136..7521a9b 100644 (file)
@@ -569,6 +569,7 @@ static void tegra_hdmi_hotplug_notify(struct tegra_hdmi *hdmi,
        tegra_dc_ext_process_hotplug(dc->ndev->id);
 
 #ifdef CONFIG_SWITCH
+       switch_set_state(&hdmi->hpd_switch, is_asserted ? 1 : 0);
        switch_set_state(&hdmi->audio_switch, is_asserted ? 1 : 0);
 #endif
 }
@@ -903,6 +904,12 @@ static int tegra_dc_hdmi_init(struct tegra_dc *dc)
        tegra_dc_set_outdata(dc, hdmi);
 
 #ifdef CONFIG_SWITCH
+       hdmi->hpd_switch.name = "hdmi";
+       err = switch_dev_register(&hdmi->hpd_switch);
+       if (err)
+               dev_err(&dc->ndev->dev,
+                       "hdmi: failed to register hpd switch %d\n", err);
+
        hdmi->audio_switch.name = "hdmi_audio";
        err = switch_dev_register(&hdmi->audio_switch);
        if (err)
@@ -929,6 +936,7 @@ static void tegra_dc_hdmi_destroy(struct tegra_dc *dc)
        tegra_prod_release(&hdmi->prod_list);
 
 #ifdef CONFIG_SWITCH
+       switch_dev_unregister(&hdmi->hpd_switch);
        switch_dev_unregister(&hdmi->audio_switch);
 #endif
        clk_put(hdmi->hda_clk);
index 0ae2f2e..bdee57f 100644 (file)
@@ -300,6 +300,7 @@ struct tegra_hdmi {
        struct clk *hda2codec_clk;
        struct clk *hda2hdmi_clk;
 #ifdef CONFIG_SWITCH
+       struct switch_dev hpd_switch;
        struct switch_dev audio_switch;
 #endif