i2c: nvidia-gpu: Handle timeout correctly in gpu_i2c_check_status()
authorKai-Heng Feng <kai.heng.feng@canonical.com>
Tue, 24 Mar 2020 15:28:11 +0000 (23:28 +0800)
committerWolfram Sang <wsa@the-dreams.de>
Tue, 24 Mar 2020 21:40:55 +0000 (22:40 +0100)
commitd944b27df121e2ee854a6c2fad13d6c6300792d4
tree0af8ad5ef21263aad1df5db0c60c19a8bd70f5c2
parent692b65c84f0bb0ca70c11e62c865cbaf7e8e3afd
i2c: nvidia-gpu: Handle timeout correctly in gpu_i2c_check_status()

Nvidia card may come with a "phantom" UCSI device, and its driver gets
stuck in probe routine, prevents any system PM operations like suspend.

There's an unaccounted case that the target time can equal to jiffies in
gpu_i2c_check_status(), let's solve that by using readl_poll_timeout()
instead of jiffies comparison functions.

Fixes: c71bcdcb42a7 ("i2c: add i2c bus driver for NVIDIA GPU")
Suggested-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Ajay Gupta <ajayg@nvidia.com>
Tested-by: Ajay Gupta <ajayg@nvidia.com>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
drivers/i2c/busses/i2c-nvidia-gpu.c