Commit ce0929d2 authored by Andy Shevchenko's avatar Andy Shevchenko Committed by Linus Walleij

gpiolib: acpi: Add quirks field to struct acpi_gpio_mapping

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: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: default avatarMika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent 5c34b6c1
...@@ -414,7 +414,8 @@ EXPORT_SYMBOL_GPL(devm_acpi_dev_remove_driver_gpios); ...@@ -414,7 +414,8 @@ EXPORT_SYMBOL_GPL(devm_acpi_dev_remove_driver_gpios);
static bool acpi_get_driver_gpio_data(struct acpi_device *adev, static bool acpi_get_driver_gpio_data(struct acpi_device *adev,
const char *name, int index, const char *name, int index,
struct acpi_reference_args *args) struct acpi_reference_args *args,
unsigned int *quirks)
{ {
const struct acpi_gpio_mapping *gm; const struct acpi_gpio_mapping *gm;
...@@ -430,6 +431,8 @@ static bool acpi_get_driver_gpio_data(struct acpi_device *adev, ...@@ -430,6 +431,8 @@ static bool acpi_get_driver_gpio_data(struct acpi_device *adev,
args->args[1] = par->line_index; args->args[1] = par->line_index;
args->args[2] = par->active_low; args->args[2] = par->active_low;
args->nargs = 3; args->nargs = 3;
*quirks = gm->quirks;
return true; return true;
} }
...@@ -580,6 +583,7 @@ static int acpi_gpio_property_lookup(struct fwnode_handle *fwnode, ...@@ -580,6 +583,7 @@ static int acpi_gpio_property_lookup(struct fwnode_handle *fwnode,
struct acpi_gpio_lookup *lookup) struct acpi_gpio_lookup *lookup)
{ {
struct acpi_reference_args args; struct acpi_reference_args args;
unsigned int quirks = 0;
int ret; int ret;
memset(&args, 0, sizeof(args)); memset(&args, 0, sizeof(args));
...@@ -591,7 +595,8 @@ static int acpi_gpio_property_lookup(struct fwnode_handle *fwnode, ...@@ -591,7 +595,8 @@ static int acpi_gpio_property_lookup(struct fwnode_handle *fwnode,
if (!adev) if (!adev)
return ret; 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; return ret;
} }
/* /*
...@@ -606,6 +611,7 @@ static int acpi_gpio_property_lookup(struct fwnode_handle *fwnode, ...@@ -606,6 +611,7 @@ static int acpi_gpio_property_lookup(struct fwnode_handle *fwnode,
lookup->active_low = !!args.args[2]; lookup->active_low = !!args.args[2];
lookup->info.adev = args.adev; lookup->info.adev = args.adev;
lookup->info.quirks = quirks;
return 0; return 0;
} }
......
...@@ -80,6 +80,7 @@ struct gpio_device { ...@@ -80,6 +80,7 @@ struct gpio_device {
* @gpioint: if %true this GPIO is of type GpioInt otherwise type is GpioIo * @gpioint: if %true this GPIO is of type GpioInt otherwise type is GpioIo
* @polarity: interrupt polarity as provided by ACPI * @polarity: interrupt polarity as provided by ACPI
* @triggering: triggering type 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_gpio_info {
struct acpi_device *adev; struct acpi_device *adev;
...@@ -87,6 +88,7 @@ struct acpi_gpio_info { ...@@ -87,6 +88,7 @@ struct acpi_gpio_info {
bool gpioint; bool gpioint;
int polarity; int polarity;
int triggering; int triggering;
unsigned int quirks;
}; };
/* gpio suffixes used for ACPI and device tree lookup */ /* gpio suffixes used for ACPI and device tree lookup */
......
...@@ -978,6 +978,7 @@ struct acpi_gpio_mapping { ...@@ -978,6 +978,7 @@ struct acpi_gpio_mapping {
const char *name; const char *name;
const struct acpi_gpio_params *data; const struct acpi_gpio_params *data;
unsigned int size; unsigned int size;
unsigned int quirks;
}; };
#if defined(CONFIG_ACPI) && defined(CONFIG_GPIOLIB) #if defined(CONFIG_ACPI) && defined(CONFIG_GPIOLIB)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment