video: tegra: Add connected prop to hotplug event
Ivan Raul Guadarrama [Fri, 3 Jul 2015 18:42:17 +0000 (21:42 +0300)]
Modify the tegra_dc_ext_control_event_hotplug struct to include
a connected property, which enables sending the type of hotplug
event synchronously. This obviates the need to query the output
properties later through an ioctl, preventing the possibility
of the event type getting out of sync.

Bug 200110896

Change-Id: Id82730bc32315b008cdbe317edac91c61d41cc75
Signed-off-by: Ivan Raul Guadarrama <iguadarrama@nvidia.com>
Reviewed-on: http://git-master/r/766337
(cherry picked from commit a2b8259e05e37237a80f5246c2a960e70c7e6545)
Reviewed-on: http://git-master/r/769379
Reviewed-by: Venkat Moganty <vmoganty@nvidia.com>
Tested-by: Venkat Moganty <vmoganty@nvidia.com>

arch/arm/mach-tegra/include/mach/tegra_dc_ext.h
drivers/video/tegra/dc/dc.c
drivers/video/tegra/dc/ext/control.c
drivers/video/tegra/dc/ext/events.c
drivers/video/tegra/dc/ext/tegra_dc_ext_priv.h
drivers/video/tegra/dc/hdmi2.0.c
drivers/video/tegra/dc/hdmi_state_machine.c
drivers/video/tegra/dc/hpd.c
include/video/tegra_dc_ext.h

index ebdbd36..f74a79b 100644 (file)
@@ -36,7 +36,7 @@ void tegra_dc_ext_enable(struct tegra_dc_ext *dc_ext);
 int tegra_dc_ext_disable(struct tegra_dc_ext *dc_ext);
 int tegra_dc_ext_restore(struct tegra_dc_ext *dc_ext);
 
-int tegra_dc_ext_process_hotplug(int output);
+int tegra_dc_ext_process_hotplug(int output, bool connected);
 int tegra_dc_ext_process_vblank(int output, ktime_t timestamp);
 int tegra_dc_ext_process_bandwidth_renegotiate(int output,
                                        struct tegra_dc_bw_data *bw);
index 14778b8..9dd7a42 100644 (file)
@@ -987,8 +987,10 @@ static ssize_t dbg_dc_event_inject_write(struct file *file,
        }
 #endif
 #ifdef CONFIG_TEGRA_DC_EXTENSIONS
-       if (event == 0x0 || event == 0x1) /* TEGRA_DC_EXT_EVENT_HOTPLUG */
-               tegra_dc_ext_process_hotplug(dc->ndev->id);
+       if (event == 0x0) /* TEGRA_DC_EXT_EVENT_HOTPLUG (Connected) */
+               tegra_dc_ext_process_hotplug(dc->ndev->id, true);
+       else if (event == 0x1) /* TEGRA_DC_EXT_EVENT_HOTPLUG (Disconnected) */
+               tegra_dc_ext_process_hotplug(dc->ndev->id, false);
        else if (event == 0x2) /* TEGRA_DC_EXT_EVENT_BANDWIDTH_DEC */
                tegra_dc_ext_process_bandwidth_renegotiate(
                                dc->ndev->id, NULL);
