* [PATCH 1/4] pinctrl: baytrail: use new GPIO line value setter callbacks
2025-06-10 12:58 [PATCH 0/4] pinctrl: intel: use new GPIO line value setter callbacks Bartosz Golaszewski
@ 2025-06-10 12:58 ` Bartosz Golaszewski
2025-06-10 12:58 ` [PATCH 2/4] pinctrl: cherryview: " Bartosz Golaszewski
` (4 subsequent siblings)
5 siblings, 0 replies; 10+ messages in thread
From: Bartosz Golaszewski @ 2025-06-10 12:58 UTC (permalink / raw)
To: Mika Westerberg, Andy Shevchenko, Linus Walleij, Bartosz Golaszewski
Cc: linux-gpio, linux-kernel, Bartosz Golaszewski
From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
struct gpio_chip now has callbacks for setting line values that return
an integer, allowing to indicate failures. Convert the driver to using
them.
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
---
drivers/pinctrl/intel/pinctrl-baytrail.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/drivers/pinctrl/intel/pinctrl-baytrail.c b/drivers/pinctrl/intel/pinctrl-baytrail.c
index 969137c4cb0659fc66bf461bcbcdc60fb2d0dcb6..6eb649f1ffd6e09c0a8c99704eb165dac58d9736 100644
--- a/drivers/pinctrl/intel/pinctrl-baytrail.c
+++ b/drivers/pinctrl/intel/pinctrl-baytrail.c
@@ -1045,7 +1045,7 @@ static int byt_gpio_get(struct gpio_chip *chip, unsigned int offset)
return !!(val & BYT_LEVEL);
}
-static void byt_gpio_set(struct gpio_chip *chip, unsigned int offset, int value)
+static int byt_gpio_set(struct gpio_chip *chip, unsigned int offset, int value)
{
struct intel_pinctrl *vg = gpiochip_get_data(chip);
void __iomem *reg;
@@ -1053,7 +1053,7 @@ static void byt_gpio_set(struct gpio_chip *chip, unsigned int offset, int value)
reg = byt_gpio_reg(vg, offset, BYT_VAL_REG);
if (!reg)
- return;
+ return -EINVAL;
guard(raw_spinlock_irqsave)(&byt_lock);
@@ -1062,6 +1062,8 @@ static void byt_gpio_set(struct gpio_chip *chip, unsigned int offset, int value)
writel(old_val | BYT_LEVEL, reg);
else
writel(old_val & ~BYT_LEVEL, reg);
+
+ return 0;
}
static int byt_gpio_get_direction(struct gpio_chip *chip, unsigned int offset)
@@ -1229,7 +1231,7 @@ static const struct gpio_chip byt_gpio_chip = {
.direction_input = byt_gpio_direction_input,
.direction_output = byt_gpio_direction_output,
.get = byt_gpio_get,
- .set = byt_gpio_set,
+ .set_rv = byt_gpio_set,
.set_config = gpiochip_generic_config,
.dbg_show = byt_gpio_dbg_show,
};
--
2.48.1
^ permalink raw reply [flat|nested] 10+ messages in thread* [PATCH 2/4] pinctrl: cherryview: use new GPIO line value setter callbacks
2025-06-10 12:58 [PATCH 0/4] pinctrl: intel: use new GPIO line value setter callbacks Bartosz Golaszewski
2025-06-10 12:58 ` [PATCH 1/4] pinctrl: baytrail: " Bartosz Golaszewski
@ 2025-06-10 12:58 ` Bartosz Golaszewski
2025-06-10 12:58 ` [PATCH 3/4] pinctrl: intel: " Bartosz Golaszewski
` (3 subsequent siblings)
5 siblings, 0 replies; 10+ messages in thread
From: Bartosz Golaszewski @ 2025-06-10 12:58 UTC (permalink / raw)
To: Mika Westerberg, Andy Shevchenko, Linus Walleij, Bartosz Golaszewski
Cc: linux-gpio, linux-kernel, Bartosz Golaszewski
From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
struct gpio_chip now has callbacks for setting line values that return
an integer, allowing to indicate failures. Convert the driver to using
them.
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
---
drivers/pinctrl/intel/pinctrl-cherryview.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/pinctrl/intel/pinctrl-cherryview.c b/drivers/pinctrl/intel/pinctrl-cherryview.c
index 69b18ce0f68588db30f7954a141641116c9094db..769e8c4102a5f64479201bd8f791d3f155e949b0 100644
--- a/drivers/pinctrl/intel/pinctrl-cherryview.c
+++ b/drivers/pinctrl/intel/pinctrl-cherryview.c
@@ -1112,7 +1112,7 @@ static int chv_gpio_get(struct gpio_chip *chip, unsigned int offset)
return !!(ctrl0 & CHV_PADCTRL0_GPIORXSTATE);
}
-static void chv_gpio_set(struct gpio_chip *chip, unsigned int offset, int value)
+static int chv_gpio_set(struct gpio_chip *chip, unsigned int offset, int value)
{
struct intel_pinctrl *pctrl = gpiochip_get_data(chip);
u32 ctrl0;
@@ -1127,6 +1127,8 @@ static void chv_gpio_set(struct gpio_chip *chip, unsigned int offset, int value)
ctrl0 &= ~CHV_PADCTRL0_GPIOTXSTATE;
chv_writel(pctrl, offset, CHV_PADCTRL0, ctrl0);
+
+ return 0;
}
static int chv_gpio_get_direction(struct gpio_chip *chip, unsigned int offset)
@@ -1166,7 +1168,7 @@ static const struct gpio_chip chv_gpio_chip = {
.direction_input = chv_gpio_direction_input,
.direction_output = chv_gpio_direction_output,
.get = chv_gpio_get,
- .set = chv_gpio_set,
+ .set_rv = chv_gpio_set,
};
static void chv_gpio_irq_ack(struct irq_data *d)
--
2.48.1
^ permalink raw reply [flat|nested] 10+ messages in thread* [PATCH 3/4] pinctrl: intel: use new GPIO line value setter callbacks
2025-06-10 12:58 [PATCH 0/4] pinctrl: intel: use new GPIO line value setter callbacks Bartosz Golaszewski
2025-06-10 12:58 ` [PATCH 1/4] pinctrl: baytrail: " Bartosz Golaszewski
2025-06-10 12:58 ` [PATCH 2/4] pinctrl: cherryview: " Bartosz Golaszewski
@ 2025-06-10 12:58 ` Bartosz Golaszewski
2025-06-10 12:58 ` [PATCH 4/4] pinctrl: lynxpoint: " Bartosz Golaszewski
` (2 subsequent siblings)
5 siblings, 0 replies; 10+ messages in thread
From: Bartosz Golaszewski @ 2025-06-10 12:58 UTC (permalink / raw)
To: Mika Westerberg, Andy Shevchenko, Linus Walleij, Bartosz Golaszewski
Cc: linux-gpio, linux-kernel, Bartosz Golaszewski
From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
struct gpio_chip now has callbacks for setting line values that return
an integer, allowing to indicate failures. Convert the driver to using
them.
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
---
drivers/pinctrl/intel/pinctrl-intel.c | 19 +++++++++++++------
1 file changed, 13 insertions(+), 6 deletions(-)
diff --git a/drivers/pinctrl/intel/pinctrl-intel.c b/drivers/pinctrl/intel/pinctrl-intel.c
index d889c7c878e2d57eb075f4147a3eb2e2ae05ec5b..846b25ed1cc44cf9549aafc63192c80d8e66a797 100644
--- a/drivers/pinctrl/intel/pinctrl-intel.c
+++ b/drivers/pinctrl/intel/pinctrl-intel.c
@@ -1033,8 +1033,8 @@ static int intel_gpio_get(struct gpio_chip *chip, unsigned int offset)
return !!(padcfg0 & PADCFG0_GPIORXSTATE);
}
-static void intel_gpio_set(struct gpio_chip *chip, unsigned int offset,
- int value)
+static int intel_gpio_set(struct gpio_chip *chip, unsigned int offset,
+ int value)
{
struct intel_pinctrl *pctrl = gpiochip_get_data(chip);
void __iomem *reg;
@@ -1043,11 +1043,11 @@ static void intel_gpio_set(struct gpio_chip *chip, unsigned int offset,
pin = intel_gpio_to_pin(pctrl, offset, NULL, NULL);
if (pin < 0)
- return;
+ return -EINVAL;
reg = intel_get_padcfg(pctrl, pin, PADCFG0);
if (!reg)
- return;
+ return -EINVAL;
guard(raw_spinlock_irqsave)(&pctrl->lock);
@@ -1057,6 +1057,8 @@ static void intel_gpio_set(struct gpio_chip *chip, unsigned int offset,
else
padcfg0 &= ~PADCFG0_GPIOTXSTATE;
writel(padcfg0, reg);
+
+ return 0;
}
static int intel_gpio_get_direction(struct gpio_chip *chip, unsigned int offset)
@@ -1094,7 +1096,12 @@ static int intel_gpio_direction_input(struct gpio_chip *chip, unsigned int offse
static int intel_gpio_direction_output(struct gpio_chip *chip, unsigned int offset,
int value)
{
- intel_gpio_set(chip, offset, value);
+ int ret;
+
+ ret = intel_gpio_set(chip, offset, value);
+ if (ret)
+ return ret;
+
return pinctrl_gpio_direction_output(chip, offset);
}
@@ -1106,7 +1113,7 @@ static const struct gpio_chip intel_gpio_chip = {
.direction_input = intel_gpio_direction_input,
.direction_output = intel_gpio_direction_output,
.get = intel_gpio_get,
- .set = intel_gpio_set,
+ .set_rv = intel_gpio_set,
.set_config = gpiochip_generic_config,
};
--
2.48.1
^ permalink raw reply [flat|nested] 10+ messages in thread* [PATCH 4/4] pinctrl: lynxpoint: use new GPIO line value setter callbacks
2025-06-10 12:58 [PATCH 0/4] pinctrl: intel: use new GPIO line value setter callbacks Bartosz Golaszewski
` (2 preceding siblings ...)
2025-06-10 12:58 ` [PATCH 3/4] pinctrl: intel: " Bartosz Golaszewski
@ 2025-06-10 12:58 ` Bartosz Golaszewski
[not found] ` <PH7PR11MB845555F9AA0823B53EFD48BF9A6AA@PH7PR11MB8455.namprd11.prod.outlook.com>
2025-06-10 20:29 ` Andy Shevchenko
5 siblings, 0 replies; 10+ messages in thread
From: Bartosz Golaszewski @ 2025-06-10 12:58 UTC (permalink / raw)
To: Mika Westerberg, Andy Shevchenko, Linus Walleij, Bartosz Golaszewski
Cc: linux-gpio, linux-kernel, Bartosz Golaszewski
From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
struct gpio_chip now has callbacks for setting line values that return
an integer, allowing to indicate failures. Convert the driver to using
them.
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
---
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 ac5459a4c63e054ae4dd975f0a19112e4382aa99..5d4a5dd493d1bfbbc6051163758fd8a9341b43a8 100644
--- a/drivers/pinctrl/intel/pinctrl-lynxpoint.c
+++ b/drivers/pinctrl/intel/pinctrl-lynxpoint.c
@@ -503,7 +503,7 @@ static int lp_gpio_get(struct gpio_chip *chip, unsigned int offset)
return !!(ioread32(reg) & IN_LVL_BIT);
}
-static void lp_gpio_set(struct gpio_chip *chip, unsigned int offset, int value)
+static int lp_gpio_set(struct gpio_chip *chip, unsigned int offset, int value)
{
struct intel_pinctrl *lg = gpiochip_get_data(chip);
void __iomem *reg = lp_gpio_reg(chip, offset, LP_CONFIG1);
@@ -514,6 +514,8 @@ static void lp_gpio_set(struct gpio_chip *chip, unsigned int offset, int value)
iowrite32(ioread32(reg) | OUT_LVL_BIT, reg);
else
iowrite32(ioread32(reg) & ~OUT_LVL_BIT, reg);
+
+ return 0;
}
static int lp_gpio_direction_input(struct gpio_chip *chip, unsigned int offset)
@@ -775,7 +777,7 @@ static int lp_gpio_probe(struct platform_device *pdev)
gc->direction_input = lp_gpio_direction_input;
gc->direction_output = lp_gpio_direction_output;
gc->get = lp_gpio_get;
- gc->set = lp_gpio_set;
+ gc->set_rv = lp_gpio_set;
gc->set_config = gpiochip_generic_config;
gc->get_direction = lp_gpio_get_direction;
gc->base = -1;
--
2.48.1
^ permalink raw reply [flat|nested] 10+ messages in thread[parent not found: <PH7PR11MB845555F9AA0823B53EFD48BF9A6AA@PH7PR11MB8455.namprd11.prod.outlook.com>]
* Re: [PATCH 0/4] pinctrl: intel: use new GPIO line value setter callbacks
[not found] ` <PH7PR11MB845555F9AA0823B53EFD48BF9A6AA@PH7PR11MB8455.namprd11.prod.outlook.com>
@ 2025-06-10 15:32 ` Bartosz Golaszewski
2025-06-10 20:33 ` Andy Shevchenko
0 siblings, 1 reply; 10+ messages in thread
From: Bartosz Golaszewski @ 2025-06-10 15:32 UTC (permalink / raw)
To: Miao, Jun, Andy Shevchenko, Mika Westerberg, Linus Walleij
Cc: open list:GPIO SUBSYSTEM, Linux Kernel Mailing List
On Tue, Jun 10, 2025 at 5:30 PM Miao, Jun <jun.miao@intel.com> wrote:
>
>
> Excuse me,
> I have a problem
> echo 631 > /sys/class/gpio/export
> echo rising > /sys/class/gpio/gpio631/edge
> [18090.472396] emmitsburg-pinctrl INTC1071:00: pin 119 cannot be used as IRQ
> [18090.472408] genirq: Setting trigger mode 1 for irq 245 failed (intel_gpio_irq_type+0x0/0x130)
>
> How to set the gpio631 as IRQ mode ?
>
Is this a regression caused by this series?
Bart
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: [PATCH 0/4] pinctrl: intel: use new GPIO line value setter callbacks
2025-06-10 15:32 ` [PATCH 0/4] pinctrl: intel: " Bartosz Golaszewski
@ 2025-06-10 20:33 ` Andy Shevchenko
0 siblings, 0 replies; 10+ messages in thread
From: Andy Shevchenko @ 2025-06-10 20:33 UTC (permalink / raw)
To: Bartosz Golaszewski
Cc: Miao, Jun, Mika Westerberg, Linus Walleij,
open list:GPIO SUBSYSTEM, Linux Kernel Mailing List
On Tue, Jun 10, 2025 at 05:32:53PM +0200, Bartosz Golaszewski wrote:
> On Tue, Jun 10, 2025 at 5:30 PM Miao, Jun <jun.miao@intel.com> wrote:
> > Excuse me,
> > I have a problem
> > echo 631 > /sys/class/gpio/export
> > echo rising > /sys/class/gpio/gpio631/edge
> > [18090.472396] emmitsburg-pinctrl INTC1071:00: pin 119 cannot be used as IRQ
Check the pin configuration in /sys/kernel/debug/pinctrl/INTC1071:00/pins. But
I believe this is the wrong driver used for not yet released HW.
I suggest you not to communicate in public for this type of issues. We have
internal mailing list for that and other channels to discuss.
> > [18090.472408] genirq: Setting trigger mode 1 for irq 245 failed (intel_gpio_irq_type+0x0/0x130)
> >
> > How to set the gpio631 as IRQ mode ?
>
> Is this a regression caused by this series?
I am pretty sure it's irrelevant. IRQ is input mode, the value setters
shouldn't be involved in that at all.
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 0/4] pinctrl: intel: use new GPIO line value setter callbacks
2025-06-10 12:58 [PATCH 0/4] pinctrl: intel: use new GPIO line value setter callbacks Bartosz Golaszewski
` (4 preceding siblings ...)
[not found] ` <PH7PR11MB845555F9AA0823B53EFD48BF9A6AA@PH7PR11MB8455.namprd11.prod.outlook.com>
@ 2025-06-10 20:29 ` Andy Shevchenko
2025-06-11 4:36 ` Mika Westerberg
5 siblings, 1 reply; 10+ messages in thread
From: Andy Shevchenko @ 2025-06-10 20:29 UTC (permalink / raw)
To: Bartosz Golaszewski
Cc: Mika Westerberg, Linus Walleij, linux-gpio, linux-kernel,
Bartosz Golaszewski
On Tue, Jun 10, 2025 at 02:58:46PM +0200, Bartosz Golaszewski wrote:
> Commit 98ce1eb1fd87e ("gpiolib: introduce gpio_chip setters that return
> values") added new line setter callbacks to struct gpio_chip. They allow
> to indicate failures to callers. We're in the process of converting all
> GPIO controllers to using them before removing the old ones. This series
> converts all GPIO chips in intel pin control drivers.
I'll wait for Mika's Ack and apply, the material LGTM, thanks!
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: [PATCH 0/4] pinctrl: intel: use new GPIO line value setter callbacks
2025-06-10 20:29 ` Andy Shevchenko
@ 2025-06-11 4:36 ` Mika Westerberg
2025-06-11 8:28 ` Andy Shevchenko
0 siblings, 1 reply; 10+ messages in thread
From: Mika Westerberg @ 2025-06-11 4:36 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Bartosz Golaszewski, Linus Walleij, linux-gpio, linux-kernel,
Bartosz Golaszewski
On Tue, Jun 10, 2025 at 11:29:38PM +0300, Andy Shevchenko wrote:
> On Tue, Jun 10, 2025 at 02:58:46PM +0200, Bartosz Golaszewski wrote:
> > Commit 98ce1eb1fd87e ("gpiolib: introduce gpio_chip setters that return
> > values") added new line setter callbacks to struct gpio_chip. They allow
> > to indicate failures to callers. We're in the process of converting all
> > GPIO controllers to using them before removing the old ones. This series
> > converts all GPIO chips in intel pin control drivers.
>
> I'll wait for Mika's Ack and apply, the material LGTM, thanks!
Looks good to me too,
Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: [PATCH 0/4] pinctrl: intel: use new GPIO line value setter callbacks
2025-06-11 4:36 ` Mika Westerberg
@ 2025-06-11 8:28 ` Andy Shevchenko
0 siblings, 0 replies; 10+ messages in thread
From: Andy Shevchenko @ 2025-06-11 8:28 UTC (permalink / raw)
To: Mika Westerberg
Cc: Bartosz Golaszewski, Linus Walleij, linux-gpio, linux-kernel,
Bartosz Golaszewski
On Wed, Jun 11, 2025 at 07:36:26AM +0300, Mika Westerberg wrote:
> On Tue, Jun 10, 2025 at 11:29:38PM +0300, Andy Shevchenko wrote:
> > On Tue, Jun 10, 2025 at 02:58:46PM +0200, Bartosz Golaszewski wrote:
> > > Commit 98ce1eb1fd87e ("gpiolib: introduce gpio_chip setters that return
> > > values") added new line setter callbacks to struct gpio_chip. They allow
> > > to indicate failures to callers. We're in the process of converting all
> > > GPIO controllers to using them before removing the old ones. This series
> > > converts all GPIO chips in intel pin control drivers.
> >
> > I'll wait for Mika's Ack and apply, the material LGTM, thanks!
>
> Looks good to me too,
>
> 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] 10+ messages in thread