Skip to content

Commit

Permalink
fec: Handle the regulator in suspend/resume
Browse files Browse the repository at this point in the history
In order to save power, let's disable the regulator in the suspend function and
enable it in resume.

Tested on a mx28evk board.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Fabio Estevam authored and David S. Miller committed May 28, 2013
1 parent c55284e commit 238f7bc
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions drivers/net/ethernet/freescale/fec_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -2044,6 +2044,9 @@ fec_suspend(struct device *dev)
clk_disable_unprepare(fep->clk_ahb);
clk_disable_unprepare(fep->clk_ipg);

if (fep->reg_phy)
regulator_disable(fep->reg_phy);

return 0;
}

Expand All @@ -2052,6 +2055,13 @@ fec_resume(struct device *dev)
{
struct net_device *ndev = dev_get_drvdata(dev);
struct fec_enet_private *fep = netdev_priv(ndev);
int ret;

if (fep->reg_phy) {
ret = regulator_enable(fep->reg_phy);
if (ret)
return ret;
}

clk_prepare_enable(fep->clk_enet_out);
clk_prepare_enable(fep->clk_ahb);
Expand Down

0 comments on commit 238f7bc

Please sign in to comment.