From e0b13b5b6a9ad3ccadaa6662524a92e13aa7a032 Mon Sep 17 00:00:00 2001 From: Paul Parsons Date: Tue, 9 Aug 2011 16:27:33 +0000 Subject: mfd: Add asic3 based LED suspend/resume handlers Added led suspend/resume handlers to the leds/leds-asic3 and mfd/asic3 drivers. On suspend the leds will be turned off and their clocks disabled. On resume the reverse. Signed-off-by: Paul Parsons Signed-off-by: Samuel Ortiz --- drivers/mfd/asic3.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'drivers/mfd/asic3.c') diff --git a/drivers/mfd/asic3.c b/drivers/mfd/asic3.c index 5ac2961fedfe..2dbb8ca89730 100644 --- a/drivers/mfd/asic3.c +++ b/drivers/mfd/asic3.c @@ -813,24 +813,43 @@ static int asic3_leds_disable(struct platform_device *pdev) return 0; } +static int asic3_leds_suspend(struct platform_device *pdev) +{ + const struct mfd_cell *cell = mfd_get_cell(pdev); + struct asic3 *asic = dev_get_drvdata(pdev->dev.parent); + + while (asic3_gpio_get(&asic->gpio, ASIC3_GPIO(C, cell->id)) != 0) + msleep(1); + + asic3_clk_disable(asic, &asic->clocks[clock_ledn[cell->id]]); + + return 0; +} + static struct mfd_cell asic3_cell_leds[ASIC3_NUM_LEDS] = { [0] = { .name = "leds-asic3", .id = 0, .enable = asic3_leds_enable, .disable = asic3_leds_disable, + .suspend = asic3_leds_suspend, + .resume = asic3_leds_enable, }, [1] = { .name = "leds-asic3", .id = 1, .enable = asic3_leds_enable, .disable = asic3_leds_disable, + .suspend = asic3_leds_suspend, + .resume = asic3_leds_enable, }, [2] = { .name = "leds-asic3", .id = 2, .enable = asic3_leds_enable, .disable = asic3_leds_disable, + .suspend = asic3_leds_suspend, + .resume = asic3_leds_enable, }, }; -- cgit v1.2.3