linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
To: Konrad Dybcio <konrad.dybcio@linaro.org>,
	Andy Gross <agross@kernel.org>,
	Bjorn Andersson <andersson@kernel.org>,
	Linus Walleij <linus.walleij@linaro.org>,
	linux-arm-msm@vger.kernel.org, linux-gpio@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] pinctrl: qcom: lpass-lpi: allow slew rate bit in main pin config register
Date: Mon, 4 Sep 2023 09:45:55 +0200	[thread overview]
Message-ID: <1f0bf00f-07db-4017-a30b-618d90ce0457@linaro.org> (raw)
In-Reply-To: <08a10dc1-bb8e-48b1-8d86-5ee513835196@linaro.org>

On 01/09/2023 14:28, Konrad Dybcio wrote:
> On 1.09.2023 11:02, Krzysztof Kozlowski wrote:
>> Existing Qualcomm SoCs have the LPASS pin controller slew rate control
>> in separate register, however this will change with upcoming Qualcomm
>> SoCs.  The slew rate will be part of the main register for pin
>> configuration, thus second device IO address space is not needed.
>>
>> Prepare for supporting new SoCs by adding flag customizing the driver
>> behavior for slew rate.
>>
>> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
>> ---
>>  drivers/pinctrl/qcom/pinctrl-lpass-lpi.c | 20 ++++++++++++++------
>>  drivers/pinctrl/qcom/pinctrl-lpass-lpi.h |  7 +++++++
>>  2 files changed, 21 insertions(+), 6 deletions(-)
>>
>> diff --git a/drivers/pinctrl/qcom/pinctrl-lpass-lpi.c b/drivers/pinctrl/qcom/pinctrl-lpass-lpi.c
>> index e2df2193a802..40eb58a3a8cd 100644
>> --- a/drivers/pinctrl/qcom/pinctrl-lpass-lpi.c
>> +++ b/drivers/pinctrl/qcom/pinctrl-lpass-lpi.c
>> @@ -190,6 +190,7 @@ static int lpi_config_set_slew_rate(struct lpi_pinctrl *pctrl,
>>  				    const struct lpi_pingroup *g,
>>  				    unsigned int group, unsigned int slew)
>>  {
>> +	void __iomem *reg;
> Aaalmost reverse-Christmas-tree!

I can fix it.

> 
>>  	unsigned long sval;
>>  	int slew_offset;
>>  
>> @@ -203,12 +204,17 @@ static int lpi_config_set_slew_rate(struct lpi_pinctrl *pctrl,
>>  	if (slew_offset == LPI_NO_SLEW)
>>  		return 0;
>>  
>> +	if (pctrl->data->flags & LPI_FLAG_SLEW_RATE_SAME_REG)
>> +		reg = pctrl->tlmm_base + LPI_TLMM_REG_OFFSET * group + LPI_GPIO_CFG_REG;
>> +	else
>> +		reg = pctrl->slew_base + LPI_SLEW_RATE_CTL_REG;
> Perhaps lpi_gpio_read/write could be used here?
> 
> I guess both ways work though

I was thinking about this, but decided not to in favor of duplicating
"tlmm_base + offset * group ....". It would not make the code easier to
read.


Best regards,
Krzysztof


      reply	other threads:[~2023-09-04  7:46 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-01  9:02 [PATCH 0/2] pinctrl: qcom: lpass-lpi: allow slew rate bit in main pin config register Krzysztof Kozlowski
2023-09-01  9:02 ` [PATCH 1/2] pinctrl: qcom: lpass-lpi: split slew rate set to separate function Krzysztof Kozlowski
2023-09-01  9:02 ` [PATCH 2/2] pinctrl: qcom: lpass-lpi: allow slew rate bit in main pin config register Krzysztof Kozlowski
2023-09-01 12:28   ` Konrad Dybcio
2023-09-04  7:45     ` Krzysztof Kozlowski [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=1f0bf00f-07db-4017-a30b-618d90ce0457@linaro.org \
    --to=krzysztof.kozlowski@linaro.org \
    --cc=agross@kernel.org \
    --cc=andersson@kernel.org \
    --cc=konrad.dybcio@linaro.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.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).