Ejemplo n.º 1
0
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
}
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;
}