Skip to content

Commit e891db1

Browse files
Jarkko SakkinenJames Morris
authored andcommitted
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: a3fbfae ("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>
1 parent fd008d1 commit e891db1

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

drivers/char/tpm/tpm-interface.c

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -402,15 +402,13 @@ int tpm_pm_suspend(struct device *dev)
402402
if (chip->flags & TPM_CHIP_FLAG_ALWAYS_POWERED)
403403
return 0;
404404

405-
if (chip->flags & TPM_CHIP_FLAG_TPM2) {
406-
mutex_lock(&chip->tpm_mutex);
407-
if (!tpm_chip_start(chip)) {
405+
if (!tpm_chip_start(chip)) {
406+
if (chip->flags & TPM_CHIP_FLAG_TPM2)
408407
tpm2_shutdown(chip, TPM2_SU_STATE);
409-
tpm_chip_stop(chip);
410-
}
411-
mutex_unlock(&chip->tpm_mutex);
412-
} else {
413-
rc = tpm1_pm_suspend(chip, tpm_suspend_pcr);
408+
else
409+
rc = tpm1_pm_suspend(chip, tpm_suspend_pcr);
410+
411+
tpm_chip_stop(chip);
414412
}
415413

416414
return rc;

0 commit comments

Comments
 (0)