From: Taniya Das <tdas@codeaurora.org>
To: Stephen Boyd <sboyd@kernel.org>,
Michael Turquette <mturquette@baylibre.com>,
Stephen Boyd <sboyd@codeaurora.org>
Cc: Andy Gross <andy.gross@linaro.org>,
David Brown <david.brown@linaro.org>,
Rajendra Nayak <rnayak@codeaurora.org>,
Odelu Kukatla <okukatla@codeaurora.org>,
Amit Nischal <anischal@codeaurora.org>,
linux-arm-msm@vger.kernel.org, linux-soc@vger.kernel.org,
linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/3] clk: qcom: gdsc: Add support to poll CFG register to check GDSC state
Date: Mon, 9 Apr 2018 14:11:42 +0530 [thread overview]
Message-ID: <530d64eb-a161-1f68-7725-1a52ab1dd999@codeaurora.org> (raw)
In-Reply-To: <152303280515.143116.7021012753371503067@swboyd.mtv.corp.google.com>
Hello Stephen,
Thanks for the review comments.
On 4/6/2018 10:10 PM, Stephen Boyd wrote:
> Quoting Taniya Das (2018-04-02 03:45:45)
>> diff --git a/drivers/clk/qcom/gdsc.c b/drivers/clk/qcom/gdsc.c
>> index e89584e..e0c83ba 100644
>> --- a/drivers/clk/qcom/gdsc.c
>> +++ b/drivers/clk/qcom/gdsc.c
>> @@ -83,6 +88,38 @@ static int gdsc_poll_status(struct gdsc *sc, unsigned int reg, bool en)
>> return -ETIMEDOUT;
>> }
>>
>> +static int gdsc_is_enabled_by_poll_cfg_reg(struct gdsc *sc, bool en)
>> +{
>> + u32 val;
>> + int ret;
>> +
>> + ret = regmap_read(sc->regmap, sc->gdscr + CFG_GDSCR_OFFSET, &val);
>> + if (ret)
>> + return ret;
>> +
>> + if (en)
>> + return !!(val & GDSC_POWER_UP_COMPLETE);
>> + else
>> + return !(val & GDSC_POWER_DOWN_COMPLETE);
>
> Make this into
>
> if (en)
> return ...
>
> return ...
>
Will fix this in the next series.
>> +}
>> +
>> +static int gdsc_poll_cfg_status(struct gdsc *sc, bool en)
>> +{
>> + ktime_t start = ktime_get();
>> + ktime_t timeout =
>> + (sc->flags & GDS_TIMEOUT) ? TIMEOUT_US_GDS : TIMEOUT_US;
>> +
>> + do {
>> + if (gdsc_is_enabled_by_poll_cfg_reg(sc, en) == en)
>> + return 0;
>> + } while (ktime_us_delta(ktime_get(), start) < timeout);
>> +
>> + if (gdsc_is_enabled_by_poll_cfg_reg(sc, en) == en)
>> + return 0;
>> +
>> + return -ETIMEDOUT;
>> +}
>> +
>> static int gdsc_toggle_logic(struct gdsc *sc, bool en)
>> {
>> int ret;
>> @@ -106,6 +143,9 @@ static int gdsc_toggle_logic(struct gdsc *sc, bool en)
>> return 0;
>> }
>>
>> + if (sc->flags & POLL_CFG_GDSCR)
>> + return gdsc_poll_cfg_status(sc, en);
>> +
>> if (sc->gds_hw_ctrl) {
>> status_reg = sc->gds_hw_ctrl;
>> /*
>> @@ -258,8 +298,12 @@ static int gdsc_disable(struct generic_pm_domain *domain)
>> */
>> udelay(1);
>>
>> - reg = sc->gds_hw_ctrl ? sc->gds_hw_ctrl : sc->gdscr;
>> - ret = gdsc_poll_status(sc, reg, true);
>> + if (sc->flags & POLL_CFG_GDSCR) {
>> + ret = gdsc_poll_cfg_status(sc, true);
>> + } else {
>> + reg = sc->gds_hw_ctrl ? sc->gds_hw_ctrl : sc->gdscr;
>> + ret = gdsc_poll_status(sc, reg, true);
>> + }
>
> Maybe this can be pushed into the gdsc_poll_status() function so that
> we can keep the "how do we poll status bit" logic in one place.
>
Yes, I will push the logic in the gdsc_poll_status() in the next series.
>> if (ret)
>> return ret;
>> }
--
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member
of Code Aurora Forum, hosted by The Linux Foundation.
--
prev parent reply other threads:[~2018-04-09 8:41 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-02 10:45 [PATCH 0/3] Update reset and poll logic for GDSCs Taniya Das
2018-04-02 10:45 ` [PATCH 1/3] clk: qcom: gdsc: Add support to reset AON and block reset logic Taniya Das
2018-04-02 10:45 ` [PATCH 2/3] clk: qcom: gdsc: Add support to poll for higher timeout value Taniya Das
2018-04-05 23:24 ` Stephen Boyd
2018-04-09 8:40 ` Taniya Das
2018-04-02 10:45 ` [PATCH 3/3] clk: qcom: gdsc: Add support to poll CFG register to check GDSC state Taniya Das
2018-04-06 16:40 ` Stephen Boyd
2018-04-09 8:41 ` Taniya Das [this message]
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=530d64eb-a161-1f68-7725-1a52ab1dd999@codeaurora.org \
--to=tdas@codeaurora.org \
--cc=andy.gross@linaro.org \
--cc=anischal@codeaurora.org \
--cc=david.brown@linaro.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-clk@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-soc@vger.kernel.org \
--cc=mturquette@baylibre.com \
--cc=okukatla@codeaurora.org \
--cc=rnayak@codeaurora.org \
--cc=sboyd@codeaurora.org \
--cc=sboyd@kernel.org \
/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
Powered by JetHome