]> git.baikalelectronics.ru Git - kernel.git/commit
hwmon: (adc128d818) Fix advanced configuration register init
authorRoy van Doormaal <roy.van.doormaal@prodrive-technologies.com>
Tue, 28 Jul 2020 15:18:45 +0000 (17:18 +0200)
committerGuenter Roeck <linux@roeck-us.net>
Tue, 4 Aug 2020 21:28:03 +0000 (14:28 -0700)
commit6c7aae611a32218a89f8b9aef2c0234faf679d03
treec33318eda7d8f8d417ea38785c2a720283fe96fc
parentd0c6f2f4d00d82a0036dd85324fa37c20dfb7790
hwmon: (adc128d818) Fix advanced configuration register init

If the operation mode is non-zero and an external reference voltage is set,
first the operation mode is written to the advanced configuration register,
followed by the externel reference enable bit,
resetting the configuration mode to 0.

To fix this, first compose the value of the advanced configuration register
based on the configuration mode and the external reference voltage.
The advanced configuration register is then written to the device,
if it is different from the default register value (0x0).

Signed-off-by: Roy van Doormaal <roy.van.doormaal@prodrive-technologies.com>
Link: https://lore.kernel.org/r/20200728151846.231785-1-roy.van.doormaal@prodrive-technologies.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
drivers/hwmon/adc128d818.c