static int s3c_udc_resume(struct platform_device *pdev) { //#ifndef CONFIG_PM usb_pm_state = 1; return 0; #if 0 #if 1 //first check status of connection DEBUG_PM("[%s]: fsa9480_check_usb_connection\n", __func__); msleep(200); fsa9480_check_usb_connection(); return 0; #else // chekc udc_resume_speed & udc_resume_state struct s3c_udc *dev = platform_get_drvdata(pdev); u32 tmp; DEBUG_PM("[%s]: System Resume \n", __func__); #if NO_USING_USB_SWITCH DEBUG_PM("[%s]: NO_USING_USB_SWITCH just return\n", __func__); return 0; #endif //if not suspended as connected if (dev->udc_resume_state == USB_STATE_CONFIGURED) { DEBUG_PM("[%s]: USB connected before suspend \n", __func__); } else { DEBUG_PM("[%s]: USB not connected before suspend\n", __func__); return 0; } switch(pm_policy) { case ALL_POWER_DOWN: s3c_udc_power_up(); break; case CLOCK_GATING: s3c_udc_resume_clock_gating(); break; case OPHYPWR_FORCE_SUSPEND: tmp = readl(S3C_USBOTG_PHYPWR); tmp &= ~(1<<FORCE_SUSPEND); writel(tmp, S3C_USBOTG_PHYPWR); break; default: DEBUG_ERROR("[%s]: not proper pm_policy\n", __func__); } return 0; #endif #endif }
/* * usb_gadget_ops pullup */ static int s3c_udc_pullup(struct usb_gadget *gadget, int is_on) { //#ifdef CONFIG_PM #if 0 //logical if (is_on) { s3c_udc_soft_connect(); } else { s3c_udc_soft_disconnect(); } #else struct s3c_udc *dev = the_controller; unsigned long flags; //UDC power on/off if (is_on) { DEBUG_PM("[%s] is_on[%d]\n", __func__, is_on); /* * if early s3c_udc_power_up make * fsa9480_check_usb_connection failed to detect USB connection */ #if NO_USING_USB_SWITCH s3c_udc_power_up(); #else fsa9480_check_usb_connection(); #endif } else { DEBUG_PM("[%s] is_on[%d]\n", __func__, is_on); S3C_UDC_LOCK_IRQSAVE(&dev->lock, flags); s3c_udc_stop_activity(dev, dev->driver); s3c_udc_power_down(); S3C_UDC_UNLOCK_IRQRESTORE(&dev->lock, flags); } #endif return 0; }
static int s3c_udc_resume(struct platform_device *pdev) { // struct s3c_udc *dev = platform_get_drvdata(pdev); u32 tmp; DEBUG_PM("[%s]: System Resume \n", __FUNCTION__); //if not suspended as connected #ifndef CONFIG_MACH_SMDK6410 if (dev->udc_resume_state == USB_STATE_CONFIGURED) { DEBUG_PM("[%s]: USB connected before suspend \n", __FUNCTION__); } else { DEBUG_PM("[%s]: USB not connected before suspend\n", __FUNCTION__); return 0; } #endif /* CONFIG_MACH_SMDK6410 */ switch(pm_policy) { case ALL_POWER_DOWN: s3c_udc_power_up(); break; case CLOCK_GATING: s3c_udc_resume_clock_gating(); break; case OPHYPWR_FORCE_SUSPEND: tmp = readl(S3C_USBOTG_PHYPWR); tmp &= ~(1); writel(tmp, S3C_USBOTG_PHYPWR); break; default: printk("[%s]: not proper pm_policy\n", __FUNCTION__); } return 0; }