devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stephen Boyd <sboyd@kernel.org>
To: Andy Gross <agross@kernel.org>,
	Bjorn Andersson <andersson@kernel.org>,
	Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
	Michael Turquette <mturquette@baylibre.com>,
	Richard Cochran <richardcochran@gmail.com>,
	Rob Herring <robh+dt@kernel.org>,
	Taniya Das <quic_tdas@quicinc.com>
Cc: quic_skakitap@quicinc.com,
	Imran Shaik <quic_imrashai@quicinc.com>,
	linux-arm-msm@vger.kernel.org, linux-clk@vger.kernel.org,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	Taniya Das <quic_tdas@quicinc.com>,
	quic_rohiagar@quicinc.com, netdev@vger.kernel.org
Subject: Re: [PATCH 1/4] clk: qcom: branch: Extend the invert logic for branch2 clocks
Date: Wed, 19 Apr 2023 14:37:10 -0700	[thread overview]
Message-ID: <0dc457cbd13ea76a3aa3c70b2a31a537.sboyd@kernel.org> (raw)
In-Reply-To: <20230419133013.2563-2-quic_tdas@quicinc.com>

Quoting Taniya Das (2023-04-19 06:30:10)
> From: Imran Shaik <quic_imrashai@quicinc.com>
> 
> Add support to handle the invert logic for branch2 clocks.
> Invert branch halt would indicate the clock ON when CLK_OFF
> bit is '1' and OFF when CLK_OFF bit is '0'.
> 
> Signed-off-by: Imran Shaik <quic_imrashai@quicinc.com>
> Signed-off-by: Taniya Das <quic_tdas@quicinc.com>
> ---
>  drivers/clk/qcom/clk-branch.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/drivers/clk/qcom/clk-branch.c b/drivers/clk/qcom/clk-branch.c
> index f869fc6aaed6..4b24d45be771 100644
> --- a/drivers/clk/qcom/clk-branch.c
> +++ b/drivers/clk/qcom/clk-branch.c
> @@ -48,6 +48,7 @@ static bool clk_branch2_check_halt(const struct clk_branch *br, bool enabling)
>  {
>         u32 val;
>         u32 mask;
> +       bool invert = (br->halt_check == BRANCH_HALT_ENABLE);
>  
>         mask = BRANCH_NOC_FSM_STATUS_MASK << BRANCH_NOC_FSM_STATUS_SHIFT;
>         mask |= BRANCH_CLK_OFF;
> @@ -56,9 +57,16 @@ static bool clk_branch2_check_halt(const struct clk_branch *br, bool enabling)
>  
>         if (enabling) {
>                 val &= mask;
> +
> +               if (invert)
> +                       return (val & BRANCH_CLK_OFF) == BRANCH_CLK_OFF;
> +
>                 return (val & BRANCH_CLK_OFF) == 0 ||
>                         val == BRANCH_NOC_FSM_STATUS_ON;

Do these clks have a NOC_FSM_STATUS bit? I think it would be better to
make a local variable for the val we're looking for, and then test for
that. We may need a mask as well, but the idea is to not duplicate the
test and return from multiple places.

>         } else {
> +               if (invert)
> +                       return (val & BRANCH_CLK_OFF) == 0;
> +
>                 return val & BRANCH_CLK_OFF;
>         }

While at it, I'd get rid of this else and de-indent the code because if
we're 'enabling' we'll return from the function regardless.

  reply	other threads:[~2023-04-19 21:37 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-19 13:30 [PATCH 0/4] Add GCC and RPMHCC support for sdx75 Taniya Das
2023-04-19 13:30 ` [PATCH 1/4] clk: qcom: branch: Extend the invert logic for branch2 clocks Taniya Das
2023-04-19 21:37   ` Stephen Boyd [this message]
2023-05-08 11:01     ` Taniya Das
2023-04-19 13:30 ` [PATCH 2/4] dt-bindings: clock: Add GCC bindings support for SDX75 Taniya Das
2023-04-19 18:11   ` Krzysztof Kozlowski
2023-05-09  9:09     ` Taniya Das
2023-04-19 13:30 ` [PATCH 3/4] clk: qcom: rpmh: Add RPMH clocks " Taniya Das
2023-04-20 10:05   ` Dmitry Baryshkov
2023-04-19 13:30 ` [PATCH 4/4] clk: qcom: Add GCC driver " Taniya Das
2023-04-20 10:10   ` Dmitry Baryshkov
2023-05-09  9:14     ` Taniya Das
2023-05-09 11:24       ` Dmitry Baryshkov

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=0dc457cbd13ea76a3aa3c70b2a31a537.sboyd@kernel.org \
    --to=sboyd@kernel.org \
    --cc=agross@kernel.org \
    --cc=andersson@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mturquette@baylibre.com \
    --cc=netdev@vger.kernel.org \
    --cc=quic_imrashai@quicinc.com \
    --cc=quic_rohiagar@quicinc.com \
    --cc=quic_skakitap@quicinc.com \
    --cc=quic_tdas@quicinc.com \
    --cc=richardcochran@gmail.com \
    --cc=robh+dt@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;
as well as URLs for NNTP newsgroup(s).