|
@@ -17,7 +17,6 @@
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
*/
|
|
*/
|
|
|
|
|
|
-#include <linux/clk.h>
|
|
|
|
#include <linux/init.h>
|
|
#include <linux/init.h>
|
|
#include <linux/platform_device.h>
|
|
#include <linux/platform_device.h>
|
|
#include <linux/spinlock.h>
|
|
#include <linux/spinlock.h>
|
|
@@ -64,7 +63,7 @@ struct irqc_priv {
|
|
struct platform_device *pdev;
|
|
struct platform_device *pdev;
|
|
struct irq_chip_generic *gc;
|
|
struct irq_chip_generic *gc;
|
|
struct irq_domain *irq_domain;
|
|
struct irq_domain *irq_domain;
|
|
- struct clk *clk;
|
|
|
|
|
|
+ atomic_t wakeup_path;
|
|
};
|
|
};
|
|
|
|
|
|
static struct irqc_priv *irq_data_to_priv(struct irq_data *data)
|
|
static struct irqc_priv *irq_data_to_priv(struct irq_data *data)
|
|
@@ -111,14 +110,10 @@ static int irqc_irq_set_wake(struct irq_data *d, unsigned int on)
|
|
int hw_irq = irqd_to_hwirq(d);
|
|
int hw_irq = irqd_to_hwirq(d);
|
|
|
|
|
|
irq_set_irq_wake(p->irq[hw_irq].requested_irq, on);
|
|
irq_set_irq_wake(p->irq[hw_irq].requested_irq, on);
|
|
-
|
|
|
|
- if (!p->clk)
|
|
|
|
- return 0;
|
|
|
|
-
|
|
|
|
if (on)
|
|
if (on)
|
|
- clk_enable(p->clk);
|
|
|
|
|
|
+ atomic_inc(&p->wakeup_path);
|
|
else
|
|
else
|
|
- clk_disable(p->clk);
|
|
|
|
|
|
+ atomic_dec(&p->wakeup_path);
|
|
|
|
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
@@ -159,12 +154,6 @@ static int irqc_probe(struct platform_device *pdev)
|
|
p->pdev = pdev;
|
|
p->pdev = pdev;
|
|
platform_set_drvdata(pdev, p);
|
|
platform_set_drvdata(pdev, p);
|
|
|
|
|
|
- p->clk = devm_clk_get(&pdev->dev, NULL);
|
|
|
|
- if (IS_ERR(p->clk)) {
|
|
|
|
- dev_warn(&pdev->dev, "unable to get clock\n");
|
|
|
|
- p->clk = NULL;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
pm_runtime_enable(&pdev->dev);
|
|
pm_runtime_enable(&pdev->dev);
|
|
pm_runtime_get_sync(&pdev->dev);
|
|
pm_runtime_get_sync(&pdev->dev);
|
|
|
|
|
|
@@ -276,6 +265,18 @@ static int irqc_remove(struct platform_device *pdev)
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+static int __maybe_unused irqc_suspend(struct device *dev)
|
|
|
|
+{
|
|
|
|
+ struct irqc_priv *p = dev_get_drvdata(dev);
|
|
|
|
+
|
|
|
|
+ if (atomic_read(&p->wakeup_path))
|
|
|
|
+ device_set_wakeup_path(dev);
|
|
|
|
+
|
|
|
|
+ return 0;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+static SIMPLE_DEV_PM_OPS(irqc_pm_ops, irqc_suspend, NULL);
|
|
|
|
+
|
|
static const struct of_device_id irqc_dt_ids[] = {
|
|
static const struct of_device_id irqc_dt_ids[] = {
|
|
{ .compatible = "renesas,irqc", },
|
|
{ .compatible = "renesas,irqc", },
|
|
{},
|
|
{},
|
|
@@ -288,6 +289,7 @@ static struct platform_driver irqc_device_driver = {
|
|
.driver = {
|
|
.driver = {
|
|
.name = "renesas_irqc",
|
|
.name = "renesas_irqc",
|
|
.of_match_table = irqc_dt_ids,
|
|
.of_match_table = irqc_dt_ids,
|
|
|
|
+ .pm = &irqc_pm_ops,
|
|
}
|
|
}
|
|
};
|
|
};
|
|
|
|
|