Esempio n. 1
0
void  sd_extr_work(struct work_struct *work)
{	
	
	//printk("#######get into extr sd work function######\n");
	unsigned long flags;
	spin_lock_irqsave(&s3c_sd_changed_lock, flags);
	if (early_suspend_stat&sd_early_suspend)
	{
	//printk("$$$$$$$$$$early_suspend_stat:%d\n",early_suspend_stat);
	//wake_lock(&sd_lock);
	SendPowerbuttonEvent();
	//wake_unlock(&sd_lock);
	sd_early_suspend=0;
	}	
	spin_unlock_irqrestore(&s3c_sd_changed_lock, flags);
	enable_irq(__gpio_to_irq(SD_DET_WAKE));
}
Esempio n. 2
0
//&*&*&*SJ1_20110701, fix adb connect issue.
static void  do_softint_usb_irq(struct work_struct *work)
{	
	struct twl4030_usb *twl = container_of(work, struct twl4030_usb, usb_irq_delay_work.work);
	static int last_state=USB_EVENT_NONE;
	int status;
	static  int run_flag=0;
	
	mdelay(200);
	last_state = twl->linkstat;
	status = twl4030_usb_linkstat(twl);
	if (status >= 0) {
		/* FIXME add a set_power() method so that B-devices can
		 * configure the charger appropriately.  It's not always
		 * correct to consume VBUS power, and how much current to
		 * consume is a function of the USB configuration chosen
		 * by the host.
		 *
		 * REVISIT usb_gadget_vbus_connect(...) as needed, ditto
		 * its disconnect() sibling, when changing to/from the
		 * USB_LINK_VBUS state.  musb_hdrc won't care until it
		 * starts to handle softconnect right.
		 */

		if (status == USB_EVENT_NONE) 
		{
			//&*&*&*QY_20110706, don't send USB_EVENT_NONE again 
			if(last_state==USB_EVENT_NONE)
			{
			   return ;
			}
			//&*&*&*QY_20110706
			twl4030_phy_suspend(twl, 0);
			if(twl->enter_early_suspend == 1)
			{
				SendPowerbuttonEvent();
				printk("[twl4030-usb]Enter %s, send power suspend event.\n", __FUNCTION__);
			}
			if(wake_lock_active(&usb_lock))
				wake_unlock(&usb_lock);
		} else {
			if(!wake_lock_active(&usb_lock))
				wake_lock(&usb_lock);
			
			twl4030_phy_resume(twl);
		}
		
		//&*&*&*QY_20110706, don't send USB_EVENT_NONE if last status is USB_EVENT_ID 			
		if(status != USB_EVENT_ID)
		{
			twl4030_otg_enable(0); //Simon			
			if( (status==USB_EVENT_VBUS) || (status==USB_EVENT_NONE && last_state!=USB_EVENT_ID))
			{
		      blocking_notifier_call_chain(&twl->otg.notifier, status,	twl->otg.gadget);
		   }
		   
		}
		//&*&*&*QY_20110706
			
		//&*&*&*QY_20110706, enable 5V when OTG-cable plug-in	
      else //(status == USB_EVENT_ID)
		{
			gpio_direction_output(OTG_EN_1V8, 0);
		   gpio_direction_output(CHG_OFFMODE, 1); 
			if(!run_flag)
			{ 
				//msleep(500);
				mdelay(3000);
			}
			blocking_notifier_call_chain(&twl->otg.notifier, USB_EVENT_ID,	twl->otg.gadget);
			if(run_flag)
			{ 
				//msleep(500);
				mdelay(1000);
			}
			else
			{
			   msleep(1000);
			}
			
			twl4030_otg_enable(1); //Simon
		} 
		//&*&*&*QY_20110706
		
	}
	run_flag=1;
	sysfs_notify(&twl->dev->kobj, NULL, "vbus");
}