diff options
| author | Gao Pan <pandy.gao@nxp.com> | 2017-01-17 05:20:55 -0500 |
|---|---|---|
| committer | Wolfram Sang <wsa@the-dreams.de> | 2017-01-25 18:24:23 -0500 |
| commit | e13fe92bb58cf9b8f709ec18267ffc9e6ffeb016 (patch) | |
| tree | d00317f9c6b34ff514194db72df2bb2c722670b7 | |
| parent | 0e1929dedea36781e25902118c93edd8d8f09af1 (diff) | |
i2c: imx-lpi2c: add VLLS mode support
When system enters VLLS mode, module power is turned off. As a result,
all registers are reset to HW default value. After exiting VLLS mode,
registers are still in default mode. As a result, the pinctrl settings
are incorrect, which will affect the module function.
The patch recovers the pinctrl setting when exit VLLS mode.
Signed-off-by: Gao Pan <pandy.gao@nxp.com>
Reviewed-by: Vladimir Zapolskiy <vz@mleia.com>
[wsa: added missing include]
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| -rw-r--r-- | drivers/i2c/busses/i2c-imx-lpi2c.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/drivers/i2c/busses/i2c-imx-lpi2c.c b/drivers/i2c/busses/i2c-imx-lpi2c.c index c62b7cd475f8..3310f2e0dbd3 100644 --- a/drivers/i2c/busses/i2c-imx-lpi2c.c +++ b/drivers/i2c/busses/i2c-imx-lpi2c.c | |||
| @@ -28,6 +28,7 @@ | |||
| 28 | #include <linux/module.h> | 28 | #include <linux/module.h> |
| 29 | #include <linux/of.h> | 29 | #include <linux/of.h> |
| 30 | #include <linux/of_device.h> | 30 | #include <linux/of_device.h> |
| 31 | #include <linux/pinctrl/consumer.h> | ||
| 31 | #include <linux/platform_device.h> | 32 | #include <linux/platform_device.h> |
| 32 | #include <linux/sched.h> | 33 | #include <linux/sched.h> |
| 33 | #include <linux/slab.h> | 34 | #include <linux/slab.h> |
| @@ -636,12 +637,31 @@ static int lpi2c_imx_remove(struct platform_device *pdev) | |||
| 636 | return 0; | 637 | return 0; |
| 637 | } | 638 | } |
| 638 | 639 | ||
| 640 | #ifdef CONFIG_PM_SLEEP | ||
| 641 | static int lpi2c_imx_suspend(struct device *dev) | ||
| 642 | { | ||
| 643 | pinctrl_pm_select_sleep_state(dev); | ||
| 644 | |||
| 645 | return 0; | ||
| 646 | } | ||
| 647 | |||
| 648 | static int lpi2c_imx_resume(struct device *dev) | ||
| 649 | { | ||
| 650 | pinctrl_pm_select_default_state(dev); | ||
| 651 | |||
| 652 | return 0; | ||
| 653 | } | ||
| 654 | #endif | ||
| 655 | |||
| 656 | static SIMPLE_DEV_PM_OPS(imx_lpi2c_pm, lpi2c_imx_suspend, lpi2c_imx_resume); | ||
| 657 | |||
| 639 | static struct platform_driver lpi2c_imx_driver = { | 658 | static struct platform_driver lpi2c_imx_driver = { |
| 640 | .probe = lpi2c_imx_probe, | 659 | .probe = lpi2c_imx_probe, |
| 641 | .remove = lpi2c_imx_remove, | 660 | .remove = lpi2c_imx_remove, |
| 642 | .driver = { | 661 | .driver = { |
| 643 | .name = DRIVER_NAME, | 662 | .name = DRIVER_NAME, |
| 644 | .of_match_table = lpi2c_imx_of_match, | 663 | .of_match_table = lpi2c_imx_of_match, |
| 664 | .pm = &imx_lpi2c_pm, | ||
| 645 | }, | 665 | }, |
| 646 | }; | 666 | }; |
| 647 | 667 | ||
