Commit 937ebf9c authored by Jonas Gorski's avatar Jonas Gorski Committed by Mark Brown

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: default avatarJonas Gorski <jogo@openwrt.org>
Signed-off-by: default avatarMark Brown <broonie@linaro.org>
parent 7d255695
...@@ -425,14 +425,14 @@ static int bcm63xx_hsspi_remove(struct platform_device *pdev) ...@@ -425,14 +425,14 @@ static int bcm63xx_hsspi_remove(struct platform_device *pdev)
return 0; return 0;
} }
#ifdef CONFIG_PM #ifdef CONFIG_PM_SLEEP
static int bcm63xx_hsspi_suspend(struct device *dev) static int bcm63xx_hsspi_suspend(struct device *dev)
{ {
struct spi_master *master = dev_get_drvdata(dev); struct spi_master *master = dev_get_drvdata(dev);
struct bcm63xx_hsspi *bs = spi_master_get_devdata(master); struct bcm63xx_hsspi *bs = spi_master_get_devdata(master);
spi_master_suspend(master); spi_master_suspend(master);
clk_disable(bs->clk); clk_disable_unprepare(bs->clk);
return 0; return 0;
} }
...@@ -441,30 +441,27 @@ static int bcm63xx_hsspi_resume(struct device *dev) ...@@ -441,30 +441,27 @@ static int bcm63xx_hsspi_resume(struct device *dev)
{ {
struct spi_master *master = dev_get_drvdata(dev); struct spi_master *master = dev_get_drvdata(dev);
struct bcm63xx_hsspi *bs = spi_master_get_devdata(master); struct bcm63xx_hsspi *bs = spi_master_get_devdata(master);
int ret;
ret = clk_prepare_enable(bs->clk);
if (ret)
return ret;
clk_enable(bs->clk);
spi_master_resume(master); spi_master_resume(master);
return 0; return 0;
} }
#endif
static const struct dev_pm_ops bcm63xx_hsspi_pm_ops = { static const struct dev_pm_ops bcm63xx_hsspi_pm_ops = {
.suspend = bcm63xx_hsspi_suspend, SET_SYSTEM_SLEEP_PM_OPS(bcm63xx_hsspi_suspend, bcm63xx_hsspi_resume)
.resume = bcm63xx_hsspi_resume,
}; };
#define BCM63XX_HSSPI_PM_OPS (&bcm63xx_hsspi_pm_ops)
#else
#define BCM63XX_HSSPI_PM_OPS NULL
#endif
static struct platform_driver bcm63xx_hsspi_driver = { static struct platform_driver bcm63xx_hsspi_driver = {
.driver = { .driver = {
.name = "bcm63xx-hsspi", .name = "bcm63xx-hsspi",
.owner = THIS_MODULE, .owner = THIS_MODULE,
.pm = BCM63XX_HSSPI_PM_OPS, .pm = &bcm63xx_hsspi_pm_ops,
}, },
.probe = bcm63xx_hsspi_probe, .probe = bcm63xx_hsspi_probe,
.remove = bcm63xx_hsspi_remove, .remove = bcm63xx_hsspi_remove,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment