Re: [PATCH v3] tpm: do not suspend/resume if power stays on

From: Jason Gunthorpe
Date: Fri Mar 03 2017 - 12:11:51 EST


On Fri, Mar 03, 2017 at 05:09:59PM +0100, Enric Balletbo i Serra wrote:
> From: Sonny Rao <sonnyrao@xxxxxxxxxxxx>
>
> The suspend/resume behavior of the TPM can be controlled by setting
> "powered-while-suspended" in the DTS. This is useful for the cases
> when hardware does not power-off the TPM.
>
> Signed-off-by: Sonny Rao <sonnyrao@xxxxxxxxxxxx>
> Signed-off-by: Enric Balletbo i Serra <enric.balletbo@xxxxxxxxxxxxx>

Reviewed-by: Jason Gunthorpe <jgunthorpe@xxxxxxxxxxxxxxxxxxxx>

> +++ b/drivers/char/tpm/tpm_of.c
> @@ -34,6 +34,9 @@ int tpm_read_log_of(struct tpm_chip *chip)
> else
> return -ENODEV;
>
> + if (of_property_read_bool(np, "powered-while-suspended"))
> + chip->flags |= TPM_CHIP_FLAG_ALWAYS_POWERED;
> +

It is really weird that this is in a function called tpm_read_log_of,
but it makes sense to use the existing conditional infrastructure for
OF as well.

We should try to tidy this later...

Jason