diff options
author | Jonas Gorski <jogo@openwrt.org> | 2013-12-17 15:44:48 -0500 |
---|---|---|
committer | Mark Brown <broonie@linaro.org> | 2013-12-17 17:32:17 -0500 |
commit | 937ebf9cd34ab3bc4ca26a4adf9c759fc58cc5e2 (patch) | |
tree | 154741cd34d94623092037f4c13680b5ae8a7719 | |
parent | 7d255695804fbe7b2c30bcd54c1faf1d0918443c (diff) |
spi/bcm63xx-hsspi: fix pm sleep support
Use the right CONFIG symbol to guard, properly (un)preprare clocks on
suspend/resume, and check the result of it.
Signed-off-by: Jonas Gorski <jogo@openwrt.org>
Signed-off-by: Mark Brown <broonie@linaro.org>
-rw-r--r-- | drivers/spi/spi-bcm63xx-hsspi.c | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/drivers/spi/spi-bcm63xx-hsspi.c b/drivers/spi/spi-bcm63xx-hsspi.c index 1721ea99d688..b528f9fc8bc0 100644 --- a/drivers/spi/spi-bcm63xx-hsspi.c +++ b/drivers/spi/spi-bcm63xx-hsspi.c | |||
@@ -425,14 +425,14 @@ static int bcm63xx_hsspi_remove(struct platform_device *pdev) | |||
425 | return 0; | 425 | return 0; |
426 | } | 426 | } |
427 | 427 | ||
428 | #ifdef CONFIG_PM | 428 | #ifdef CONFIG_PM_SLEEP |
429 | static int bcm63xx_hsspi_suspend(struct device *dev) | 429 | static int bcm63xx_hsspi_suspend(struct device *dev) |
430 | { | 430 | { |
431 | struct spi_master *master = dev_get_drvdata(dev); | 431 | struct spi_master *master = dev_get_drvdata(dev); |
432 | struct bcm63xx_hsspi *bs = spi_master_get_devdata(master); | 432 | struct bcm63xx_hsspi *bs = spi_master_get_devdata(master); |
433 | 433 | ||
434 | spi_master_suspend(master); | 434 | spi_master_suspend(master); |
435 | clk_disable(bs->clk); | 435 | clk_disable_unprepare(bs->clk); |
436 | 436 | ||
437 | return 0; | 437 | return 0; |
438 | } | 438 | } |
@@ -441,30 +441,27 @@ static int bcm63xx_hsspi_resume(struct device *dev) | |||
441 | { | 441 | { |
442 | struct spi_master *master = dev_get_drvdata(dev); | 442 | struct spi_master *master = dev_get_drvdata(dev); |
443 | struct bcm63xx_hsspi *bs = spi_master_get_devdata(master); | 443 | struct bcm63xx_hsspi *bs = spi_master_get_devdata(master); |
444 | int ret; | ||
445 | |||
446 | ret = clk_prepare_enable(bs->clk); | ||
447 | if (ret) | ||
448 | return ret; | ||
444 | 449 | ||
445 | clk_enable(bs->clk); | ||
446 | spi_master_resume(master); | 450 | spi_master_resume(master); |
447 | 451 | ||
448 | return 0; | 452 | return 0; |
449 | } | 453 | } |
454 | #endif | ||
450 | 455 | ||
451 | static const struct dev_pm_ops bcm63xx_hsspi_pm_ops = { | 456 | static const struct dev_pm_ops bcm63xx_hsspi_pm_ops = { |
452 | .suspend = bcm63xx_hsspi_suspend, | 457 | SET_SYSTEM_SLEEP_PM_OPS(bcm63xx_hsspi_suspend, bcm63xx_hsspi_resume) |
453 | .resume = bcm63xx_hsspi_resume, | ||
454 | }; | 458 | }; |
455 | 459 | ||
456 | #define BCM63XX_HSSPI_PM_OPS (&bcm63xx_hsspi_pm_ops) | ||
457 | #else | ||
458 | #define BCM63XX_HSSPI_PM_OPS NULL | ||
459 | #endif | ||
460 | |||
461 | |||
462 | |||
463 | static struct platform_driver bcm63xx_hsspi_driver = { | 460 | static struct platform_driver bcm63xx_hsspi_driver = { |
464 | .driver = { | 461 | .driver = { |
465 | .name = "bcm63xx-hsspi", | 462 | .name = "bcm63xx-hsspi", |
466 | .owner = THIS_MODULE, | 463 | .owner = THIS_MODULE, |
467 | .pm = BCM63XX_HSSPI_PM_OPS, | 464 | .pm = &bcm63xx_hsspi_pm_ops, |
468 | }, | 465 | }, |
469 | .probe = bcm63xx_hsspi_probe, | 466 | .probe = bcm63xx_hsspi_probe, |
470 | .remove = bcm63xx_hsspi_remove, | 467 | .remove = bcm63xx_hsspi_remove, |