diff mbox series

[1/2] phy: core: Add documentation of phy operation order

Message ID 20220322143011.16580-2-jmaselbas@kalray.eu (mailing list archive)
State Superseded
Headers show
Series Cleanup the call ordering of phy_init and phy_power_on | expand

Commit Message

Jules Maselbas March 22, 2022, 2:30 p.m. UTC
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 <jmaselbas@kalray.eu>
CC: Ahmad Fatoum <a.fatoum@pengutronix.de>
CC: Amelie DELAUNAY <amelie.delaunay@foss.st.com>
---
 drivers/phy/phy-core.c | 35 +++++++++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)

Comments

Randy Dunlap March 22, 2022, 7:46 p.m. UTC | #1
Hi--

On 3/22/22 07:30, Jules Maselbas wrote:
> 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 <jmaselbas@kalray.eu>
> CC: Ahmad Fatoum <a.fatoum@pengutronix.de>
> CC: Amelie DELAUNAY <amelie.delaunay@foss.st.com>
> ---
>  drivers/phy/phy-core.c | 35 +++++++++++++++++++++++++++++++++++
>  1 file changed, 35 insertions(+)
> 
> diff --git a/drivers/phy/phy-core.c b/drivers/phy/phy-core.c
> index 91e28d6ce450..ed10cbb24b08 100644
> --- a/drivers/phy/phy-core.c
> +++ b/drivers/phy/phy-core.c
> @@ -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().
> + *
> + * Returns: 0 if successful, an negative error code otherwise

    * Return: %0 if successful, a negative error code otherwise

(in all 4 functions)

> + */
>  int phy_init(struct phy *phy)
diff mbox series

Patch

diff --git a/drivers/phy/phy-core.c b/drivers/phy/phy-core.c
index 91e28d6ce450..ed10cbb24b08 100644
--- a/drivers/phy/phy-core.c
+++ b/drivers/phy/phy-core.c
@@ -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().
+ *
+ * Returns: 0 if successful, an negative error code otherwise
+ */
 int phy_init(struct phy *phy)
 {
 	int ret;
@@ -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().
+ *
+ * Returns: 0 if successful, an negative error code otherwise
+ */
 int phy_exit(struct phy *phy)
 {
 	int ret;
@@ -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().
+ *
+ * Returns: 0 if successful, an negative error code otherwise
+ */
 int phy_power_on(struct phy *phy)
 {
 	int ret = 0;
@@ -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().
+ *
+ * Returns: 0 if successful, an negative error code otherwise
+ */
 int phy_power_off(struct phy *phy)
 {
 	int ret;