diff options
author | Boris Brezillon <boris.brezillon@free-electrons.com> | 2017-03-16 09:30:34 +0100 |
---|---|---|
committer | Lee Jones <lee.jones@linaro.org> | 2017-04-27 09:25:06 +0100 |
commit | 4407319d8fff93308c2afe40e7c2a7dc564ec122 (patch) | |
tree | da626f42766eb39eb35cd4a450d782b5a16b5257 /drivers/memory | |
parent | aaa572b945876619ebd114d5a456d1250f267b9a (diff) | |
download | linux-4407319d8fff93308c2afe40e7c2a7dc564ec122.tar.gz linux-4407319d8fff93308c2afe40e7c2a7dc564ec122.tar.bz2 linux-4407319d8fff93308c2afe40e7c2a7dc564ec122.zip |
memory: atmel-ebi: Add PM ops
Add a ->resume() hook to make sure the EBI dev configs are correctly
restored when resuming the platform.
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Acked-by: Nicolas Ferre <nicolas.ferre@microchip.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Diffstat (limited to 'drivers/memory')
-rw-r--r-- | drivers/memory/atmel-ebi.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/drivers/memory/atmel-ebi.c b/drivers/memory/atmel-ebi.c index 7d24a957e98c..35910f945bfa 100644 --- a/drivers/memory/atmel-ebi.c +++ b/drivers/memory/atmel-ebi.c @@ -507,6 +507,8 @@ static int atmel_ebi_probe(struct platform_device *pdev) if (!ebi) return -ENOMEM; + platform_set_drvdata(pdev, ebi); + INIT_LIST_HEAD(&ebi->devs); ebi->caps = match->data; ebi->dev = dev; @@ -579,10 +581,28 @@ static int atmel_ebi_probe(struct platform_device *pdev) return of_platform_populate(np, NULL, NULL, dev); } +static int atmel_ebi_resume(struct device *dev) +{ + struct atmel_ebi *ebi = dev_get_drvdata(dev); + struct atmel_ebi_dev *ebid; + + list_for_each_entry(ebid, &ebi->devs, node) { + int i; + + for (i = 0; i < ebid->numcs; i++) + ebid->ebi->caps->apply_config(ebid, &ebid->configs[i]); + } + + return 0; +} + +static SIMPLE_DEV_PM_OPS(atmel_ebi_pm_ops, NULL, atmel_ebi_resume); + static struct platform_driver atmel_ebi_driver = { .driver = { .name = "atmel-ebi", .of_match_table = atmel_ebi_id_table, + .pm = &atmel_ebi_pm_ops, }, }; builtin_platform_driver_probe(atmel_ebi_driver, atmel_ebi_probe); |