Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1590295

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

From Enric Balletbo i Serra <enric.balletbo@collabora.com>
Newsgroups linux.kernel
Subject Re: [PATCH] tpm: do not suspend/resume if power stays on
Date 2017-03-01 13:20 +0100
Message-ID <tgboB-2Wi-3@gated-at.bofh.it> (permalink)
References <tgb5g-2A8-21@gated-at.bofh.it> <tgbeW-2ST-11@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Hi Peter,

On 01/03/17 13:00, Peter Huewe wrote:
> 
> 
> Am 1. März 2017 12:51:16 MEZ schrieb Enric Balletbo i Serra <enric.balletbo@collabora.com>:
>> From: Sonny Rao <sonnyrao@chromium.org>
>>
>> The suspend/resume behavior of the TPM can be controlled
>> by setting "powered-while-suspended" in the DTS.
>>
>> Signed-off-by: Sonny Rao <sonnyrao@chromium.org>
>> Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
>> ---
>> Documentation/devicetree/bindings/tpm/tpm.txt | 25
>> +++++++++++++++++++++++++
>> drivers/char/tpm/tpm_i2c_infineon.c           | 25
>> ++++++++++++++++++++++++-
>> 2 files changed, 49 insertions(+), 1 deletion(-)
>> create mode 100644 Documentation/devicetree/bindings/tpm/tpm.txt
>>
>> diff --git a/Documentation/devicetree/bindings/tpm/tpm.txt
>> b/Documentation/devicetree/bindings/tpm/tpm.txt
>> new file mode 100644
>> index 0000000..af4de0d
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/tpm/tpm.txt
> 
> Hi, for this device there exists a binding in the i2c subfolder
> 
> https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/Documentation/devicetree/bindings/i2c/trivial-devices.txt?id=refs/tags/v4.10
> 

Thanks to catch this, I propose remove from trivial-devices.txt and create a new binding called Documentation/devicetree/bindings/i2c/i2c-tpm-infineon.txt for tpm-infineon devices? What do you think?

Thanks,
 Enric

> Peter
>> @@ -0,0 +1,25 @@
>> +TPM (Trusted Platform Module)
>> +
>> +A TPM on the I2C bus is a child of the node for the bus.
>> +
>> +Required properties:
>> +- compatible: should be "infineon,<chip>"
>> +- reg: the I2C address
>> +
>> +Optional properties:
>> +- powered-while-suspended: present when the TPM is left powered on
>> between
>> +  suspend and resume (makes the suspend/resume callbacks do nothing).
>> +
>> +Example:
>> +	i2c@12C90000 {
>> +		samsung,i2c-sda-delay = <100>;
>> +		samsung,i2c-max-bus-freq = <66000>;
>> +		gpios = <&gpa1 2 3 3 0>,
>> +			<&gpa1 3 3 3 0>;
>> +
>> +		tpm {
>> +			compatible = "infineon,slb9635tt";
>> +			reg = <0x20>;
>> +			powered-while-suspended;
>> +		};
>> +	};
>> diff --git a/drivers/char/tpm/tpm_i2c_infineon.c
>> b/drivers/char/tpm/tpm_i2c_infineon.c
>> index 62ee44e..19d9522 100644
>> --- a/drivers/char/tpm/tpm_i2c_infineon.c
>> +++ b/drivers/char/tpm/tpm_i2c_infineon.c
>> @@ -70,6 +70,7 @@ struct tpm_inf_dev {
>> 	u8 buf[TPM_BUFSIZE + sizeof(u8)]; /* max. buffer size + addr */
>> 	struct tpm_chip *chip;
>> 	enum i2c_chip_type chip_type;
>> +	bool powered_while_suspended;
>> };
>>
>> static struct tpm_inf_dev tpm_dev;
>> @@ -599,6 +600,11 @@ static int tpm_tis_i2c_init(struct device *dev)
>> 		goto out_err;
>> 	}
>>
>> +	if (dev->of_node &&
>> +	    of_get_property(dev->of_node, "powered-while-suspended", NULL)) {
>> +		tpm_dev.powered_while_suspended = true;
>> +	}
>> +
>> 	/* read four bytes from DID_VID register */
>> 	if (iic_tpm_read(TPM_DID_VID(0), (u8 *)&vendor, 4) < 0) {
>> 		dev_err(dev, "could not read vendor id\n");
>> @@ -662,7 +668,24 @@ static const struct of_device_id
>> tpm_tis_i2c_of_match[] = {
>> MODULE_DEVICE_TABLE(of, tpm_tis_i2c_of_match);
>> #endif
>>
>> -static SIMPLE_DEV_PM_OPS(tpm_tis_i2c_ops, tpm_pm_suspend,
>> tpm_pm_resume);
>> +static int __maybe_unused tpm_tis_i2c_suspend(struct device *dev)
>> +{
>> +	if (tpm_dev.powered_while_suspended)
>> +		return 0;
>> +
>> +	return tpm_pm_suspend(dev);
>> +}
>> +
>> +static int __maybe_unused tpm_tis_i2c_resume(struct device *dev)
>> +{
>> +	if (tpm_dev.powered_while_suspended)
>> +		return 0;
>> +
>> +	return tpm_pm_resume(dev);
>> +}
>> +
>> +static SIMPLE_DEV_PM_OPS(tpm_tis_i2c_ops, tpm_tis_i2c_suspend,
>> +			 tpm_tis_i2c_resume);
>>
>> static int tpm_tis_i2c_probe(struct i2c_client *client,
>> 			     const struct i2c_device_id *id)
> 

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH] tpm: do not suspend/resume if power stays on Enric Balletbo i Serra <enric.balletbo@collabora.com> - 2017-03-01 13:00 +0100
  Re: [PATCH] tpm: do not suspend/resume if power stays on Peter Huewe <peterhuewe@gmx.de> - 2017-03-01 13:10 +0100
    Re: [PATCH] tpm: do not suspend/resume if power stays on Enric Balletbo i Serra <enric.balletbo@collabora.com> - 2017-03-01 13:20 +0100
  Re: [PATCH] tpm: do not suspend/resume if power stays on Mark Rutland <mark.rutland@arm.com> - 2017-03-01 15:00 +0100
    Re: [tpmdd-devel] [PATCH] tpm: do not suspend/resume if power stays  on Jason Gunthorpe <jgunthorpe@obsidianresearch.com> - 2017-03-01 20:50 +0100
      Re: [tpmdd-devel] [PATCH] tpm: do not suspend/resume if power stays on Sonny Rao <sonnyrao@chromium.org> - 2017-03-01 23:40 +0100
        Re: [tpmdd-devel] [PATCH] tpm: do not suspend/resume if power stays on Sonny Rao <sonnyrao@chromium.org> - 2017-03-02 01:10 +0100
        Re: [tpmdd-devel] [PATCH] tpm: do not suspend/resume if power stays  on Jason Gunthorpe <jgunthorpe@obsidianresearch.com> - 2017-03-02 01:50 +0100

csiph-web