index 4e4df39..8470c17 100644 (file)
@@ -42,9 +42,9 @@ struct tegra_dc_ext_control_output_edid32 {
 
 static struct tegra_dc_ext_control g_control;
 
-int tegra_dc_ext_process_hotplug(int output)
+int tegra_dc_ext_process_hotplug(int output, bool connected)
 {
-       return tegra_dc_ext_queue_hotplug(&g_control, output);
+       return tegra_dc_ext_queue_hotplug(&g_control, output, connected);
 }
 
 int tegra_dc_ext_process_vblank(int output, ktime_t timestamp)
index 123eda7..4ba361a 100644 (file)
@@ -181,7 +181,8 @@ static int tegra_dc_ext_queue_event(struct tegra_dc_ext_control *control,
        return retval;
 }
 
-int tegra_dc_ext_queue_hotplug(struct tegra_dc_ext_control *control, int output)
+int tegra_dc_ext_queue_hotplug(struct tegra_dc_ext_control *control, int output,
+                               bool connected)
 {
        struct {
                struct tegra_dc_ext_event event;
@@ -192,6 +193,7 @@ int tegra_dc_ext_queue_hotplug(struct tegra_dc_ext_control *control, int output)
        pack.event.data_size = sizeof(pack.hotplug);
 
        pack.hotplug.handle = output;
+       pack.hotplug.connected = connected;
 
        tegra_dc_ext_queue_event(control, &pack.event);
 
index 859a856..f8e95d8 100644 (file)
@@ -150,7 +150,7 @@ extern int tegra_dc_ext_cursor_clip(struct tegra_dc_ext_user *user,
 extern int tegra_dc_ext_control_init(void);
 
 extern int tegra_dc_ext_queue_hotplug(struct tegra_dc_ext_control *,
-                                     int output);
+                                     int output, bool connected);
 extern int tegra_dc_ext_queue_vblank(struct tegra_dc_ext_control *,
                                      int output, ktime_t timestamp);
 extern int tegra_dc_ext_queue_bandwidth_renegotiate(
index e5ffed7..b42d7bf 100644 (file)
@@ -672,7 +672,7 @@ static void tegra_hdmi_hotplug_notify(struct tegra_hdmi *hdmi,
 #endif
 
        dc->connected = is_asserted;
-       tegra_dc_ext_process_hotplug(dc->ndev->id);
+       tegra_dc_ext_process_hotplug(dc->ndev->id, is_asserted);
 
 #ifdef CONFIG_SWITCH
        switch_set_state(&hdmi->hpd_switch, is_asserted ? 1 : 0);
@@ -735,7 +735,7 @@ static int tegra_hdmi_disable(struct tegra_hdmi *hdmi)
 
        if (!hdmi->enabled) {
                dc->connected = false;
-               tegra_dc_ext_process_hotplug(dc->ndev->id);
+               tegra_dc_ext_process_hotplug(dc->ndev->id, false);
 #ifdef CONFIG_SWITCH
                switch_set_state(&hdmi->hpd_switch, 0);
 #endif
index 3032888..32ed7a5 100644 (file)
@@ -185,9 +185,6 @@ static void hdmi_disable_l(struct tegra_dc_hdmi_data *hdmi)
        if (hdmi->dc->connected) {
                pr_info("HDMI from connected to disconnected\n");
                tegra_dc_disable(hdmi->dc);
-#ifdef CONFIG_TEGRA_DC_EXTENSIONS
-               tegra_dc_ext_process_hotplug(hdmi->dc->ndev->id);
-#endif
        }
        hdmi->dc->connected = false;
 #ifdef CONFIG_ADF_TEGRA
@@ -196,7 +193,7 @@ static void hdmi_disable_l(struct tegra_dc_hdmi_data *hdmi)
        tegra_fb_update_monspecs(hdmi->dc->fb, NULL, NULL);
 #endif
 #ifdef CONFIG_TEGRA_DC_EXTENSIONS
-       tegra_dc_ext_process_hotplug(hdmi->dc->ndev->id);
+       tegra_dc_ext_process_hotplug(hdmi->dc->ndev->id, false);
 #endif
 }
 
@@ -299,7 +296,7 @@ static void handle_check_edid_l(struct tegra_dc_hdmi_data *hdmi)
        hdmi->dc->connected = true;
 
 #ifdef CONFIG_TEGRA_DC_EXTENSIONS
-       tegra_dc_ext_process_hotplug(hdmi->dc->ndev->id);
+       tegra_dc_ext_process_hotplug(hdmi->dc->ndev->id, true);
 #endif
 
        if (unlikely(tegra_is_clk_enabled(hdmi->clk))) {
index 266538e..c9b477c 100644 (file)
@@ -82,7 +82,7 @@ static void hpd_disable(struct tegra_hpd_data *data)
                data->ops->disable(data->drv_data);
 
 #ifdef CONFIG_TEGRA_DC_EXTENSIONS
-       tegra_dc_ext_process_hotplug(data->dc->ndev->id);
+       tegra_dc_ext_process_hotplug(data->dc->ndev->id, false);
 #endif
 }
 
@@ -210,7 +210,7 @@ static void edid_read_notify(struct tegra_hpd_data *data)
        data->dc->connected = true;
 
 #ifdef CONFIG_TEGRA_DC_EXTENSIONS
-       tegra_dc_ext_process_hotplug(data->dc->ndev->id);
+       tegra_dc_ext_process_hotplug(data->dc->ndev->id, true);
 #endif
 
        if (data->ops->edid_notify)
index a59ff41..71879d9 100644 (file)
@@ -592,6 +592,7 @@ struct tegra_dc_ext_event {
 #define TEGRA_DC_EXT_EVENT_HOTPLUG                     (1 << 0)
 struct tegra_dc_ext_control_event_hotplug {
        __u32 handle;
+       __u32 connected;
 };
 
 #define TEGRA_DC_EXT_EVENT_VBLANK                      (1 << 1)