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