diff options
author | Winkler, Tomas <tomas.winkler@intel.com> | 2017-03-05 18:53:35 -0500 |
---|---|---|
committer | Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> | 2017-04-03 15:46:00 -0400 |
commit | 095fc30c2c8d2c63ec88745f57711f05af617581 (patch) | |
tree | 241ca4cb8800e4374e3e3941665fd21bc08f04ff | |
parent | 4bf4b4ed9de40eb58232a9f576391fdc5e13a7b4 (diff) |
tpm/tpm_crb: enter the low power state upon device suspend
This fix enables a platform to enter the idle state (suspend-to-idle)
The driver needs to request explicitly go_idle upon completion
from the pm suspend handler.
The runtime pm is disabled on suspend during prepare state by calling
pm_runtime_get_noresume, hence we cannot relay on runtime pm to leave
the device in low power state. Symmetrically cmdReady is called
upon resume.
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Tested-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Reviewed-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Siged-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
-rw-r--r-- | drivers/char/tpm/tpm_crb.c | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/drivers/char/tpm/tpm_crb.c b/drivers/char/tpm/tpm_crb.c index 421dfa959a4f..cb6fb131963f 100644 --- a/drivers/char/tpm/tpm_crb.c +++ b/drivers/char/tpm/tpm_crb.c | |||
@@ -502,10 +502,33 @@ static int crb_pm_runtime_resume(struct device *dev) | |||
502 | 502 | ||
503 | return crb_cmd_ready(dev, priv); | 503 | return crb_cmd_ready(dev, priv); |
504 | } | 504 | } |
505 | |||
506 | static int crb_pm_suspend(struct device *dev) | ||
507 | { | ||
508 | int ret; | ||
509 | |||
510 | ret = tpm_pm_suspend(dev); | ||
511 | if (ret) | ||
512 | return ret; | ||
513 | |||
514 | return crb_pm_runtime_suspend(dev); | ||
515 | } | ||
516 | |||
517 | static int crb_pm_resume(struct device *dev) | ||
518 | { | ||
519 | int ret; | ||
520 | |||
521 | ret = crb_pm_runtime_resume(dev); | ||
522 | if (ret) | ||
523 | return ret; | ||
524 | |||
525 | return tpm_pm_resume(dev); | ||
526 | } | ||
527 | |||
505 | #endif /* CONFIG_PM */ | 528 | #endif /* CONFIG_PM */ |
506 | 529 | ||
507 | static const struct dev_pm_ops crb_pm = { | 530 | static const struct dev_pm_ops crb_pm = { |
508 | SET_SYSTEM_SLEEP_PM_OPS(tpm_pm_suspend, tpm_pm_resume) | 531 | SET_SYSTEM_SLEEP_PM_OPS(crb_pm_suspend, crb_pm_resume) |
509 | SET_RUNTIME_PM_OPS(crb_pm_runtime_suspend, crb_pm_runtime_resume, NULL) | 532 | SET_RUNTIME_PM_OPS(crb_pm_runtime_suspend, crb_pm_runtime_resume, NULL) |
510 | }; | 533 | }; |
511 | 534 | ||