__func__, OMAP4_SFH7741_ENABLE_GPIO, error);
 }
 
-static struct gpio sdp4430_hdmi_gpios[] = {
-       { HDMI_GPIO_CT_CP_HPD, GPIOF_OUT_INIT_HIGH, "hdmi_gpio_ct_cp_hpd" },
-       { HDMI_GPIO_LS_OE,      GPIOF_OUT_INIT_HIGH,    "hdmi_gpio_ls_oe" },
-       { HDMI_GPIO_HPD, GPIOF_DIR_IN, "hdmi_gpio_hpd" },
-};
-
-static int sdp4430_panel_enable_hdmi(struct omap_dss_device *dssdev)
-{
-       int status;
-
-       status = gpio_request_array(sdp4430_hdmi_gpios,
-                                   ARRAY_SIZE(sdp4430_hdmi_gpios));
-       if (status)
-               pr_err("%s: Cannot request HDMI GPIOs\n", __func__);
-
-       return status;
-}
-
-static void sdp4430_panel_disable_hdmi(struct omap_dss_device *dssdev)
-{
-       gpio_free_array(sdp4430_hdmi_gpios, ARRAY_SIZE(sdp4430_hdmi_gpios));
-}
-
 static struct nokia_dsi_panel_data dsi1_panel = {
                .name           = "taal",
                .reset_gpio     = 102,
 };
 
 static struct omap_dss_hdmi_data sdp4430_hdmi_data = {
+       .ct_cp_hpd_gpio = HDMI_GPIO_CT_CP_HPD,
+       .ls_oe_gpio = HDMI_GPIO_LS_OE,
        .hpd_gpio = HDMI_GPIO_HPD,
 };
 
        .name = "hdmi",
        .driver_name = "hdmi_panel",
        .type = OMAP_DISPLAY_TYPE_HDMI,
-       .platform_enable = sdp4430_panel_enable_hdmi,
-       .platform_disable = sdp4430_panel_disable_hdmi,
        .channel = OMAP_DSS_CHANNEL_DIGIT,
        .data = &sdp4430_hdmi_data,
 };
 
        .channel                = OMAP_DSS_CHANNEL_LCD2,
 };
 
-static struct gpio panda_hdmi_gpios[] = {
-       { HDMI_GPIO_CT_CP_HPD, GPIOF_OUT_INIT_HIGH, "hdmi_gpio_ct_cp_hpd" },
-       { HDMI_GPIO_LS_OE,      GPIOF_OUT_INIT_HIGH, "hdmi_gpio_ls_oe" },
-       { HDMI_GPIO_HPD, GPIOF_DIR_IN, "hdmi_gpio_hpd" },
-};
-
-static int omap4_panda_panel_enable_hdmi(struct omap_dss_device *dssdev)
-{
-       int status;
-
-       status = gpio_request_array(panda_hdmi_gpios,
-                                   ARRAY_SIZE(panda_hdmi_gpios));
-       if (status)
-               pr_err("Cannot request HDMI GPIOs\n");
-
-       return status;
-}
-
-static void omap4_panda_panel_disable_hdmi(struct omap_dss_device *dssdev)
-{
-       gpio_free_array(panda_hdmi_gpios, ARRAY_SIZE(panda_hdmi_gpios));
-}
-
 static struct omap_dss_hdmi_data omap4_panda_hdmi_data = {
+       .ct_cp_hpd_gpio = HDMI_GPIO_CT_CP_HPD,
+       .ls_oe_gpio = HDMI_GPIO_LS_OE,
        .hpd_gpio = HDMI_GPIO_HPD,
 };
 
        .name = "hdmi",
        .driver_name = "hdmi_panel",
        .type = OMAP_DISPLAY_TYPE_HDMI,
-       .platform_enable = omap4_panda_panel_enable_hdmi,
-       .platform_disable = omap4_panda_panel_disable_hdmi,
        .channel = OMAP_DSS_CHANNEL_DIGIT,
        .data = &omap4_panda_hdmi_data,
 };
 
 #include <linux/platform_device.h>
 #include <linux/pm_runtime.h>
 #include <linux/clk.h>
+#include <linux/gpio.h>
 #include <video/omapdss.h>
 
 #include "ti_hdmi.h"
        struct hdmi_ip_data ip_data;
 
        struct clk *sys_clk;
+
+       int ct_cp_hpd_gpio;
+       int ls_oe_gpio;
+       int hpd_gpio;
 } hdmi;
 
 /*
 
 static int __init hdmi_init_display(struct omap_dss_device *dssdev)
 {
+       int r;
+
+       struct gpio gpios[] = {
+               { hdmi.ct_cp_hpd_gpio, GPIOF_OUT_INIT_LOW, "hdmi_ct_cp_hpd" },
+               { hdmi.ls_oe_gpio, GPIOF_OUT_INIT_LOW, "hdmi_ls_oe" },
+               { hdmi.hpd_gpio, GPIOF_DIR_IN, "hdmi_hpd" },
+       };
+
        DSSDBG("init_display\n");
 
        dss_init_hdmi_ip_ops(&hdmi.ip_data);
+
+       r = gpio_request_array(gpios, ARRAY_SIZE(gpios));
+       if (r)
+               return r;
+
        return 0;
 }
 
+static void __exit hdmi_uninit_display(struct omap_dss_device *dssdev)
+{
+       DSSDBG("uninit_display\n");
+
+       gpio_free(hdmi.ct_cp_hpd_gpio);
+       gpio_free(hdmi.ls_oe_gpio);
+       gpio_free(hdmi.hpd_gpio);
+}
+
 static const struct hdmi_config *hdmi_find_timing(
                                        const struct hdmi_config *timings_arr,
                                        int len)
        struct omap_video_timings *p;
        unsigned long phy;
 
+       gpio_set_value(hdmi.ct_cp_hpd_gpio, 1);
+       gpio_set_value(hdmi.ls_oe_gpio, 1);
+
        r = hdmi_runtime_get();
        if (r)
-               return r;
+               goto err_runtime_get;
 
        dss_mgr_disable(dssdev->manager);
 
        r = hdmi.ip_data.ops->pll_enable(&hdmi.ip_data);
        if (r) {
                DSSDBG("Failed to lock PLL\n");
-               goto err;
+               goto err_pll_enable;
        }
 
        r = hdmi.ip_data.ops->phy_enable(&hdmi.ip_data);
        hdmi.ip_data.ops->phy_disable(&hdmi.ip_data);
 err_phy_enable:
        hdmi.ip_data.ops->pll_disable(&hdmi.ip_data);
-err:
+err_pll_enable:
        hdmi_runtime_put();
+err_runtime_get:
+       gpio_set_value(hdmi.ct_cp_hpd_gpio, 0);
+       gpio_set_value(hdmi.ls_oe_gpio, 0);
        return -EIO;
 }
 
        hdmi.ip_data.ops->phy_disable(&hdmi.ip_data);
        hdmi.ip_data.ops->pll_disable(&hdmi.ip_data);
        hdmi_runtime_put();
+
+       gpio_set_value(hdmi.ct_cp_hpd_gpio, 0);
+       gpio_set_value(hdmi.ls_oe_gpio, 0);
 }
 
 int omapdss_hdmi_display_check_timing(struct omap_dss_device *dssdev,
 
 int omapdss_hdmi_display_enable(struct omap_dss_device *dssdev)
 {
-       struct omap_dss_hdmi_data *priv = dssdev->data;
        int r = 0;
 
        DSSDBG("ENTER hdmi_display_enable\n");
                goto err0;
        }
 
-       hdmi.ip_data.hpd_gpio = priv->hpd_gpio;
+       hdmi.ip_data.hpd_gpio = hdmi.hpd_gpio;
 
        r = omap_dss_start_device(dssdev);
        if (r) {
                goto err0;
        }
 
-       if (dssdev->platform_enable) {
-               r = dssdev->platform_enable(dssdev);
-               if (r) {
-                       DSSERR("failed to enable GPIO's\n");
-                       goto err1;
-               }
-       }
-
        r = hdmi_power_on(dssdev);
        if (r) {
                DSSERR("failed to power on device\n");
-               goto err2;
+               goto err1;
        }
 
        mutex_unlock(&hdmi.lock);
        return 0;
 
-err2:
-       if (dssdev->platform_disable)
-               dssdev->platform_disable(dssdev);
 err1:
        omap_dss_stop_device(dssdev);
 err0:
 
        hdmi_power_off(dssdev);
 
-       if (dssdev->platform_disable)
-               dssdev->platform_disable(dssdev);
-
        omap_dss_stop_device(dssdev);
 
        mutex_unlock(&hdmi.lock);
 
        for (i = 0; i < pdata->num_devices; ++i) {
                struct omap_dss_device *dssdev = pdata->devices[i];
+               struct omap_dss_hdmi_data *priv = dssdev->data;
 
                if (dssdev->type != OMAP_DISPLAY_TYPE_HDMI)
                        continue;
 
+               hdmi.ct_cp_hpd_gpio = priv->ct_cp_hpd_gpio;
+               hdmi.ls_oe_gpio = priv->ls_oe_gpio;
+               hdmi.hpd_gpio = priv->hpd_gpio;
+
                r = hdmi_init_display(dssdev);
                if (r) {
                        DSSERR("device %s init failed: %d\n", dssdev->name, r);
        return 0;
 }
 
+static int __exit hdmi_remove_child(struct device *dev, void *data)
+{
+       struct omap_dss_device *dssdev = to_dss_device(dev);
+       hdmi_uninit_display(dssdev);
+       return 0;
+}
+
 static int __exit omapdss_hdmihw_remove(struct platform_device *pdev)
 {
+       device_for_each_child(&pdev->dev, NULL, hdmi_remove_child);
+
        omap_dss_unregister_child_devices(&pdev->dev);
 
        hdmi_panel_exit();