From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Linus Walleij <linus.walleij@linaro.org>,
Bartosz Golaszewski <bgolaszewski@baylibre.com>,
linux-gpio@vger.kernel.org,
Mika Westerberg <mika.westerberg@linux.intel.com>,
linux-acpi@vger.kernel.org
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Subject: [PATCH v1 1/5] gpiolib: acpi: Introduce opaque data field for quirks
Date: Thu, 21 May 2020 00:19:12 +0300 [thread overview]
Message-ID: <20200520211916.25727-1-andriy.shevchenko@linux.intel.com> (raw)
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
next reply other threads:[~2020-05-20 21:19 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-20 21:19 Andy Shevchenko [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200520211916.25727-1-andriy.shevchenko@linux.intel.com \
--to=andriy.shevchenko@linux.intel.com \
--cc=bgolaszewski@baylibre.com \
--cc=linus.walleij@linaro.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-gpio@vger.kernel.org \
--cc=mika.westerberg@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).