]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/commitdiff
mfd: stmfx: Disable IRQ in suspend to avoid spurious interrupt
authorAmelie Delaunay <amelie.delaunay@st.com>
Wed, 22 Apr 2020 09:08:33 +0000 (11:08 +0200)
committerKhalid Elmously <khalid.elmously@canonical.com>
Sat, 8 Aug 2020 05:53:12 +0000 (01:53 -0400)
BugLink: https://bugs.launchpad.net/bugs/1885322
[ Upstream commit 97eda5dcc2cde5dcc778bef7a9344db3b6bf8ef5 ]

When STMFX supply is stopped, spurious interrupt can occur. To avoid that,
disable the interrupt in suspend before disabling the regulator and
re-enable it at the end of resume.

Fixes: 06252ade9156 ("mfd: Add ST Multi-Function eXpander (STMFX) core driver")
Signed-off-by: Amelie Delaunay <amelie.delaunay@st.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Kelsey Skunberg <kelsey.skunberg@canonical.com>
drivers/mfd/stmfx.c
include/linux/mfd/stmfx.h

index 1977fe95f876c51b5beb1676d144aa26c8348335..711979afd90a0638e900a5c4d97fe853a07ac86c 100644 (file)
@@ -296,6 +296,8 @@ static int stmfx_irq_init(struct i2c_client *client)
        if (ret)
                goto irq_exit;
 
+       stmfx->irq = client->irq;
+
        return 0;
 
 irq_exit:
@@ -486,6 +488,8 @@ static int stmfx_suspend(struct device *dev)
        if (ret)
                return ret;
 
+       disable_irq(stmfx->irq);
+
        if (stmfx->vdd)
                return regulator_disable(stmfx->vdd);
 
@@ -529,6 +533,8 @@ static int stmfx_resume(struct device *dev)
        if (ret)
                return ret;
 
+       enable_irq(stmfx->irq);
+
        return 0;
 }
 #endif
index 3c67983678ec7e32f0fca3dcddc028aa2dc7083c..744dce63946e069f90f8efb2c8f190ba0c36a58e 100644 (file)
@@ -109,6 +109,7 @@ struct stmfx {
        struct device *dev;
        struct regmap *map;
        struct regulator *vdd;
+       int irq;
        struct irq_domain *irq_domain;
        struct mutex lock; /* IRQ bus lock */
        u8 irq_src;