Skip to content

Commit 17c2dae

Browse files
buytenhdwmw2
authored andcommitted
[MTD] physmap: add power management support
Implement PM handling for physmap. Idea from Steven Scholz, patch by David Anders. Signed-off-by: Lennert Buytenhek <buytenh@wantstofly.org> Signed-off-by: David Woodhouse <dwmw2@infradead.org>
1 parent 25f0c65 commit 17c2dae

1 file changed

Lines changed: 33 additions & 0 deletions

File tree

‎drivers/mtd/maps/physmap.c‎

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,9 +158,42 @@ static int physmap_flash_probe(struct platform_device *dev)
158158
return err;
159159
}
160160

161+
#ifdef CONFIG_PM
162+
static int physmap_flash_suspend(struct platform_device *dev, pm_message_t state)
163+
{
164+
struct physmap_flash_info *info = platform_get_drvdata(dev);
165+
int ret = 0;
166+
167+
if (info)
168+
ret = info->mtd->suspend(info->mtd);
169+
170+
return ret;
171+
}
172+
173+
static int physmap_flash_resume(struct platform_device *dev)
174+
{
175+
struct physmap_flash_info *info = platform_get_drvdata(dev);
176+
if (info)
177+
info->mtd->resume(info->mtd);
178+
return 0;
179+
}
180+
181+
static void physmap_flash_shutdown(struct platform_device *dev)
182+
{
183+
struct physmap_flash_info *info = platform_get_drvdata(dev);
184+
if (info && info->mtd->suspend(info->mtd) == 0)
185+
info->mtd->resume(info->mtd);
186+
}
187+
#endif
188+
161189
static struct platform_driver physmap_flash_driver = {
162190
.probe = physmap_flash_probe,
163191
.remove = physmap_flash_remove,
192+
#ifdef CONFIG_PM
193+
.suspend = physmap_flash_suspend,
194+
.resume = physmap_flash_resume,
195+
.shutdown = physmap_flash_shutdown,
196+
#endif
164197
.driver = {
165198
.name = "physmap-flash",
166199
},

0 commit comments

Comments
 (0)