summaryrefslogtreecommitdiffstats
path: root/drivers/phy/phy-core.c
diff options
context:
space:
mode:
authorDavid Lechner2016-05-10 01:39:59 +0200
committerKishon Vijay Abraham I2016-07-04 13:49:22 +0200
commit300eb0139cf27044c67f6005ff17b8434c7843f0 (patch)
tree62c0de657f6928db11a9139c3c552b877ec7958b /drivers/phy/phy-core.c
parentphy: xgene: rename "enum phy_mode" to "enum xgene_phy_mode" (diff)
downloadkernel-qcow2-linux-300eb0139cf27044c67f6005ff17b8434c7843f0.tar.gz
kernel-qcow2-linux-300eb0139cf27044c67f6005ff17b8434c7843f0.tar.xz
kernel-qcow2-linux-300eb0139cf27044c67f6005ff17b8434c7843f0.zip
phy: Add set_mode callback
The initial use for this is for PHYs that have a mode related to USB OTG. There are several SoCs (e.g. TI OMAP and DA8xx) that have a mode setting in the USB PHY to override OTG VBUS and ID signals. Of course, the enum can be expaned in the future to include modes for other types of PHYs as well. Suggested-by: Kishon Vijay Abraham I <kishon@ti.com> Signed-off-by: David Lechner <david@lechnology.com>
Diffstat (limited to 'drivers/phy/phy-core.c')
-rw-r--r--drivers/phy/phy-core.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/drivers/phy/phy-core.c b/drivers/phy/phy-core.c
index b72e9a3b6429..8eca906b6e70 100644
--- a/drivers/phy/phy-core.c
+++ b/drivers/phy/phy-core.c
@@ -342,6 +342,21 @@ int phy_power_off(struct phy *phy)
}
EXPORT_SYMBOL_GPL(phy_power_off);
+int phy_set_mode(struct phy *phy, enum phy_mode mode)
+{
+ int ret;
+
+ if (!phy || !phy->ops->set_mode)
+ return 0;
+
+ mutex_lock(&phy->mutex);
+ ret = phy->ops->set_mode(phy, mode);
+ mutex_unlock(&phy->mutex);
+
+ return ret;
+}
+EXPORT_SYMBOL_GPL(phy_set_mode);
+
/**
* _of_phy_get() - lookup and obtain a reference to a phy by phandle
* @np: device_node for which to get the phy