Skip to content

Commit

Permalink
phy: core: Add documentation of phy operation order
Browse files Browse the repository at this point in the history
Add documentation on phy function usage: init function must be
called before power_on; power_off must be called before exit.

Signed-off-by: Jules Maselbas <[email protected]>
Cc: Ahmad Fatoum <[email protected]>
Cc: Amelie DELAUNAY <[email protected]>
Cc: Minas Harutyunyan <[email protected]>
Cc: Kishon Vijay Abraham I <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Vinod Koul <[email protected]>
  • Loading branch information
jmaselbas authored and vinodkoul committed Apr 20, 2022
1 parent 51a9b2c commit f1b8d33
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions drivers/phy/phy-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,17 @@ void phy_pm_runtime_forbid(struct phy *phy)
}
EXPORT_SYMBOL_GPL(phy_pm_runtime_forbid);

/**
* phy_init - phy internal initialization before phy operation
* @phy: the phy returned by phy_get()
*
* Used to allow phy's driver to perform phy internal initialization,
* such as PLL block powering, clock initialization or anything that's
* is required by the phy to perform the start of operation.
* Must be called before phy_power_on().
*
* Return: %0 if successful, a negative error code otherwise
*/
int phy_init(struct phy *phy)
{
int ret;
Expand Down Expand Up @@ -258,6 +269,14 @@ int phy_init(struct phy *phy)
}
EXPORT_SYMBOL_GPL(phy_init);

/**
* phy_exit - Phy internal un-initialization
* @phy: the phy returned by phy_get()
*
* Must be called after phy_power_off().
*
* Return: %0 if successful, a negative error code otherwise
*/
int phy_exit(struct phy *phy)
{
int ret;
Expand Down Expand Up @@ -287,6 +306,14 @@ int phy_exit(struct phy *phy)
}
EXPORT_SYMBOL_GPL(phy_exit);

/**
* phy_power_on - Enable the phy and enter proper operation
* @phy: the phy returned by phy_get()
*
* Must be called after phy_init().
*
* Return: %0 if successful, a negative error code otherwise
*/
int phy_power_on(struct phy *phy)
{
int ret = 0;
Expand Down Expand Up @@ -329,6 +356,14 @@ int phy_power_on(struct phy *phy)
}
EXPORT_SYMBOL_GPL(phy_power_on);

/**
* phy_power_off - Disable the phy.
* @phy: the phy returned by phy_get()
*
* Must be called before phy_exit().
*
* Return: %0 if successful, a negative error code otherwise
*/
int phy_power_off(struct phy *phy)
{
int ret;
Expand Down

0 comments on commit f1b8d33

Please sign in to comment.