The shunt resistance can only be set via platform_data or device tree. ThisAfter reading the datasheet again ... those defines were meant
isn't suitable for devices in which the shunt resistance can change/isn't
known at boot-time.
Add a sysfs attribute that allows to read and set the shunt resistance.
Signed-off-by: Bartosz Golaszewski <bgolaszewski@xxxxxxxxxxxx>
---
drivers/hwmon/ina2xx.c | 62 +++++++++++++++++++++++++++++++++++++++++++++-----
1 file changed, 56 insertions(+), 6 deletions(-)
diff --git a/drivers/hwmon/ina2xx.c b/drivers/hwmon/ina2xx.c
index 0a6b60f..341da67 100644
--- a/drivers/hwmon/ina2xx.c
+++ b/drivers/hwmon/ina2xx.c
@@ -51,6 +51,8 @@
#define INA226_ALERT_LIMIT 0x07
#define INA226_DIE_ID 0xFF
+/* shunt resistor sysfs attribute index */
+#define INA2XX_RSHUNT 0x8