linux-acpi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Linus Walleij <linus.walleij@linaro.org>,
	linux-gpio@vger.kernel.org,
	"Rafael J. Wysocki" <rjw@rjwysocki.net>,
	linux-acpi@vger.kernel.org,
	Mika Westerberg <mika.westerberg@linux.intel.com>
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Subject: [PATCH v1 5/6] gpiolib: acpi: Add quirks field to struct acpi_gpio_mapping
Date: Fri, 10 Nov 2017 15:40:32 +0200	[thread overview]
Message-ID: <20171110134033.85461-5-andriy.shevchenko@linux.intel.com> (raw)
In-Reply-To: <20171110134033.85461-1-andriy.shevchenko@linux.intel.com>

Some broken ACPI tables might require quirks in the OS.
Introduce quirks field in struct acpi_gpio_mapping.

Propagate them to struct acpi_gpio_info for further use.

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

diff --git a/drivers/gpio/gpiolib-acpi.c b/drivers/gpio/gpiolib-acpi.c
index 88518afa26bd..711f64b9dd30 100644
--- a/drivers/gpio/gpiolib-acpi.c
+++ b/drivers/gpio/gpiolib-acpi.c
@@ -414,7 +414,8 @@ 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 acpi_reference_args *args)
+				      struct acpi_reference_args *args,
+				      unsigned int *quirks)
 {
 	const struct acpi_gpio_mapping *gm;
 
@@ -430,6 +431,8 @@ static bool acpi_get_driver_gpio_data(struct acpi_device *adev,
 			args->args[1] = par->line_index;
 			args->args[2] = par->active_low;
 			args->nargs = 3;
+
+			*quirks = gm->quirks;
 			return true;
 		}
 
@@ -580,6 +583,7 @@ static int acpi_gpio_property_lookup(struct fwnode_handle *fwnode,
 				     struct acpi_gpio_lookup *lookup)
 {
 	struct acpi_reference_args args;
+	unsigned int quirks = 0;
 	int ret;
 
 	memset(&args, 0, sizeof(args));
@@ -591,7 +595,8 @@ static int acpi_gpio_property_lookup(struct fwnode_handle *fwnode,
 		if (!adev)
 			return ret;
 
-		if (!acpi_get_driver_gpio_data(adev, propname, index, &args))
+		if (!acpi_get_driver_gpio_data(adev, propname, index, &args,
+					       &quirks))
 			return ret;
 	}
 	/*
@@ -606,6 +611,7 @@ static int acpi_gpio_property_lookup(struct fwnode_handle *fwnode,
 	lookup->active_low = !!args.args[2];
 
 	lookup->info.adev = args.adev;
+	lookup->info.quirks = quirks;
 	return 0;
 }
 
diff --git a/drivers/gpio/gpiolib.h b/drivers/gpio/gpiolib.h
index b23aeaf5ac9e..cd4622863fe1 100644
--- a/drivers/gpio/gpiolib.h
+++ b/drivers/gpio/gpiolib.h
@@ -80,6 +80,7 @@ struct gpio_device {
  * @gpioint: if %true this GPIO is of type GpioInt otherwise type is GpioIo
  * @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
  */
 struct acpi_gpio_info {
 	struct acpi_device *adev;
@@ -87,6 +88,7 @@ struct acpi_gpio_info {
 	bool gpioint;
 	int polarity;
 	int triggering;
+	unsigned int quirks;
 };
 
 /* gpio suffixes used for ACPI and device tree lookup */
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index dc1ebfeeb5ec..25fe77fccea0 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -978,6 +978,7 @@ struct acpi_gpio_mapping {
 	const char *name;
 	const struct acpi_gpio_params *data;
 	unsigned int size;
+	unsigned int quirks;
 };
 
 #if defined(CONFIG_ACPI) && defined(CONFIG_GPIOLIB)
-- 
2.14.2


  parent reply	other threads:[~2017-11-10 13:41 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-10 13:40 [PATCH v1 1/6] gpiolib: acpi: Assign polarity when call acpi_populate_gpio_lookup() Andy Shevchenko
2017-11-10 13:40 ` [PATCH v1 2/6] gpiolib: acpi: Don't contaminate return parameter in case of error Andy Shevchenko
2017-11-13 11:15   ` Mika Westerberg
2017-11-29 12:28   ` Linus Walleij
2017-11-10 13:40 ` [PATCH v1 3/6] gpiolib: acpi: Move adev member to struct acpi_gpio_info Andy Shevchenko
2017-11-13 11:23   ` Mika Westerberg
2017-11-29 12:30   ` Linus Walleij
2017-11-10 13:40 ` [PATCH v1 4/6] gpiolib: acpi: Consolidate debug output in acpi_gpio_update_gpiod_flags() Andy Shevchenko
2017-11-13 11:25   ` Mika Westerberg
2017-11-29 12:31   ` Linus Walleij
2017-11-10 13:40 ` Andy Shevchenko [this message]
2017-11-13 11:44   ` [PATCH v1 5/6] gpiolib: acpi: Add quirks field to struct acpi_gpio_mapping Mika Westerberg
2017-11-29 12:32   ` Linus Walleij
2017-11-10 13:40 ` [PATCH v1 6/6] gpiolib: acpi: Introduce NO_RESTRICTION quirk Andy Shevchenko
2017-11-13 11:55   ` Mika Westerberg
2017-11-13 13:10     ` Andy Shevchenko
2017-11-13 13:19       ` Mika Westerberg
2017-11-29 12:35       ` Linus Walleij
2017-11-29 13:41         ` Andy Shevchenko
2017-11-30  9:57           ` Linus Walleij
2017-11-30 11:07             ` Andy Shevchenko
2017-11-29 12:34   ` Linus Walleij
2017-11-13 11:07 ` [PATCH v1 1/6] gpiolib: acpi: Assign polarity when call acpi_populate_gpio_lookup() Mika Westerberg
2017-11-18 14:55 ` Rafael J. Wysocki
2017-11-18 16:45   ` Andy Shevchenko
2017-11-29 12:27 ` Linus Walleij

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=20171110134033.85461-5-andriy.shevchenko@linux.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=mika.westerberg@linux.intel.com \
    --cc=rjw@rjwysocki.net \
    /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).