#include <linux/jiffies.h>
 #include <linux/completion.h>
 #include <linux/of.h>
+#include <linux/pm_wakeirq.h>
 #include <linux/property.h>
 #include <linux/regulator/consumer.h>
 #include <asm/unaligned.h>
        u16                     fw_page_size;
        u32                     fw_signature_address;
 
-       bool                    irq_wake;
-
        u8                      min_baseline;
        u8                      max_baseline;
        bool                    baseline_ready;
        if (!dev->of_node)
                device_init_wakeup(dev, true);
 
+       /*
+        * The wake IRQ should be declared via device tree instead of assuming
+        * the IRQ can wake the system. This is here for legacy reasons and
+        * will be removed once the i2c-core supports querying ACPI for wake
+        * capabilities.
+        */
+       if (!dev->power.wakeirq)
+               dev_pm_set_wake_irq(dev, client->irq);
+
        return 0;
 }
 
 
        if (device_may_wakeup(dev)) {
                ret = elan_sleep(data);
-               /* Enable wake from IRQ */
-               data->irq_wake = (enable_irq_wake(client->irq) == 0);
        } else {
                ret = elan_set_power(data, false);
                if (ret)
                        dev_err(dev, "error %d enabling regulator\n", error);
                        goto err;
                }
-       } else if (data->irq_wake) {
-               disable_irq_wake(client->irq);
-               data->irq_wake = false;
        }
 
        error = elan_set_power(data, true);