···342342}343343EXPORT_SYMBOL_GPL(phy_power_off);344344345345+int phy_set_mode(struct phy *phy, enum phy_mode mode)346346+{347347+ int ret;348348+349349+ if (!phy || !phy->ops->set_mode)350350+ return 0;351351+352352+ mutex_lock(&phy->mutex);353353+ ret = phy->ops->set_mode(phy, mode);354354+ mutex_unlock(&phy->mutex);355355+356356+ return ret;357357+}358358+EXPORT_SYMBOL_GPL(phy_set_mode);359359+345360/**346361 * _of_phy_get() - lookup and obtain a reference to a phy by phandle347362 * @np: device_node for which to get the phy
···22222323struct phy;24242525+enum phy_mode {2626+ PHY_MODE_INVALID,2727+ PHY_MODE_USB_HOST,2828+ PHY_MODE_USB_DEVICE,2929+ PHY_MODE_USB_OTG,3030+};3131+2532/**2633 * struct phy_ops - set of function pointers for performing phy operations2734 * @init: operation to be performed for initializing phy2835 * @exit: operation to be performed while exiting2936 * @power_on: powering on the phy3037 * @power_off: powering off the phy3838+ * @set_mode: set the mode of the phy3139 * @owner: the module owner containing the ops3240 */3341struct phy_ops {···4335 int (*exit)(struct phy *phy);4436 int (*power_on)(struct phy *phy);4537 int (*power_off)(struct phy *phy);3838+ int (*set_mode)(struct phy *phy, enum phy_mode mode);4639 struct module *owner;4740};4841···135126int phy_exit(struct phy *phy);136127int phy_power_on(struct phy *phy);137128int phy_power_off(struct phy *phy);129129+int phy_set_mode(struct phy *phy, enum phy_mode mode);138130static inline int phy_get_bus_width(struct phy *phy)139131{140132 return phy->attrs.bus_width;···237227}238228239229static inline int phy_power_off(struct phy *phy)230230+{231231+ if (!phy)232232+ return 0;233233+ return -ENOSYS;234234+}235235+236236+static inline int phy_set_mode(struct phy *phy, enum phy_mode mode)240237{241238 if (!phy)242239 return 0;