linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1 1/2] pinctrl: lynxpoint: Use defined constant for disabled bias explicitly
@ 2020-11-11 11:34 Andy Shevchenko
  2020-11-11 11:34 ` [PATCH v1 2/2] pinctrl: lynxpoint: Enable pin configuration setting for GPIO chip Andy Shevchenko
  2020-11-12  8:00 ` [PATCH v1 1/2] pinctrl: lynxpoint: Use defined constant for disabled bias explicitly Mika Westerberg
  0 siblings, 2 replies; 5+ messages in thread
From: Andy Shevchenko @ 2020-11-11 11:34 UTC (permalink / raw)
  To: Mika Westerberg, linux-gpio, Linus Walleij; +Cc: Andy Shevchenko

We have a specific constant to describe a disabled bias,
i.e. GPIWP_NONE. Use it explicitly instead of making
an assumption about its value.

While at it, move argument assignment to the switch-case
in lp_pin_config_get().

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/pinctrl/intel/pinctrl-lynxpoint.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/pinctrl/intel/pinctrl-lynxpoint.c b/drivers/pinctrl/intel/pinctrl-lynxpoint.c
index 849979d5d646..2e9670fc479a 100644
--- a/drivers/pinctrl/intel/pinctrl-lynxpoint.c
+++ b/drivers/pinctrl/intel/pinctrl-lynxpoint.c
@@ -496,7 +496,7 @@ static int lp_pin_config_get(struct pinctrl_dev *pctldev, unsigned int pin,
 	enum pin_config_param param = pinconf_to_config_param(*config);
 	unsigned long flags;
 	u32 value, pull;
-	u16 arg = 0;
+	u16 arg;
 
 	raw_spin_lock_irqsave(&lg->lock, flags);
 	value = ioread32(conf2);
@@ -506,8 +506,9 @@ static int lp_pin_config_get(struct pinctrl_dev *pctldev, unsigned int pin,
 
 	switch (param) {
 	case PIN_CONFIG_BIAS_DISABLE:
-		if (pull)
+		if (pull != GPIWP_NONE)
 			return -EINVAL;
+		arg = 0;
 		break;
 	case PIN_CONFIG_BIAS_PULL_DOWN:
 		if (pull != GPIWP_DOWN)
@@ -550,6 +551,7 @@ static int lp_pin_config_set(struct pinctrl_dev *pctldev, unsigned int pin,
 		switch (param) {
 		case PIN_CONFIG_BIAS_DISABLE:
 			value &= ~GPIWP_MASK;
+			value |= GPIWP_NONE;
 			break;
 		case PIN_CONFIG_BIAS_PULL_DOWN:
 			value &= ~GPIWP_MASK;
-- 
2.28.0


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

* [PATCH v1 2/2] pinctrl: lynxpoint: Enable pin configuration setting for GPIO chip
  2020-11-11 11:34 [PATCH v1 1/2] pinctrl: lynxpoint: Use defined constant for disabled bias explicitly Andy Shevchenko
@ 2020-11-11 11:34 ` Andy Shevchenko
  2020-11-12  8:00   ` Mika Westerberg
  2020-11-12  8:00 ` [PATCH v1 1/2] pinctrl: lynxpoint: Use defined constant for disabled bias explicitly Mika Westerberg
  1 sibling, 1 reply; 5+ messages in thread
From: Andy Shevchenko @ 2020-11-11 11:34 UTC (permalink / raw)
  To: Mika Westerberg, linux-gpio, Linus Walleij; +Cc: Andy Shevchenko

It appears that pin configuration for GPIO chip hasn't been enabled yet
due to absence of ->set_config() callback.

Enable it here for Intel Lynxpoint PCH.

Depends-on: 2956b5d94a76 ("pinctrl / gpio: Introduce .set_config() callback for GPIO chips")
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/pinctrl/intel/pinctrl-lynxpoint.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/pinctrl/intel/pinctrl-lynxpoint.c b/drivers/pinctrl/intel/pinctrl-lynxpoint.c
index 2e9670fc479a..0a48ca46ab59 100644
--- a/drivers/pinctrl/intel/pinctrl-lynxpoint.c
+++ b/drivers/pinctrl/intel/pinctrl-lynxpoint.c
@@ -874,6 +874,7 @@ static int lp_gpio_probe(struct platform_device *pdev)
 	gc->direction_output = lp_gpio_direction_output;
 	gc->get = lp_gpio_get;
 	gc->set = lp_gpio_set;
+	gc->set_config = gpiochip_generic_config;
 	gc->get_direction = lp_gpio_get_direction;
 	gc->base = -1;
 	gc->ngpio = LP_NUM_GPIO;
-- 
2.28.0


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

* Re: [PATCH v1 1/2] pinctrl: lynxpoint: Use defined constant for disabled bias explicitly
  2020-11-11 11:34 [PATCH v1 1/2] pinctrl: lynxpoint: Use defined constant for disabled bias explicitly Andy Shevchenko
  2020-11-11 11:34 ` [PATCH v1 2/2] pinctrl: lynxpoint: Enable pin configuration setting for GPIO chip Andy Shevchenko
@ 2020-11-12  8:00 ` Mika Westerberg
  1 sibling, 0 replies; 5+ messages in thread
From: Mika Westerberg @ 2020-11-12  8:00 UTC (permalink / raw)
  To: Andy Shevchenko; +Cc: linux-gpio, Linus Walleij

On Wed, Nov 11, 2020 at 01:34:31PM +0200, Andy Shevchenko wrote:
> We have a specific constant to describe a disabled bias,
> i.e. GPIWP_NONE. Use it explicitly instead of making
> an assumption about its value.
> 
> While at it, move argument assignment to the switch-case
> in lp_pin_config_get().
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>

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

* Re: [PATCH v1 2/2] pinctrl: lynxpoint: Enable pin configuration setting for GPIO chip
  2020-11-11 11:34 ` [PATCH v1 2/2] pinctrl: lynxpoint: Enable pin configuration setting for GPIO chip Andy Shevchenko
@ 2020-11-12  8:00   ` Mika Westerberg
  2020-11-12 11:00     ` Andy Shevchenko
  0 siblings, 1 reply; 5+ messages in thread
From: Mika Westerberg @ 2020-11-12  8:00 UTC (permalink / raw)
  To: Andy Shevchenko; +Cc: linux-gpio, Linus Walleij

On Wed, Nov 11, 2020 at 01:34:32PM +0200, Andy Shevchenko wrote:
> It appears that pin configuration for GPIO chip hasn't been enabled yet
> due to absence of ->set_config() callback.
> 
> Enable it here for Intel Lynxpoint PCH.
> 
> Depends-on: 2956b5d94a76 ("pinctrl / gpio: Introduce .set_config() callback for GPIO chips")
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>

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

* Re: [PATCH v1 2/2] pinctrl: lynxpoint: Enable pin configuration setting for GPIO chip
  2020-11-12  8:00   ` Mika Westerberg
@ 2020-11-12 11:00     ` Andy Shevchenko
  0 siblings, 0 replies; 5+ messages in thread
From: Andy Shevchenko @ 2020-11-12 11:00 UTC (permalink / raw)
  To: Mika Westerberg; +Cc: linux-gpio, Linus Walleij

On Thu, Nov 12, 2020 at 10:00:51AM +0200, Mika Westerberg wrote:
> On Wed, Nov 11, 2020 at 01:34:32PM +0200, Andy Shevchenko wrote:
> > It appears that pin configuration for GPIO chip hasn't been enabled yet
> > due to absence of ->set_config() callback.
> > 
> > Enable it here for Intel Lynxpoint PCH.
> > 
> > Depends-on: 2956b5d94a76 ("pinctrl / gpio: Introduce .set_config() callback for GPIO chips")
> > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> 
> Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>

Pushed to my review and testing queue, thanks!

-- 
With Best Regards,
Andy Shevchenko



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

end of thread, other threads:[~2020-11-12 11:01 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-11-11 11:34 [PATCH v1 1/2] pinctrl: lynxpoint: Use defined constant for disabled bias explicitly Andy Shevchenko
2020-11-11 11:34 ` [PATCH v1 2/2] pinctrl: lynxpoint: Enable pin configuration setting for GPIO chip Andy Shevchenko
2020-11-12  8:00   ` Mika Westerberg
2020-11-12 11:00     ` Andy Shevchenko
2020-11-12  8:00 ` [PATCH v1 1/2] pinctrl: lynxpoint: Use defined constant for disabled bias explicitly Mika Westerberg

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