Quantcast
Channel: Processors
Viewing all articles
Browse latest Browse all 150011

Forum Post: RE: suspend and resume Ethernet(CPSW) from a script

$
0
0

I have read the docs in the links you provided......I am specifically looking for suspend/resume of ethernet implemented in CPSW driver.

The following code is present in kernel/drivers/net/ethernet/ti/cpsw.c

static int cpsw_suspend(struct device *dev)
{
    struct platform_device    *pdev = to_platform_device(dev);
    struct net_device    *ndev = platform_get_drvdata(pdev);

    cpsw_stop_slaves_interface(ndev);
    pm_runtime_put_sync(&pdev->dev);

    return 0;
}

static int cpsw_resume(struct device *dev)
{
    struct platform_device    *pdev = to_platform_device(dev);
    struct net_device    *ndev = platform_get_drvdata(pdev);

    pm_runtime_get_sync(&pdev->dev);
    cpsw_start_slaves_interface(ndev);

    return 0;
}

static const struct dev_pm_ops cpsw_pm_ops = {
    .suspend    = cpsw_suspend,
    .resume        = cpsw_resume,
};

static struct platform_driver cpsw_driver = {
    .driver = {
        .name     = "cpsw",
        .owner     = THIS_MODULE,
        .pm     = &cpsw_pm_ops,
    },
    .probe = cpsw_probe,
    .remove = __devexit_p(cpsw_remove),
};

I am looking for a way to call the suspend/resume functions by setting a value in /sys probably. Please let me know how I can achieve this.


Viewing all articles
Browse latest Browse all 150011

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>