static void hsic_aux_work(struct work_struct *work) { dev_dbg(&pci_dev->dev, "%s---->\n", __func__); if (hsic.modem_dev == NULL) { dev_dbg(&pci_dev->dev, "%s---->Modem not created\n", __func__); return; } mutex_lock(&hsic.hsic_mutex); /* Free the aux irq */ hsic_aux_irq_free(); dev_dbg(&pci_dev->dev, "%s---->AUX IRQ is disabled\n", __func__); if (hsic.hsic_stopped == 0) ehci_hsic_stop_host(pci_dev); hsic_enter_exit_d3(1); usleep_range(5000, 6000); hsic_enter_exit_d3(0); ehci_hsic_start_host(pci_dev); hsic.autosuspend_enable = 0; usb_disable_autosuspend(hsic.rh_dev); hsic.hsic_aux_finish = 1; wake_up(&hsic.aux_wq); mutex_unlock(&hsic.hsic_mutex); dev_dbg(&pci_dev->dev, "%s<----\n", __func__); return; }
static void hsic_aux_work(struct work_struct *work) { dev_dbg(&pci_dev->dev, "%s---->\n", __func__); mutex_lock(&hsic.hsic_mutex); #if 0 /* Free the aux irq */ hsic_aux_irq_free(); msleep(800); dev_dbg(&pci_dev->dev, "%s---->AUX IRQ is disabled\n", __func__); #endif if (hsic.hsic_stopped == 0) ush_hsic_port_disable(pci_dev); usleep_range(hsic.reenumeration_delay, hsic.reenumeration_delay + 1000); ush_hsic_port_enable(pci_dev); mutex_unlock(&hsic.hsic_mutex); hsic.hsic_aux_finish = 1; wake_up(&hsic.aux_wq); dev_dbg(&pci_dev->dev, "%s<----\n", __func__); return; }
static void xhci_ush_pci_remove(struct pci_dev *dev) { struct xhci_hcd *xhci; xhci = hcd_to_xhci(pci_get_drvdata(dev)); if (xhci->shared_hcd) { usb_remove_hcd(xhci->shared_hcd); usb_put_hcd(xhci->shared_hcd); } if (!pci_dev_run_wake(dev)) pm_runtime_get_noresume(&dev->dev); pm_runtime_forbid(&dev->dev); usb_hcd_pci_remove(dev); /* Free the aux irq */ hsic_aux_irq_free(); hsic_wakeup_irq_free(); gpio_free(hsic.aux_gpio); gpio_free(hsic.wakeup_gpio); hsic.hsic_stopped = 1; hsic_enable = 0; kfree(xhci); }
static void xhci_ush_pci_remove(struct pci_dev *dev) { struct xhci_hcd *xhci; xhci = hcd_to_xhci(pci_get_drvdata(dev)); if (xhci->shared_hcd) { usb_remove_hcd(xhci->shared_hcd); usb_put_hcd(xhci->shared_hcd); } if (!pci_dev_run_wake(dev)) pm_runtime_get_noresume(&dev->dev); pm_runtime_forbid(&dev->dev); usb_hcd_pci_remove(dev); /* Free the aux irq */ hsic_aux_irq_free(); hsic_wakeup_irq_free(); gpio_free(hsic.aux_gpio); gpio_free(hsic.wakeup_gpio); hsic.port_disconnect = 1; hsic_enable = 0; wake_lock_destroy(&(hsic.resume_wake_lock)); wake_lock_destroy(&hsic.s3_wake_lock); usb_unregister_notify(&hsic.hsic_pm_nb); unregister_pm_notifier(&hsic.hsic_s3_entry_nb); kfree(xhci); }
static ssize_t hsic_port_enable_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t size) { int retval; int org_req; if (size > HSIC_ENABLE_SIZE) return -EINVAL; if (sscanf(buf, "%d", &org_req) != 1) { dev_dbg(dev, "Invalid, value\n"); return -EINVAL; } #if 0 /* Free the aux irq */ hsic_aux_irq_free(); dev_dbg(dev, "%s---->AUX IRQ is disabled\n", __func__); #endif if (delayed_work_pending(&hsic.hsic_aux)) { dev_dbg(dev, "%s---->Wait for delayed work finish\n", __func__); retval = wait_event_interruptible(hsic.aux_wq, hsic.hsic_aux_finish); if (retval < 0) return retval; if (org_req) return size; } mutex_lock(&hsic.hsic_mutex); if (org_req) { dev_dbg(dev, "enable hsic\n"); /* add this due to hcd release doesn't set hcd to NULL */ if (hsic.hsic_stopped == 0) ush_hsic_port_disable(pci_dev); usleep_range(5000, 6000); ush_hsic_port_enable(pci_dev); } else { dev_dbg(dev, "disable hsic\n"); /* add this due to hcd release doesn't set hcd to NULL */ if (hsic.hsic_stopped == 0) ush_hsic_port_disable(pci_dev); } mutex_unlock(&hsic.hsic_mutex); return size; }
static ssize_t hsic_port_enable_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t size) { int retval; int org_req; if (size > HSIC_ENABLE_SIZE) { dev_dbg(dev, "Invalid, size = %d\n", size); return -EINVAL; } if (sscanf(buf, "%d", &org_req) != 1) { dev_dbg(dev, "Invalid, value\n"); return -EINVAL; } /* Free the aux irq */ hsic_aux_irq_free(); dev_dbg(dev, "%s---->AUX IRQ is disabled\n", __func__); if (delayed_work_pending(&hsic.hsic_aux)) { dev_dbg(dev, "%s---->Wait for delayed work finish\n", __func__); retval = wait_event_interruptible(hsic.aux_wq, hsic.hsic_aux_finish); if (retval < 0) return retval; if (org_req) return size; } mutex_lock(&hsic.hsic_mutex); if (org_req) { dev_dbg(dev, "enable hsic\n"); /* add this due to hcd release doesn't set hcd to NULL */ if (hsic.hsic_stopped == 0) ehci_hsic_stop_host(pci_dev); hsic_enter_exit_d3(1); usleep_range(5000, 6000); hsic_enter_exit_d3(0); ehci_hsic_start_host(pci_dev); hsic.autosuspend_enable = 0; usb_disable_autosuspend(hsic.rh_dev); } else { dev_dbg(dev, "disable hsic\n"); /* If device enable auto suspend, disable it before disable hsic */ if (hsic.autosuspend_enable) { dev_dbg(dev, "disable pm\n"); if (hsic.modem_dev != NULL) { usb_disable_autosuspend(hsic.modem_dev); hsic.autosuspend_enable = 0; } if (hsic.rh_dev != NULL) { usb_disable_autosuspend(hsic.rh_dev); hsic.autosuspend_enable = 0; } } /* add this due to hcd release doesn't set hcd to NULL */ if (hsic.hsic_stopped == 0) ehci_hsic_stop_host(pci_dev); } mutex_unlock(&hsic.hsic_mutex); return size; }
static void ehci_hsic_remove(struct pci_dev *pdev) { struct usb_hcd *hcd = pci_get_drvdata(pdev); struct ehci_hcd *ehci = hcd_to_ehci(hcd); if (!hcd) return; hsic.hsic_stopped = 1; hsic_enable = 0; if (pci_dev_run_wake(pdev)) pm_runtime_get_noresume(&pdev->dev); if (!enabling_disabling) { if (!pci_dev_run_wake(pdev)) pm_runtime_get_noresume(&pdev->dev); pm_runtime_forbid(&pdev->dev); } /* Free the aux irq */ hsic_aux_irq_free(); hsic_wakeup_irq_free(); /* Fake an interrupt request in order to give the driver a chance * to test whether the controller hardware has been removed (e.g., * cardbus physical eject). */ local_irq_disable(); usb_hcd_irq(0, hcd); local_irq_enable(); usb_remove_hcd(hcd); #if 0 ehci_hsic_port_power(ehci, 0); #endif /* Set phy low power mode, disable phy clock */ ehci_hsic_phy_power(ehci, 1); if (hcd->driver->flags & HCD_MEMORY) { iounmap(hcd->regs); release_mem_region(hcd->rsrc_start, hcd->rsrc_len); } else { release_region(hcd->rsrc_start, hcd->rsrc_len); } usb_put_hcd(hcd); gpio_free(hsic.aux_gpio); gpio_free(hsic.wakeup_gpio); pci_disable_device(pdev); cancel_delayed_work_sync(&hsic.wakeup_work); destroy_workqueue(hsic.work_queue); wake_lock_destroy(&(hsic.resume_wake_lock)); wake_lock_destroy(&hsic.s3_wake_lock); usb_unregister_notify(&hsic.hsic_pm_nb); unregister_pm_notifier(&hsic.hsic_s3_entry_nb); hsic_debugfs_cleanup(); }