]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
phy: ti: phy-j721e-wiz: restore mux selection during resume
authorThomas Richard (TI.com) <thomas.richard@bootlin.com>
Tue, 16 Dec 2025 14:26:20 +0000 (15:26 +0100)
committerVinod Koul <vkoul@kernel.org>
Tue, 23 Dec 2025 17:41:04 +0000 (23:11 +0530)
While suspend and resume mux selection was getting lost. So save and
restore these values in suspend and resume operations.

Signed-off-by: Thomas Richard (TI.com) <thomas.richard@bootlin.com>
Link: https://patch.msgid.link/20251216-phy-ti-phy-j721e-wiz-resume-restore-mux-sel-v1-1-771d564db966@bootlin.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
drivers/phy/ti/phy-j721e-wiz.c

index a8b440c6c46bb0c754845655f9c2c0ba6b435b8d..ba31b0a1f7f79b957b4f1d34f4064be659b9bc35 100644 (file)
@@ -393,6 +393,7 @@ struct wiz {
        struct clk              *output_clks[WIZ_MAX_OUTPUT_CLOCKS];
        struct clk_onecell_data clk_data;
        const struct wiz_data   *data;
+       int                     mux_sel_status[WIZ_MUX_NUM_CLOCKS];
 };
 
 static int wiz_reset(struct wiz *wiz)
@@ -1654,11 +1655,25 @@ static void wiz_remove(struct platform_device *pdev)
        pm_runtime_disable(dev);
 }
 
+static int wiz_suspend_noirq(struct device *dev)
+{
+       struct wiz *wiz = dev_get_drvdata(dev);
+       int i;
+
+       for (i = 0; i < WIZ_MUX_NUM_CLOCKS; i++)
+               regmap_field_read(wiz->mux_sel_field[i], &wiz->mux_sel_status[i]);
+
+       return 0;
+}
+
 static int wiz_resume_noirq(struct device *dev)
 {
        struct device_node *node = dev->of_node;
        struct wiz *wiz = dev_get_drvdata(dev);
-       int ret;
+       int ret, i;
+
+       for (i = 0; i < WIZ_MUX_NUM_CLOCKS; i++)
+               regmap_field_write(wiz->mux_sel_field[i], wiz->mux_sel_status[i]);
 
        /* Enable supplemental Control override if available */
        if (wiz->sup_legacy_clk_override)
@@ -1680,7 +1695,7 @@ err_wiz_init:
        return ret;
 }
 
-static DEFINE_NOIRQ_DEV_PM_OPS(wiz_pm_ops, NULL, wiz_resume_noirq);
+static DEFINE_NOIRQ_DEV_PM_OPS(wiz_pm_ops, wiz_suspend_noirq, wiz_resume_noirq);
 
 static struct platform_driver wiz_driver = {
        .probe          = wiz_probe,