Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

i2c: tegra: Fix runtime resume to re-init VI I2C

VI I2C is on host1x bus and is part of VE power domain.

During suspend/resume VE power domain goes through power off/on.

So, controller reset followed by i2c re-initialization is required
after the domain power up.

This patch fixes it.

Reviewed-by: Dmitry Osipenko <digetx@gmail.com>
Signed-off-by: Sowjanya Komatineni <skomatineni@nvidia.com>
Signed-off-by: Wolfram Sang <wsa@kernel.org>

authored by

Sowjanya Komatineni and committed by
Wolfram Sang
0d722620 42aa38b5

+16
+16
drivers/i2c/busses/i2c-tegra.c
··· 293 293 bool is_curr_atomic_xfer; 294 294 }; 295 295 296 + static int tegra_i2c_init(struct tegra_i2c_dev *i2c_dev, bool clk_reinit); 297 + 296 298 static void dvc_writel(struct tegra_i2c_dev *i2c_dev, u32 val, 297 299 unsigned long reg) 298 300 { ··· 677 675 goto disable_slow_clk; 678 676 } 679 677 678 + /* 679 + * VI I2C device is attached to VE power domain which goes through 680 + * power ON/OFF during PM runtime resume/suspend. So, controller 681 + * should go through reset and need to re-initialize after power 682 + * domain ON. 683 + */ 684 + if (i2c_dev->is_vi) { 685 + ret = tegra_i2c_init(i2c_dev, true); 686 + if (ret) 687 + goto disable_div_clk; 688 + } 689 + 680 690 return 0; 681 691 692 + disable_div_clk: 693 + clk_disable(i2c_dev->div_clk); 682 694 disable_slow_clk: 683 695 clk_disable(i2c_dev->slow_clk); 684 696 disable_fast_clk: