Merge branch 'x86-debug-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git...
[firefly-linux-kernel-4.4.55.git] / include / linux / usb / phy.h
index 15847cbdb512b804347b3219d60c7b96563fd9bd..6b5978f576331bcfc9e9411211ab82b38f91f4a2 100644 (file)
@@ -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,8 +163,26 @@ 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 */
-#ifdef CONFIG_USB_OTG_UTILS
+#if IS_ENABLED(CONFIG_USB_PHY)
 extern struct usb_phy *usb_get_phy(enum usb_phy_type type);
 extern struct usb_phy *devm_usb_get_phy(struct device *dev,
        enum usb_phy_type type);
@@ -176,29 +197,29 @@ extern int usb_bind_phy(const char *dev_name, u8 index,
 #else
 static inline struct usb_phy *usb_get_phy(enum usb_phy_type type)
 {
-       return NULL;
+       return ERR_PTR(-ENXIO);
 }
 
 static inline struct usb_phy *devm_usb_get_phy(struct device *dev,
        enum usb_phy_type type)
 {
-       return NULL;
+       return ERR_PTR(-ENXIO);
 }
 
 static inline struct usb_phy *usb_get_phy_dev(struct device *dev, u8 index)
 {
-       return NULL;
+       return ERR_PTR(-ENXIO);
 }
 
 static inline struct usb_phy *devm_usb_get_phy_dev(struct device *dev, u8 index)
 {
-       return NULL;
+       return ERR_PTR(-ENXIO);
 }
 
 static inline struct usb_phy *devm_usb_get_phy_by_phandle(struct device *dev,
        const char *phandle, u8 index)
 {
-       return NULL;
+       return ERR_PTR(-ENXIO);
 }
 
 static inline void usb_put_phy(struct usb_phy *x)