aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJarkko Sakkinen <jarkko.sakkinen@linux.intel.com>2019-03-22 06:51:20 -0400
committerJames Morris <james.morris@microsoft.com>2019-04-08 18:58:52 -0400
commite891db1a18bf11e02533ec2386b796cfd8d60666 (patch)
treeb750c0c024caa9d047add14dbe52f4259080dcc5
parentfd008d1a7a204695f0e5e003af16448bb9c34b7b (diff)
tpm: turn on TPM on suspend for TPM 1.x
tpm_chip_start/stop() should be also called for TPM 1.x devices on suspend. Add that functionality back. Do not lock the chip because it is unnecessary as there are no multiple threads using it when doing the suspend. Fixes: a3fbfae82b4c ("tpm: take TPM chip power gating out of tpm_transmit()") Reported-by: Paul Zimmerman <pauldzim@gmail.com> Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> Tested-by: Domenico Andreoli <domenico.andreoli@linux.com> Signed-off-by: James Morris <james.morris@microsoft.com>
-rw-r--r--drivers/char/tpm/tpm-interface.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/drivers/char/tpm/tpm-interface.c b/drivers/char/tpm/tpm-interface.c
index 83ece5639f86..ae1030c9b086 100644
--- a/drivers/char/tpm/tpm-interface.c
+++ b/drivers/char/tpm/tpm-interface.c
@@ -402,15 +402,13 @@ int tpm_pm_suspend(struct device *dev)
402 if (chip->flags & TPM_CHIP_FLAG_ALWAYS_POWERED) 402 if (chip->flags & TPM_CHIP_FLAG_ALWAYS_POWERED)
403 return 0; 403 return 0;
404 404
405 if (chip->flags & TPM_CHIP_FLAG_TPM2) { 405 if (!tpm_chip_start(chip)) {
406 mutex_lock(&chip->tpm_mutex); 406 if (chip->flags & TPM_CHIP_FLAG_TPM2)
407 if (!tpm_chip_start(chip)) {
408 tpm2_shutdown(chip, TPM2_SU_STATE); 407 tpm2_shutdown(chip, TPM2_SU_STATE);
409 tpm_chip_stop(chip); 408 else
410 } 409 rc = tpm1_pm_suspend(chip, tpm_suspend_pcr);
411 mutex_unlock(&chip->tpm_mutex); 410
412 } else { 411 tpm_chip_stop(chip);
413 rc = tpm1_pm_suspend(chip, tpm_suspend_pcr);
414 } 412 }
415 413
416 return rc; 414 return rc;