mirror of
https://github.com/torvalds/linux.git
synced 2024-12-03 17:41:22 +00:00
spi: add power control when set_cs
As to set_cs takes effect immediately, power spi is needed when setup spi. Cc: Mark Brown <broonie@kernel.org> Signed-off-by: Luhua Xu <luhua.xu@mediatek.com> Link: https://lore.kernel.org/r/1572426234-30019-1-git-send-email-luhua.xu@mediatek.com Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
c618a90dca
commit
d948e6ca18
@ -3261,7 +3261,20 @@ int spi_setup(struct spi_device *spi)
|
||||
if (spi->controller->setup)
|
||||
status = spi->controller->setup(spi);
|
||||
|
||||
spi_set_cs(spi, false);
|
||||
if (spi->controller->auto_runtime_pm && spi->controller->set_cs) {
|
||||
status = pm_runtime_get_sync(spi->controller->dev.parent);
|
||||
if (status < 0) {
|
||||
pm_runtime_put_noidle(spi->controller->dev.parent);
|
||||
dev_err(&spi->controller->dev, "Failed to power device: %d\n",
|
||||
status);
|
||||
return status;
|
||||
}
|
||||
spi_set_cs(spi, false);
|
||||
pm_runtime_mark_last_busy(spi->controller->dev.parent);
|
||||
pm_runtime_put_autosuspend(spi->controller->dev.parent);
|
||||
} else {
|
||||
spi_set_cs(spi, false);
|
||||
}
|
||||
|
||||
if (spi->rt && !spi->controller->rt) {
|
||||
spi->controller->rt = true;
|
||||
|
Loading…
Reference in New Issue
Block a user