diff options
| author | Grant Likely <grant.likely@secretlab.ca> | 2012-05-08 11:35:37 -0600 | 
|---|---|---|
| committer | Grant Likely <grant.likely@secretlab.ca> | 2012-05-08 11:35:37 -0600 | 
| commit | 7b96c686223a5c902d6a59c7d178f3904f0ab757 (patch) | |
| tree | fe328ed56ad3719de3cfebad72ef74e34f1ed92b /drivers/usb/otg/gpio_vbus.c | |
| parent | f141ed65f256ec036c7fba604da6b7c448096ef9 (diff) | |
| parent | d48b97b403d23f6df0b990cee652bdf9a52337a3 (diff) | |
| download | olio-linux-3.10-7b96c686223a5c902d6a59c7d178f3904f0ab757.tar.xz olio-linux-3.10-7b96c686223a5c902d6a59c7d178f3904f0ab757.zip  | |
Merge tag 'v3.4-rc6' into gpio/next
Linux 3.4-rc6
Diffstat (limited to 'drivers/usb/otg/gpio_vbus.c')
| -rw-r--r-- | drivers/usb/otg/gpio_vbus.c | 15 | 
1 files changed, 14 insertions, 1 deletions
diff --git a/drivers/usb/otg/gpio_vbus.c b/drivers/usb/otg/gpio_vbus.c index 3ece43a2e4c..a0a2178974f 100644 --- a/drivers/usb/otg/gpio_vbus.c +++ b/drivers/usb/otg/gpio_vbus.c @@ -96,7 +96,7 @@ static void gpio_vbus_work(struct work_struct *work)  	struct gpio_vbus_data *gpio_vbus =  		container_of(work, struct gpio_vbus_data, work);  	struct gpio_vbus_mach_info *pdata = gpio_vbus->dev->platform_data; -	int gpio; +	int gpio, status;  	if (!gpio_vbus->phy.otg->gadget)  		return; @@ -108,7 +108,9 @@ static void gpio_vbus_work(struct work_struct *work)  	 */  	gpio = pdata->gpio_pullup;  	if (is_vbus_powered(pdata)) { +		status = USB_EVENT_VBUS;  		gpio_vbus->phy.state = OTG_STATE_B_PERIPHERAL; +		gpio_vbus->phy.last_event = status;  		usb_gadget_vbus_connect(gpio_vbus->phy.otg->gadget);  		/* drawing a "unit load" is *always* OK, except for OTG */ @@ -117,6 +119,9 @@ static void gpio_vbus_work(struct work_struct *work)  		/* optionally enable D+ pullup */  		if (gpio_is_valid(gpio))  			gpio_set_value(gpio, !pdata->gpio_pullup_inverted); + +		atomic_notifier_call_chain(&gpio_vbus->phy.notifier, +					   status, gpio_vbus->phy.otg->gadget);  	} else {  		/* optionally disable D+ pullup */  		if (gpio_is_valid(gpio)) @@ -125,7 +130,12 @@ static void gpio_vbus_work(struct work_struct *work)  		set_vbus_draw(gpio_vbus, 0);  		usb_gadget_vbus_disconnect(gpio_vbus->phy.otg->gadget); +		status = USB_EVENT_NONE;  		gpio_vbus->phy.state = OTG_STATE_B_IDLE; +		gpio_vbus->phy.last_event = status; + +		atomic_notifier_call_chain(&gpio_vbus->phy.notifier, +					   status, gpio_vbus->phy.otg->gadget);  	}  } @@ -287,6 +297,9 @@ static int __init gpio_vbus_probe(struct platform_device *pdev)  			irq, err);  		goto err_irq;  	} + +	ATOMIC_INIT_NOTIFIER_HEAD(&gpio_vbus->phy.notifier); +  	INIT_WORK(&gpio_vbus->work, gpio_vbus_work);  	gpio_vbus->vbus_draw = regulator_get(&pdev->dev, "vbus_draw");  |