Skip to content

Commit

Permalink
spi: atmel: add missing spi_master_{resume,suspend} calls to PM callb…
Browse files Browse the repository at this point in the history
…acks

The PM callbacks implemented by the spi-atmel driver don't call
spi_master_{resume,suspend}, fix that.

Signed-off-by: Wenyou Yang <wenyou.yang@atmel.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
  • Loading branch information
Wenyou Yang authored and Mark Brown committed Mar 5, 2014
1 parent 38dbfb5 commit ba938f3
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion drivers/spi/spi-atmel.c
Original file line number Diff line number Diff line change
Expand Up @@ -1455,6 +1455,14 @@ static int atmel_spi_suspend(struct device *dev)
{
struct spi_master *master = dev_get_drvdata(dev);
struct atmel_spi *as = spi_master_get_devdata(master);
int ret;

/* Stop the queue running */
ret = spi_master_suspend(master);
if (ret) {
dev_warn(dev, "cannot suspend master\n");
return ret;
}

clk_disable_unprepare(as->clk);
return 0;
Expand All @@ -1464,9 +1472,16 @@ static int atmel_spi_resume(struct device *dev)
{
struct spi_master *master = dev_get_drvdata(dev);
struct atmel_spi *as = spi_master_get_devdata(master);
int ret;

clk_prepare_enable(as->clk);
return 0;

/* Start the queue running */
ret = spi_master_resume(master);
if (ret)
dev_err(dev, "problem starting queue (%d)\n", ret);

return ret;
}

static SIMPLE_DEV_PM_OPS(atmel_spi_pm_ops, atmel_spi_suspend, atmel_spi_resume);
Expand Down

0 comments on commit ba938f3

Please sign in to comment.