GFX-Display: system no response after HDMI plug in
authorKe Ai <ke.ai@intel.com>
Mon, 2 Apr 2012 15:47:41 +0000 (23:47 +0800)
committerbuildbot <buildbot@intel.com>
Fri, 6 Apr 2012 15:24:18 +0000 (08:24 -0700)
BZ: 30219 30202

the hotplug workqueue has not been initialized for CTP

Change-Id: Ic8516b332894e9bd92bf6e541ed91ca376cabc30
Signed-off-by: Ke Ai <ke.ai@intel.com>
Reviewed-on: http://android.intel.com:8080/42161
Reviewed-by: Koskinen, Ilkka <ilkka.koskinen@intel.com>
Reviewed-by: Tong, BoX <box.tong@intel.com>
Tested-by: Tong, BoX <box.tong@intel.com>
Reviewed-by: buildbot <buildbot@intel.com>
Tested-by: buildbot <buildbot@intel.com>
drivers/staging/mrst/drv/mdfld_ti_tpd.c

index 000e9fa..96b793e 100644 (file)
@@ -69,51 +69,76 @@ irqreturn_t hdmi_hpd_handler(int irq, void *dev_id)
 static int __devinit ti_tpd_probe(struct pci_dev *pdev,
                const struct pci_device_id *ent)
 {
+       struct drm_device *dev = hdmi_priv ? hdmi_priv->dev : 0;
+       struct drm_psb_private *dev_priv = psb_priv(dev);
        int ret = 0;
 
        PSB_DEBUG_ENTRY("\n");
 
+       if (pdev->device != TI_TPD_PCI_DEVICE_ID) {
+               DRM_ERROR("%s: pciid = 0x%x is not ti_tpd pciid.\n",
+                         __func__, pdev->device);
+               ret = -EINVAL;
+               goto err0;
+       }
+
        /* enable HDMI COMPANION CHIP device */
        ret = pci_enable_device(pdev);
+       if (ret) {
+               DRM_ERROR("%s:Fail to enable pci devices\n",
+                               __func__);
+               goto err0;
+       }
+
+       ret = gpio_request(CLV_TI_HPD_GPIO_PIN, "ti_tpd_hdmi_hpd");
+       if (ret) {
+               DRM_ERROR("%s: Failed to request GPIO %d for kbd IRQ\n",
+                               __func__, CLV_TI_HPD_GPIO_PIN);
+               goto err1;
+       }
+
+       ret = gpio_direction_input(CLV_TI_HPD_GPIO_PIN);
+       if (ret) {
+               DRM_ERROR("%s: Failed to set GPIO %d as input\n",
+                               __func__, CLV_TI_HPD_GPIO_PIN);
+               goto err2;
+       }
 
-       if ((!ret) && (pdev->device == TI_TPD_PCI_DEVICE_ID)) {
-               ret = gpio_request(CLV_TI_HPD_GPIO_PIN, "ti_tpd_hdmi_hpd");
-               if (ret) {
-                       DRM_ERROR("%s: Failed to request GPIO %d for kbd IRQ\n",
-                                       __func__, CLV_TI_HPD_GPIO_PIN);
-                       goto out_err;
-               }
-
-               ret = gpio_direction_input(CLV_TI_HPD_GPIO_PIN);
-               if (ret) {
-                       DRM_ERROR("%s: Failed to set GPIO %d as input\n",
-                                       __func__, CLV_TI_HPD_GPIO_PIN);
-                       goto out_err;
-               }
-
-               ret = irq_set_irq_type(gpio_to_irq(CLV_TI_HPD_GPIO_PIN),
-                               IRQ_TYPE_EDGE_BOTH);
-               if (ret) {
-                       DRM_ERROR("%s: Failed to set HDMI HPD IRQ type\n",
-                                       __func__);
-                       goto out_err;
-               }
-
-               ret = request_irq(gpio_to_irq(CLV_TI_HPD_GPIO_PIN),
-                               hdmi_hpd_handler, IRQF_SHARED,
-                               "hdmi_hpd_handler", (void *)hdmi_priv);
-               if (ret) {
-                       DRM_ERROR("%s: Can not register GPIO %d IRQ!\n",
-                                       __func__, CLV_TI_HPD_GPIO_PIN);
-                       goto out_err;
-               }
-
-               PSB_DEBUG_ENTRY("%s: Requested HDMI HPD IRQ"
-                               "sussessfully.\n", __func__);
-               return ret;
+       ret = irq_set_irq_type(gpio_to_irq(CLV_TI_HPD_GPIO_PIN),
+                       IRQ_TYPE_EDGE_BOTH);
+       if (ret) {
+               DRM_ERROR("%s: Failed to set HDMI HPD IRQ type\n",
+                               __func__);
+               goto err2;
        }
 
-out_err:
+       dev_priv->hpd_detect = create_freezable_workqueue("hpd_detect");
+       if (dev_priv->hpd_detect == NULL) {
+               DRM_ERROR("%s: Creating workqueue failed", __func__);
+               ret = -ENOMEM;
+               goto err2;
+       }
+
+       ret = request_irq(gpio_to_irq(CLV_TI_HPD_GPIO_PIN),
+                       hdmi_hpd_handler, IRQF_SHARED,
+                       "hdmi_hpd_handler", (void *)hdmi_priv);
+       if (ret) {
+               DRM_ERROR("%s: Can not register GPIO %d IRQ!\n",
+                               __func__, CLV_TI_HPD_GPIO_PIN);
+               goto err3;
+       }
+
+       PSB_DEBUG_ENTRY("%s: Requested HDMI HPD IRQ"
+                       "sussessfully.\n", __func__);
+       return ret;
+
+err3:
+       destroy_workqueue(dev_priv->hpd_detect);
+err2:
+       gpio_free(CLV_TI_HPD_GPIO_PIN);
+err1:
+       pci_disable_device(pdev);
+err0:
        pci_dev_put(pdev);
        DRM_ERROR("%s: request_irq failed. ret = %d.\n", __func__, ret);
        return ret;