Skip to content

Commit e13fe92

Browse files
Gao PanWolfram Sang
authored andcommitted
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 <[email protected]> Reviewed-by: Vladimir Zapolskiy <[email protected]> [wsa: added missing include] Signed-off-by: Wolfram Sang <[email protected]>
1 parent 0e1929d commit e13fe92

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

drivers/i2c/busses/i2c-imx-lpi2c.c

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
#include <linux/module.h>
2929
#include <linux/of.h>
3030
#include <linux/of_device.h>
31+
#include <linux/pinctrl/consumer.h>
3132
#include <linux/platform_device.h>
3233
#include <linux/sched.h>
3334
#include <linux/slab.h>
@@ -636,12 +637,31 @@ static int lpi2c_imx_remove(struct platform_device *pdev)
636637
return 0;
637638
}
638639

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+
639658
static struct platform_driver lpi2c_imx_driver = {
640659
.probe = lpi2c_imx_probe,
641660
.remove = lpi2c_imx_remove,
642661
.driver = {
643662
.name = DRIVER_NAME,
644663
.of_match_table = lpi2c_imx_of_match,
664+
.pm = &imx_lpi2c_pm,
645665
},
646666
};
647667

0 commit comments

Comments
 (0)