From patchwork Thu Apr 7 10:21:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jules Maselbas X-Patchwork-Id: 561464 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C21F1C433FE for ; Thu, 7 Apr 2022 10:21:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237395AbiDGKXT (ORCPT ); Thu, 7 Apr 2022 06:23:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41690 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237328AbiDGKXS (ORCPT ); Thu, 7 Apr 2022 06:23:18 -0400 Received: from fx301.security-mail.net (smtpout30.security-mail.net [85.31.212.36]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9E11427FD9 for ; Thu, 7 Apr 2022 03:21:18 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by fx301.security-mail.net (Postfix) with ESMTP id 38BF324BD0CA for ; Thu, 7 Apr 2022 12:21:17 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kalray.eu; s=sec-sig-email; t=1649326877; bh=yqZkgoLIliahw54bhuOwqAtHS1QM7mDnzTPGUCJAZLA=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=Key5QeUk52dfAehA2AQqxDDwuibIZ63CLDp3ki7bhXyFKcZD31AlFuzK9bx4CRTu4 fVSxcNrV3RDDa66Un79suZiEGZyoVh3xRmdssrxfoNaGHTksdSgpIkx0KaBhOgJXVt vVXWUqKsSZMG/NJEY+/ho+w+RDb4sxK+EOY1gBbs= Received: from fx301 (localhost [127.0.0.1]) by fx301.security-mail.net (Postfix) with ESMTP id 46AD224BD08B; Thu, 7 Apr 2022 12:21:16 +0200 (CEST) X-Virus-Scanned: E-securemail Secumail-id: <8e12.624ebb1b.b522d.0> Received: from zimbra2.kalray.eu (unknown [217.181.231.53]) by fx301.security-mail.net (Postfix) with ESMTPS id B58F924BD080; Thu, 7 Apr 2022 12:21:15 +0200 (CEST) Received: from zimbra2.kalray.eu (localhost [127.0.0.1]) by zimbra2.kalray.eu (Postfix) with ESMTPS id 96E9E27E044F; Thu, 7 Apr 2022 12:21:15 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by zimbra2.kalray.eu (Postfix) with ESMTP id 7FE9927E044D; Thu, 7 Apr 2022 12:21:15 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.10.3 zimbra2.kalray.eu 7FE9927E044D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kalray.eu; s=32AE1B44-9502-11E5-BA35-3734643DEF29; t=1649326875; bh=tYjU0VyJFwe7OSSRp1Yty55z6lsZNfkFYLTMM5Cxjhw=; h=From:To:Date:Message-Id; b=PNEiforYv9jEllNVZmAfsgS2+X24vZqP7StpA3ypfvqIEvd+OtmMTfg/4y8+amzkF oNizW+CrkIKrAHSqbiVsmVdFOsyNdyHZSo5qHhF/rHbEHXumNIVq9tjYIekXopMdti QkSL2maoAGZVifE+Los+38D+VqQjY/2cGfFwa1II= Received: from zimbra2.kalray.eu ([127.0.0.1]) by localhost (zimbra2.kalray.eu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id U4URVFnSMH9N; Thu, 7 Apr 2022 12:21:15 +0200 (CEST) Received: from tellis.lin.mbt.kalray.eu (unknown [192.168.36.206]) by zimbra2.kalray.eu (Postfix) with ESMTPSA id 6CED527E0443; Thu, 7 Apr 2022 12:21:15 +0200 (CEST) From: Jules Maselbas To: linux-phy@lists.infradead.org Cc: linux-usb@vger.kernel.org, Kishon Vijay Abraham I , Vinod Koul , Ahmad Fatoum , Minas Harutyunyan , Amelie DELAUNAY , Yann Sionneau , Michael Grzeschik , Randy Dunlap , Arnd Bergmann , Jules Maselbas Subject: [PATCH RESEND v3 1/3] phy: core: Add documentation of phy operation order Date: Thu, 7 Apr 2022 12:21:06 +0200 Message-Id: <20220407102108.24211-2-jmaselbas@kalray.eu> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220407102108.24211-1-jmaselbas@kalray.eu> References: <20220407102108.24211-1-jmaselbas@kalray.eu> X-Virus-Scanned: by Secumail Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org 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 Cc: Ahmad Fatoum Cc: Amelie DELAUNAY Cc: Minas Harutyunyan Cc: Kishon Vijay Abraham I --- 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 b3f45dbdc681..d1817a0f2d09 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;