2020-06-25 19:58:02

by Wesley Cheng

[permalink] [raw]
Subject: [PATCH v3 0/2] phy: qcom-snps: Add runtime suspend and resume handlers

Changes in v3:
- Fixed strict checkpatch warnings due to alignment
- Remove debug artifacts from prints
- Split the set mode callback addition to another patch
- Removed suspended parameter

Changes in v2:
- Addressed checkpatch alignment/line length warnings.
- Removed superfluous init in qcom_snps_hsphy_resume().

Adds a set mode callback and runtime suspend/resume handlers to the
phy-qcom-snps-femto-v2 driver. The set mode is used to enable certain
power management features in the PHY during suspend/resume.

Wesley Cheng (2):
phy: qcom-snps: Add runtime suspend and resume handlers
phy: qcom-snps: Add a set mode callback

drivers/phy/qualcomm/phy-qcom-snps-femto-v2.c | 85 +++++++++++++++++++
1 file changed, 85 insertions(+)

--
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project


2020-06-25 19:58:11

by Wesley Cheng

[permalink] [raw]
Subject: [PATCH v3 2/2] phy: qcom-snps: Add a set mode callback

The set mode handler is used to keep track of the current role of the
device. This is used for enabling certain resources within the PHY
depending on if the device is behaving as a host or device.

Signed-off-by: Wesley Cheng <[email protected]>
---
drivers/phy/qualcomm/phy-qcom-snps-femto-v2.c | 12 ++++++++++++
1 file changed, 12 insertions(+)

diff --git a/drivers/phy/qualcomm/phy-qcom-snps-femto-v2.c b/drivers/phy/qualcomm/phy-qcom-snps-femto-v2.c
index 152d8633f4ea..ae4bac024c7b 100644
--- a/drivers/phy/qualcomm/phy-qcom-snps-femto-v2.c
+++ b/drivers/phy/qualcomm/phy-qcom-snps-femto-v2.c
@@ -77,6 +77,7 @@ static const char * const qcom_snps_hsphy_vreg_names[] = {
* @phy_reset: phy reset control
* @vregs: regulator supplies bulk data
* @phy_initialized: if PHY has been initialized correctly
+ * @mode: contains the current mode the PHY is in
*/
struct qcom_snps_hsphy {
struct phy *phy;
@@ -88,6 +89,7 @@ struct qcom_snps_hsphy {
struct regulator_bulk_data vregs[SNPS_HS_NUM_VREGS];

bool phy_initialized;
+ enum phy_mode mode;
};

static inline void qcom_snps_hsphy_write_mask(void __iomem *base, u32 offset,
@@ -161,6 +163,15 @@ static int __maybe_unused qcom_snps_hsphy_runtime_resume(struct device *dev)
return 0;
}

+static int qcom_snps_hsphy_set_mode(struct phy *phy, enum phy_mode mode,
+ int submode)
+{
+ struct qcom_snps_hsphy *hsphy = phy_get_drvdata(phy);
+
+ hsphy->mode = mode;
+ return 0;
+}
+
static int qcom_snps_hsphy_init(struct phy *phy)
{
struct qcom_snps_hsphy *hsphy = phy_get_drvdata(phy);
@@ -258,6 +269,7 @@ static int qcom_snps_hsphy_exit(struct phy *phy)
static const struct phy_ops qcom_snps_hsphy_gen_ops = {
.init = qcom_snps_hsphy_init,
.exit = qcom_snps_hsphy_exit,
+ .set_mode = qcom_snps_hsphy_set_mode,
.owner = THIS_MODULE,
};

--
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project

2020-06-29 21:37:39

by Vinod Koul

[permalink] [raw]
Subject: Re: [PATCH v3 0/2] phy: qcom-snps: Add runtime suspend and resume handlers

On 25-06-20, 12:54, Wesley Cheng wrote:
> Changes in v3:
> - Fixed strict checkpatch warnings due to alignment
> - Remove debug artifacts from prints
> - Split the set mode callback addition to another patch
> - Removed suspended parameter
>
> Changes in v2:
> - Addressed checkpatch alignment/line length warnings.
> - Removed superfluous init in qcom_snps_hsphy_resume().
>
> Adds a set mode callback and runtime suspend/resume handlers to the
> phy-qcom-snps-femto-v2 driver. The set mode is used to enable certain
> power management features in the PHY during suspend/resume.

Applied after dropping the wrong review tag, thanks
--
~Vinod