mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Priyansh Jain <quic_priyjain@quicinc.com>
To: Daniel Lezcano <daniel.lezcano@linaro.org>,
	Amit Kucheria <amitk@kernel.org>,
	Thara Gopinath <thara.gopinath@gmail.com>,
	"Bjorn Andersson" <andersson@kernel.org>,
	Konrad Dybcio <konrad.dybcio@linaro.org>,
	"Rafael J . Wysocki" <rafael@kernel.org>,
	Zhang Rui <rui.zhang@intel.com>,
	Lukasz Luba <lukasz.luba@arm.com>, <linux-pm@vger.kernel.org>,
	<linux-arm-msm@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Cc: <quic_manafm@quicinc.com>
Subject: Re: [PATCH v4] thermal/drivers/tsens: Add suspend to RAM support for tsens
Date: Wed, 27 Mar 2024 15:11:47 +0530	[thread overview]
Message-ID: <05d95845-85ce-bf83-57a7-135265a7508d@quicinc.com> (raw)
In-Reply-To: <9bea167d-edcf-4d66-8ec7-051e97c8dffd@linaro.org>



On 3/26/2024 4:30 PM, Daniel Lezcano wrote:
> On 26/03/2024 08:40, Priyansh Jain wrote:
>> As part of suspend to RAM, tsens hardware will be turned off.
>> While resume callback, re-initialize tsens hardware.
>>
>> Signed-off-by: Priyansh Jain <quic_priyjain@quicinc.com>
>> ---
>> V3 -> V4: Make tsens_reinit function specific to tsens v2. Add
>> NULL resume callback support for platform whose versions < ver_2_x
>> in tsens ops.
>> V2 -> V3: Remove suspend callback & interrupt enablement part from
>> resume callback.
>> V1 -> V2: Update commit text to explain the necessity of this patch
>>
>>   drivers/thermal/qcom/tsens-v0_1.c |  6 +++++
>>   drivers/thermal/qcom/tsens-v1.c   |  3 +++
>>   drivers/thermal/qcom/tsens-v2.c   |  1 +
>>   drivers/thermal/qcom/tsens.c      | 37 +++++++++++++++++++++++++++++++
>>   drivers/thermal/qcom/tsens.h      |  5 +++++
>>   5 files changed, 52 insertions(+)
>>
>> diff --git a/drivers/thermal/qcom/tsens-v0_1.c 
>> b/drivers/thermal/qcom/tsens-v0_1.c
>> index 32d2d3e33287..7ed85379247b 100644
>> --- a/drivers/thermal/qcom/tsens-v0_1.c
>> +++ b/drivers/thermal/qcom/tsens-v0_1.c
>> @@ -329,6 +329,7 @@ static const struct tsens_ops ops_8226 = {
>>       .init        = init_8226,
>>       .calibrate    = tsens_calibrate_common,
>>       .get_temp    = get_temp_common,
>> +    .resume        = NULL,
> 
> As a static variable it is already set to NULL. Why do you need to 
> explicitly set them everywhere ?
> 
It was asked in last version to explicitly add (.resume = NULL). So 
added this for all the tsens platforms for which resume callback is not
validated.

> [ ... ]
> 
>> +#ifdef CONFIG_SUSPEND
>> +static int tsens_reinit(struct tsens_priv *priv)
>> +{
>> +    unsigned long flags;
>> +
>> +    spin_lock_irqsave(&priv->ul_lock, flags);
> 
> What this lock is protecting ?
> 
Yes this lock can be removed, will remove this in next patch.

>> +    if (tsens_version(priv) >= VER_2_X) {
> 
> May be move this test before the lock ?
> 
>> +        /*
>> +         * Re-enable the watchdog, unmask the bark.
>> +         * Disable cycle completion monitoring
>> +         */
>> +        if (priv->feat->has_watchdog) {
>> +            regmap_field_write(priv->rf[WDOG_BARK_MASK], 0);
>> +            regmap_field_write(priv->rf[CC_MON_MASK], 1);
>> +        }
>> +
>> +        /* Re-enable interrupts */
>> +        tsens_enable_irq(priv);
>> +    }
>> +
>> +    spin_unlock_irqrestore(&priv->ul_lock, flags);
>> +
>> +    return 0;
>> +}
>> +
>> +int tsens_resume_common(struct tsens_priv *priv)
>> +{
>> +    if (pm_suspend_target_state == PM_SUSPEND_MEM)
>> +        tsens_reinit(priv);
>> +
>> +    return 0;
>> +}
>> +
>> +#endif /* !CONFIG_SUSPEND */
> 
> 

  reply	other threads:[~2024-03-27  9:42 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-26  7:40 Priyansh Jain
2024-03-26 11:00 ` Daniel Lezcano
2024-03-27  9:41   ` Priyansh Jain [this message]
2024-03-28  4:50     ` Amit Kucheria

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=05d95845-85ce-bf83-57a7-135265a7508d@quicinc.com \
    --to=quic_priyjain@quicinc.com \
    --cc=amitk@kernel.org \
    --cc=andersson@kernel.org \
    --cc=daniel.lezcano@linaro.org \
    --cc=konrad.dybcio@linaro.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=lukasz.luba@arm.com \
    --cc=quic_manafm@quicinc.com \
    --cc=rafael@kernel.org \
    --cc=rui.zhang@intel.com \
    --cc=thara.gopinath@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®