From mboxrd@z Thu Jan 1 00:00:00 1970 From: "christophe.ricard" Subject: Re: [PATCH v4 1/4] tpm/tpm_i2c_stm_st33: Replace access to io_lpcpd from struct st33zp24_platform_data to tpm_stm_dev Date: Mon, 26 Jan 2015 23:18:23 +0100 Message-ID: <54C6BD2F.90605@gmail.com> References: <1422220293-21005-1-git-send-email-christophe-h.ricard@st.com> <1422220293-21005-2-git-send-email-christophe-h.ricard@st.com> <201501262315.07543.PeterHuewe@gmx.de> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15; format=flowed Content-Transfer-Encoding: QUOTED-PRINTABLE Return-path: In-Reply-To: <201501262315.07543.PeterHuewe-Mmb7MZpHnFY@public.gmane.org> Sender: devicetree-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org To: =?ISO-8859-15?Q?Peter_H=FCwe?= Cc: ashley-fm2HMyfA2y6tG0bUXCXiUA@public.gmane.org, tpmdd-yWjUBOtONefk1uMJSBkQmQ@public.gmane.org, tpmdd-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org, christophe-h.ricard-qxv4g6HH51o@public.gmane.org, jean-luc.blanc-qxv4g6HH51o@public.gmane.org, benoit.houyere-qxv4g6HH51o@public.gmane.org, devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org, jarkko.sakkinen-VuQAYsv1563Yd54FQh9/CA@public.gmane.org List-Id: devicetree@vger.kernel.org Hi Peter, The lpcpd pin allow the tpm to go in low power mode keeping the current= =20 context in RAM. As mention in the dts documentation: "If set, power must be present when the platform is going into=20 sleep/hibernate mode." The gpio state is enough to save and restore the context. This allows for example saving some memory wear or quicker state change= s... Best Regards Christophe On 26/01/2015 23:15, Peter H=FCwe wrote: > Hi Christophe, > Am Sonntag, 25. Januar 2015, 22:11:30 schrieb Christophe Ricard: >> io_lpcpd is accessible from struct tpm_stm_dev. >> struct st33zp24_platform_data is only valid when using static platfo= rm >> configuration data, not when using dts. >> >> Reviewed-by: Jason Gunthorpe >> Signed-off-by: Christophe Ricard >> --- >> drivers/char/tpm/tpm_i2c_stm_st33.c | 18 +++++++++++------- >> 1 file changed, 11 insertions(+), 7 deletions(-) >> >> diff --git a/drivers/char/tpm/tpm_i2c_stm_st33.c >> b/drivers/char/tpm/tpm_i2c_stm_st33.c index 612845b..882c60a 100644 >> --- a/drivers/char/tpm/tpm_i2c_stm_st33.c >> +++ b/drivers/char/tpm/tpm_i2c_stm_st33.c >> @@ -837,11 +837,14 @@ static int tpm_stm_i2c_remove(struct i2c_clien= t >> *client) */ >> static int tpm_stm_i2c_pm_suspend(struct device *dev) >> { >> - struct st33zp24_platform_data *pin_infos =3D dev->platform_data; >> + struct tpm_chip *chip =3D dev_get_drvdata(dev); >> + struct tpm_stm_dev *tpm_dev; >> int ret =3D 0; >> >> - if (gpio_is_valid(pin_infos->io_lpcpd)) >> - gpio_set_value(pin_infos->io_lpcpd, 0); >> + tpm_dev =3D (struct tpm_stm_dev *)TPM_VPRIV(chip); >> + >> + if (gpio_is_valid(tpm_dev->io_lpcpd)) >> + gpio_set_value(tpm_dev->io_lpcpd, 0); >> else >> ret =3D tpm_pm_suspend(dev); > I know this is not changed by this patch, but > don't you need to send a tpm savestate? or is this implicit by pullin= g > io_lpcpd ? > > > >> @@ -856,12 +859,13 @@ static int tpm_stm_i2c_pm_suspend(struct devic= e *dev) >> static int tpm_stm_i2c_pm_resume(struct device *dev) >> { >> struct tpm_chip *chip =3D dev_get_drvdata(dev); >> - struct st33zp24_platform_data *pin_infos =3D dev->platform_data; >> - >> + struct tpm_stm_dev *tpm_dev; >> int ret =3D 0; >> >> - if (gpio_is_valid(pin_infos->io_lpcpd)) { >> - gpio_set_value(pin_infos->io_lpcpd, 1); >> + tpm_dev =3D (struct tpm_stm_dev *)TPM_VPRIV(chip); >> + >> + if (gpio_is_valid(tpm_dev->io_lpcpd)) { >> + gpio_set_value(tpm_dev->io_lpcpd, 1); >> ret =3D wait_for_stat(chip, >> TPM_STS_VALID, chip->vendor.timeout_b, >> &chip->vendor.read_queue, false); > > Same applies to startup(STATE) on resume? > > Peter -- To unsubscribe from this list: send the line "unsubscribe devicetree" i= n the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html