diff options
| -rw-r--r-- | include/linux/usb/phy.h | 21 | 
1 files changed, 21 insertions, 0 deletions
diff --git a/include/linux/usb/phy.h b/include/linux/usb/phy.h index b001dc3d635..b7c2217c585 100644 --- a/include/linux/usb/phy.h +++ b/include/linux/usb/phy.h @@ -91,6 +91,9 @@ struct usb_phy {  	int	(*init)(struct usb_phy *x);  	void	(*shutdown)(struct usb_phy *x); +	/* enable/disable VBUS */ +	int	(*set_vbus)(struct usb_phy *x, int on); +  	/* effective for B devices, ignored for A-peripheral */  	int	(*set_power)(struct usb_phy *x,  				unsigned mA); @@ -160,6 +163,24 @@ usb_phy_shutdown(struct usb_phy *x)  		x->shutdown(x);  } +static inline int +usb_phy_vbus_on(struct usb_phy *x) +{ +	if (!x->set_vbus) +		return 0; + +	return x->set_vbus(x, true); +} + +static inline int +usb_phy_vbus_off(struct usb_phy *x) +{ +	if (!x->set_vbus) +		return 0; + +	return x->set_vbus(x, false); +} +  /* for usb host and peripheral controller drivers */  #if IS_ENABLED(CONFIG_USB_PHY)  extern struct usb_phy *usb_get_phy(enum usb_phy_type type);  |