On Sat, May 09, 2020 at 06:35:41PM +0300, Dmitry Osipenko wrote: > > 2. Could you please explain why I2C driver has to care about restoring > > the pinmux state? Why pinctrl driver isn't doing that for I2C and > > everything else? > > Although, now I see what you meant in the commit's message. > > Perhaps the "their I2C controllers may have lost the pinmux state in > hardware" paragraph should be removed from the commit's message because > it's irrelevant to this patch. The pinctrl state is changed once > tegra_i2c_runtime_resume() is invoked and it is not about the change > made by this patch. The pinctrl state is changed in tegra_i2c_runtime_resume() *only if* tegra_i2c_runtime_resume() has previously been called. So this patch does indeed cause the pinmux to be restored, even though it does so indirectly. I think that paragraph is necessary to explain that. It's the pinctrl that doesn't "notice" that the actual pinctrl state has changed from "I2C" to "idle", so on resume it still thinks we're at "I2C" and won't try to reapply the same state. Calling tegra_i2c_runtime_suspend() is making sure that pinctrl explicitly switches to "idle", so that during resume it will apply the "I2C" state since it is different from "idle". Thierry
Attachment:
signature.asc
Description: PGP signature