linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] platform/x86: convert GPIO chips to using new value setters
@ 2025-04-08  7:19 Bartosz Golaszewski
  2025-04-08  7:19 ` [PATCH 1/3] platform/x86: barco-p50: use new GPIO line value setter callbacks Bartosz Golaszewski
                   ` (4 more replies)
  0 siblings, 5 replies; 7+ messages in thread
From: Bartosz Golaszewski @ 2025-04-08  7:19 UTC (permalink / raw)
  To: Santosh Kumar Yadav, Peter Korsgaard, Hans de Goede,
	Ilpo Järvinen, Linus Walleij, Bartosz Golaszewski
  Cc: platform-driver-x86, linux-kernel, linux-gpio,
	Bartosz Golaszewski

struct gpio_chip now has callbacks for setting line values that return
an integer, allowing to indicate failures. We're in the process of
converting all GPIO drivers to using the new API. This series converts
all the x86 platform GPIO controllers.

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
---
Bartosz Golaszewski (3):
      platform/x86: barco-p50: use new GPIO line value setter callbacks
      platform/x86: int0002: use new GPIO line value setter callbacks
      platform/x86: silicom: use new GPIO line value setter callbacks

 drivers/platform/x86/barco-p50-gpio.c      | 10 +++++++---
 drivers/platform/x86/intel/int0002_vgpio.c |  7 ++++---
 drivers/platform/x86/silicom-platform.c    | 11 ++++++-----
 3 files changed, 17 insertions(+), 11 deletions(-)
---
base-commit: 0af2f6be1b4281385b618cb86ad946eded089ac8
change-id: 20250401-gpiochip-set-rv-platform-x86-86788597f4a4

Best regards,
-- 
Bartosz Golaszewski <bartosz.golaszewski@linaro.org>


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

* [PATCH 1/3] platform/x86: barco-p50: use new GPIO line value setter callbacks
  2025-04-08  7:19 [PATCH 0/3] platform/x86: convert GPIO chips to using new value setters Bartosz Golaszewski
@ 2025-04-08  7:19 ` Bartosz Golaszewski
  2025-04-08  7:24   ` Korsgaard, Peter
  2025-04-08  7:19 ` [PATCH 2/3] platform/x86: int0002: " Bartosz Golaszewski
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 7+ messages in thread
From: Bartosz Golaszewski @ 2025-04-08  7:19 UTC (permalink / raw)
  To: Santosh Kumar Yadav, Peter Korsgaard, Hans de Goede,
	Ilpo Järvinen, Linus Walleij, Bartosz Golaszewski
  Cc: platform-driver-x86, linux-kernel, linux-gpio,
	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/platform/x86/barco-p50-gpio.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/platform/x86/barco-p50-gpio.c b/drivers/platform/x86/barco-p50-gpio.c
index 143d14548565..bb3393bbfb89 100644
--- a/drivers/platform/x86/barco-p50-gpio.c
+++ b/drivers/platform/x86/barco-p50-gpio.c
@@ -268,15 +268,19 @@ static int p50_gpio_get(struct gpio_chip *gc, unsigned int offset)
 	return ret;
 }
 
-static void p50_gpio_set(struct gpio_chip *gc, unsigned int offset, int value)
+static int p50_gpio_set(struct gpio_chip *gc, unsigned int offset, int value)
 {
 	struct p50_gpio *p50 = gpiochip_get_data(gc);
+	int ret;
 
 	mutex_lock(&p50->lock);
 
-	p50_send_mbox_cmd(p50, P50_MBOX_CMD_WRITE_GPIO, gpio_params[offset], value);
+	ret = p50_send_mbox_cmd(p50, P50_MBOX_CMD_WRITE_GPIO,
+				gpio_params[offset], value);
 
 	mutex_unlock(&p50->lock);
+
+	return ret;
 }
 
 static int p50_gpio_probe(struct platform_device *pdev)
@@ -312,7 +316,7 @@ static int p50_gpio_probe(struct platform_device *pdev)
 	p50->gc.base = -1;
 	p50->gc.get_direction = p50_gpio_get_direction;
 	p50->gc.get = p50_gpio_get;
-	p50->gc.set = p50_gpio_set;
+	p50->gc.set_rv = p50_gpio_set;
 
 
 	/* reset mbox */

-- 
2.45.2


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

* [PATCH 2/3] platform/x86: int0002: use new GPIO line value setter callbacks
  2025-04-08  7:19 [PATCH 0/3] platform/x86: convert GPIO chips to using new value setters Bartosz Golaszewski
  2025-04-08  7:19 ` [PATCH 1/3] platform/x86: barco-p50: use new GPIO line value setter callbacks Bartosz Golaszewski
@ 2025-04-08  7:19 ` Bartosz Golaszewski
  2025-04-08  7:19 ` [PATCH 3/3] platform/x86: silicom: " Bartosz Golaszewski
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: Bartosz Golaszewski @ 2025-04-08  7:19 UTC (permalink / raw)
  To: Santosh Kumar Yadav, Peter Korsgaard, Hans de Goede,
	Ilpo Järvinen, Linus Walleij, Bartosz Golaszewski
  Cc: platform-driver-x86, linux-kernel, linux-gpio,
	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/platform/x86/intel/int0002_vgpio.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/platform/x86/intel/int0002_vgpio.c b/drivers/platform/x86/intel/int0002_vgpio.c
