예제 #1
0
static ssize_t soft_switch_state(struct switch_dev *sdev, char *buf)
{
	if (soft_switch.state == 0) {
		s3c_udc_soft_disconnect();
		udelay(20);
		s3c_udc_soft_connect();
		soft_switch.state = 1;
	}
	else {
		s3c_udc_soft_disconnect();
		udelay(20);
		s3c_udc_soft_connect();
		soft_switch.state = 0;
	}
	return sprintf(buf, "%s\n", (soft_switch.state ? "1" : "0"));
}
/*
 * usb_gadget_ops pullup
 */ 
static int s3c_udc_pullup(struct usb_gadget *gadget, int is_on)
{
	if (is_on)
		s3c_udc_soft_connect();
	else
		s3c_udc_soft_disconnect();
	return 0;
}
예제 #3
0
/*
 * 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_suspend(struct platform_device *pdev, pm_message_t state)
{
	struct s3c_udc *dev = platform_get_drvdata(pdev);

	DEBUG_PM("[%s]: System Suspend \n", __FUNCTION__);

	//save the state of connection to udc_resume_state
	if (dev->gadget.speed != USB_SPEED_UNKNOWN)
	{
		dev->udc_resume_state = dev->udc_state;
		DEBUG_PM("[%s]: USB connected at suspend\n", __FUNCTION__);
	}
	else
	{
		dev->udc_resume_state = dev->udc_state;
		DEBUG_PM("[%s]: USB not connected at suspend\n", __FUNCTION__);
	}

	switch(pm_policy)
	{
		case ALL_POWER_DOWN:			
			s3c_udc_soft_disconnect();
			stop_activity(dev, dev->driver);
			//confirm clk disable
			s3c_udc_power_down();
			break;
		case CLOCK_GATING: 		
			s3c_udc_suspend_clock_gating();
			break;
		case OPHYPWR_FORCE_SUSPEND:			
			writel((readl(S3C_USBOTG_PHYPWR)|1), S3C_USBOTG_PHYPWR);
			break;
		default:
			printk("[%s]: not proper pm_policy\n", __FUNCTION__);
	}
	return 0;
}