aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/usb
diff options
context:
space:
mode:
authorFelipe Balbi <balbi@ti.com>2013-03-08 06:22:58 -0500
committerFelipe Balbi <balbi@ti.com>2013-03-18 05:18:09 -0400
commitb774212ea5f13911a5e0211a7088e42dad46b4c8 (patch)
tree8cd62b61e57f3ee5a257e049557ed69bf530e747 /include/linux/usb
parent790d3a5ab6e36fb06e99339afe35ecdec4d3b2cb (diff)
usb: phy: introduce ->set_vbus() method
this method will be used to enable or disable the charge pump. Whenever we have DRD devices, we need to be able to turn VBUS on or off whenever we want. Note that in the ideal case, this would be controlled by the ID-pin Interrupt, but not all devices have ID-pin properly routed since manufacturers can choose to save that trace if they're building a host-only product out of a DRD IP. This is also useful during debugging where we might not have the proper cable hanging around. Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'include/linux/usb')
-rw-r--r--include/linux/usb/phy.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/include/linux/usb/phy.h b/include/linux/usb/phy.h
index b001dc3d6354..b7c2217c585f 100644
--- a/include/linux/usb/phy.h
+++ b/include/linux/usb/phy.h
@@ -91,6 +91,9 @@ struct usb_phy {
91 int (*init)(struct usb_phy *x); 91 int (*init)(struct usb_phy *x);
92 void (*shutdown)(struct usb_phy *x); 92 void (*shutdown)(struct usb_phy *x);
93 93
94 /* enable/disable VBUS */
95 int (*set_vbus)(struct usb_phy *x, int on);
96
94 /* effective for B devices, ignored for A-peripheral */ 97 /* effective for B devices, ignored for A-peripheral */
95 int (*set_power)(struct usb_phy *x, 98 int (*set_power)(struct usb_phy *x,
96 unsigned mA); 99 unsigned mA);
@@ -160,6 +163,24 @@ usb_phy_shutdown(struct usb_phy *x)
160 x->shutdown(x); 163 x->shutdown(x);
161} 164}
162 165
166static inline int
167usb_phy_vbus_on(struct usb_phy *x)
168{
169 if (!x->set_vbus)
170 return 0;
171
172 return x->set_vbus(x, true);
173}
174
175static inline int
176usb_phy_vbus_off(struct usb_phy *x)
177{
178 if (!x->set_vbus)
179 return 0;
180
181 return x->set_vbus(x, false);
182}
183
163/* for usb host and peripheral controller drivers */ 184/* for usb host and peripheral controller drivers */
164#if IS_ENABLED(CONFIG_USB_PHY) 185#if IS_ENABLED(CONFIG_USB_PHY)
165extern struct usb_phy *usb_get_phy(enum usb_phy_type type); 186extern struct usb_phy *usb_get_phy(enum usb_phy_type type);