Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751852AbdCCRL3 (ORCPT ); Fri, 3 Mar 2017 12:11:29 -0500 Received: from quartz.orcorp.ca ([184.70.90.242]:55474 "EHLO quartz.orcorp.ca" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751663AbdCCRLX (ORCPT ); Fri, 3 Mar 2017 12:11:23 -0500 Date: Fri, 3 Mar 2017 10:11:07 -0700 From: Jason Gunthorpe To: Enric Balletbo i Serra Cc: Rob Herring , Peter Huewe , Mark Rutland , Jarkko Sakkinen , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, tpmdd-devel@lists.sourceforge.net, Sonny Rao Subject: Re: [PATCH v3] tpm: do not suspend/resume if power stays on Message-ID: <20170303171107.GA2273@obsidianresearch.com> References: <20170303160959.27422-1-enric.balletbo@collabora.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170303160959.27422-1-enric.balletbo@collabora.com> User-Agent: Mutt/1.5.24 (2015-08-30) X-Broken-Reverse-DNS: no host name found for IP address 10.0.0.156 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 934 Lines: 28 On Fri, Mar 03, 2017 at 05:09:59PM +0100, Enric Balletbo i Serra wrote: > From: Sonny Rao > > 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 > Signed-off-by: Enric Balletbo i Serra Reviewed-by: Jason Gunthorpe > +++ 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