Commit be9dad1f authored by Sebastian Hesselbarth's avatar Sebastian Hesselbarth Committed by David S. Miller

net: phy: suspend phydev when going to HALTED

When phydev is going to HALTED state, we can try to suspend it to
safe more power. phy_suspend helper will check if PHY can be suspended,
so just call it when entering HALTED state.
Signed-off-by: default avatarSebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Acked-by: default avatarMugunthan V N <mugunthanvnm@ti.com>
Reviewed-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 1211ce53
...@@ -739,7 +739,7 @@ void phy_state_machine(struct work_struct *work) ...@@ -739,7 +739,7 @@ void phy_state_machine(struct work_struct *work)
struct delayed_work *dwork = to_delayed_work(work); struct delayed_work *dwork = to_delayed_work(work);
struct phy_device *phydev = struct phy_device *phydev =
container_of(dwork, struct phy_device, state_queue); container_of(dwork, struct phy_device, state_queue);
int needs_aneg = 0; int needs_aneg = 0, do_suspend = 0;
int err = 0; int err = 0;
mutex_lock(&phydev->lock); mutex_lock(&phydev->lock);
...@@ -854,6 +854,7 @@ void phy_state_machine(struct work_struct *work) ...@@ -854,6 +854,7 @@ void phy_state_machine(struct work_struct *work)
phydev->link = 0; phydev->link = 0;
netif_carrier_off(phydev->attached_dev); netif_carrier_off(phydev->attached_dev);
phydev->adjust_link(phydev->attached_dev); phydev->adjust_link(phydev->attached_dev);
do_suspend = 1;
} }
break; break;
case PHY_RESUMING: case PHY_RESUMING:
...@@ -912,6 +913,9 @@ void phy_state_machine(struct work_struct *work) ...@@ -912,6 +913,9 @@ void phy_state_machine(struct work_struct *work)
if (needs_aneg) if (needs_aneg)
err = phy_start_aneg(phydev); err = phy_start_aneg(phydev);
if (do_suspend)
phy_suspend(phydev);
if (err < 0) if (err < 0)
phy_error(phydev); phy_error(phydev);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment