Skip to content

Commit bc25f0b

Browse files
thom24vinodkoul
authored andcommitted
phy: ti: gmii-sel: add resume support
The resume callback restores the submode of each PHY. It uses the submode stored in struct phy_gmii_sel_phy_priv (variable phy_if_mode). The submode was saved by the set_mode PHY operation. Signed-off-by: Thomas Richard <thomas.richard@bootlin.com> Link: https://lore.kernel.org/r/20240125171754.773909-1-thomas.richard@bootlin.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
1 parent 442f34e commit bc25f0b

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

drivers/phy/ti/phy-gmii-sel.c

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -494,11 +494,35 @@ static int phy_gmii_sel_probe(struct platform_device *pdev)
494494
return 0;
495495
}
496496

497+
static int phy_gmii_sel_resume_noirq(struct device *dev)
498+
{
499+
struct phy_gmii_sel_priv *priv = dev_get_drvdata(dev);
500+
struct phy_gmii_sel_phy_priv *if_phys = priv->if_phys;
501+
int ret, i;
502+
503+
for (i = 0; i < priv->num_ports; i++) {
504+
if (if_phys[i].phy_if_mode) {
505+
ret = phy_gmii_sel_mode(if_phys[i].if_phy,
506+
PHY_MODE_ETHERNET, if_phys[i].phy_if_mode);
507+
if (ret) {
508+
dev_err(dev, "port%u: restore mode fail %d\n",
509+
if_phys[i].if_phy->id, ret);
510+
return ret;
511+
}
512+
}
513+
}
514+
515+
return 0;
516+
}
517+
518+
static DEFINE_NOIRQ_DEV_PM_OPS(phy_gmii_sel_pm_ops, NULL, phy_gmii_sel_resume_noirq);
519+
497520
static struct platform_driver phy_gmii_sel_driver = {
498521
.probe = phy_gmii_sel_probe,
499522
.driver = {
500523
.name = "phy-gmii-sel",
501524
.of_match_table = phy_gmii_sel_id_table,
525+
.pm = pm_sleep_ptr(&phy_gmii_sel_pm_ops),
502526
},
503527
};
504528
module_platform_driver(phy_gmii_sel_driver);

0 commit comments

Comments
 (0)