linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] pinctrl: sprd: Change to use devm_platform_ioremap_resource()
@ 2019-07-25  9:56 Baolin Wang
  2019-07-25  9:56 ` [PATCH 2/2] pinctrl: sprd: Combine the condition of MISC_PIN and COMMON_PIN Baolin Wang
  2019-08-05 10:12 ` [PATCH 1/2] pinctrl: sprd: Change to use devm_platform_ioremap_resource() Linus Walleij
  0 siblings, 2 replies; 4+ messages in thread
From: Baolin Wang @ 2019-07-25  9:56 UTC (permalink / raw)
  To: linus.walleij, orsonzhai, zhang.lyra
  Cc: baolin.wang, vincent.guittot, linux-gpio, linux-kernel

The devm_platform_ioremap_resource() function wraps platform_get_resource()
and devm_ioremap_resource() in a single helper, thus use it to simplify
the code.

Signed-off-by: Baolin Wang <baolin.wang@linaro.org>
---
 drivers/pinctrl/sprd/pinctrl-sprd.c |    4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/pinctrl/sprd/pinctrl-sprd.c b/drivers/pinctrl/sprd/pinctrl-sprd.c
index c31b581..a32e809 100644
--- a/drivers/pinctrl/sprd/pinctrl-sprd.c
+++ b/drivers/pinctrl/sprd/pinctrl-sprd.c
@@ -1020,7 +1020,6 @@ int sprd_pinctrl_core_probe(struct platform_device *pdev,
 	struct sprd_pinctrl *sprd_pctl;
 	struct sprd_pinctrl_soc_info *pinctrl_info;
 	struct pinctrl_pin_desc *pin_desc;
-	struct resource *res;
 	int ret, i;
 
 	sprd_pctl = devm_kzalloc(&pdev->dev, sizeof(struct sprd_pinctrl),
@@ -1028,8 +1027,7 @@ int sprd_pinctrl_core_probe(struct platform_device *pdev,
 	if (!sprd_pctl)
 		return -ENOMEM;
 
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	sprd_pctl->base = devm_ioremap_resource(&pdev->dev, res);
+	sprd_pctl->base = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(sprd_pctl->base))
 		return PTR_ERR(sprd_pctl->base);
 
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] pinctrl: sprd: Combine the condition of MISC_PIN and COMMON_PIN
  2019-07-25  9:56 [PATCH 1/2] pinctrl: sprd: Change to use devm_platform_ioremap_resource() Baolin Wang
@ 2019-07-25  9:56 ` Baolin Wang
  2019-08-05 10:13   ` Linus Walleij
  2019-08-05 10:12 ` [PATCH 1/2] pinctrl: sprd: Change to use devm_platform_ioremap_resource() Linus Walleij
  1 sibling, 1 reply; 4+ messages in thread
From: Baolin Wang @ 2019-07-25  9:56 UTC (permalink / raw)
  To: linus.walleij, orsonzhai, zhang.lyra
  Cc: baolin.wang, vincent.guittot, linux-gpio, linux-kernel

Since the follow-up pin design on Spreadtrum platform has some changes,
some configuration of MISC_PIN moved to COMMON_PIN. To support current
pin design and keep backward compatibility, we should combine the
condition of MISC_PIN and COMMON_PIN to configure an individual pin.

Signed-off-by: Baolin Wang <baolin.wang@linaro.org>
---
 drivers/pinctrl/sprd/pinctrl-sprd.c |   19 ++-----------------
 1 file changed, 2 insertions(+), 17 deletions(-)

diff --git a/drivers/pinctrl/sprd/pinctrl-sprd.c b/drivers/pinctrl/sprd/pinctrl-sprd.c
index a32e809..5d40bab 100644
--- a/drivers/pinctrl/sprd/pinctrl-sprd.c
+++ b/drivers/pinctrl/sprd/pinctrl-sprd.c
@@ -454,7 +454,7 @@ static int sprd_pinconf_get(struct pinctrl_dev *pctldev, unsigned int pin_id,
 	if (pin->type == GLOBAL_CTRL_PIN &&
 	    param == SPRD_PIN_CONFIG_CONTROL) {
 		arg = reg;
-	} else if (pin->type == COMMON_PIN) {
+	} else if (pin->type == COMMON_PIN || pin->type == MISC_PIN) {
 		switch (param) {
 		case SPRD_PIN_CONFIG_SLEEP_MODE:
 			arg = (reg >> SLEEP_MODE_SHIFT) & SLEEP_MODE_MASK;
@@ -465,14 +465,6 @@ static int sprd_pinconf_get(struct pinctrl_dev *pctldev, unsigned int pin_id,
 		case PIN_CONFIG_OUTPUT:
 			arg = reg & SLEEP_OUTPUT_MASK;
 			break;
-		case PIN_CONFIG_SLEEP_HARDWARE_STATE:
-			arg = 0;
-			break;
-		default:
-			return -ENOTSUPP;
-		}
-	} else if (pin->type == MISC_PIN) {
-		switch (param) {
 		case PIN_CONFIG_DRIVE_STRENGTH:
 			arg = (reg >> DRIVE_STRENGTH_SHIFT) &
 				DRIVE_STRENGTH_MASK;
@@ -606,7 +598,7 @@ static int sprd_pinconf_set(struct pinctrl_dev *pctldev, unsigned int pin_id,
 		if (pin->type == GLOBAL_CTRL_PIN &&
 		    param == SPRD_PIN_CONFIG_CONTROL) {
 			val = arg;
-		} else if (pin->type == COMMON_PIN) {
+		} else if (pin->type == COMMON_PIN || pin->type == MISC_PIN) {
 			switch (param) {
 			case SPRD_PIN_CONFIG_SLEEP_MODE:
 				if (arg & AP_SLEEP)
@@ -639,13 +631,6 @@ static int sprd_pinconf_set(struct pinctrl_dev *pctldev, unsigned int pin_id,
 					shift = SLEEP_OUTPUT_SHIFT;
 				}
 				break;
-			case PIN_CONFIG_SLEEP_HARDWARE_STATE:
-				continue;
-			default:
-				return -ENOTSUPP;
-			}
-		} else if (pin->type == MISC_PIN) {
-			switch (param) {
 			case PIN_CONFIG_DRIVE_STRENGTH:
 				if (arg < 2 || arg > 60)
 					return -EINVAL;
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/2] pinctrl: sprd: Change to use devm_platform_ioremap_resource()
  2019-07-25  9:56 [PATCH 1/2] pinctrl: sprd: Change to use devm_platform_ioremap_resource() Baolin Wang
  2019-07-25  9:56 ` [PATCH 2/2] pinctrl: sprd: Combine the condition of MISC_PIN and COMMON_PIN Baolin Wang
@ 2019-08-05 10:12 ` Linus Walleij
  1 sibling, 0 replies; 4+ messages in thread
From: Linus Walleij @ 2019-08-05 10:12 UTC (permalink / raw)
  To: Baolin Wang
  Cc: Orson Zhai, Lyra Zhang, Vincent Guittot,
	open list:GPIO SUBSYSTEM, linux-kernel

On Thu, Jul 25, 2019 at 11:56 AM Baolin Wang <baolin.wang@linaro.org> wrote:

> The devm_platform_ioremap_resource() function wraps platform_get_resource()
> and devm_ioremap_resource() in a single helper, thus use it to simplify
> the code.
>
> Signed-off-by: Baolin Wang <baolin.wang@linaro.org>

Patch applied.

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 2/2] pinctrl: sprd: Combine the condition of MISC_PIN and COMMON_PIN
  2019-07-25  9:56 ` [PATCH 2/2] pinctrl: sprd: Combine the condition of MISC_PIN and COMMON_PIN Baolin Wang
@ 2019-08-05 10:13   ` Linus Walleij
  0 siblings, 0 replies; 4+ messages in thread
From: Linus Walleij @ 2019-08-05 10:13 UTC (permalink / raw)
  To: Baolin Wang
  Cc: Orson Zhai, Lyra Zhang, Vincent Guittot,
	open list:GPIO SUBSYSTEM, linux-kernel

On Thu, Jul 25, 2019 at 11:56 AM Baolin Wang <baolin.wang@linaro.org> wrote:

> Since the follow-up pin design on Spreadtrum platform has some changes,
> some configuration of MISC_PIN moved to COMMON_PIN. To support current
> pin design and keep backward compatibility, we should combine the
> condition of MISC_PIN and COMMON_PIN to configure an individual pin.
>
> Signed-off-by: Baolin Wang <baolin.wang@linaro.org>

Patch applied.

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-08-05 10:13 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-25  9:56 [PATCH 1/2] pinctrl: sprd: Change to use devm_platform_ioremap_resource() Baolin Wang
2019-07-25  9:56 ` [PATCH 2/2] pinctrl: sprd: Combine the condition of MISC_PIN and COMMON_PIN Baolin Wang
2019-08-05 10:13   ` Linus Walleij
2019-08-05 10:12 ` [PATCH 1/2] pinctrl: sprd: Change to use devm_platform_ioremap_resource() Linus Walleij

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).