Skip to content

Commit 4407319

Browse files
Boris BrezillonLee Jones
authored andcommitted
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>
1 parent aaa572b commit 4407319

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

‎drivers/memory/atmel-ebi.c‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -507,6 +507,8 @@ static int atmel_ebi_probe(struct platform_device *pdev)
507507
if (!ebi)
508508
return -ENOMEM;
509509

510+
platform_set_drvdata(pdev, ebi);
511+
510512
INIT_LIST_HEAD(&ebi->devs);
511513
ebi->caps = match->data;
512514
ebi->dev = dev;
@@ -579,10 +581,28 @@ static int atmel_ebi_probe(struct platform_device *pdev)
579581
return of_platform_populate(np, NULL, NULL, dev);
580582
}
581583

584+
static int atmel_ebi_resume(struct device *dev)
585+
{
586+
struct atmel_ebi *ebi = dev_get_drvdata(dev);
587+
struct atmel_ebi_dev *ebid;
588+
589+
list_for_each_entry(ebid, &ebi->devs, node) {
590+
int i;
591+
592+
for (i = 0; i < ebid->numcs; i++)
593+
ebid->ebi->caps->apply_config(ebid, &ebid->configs[i]);
594+
}
595+
596+
return 0;
597+
}
598+
599+
static SIMPLE_DEV_PM_OPS(atmel_ebi_pm_ops, NULL, atmel_ebi_resume);
600+
582601
static struct platform_driver atmel_ebi_driver = {
583602
.driver = {
584603
.name = "atmel-ebi",
585604
.of_match_table = atmel_ebi_id_table,
605+
.pm = &atmel_ebi_pm_ops,
586606
},
587607
};
588608
builtin_platform_driver_probe(atmel_ebi_driver, atmel_ebi_probe);

0 commit comments

Comments
 (0)