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.
Unified · Split
| @@ -296,6 +296,8 @@ static int stmfx_irq_init(struct i2c_client *client) · 295 unmodified lines | ||
| 296 | 296 | if (ret) |
| 297 | 297 | goto irq_exit; |
| 298 | 298 | |
| 299 | + stmfx->irq = client->irq; | |
| 300 | + | |
| 299 | 301 | return 0; |
| 300 | 302 | |
| 301 | 303 | irq_exit: |
| @@ -486,6 +488,8 @@ static int stmfx_suspend(struct device *dev) · 184 unmodified lines | ||
| 486 | 488 | if (ret) |
| 487 | 489 | return ret; |
| 488 | 490 | |
| 491 | + disable_irq(stmfx->irq); | |
| 492 | + | |
| 489 | 493 | if (stmfx->vdd) |
| 490 | 494 | return regulator_disable(stmfx->vdd); |
| 491 | 495 | |
| @@ -529,6 +533,8 @@ static int stmfx_resume(struct device *dev) · 37 unmodified lines | ||
| 529 | 533 | if (ret) |
| 530 | 534 | return ret; |
| 531 | 535 | |
| 536 | + enable_irq(stmfx->irq); | |
| 537 | + | |
| 532 | 538 | return 0; |
| 533 | 539 | } |
| 534 | 540 | #endif |
| @@ -109,6 +109,7 @@ struct stmfx { · 108 unmodified lines | ||
| 109 | 109 | struct device *dev; |
| 110 | 110 | struct regmap *map; |
| 111 | 111 | struct regulator *vdd; |
| 112 | + int irq; | |
| 112 | 113 | struct irq_domain *irq_domain; |
| 113 | 114 | struct mutex lock; /* IRQ bus lock */ |
| 114 | 115 | u8 irq_src; |