mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Linhua Xu <Linhua.xu@unisoc.com>
To: Linus Walleij <linus.walleij@linaro.org>
Cc: Orson Zhai <orsonzhai@gmail.com>,
	Baolin Wang <baolin.wang@linux.alibaba.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>, Linhua Xu <Linhua.Xu@unisoc.com>,
	Xiongpeng Wu <xiongpeng.wu@unisoc.com>
Subject: [PATCH 3/6] pinctrl: sprd: Modify pull-up parameters
Date: Fri, 25 Aug 2023 11:18:23 +0800	[thread overview]
Message-ID: <20230825031826.31599-4-Linhua.xu@unisoc.com> (raw)
In-Reply-To: <20230825031826.31599-1-Linhua.xu@unisoc.com>

From: Linhua Xu <Linhua.Xu@unisoc.com>

For UNISOC pin controller, there are three different configurations of
pull-up drive current: 1 for pull-up resistor is 20K, 2 for pull-up
resistor is 4.7K and 3 for pull-up resistor is 1.8K. Thus modify them.

Signed-off-by: Linhua Xu <Linhua.Xu@unisoc.com>
---
 drivers/pinctrl/sprd/pinctrl-sprd.c | 22 ++++++++++++----------
 1 file changed, 12 insertions(+), 10 deletions(-)

diff --git a/drivers/pinctrl/sprd/pinctrl-sprd.c b/drivers/pinctrl/sprd/pinctrl-sprd.c
index 6464999aaebe..6d16209a4846 100644
--- a/drivers/pinctrl/sprd/pinctrl-sprd.c
+++ b/drivers/pinctrl/sprd/pinctrl-sprd.c
@@ -69,8 +69,9 @@
 #define SLEEP_PULL_UP_MASK		0x3
 #define SLEEP_PULL_UP_SHIFT		2
 
-#define PULL_UP_4_7K			(BIT(12) | BIT(7))
-#define PULL_UP_20K			BIT(7)
+#define PULL_UP_WPUSP			(BIT(12) | BIT(7))
+#define PULL_UP_WPUS			BIT(12)
+#define PULL_UP_WPU			BIT(7)
 #define PULL_UP_MASK			0x43
 #define PULL_UP_SHIFT			6
 
@@ -497,7 +498,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_WPUSP)))
 				return -EINVAL;
 
 			arg = 1;
@@ -690,15 +691,17 @@ static int sprd_pinconf_set(struct pinctrl_dev *pctldev, unsigned int pin_id,
 				shift = INPUT_SCHMITT_SHIFT;
 				break;
 			case PIN_CONFIG_BIAS_PULL_UP:
-				if (is_sleep_config) {
+				if (is_sleep_config == true) {
 					val |= SLEEP_PULL_UP;
 					mask = SLEEP_PULL_UP_MASK;
 					shift = SLEEP_PULL_UP_SHIFT;
 				} else {
-					if (arg == 20000)
-						val |= PULL_UP_20K;
-					else if (arg == 4700)
-						val |= PULL_UP_4_7K;
+					if (arg == 3)
+						val |= PULL_UP_WPUSP;
+					else if (arg == 2)
+						val |= PULL_UP_WPUS;
+					else if (arg == 1)
+						val |= PULL_UP_WPU;
 
 					mask = PULL_UP_MASK;
 					shift = PULL_UP_SHIFT;
@@ -710,8 +713,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_WPUSP;
 				}
 				break;
 			case PIN_CONFIG_SLEEP_HARDWARE_STATE:
-- 
2.17.1


  parent reply	other threads:[~2023-08-25  3:39 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-25  3:18 [PATCH 0/6] pinctrl: sprd: Modification of UNIOC Platform pinctrl Driver Linhua Xu
2023-08-25  3:18 ` [PATCH 1/6] pinctrl: sprd: Modify the probe function parameters Linhua Xu
2023-08-25  5:25   ` kernel test robot
2023-08-25 10:08   ` Andy Shevchenko
2023-08-25  3:18 ` [PATCH 2/6] pinctrl: sprd: Fix the incorrect mask and shift definition Linhua Xu
2023-08-25 10:10   ` Andy Shevchenko
2023-08-25  3:18 ` Linhua Xu [this message]
2023-08-25 10:13   ` [PATCH 3/6] pinctrl: sprd: Modify pull-up parameters Andy Shevchenko
2023-08-25  3:18 ` [PATCH 4/6] pinctrl: sprd: Add pinctrl support for UMS512 Linhua Xu
2023-08-25 10:17   ` Andy Shevchenko
2023-08-25  3:18 ` [PATCH 5/6] pinctrl: sprd: Increase the range of register values Linhua Xu
2023-08-25 10:19   ` Andy Shevchenko
2023-08-25  3:18 ` [PATCH 6/6] pinctrl: sprd: Add pinctrl support for UMS9621 Linhua Xu
2023-08-25 10:20   ` Andy Shevchenko

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=20230825031826.31599-4-Linhua.xu@unisoc.com \
    --to=linhua.xu@unisoc.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=baolin.wang@linux.alibaba.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 \
    /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®