Merge branches 'acpi-pm', 'acpi-enumeration' and 'acpi-sysfs'
* acpi-pm: ACPI / PM: Enable all wakeup GPEs in suspend-to-idle ACPI / sleep: Drop acpi_suspend() which is not used * acpi-enumeration: ACPI: Add acpi_device_uid() for convenience ACPI: Update GPIO documentation to mention _DSD * acpi-sysfs: ACPI / sysfs: Treat the count field of counter_show() as unsigned
This commit is contained in:
commit
f303906d4d
5 changed files with 27 additions and 21 deletions
|
@ -254,8 +254,13 @@ GPIO support
|
||||||
~~~~~~~~~~~~
|
~~~~~~~~~~~~
|
||||||
ACPI 5 introduced two new resources to describe GPIO connections: GpioIo
|
ACPI 5 introduced two new resources to describe GPIO connections: GpioIo
|
||||||
and GpioInt. These resources are used be used to pass GPIO numbers used by
|
and GpioInt. These resources are used be used to pass GPIO numbers used by
|
||||||
the device to the driver. For example:
|
the device to the driver. ACPI 5.1 extended this with _DSD (Device
|
||||||
|
Specific Data) which made it possible to name the GPIOs among other things.
|
||||||
|
|
||||||
|
For example:
|
||||||
|
|
||||||
|
Device (DEV)
|
||||||
|
{
|
||||||
Method (_CRS, 0, NotSerialized)
|
Method (_CRS, 0, NotSerialized)
|
||||||
{
|
{
|
||||||
Name (SBUF, ResourceTemplate()
|
Name (SBUF, ResourceTemplate()
|
||||||
|
@ -285,6 +290,18 @@ the device to the driver. For example:
|
||||||
Return (SBUF)
|
Return (SBUF)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ACPI 5.1 _DSD used for naming the GPIOs
|
||||||
|
Name (_DSD, Package ()
|
||||||
|
{
|
||||||
|
ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
|
||||||
|
Package ()
|
||||||
|
{
|
||||||
|
Package () {"power-gpios", Package() {^DEV, 0, 0, 0 }},
|
||||||
|
Package () {"irq-gpios", Package() {^DEV, 1, 0, 0 }},
|
||||||
|
}
|
||||||
|
})
|
||||||
|
...
|
||||||
|
|
||||||
These GPIO numbers are controller relative and path "\\_SB.PCI0.GPI0"
|
These GPIO numbers are controller relative and path "\\_SB.PCI0.GPI0"
|
||||||
specifies the path to the controller. In order to use these GPIOs in Linux
|
specifies the path to the controller. In order to use these GPIOs in Linux
|
||||||
we need to translate them to the corresponding Linux GPIO descriptors.
|
we need to translate them to the corresponding Linux GPIO descriptors.
|
||||||
|
@ -300,11 +317,11 @@ a code like this:
|
||||||
|
|
||||||
struct gpio_desc *irq_desc, *power_desc;
|
struct gpio_desc *irq_desc, *power_desc;
|
||||||
|
|
||||||
irq_desc = gpiod_get_index(dev, NULL, 1);
|
irq_desc = gpiod_get(dev, "irq");
|
||||||
if (IS_ERR(irq_desc))
|
if (IS_ERR(irq_desc))
|
||||||
/* handle error */
|
/* handle error */
|
||||||
|
|
||||||
power_desc = gpiod_get_index(dev, NULL, 0);
|
power_desc = gpiod_get(dev, "power");
|
||||||
if (IS_ERR(power_desc))
|
if (IS_ERR(power_desc))
|
||||||
/* handle error */
|
/* handle error */
|
||||||
|
|
||||||
|
@ -313,6 +330,9 @@ a code like this:
|
||||||
There are also devm_* versions of these functions which release the
|
There are also devm_* versions of these functions which release the
|
||||||
descriptors once the device is released.
|
descriptors once the device is released.
|
||||||
|
|
||||||
|
See Documentation/acpi/gpio-properties.txt for more information about the
|
||||||
|
_DSD binding related to GPIOs.
|
||||||
|
|
||||||
MFD devices
|
MFD devices
|
||||||
~~~~~~~~~~~
|
~~~~~~~~~~~
|
||||||
The MFD devices register their children as platform devices. For the child
|
The MFD devices register their children as platform devices. For the child
|
||||||
|
|
|
@ -629,6 +629,7 @@ static int acpi_freeze_begin(void)
|
||||||
|
|
||||||
static int acpi_freeze_prepare(void)
|
static int acpi_freeze_prepare(void)
|
||||||
{
|
{
|
||||||
|
acpi_enable_wakeup_devices(ACPI_STATE_S0);
|
||||||
acpi_enable_all_wakeup_gpes();
|
acpi_enable_all_wakeup_gpes();
|
||||||
acpi_os_wait_events_complete();
|
acpi_os_wait_events_complete();
|
||||||
enable_irq_wake(acpi_gbl_FADT.sci_interrupt);
|
enable_irq_wake(acpi_gbl_FADT.sci_interrupt);
|
||||||
|
@ -637,6 +638,7 @@ static int acpi_freeze_prepare(void)
|
||||||
|
|
||||||
static void acpi_freeze_restore(void)
|
static void acpi_freeze_restore(void)
|
||||||
{
|
{
|
||||||
|
acpi_disable_wakeup_devices(ACPI_STATE_S0);
|
||||||
disable_irq_wake(acpi_gbl_FADT.sci_interrupt);
|
disable_irq_wake(acpi_gbl_FADT.sci_interrupt);
|
||||||
acpi_enable_all_runtime_gpes();
|
acpi_enable_all_runtime_gpes();
|
||||||
}
|
}
|
||||||
|
@ -806,21 +808,6 @@ static void acpi_sleep_hibernate_setup(void)
|
||||||
static inline void acpi_sleep_hibernate_setup(void) {}
|
static inline void acpi_sleep_hibernate_setup(void) {}
|
||||||
#endif /* !CONFIG_HIBERNATION */
|
#endif /* !CONFIG_HIBERNATION */
|
||||||
|
|
||||||
int acpi_suspend(u32 acpi_state)
|
|
||||||
{
|
|
||||||
suspend_state_t states[] = {
|
|
||||||
[1] = PM_SUSPEND_STANDBY,
|
|
||||||
[3] = PM_SUSPEND_MEM,
|
|
||||||
[5] = PM_SUSPEND_MAX
|
|
||||||
};
|
|
||||||
|
|
||||||
if (acpi_state < 6 && states[acpi_state])
|
|
||||||
return pm_suspend(states[acpi_state]);
|
|
||||||
if (acpi_state == 4)
|
|
||||||
return hibernate();
|
|
||||||
return -EINVAL;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void acpi_power_off_prepare(void)
|
static void acpi_power_off_prepare(void)
|
||||||
{
|
{
|
||||||
/* Prepare to power off the system */
|
/* Prepare to power off the system */
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
|
|
||||||
extern int acpi_suspend(u32 state);
|
|
||||||
|
|
||||||
extern void acpi_enable_wakeup_devices(u8 sleep_state);
|
extern void acpi_enable_wakeup_devices(u8 sleep_state);
|
||||||
extern void acpi_disable_wakeup_devices(u8 sleep_state);
|
extern void acpi_disable_wakeup_devices(u8 sleep_state);
|
||||||
|
|
||||||
|
|
|
@ -527,7 +527,7 @@ static ssize_t counter_show(struct kobject *kobj,
|
||||||
acpi_irq_not_handled;
|
acpi_irq_not_handled;
|
||||||
all_counters[num_gpes + ACPI_NUM_FIXED_EVENTS + COUNT_GPE].count =
|
all_counters[num_gpes + ACPI_NUM_FIXED_EVENTS + COUNT_GPE].count =
|
||||||
acpi_gpe_count;
|
acpi_gpe_count;
|
||||||
size = sprintf(buf, "%8d", all_counters[index].count);
|
size = sprintf(buf, "%8u", all_counters[index].count);
|
||||||
|
|
||||||
/* "gpe_all" or "sci" */
|
/* "gpe_all" or "sci" */
|
||||||
if (index >= num_gpes + ACPI_NUM_FIXED_EVENTS)
|
if (index >= num_gpes + ACPI_NUM_FIXED_EVENTS)
|
||||||
|
|
|
@ -252,6 +252,7 @@ struct acpi_device_pnp {
|
||||||
#define acpi_device_bid(d) ((d)->pnp.bus_id)
|
#define acpi_device_bid(d) ((d)->pnp.bus_id)
|
||||||
#define acpi_device_adr(d) ((d)->pnp.bus_address)
|
#define acpi_device_adr(d) ((d)->pnp.bus_address)
|
||||||
const char *acpi_device_hid(struct acpi_device *device);
|
const char *acpi_device_hid(struct acpi_device *device);
|
||||||
|
#define acpi_device_uid(d) ((d)->pnp.unique_id)
|
||||||
#define acpi_device_name(d) ((d)->pnp.device_name)
|
#define acpi_device_name(d) ((d)->pnp.device_name)
|
||||||
#define acpi_device_class(d) ((d)->pnp.device_class)
|
#define acpi_device_class(d) ((d)->pnp.device_class)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue