]> Git Repo - linux.git/blobdiff - drivers/acpi/resource.c
Merge branches 'acpi-apei', 'acpi-wakeup', 'acpi-reboot' and 'acpi-thermal'
[linux.git] / drivers / acpi / resource.c
index 510cdec375c4d88e9bced03c7a2b3d55f91dd895..6f9489edfb4ee5446d3b2ccc4ac0ba5e5c8f1dbf 100644 (file)
@@ -336,8 +336,9 @@ EXPORT_SYMBOL_GPL(acpi_dev_resource_ext_address_space);
  * @triggering: Triggering type as provided by ACPI.
  * @polarity: Interrupt polarity as provided by ACPI.
  * @shareable: Whether or not the interrupt is shareable.
+ * @wake_capable: Wake capability as provided by ACPI.
  */
-unsigned long acpi_dev_irq_flags(u8 triggering, u8 polarity, u8 shareable)
+unsigned long acpi_dev_irq_flags(u8 triggering, u8 polarity, u8 shareable, u8 wake_capable)
 {
        unsigned long flags;
 
@@ -351,6 +352,9 @@ unsigned long acpi_dev_irq_flags(u8 triggering, u8 polarity, u8 shareable)
        if (shareable == ACPI_SHARED)
                flags |= IORESOURCE_IRQ_SHAREABLE;
 
+       if (wake_capable == ACPI_WAKE_CAPABLE)
+               flags |= IORESOURCE_IRQ_WAKECAPABLE;
+
        return flags | IORESOURCE_IRQ;
 }
 EXPORT_SYMBOL_GPL(acpi_dev_irq_flags);
@@ -399,6 +403,31 @@ static const struct dmi_system_id medion_laptop[] = {
        { }
 };
 
+static const struct dmi_system_id asus_laptop[] = {
+       {
+               .ident = "Asus Vivobook K3402ZA",
+               .matches = {
+                       DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
+                       DMI_MATCH(DMI_BOARD_NAME, "K3402ZA"),
+               },
+       },
+       {
+               .ident = "Asus Vivobook K3502ZA",
+               .matches = {
+                       DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
+                       DMI_MATCH(DMI_BOARD_NAME, "K3502ZA"),
+               },
+       },
+       {
+               .ident = "Asus Vivobook S5402ZA",
+               .matches = {
+                       DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
+                       DMI_MATCH(DMI_BOARD_NAME, "S5402ZA"),
+               },
+       },
+       { }
+};
+
 struct irq_override_cmp {
        const struct dmi_system_id *system;
        unsigned char irq;
@@ -409,6 +438,7 @@ struct irq_override_cmp {
 
 static const struct irq_override_cmp skip_override_table[] = {
        { medion_laptop, 1, ACPI_LEVEL_SENSITIVE, ACPI_ACTIVE_LOW, 0 },
+       { asus_laptop, 1, ACPI_LEVEL_SENSITIVE, ACPI_ACTIVE_LOW, 0 },
 };
 
 static bool acpi_dev_irq_override(u32 gsi, u8 triggering, u8 polarity,
@@ -442,7 +472,7 @@ static bool acpi_dev_irq_override(u32 gsi, u8 triggering, u8 polarity,
 
 static void acpi_dev_get_irqresource(struct resource *res, u32 gsi,
                                     u8 triggering, u8 polarity, u8 shareable,
-                                    bool check_override)
+                                    u8 wake_capable, bool check_override)
 {
        int irq, p, t;
 
@@ -475,7 +505,7 @@ static void acpi_dev_get_irqresource(struct resource *res, u32 gsi,
                }
        }
 
-       res->flags = acpi_dev_irq_flags(triggering, polarity, shareable);
+       res->flags = acpi_dev_irq_flags(triggering, polarity, shareable, wake_capable);
        irq = acpi_register_gsi(NULL, gsi, triggering, polarity);
        if (irq >= 0) {
                res->start = irq;
@@ -523,7 +553,8 @@ bool acpi_dev_resource_interrupt(struct acpi_resource *ares, int index,
                }
                acpi_dev_get_irqresource(res, irq->interrupts[index],
                                         irq->triggering, irq->polarity,
-                                        irq->shareable, true);
+                                        irq->shareable, irq->wake_capable,
+                                        true);
                break;
        case ACPI_RESOURCE_TYPE_EXTENDED_IRQ:
                ext_irq = &ares->data.extended_irq;
@@ -534,7 +565,8 @@ bool acpi_dev_resource_interrupt(struct acpi_resource *ares, int index,
                if (is_gsi(ext_irq))
                        acpi_dev_get_irqresource(res, ext_irq->interrupts[index],
                                         ext_irq->triggering, ext_irq->polarity,
-                                        ext_irq->shareable, false);
+                                        ext_irq->shareable, ext_irq->wake_capable,
+                                        false);
                else
                        irqresource_disabled(res, 0);
                break;
@@ -690,6 +722,9 @@ static int is_memory(struct acpi_resource *ares, void *not_used)
 
        memset(&win, 0, sizeof(win));
 
+       if (acpi_dev_filter_resource_type(ares, IORESOURCE_MEM))
+               return 1;
+
        return !(acpi_dev_resource_memory(ares, res)
               || acpi_dev_resource_address_space(ares, &win)
               || acpi_dev_resource_ext_address_space(ares, &win));
@@ -718,6 +753,23 @@ int acpi_dev_get_dma_resources(struct acpi_device *adev, struct list_head *list)
 }
 EXPORT_SYMBOL_GPL(acpi_dev_get_dma_resources);
 
+/**
+ * acpi_dev_get_memory_resources - Get current memory resources of a device.
+ * @adev: ACPI device node to get the resources for.
+ * @list: Head of the resultant list of resources (must be empty).
+ *
+ * This is a helper function that locates all memory type resources of @adev
+ * with acpi_dev_get_resources().
+ *
+ * The number of resources in the output list is returned on success, an error
+ * code reflecting the error condition is returned otherwise.
+ */
+int acpi_dev_get_memory_resources(struct acpi_device *adev, struct list_head *list)
+{
+       return acpi_dev_get_resources(adev, list, is_memory, NULL);
+}
+EXPORT_SYMBOL_GPL(acpi_dev_get_memory_resources);
+
 /**
  * acpi_dev_filter_resource_type - Filter ACPI resource according to resource
  *                                types
This page took 0.0375760000000001 seconds and 4 git commands to generate.