Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 238f7bc7 authored by Fabio Estevam's avatar Fabio Estevam Committed by David S. Miller
Browse files

fec: Handle the regulator in suspend/resume



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: default avatarFabio Estevam <fabio.estevam@freescale.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent c55284e4
Loading
Loading
Loading
Loading
+10 −0
Original line number Original line Diff line number Diff line
@@ -2044,6 +2044,9 @@ fec_suspend(struct device *dev)
	clk_disable_unprepare(fep->clk_ahb);
	clk_disable_unprepare(fep->clk_ahb);
	clk_disable_unprepare(fep->clk_ipg);
	clk_disable_unprepare(fep->clk_ipg);


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

	return 0;
	return 0;
}
}


@@ -2052,6 +2055,13 @@ fec_resume(struct device *dev)
{
{
	struct net_device *ndev = dev_get_drvdata(dev);
	struct net_device *ndev = dev_get_drvdata(dev);
	struct fec_enet_private *fep = netdev_priv(ndev);
	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_enet_out);
	clk_prepare_enable(fep->clk_ahb);
	clk_prepare_enable(fep->clk_ahb);