On Mon, Aug 12, 2019 at 03:36:19PM -0700, Stephen Boyd wrote:
> Cr50 firmware has a requirement to wait for the TPM to wakeup before
> sending commands over the SPI bus. Otherwise, the firmware could be in
> deep sleep and not respond. Add a hook to tpm_tis_spi_transfer() before
> we start a SPI transfer so we can keep track of the last time the TPM
> driver accessed the SPI bus.
> 
> Cc: Andrey Pronin <apro...@chromium.org>
> Cc: Duncan Laurie <dlau...@chromium.org>
> Cc: Jason Gunthorpe <j...@ziepe.ca>
> Cc: Arnd Bergmann <a...@arndb.de>
> Cc: Greg Kroah-Hartman <gre...@linuxfoundation.org>
> Cc: Guenter Roeck <gro...@chromium.org>
> Cc: Alexander Steffen <alexander.stef...@infineon.com>
> Signed-off-by: Stephen Boyd <swb...@chromium.org>
> ---
>  drivers/char/tpm/tpm_tis_spi.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/char/tpm/tpm_tis_spi.c b/drivers/char/tpm/tpm_tis_spi.c
> index 819602e85b34..93f49b1941f0 100644
> --- a/drivers/char/tpm/tpm_tis_spi.c
> +++ b/drivers/char/tpm/tpm_tis_spi.c
> @@ -44,6 +44,7 @@ struct tpm_tis_spi_phy {
>       struct spi_device *spi_device;
>       int (*flow_control)(struct tpm_tis_spi_phy *phy,
>                           struct spi_transfer *xfer);
> +     void (*pre_transfer)(struct tpm_tis_spi_phy *phy);

A callback should have somewhat well defined purpose. A callback named
as pre_transfer() could have any purpose.

/Jarkko

Reply via email to