2012-11-30 19:37:36 +08:00
|
|
|
/*
|
|
|
|
* ACPI helpers for GPIO API
|
|
|
|
*
|
|
|
|
* Copyright (C) 2012, Intel Corporation
|
|
|
|
* Authors: Mathias Nyman <mathias.nyman@linux.intel.com>
|
|
|
|
* Mika Westerberg <mika.westerberg@linux.intel.com>
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License version 2 as
|
|
|
|
* published by the Free Software Foundation.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <linux/errno.h>
|
2013-10-10 16:01:08 +08:00
|
|
|
#include <linux/gpio/consumer.h>
|
2014-01-08 18:40:56 +08:00
|
|
|
#include <linux/gpio/driver.h>
|
2012-11-30 19:37:36 +08:00
|
|
|
#include <linux/export.h>
|
|
|
|
#include <linux/acpi.h>
|
2013-01-28 22:23:10 +08:00
|
|
|
#include <linux/interrupt.h>
|
gpio / ACPI: Add support for ACPI GPIO operation regions
GPIO operation regions is a new feature introduced in ACPI 5.0
specification. This feature adds a way for platform ASL code to call back
to OS GPIO driver and toggle GPIO pins.
An example ASL code from Lenovo Miix 2 tablet with only relevant part
listed:
Device (\_SB.GPO0)
{
Name (AVBL, Zero)
Method (_REG, 2, NotSerialized)
{
If (LEqual (Arg0, 0x08))
{
// Marks the region available
Store (Arg1, AVBL)
}
}
OperationRegion (GPOP, GeneralPurposeIo, Zero, 0x0C)
Field (GPOP, ByteAcc, NoLock, Preserve)
{
Connection (
GpioIo (Exclusive, PullDefault, 0, 0, IoRestrictionOutputOnly,
"\\_SB.GPO0", 0x00, ResourceConsumer,,)
{
0x003B
}
),
SHD3, 1,
}
}
Device (SHUB)
{
Method (_PS0, 0, Serialized)
{
If (LEqual (\_SB.GPO0.AVBL, One))
{
Store (One, \_SB.GPO0.SHD3)
Sleep (0x32)
}
}
Method (_PS3, 0, Serialized)
{
If (LEqual (\_SB.GPO0.AVBL, One))
{
Store (Zero, \_SB.GPO0.SHD3)
}
}
}
How this works is that whenever _PS0 or _PS3 method is run (typically when
SHUB device is transitioned to D0 or D3 respectively), ASL code checks if
the GPIO operation region is available (\_SB.GPO0.AVBL). If it is we go and
store either 0 or 1 to \_SB.GPO0.SHD3.
Now, when ACPICA notices ACPI GPIO operation region access (the store
above) it will call acpi_gpio_adr_space_handler() that then toggles the
GPIO accordingly using standard gpiolib interfaces.
Implement the support by registering GPIO operation region handlers for all
GPIO devices that have an ACPI handle. First time the GPIO is used by the
ASL code we make sure that the GPIO stays requested until the GPIO chip
driver itself is unloaded. If we find out that the GPIO is already
requested we just toggle it according to the value got from ASL code.
Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2014-03-14 23:58:07 +08:00
|
|
|
#include <linux/mutex.h>
|
2012-11-30 19:37:36 +08:00
|
|
|
|
2014-01-08 18:40:56 +08:00
|
|
|
#include "gpiolib.h"
|
|
|
|
|
2014-03-10 20:54:52 +08:00
|
|
|
struct acpi_gpio_event {
|
2013-04-09 21:57:25 +08:00
|
|
|
struct list_head node;
|
2014-03-10 20:54:52 +08:00
|
|
|
acpi_handle handle;
|
2013-04-09 21:57:25 +08:00
|
|
|
unsigned int pin;
|
|
|
|
unsigned int irq;
|
2014-08-20 01:06:08 +08:00
|
|
|
struct gpio_desc *desc;
|
2013-04-09 21:57:25 +08:00
|
|
|
};
|
|
|
|
|
gpio / ACPI: Add support for ACPI GPIO operation regions
GPIO operation regions is a new feature introduced in ACPI 5.0
specification. This feature adds a way for platform ASL code to call back
to OS GPIO driver and toggle GPIO pins.
An example ASL code from Lenovo Miix 2 tablet with only relevant part
listed:
Device (\_SB.GPO0)
{
Name (AVBL, Zero)
Method (_REG, 2, NotSerialized)
{
If (LEqual (Arg0, 0x08))
{
// Marks the region available
Store (Arg1, AVBL)
}
}
OperationRegion (GPOP, GeneralPurposeIo, Zero, 0x0C)
Field (GPOP, ByteAcc, NoLock, Preserve)
{
Connection (
GpioIo (Exclusive, PullDefault, 0, 0, IoRestrictionOutputOnly,
"\\_SB.GPO0", 0x00, ResourceConsumer,,)
{
0x003B
}
),
SHD3, 1,
}
}
Device (SHUB)
{
Method (_PS0, 0, Serialized)
{
If (LEqual (\_SB.GPO0.AVBL, One))
{
Store (One, \_SB.GPO0.SHD3)
Sleep (0x32)
}
}
Method (_PS3, 0, Serialized)
{
If (LEqual (\_SB.GPO0.AVBL, One))
{
Store (Zero, \_SB.GPO0.SHD3)
}
}
}
How this works is that whenever _PS0 or _PS3 method is run (typically when
SHUB device is transitioned to D0 or D3 respectively), ASL code checks if
the GPIO operation region is available (\_SB.GPO0.AVBL). If it is we go and
store either 0 or 1 to \_SB.GPO0.SHD3.
Now, when ACPICA notices ACPI GPIO operation region access (the store
above) it will call acpi_gpio_adr_space_handler() that then toggles the
GPIO accordingly using standard gpiolib interfaces.
Implement the support by registering GPIO operation region handlers for all
GPIO devices that have an ACPI handle. First time the GPIO is used by the
ASL code we make sure that the GPIO stays requested until the GPIO chip
driver itself is unloaded. If we find out that the GPIO is already
requested we just toggle it according to the value got from ASL code.
Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2014-03-14 23:58:07 +08:00
|
|
|
struct acpi_gpio_connection {
|
|
|
|
struct list_head node;
|
2014-08-20 01:06:08 +08:00
|
|
|
unsigned int pin;
|
gpio / ACPI: Add support for ACPI GPIO operation regions
GPIO operation regions is a new feature introduced in ACPI 5.0
specification. This feature adds a way for platform ASL code to call back
to OS GPIO driver and toggle GPIO pins.
An example ASL code from Lenovo Miix 2 tablet with only relevant part
listed:
Device (\_SB.GPO0)
{
Name (AVBL, Zero)
Method (_REG, 2, NotSerialized)
{
If (LEqual (Arg0, 0x08))
{
// Marks the region available
Store (Arg1, AVBL)
}
}
OperationRegion (GPOP, GeneralPurposeIo, Zero, 0x0C)
Field (GPOP, ByteAcc, NoLock, Preserve)
{
Connection (
GpioIo (Exclusive, PullDefault, 0, 0, IoRestrictionOutputOnly,
"\\_SB.GPO0", 0x00, ResourceConsumer,,)
{
0x003B
}
),
SHD3, 1,
}
}
Device (SHUB)
{
Method (_PS0, 0, Serialized)
{
If (LEqual (\_SB.GPO0.AVBL, One))
{
Store (One, \_SB.GPO0.SHD3)
Sleep (0x32)
}
}
Method (_PS3, 0, Serialized)
{
If (LEqual (\_SB.GPO0.AVBL, One))
{
Store (Zero, \_SB.GPO0.SHD3)
}
}
}
How this works is that whenever _PS0 or _PS3 method is run (typically when
SHUB device is transitioned to D0 or D3 respectively), ASL code checks if
the GPIO operation region is available (\_SB.GPO0.AVBL). If it is we go and
store either 0 or 1 to \_SB.GPO0.SHD3.
Now, when ACPICA notices ACPI GPIO operation region access (the store
above) it will call acpi_gpio_adr_space_handler() that then toggles the
GPIO accordingly using standard gpiolib interfaces.
Implement the support by registering GPIO operation region handlers for all
GPIO devices that have an ACPI handle. First time the GPIO is used by the
ASL code we make sure that the GPIO stays requested until the GPIO chip
driver itself is unloaded. If we find out that the GPIO is already
requested we just toggle it according to the value got from ASL code.
Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2014-03-14 23:58:07 +08:00
|
|
|
struct gpio_desc *desc;
|
|
|
|
};
|
|
|
|
|
2014-03-10 20:54:51 +08:00
|
|
|
struct acpi_gpio_chip {
|
gpio / ACPI: Add support for ACPI GPIO operation regions
GPIO operation regions is a new feature introduced in ACPI 5.0
specification. This feature adds a way for platform ASL code to call back
to OS GPIO driver and toggle GPIO pins.
An example ASL code from Lenovo Miix 2 tablet with only relevant part
listed:
Device (\_SB.GPO0)
{
Name (AVBL, Zero)
Method (_REG, 2, NotSerialized)
{
If (LEqual (Arg0, 0x08))
{
// Marks the region available
Store (Arg1, AVBL)
}
}
OperationRegion (GPOP, GeneralPurposeIo, Zero, 0x0C)
Field (GPOP, ByteAcc, NoLock, Preserve)
{
Connection (
GpioIo (Exclusive, PullDefault, 0, 0, IoRestrictionOutputOnly,
"\\_SB.GPO0", 0x00, ResourceConsumer,,)
{
0x003B
}
),
SHD3, 1,
}
}
Device (SHUB)
{
Method (_PS0, 0, Serialized)
{
If (LEqual (\_SB.GPO0.AVBL, One))
{
Store (One, \_SB.GPO0.SHD3)
Sleep (0x32)
}
}
Method (_PS3, 0, Serialized)
{
If (LEqual (\_SB.GPO0.AVBL, One))
{
Store (Zero, \_SB.GPO0.SHD3)
}
}
}
How this works is that whenever _PS0 or _PS3 method is run (typically when
SHUB device is transitioned to D0 or D3 respectively), ASL code checks if
the GPIO operation region is available (\_SB.GPO0.AVBL). If it is we go and
store either 0 or 1 to \_SB.GPO0.SHD3.
Now, when ACPICA notices ACPI GPIO operation region access (the store
above) it will call acpi_gpio_adr_space_handler() that then toggles the
GPIO accordingly using standard gpiolib interfaces.
Implement the support by registering GPIO operation region handlers for all
GPIO devices that have an ACPI handle. First time the GPIO is used by the
ASL code we make sure that the GPIO stays requested until the GPIO chip
driver itself is unloaded. If we find out that the GPIO is already
requested we just toggle it according to the value got from ASL code.
Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2014-03-14 23:58:07 +08:00
|
|
|
/*
|
|
|
|
* ACPICA requires that the first field of the context parameter
|
|
|
|
* passed to acpi_install_address_space_handler() is large enough
|
|
|
|
* to hold struct acpi_connection_info.
|
|
|
|
*/
|
|
|
|
struct acpi_connection_info conn_info;
|
|
|
|
struct list_head conns;
|
|
|
|
struct mutex conn_lock;
|
2014-03-10 20:54:51 +08:00
|
|
|
struct gpio_chip *chip;
|
2014-03-10 20:54:52 +08:00
|
|
|
struct list_head events;
|
2014-03-10 20:54:51 +08:00
|
|
|
};
|
|
|
|
|
2012-11-30 19:37:36 +08:00
|
|
|
static int acpi_gpiochip_find(struct gpio_chip *gc, void *data)
|
|
|
|
{
|
|
|
|
if (!gc->dev)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
return ACPI_HANDLE(gc->dev) == data;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2013-10-10 16:01:08 +08:00
|
|
|
* acpi_get_gpiod() - Translate ACPI GPIO pin to GPIO descriptor usable with GPIO API
|
2012-11-30 19:37:36 +08:00
|
|
|
* @path: ACPI GPIO controller full path name, (e.g. "\\_SB.GPO1")
|
|
|
|
* @pin: ACPI GPIO pin number (0-based, controller-relative)
|
|
|
|
*
|
2013-10-10 16:01:08 +08:00
|
|
|
* Returns GPIO descriptor to use with Linux generic GPIO API, or ERR_PTR
|
|
|
|
* error value
|
2012-11-30 19:37:36 +08:00
|
|
|
*/
|
|
|
|
|
2013-10-10 16:01:08 +08:00
|
|
|
static struct gpio_desc *acpi_get_gpiod(char *path, int pin)
|
2012-11-30 19:37:36 +08:00
|
|
|
{
|
|
|
|
struct gpio_chip *chip;
|
|
|
|
acpi_handle handle;
|
|
|
|
acpi_status status;
|
|
|
|
|
|
|
|
status = acpi_get_handle(NULL, path, &handle);
|
|
|
|
if (ACPI_FAILURE(status))
|
2013-10-10 16:01:08 +08:00
|
|
|
return ERR_PTR(-ENODEV);
|
2012-11-30 19:37:36 +08:00
|
|
|
|
|
|
|
chip = gpiochip_find(handle, acpi_gpiochip_find);
|
|
|
|
if (!chip)
|
2013-10-10 16:01:08 +08:00
|
|
|
return ERR_PTR(-ENODEV);
|
2012-11-30 19:37:36 +08:00
|
|
|
|
2013-10-10 16:01:08 +08:00
|
|
|
if (pin < 0 || pin > chip->ngpio)
|
|
|
|
return ERR_PTR(-EINVAL);
|
2012-11-30 19:37:36 +08:00
|
|
|
|
2014-02-09 16:43:55 +08:00
|
|
|
return gpiochip_get_desc(chip, pin);
|
2012-11-30 19:37:36 +08:00
|
|
|
}
|
2013-01-28 22:23:10 +08:00
|
|
|
|
|
|
|
static irqreturn_t acpi_gpio_irq_handler(int irq, void *data)
|
|
|
|
{
|
2014-03-10 20:54:53 +08:00
|
|
|
struct acpi_gpio_event *event = data;
|
2013-01-28 22:23:10 +08:00
|
|
|
|
2014-03-10 20:54:53 +08:00
|
|
|
acpi_evaluate_object(event->handle, NULL, NULL, NULL);
|
2013-01-28 22:23:10 +08:00
|
|
|
|
|
|
|
return IRQ_HANDLED;
|
|
|
|
}
|
|
|
|
|
2013-04-09 21:57:25 +08:00
|
|
|
static irqreturn_t acpi_gpio_irq_handler_evt(int irq, void *data)
|
|
|
|
{
|
2014-03-10 20:54:52 +08:00
|
|
|
struct acpi_gpio_event *event = data;
|
2013-04-09 21:57:25 +08:00
|
|
|
|
2014-03-10 20:54:52 +08:00
|
|
|
acpi_execute_simple_method(event->handle, NULL, event->pin);
|
2013-04-09 21:57:25 +08:00
|
|
|
|
|
|
|
return IRQ_HANDLED;
|
|
|
|
}
|
|
|
|
|
2014-03-10 20:54:51 +08:00
|
|
|
static void acpi_gpio_chip_dh(acpi_handle handle, void *data)
|
2013-04-09 21:57:25 +08:00
|
|
|
{
|
|
|
|
/* The address of this function is used as a key. */
|
|
|
|
}
|
|
|
|
|
2014-03-10 20:54:53 +08:00
|
|
|
static acpi_status acpi_gpiochip_request_interrupt(struct acpi_resource *ares,
|
|
|
|
void *context)
|
2013-01-28 22:23:10 +08:00
|
|
|
{
|
2014-03-10 20:54:53 +08:00
|
|
|
struct acpi_gpio_chip *acpi_gpio = context;
|
2014-03-10 20:54:51 +08:00
|
|
|
struct gpio_chip *chip = acpi_gpio->chip;
|
2014-03-10 20:54:53 +08:00
|
|
|
struct acpi_resource_gpio *agpio;
|
2013-04-09 21:57:25 +08:00
|
|
|
acpi_handle handle, evt_handle;
|
2014-03-10 20:54:53 +08:00
|
|
|
struct acpi_gpio_event *event;
|
|
|
|
irq_handler_t handler = NULL;
|
|
|
|
struct gpio_desc *desc;
|
|
|
|
unsigned long irqflags;
|
|
|
|
int ret, pin, irq;
|
2013-01-28 22:23:10 +08:00
|
|
|
|
2014-03-10 20:54:53 +08:00
|
|
|
if (ares->type != ACPI_RESOURCE_TYPE_GPIO)
|
|
|
|
return AE_OK;
|
|
|
|
|
|
|
|
agpio = &ares->data.gpio;
|
|
|
|
if (agpio->connection_type != ACPI_RESOURCE_GPIO_TYPE_INT)
|
|
|
|
return AE_OK;
|
2013-01-28 22:23:10 +08:00
|
|
|
|
|
|
|
handle = ACPI_HANDLE(chip->dev);
|
2014-03-10 20:54:53 +08:00
|
|
|
pin = agpio->pin_table[0];
|
|
|
|
|
|
|
|
if (pin <= 255) {
|
|
|
|
char ev_name[5];
|
|
|
|
sprintf(ev_name, "_%c%02X",
|
|
|
|
agpio->triggering == ACPI_EDGE_SENSITIVE ? 'E' : 'L',
|
|
|
|
pin);
|
|
|
|
if (ACPI_SUCCESS(acpi_get_handle(handle, ev_name, &evt_handle)))
|
|
|
|
handler = acpi_gpio_irq_handler;
|
|
|
|
}
|
|
|
|
if (!handler) {
|
|
|
|
if (ACPI_SUCCESS(acpi_get_handle(handle, "_EVT", &evt_handle)))
|
|
|
|
handler = acpi_gpio_irq_handler_evt;
|
|
|
|
}
|
|
|
|
if (!handler)
|
|
|
|
return AE_BAD_PARAMETER;
|
2013-01-28 22:23:10 +08:00
|
|
|
|
2014-08-20 01:06:09 +08:00
|
|
|
desc = gpiochip_request_own_desc(chip, pin, "ACPI:Event");
|
2014-03-10 20:54:53 +08:00
|
|
|
if (IS_ERR(desc)) {
|
|
|
|
dev_err(chip->dev, "Failed to request GPIO\n");
|
|
|
|
return AE_ERROR;
|
|
|
|
}
|
2013-01-28 22:23:10 +08:00
|
|
|
|
2014-03-10 20:54:53 +08:00
|
|
|
gpiod_direction_input(desc);
|
2013-01-28 22:23:10 +08:00
|
|
|
|
2014-07-22 15:17:42 +08:00
|
|
|
ret = gpio_lock_as_irq(chip, pin);
|
2014-03-10 20:54:53 +08:00
|
|
|
if (ret) {
|
|
|
|
dev_err(chip->dev, "Failed to lock GPIO as interrupt\n");
|
|
|
|
goto fail_free_desc;
|
|
|
|
}
|
2013-01-28 22:23:10 +08:00
|
|
|
|
2014-03-10 20:54:53 +08:00
|
|
|
irq = gpiod_to_irq(desc);
|
|
|
|
if (irq < 0) {
|
|
|
|
dev_err(chip->dev, "Failed to translate GPIO to IRQ\n");
|
|
|
|
goto fail_unlock_irq;
|
|
|
|
}
|
2013-04-09 21:57:25 +08:00
|
|
|
|
2014-03-10 20:54:53 +08:00
|
|
|
irqflags = IRQF_ONESHOT;
|
|
|
|
if (agpio->triggering == ACPI_LEVEL_SENSITIVE) {
|
|
|
|
if (agpio->polarity == ACPI_ACTIVE_HIGH)
|
|
|
|
irqflags |= IRQF_TRIGGER_HIGH;
|
|
|
|
else
|
|
|
|
irqflags |= IRQF_TRIGGER_LOW;
|
|
|
|
} else {
|
|
|
|
switch (agpio->polarity) {
|
|
|
|
case ACPI_ACTIVE_HIGH:
|
|
|
|
irqflags |= IRQF_TRIGGER_RISING;
|
|
|
|
break;
|
|
|
|
case ACPI_ACTIVE_LOW:
|
|
|
|
irqflags |= IRQF_TRIGGER_FALLING;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
irqflags |= IRQF_TRIGGER_RISING |
|
|
|
|
IRQF_TRIGGER_FALLING;
|
|
|
|
break;
|
2013-04-09 21:57:25 +08:00
|
|
|
}
|
2014-03-10 20:54:53 +08:00
|
|
|
}
|
2014-03-10 20:54:51 +08:00
|
|
|
|
2014-03-10 20:54:53 +08:00
|
|
|
event = kzalloc(sizeof(*event), GFP_KERNEL);
|
|
|
|
if (!event)
|
|
|
|
goto fail_unlock_irq;
|
2013-04-09 21:57:25 +08:00
|
|
|
|
2014-03-10 20:54:53 +08:00
|
|
|
event->handle = evt_handle;
|
|
|
|
event->irq = irq;
|
|
|
|
event->pin = pin;
|
2014-08-20 01:06:08 +08:00
|
|
|
event->desc = desc;
|
2013-04-09 21:57:25 +08:00
|
|
|
|
2014-03-10 20:54:53 +08:00
|
|
|
ret = request_threaded_irq(event->irq, NULL, handler, irqflags,
|
|
|
|
"ACPI:Event", event);
|
|
|
|
if (ret) {
|
|
|
|
dev_err(chip->dev, "Failed to setup interrupt handler for %d\n",
|
|
|
|
event->irq);
|
|
|
|
goto fail_free_event;
|
2013-01-28 22:23:10 +08:00
|
|
|
}
|
2014-03-10 20:54:53 +08:00
|
|
|
|
|
|
|
list_add_tail(&event->node, &acpi_gpio->events);
|
|
|
|
return AE_OK;
|
|
|
|
|
|
|
|
fail_free_event:
|
|
|
|
kfree(event);
|
|
|
|
fail_unlock_irq:
|
2014-07-22 15:17:42 +08:00
|
|
|
gpio_unlock_as_irq(chip, pin);
|
2014-03-10 20:54:53 +08:00
|
|
|
fail_free_desc:
|
|
|
|
gpiochip_free_own_desc(desc);
|
|
|
|
|
|
|
|
return AE_ERROR;
|
2013-01-28 22:23:10 +08:00
|
|
|
}
|
2013-04-09 21:57:25 +08:00
|
|
|
|
2013-10-10 16:01:07 +08:00
|
|
|
/**
|
2014-03-10 20:54:53 +08:00
|
|
|
* acpi_gpiochip_request_interrupts() - Register isr for gpio chip ACPI events
|
2014-07-25 14:54:48 +08:00
|
|
|
* @chip: GPIO chip
|
2013-10-10 16:01:07 +08:00
|
|
|
*
|
2014-03-10 20:54:53 +08:00
|
|
|
* ACPI5 platforms can use GPIO signaled ACPI events. These GPIO interrupts are
|
|
|
|
* handled by ACPI event methods which need to be called from the GPIO
|
|
|
|
* chip's interrupt handler. acpi_gpiochip_request_interrupts finds out which
|
|
|
|
* gpio pins have acpi event methods and assigns interrupt handlers that calls
|
|
|
|
* the acpi event methods for those pins.
|
|
|
|
*/
|
2014-07-25 14:54:48 +08:00
|
|
|
void acpi_gpiochip_request_interrupts(struct gpio_chip *chip)
|
2014-03-10 20:54:53 +08:00
|
|
|
{
|
2014-07-25 14:54:48 +08:00
|
|
|
struct acpi_gpio_chip *acpi_gpio;
|
|
|
|
acpi_handle handle;
|
|
|
|
acpi_status status;
|
|
|
|
|
|
|
|
if (!chip->dev || !chip->to_irq)
|
|
|
|
return;
|
2014-03-10 20:54:53 +08:00
|
|
|
|
2014-07-25 14:54:48 +08:00
|
|
|
handle = ACPI_HANDLE(chip->dev);
|
|
|
|
if (!handle)
|
|
|
|
return;
|
|
|
|
|
|
|
|
status = acpi_get_data(handle, acpi_gpio_chip_dh, (void **)&acpi_gpio);
|
|
|
|
if (ACPI_FAILURE(status))
|
2014-03-10 20:54:53 +08:00
|
|
|
return;
|
|
|
|
|
|
|
|
INIT_LIST_HEAD(&acpi_gpio->events);
|
|
|
|
acpi_walk_resources(ACPI_HANDLE(chip->dev), "_AEI",
|
|
|
|
acpi_gpiochip_request_interrupt, acpi_gpio);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* acpi_gpiochip_free_interrupts() - Free GPIO ACPI event interrupts.
|
2014-07-25 14:54:48 +08:00
|
|
|
* @chip: GPIO chip
|
2013-10-10 16:01:07 +08:00
|
|
|
*
|
2014-03-10 20:54:53 +08:00
|
|
|
* Free interrupts associated with GPIO ACPI event method for the given
|
|
|
|
* GPIO chip.
|
2013-10-10 16:01:07 +08:00
|
|
|
*/
|
2014-07-25 14:54:48 +08:00
|
|
|
void acpi_gpiochip_free_interrupts(struct gpio_chip *chip)
|
2013-10-10 16:01:07 +08:00
|
|
|
{
|
2014-07-25 14:54:48 +08:00
|
|
|
struct acpi_gpio_chip *acpi_gpio;
|
2014-03-10 20:54:52 +08:00
|
|
|
struct acpi_gpio_event *event, *ep;
|
2014-07-25 14:54:48 +08:00
|
|
|
acpi_handle handle;
|
|
|
|
acpi_status status;
|
|
|
|
|
|
|
|
if (!chip->dev || !chip->to_irq)
|
|
|
|
return;
|
2013-10-10 16:01:07 +08:00
|
|
|
|
2014-07-25 14:54:48 +08:00
|
|
|
handle = ACPI_HANDLE(chip->dev);
|
|
|
|
if (!handle)
|
|
|
|
return;
|
|
|
|
|
|
|
|
status = acpi_get_data(handle, acpi_gpio_chip_dh, (void **)&acpi_gpio);
|
|
|
|
if (ACPI_FAILURE(status))
|
2013-10-10 16:01:07 +08:00
|
|
|
return;
|
|
|
|
|
2014-03-10 20:54:52 +08:00
|
|
|
list_for_each_entry_safe_reverse(event, ep, &acpi_gpio->events, node) {
|
2014-03-10 20:54:53 +08:00
|
|
|
struct gpio_desc *desc;
|
|
|
|
|
|
|
|
free_irq(event->irq, event);
|
2014-08-20 01:06:08 +08:00
|
|
|
desc = event->desc;
|
2014-03-10 20:54:53 +08:00
|
|
|
if (WARN_ON(IS_ERR(desc)))
|
|
|
|
continue;
|
2014-07-22 15:17:42 +08:00
|
|
|
gpio_unlock_as_irq(chip, event->pin);
|
2014-03-10 20:54:53 +08:00
|
|
|
gpiochip_free_own_desc(desc);
|
2014-03-10 20:54:52 +08:00
|
|
|
list_del(&event->node);
|
|
|
|
kfree(event);
|
2013-10-10 16:01:07 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-04-03 18:56:54 +08:00
|
|
|
struct acpi_gpio_lookup {
|
|
|
|
struct acpi_gpio_info info;
|
|
|
|
int index;
|
2013-10-10 16:01:08 +08:00
|
|
|
struct gpio_desc *desc;
|
2013-04-03 18:56:54 +08:00
|
|
|
int n;
|
|
|
|
};
|
|
|
|
|
|
|
|
static int acpi_find_gpio(struct acpi_resource *ares, void *data)
|
|
|
|
{
|
|
|
|
struct acpi_gpio_lookup *lookup = data;
|
|
|
|
|
|
|
|
if (ares->type != ACPI_RESOURCE_TYPE_GPIO)
|
|
|
|
return 1;
|
|
|
|
|
2013-10-10 16:01:08 +08:00
|
|
|
if (lookup->n++ == lookup->index && !lookup->desc) {
|
2013-04-03 18:56:54 +08:00
|
|
|
const struct acpi_resource_gpio *agpio = &ares->data.gpio;
|
|
|
|
|
2013-10-10 16:01:08 +08:00
|
|
|
lookup->desc = acpi_get_gpiod(agpio->resource_source.string_ptr,
|
|
|
|
agpio->pin_table[0]);
|
2013-04-03 18:56:54 +08:00
|
|
|
lookup->info.gpioint =
|
|
|
|
agpio->connection_type == ACPI_RESOURCE_GPIO_TYPE_INT;
|
2013-10-10 16:01:10 +08:00
|
|
|
lookup->info.active_low =
|
|
|
|
agpio->polarity == ACPI_ACTIVE_LOW;
|
2013-04-03 18:56:54 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2013-10-10 16:01:08 +08:00
|
|
|
* acpi_get_gpiod_by_index() - get a GPIO descriptor from device resources
|
2013-04-03 18:56:54 +08:00
|
|
|
* @dev: pointer to a device to get GPIO from
|
|
|
|
* @index: index of GpioIo/GpioInt resource (starting from %0)
|
|
|
|
* @info: info pointer to fill in (optional)
|
|
|
|
*
|
|
|
|
* Function goes through ACPI resources for @dev and based on @index looks
|
2013-10-10 16:01:08 +08:00
|
|
|
* up a GpioIo/GpioInt resource, translates it to the Linux GPIO descriptor,
|
2013-04-03 18:56:54 +08:00
|
|
|
* and returns it. @index matches GpioIo/GpioInt resources only so if there
|
|
|
|
* are total %3 GPIO resources, the index goes from %0 to %2.
|
|
|
|
*
|
2013-10-10 16:01:08 +08:00
|
|
|
* If the GPIO cannot be translated or there is an error an ERR_PTR is
|
2013-04-03 18:56:54 +08:00
|
|
|
* returned.
|
|
|
|
*
|
|
|
|
* Note: if the GPIO resource has multiple entries in the pin list, this
|
|
|
|
* function only returns the first.
|
|
|
|
*/
|
2013-10-10 16:01:08 +08:00
|
|
|
struct gpio_desc *acpi_get_gpiod_by_index(struct device *dev, int index,
|
|
|
|
struct acpi_gpio_info *info)
|
2013-04-03 18:56:54 +08:00
|
|
|
{
|
|
|
|
struct acpi_gpio_lookup lookup;
|
|
|
|
struct list_head resource_list;
|
|
|
|
struct acpi_device *adev;
|
|
|
|
acpi_handle handle;
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
if (!dev)
|
2013-10-10 16:01:08 +08:00
|
|
|
return ERR_PTR(-EINVAL);
|
2013-04-03 18:56:54 +08:00
|
|
|
|
|
|
|
handle = ACPI_HANDLE(dev);
|
|
|
|
if (!handle || acpi_bus_get_device(handle, &adev))
|
2013-10-10 16:01:08 +08:00
|
|
|
return ERR_PTR(-ENODEV);
|
2013-04-03 18:56:54 +08:00
|
|
|
|
|
|
|
memset(&lookup, 0, sizeof(lookup));
|
|
|
|
lookup.index = index;
|
|
|
|
|
|
|
|
INIT_LIST_HEAD(&resource_list);
|
|
|
|
ret = acpi_dev_get_resources(adev, &resource_list, acpi_find_gpio,
|
|
|
|
&lookup);
|
|
|
|
if (ret < 0)
|
2013-10-10 16:01:08 +08:00
|
|
|
return ERR_PTR(ret);
|
2013-04-03 18:56:54 +08:00
|
|
|
|
|
|
|
acpi_dev_free_resource_list(&resource_list);
|
|
|
|
|
2013-10-10 16:01:08 +08:00
|
|
|
if (lookup.desc && info)
|
2013-04-03 18:56:54 +08:00
|
|
|
*info = lookup.info;
|
|
|
|
|
2013-12-10 18:00:27 +08:00
|
|
|
return lookup.desc ? lookup.desc : ERR_PTR(-ENOENT);
|
2013-04-03 18:56:54 +08:00
|
|
|
}
|
2014-01-08 18:40:54 +08:00
|
|
|
|
gpio / ACPI: Add support for ACPI GPIO operation regions
GPIO operation regions is a new feature introduced in ACPI 5.0
specification. This feature adds a way for platform ASL code to call back
to OS GPIO driver and toggle GPIO pins.
An example ASL code from Lenovo Miix 2 tablet with only relevant part
listed:
Device (\_SB.GPO0)
{
Name (AVBL, Zero)
Method (_REG, 2, NotSerialized)
{
If (LEqual (Arg0, 0x08))
{
// Marks the region available
Store (Arg1, AVBL)
}
}
OperationRegion (GPOP, GeneralPurposeIo, Zero, 0x0C)
Field (GPOP, ByteAcc, NoLock, Preserve)
{
Connection (
GpioIo (Exclusive, PullDefault, 0, 0, IoRestrictionOutputOnly,
"\\_SB.GPO0", 0x00, ResourceConsumer,,)
{
0x003B
}
),
SHD3, 1,
}
}
Device (SHUB)
{
Method (_PS0, 0, Serialized)
{
If (LEqual (\_SB.GPO0.AVBL, One))
{
Store (One, \_SB.GPO0.SHD3)
Sleep (0x32)
}
}
Method (_PS3, 0, Serialized)
{
If (LEqual (\_SB.GPO0.AVBL, One))
{
Store (Zero, \_SB.GPO0.SHD3)
}
}
}
How this works is that whenever _PS0 or _PS3 method is run (typically when
SHUB device is transitioned to D0 or D3 respectively), ASL code checks if
the GPIO operation region is available (\_SB.GPO0.AVBL). If it is we go and
store either 0 or 1 to \_SB.GPO0.SHD3.
Now, when ACPICA notices ACPI GPIO operation region access (the store
above) it will call acpi_gpio_adr_space_handler() that then toggles the
GPIO accordingly using standard gpiolib interfaces.
Implement the support by registering GPIO operation region handlers for all
GPIO devices that have an ACPI handle. First time the GPIO is used by the
ASL code we make sure that the GPIO stays requested until the GPIO chip
driver itself is unloaded. If we find out that the GPIO is already
requested we just toggle it according to the value got from ASL code.
Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2014-03-14 23:58:07 +08:00
|
|
|
static acpi_status
|
|
|
|
acpi_gpio_adr_space_handler(u32 function, acpi_physical_address address,
|
|
|
|
u32 bits, u64 *value, void *handler_context,
|
|
|
|
void *region_context)
|
|
|
|
{
|
|
|
|
struct acpi_gpio_chip *achip = region_context;
|
|
|
|
struct gpio_chip *chip = achip->chip;
|
|
|
|
struct acpi_resource_gpio *agpio;
|
|
|
|
struct acpi_resource *ares;
|
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>
2014-09-23 10:35:54 +08:00
|
|
|
int pin_index = (int)address;
|
gpio / ACPI: Add support for ACPI GPIO operation regions
GPIO operation regions is a new feature introduced in ACPI 5.0
specification. This feature adds a way for platform ASL code to call back
to OS GPIO driver and toggle GPIO pins.
An example ASL code from Lenovo Miix 2 tablet with only relevant part
listed:
Device (\_SB.GPO0)
{
Name (AVBL, Zero)
Method (_REG, 2, NotSerialized)
{
If (LEqual (Arg0, 0x08))
{
// Marks the region available
Store (Arg1, AVBL)
}
}
OperationRegion (GPOP, GeneralPurposeIo, Zero, 0x0C)
Field (GPOP, ByteAcc, NoLock, Preserve)
{
Connection (
GpioIo (Exclusive, PullDefault, 0, 0, IoRestrictionOutputOnly,
"\\_SB.GPO0", 0x00, ResourceConsumer,,)
{
0x003B
}
),
SHD3, 1,
}
}
Device (SHUB)
{
Method (_PS0, 0, Serialized)
{
If (LEqual (\_SB.GPO0.AVBL, One))
{
Store (One, \_SB.GPO0.SHD3)
Sleep (0x32)
}
}
Method (_PS3, 0, Serialized)
{
If (LEqual (\_SB.GPO0.AVBL, One))
{
Store (Zero, \_SB.GPO0.SHD3)
}
}
}
How this works is that whenever _PS0 or _PS3 method is run (typically when
SHUB device is transitioned to D0 or D3 respectively), ASL code checks if
the GPIO operation region is available (\_SB.GPO0.AVBL). If it is we go and
store either 0 or 1 to \_SB.GPO0.SHD3.
Now, when ACPICA notices ACPI GPIO operation region access (the store
above) it will call acpi_gpio_adr_space_handler() that then toggles the
GPIO accordingly using standard gpiolib interfaces.
Implement the support by registering GPIO operation region handlers for all
GPIO devices that have an ACPI handle. First time the GPIO is used by the
ASL code we make sure that the GPIO stays requested until the GPIO chip
driver itself is unloaded. If we find out that the GPIO is already
requested we just toggle it according to the value got from ASL code.
Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2014-03-14 23:58:07 +08:00
|
|
|
acpi_status status;
|
|
|
|
bool pull_up;
|
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>
2014-09-23 10:35:54 +08:00
|
|
|
int length;
|
gpio / ACPI: Add support for ACPI GPIO operation regions
GPIO operation regions is a new feature introduced in ACPI 5.0
specification. This feature adds a way for platform ASL code to call back
to OS GPIO driver and toggle GPIO pins.
An example ASL code from Lenovo Miix 2 tablet with only relevant part
listed:
Device (\_SB.GPO0)
{
Name (AVBL, Zero)
Method (_REG, 2, NotSerialized)
{
If (LEqual (Arg0, 0x08))
{
// Marks the region available
Store (Arg1, AVBL)
}
}
OperationRegion (GPOP, GeneralPurposeIo, Zero, 0x0C)
Field (GPOP, ByteAcc, NoLock, Preserve)
{
Connection (
GpioIo (Exclusive, PullDefault, 0, 0, IoRestrictionOutputOnly,
"\\_SB.GPO0", 0x00, ResourceConsumer,,)
{
0x003B
}
),
SHD3, 1,
}
}
Device (SHUB)
{
Method (_PS0, 0, Serialized)
{
If (LEqual (\_SB.GPO0.AVBL, One))
{
Store (One, \_SB.GPO0.SHD3)
Sleep (0x32)
}
}
Method (_PS3, 0, Serialized)
{
If (LEqual (\_SB.GPO0.AVBL, One))
{
Store (Zero, \_SB.GPO0.SHD3)
}
}
}
How this works is that whenever _PS0 or _PS3 method is run (typically when
SHUB device is transitioned to D0 or D3 respectively), ASL code checks if
the GPIO operation region is available (\_SB.GPO0.AVBL). If it is we go and
store either 0 or 1 to \_SB.GPO0.SHD3.
Now, when ACPICA notices ACPI GPIO operation region access (the store
above) it will call acpi_gpio_adr_space_handler() that then toggles the
GPIO accordingly using standard gpiolib interfaces.
Implement the support by registering GPIO operation region handlers for all
GPIO devices that have an ACPI handle. First time the GPIO is used by the
ASL code we make sure that the GPIO stays requested until the GPIO chip
driver itself is unloaded. If we find out that the GPIO is already
requested we just toggle it according to the value got from ASL code.
Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2014-03-14 23:58:07 +08:00
|
|
|
int i;
|
|
|
|
|
|
|
|
status = acpi_buffer_to_resource(achip->conn_info.connection,
|
|
|
|
achip->conn_info.length, &ares);
|
|
|
|
if (ACPI_FAILURE(status))
|
|
|
|
return status;
|
|
|
|
|
|
|
|
if (WARN_ON(ares->type != ACPI_RESOURCE_TYPE_GPIO)) {
|
|
|
|
ACPI_FREE(ares);
|
|
|
|
return AE_BAD_PARAMETER;
|
|
|
|
}
|
|
|
|
|
|
|
|
agpio = &ares->data.gpio;
|
|
|
|
pull_up = agpio->pin_config == ACPI_PIN_CONFIG_PULLUP;
|
|
|
|
|
|
|
|
if (WARN_ON(agpio->io_restriction == ACPI_IO_RESTRICT_INPUT &&
|
|
|
|
function == ACPI_WRITE)) {
|
|
|
|
ACPI_FREE(ares);
|
|
|
|
return AE_BAD_PARAMETER;
|
|
|
|
}
|
|
|
|
|
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>
2014-09-23 10:35:54 +08:00
|
|
|
length = min(agpio->pin_table_length, (u16)(pin_index + bits));
|
|
|
|
for (i = pin_index; i < length; ++i) {
|
gpio / ACPI: Add support for ACPI GPIO operation regions
GPIO operation regions is a new feature introduced in ACPI 5.0
specification. This feature adds a way for platform ASL code to call back
to OS GPIO driver and toggle GPIO pins.
An example ASL code from Lenovo Miix 2 tablet with only relevant part
listed:
Device (\_SB.GPO0)
{
Name (AVBL, Zero)
Method (_REG, 2, NotSerialized)
{
If (LEqual (Arg0, 0x08))
{
// Marks the region available
Store (Arg1, AVBL)
}
}
OperationRegion (GPOP, GeneralPurposeIo, Zero, 0x0C)
Field (GPOP, ByteAcc, NoLock, Preserve)
{
Connection (
GpioIo (Exclusive, PullDefault, 0, 0, IoRestrictionOutputOnly,
"\\_SB.GPO0", 0x00, ResourceConsumer,,)
{
0x003B
}
),
SHD3, 1,
}
}
Device (SHUB)
{
Method (_PS0, 0, Serialized)
{
If (LEqual (\_SB.GPO0.AVBL, One))
{
Store (One, \_SB.GPO0.SHD3)
Sleep (0x32)
}
}
Method (_PS3, 0, Serialized)
{
If (LEqual (\_SB.GPO0.AVBL, One))
{
Store (Zero, \_SB.GPO0.SHD3)
}
}
}
How this works is that whenever _PS0 or _PS3 method is run (typically when
SHUB device is transitioned to D0 or D3 respectively), ASL code checks if
the GPIO operation region is available (\_SB.GPO0.AVBL). If it is we go and
store either 0 or 1 to \_SB.GPO0.SHD3.
Now, when ACPICA notices ACPI GPIO operation region access (the store
above) it will call acpi_gpio_adr_space_handler() that then toggles the
GPIO accordingly using standard gpiolib interfaces.
Implement the support by registering GPIO operation region handlers for all
GPIO devices that have an ACPI handle. First time the GPIO is used by the
ASL code we make sure that the GPIO stays requested until the GPIO chip
driver itself is unloaded. If we find out that the GPIO is already
requested we just toggle it according to the value got from ASL code.
Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2014-03-14 23:58:07 +08:00
|
|
|
unsigned pin = agpio->pin_table[i];
|
|
|
|
struct acpi_gpio_connection *conn;
|
|
|
|
struct gpio_desc *desc;
|
|
|
|
bool found;
|
|
|
|
|
|
|
|
mutex_lock(&achip->conn_lock);
|
|
|
|
|
|
|
|
found = false;
|
|
|
|
list_for_each_entry(conn, &achip->conns, node) {
|
2014-08-20 01:06:08 +08:00
|
|
|
if (conn->pin == pin) {
|
gpio / ACPI: Add support for ACPI GPIO operation regions
GPIO operation regions is a new feature introduced in ACPI 5.0
specification. This feature adds a way for platform ASL code to call back
to OS GPIO driver and toggle GPIO pins.
An example ASL code from Lenovo Miix 2 tablet with only relevant part
listed:
Device (\_SB.GPO0)
{
Name (AVBL, Zero)
Method (_REG, 2, NotSerialized)
{
If (LEqual (Arg0, 0x08))
{
// Marks the region available
Store (Arg1, AVBL)
}
}
OperationRegion (GPOP, GeneralPurposeIo, Zero, 0x0C)
Field (GPOP, ByteAcc, NoLock, Preserve)
{
Connection (
GpioIo (Exclusive, PullDefault, 0, 0, IoRestrictionOutputOnly,
"\\_SB.GPO0", 0x00, ResourceConsumer,,)
{
0x003B
}
),
SHD3, 1,
}
}
Device (SHUB)
{
Method (_PS0, 0, Serialized)
{
If (LEqual (\_SB.GPO0.AVBL, One))
{
Store (One, \_SB.GPO0.SHD3)
Sleep (0x32)
}
}
Method (_PS3, 0, Serialized)
{
If (LEqual (\_SB.GPO0.AVBL, One))
{
Store (Zero, \_SB.GPO0.SHD3)
}
}
}
How this works is that whenever _PS0 or _PS3 method is run (typically when
SHUB device is transitioned to D0 or D3 respectively), ASL code checks if
the GPIO operation region is available (\_SB.GPO0.AVBL). If it is we go and
store either 0 or 1 to \_SB.GPO0.SHD3.
Now, when ACPICA notices ACPI GPIO operation region access (the store
above) it will call acpi_gpio_adr_space_handler() that then toggles the
GPIO accordingly using standard gpiolib interfaces.
Implement the support by registering GPIO operation region handlers for all
GPIO devices that have an ACPI handle. First time the GPIO is used by the
ASL code we make sure that the GPIO stays requested until the GPIO chip
driver itself is unloaded. If we find out that the GPIO is already
requested we just toggle it according to the value got from ASL code.
Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2014-03-14 23:58:07 +08:00
|
|
|
found = true;
|
2014-08-20 01:06:08 +08:00
|
|
|
desc = conn->desc;
|
gpio / ACPI: Add support for ACPI GPIO operation regions
GPIO operation regions is a new feature introduced in ACPI 5.0
specification. This feature adds a way for platform ASL code to call back
to OS GPIO driver and toggle GPIO pins.
An example ASL code from Lenovo Miix 2 tablet with only relevant part
listed:
Device (\_SB.GPO0)
{
Name (AVBL, Zero)
Method (_REG, 2, NotSerialized)
{
If (LEqual (Arg0, 0x08))
{
// Marks the region available
Store (Arg1, AVBL)
}
}
OperationRegion (GPOP, GeneralPurposeIo, Zero, 0x0C)
Field (GPOP, ByteAcc, NoLock, Preserve)
{
Connection (
GpioIo (Exclusive, PullDefault, 0, 0, IoRestrictionOutputOnly,
"\\_SB.GPO0", 0x00, ResourceConsumer,,)
{
0x003B
}
),
SHD3, 1,
}
}
Device (SHUB)
{
Method (_PS0, 0, Serialized)
{
If (LEqual (\_SB.GPO0.AVBL, One))
{
Store (One, \_SB.GPO0.SHD3)
Sleep (0x32)
}
}
Method (_PS3, 0, Serialized)
{
If (LEqual (\_SB.GPO0.AVBL, One))
{
Store (Zero, \_SB.GPO0.SHD3)
}
}
}
How this works is that whenever _PS0 or _PS3 method is run (typically when
SHUB device is transitioned to D0 or D3 respectively), ASL code checks if
the GPIO operation region is available (\_SB.GPO0.AVBL). If it is we go and
store either 0 or 1 to \_SB.GPO0.SHD3.
Now, when ACPICA notices ACPI GPIO operation region access (the store
above) it will call acpi_gpio_adr_space_handler() that then toggles the
GPIO accordingly using standard gpiolib interfaces.
Implement the support by registering GPIO operation region handlers for all
GPIO devices that have an ACPI handle. First time the GPIO is used by the
ASL code we make sure that the GPIO stays requested until the GPIO chip
driver itself is unloaded. If we find out that the GPIO is already
requested we just toggle it according to the value got from ASL code.
Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2014-03-14 23:58:07 +08:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!found) {
|
2014-08-20 01:06:09 +08:00
|
|
|
desc = gpiochip_request_own_desc(chip, pin,
|
|
|
|
"ACPI:OpRegion");
|
2014-08-20 01:06:08 +08:00
|
|
|
if (IS_ERR(desc)) {
|
gpio / ACPI: Add support for ACPI GPIO operation regions
GPIO operation regions is a new feature introduced in ACPI 5.0
specification. This feature adds a way for platform ASL code to call back
to OS GPIO driver and toggle GPIO pins.
An example ASL code from Lenovo Miix 2 tablet with only relevant part
listed:
Device (\_SB.GPO0)
{
Name (AVBL, Zero)
Method (_REG, 2, NotSerialized)
{
If (LEqual (Arg0, 0x08))
{
// Marks the region available
Store (Arg1, AVBL)
}
}
OperationRegion (GPOP, GeneralPurposeIo, Zero, 0x0C)
Field (GPOP, ByteAcc, NoLock, Preserve)
{
Connection (
GpioIo (Exclusive, PullDefault, 0, 0, IoRestrictionOutputOnly,
"\\_SB.GPO0", 0x00, ResourceConsumer,,)
{
0x003B
}
),
SHD3, 1,
}
}
Device (SHUB)
{
Method (_PS0, 0, Serialized)
{
If (LEqual (\_SB.GPO0.AVBL, One))
{
Store (One, \_SB.GPO0.SHD3)
Sleep (0x32)
}
}
Method (_PS3, 0, Serialized)
{
If (LEqual (\_SB.GPO0.AVBL, One))
{
Store (Zero, \_SB.GPO0.SHD3)
}
}
}
How this works is that whenever _PS0 or _PS3 method is run (typically when
SHUB device is transitioned to D0 or D3 respectively), ASL code checks if
the GPIO operation region is available (\_SB.GPO0.AVBL). If it is we go and
store either 0 or 1 to \_SB.GPO0.SHD3.
Now, when ACPICA notices ACPI GPIO operation region access (the store
above) it will call acpi_gpio_adr_space_handler() that then toggles the
GPIO accordingly using standard gpiolib interfaces.
Implement the support by registering GPIO operation region handlers for all
GPIO devices that have an ACPI handle. First time the GPIO is used by the
ASL code we make sure that the GPIO stays requested until the GPIO chip
driver itself is unloaded. If we find out that the GPIO is already
requested we just toggle it according to the value got from ASL code.
Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2014-03-14 23:58:07 +08:00
|
|
|
status = AE_ERROR;
|
|
|
|
mutex_unlock(&achip->conn_lock);
|
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
|
|
|
|
switch (agpio->io_restriction) {
|
|
|
|
case ACPI_IO_RESTRICT_INPUT:
|
|
|
|
gpiod_direction_input(desc);
|
|
|
|
break;
|
|
|
|
case ACPI_IO_RESTRICT_OUTPUT:
|
|
|
|
/*
|
|
|
|
* ACPI GPIO resources don't contain an
|
|
|
|
* initial value for the GPIO. Therefore we
|
|
|
|
* deduce that value from the pull field
|
|
|
|
* instead. If the pin is pulled up we
|
|
|
|
* assume default to be high, otherwise
|
|
|
|
* low.
|
|
|
|
*/
|
|
|
|
gpiod_direction_output(desc, pull_up);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
/*
|
|
|
|
* Assume that the BIOS has configured the
|
|
|
|
* direction and pull accordingly.
|
|
|
|
*/
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
conn = kzalloc(sizeof(*conn), GFP_KERNEL);
|
|
|
|
if (!conn) {
|
|
|
|
status = AE_NO_MEMORY;
|
|
|
|
gpiochip_free_own_desc(desc);
|
|
|
|
mutex_unlock(&achip->conn_lock);
|
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
|
2014-08-20 01:06:08 +08:00
|
|
|
conn->pin = pin;
|
gpio / ACPI: Add support for ACPI GPIO operation regions
GPIO operation regions is a new feature introduced in ACPI 5.0
specification. This feature adds a way for platform ASL code to call back
to OS GPIO driver and toggle GPIO pins.
An example ASL code from Lenovo Miix 2 tablet with only relevant part
listed:
Device (\_SB.GPO0)
{
Name (AVBL, Zero)
Method (_REG, 2, NotSerialized)
{
If (LEqual (Arg0, 0x08))
{
// Marks the region available
Store (Arg1, AVBL)
}
}
OperationRegion (GPOP, GeneralPurposeIo, Zero, 0x0C)
Field (GPOP, ByteAcc, NoLock, Preserve)
{
Connection (
GpioIo (Exclusive, PullDefault, 0, 0, IoRestrictionOutputOnly,
"\\_SB.GPO0", 0x00, ResourceConsumer,,)
{
0x003B
}
),
SHD3, 1,
}
}
Device (SHUB)
{
Method (_PS0, 0, Serialized)
{
If (LEqual (\_SB.GPO0.AVBL, One))
{
Store (One, \_SB.GPO0.SHD3)
Sleep (0x32)
}
}
Method (_PS3, 0, Serialized)
{
If (LEqual (\_SB.GPO0.AVBL, One))
{
Store (Zero, \_SB.GPO0.SHD3)
}
}
}
How this works is that whenever _PS0 or _PS3 method is run (typically when
SHUB device is transitioned to D0 or D3 respectively), ASL code checks if
the GPIO operation region is available (\_SB.GPO0.AVBL). If it is we go and
store either 0 or 1 to \_SB.GPO0.SHD3.
Now, when ACPICA notices ACPI GPIO operation region access (the store
above) it will call acpi_gpio_adr_space_handler() that then toggles the
GPIO accordingly using standard gpiolib interfaces.
Implement the support by registering GPIO operation region handlers for all
GPIO devices that have an ACPI handle. First time the GPIO is used by the
ASL code we make sure that the GPIO stays requested until the GPIO chip
driver itself is unloaded. If we find out that the GPIO is already
requested we just toggle it according to the value got from ASL code.
Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2014-03-14 23:58:07 +08:00
|
|
|
conn->desc = desc;
|
|
|
|
list_add_tail(&conn->node, &achip->conns);
|
|
|
|
}
|
|
|
|
|
|
|
|
mutex_unlock(&achip->conn_lock);
|
|
|
|
|
|
|
|
if (function == ACPI_WRITE)
|
2014-05-20 17:07:38 +08:00
|
|
|
gpiod_set_raw_value_cansleep(desc,
|
|
|
|
!!((1 << i) & *value));
|
gpio / ACPI: Add support for ACPI GPIO operation regions
GPIO operation regions is a new feature introduced in ACPI 5.0
specification. This feature adds a way for platform ASL code to call back
to OS GPIO driver and toggle GPIO pins.
An example ASL code from Lenovo Miix 2 tablet with only relevant part
listed:
Device (\_SB.GPO0)
{
Name (AVBL, Zero)
Method (_REG, 2, NotSerialized)
{
If (LEqual (Arg0, 0x08))
{
// Marks the region available
Store (Arg1, AVBL)
}
}
OperationRegion (GPOP, GeneralPurposeIo, Zero, 0x0C)
Field (GPOP, ByteAcc, NoLock, Preserve)
{
Connection (
GpioIo (Exclusive, PullDefault, 0, 0, IoRestrictionOutputOnly,
"\\_SB.GPO0", 0x00, ResourceConsumer,,)
{
0x003B
}
),
SHD3, 1,
}
}
Device (SHUB)
{
Method (_PS0, 0, Serialized)
{
If (LEqual (\_SB.GPO0.AVBL, One))
{
Store (One, \_SB.GPO0.SHD3)
Sleep (0x32)
}
}
Method (_PS3, 0, Serialized)
{
If (LEqual (\_SB.GPO0.AVBL, One))
{
Store (Zero, \_SB.GPO0.SHD3)
}
}
}
How this works is that whenever _PS0 or _PS3 method is run (typically when
SHUB device is transitioned to D0 or D3 respectively), ASL code checks if
the GPIO operation region is available (\_SB.GPO0.AVBL). If it is we go and
store either 0 or 1 to \_SB.GPO0.SHD3.
Now, when ACPICA notices ACPI GPIO operation region access (the store
above) it will call acpi_gpio_adr_space_handler() that then toggles the
GPIO accordingly using standard gpiolib interfaces.
Implement the support by registering GPIO operation region handlers for all
GPIO devices that have an ACPI handle. First time the GPIO is used by the
ASL code we make sure that the GPIO stays requested until the GPIO chip
driver itself is unloaded. If we find out that the GPIO is already
requested we just toggle it according to the value got from ASL code.
Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2014-03-14 23:58:07 +08:00
|
|
|
else
|
2014-05-20 17:07:38 +08:00
|
|
|
*value |= (u64)gpiod_get_raw_value_cansleep(desc) << i;
|
gpio / ACPI: Add support for ACPI GPIO operation regions
GPIO operation regions is a new feature introduced in ACPI 5.0
specification. This feature adds a way for platform ASL code to call back
to OS GPIO driver and toggle GPIO pins.
An example ASL code from Lenovo Miix 2 tablet with only relevant part
listed:
Device (\_SB.GPO0)
{
Name (AVBL, Zero)
Method (_REG, 2, NotSerialized)
{
If (LEqual (Arg0, 0x08))
{
// Marks the region available
Store (Arg1, AVBL)
}
}
OperationRegion (GPOP, GeneralPurposeIo, Zero, 0x0C)
Field (GPOP, ByteAcc, NoLock, Preserve)
{
Connection (
GpioIo (Exclusive, PullDefault, 0, 0, IoRestrictionOutputOnly,
"\\_SB.GPO0", 0x00, ResourceConsumer,,)
{
0x003B
}
),
SHD3, 1,
}
}
Device (SHUB)
{
Method (_PS0, 0, Serialized)
{
If (LEqual (\_SB.GPO0.AVBL, One))
{
Store (One, \_SB.GPO0.SHD3)
Sleep (0x32)
}
}
Method (_PS3, 0, Serialized)
{
If (LEqual (\_SB.GPO0.AVBL, One))
{
Store (Zero, \_SB.GPO0.SHD3)
}
}
}
How this works is that whenever _PS0 or _PS3 method is run (typically when
SHUB device is transitioned to D0 or D3 respectively), ASL code checks if
the GPIO operation region is available (\_SB.GPO0.AVBL). If it is we go and
store either 0 or 1 to \_SB.GPO0.SHD3.
Now, when ACPICA notices ACPI GPIO operation region access (the store
above) it will call acpi_gpio_adr_space_handler() that then toggles the
GPIO accordingly using standard gpiolib interfaces.
Implement the support by registering GPIO operation region handlers for all
GPIO devices that have an ACPI handle. First time the GPIO is used by the
ASL code we make sure that the GPIO stays requested until the GPIO chip
driver itself is unloaded. If we find out that the GPIO is already
requested we just toggle it according to the value got from ASL code.
Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2014-03-14 23:58:07 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
out:
|
|
|
|
ACPI_FREE(ares);
|
|
|
|
return status;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void acpi_gpiochip_request_regions(struct acpi_gpio_chip *achip)
|
|
|
|
{
|
|
|
|
struct gpio_chip *chip = achip->chip;
|
|
|
|
acpi_handle handle = ACPI_HANDLE(chip->dev);
|
|
|
|
acpi_status status;
|
|
|
|
|
|
|
|
INIT_LIST_HEAD(&achip->conns);
|
|
|
|
mutex_init(&achip->conn_lock);
|
|
|
|
status = acpi_install_address_space_handler(handle, ACPI_ADR_SPACE_GPIO,
|
|
|
|
acpi_gpio_adr_space_handler,
|
|
|
|
NULL, achip);
|
|
|
|
if (ACPI_FAILURE(status))
|
|
|
|
dev_err(chip->dev, "Failed to install GPIO OpRegion handler\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
static void acpi_gpiochip_free_regions(struct acpi_gpio_chip *achip)
|
|
|
|
{
|
|
|
|
struct gpio_chip *chip = achip->chip;
|
|
|
|
acpi_handle handle = ACPI_HANDLE(chip->dev);
|
|
|
|
struct acpi_gpio_connection *conn, *tmp;
|
|
|
|
acpi_status status;
|
|
|
|
|
|
|
|
status = acpi_remove_address_space_handler(handle, ACPI_ADR_SPACE_GPIO,
|
|
|
|
acpi_gpio_adr_space_handler);
|
|
|
|
if (ACPI_FAILURE(status)) {
|
|
|
|
dev_err(chip->dev, "Failed to remove GPIO OpRegion handler\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
list_for_each_entry_safe_reverse(conn, tmp, &achip->conns, node) {
|
|
|
|
gpiochip_free_own_desc(conn->desc);
|
|
|
|
list_del(&conn->node);
|
|
|
|
kfree(conn);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-01-08 18:40:54 +08:00
|
|
|
void acpi_gpiochip_add(struct gpio_chip *chip)
|
|
|
|
{
|
2014-03-10 20:54:51 +08:00
|
|
|
struct acpi_gpio_chip *acpi_gpio;
|
|
|
|
acpi_handle handle;
|
|
|
|
acpi_status status;
|
|
|
|
|
2014-03-31 20:16:49 +08:00
|
|
|
if (!chip || !chip->dev)
|
|
|
|
return;
|
|
|
|
|
2014-03-10 20:54:51 +08:00
|
|
|
handle = ACPI_HANDLE(chip->dev);
|
|
|
|
if (!handle)
|
|
|
|
return;
|
|
|
|
|
|
|
|
acpi_gpio = kzalloc(sizeof(*acpi_gpio), GFP_KERNEL);
|
|
|
|
if (!acpi_gpio) {
|
|
|
|
dev_err(chip->dev,
|
|
|
|
"Failed to allocate memory for ACPI GPIO chip\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
acpi_gpio->chip = chip;
|
|
|
|
|
|
|
|
status = acpi_attach_data(handle, acpi_gpio_chip_dh, acpi_gpio);
|
|
|
|
if (ACPI_FAILURE(status)) {
|
|
|
|
dev_err(chip->dev, "Failed to attach ACPI GPIO chip\n");
|
|
|
|
kfree(acpi_gpio);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
gpio / ACPI: Add support for ACPI GPIO operation regions
GPIO operation regions is a new feature introduced in ACPI 5.0
specification. This feature adds a way for platform ASL code to call back
to OS GPIO driver and toggle GPIO pins.
An example ASL code from Lenovo Miix 2 tablet with only relevant part
listed:
Device (\_SB.GPO0)
{
Name (AVBL, Zero)
Method (_REG, 2, NotSerialized)
{
If (LEqual (Arg0, 0x08))
{
// Marks the region available
Store (Arg1, AVBL)
}
}
OperationRegion (GPOP, GeneralPurposeIo, Zero, 0x0C)
Field (GPOP, ByteAcc, NoLock, Preserve)
{
Connection (
GpioIo (Exclusive, PullDefault, 0, 0, IoRestrictionOutputOnly,
"\\_SB.GPO0", 0x00, ResourceConsumer,,)
{
0x003B
}
),
SHD3, 1,
}
}
Device (SHUB)
{
Method (_PS0, 0, Serialized)
{
If (LEqual (\_SB.GPO0.AVBL, One))
{
Store (One, \_SB.GPO0.SHD3)
Sleep (0x32)
}
}
Method (_PS3, 0, Serialized)
{
If (LEqual (\_SB.GPO0.AVBL, One))
{
Store (Zero, \_SB.GPO0.SHD3)
}
}
}
How this works is that whenever _PS0 or _PS3 method is run (typically when
SHUB device is transitioned to D0 or D3 respectively), ASL code checks if
the GPIO operation region is available (\_SB.GPO0.AVBL). If it is we go and
store either 0 or 1 to \_SB.GPO0.SHD3.
Now, when ACPICA notices ACPI GPIO operation region access (the store
above) it will call acpi_gpio_adr_space_handler() that then toggles the
GPIO accordingly using standard gpiolib interfaces.
Implement the support by registering GPIO operation region handlers for all
GPIO devices that have an ACPI handle. First time the GPIO is used by the
ASL code we make sure that the GPIO stays requested until the GPIO chip
driver itself is unloaded. If we find out that the GPIO is already
requested we just toggle it according to the value got from ASL code.
Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2014-03-14 23:58:07 +08:00
|
|
|
acpi_gpiochip_request_regions(acpi_gpio);
|
2014-01-08 18:40:54 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void acpi_gpiochip_remove(struct gpio_chip *chip)
|
|
|
|
{
|
2014-03-10 20:54:51 +08:00
|
|
|
struct acpi_gpio_chip *acpi_gpio;
|
|
|
|
acpi_handle handle;
|
|
|
|
acpi_status status;
|
|
|
|
|
2014-03-31 20:16:49 +08:00
|
|
|
if (!chip || !chip->dev)
|
|
|
|
return;
|
|
|
|
|
2014-03-10 20:54:51 +08:00
|
|
|
handle = ACPI_HANDLE(chip->dev);
|
|
|
|
if (!handle)
|
|
|
|
return;
|
|
|
|
|
|
|
|
status = acpi_get_data(handle, acpi_gpio_chip_dh, (void **)&acpi_gpio);
|
|
|
|
if (ACPI_FAILURE(status)) {
|
|
|
|
dev_warn(chip->dev, "Failed to retrieve ACPI GPIO chip\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
gpio / ACPI: Add support for ACPI GPIO operation regions
GPIO operation regions is a new feature introduced in ACPI 5.0
specification. This feature adds a way for platform ASL code to call back
to OS GPIO driver and toggle GPIO pins.
An example ASL code from Lenovo Miix 2 tablet with only relevant part
listed:
Device (\_SB.GPO0)
{
Name (AVBL, Zero)
Method (_REG, 2, NotSerialized)
{
If (LEqual (Arg0, 0x08))
{
// Marks the region available
Store (Arg1, AVBL)
}
}
OperationRegion (GPOP, GeneralPurposeIo, Zero, 0x0C)
Field (GPOP, ByteAcc, NoLock, Preserve)
{
Connection (
GpioIo (Exclusive, PullDefault, 0, 0, IoRestrictionOutputOnly,
"\\_SB.GPO0", 0x00, ResourceConsumer,,)
{
0x003B
}
),
SHD3, 1,
}
}
Device (SHUB)
{
Method (_PS0, 0, Serialized)
{
If (LEqual (\_SB.GPO0.AVBL, One))
{
Store (One, \_SB.GPO0.SHD3)
Sleep (0x32)
}
}
Method (_PS3, 0, Serialized)
{
If (LEqual (\_SB.GPO0.AVBL, One))
{
Store (Zero, \_SB.GPO0.SHD3)
}
}
}
How this works is that whenever _PS0 or _PS3 method is run (typically when
SHUB device is transitioned to D0 or D3 respectively), ASL code checks if
the GPIO operation region is available (\_SB.GPO0.AVBL). If it is we go and
store either 0 or 1 to \_SB.GPO0.SHD3.
Now, when ACPICA notices ACPI GPIO operation region access (the store
above) it will call acpi_gpio_adr_space_handler() that then toggles the
GPIO accordingly using standard gpiolib interfaces.
Implement the support by registering GPIO operation region handlers for all
GPIO devices that have an ACPI handle. First time the GPIO is used by the
ASL code we make sure that the GPIO stays requested until the GPIO chip
driver itself is unloaded. If we find out that the GPIO is already
requested we just toggle it according to the value got from ASL code.
Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2014-03-14 23:58:07 +08:00
|
|
|
acpi_gpiochip_free_regions(acpi_gpio);
|
2014-03-10 20:54:51 +08:00
|
|
|
|
|
|
|
acpi_detach_data(handle, acpi_gpio_chip_dh);
|
|
|
|
kfree(acpi_gpio);
|
2014-01-08 18:40:54 +08:00
|
|
|
}
|