aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSrinivas Pandruvada <srinivas.pandruvada@linux.intel.com>2014-09-22 22:35:54 -0400
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2014-09-24 16:58:09 -0400
commitc15d821ddb9dac9ac6b5beb75bf942f3bc3a4004 (patch)
treeb453653f8406377c89fbfed0202be4436f5257d9
parent75ec6e55f1384548311a13ce4fcb39c516053314 (diff)
gpio / ACPI: Use pin index and bit length
Fix code when the operation region callback is for an gpio, which is not at index 0 and for partial pins in a GPIO definition. For example: Name (GMOD, ResourceTemplate () { //3 Outputs that define the Power mode of the device GpioIo (Exclusive, PullDown, , , , "\\_SB.GPI2") {10, 11, 12} }) } If opregion callback calls is for: - Set pin 10, then address = 0 and bit length = 1 - Set pin 11, then address = 1 and bit length = 1 - Set for both pin 11 and pin 12, then address = 1, bit length = 2 This change requires updated ACPICA gpio operation handler code to send the pin index and bit length. Fixes: 473ed7be0da0 (gpio / ACPI: Add support for ACPI GPIO operation regions) Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com> Acked-by: Linus Walleij <linus.walleij@linaro.org> Cc: 3.15+ <stable@vger.kernel.org> # 3.15+: 75ec6e55f138 ACPICA: Update to GPIO region handler interface. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
-rw-r--r--drivers/gpio/gpiolib-acpi.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/gpio/gpiolib-acpi.c b/drivers/gpio/gpiolib-acpi.c
index d62eaaa75397..687476fb39e3 100644
--- a/drivers/gpio/gpiolib-acpi.c
+++ b/drivers/gpio/gpiolib-acpi.c
@@ -377,8 +377,10 @@ acpi_gpio_adr_space_handler(u32 function, acpi_physical_address address,
377 struct gpio_chip *chip = achip->chip; 377 struct gpio_chip *chip = achip->chip;
378 struct acpi_resource_gpio *agpio; 378 struct acpi_resource_gpio *agpio;
379 struct acpi_resource *ares; 379 struct acpi_resource *ares;
380 int pin_index = (int)address;
380 acpi_status status; 381 acpi_status status;
381 bool pull_up; 382 bool pull_up;
383 int length;
382 int i; 384 int i;
383 385
384 status = acpi_buffer_to_resource(achip->conn_info.connection, 386 status = acpi_buffer_to_resource(achip->conn_info.connection,
@@ -400,7 +402,8 @@ acpi_gpio_adr_space_handler(u32 function, acpi_physical_address address,
400 return AE_BAD_PARAMETER; 402 return AE_BAD_PARAMETER;
401 } 403 }
402 404
403 for (i = 0; i < agpio->pin_table_length; i++) { 405 length = min(agpio->pin_table_length, (u16)(pin_index + bits));
406 for (i = pin_index; i < length; ++i) {
404 unsigned pin = agpio->pin_table[i]; 407 unsigned pin = agpio->pin_table[i];
405 struct acpi_gpio_connection *conn; 408 struct acpi_gpio_connection *conn;
406 struct gpio_desc *desc; 409 struct gpio_desc *desc;