コード例 #1
0
/**
 * Cleanup the PCD.
 */
void pcd_remove(
struct platform_device *_dev
	)
{
	dwc_otg_device_t *otg_dev = platform_get_drvdata(_dev);
	struct sprd_usb_platform_data *pdata= _dev->dev.platform_data;
	dwc_otg_pcd_t *pcd = otg_dev->pcd;
	int plug_irq;

	DWC_DEBUGPL(DBG_PCDV, "%s(%p)\n", __func__, _dev);

	usb_del_gadget_udc(&gadget_wrapper->gadget);

	/*
	 * Free the IRQ
	 */
	free_irq(platform_get_irq(_dev, 0), pcd);
	plug_irq = usb_get_vbus_irq();
	usb_free_vbus_irq(plug_irq,pdata->gpio_chgdet);
	dwc_otg_pcd_remove(pcd);
	destroy_workqueue(gadget_wrapper->detect_wq);
	destroy_workqueue(gadget_wrapper->cable2pc_wq);
	wake_lock_destroy(&usb_wake_lock);
	switch_dev_unregister(&gadget_wrapper->sdev);
	free_wrapper(gadget_wrapper);
	pcd = 0;
}
コード例 #2
0
int usb_register_hotplug_callback(struct usb_hotplug_callback *cb)
{
	int ret = 0;
	int plug_irq = usb_get_vbus_irq();
	if (cb){
		hotplug_cb = cb;
		enable_irq(plug_irq);
	} else {
		pr_warning("%s, error\n", __func__);
		ret = -EINVAL;
	}
	return ret;
}
コード例 #3
0
/**
 * Cleanup the PCD.
 */
void pcd_remove(
struct platform_device *_dev
	)
{
	dwc_otg_device_t *otg_dev = platform_get_drvdata(_dev);
	dwc_otg_pcd_t *pcd = otg_dev->pcd;
	int plug_irq;

	DWC_DEBUGPL(DBG_PCDV, "%s(%p)\n", __func__, _dev);

	/*
	 * Free the IRQ
	 */
	//free_irq(_dev->irq, pcd);
	plug_irq = usb_get_vbus_irq();
	usb_free_vbus_irq(plug_irq);
	dwc_otg_pcd_remove(pcd);
	destroy_workqueue(gadget_wrapper->detect_wq);
	wake_lock_destroy(&usb_wake_lock);
	switch_dev_unregister(&gadget_wrapper->sdev);
	free_wrapper(gadget_wrapper);
	pcd = 0;
}