All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jules Maselbas <jmaselbas@kalray.eu>
To: linux-usb@vger.kernel.org
Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>,
	Minas Harutyunyan <hminas@synopsys.com>,
	Kishon Vijay Abraham I <kishon@ti.com>,
	Amelie DELAUNAY <amelie.delaunay@foss.st.com>,
	Yann Sionneau <ysionneau@kalray.eu>,
	Michael Grzeschik <mgr@pengutronix.de>,
	Randy Dunlap <rdunlap@infradead.org>,
	Arnd Bergmann <arnd@arndb.de>,
	Jules Maselbas <jmaselbas@kalray.eu>
Subject: [PATCH v2 1/3] phy: core: Add documentation of phy operation order
Date: Wed, 23 Mar 2022 12:07:06 +0100	[thread overview]
Message-ID: <20220323110708.8254-2-jmaselbas@kalray.eu> (raw)
In-Reply-To: <20220323110708.8254-1-jmaselbas@kalray.eu>

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>
Cc: Minas Harutyunyan <hminas@synopsys.com>
Cc: Kishon Vijay Abraham I <kishon@ti.com>
---
change in v2:
  - Update the documentation syntax for returned value

 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..2f32f999445f 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().
+ *
+ * Return: %0 if successful, a 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().
+ *
+ * Return: %0 if successful, a 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().
+ *
+ * Return: %0 if successful, a 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().
+ *
+ * Return: %0 if successful, a negative error code otherwise
+ */
 int phy_power_off(struct phy *phy)
 {
 	int ret;
-- 
2.17.1


  reply	other threads:[~2022-03-23 11:07 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-23 11:07 [PATCH v2 0/3] Cleanup the call ordering of phy_init and phy_power_on Jules Maselbas
2022-03-23 11:07 ` Jules Maselbas [this message]
2022-03-23 11:07 ` [PATCH v2 2/3] phy: core: Update documentation syntax Jules Maselbas
2022-03-23 11:07 ` [PATCH v2 3/3] phy: core: Warn when phy_power_on is called before phy_init Jules Maselbas
2022-03-23 11:13   ` Ahmad Fatoum
2022-03-23 11:21     ` Jules Maselbas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220323110708.8254-2-jmaselbas@kalray.eu \
    --to=jmaselbas@kalray.eu \
    --cc=a.fatoum@pengutronix.de \
    --cc=amelie.delaunay@foss.st.com \
    --cc=arnd@arndb.de \
    --cc=hminas@synopsys.com \
    --cc=kishon@ti.com \
    --cc=linux-usb@vger.kernel.org \
    --cc=mgr@pengutronix.de \
    --cc=rdunlap@infradead.org \
    --cc=ysionneau@kalray.eu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.