linux-acpi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1 1/5] gpiolib: acpi: Introduce opaque data field for quirks
@ 2020-05-20 21:19 Andy Shevchenko
  2020-05-20 21:19 ` [PATCH v1 2/5] gpiolib: acpi: Introduce a quirk to force GpioInt pin Andy Shevchenko
                   ` (3 more replies)
  0 siblings, 4 replies; 22+ messages in thread
From: Andy Shevchenko @ 2020-05-20 21:19 UTC (permalink / raw)
  To: Linus Walleij, Bartosz Golaszewski, linux-gpio, Mika Westerberg,
	linux-acpi
  Cc: Andy Shevchenko

Some quirks may need an additional data to be provided.
Introduce special quirks data field.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/gpio/gpiolib-acpi.c   | 13 +++++++------
 drivers/gpio/gpiolib-acpi.h   |  2 ++
 include/linux/gpio/consumer.h |  1 +
 3 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/drivers/gpio/gpiolib-acpi.c b/drivers/gpio/gpiolib-acpi.c
index 9276051663da..3aa976f9ad1a 100644
--- a/drivers/gpio/gpiolib-acpi.c
+++ b/drivers/gpio/gpiolib-acpi.c
@@ -502,7 +502,7 @@ EXPORT_SYMBOL_GPL(devm_acpi_dev_remove_driver_gpios);
 static bool acpi_get_driver_gpio_data(struct acpi_device *adev,
 				      const char *name, int index,
 				      struct fwnode_reference_args *args,
-				      unsigned int *quirks)
+				      struct acpi_gpio_info *info)
 {
 	const struct acpi_gpio_mapping *gm;
 
@@ -519,7 +519,8 @@ static bool acpi_get_driver_gpio_data(struct acpi_device *adev,
 			args->args[2] = par->active_low;
 			args->nargs = 3;
 
-			*quirks = gm->quirks;
+			info->quirks = gm->quirks;
+			info->quirks_data = gm->quirks_data;
 			return true;
 		}
 
@@ -716,7 +717,7 @@ static int acpi_gpio_property_lookup(struct fwnode_handle *fwnode,
 				     struct acpi_gpio_lookup *lookup)
 {
 	struct fwnode_reference_args args;
-	unsigned int quirks = 0;
+	struct acpi_gpio_info info = {};
 	int ret;
 
 	memset(&args, 0, sizeof(args));
@@ -728,8 +729,7 @@ static int acpi_gpio_property_lookup(struct fwnode_handle *fwnode,
 		if (!adev)
 			return ret;
 
-		if (!acpi_get_driver_gpio_data(adev, propname, index, &args,
-					       &quirks))
+		if (!acpi_get_driver_gpio_data(adev, propname, index, &args, &info))
 			return ret;
 	}
 	/*
@@ -746,7 +746,8 @@ static int acpi_gpio_property_lookup(struct fwnode_handle *fwnode,
 	lookup->active_low = !!args.args[2];
 
 	lookup->info.adev = to_acpi_device_node(args.fwnode);
-	lookup->info.quirks = quirks;
+	lookup->info.quirks = info.quirks;
+	lookup->info.quirks_data = info.quirks_data;
 
 	return 0;
 }
diff --git a/drivers/gpio/gpiolib-acpi.h b/drivers/gpio/gpiolib-acpi.h
index 1c6d65cf0629..44cf55c9d35d 100644
--- a/drivers/gpio/gpiolib-acpi.h
+++ b/drivers/gpio/gpiolib-acpi.h
@@ -19,6 +19,7 @@ struct acpi_device;
  * @polarity: interrupt polarity as provided by ACPI
  * @triggering: triggering type as provided by ACPI
  * @quirks: Linux specific quirks as provided by struct acpi_gpio_mapping
+ * @quirks_data: optional data for the specific @quirks
  */
 struct acpi_gpio_info {
 	struct acpi_device *adev;
@@ -28,6 +29,7 @@ struct acpi_gpio_info {
 	int polarity;
 	int triggering;
 	unsigned int quirks;
+	unsigned long quirks_data;
 };
 
 #ifdef CONFIG_ACPI
diff --git a/include/linux/gpio/consumer.h b/include/linux/gpio/consumer.h
index 901aab89d025..49743a499fda 100644
--- a/include/linux/gpio/consumer.h
+++ b/include/linux/gpio/consumer.h
@@ -676,6 +676,7 @@ struct acpi_gpio_mapping {
 #define ACPI_GPIO_QUIRK_ONLY_GPIOIO		BIT(1)
 
 	unsigned int quirks;
+	unsigned long quirks_data;
 };
 
 #if IS_ENABLED(CONFIG_GPIOLIB) && IS_ENABLED(CONFIG_ACPI)
-- 
2.26.2


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

end of thread, other threads:[~2020-06-03 12:05 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-20 21:19 [PATCH v1 1/5] gpiolib: acpi: Introduce opaque data field for quirks Andy Shevchenko
2020-05-20 21:19 ` [PATCH v1 2/5] gpiolib: acpi: Introduce a quirk to force GpioInt pin Andy Shevchenko
2020-05-20 21:19 ` [PATCH v1 3/5] gpio: pca953x: Drop unneeded ACPI_PTR() Andy Shevchenko
2020-05-25 17:58   ` Andy Shevchenko
2020-05-27 13:13     ` Bartosz Golaszewski
2020-05-27 13:38       ` Andy Shevchenko
2020-06-03 12:05       ` Linus Walleij
2020-05-20 21:19 ` [PATCH v1 4/5] gpio: pca935x: Allow IRQ support for driver built as a module Andy Shevchenko
2020-05-25  9:38   ` Bartosz Golaszewski
2020-05-25 10:09     ` Andy Shevchenko
2020-05-20 21:19 ` [PATCH v1 5/5] gpio: pca953x: Override GpioInt() pin for Intel Galileo Gen 2 Andy Shevchenko
2020-05-25  9:20   ` Mika Westerberg
2020-05-25  9:31     ` Andy Shevchenko
2020-05-25  9:45       ` Mika Westerberg
2020-05-25 10:13         ` Andy Shevchenko
2020-05-25 11:05           ` Mika Westerberg
2020-05-25 11:35             ` Andy Shevchenko
2020-05-25 12:01               ` Andy Shevchenko
2020-05-25 12:21               ` Mika Westerberg
2020-05-25 13:01                 ` Andy Shevchenko
2020-05-25 13:47                   ` Mika Westerberg
2020-05-25 14:34                     ` Andy Shevchenko

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