]> git.baikalelectronics.ru Git - kernel.git/commit
hwmon: (ina3221) Add PM runtime support
authorNicolin Chen <nicoleotsuka@gmail.com>
Mon, 5 Nov 2018 20:48:43 +0000 (12:48 -0800)
committerGuenter Roeck <linux@roeck-us.net>
Sun, 16 Dec 2018 23:13:13 +0000 (15:13 -0800)
commite577ed5ff6d2b3de78a9490faf5b77b89bb44c67
tree64daad7cf46ae76a9089568c191b1ccb52bc2a1d
parent2ae8ce5b5b3499d1e7e955264405a40bfbe224e7
hwmon: (ina3221) Add PM runtime support

If all three channels are disabled via in[123]_enable ABI,
the driver could suspend the chip for power saving purpose.

So this patch adds the PM runtime support in order to gain
more power control than system suspend and resume use case.

For PM runtime, there are a few related changes happening:
1) Added a new pm_dev device pointer for all the PM runtime
   callbacks. This is because hwmon core registers a child
   device for each hwmon driver and passes it back to each
   driver. So there might be a mismatch between two device
   pointers in the driver if mixing using them.
2) Added a check in ina3221_is_enabled() to make sure that
   the chip is resumed.
3) Bypassed the unchanged status in ina3221_write_enable()
   in order to keep the PM runtime refcount being matched.
4) Removed the reset routine in the probe() by calling the
   resume() via pm_runtime_get_sync() instead, as they're
   similar. It's also necessary to do so to match initial
   PM refcount with the number of enabled channels.

Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
drivers/hwmon/ina3221.c