Lines Matching full:phy

3  * phy.h -- generic phy header file
19 #include <linux/phy/phy-dp.h>
20 #include <linux/phy/phy-mipi-dphy.h>
22 struct phy;
48 * union phy_configure_opts - Opaque generic phy configuration
51 * the MIPI_DPHY phy mode.
61 * struct phy_ops - set of function pointers for performing phy operations
62 * @init: operation to be performed for initializing phy
64 * @power_on: powering on the phy
65 * @power_off: powering off the phy
66 * @set_mode: set the mode of the phy
67 * @reset: resetting the phy
68 * @calibrate: calibrate the phy
69 * @release: ops to be performed while the consumer relinquishes the PHY
73 int (*init)(struct phy *phy);
74 int (*exit)(struct phy *phy);
75 int (*power_on)(struct phy *phy);
76 int (*power_off)(struct phy *phy);
77 int (*set_mode)(struct phy *phy, enum phy_mode mode, int submode);
84 * Used to change the PHY parameters. phy_init() must have
85 * been called on the phy.
89 int (*configure)(struct phy *phy, union phy_configure_opts *opts);
97 * handled by the phy. Implementations are free to tune the
100 * any actual configuration of the PHY, so calling it as many
107 int (*validate)(struct phy *phy, enum phy_mode mode, int submode,
109 int (*reset)(struct phy *phy);
110 int (*calibrate)(struct phy *phy);
111 void (*release)(struct phy *phy);
116 * struct phy_attrs - represents phy attributes
117 * @bus_width: Data path width implemented by PHY
118 * @max_link_rate: Maximum link rate supported by PHY (in Mbps)
119 * @mode: PHY mode
128 * struct phy - represents the phy device
129 * @dev: phy device
130 * @id: id of the phy device
131 * @ops: function pointers for performing phy operations
133 * @init_count: used to protect when the PHY is used by multiple consumers
134 * @power_count: used to protect when the PHY is used by multiple consumers
135 * @attrs: used to specify PHY specific attributes
136 * @pwr: power regulator associated with the phy
138 struct phy { struct
150 * struct phy_provider - represents the phy provider argument
151 * @dev: phy provider device
154 * @list: to maintain a linked list of PHY providers
155 * @of_xlate: function pointer to obtain phy instance from phy pointer
162 struct phy * (*of_xlate)(struct device *dev,
167 * struct phy_lookup - PHY association in list of phys managed by the phy driver
171 * @phy: the phy of the association
177 struct phy *phy; member
180 #define to_phy(a) (container_of((a), struct phy, dev))
194 static inline void phy_set_drvdata(struct phy *phy, void *data) in phy_set_drvdata() argument
196 dev_set_drvdata(&phy->dev, data); in phy_set_drvdata()
199 static inline void *phy_get_drvdata(struct phy *phy) in phy_get_drvdata() argument
201 return dev_get_drvdata(&phy->dev); in phy_get_drvdata()
205 int phy_pm_runtime_get(struct phy *phy);
206 int phy_pm_runtime_get_sync(struct phy *phy);
207 int phy_pm_runtime_put(struct phy *phy);
208 int phy_pm_runtime_put_sync(struct phy *phy);
209 void phy_pm_runtime_allow(struct phy *phy);
210 void phy_pm_runtime_forbid(struct phy *phy);
211 int phy_init(struct phy *phy);
212 int phy_exit(struct phy *phy);
213 int phy_power_on(struct phy *phy);
214 int phy_power_off(struct phy *phy);
215 int phy_set_mode_ext(struct phy *phy, enum phy_mode mode, int submode);
216 #define phy_set_mode(phy, mode) \ argument
217 phy_set_mode_ext(phy, mode, 0)
218 int phy_configure(struct phy *phy, union phy_configure_opts *opts);
219 int phy_validate(struct phy *phy, enum phy_mode mode, int submode,
222 static inline enum phy_mode phy_get_mode(struct phy *phy) in phy_get_mode() argument
224 return phy->attrs.mode; in phy_get_mode()
226 int phy_reset(struct phy *phy);
227 int phy_calibrate(struct phy *phy);
228 static inline int phy_get_bus_width(struct phy *phy) in phy_get_bus_width() argument
230 return phy->attrs.bus_width; in phy_get_bus_width()
232 static inline void phy_set_bus_width(struct phy *phy, int bus_width) in phy_set_bus_width() argument
234 phy->attrs.bus_width = bus_width; in phy_set_bus_width()
236 struct phy *phy_get(struct device *dev, const char *string);
237 struct phy *phy_optional_get(struct device *dev, const char *string);
238 struct phy *devm_phy_get(struct device *dev, const char *string);
239 struct phy *devm_phy_optional_get(struct device *dev, const char *string);
240 struct phy *devm_of_phy_get(struct device *dev, struct device_node *np,
242 struct phy *devm_of_phy_get_by_index(struct device *dev, struct device_node *np,
244 void of_phy_put(struct phy *phy);
245 void phy_put(struct device *dev, struct phy *phy);
246 void devm_phy_put(struct device *dev, struct phy *phy);
247 struct phy *of_phy_get(struct device_node *np, const char *con_id);
248 struct phy *of_phy_simple_xlate(struct device *dev,
250 struct phy *phy_create(struct device *dev, struct device_node *node,
252 struct phy *devm_phy_create(struct device *dev, struct device_node *node,
254 void phy_destroy(struct phy *phy);
255 void devm_phy_destroy(struct device *dev, struct phy *phy);
258 struct phy * (*of_xlate)(struct device *dev,
262 struct phy * (*of_xlate)(struct device *dev,
267 int phy_create_lookup(struct phy *phy, const char *con_id, const char *dev_id);
268 void phy_remove_lookup(struct phy *phy, const char *con_id, const char *dev_id);
270 static inline int phy_pm_runtime_get(struct phy *phy) in phy_pm_runtime_get() argument
272 if (!phy) in phy_pm_runtime_get()
277 static inline int phy_pm_runtime_get_sync(struct phy *phy) in phy_pm_runtime_get_sync() argument
279 if (!phy) in phy_pm_runtime_get_sync()
284 static inline int phy_pm_runtime_put(struct phy *phy) in phy_pm_runtime_put() argument
286 if (!phy) in phy_pm_runtime_put()
291 static inline int phy_pm_runtime_put_sync(struct phy *phy) in phy_pm_runtime_put_sync() argument
293 if (!phy) in phy_pm_runtime_put_sync()
298 static inline void phy_pm_runtime_allow(struct phy *phy) in phy_pm_runtime_allow() argument
303 static inline void phy_pm_runtime_forbid(struct phy *phy) in phy_pm_runtime_forbid() argument
308 static inline int phy_init(struct phy *phy) in phy_init() argument
310 if (!phy) in phy_init()
315 static inline int phy_exit(struct phy *phy) in phy_exit() argument
317 if (!phy) in phy_exit()
322 static inline int phy_power_on(struct phy *phy) in phy_power_on() argument
324 if (!phy) in phy_power_on()
329 static inline int phy_power_off(struct phy *phy) in phy_power_off() argument
331 if (!phy) in phy_power_off()
336 static inline int phy_set_mode_ext(struct phy *phy, enum phy_mode mode, in phy_set_mode_ext() argument
339 if (!phy) in phy_set_mode_ext()
344 #define phy_set_mode(phy, mode) \ argument
345 phy_set_mode_ext(phy, mode, 0)
347 static inline enum phy_mode phy_get_mode(struct phy *phy) in phy_get_mode() argument
352 static inline int phy_reset(struct phy *phy) in phy_reset() argument
354 if (!phy) in phy_reset()
359 static inline int phy_calibrate(struct phy *phy) in phy_calibrate() argument
361 if (!phy) in phy_calibrate()
366 static inline int phy_configure(struct phy *phy, in phy_configure() argument
369 if (!phy) in phy_configure()
375 static inline int phy_validate(struct phy *phy, enum phy_mode mode, int submode, in phy_validate() argument
378 if (!phy) in phy_validate()
384 static inline int phy_get_bus_width(struct phy *phy) in phy_get_bus_width() argument
389 static inline void phy_set_bus_width(struct phy *phy, int bus_width) in phy_set_bus_width() argument
394 static inline struct phy *phy_get(struct device *dev, const char *string) in phy_get()
399 static inline struct phy *phy_optional_get(struct device *dev, in phy_optional_get()
405 static inline struct phy *devm_phy_get(struct device *dev, const char *string) in devm_phy_get()
410 static inline struct phy *devm_phy_optional_get(struct device *dev, in devm_phy_optional_get()
416 static inline struct phy *devm_of_phy_get(struct device *dev, in devm_of_phy_get()
423 static inline struct phy *devm_of_phy_get_by_index(struct device *dev, in devm_of_phy_get_by_index()
430 static inline void of_phy_put(struct phy *phy) in of_phy_put() argument
434 static inline void phy_put(struct device *dev, struct phy *phy) in phy_put() argument
438 static inline void devm_phy_put(struct device *dev, struct phy *phy) in devm_phy_put() argument
442 static inline struct phy *of_phy_get(struct device_node *np, const char *con_id) in of_phy_get()
447 static inline struct phy *of_phy_simple_xlate(struct device *dev, in of_phy_simple_xlate()
453 static inline struct phy *phy_create(struct device *dev, in phy_create()
460 static inline struct phy *devm_phy_create(struct device *dev, in devm_phy_create()
467 static inline void phy_destroy(struct phy *phy) in phy_destroy() argument
471 static inline void devm_phy_destroy(struct device *dev, struct phy *phy) in devm_phy_destroy() argument
477 struct phy * (*of_xlate)(struct device *dev, in __of_phy_provider_register()
485 struct phy * (*of_xlate)(struct device *dev, in __devm_of_phy_provider_register()
500 phy_create_lookup(struct phy *phy, const char *con_id, const char *dev_id) in phy_create_lookup() argument
504 static inline void phy_remove_lookup(struct phy *phy, const char *con_id, in phy_remove_lookup() argument