index 3b48cd7a4075..ab104fddee89 100644
--- a/drivers/platform/x86/intel/int0002_vgpio.c
+++ b/drivers/platform/x86/intel/int0002_vgpio.c
@@ -65,9 +65,10 @@ static int int0002_gpio_get(struct gpio_chip *chip, unsigned int offset)
 	return 0;
 }
 
-static void int0002_gpio_set(struct gpio_chip *chip, unsigned int offset,
-			     int value)
+static int int0002_gpio_set(struct gpio_chip *chip, unsigned int offset,
+			    int value)
 {
+	return 0;
 }
 
 static int int0002_gpio_direction_output(struct gpio_chip *chip,
@@ -192,7 +193,7 @@ static int int0002_probe(struct platform_device *pdev)
 	chip->parent = dev;
 	chip->owner = THIS_MODULE;
 	chip->get = int0002_gpio_get;
-	chip->set = int0002_gpio_set;
+	chip->set_rv = int0002_gpio_set;
 	chip->direction_input = int0002_gpio_get;
 	chip->direction_output = int0002_gpio_direction_output;
 	chip->base = -1;

-- 
2.45.2


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

* [PATCH 3/3] platform/x86: silicom: use new GPIO line value setter callbacks
  2025-04-08  7:19 [PATCH 0/3] platform/x86: convert GPIO chips to using new value setters Bartosz Golaszewski
  2025-04-08  7:19 ` [PATCH 1/3] platform/x86: barco-p50: use new GPIO line value setter callbacks Bartosz Golaszewski
  2025-04-08  7:19 ` [PATCH 2/3] platform/x86: int0002: " Bartosz Golaszewski
@ 2025-04-08  7:19 ` Bartosz Golaszewski
  2025-04-08  8:50 ` [PATCH 0/3] platform/x86: convert GPIO chips to using new value setters Hans de Goede
  2025-04-11 12:24 ` Ilpo Järvinen
  4 siblings, 0 replies; 7+ messages in thread
From: Bartosz Golaszewski @ 2025-04-08  7:19 UTC (permalink / raw)
  To: Santosh Kumar Yadav, Peter Korsgaard, Hans de Goede,
	Ilpo Järvinen, Linus Walleij, Bartosz Golaszewski
  Cc: platform-driver-x86, linux-kernel, linux-gpio,
	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/platform/x86/silicom-platform.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/platform/x86/silicom-platform.c b/drivers/platform/x86/silicom-platform.c
index c0910af16a3a..021f3fed197a 100644
--- a/drivers/platform/x86/silicom-platform.c
+++ b/drivers/platform/x86/silicom-platform.c
@@ -245,18 +245,19 @@ static int silicom_gpio_direction_input(struct gpio_chip *gc,
 	return direction == GPIO_LINE_DIRECTION_IN ? 0 : -EINVAL;
 }
 
-static void silicom_gpio_set(struct gpio_chip *gc,
-			     unsigned int offset,
-			     int value)
+static int silicom_gpio_set(struct gpio_chip *gc, unsigned int offset,
+			    int value)
 {
 	int direction = silicom_gpio_get_direction(gc, offset);
 	u8 *channels = gpiochip_get_data(gc);
 	int channel = channels[offset];
 
 	if (direction == GPIO_LINE_DIRECTION_IN)
-		return;
+		return -EPERM;
 
 	silicom_mec_port_set(channel, !value);
+
+	return 0;
 }
 
 static int silicom_gpio_direction_output(struct gpio_chip *gc,
@@ -469,7 +470,7 @@ static struct gpio_chip silicom_gpio_chip = {
 	.direction_input = silicom_gpio_direction_input,
 	.direction_output = silicom_gpio_direction_output,
 	.get = silicom_gpio_get,
-	.set = silicom_gpio_set,
+	.set_rv = silicom_gpio_set,
 	.base = -1,
 	.ngpio = ARRAY_SIZE(plat_0222_gpio_channels),
 	.names = plat_0222_gpio_names,

-- 
2.45.2


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

* Re: [PATCH 1/3] platform/x86: barco-p50: use new GPIO line value setter callbacks
  2025-04-08  7:19 ` [PATCH 1/3] platform/x86: barco-p50: use new GPIO line value setter callbacks Bartosz Golaszewski
@ 2025-04-08  7:24   ` Korsgaard, Peter
  0 siblings, 0 replies; 7+ messages in thread
From: Korsgaard, Peter @ 2025-04-08  7:24 UTC (permalink / raw)
  To: Bartosz Golaszewski, Yadav, Santosh Kumar, Hans de Goede,
	Ilpo Järvinen, Linus Walleij
  Cc: platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-gpio@vger.kernel.org, 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>

Acked-by: Peter Korsgaard <peter.korsgaard@barco.com>

--
Bye, Peter Korsgaard
This message is subject to the following terms and conditions: MAIL DISCLAIMER<https://www.barco.com/en/maildisclaimer>

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

* Re: [PATCH 0/3] platform/x86: convert GPIO chips to using new value setters
  2025-04-08  7:19 [PATCH 0/3] platform/x86: convert GPIO chips to using new value setters Bartosz Golaszewski
                   ` (2 preceding siblings ...)
  2025-04-08  7:19 ` [PATCH 3/3] platform/x86: silicom: " Bartosz Golaszewski
@ 2025-04-08  8:50 ` Hans de Goede
  2025-04-11 12:24 ` Ilpo Järvinen
  4 siblings, 0 replies; 7+ messages in thread
From: Hans de Goede @ 2025-04-08  8:50 UTC (permalink / raw)
  To: Bartosz Golaszewski, Santosh Kumar Yadav, Peter Korsgaard,
	Ilpo Järvinen, Linus Walleij
  Cc: platform-driver-x86, linux-kernel, linux-gpio,
	Bartosz Golaszewski

Hi Bartosz,

On 8-Apr-25 9:19 AM, Bartosz Golaszewski wrote:
> struct gpio_chip now has callbacks for setting line values that return
> an integer, allowing to indicate failures. We're in the process of
> converting all GPIO drivers to using the new API. This series converts
> all the x86 platform GPIO controllers.
> 
> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>

Thanks, the entire series looks good to me:

Reviewed-by: Hans de Goede <hdegoede@redhat.com>

for the series.

Regards,

Hans




> ---
> Bartosz Golaszewski (3):
>       platform/x86: barco-p50: use new GPIO line value setter callbacks
>       platform/x86: int0002: use new GPIO line value setter callbacks
>       platform/x86: silicom: use new GPIO line value setter callbacks
> 
>  drivers/platform/x86/barco-p50-gpio.c      | 10 +++++++---
>  drivers/platform/x86/intel/int0002_vgpio.c |  7 ++++---
>  drivers/platform/x86/silicom-platform.c    | 11 ++++++-----
>  3 files changed, 17 insertions(+), 11 deletions(-)
> ---
> base-commit: 0af2f6be1b4281385b618cb86ad946eded089ac8
> change-id: 20250401-gpiochip-set-rv-platform-x86-86788597f4a4
> 
> Best regards,


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

* Re: [PATCH 0/3] platform/x86: convert GPIO chips to using new value setters
  2025-04-08  7:19 [PATCH 0/3] platform/x86: convert GPIO chips to using new value setters Bartosz Golaszewski
                   ` (3 preceding siblings ...)
  2025-04-08  8:50 ` [PATCH 0/3] platform/x86: convert GPIO chips to using new value setters Hans de Goede
@ 2025-04-11 12:24 ` Ilpo Järvinen
  4 siblings, 0 replies; 7+ messages in thread
From: Ilpo Järvinen @ 2025-04-11 12:24 UTC (permalink / raw)
  To: Santosh Kumar Yadav, Peter Korsgaard, Hans de Goede,
	Linus Walleij, Bartosz Golaszewski
  Cc: platform-driver-x86, linux-kernel, linux-gpio,
	Bartosz Golaszewski

On Tue, 08 Apr 2025 09:19:52 +0200, Bartosz Golaszewski wrote:

> struct gpio_chip now has callbacks for setting line values that return
> an integer, allowing to indicate failures. We're in the process of
> converting all GPIO drivers to using the new API. This series converts
> all the x86 platform GPIO controllers.
> 
> 


Thank you for your contribution, it has been applied to my local
review-ilpo-next branch. Note it will show up in the public
platform-drivers-x86/review-ilpo-next branch only once I've pushed my
local branch there, which might take a while.

The list of commits applied:
[1/3] platform/x86: barco-p50: use new GPIO line value setter callbacks
      commit: 29ba3b6037dcf73f0fc563611ea81669fb2a3f37
[2/3] platform/x86: int0002: use new GPIO line value setter callbacks
      commit: e0071ad2ee0bf09a06e650cb5d697e6c8a7ca827
[3/3] platform/x86: silicom: use new GPIO line value setter callbacks
      commit: 88f67f2a99f061cb938812db3deb965504cf5c5c

--
 i.


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

end of thread, other threads:[~2025-04-11 12:24 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-08  7:19 [PATCH 0/3] platform/x86: convert GPIO chips to using new value setters Bartosz Golaszewski
2025-04-08  7:19 ` [PATCH 1/3] platform/x86: barco-p50: use new GPIO line value setter callbacks Bartosz Golaszewski
2025-04-08  7:24   ` Korsgaard, Peter
2025-04-08  7:19 ` [PATCH 2/3] platform/x86: int0002: " Bartosz Golaszewski
2025-04-08  7:19 ` [PATCH 3/3] platform/x86: silicom: " Bartosz Golaszewski
2025-04-08  8:50 ` [PATCH 0/3] platform/x86: convert GPIO chips to using new value setters Hans de Goede
2025-04-11 12:24 ` Ilpo Järvinen

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