Skip to content

Commit

Permalink
mfd: stmfx: Disable IRQ in suspend to avoid spurious interrupt
Browse files Browse the repository at this point in the history
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: 06252ad ("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>
  • Loading branch information
Amelie Delaunay authored and Lee Jones committed May 26, 2020
1 parent 60c2c4b commit 97eda5d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
6 changes: 6 additions & 0 deletions drivers/mfd/stmfx.c
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -529,6 +533,8 @@ static int stmfx_resume(struct device *dev)
if (ret)
return ret;

enable_irq(stmfx->irq);

return 0;
}
#endif
Expand Down
1 change: 1 addition & 0 deletions include/linux/mfd/stmfx.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 97eda5d

Please sign in to comment.