mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Baolin Wang <baolin.wang@linux.alibaba.com>
To: Linhua Xu <Linhua.xu@unisoc.com>,
	Linus Walleij <linus.walleij@linaro.org>
Cc: Orson Zhai <orsonzhai@gmail.com>,
	Chunyan Zhang <zhang.lyra@gmail.com>,
	linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	lh xu <xulh0829@gmail.com>, Zhirong Qiu <zhirong.qiu@unisoc.com>,
	Xiongpeng Wu <xiongpeng.wu@unisoc.com>
Subject: Re: [PATCH V2 3/6] pinctrl: sprd: Modify pull-up parameters
Date: Tue, 12 Sep 2023 16:22:01 +0800	[thread overview]
Message-ID: <06791ae0-a4fb-d230-da0c-ced84d8ebe93@linux.alibaba.com> (raw)
In-Reply-To: <20230908055146.18347-4-Linhua.xu@unisoc.com>



On 9/8/2023 1:51 PM, Linhua Xu wrote:
> From: Linhua Xu <Linhua.Xu@unisoc.com>
> 
> For UNISOC pin controller, there are three different configurations of
> pull-up drive current. Modify the 20K pull-up resistor configuration and
> add the 1.8K pull-up resistor configuration.
> 
> Signed-off-by: Linhua Xu <Linhua.Xu@unisoc.com>

Please add a Fixes tag.

> ---
>   drivers/pinctrl/sprd/pinctrl-sprd.c | 10 ++++++----
>   1 file changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/pinctrl/sprd/pinctrl-sprd.c b/drivers/pinctrl/sprd/pinctrl-sprd.c
> index 5b9126b2cde2..6c75e6b8d2ca 100644
> --- a/drivers/pinctrl/sprd/pinctrl-sprd.c
> +++ b/drivers/pinctrl/sprd/pinctrl-sprd.c
> @@ -69,7 +69,8 @@
>   #define SLEEP_PULL_UP_MASK		GENMASK(1, 0)
>   #define SLEEP_PULL_UP_SHIFT		2
>   
> -#define PULL_UP_4_7K			(BIT(12) | BIT(7))
> +#define PULL_UP_1_8K			(BIT(12) | BIT(7))
> +#define PULL_UP_4_7K			BIT(12)
>   #define PULL_UP_20K			BIT(7)
>   #define PULL_UP_MASK			(GENMASK(1, 0) | BIT(6))
>   #define PULL_UP_SHIFT			6
> @@ -499,7 +500,7 @@ static int sprd_pinconf_get(struct pinctrl_dev *pctldev, unsigned int pin_id,
>   			break;
>   		case PIN_CONFIG_BIAS_DISABLE:
>   			if ((reg & (SLEEP_PULL_DOWN | SLEEP_PULL_UP)) ||
> -			    (reg & (PULL_DOWN | PULL_UP_4_7K | PULL_UP_20K)))
> +			    (reg & (PULL_DOWN | PULL_UP_1_8K)))

The math logic is correct, but the code is not readable now. Since we 
should mask all PULL UP configration, but the code only mask 'PULL_UP_1_8K'.

So changing to below will be more clear:
(reg & (PULL_DOWN | PULL_UP_4_7K | PULL_UP_20K | PULL_UP_1_8K)

>   				return -EINVAL;
>   
>   			arg = 1;
> @@ -701,6 +702,8 @@ static int sprd_pinconf_set(struct pinctrl_dev *pctldev, unsigned int pin_id,
>   						val |= PULL_UP_20K;
>   					else if (arg == 4700)
>   						val |= PULL_UP_4_7K;
> +					else if (arg == 1800)
> +						val |= PULL_UP_1_8K;
>   
>   					mask = PULL_UP_MASK;
>   					shift = PULL_UP_SHIFT;
> @@ -712,8 +715,7 @@ static int sprd_pinconf_set(struct pinctrl_dev *pctldev, unsigned int pin_id,
>   					mask = SLEEP_PULL_DOWN | SLEEP_PULL_UP;
>   				} else {
>   					val = shift = 0;
> -					mask = PULL_DOWN | PULL_UP_20K |
> -						PULL_UP_4_7K;
> +					mask = PULL_DOWN | PULL_UP_1_8K;

ditto.

>   				}
>   				break;
>   			case PIN_CONFIG_SLEEP_HARDWARE_STATE:

  parent reply	other threads:[~2023-09-12  8:22 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-08  5:51 [PATCH V2 0/6] pinctrl: sprd: Modification of UNIOC Platform pinctrl Driver Linhua Xu
2023-09-08  5:51 ` [PATCH V2 1/6] pinctrl: sprd: Modify the probe function parameters Linhua Xu
2023-09-11  9:46   ` Andy Shevchenko
2023-09-12  8:13   ` Baolin Wang
2023-09-08  5:51 ` [PATCH V2 2/6] pinctrl: sprd: Fix the incorrect mask and shift definition Linhua Xu
2023-09-11  9:50   ` Andy Shevchenko
2023-09-12  8:28   ` Baolin Wang
2023-11-13 13:50   ` Linus Walleij
2023-09-08  5:51 ` [PATCH V2 3/6] pinctrl: sprd: Modify pull-up parameters Linhua Xu
2023-09-11  9:51   ` Andy Shevchenko
2023-09-12  8:22   ` Baolin Wang [this message]
2023-09-08  5:51 ` [PATCH V2 4/6] pinctrl: sprd: Add pinctrl support for UMS512 Linhua Xu
2023-09-09  1:56   ` kernel test robot
2023-09-11  9:53   ` Andy Shevchenko
2023-09-08  5:51 ` [PATCH V2 5/6] pinctrl: sprd: Increase the range of register values Linhua Xu
2023-09-11  9:55   ` Andy Shevchenko
2023-09-12  8:37   ` Baolin Wang
     [not found]     ` <CAPjKKSrs9X2msnDg=9rC8H57Dq8FPd7SWyBsr2MCwL0FMNkHPA@mail.gmail.com>
2023-10-26  2:57       ` Baolin Wang
2023-09-08  5:51 ` [PATCH V2 6/6] pinctrl: sprd: Add pinctrl support for UMS9621 Linhua Xu
2023-09-11  9:56   ` Andy Shevchenko
2023-09-11 13:41 ` [PATCH V2 0/6] pinctrl: sprd: Modification of UNIOC Platform pinctrl Driver Linus Walleij
2023-09-12  8:40   ` Baolin Wang

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=06791ae0-a4fb-d230-da0c-ced84d8ebe93@linux.alibaba.com \
    --to=baolin.wang@linux.alibaba.com \
    --cc=Linhua.xu@unisoc.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=orsonzhai@gmail.com \
    --cc=xiongpeng.wu@unisoc.com \
    --cc=xulh0829@gmail.com \
    --cc=zhang.lyra@gmail.com \
    --cc=zhirong.qiu@unisoc.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®