[PATCH 2/5] hwmon: ina2xx: make shunt resistance configurable at run-time

2014-11-25 Thread Bartosz Golaszewski
The shunt resistance can only be set via platform_data or device tree. This 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 bgolaszew

[PATCH 5/5] hwmon: ina2xx: documentation update for new sysfs attributes

2014-11-25 Thread Bartosz Golaszewski
Include the rshunt and avg sysfs attributes for ina2xx in the documentation. Signed-off-by: Bartosz Golaszewski bgolaszew...@baylibre.com --- Documentation/hwmon/ina2xx | 10 +++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Documentation/hwmon/ina2xx b/Documentation/hwmon

[PATCH 4/5] hwmon: ina2xx: change hex constants to lower-case

2014-11-25 Thread Bartosz Golaszewski
Make ina2xx uniform with the majority of the kernel code. Signed-off-by: Bartosz Golaszewski bgolaszew...@baylibre.com --- drivers/hwmon/ina2xx.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/hwmon/ina2xx.c b/drivers/hwmon/ina2xx.c index 0914a72..41a5ad3

[PATCH 0/5] hwmon: ina2xx: fixes extensions

2014-11-25 Thread Bartosz Golaszewski
This set of patches fixes an initialization issue we've experienced with the ina2xx driver and extends the sysfs interface to make the driver configurable at run-time. Bartosz Golaszewski (5): hwmon: ina2xx: bail-out from ina2xx_probe() in case of configuration errors hwmon: ina2xx: make

[PATCH 3/5] hwmon: ina2xx: allow to change the averaging rate at run-time

2014-11-25 Thread Bartosz Golaszewski
The averaging rate of ina226 is hardcoded to 16 in the driver. Make it modifiable at run-time via a new sysfs attribute. Signed-off-by: Bartosz Golaszewski bgolaszew...@baylibre.com --- drivers/hwmon/ina2xx.c | 115 + 1 file changed, 106

[PATCH 1/5] hwmon: ina2xx: bail-out from ina2xx_probe() in case of configuration errors

2014-11-25 Thread Bartosz Golaszewski
as the configuration has never been actually written to the register. Error out in case of write errors in probe and notify the user. Signed-off-by: Bartosz Golaszewski bgolaszew...@baylibre.com --- drivers/hwmon/ina2xx.c | 49 +++-- 1 file changed, 43 insertions(+), 6

Re: [PATCH 1/5] hwmon: ina2xx: bail-out from ina2xx_probe() in case of configuration errors

2014-11-25 Thread Bartosz Golaszewski
2014-11-25 16:58 GMT+01:00 Guenter Roeck li...@roeck-us.net: You are introducing those two functions with the same code just to display a different error message. That does not provide enough value to have extra functions and just increases code size. Just check the return code from

Re: [PATCH 1/5] hwmon: ina2xx: bail-out from ina2xx_probe() in case of configuration errors

2014-11-25 Thread Bartosz Golaszewski
2014-11-25 17:59 GMT+01:00 Guenter Roeck li...@roeck-us.net: The new functions _might_ make a bit more sense if you would implement the necessary calculations in the functions, but you are not doing that. Instead, in the next patch, you introduce yet another function to do the calibration

Re: [PATCH 1/5] hwmon: ina2xx: bail-out from ina2xx_probe() in case of configuration errors

2014-11-25 Thread Bartosz Golaszewski
2014-11-25 18:59 GMT+01:00 Guenter Roeck li...@roeck-us.net: It seems to me this is a problem of your architecture. That doesn't make it a generic problem. Your architecture should detect that a probe was disconnected and de-instantiate the device automatically if so, and re-instantiate it if

Re: [PATCH 1/5] hwmon: ina2xx: bail-out from ina2xx_probe() in case of configuration errors

2014-11-26 Thread Bartosz Golaszewski
2014-11-26 4:05 GMT+01:00 Guenter Roeck li...@roeck-us.net: On 11/25/2014 10:30 AM, Guenter Roeck wrote: Repeating my earlier question: Is the resistor value changed by software or by changing the probe ? Looking into the available documents, I am quite sure that the resistor is changed by

[PATCH v2 0/5] hwmon: ina2xx: fixes extensions

2014-11-27 Thread Bartosz Golaszewski
isn't integrated with the shunt. The avg_rate attribute allows to increase/decrease noise reduction. Bartosz Golaszewski (5): hwmon: ina2xx: bail-out from ina2xx_probe() in case of configuration errors hwmon: ina2xx: make shunt resistance configurable at run-time hwmon: ina2xx: allow to change

[PATCH v2 4/5] hwmon: ina2xx: change hex constants to lower-case

2014-11-27 Thread Bartosz Golaszewski
Make ina2xx uniform with the majority of the kernel code. Signed-off-by: Bartosz Golaszewski bgolaszew...@baylibre.com --- drivers/hwmon/ina2xx.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/hwmon/ina2xx.c b/drivers/hwmon/ina2xx.c index 7fdb586..5095a7a

[PATCH v2 5/5] hwmon: ina2xx: documentation update for new sysfs attributes

2014-11-27 Thread Bartosz Golaszewski
Include the rshunt and avg sysfs attributes for ina2xx in the documentation. Signed-off-by: Bartosz Golaszewski bgolaszew...@baylibre.com --- Documentation/hwmon/ina2xx | 10 +++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Documentation/hwmon/ina2xx b/Documentation/hwmon

[PATCH v2 2/5] hwmon: ina2xx: make shunt resistance configurable at run-time

2014-11-27 Thread Bartosz Golaszewski
The shunt resistance can only be set via platform_data or device tree. This 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 bgolaszew

[PATCH v2 3/5] hwmon: ina2xx: allow to change the averaging rate at run-time

2014-11-27 Thread Bartosz Golaszewski
The averaging rate of ina226 is hardcoded to 16 in the driver. Make it modifiable at run-time via a new sysfs attribute. Signed-off-by: Bartosz Golaszewski bgolaszew...@baylibre.com --- drivers/hwmon/ina2xx.c | 120 - 1 file changed, 109

[PATCH v2 1/5] hwmon: ina2xx: bail-out from ina2xx_probe() in case of configuration errors

2014-11-27 Thread Bartosz Golaszewski
as the configuration has never been actually written to the register. Error out in case of write errors in probe and notify the user. Signed-off-by: Bartosz Golaszewski bgolaszew...@baylibre.com --- drivers/hwmon/ina2xx.c | 25 +++-- 1 file changed, 19 insertions(+), 6 deletions(-) diff --git

Re: [PATCH v5 1/3] hwmon: ina2xx: make shunt resistance configurable at run-time

2014-12-11 Thread Bartosz Golaszewski
2014-12-10 19:31 GMT+01:00 Guenter Roeck li...@roeck-us.net: I don't really want it at all ;-). Seems to me all those options are broken one way or another. The only real solution would be to re-instantiate the driver if the chip was removed and re-inserted, and to provide parameters either

[PATCH v6 1/5] hwmon: ina2xx: reinitialize the chip in case it's been reset

2014-12-12 Thread Bartosz Golaszewski
if needed. Signed-off-by: Bartosz Golaszewski bgolaszew...@baylibre.com --- drivers/hwmon/ina2xx.c | 90 -- 1 file changed, 65 insertions(+), 25 deletions(-) diff --git a/drivers/hwmon/ina2xx.c b/drivers/hwmon/ina2xx.c index e01feba..4c5c9ab 100644

[PATCH v6 0/5] hwmon: ina2xx: implement chip reinitialization and add new attributes

2014-12-12 Thread Bartosz Golaszewski
, - other minor fixes and improvements, v5: https://www.mail-archive.com/linux-kernel%40vger.kernel.org/msg785734.html Bartosz Golaszewski (5): hwmon: ina2xx: reinitialize the chip in case it's been reset hwmon: ina2xx: remove a stray new line hwmon: ina2xx: don't accept shunt values greater

[PATCH v6 5/5] hwmon: ina2xx: allow to change the averaging rate at run-time

2014-12-12 Thread Bartosz Golaszewski
of an unexpected chip reset. Signed-off-by: Bartosz Golaszewski bgolaszew...@baylibre.com --- Documentation/hwmon/ina2xx | 3 ++ drivers/hwmon/ina2xx.c | 132 +++-- 2 files changed, 131 insertions(+), 4 deletions(-) diff --git a/Documentation/hwmon/ina2xx

[PATCH v6 3/5] hwmon: ina2xx: don't accept shunt values greater than the calibration factor

2014-12-12 Thread Bartosz Golaszewski
Shunt resistance values greater than the chip's calibration factor make no sense since the actual value written to the register equals: calibration factor / shunt Bail-out from ina2xx_probe() if the configured value is greater than the calibration factor. Signed-off-by: Bartosz

[PATCH v6 2/5] hwmon: ina2xx: remove a stray new line

2014-12-12 Thread Bartosz Golaszewski
Signed-off-by: Bartosz Golaszewski bgolaszew...@baylibre.com --- drivers/hwmon/ina2xx.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/hwmon/ina2xx.c b/drivers/hwmon/ina2xx.c index 4c5c9ab..24fce2a 100644 --- a/drivers/hwmon/ina2xx.c +++ b/drivers/hwmon/ina2xx.c @@ -52,7 +52,6

[PATCH v6 4/5] hwmon: ina2xx: make shunt resistance configurable at run-time

2014-12-12 Thread Bartosz Golaszewski
The shunt resistance can only be set via platform_data or device tree. This 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 bgolaszew

[PATCH v7 5/5] hwmon: ina2xx: allow to change the averaging rate at run-time

2014-12-13 Thread Bartosz Golaszewski
of an unexpected chip reset. Signed-off-by: Bartosz Golaszewski bgolaszew...@baylibre.com --- Documentation/hwmon/ina2xx | 3 ++ drivers/hwmon/ina2xx.c | 132 +++-- 2 files changed, 131 insertions(+), 4 deletions(-) diff --git a/Documentation/hwmon/ina2xx

[PATCH v7 2/5] hwmon: ina2xx: remove a stray new line

2014-12-13 Thread Bartosz Golaszewski
Signed-off-by: Bartosz Golaszewski bgolaszew...@baylibre.com --- drivers/hwmon/ina2xx.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/hwmon/ina2xx.c b/drivers/hwmon/ina2xx.c index ffbd60f..39e017b 100644 --- a/drivers/hwmon/ina2xx.c +++ b/drivers/hwmon/ina2xx.c @@ -52,7 +52,6

[PATCH v7 3/5] hwmon: ina2xx: don't accept shunt values greater than the calibration factor

2014-12-13 Thread Bartosz Golaszewski
Shunt resistance values greater than the chip's calibration factor make no sense since the actual value written to the register equals: calibration factor / shunt Bail-out from ina2xx_probe() if the configured value is greater than the calibration factor. Signed-off-by: Bartosz

[PATCH v7 0/5] hwmon: ina2xx: implement chip reinitialization and add new attributes

2014-12-13 Thread Bartosz Golaszewski
: https://www.mail-archive.com/linux-kernel%40vger.kernel.org/msg787390.html Bartosz Golaszewski (5): hwmon: ina2xx: reinitialize the chip in case it's been reset hwmon: ina2xx: remove a stray new line hwmon: ina2xx: don't accept shunt values greater than the calibration factor hwmon

[PATCH v7 1/5] hwmon: ina2xx: reinitialize the chip in case it's been reset

2014-12-13 Thread Bartosz Golaszewski
if needed. Signed-off-by: Bartosz Golaszewski bgolaszew...@baylibre.com --- drivers/hwmon/ina2xx.c | 128 +++-- 1 file changed, 91 insertions(+), 37 deletions(-) diff --git a/drivers/hwmon/ina2xx.c b/drivers/hwmon/ina2xx.c index e01feba..ffbd60f 100644

[PATCH v7 4/5] hwmon: ina2xx: make shunt resistance configurable at run-time

2014-12-13 Thread Bartosz Golaszewski
The shunt resistance can only be set via platform_data or device tree. This 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 bgolaszew

[PATCH v3 1/3] hwmon: ina2xx: make shunt resistance configurable at run-time

2014-12-03 Thread Bartosz Golaszewski
From: Bartosz Golaszewski bgolaszew...@baylibre.com The shunt resistance can only be set via platform_data or device tree. This 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

[PATCH v3 3/3] hwmon: ina2xx: documentation update for new sysfs attributes

2014-12-03 Thread Bartosz Golaszewski
Include the rshunt and avg sysfs attributes for ina2xx in the documentation. Signed-off-by: Bartosz Golaszewski bartekg...@gmail.com --- Documentation/hwmon/ina2xx | 10 +++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Documentation/hwmon/ina2xx b/Documentation/hwmon

[PATCH v3 0/3] hwmon: ina2xx: new attributes

2014-12-03 Thread Bartosz Golaszewski
against the hwmon-next branch. Bartosz Golaszewski (3): hwmon: ina2xx: make shunt resistance configurable at run-time hwmon: ina2xx: allow to change the averaging rate at run-time hwmon: ina2xx: documentation update for new sysfs attributes Documentation/hwmon/ina2xx | 10 ++- drivers/hwmon

[PATCH v3 2/3] hwmon: ina2xx: allow to change the averaging rate at run-time

2014-12-03 Thread Bartosz Golaszewski
The averaging rate of ina226 is hardcoded to 16 in the driver. Make it modifiable at run-time via a new sysfs attribute. Signed-off-by: Bartosz Golaszewski bgolaszew...@baylibre.com --- drivers/hwmon/ina2xx.c | 125 +++-- 1 file changed, 122

[PATCH v4 1/3] hwmon: ina2xx: make shunt resistance configurable at run-time

2014-12-03 Thread Bartosz Golaszewski
The shunt resistance can only be set via platform_data or device tree. This 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 bgolaszew

[PATCH v4 2/3] hwmon: ina2xx: allow to change the averaging rate at run-time

2014-12-03 Thread Bartosz Golaszewski
The averaging rate of ina226 is hardcoded to 16 in the driver. Make it modifiable at run-time via a new sysfs attribute. Signed-off-by: Bartosz Golaszewski bgolaszew...@baylibre.com --- drivers/hwmon/ina2xx.c | 125 +++-- 1 file changed, 122

[PATCH v4 3/3] hwmon: ina2xx: documentation update for new sysfs attributes

2014-12-03 Thread Bartosz Golaszewski
Include the rshunt and avg sysfs attributes for ina2xx in the documentation. Signed-off-by: Bartosz Golaszewski bgolaszew...@baylibre.com --- Documentation/hwmon/ina2xx | 10 +++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Documentation/hwmon/ina2xx b/Documentation/hwmon

[PATCH v4 0/3] hwmon: ina2xx: new attributes

2014-12-03 Thread Bartosz Golaszewski
%40vger.kernel.org/msg776942.html The following patches have been rebased against the hwmon-next branch. Bartosz Golaszewski (3): hwmon: ina2xx: make shunt resistance configurable at run-time hwmon: ina2xx: allow to change the averaging rate at run-time hwmon: ina2xx: documentation update for new sysfs

[RESEND PATCH v7 0/5] hwmon: ina2xx: implement chip reinitialization and add new attributes

2014-12-19 Thread Bartosz Golaszewski
: https://www.mail-archive.com/linux-kernel%40vger.kernel.org/msg787390.html Bartosz Golaszewski (5): hwmon: ina2xx: reinitialize the chip in case it's been reset hwmon: ina2xx: remove a stray new line hwmon: ina2xx: don't accept shunt values greater than the calibration factor hwmon

[RESEND PATCH v7 4/5] hwmon: ina2xx: make shunt resistance configurable at run-time

2014-12-19 Thread Bartosz Golaszewski
The shunt resistance can only be set via platform_data or device tree. This 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 bgolaszew

[RESEND PATCH v7 1/5] hwmon: ina2xx: reinitialize the chip in case it's been reset

2014-12-19 Thread Bartosz Golaszewski
if needed. Signed-off-by: Bartosz Golaszewski bgolaszew...@baylibre.com --- drivers/hwmon/ina2xx.c | 128 +++-- 1 file changed, 91 insertions(+), 37 deletions(-) diff --git a/drivers/hwmon/ina2xx.c b/drivers/hwmon/ina2xx.c index e01feba..ffbd60f 100644

[RESEND PATCH v7 5/5] hwmon: ina2xx: allow to change the averaging rate at run-time

2014-12-19 Thread Bartosz Golaszewski
of an unexpected chip reset. Signed-off-by: Bartosz Golaszewski bgolaszew...@baylibre.com --- Documentation/hwmon/ina2xx | 3 ++ drivers/hwmon/ina2xx.c | 132 +++-- 2 files changed, 131 insertions(+), 4 deletions(-) diff --git a/Documentation/hwmon/ina2xx

[RESEND PATCH v7 2/5] hwmon: ina2xx: remove a stray new line

2014-12-19 Thread Bartosz Golaszewski
Signed-off-by: Bartosz Golaszewski bgolaszew...@baylibre.com --- drivers/hwmon/ina2xx.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/hwmon/ina2xx.c b/drivers/hwmon/ina2xx.c index ffbd60f..39e017b 100644 --- a/drivers/hwmon/ina2xx.c +++ b/drivers/hwmon/ina2xx.c @@ -52,7 +52,6

[RESEND PATCH v7 3/5] hwmon: ina2xx: don't accept shunt values greater than the calibration factor

2014-12-19 Thread Bartosz Golaszewski
Shunt resistance values greater than the chip's calibration factor make no sense since the actual value written to the register equals: calibration factor / shunt Bail-out from ina2xx_probe() if the configured value is greater than the calibration factor. Signed-off-by: Bartosz

[PATCH 2/2] hwmon: tmp401: bail-out from tmp401_probe() in case of write errors

2014-12-04 Thread Bartosz Golaszewski
. Signed-off-by: Bartosz Golaszewski bgolaszew...@baylibre.com --- drivers/hwmon/tmp401.c | 16 ++-- 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/drivers/hwmon/tmp401.c b/drivers/hwmon/tmp401.c index 5a72d7f..75b3210 100644 --- a/drivers/hwmon/tmp401.c +++ b/drivers

[PATCH 1/2] hwmon: tmp401: add support for TI TMP435

2014-12-04 Thread Bartosz Golaszewski
From: Patrick Titiano ptiti...@baylibre.com Signed-off-by: Patrick Titiano ptiti...@baylibre.com Signed-off-by: Bartosz Golaszewski bgolaszew...@baylibre.com --- drivers/hwmon/tmp401.c | 16 ++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/drivers/hwmon/tmp401.c b

[PATCH 0/2] hwmon: tmp401: support for TMP435 and fix for a probe issue

2014-12-04 Thread Bartosz Golaszewski
This series adds support for the TI TMP435 chip and fixes an issue similar to the one we observed for ina2xx - ignoring the write errors when probing the device. Bartosz Golaszewski (1): hwmon: tmp401: bail-out from tmp401_probe() in case of write errors Patrick Titiano (1): hwmon: tmp401

Re: [PATCH 1/2] hwmon: tmp401: add support for TI TMP435

2014-12-04 Thread Bartosz Golaszewski
2014-12-04 15:19 GMT+01:00 Guenter Roeck li...@roeck-us.net: The datasheet claims otherwise (0x31, specifically). Is this based on real chip information ? Can you send me the output from i2cdump for the chip ? This is what I'm reading: # i2cdump -y 1 0x4c No size specified (using byte-data

[PATCH v2 3/3] hwmon: tmp401: bail-out from tmp401_probe() in case of write errors

2014-12-04 Thread Bartosz Golaszewski
. Signed-off-by: Bartosz Golaszewski bgolaszew...@baylibre.com --- drivers/hwmon/tmp401.c | 29 ++--- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/drivers/hwmon/tmp401.c b/drivers/hwmon/tmp401.c index a5f0973..ce7e579 100644 --- a/drivers/hwmon/tmp401.c

[PATCH v2 0/3] hwmon: tmp401: support for TMP435 and fix for a probe issue

2014-12-04 Thread Bartosz Golaszewski
/msg781930.html Bartosz Golaszewski (2): hwmon: tmp401: add TMP435 to the list of supported chips in docs and Kconfig hwmon: tmp401: bail-out from tmp401_probe() in case of write errors Patrick Titiano (1): hwmon: tmp401: add support for TI TMP435 Documentation/hwmon/tmp401 | 7

[PATCH v2 1/3] hwmon: tmp401: add support for TI TMP435

2014-12-04 Thread Bartosz Golaszewski
From: Patrick Titiano ptiti...@baylibre.com Signed-off-by: Patrick Titiano ptiti...@baylibre.com [Bartosz Golaszewski: prepared for submission, code review fixes] Signed-off-by: Bartosz Golaszewski bgolaszew...@baylibre.com --- drivers/hwmon/tmp401.c | 16 ++-- 1 file changed, 14

[PATCH v2 2/3] hwmon: tmp401: add TMP435 to the list of supported chips in docs and Kconfig

2014-12-04 Thread Bartosz Golaszewski
Signed-off-by: Bartosz Golaszewski bgolaszew...@baylibre.com --- Documentation/hwmon/tmp401 | 8 ++-- drivers/hwmon/Kconfig | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/Documentation/hwmon/tmp401 b/Documentation/hwmon/tmp401 index f91e3fa..445ff7b 100644

[PATCH v3 3/3] hwmon: tmp401: bail-out from tmp401_probe() in case of write errors

2014-12-04 Thread Bartosz Golaszewski
. Signed-off-by: Bartosz Golaszewski bgolaszew...@baylibre.com --- drivers/hwmon/tmp401.c | 24 ++-- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/drivers/hwmon/tmp401.c b/drivers/hwmon/tmp401.c index ccd9938..f2182ee 100644 --- a/drivers/hwmon/tmp401.c +++ b

[PATCH v3 1/3] hwmon: tmp401: add support for TI TMP435

2014-12-04 Thread Bartosz Golaszewski
From: Patrick Titiano ptiti...@baylibre.com Signed-off-by: Patrick Titiano ptiti...@baylibre.com [Bartosz Golaszewski: prepared for submission, code review fixes] Signed-off-by: Bartosz Golaszewski bgolaszew...@baylibre.com --- drivers/hwmon/tmp401.c | 13 +++-- 1 file changed, 11

[PATCH v3 2/3] hwmon: tmp401: add TMP435 to the list of supported chips in docs and Kconfig

2014-12-04 Thread Bartosz Golaszewski
Signed-off-by: Bartosz Golaszewski bgolaszew...@baylibre.com --- Documentation/hwmon/tmp401 | 8 ++-- drivers/hwmon/Kconfig | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/Documentation/hwmon/tmp401 b/Documentation/hwmon/tmp401 index f91e3fa..445ff7b 100644

[PATCH v3 0/3] hwmon: tmp401: support for TMP435 and fix for a probe issue

2014-12-04 Thread Bartosz Golaszewski
-121' anyway in dmesg, v1: https://www.mail-archive.com/linux-kernel%40vger.kernel.org/msg781930.html Bartosz Golaszewski (2): hwmon: tmp401: add TMP435 to the list of supported chips in docs and Kconfig hwmon: tmp401: bail-out from tmp401_probe() in case of write errors Patrick Titiano (1

[PATCH v5 0/3] hwmon: ina2xx: new attributes

2014-12-10 Thread Bartosz Golaszewski
/decrease noise reduction. v5: - avoid a division by zero in kernel if reading from an uninitialized register v4: https://www.mail-archive.com/linux-kernel%40vger.kernel.org/msg781119.html Bartosz Golaszewski (3): hwmon: ina2xx: make shunt resistance configurable at run-time hwmon: ina2xx

[PATCH v5 3/3] hwmon: ina2xx: documentation update for new sysfs attributes

2014-12-10 Thread Bartosz Golaszewski
Include the rshunt and avg sysfs attributes for ina2xx in the documentation. Signed-off-by: Bartosz Golaszewski bgolaszew...@baylibre.com --- Documentation/hwmon/ina2xx | 10 +++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Documentation/hwmon/ina2xx b/Documentation/hwmon

[PATCH v5 2/3] hwmon: ina2xx: allow to change the averaging rate at run-time

2014-12-10 Thread Bartosz Golaszewski
The averaging rate of ina226 is hardcoded to 16 in the driver. Make it modifiable at run-time via a new sysfs attribute. Signed-off-by: Bartosz Golaszewski bgolaszew...@baylibre.com --- drivers/hwmon/ina2xx.c | 125 +++-- 1 file changed, 122

[PATCH v5 1/3] hwmon: ina2xx: make shunt resistance configurable at run-time

2014-12-10 Thread Bartosz Golaszewski
The shunt resistance can only be set via platform_data or device tree. This 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 bgolaszew

Re: [PATCH v5 1/3] hwmon: ina2xx: make shunt resistance configurable at run-time

2014-12-10 Thread Bartosz Golaszewski
2014-12-10 15:20 GMT+01:00 Guenter Roeck li...@roeck-us.net: + case INA2XX_CALIBRATION: + if (data-regs[reg] == 0) + val = 0; + else + val = data-config-calibration_factor +

[PATCH v8 0/5] hwmon: ina2xx: implement chip reinitialization and add new attributes

2015-01-05 Thread Bartosz Golaszewski
the registers are going to be re-read after setting the averaging rate v7: https://www.mail-archive.com/linux-kernel%40vger.kernel.org/msg787851.html Bartosz Golaszewski (5): hwmon: ina2xx: reinitialize the chip in case it's been reset hwmon: ina2xx: remove a stray new line hwmon: ina2xx: don't

[PATCH v8 1/5] hwmon: ina2xx: reinitialize the chip in case it's been reset

2015-01-05 Thread Bartosz Golaszewski
if needed. Signed-off-by: Bartosz Golaszewski bgolaszew...@baylibre.com --- drivers/hwmon/ina2xx.c | 128 +++-- 1 file changed, 91 insertions(+), 37 deletions(-) diff --git a/drivers/hwmon/ina2xx.c b/drivers/hwmon/ina2xx.c index e01feba..ffbd60f 100644

[PATCH v8 3/5] hwmon: ina2xx: don't accept shunt values greater than the calibration factor

2015-01-05 Thread Bartosz Golaszewski
Shunt resistance values greater than the chip's calibration factor make no sense since the actual value written to the register equals: calibration factor / shunt Bail-out from ina2xx_probe() if the configured value is greater than the calibration factor. Signed-off-by: Bartosz

[PATCH v8 5/5] hwmon: ina2xx: allow to change the averaging rate at run-time

2015-01-05 Thread Bartosz Golaszewski
of an unexpected chip reset. Signed-off-by: Bartosz Golaszewski bgolaszew...@baylibre.com --- Documentation/hwmon/ina2xx | 3 ++ drivers/hwmon/ina2xx.c | 129 +++-- 2 files changed, 128 insertions(+), 4 deletions(-) diff --git a/Documentation/hwmon/ina2xx

[PATCH v8 2/5] hwmon: ina2xx: remove a stray new line

2015-01-05 Thread Bartosz Golaszewski
Signed-off-by: Bartosz Golaszewski bgolaszew...@baylibre.com --- drivers/hwmon/ina2xx.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/hwmon/ina2xx.c b/drivers/hwmon/ina2xx.c index ffbd60f..39e017b 100644 --- a/drivers/hwmon/ina2xx.c +++ b/drivers/hwmon/ina2xx.c @@ -52,7 +52,6

[PATCH v8 4/5] hwmon: ina2xx: make shunt resistance configurable at run-time

2015-01-05 Thread Bartosz Golaszewski
The shunt resistance can only be set via platform_data or device tree. This 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 bgolaszew

[PATCH 0/2] hwmon: (ina2xx) code clean-up and minor fixes

2015-01-12 Thread Bartosz Golaszewski
current hwmon-next. Bartosz Golaszewski (2): hwmon: (ina2xx) remove an unnecessary dev_get_drvdata() result check hwmon: (ina2xx) use DIV_ROUND_CLOSEST() to avoid rounding errors drivers/hwmon/ina2xx.c | 13 +++-- 1 file changed, 7 insertions(+), 6 deletions(-) -- 2.1.3

[PATCH 1/2] hwmon: (ina2xx) remove an unnecessary dev_get_drvdata() result check

2015-01-12 Thread Bartosz Golaszewski
Signed-off-by: Bartosz Golaszewski bgolaszew...@baylibre.com --- drivers/hwmon/ina2xx.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/hwmon/ina2xx.c b/drivers/hwmon/ina2xx.c index a16d6a2..ae110c5 100644 --- a/drivers/hwmon/ina2xx.c +++ b/drivers/hwmon/ina2xx.c @@ -370,9 +370,6

[PATCH 2/2] hwmon: (ina2xx) use DIV_ROUND_CLOSEST() to avoid rounding errors

2015-01-12 Thread Bartosz Golaszewski
Use DIV_ROUND_CLOSEST() when dealing with the calibration values to make the calculations less error prone. Signed-off-by: Bartosz Golaszewski bgolaszew...@baylibre.com --- drivers/hwmon/ina2xx.c | 10 +++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/hwmon

[PATCHv3] hwmon: (ina2xx) implement update_interval attribute for ina226

2015-01-09 Thread Bartosz Golaszewski
configuration settings - this way we'll be able to restore the configuration in case of an unexpected chip reset. Signed-off-by: Bartosz Golaszewski bgolaszew...@baylibre.com --- Documentation/hwmon/ina2xx | 7 ++ drivers/hwmon/ina2xx.c | 164 +++-- 2

[PATCHv2] hwmon: (ina2xx) implement update_interval attribute for ina226

2015-01-09 Thread Bartosz Golaszewski
configuration settings - this way we'll be able to restore the configuration in case of an unexpected chip reset. Signed-off-by: Bartosz Golaszewski bgolaszew...@baylibre.com --- Documentation/hwmon/ina2xx | 7 +++ drivers/hwmon/ina2xx.c | 140 ++--- 2

Re: [PATCHv2] hwmon: (ina2xx) implement update_interval attribute for ina226

2015-01-09 Thread Bartosz Golaszewski
2015-01-09 15:34 GMT+01:00 Guenter Roeck li...@roeck-us.net: Unfortunately that only applies to INA226 and not INA219, where the time is static (at least so far). Oops, I must have missed this one. I think we'll need to store the time in ina2xx_data and use the old (constant) value for

[PATCH] hwmon: ina2xx: allow to change the averaging rate at run-time

2015-01-07 Thread Bartosz Golaszewski
of an unexpected chip reset. Signed-off-by: Bartosz Golaszewski bgolaszew...@baylibre.com --- Documentation/hwmon/ina2xx | 4 ++ drivers/hwmon/ina2xx.c | 110 +++-- 2 files changed, 110 insertions(+), 4 deletions(-) diff --git a/Documentation/hwmon/ina2xx

Re: [PATCH] hwmon: (ina2xx) implement update_interval attribute for ina226

2015-01-08 Thread Bartosz Golaszewski
2015-01-08 18:05 GMT+01:00 Guenter Roeck li...@roeck-us.net: What is the purpose of multiplying the calculated average by 2 ? The comment above says: + /* + * Add bus and shunt voltage conversion times and multiple them + * by the averaging rate. Return the result in

[PATCH] hwmon: (ina2xx) implement update_interval attribute for ina226

2015-01-08 Thread Bartosz Golaszewski
configuration settings - this way we'll be able to restore the configuration in case of an unexpected chip reset. Signed-off-by: Bartosz Golaszewski bgolaszew...@baylibre.com --- Documentation/hwmon/ina2xx | 3 + drivers/hwmon/ina2xx.c | 133 +++-- 2

Re: [PATCH] hwmon: ina2xx: allow to change the averaging rate at run-time

2015-01-07 Thread Bartosz Golaszewski
2015-01-07 17:16 GMT+01:00 Guenter Roeck li...@roeck-us.net: INA219 uses the same mechanism and timing as used by INA209. This way it is easily possible to extend the driver to support the attribute for every chip. But overall this uses the existing ABI (update_interval is part of the hwmon

Re: [PATCH] hwmon: ina2xx: allow to change the averaging rate at run-time

2015-01-07 Thread Bartosz Golaszewski
2015-01-07 14:22 GMT+01:00 Guenter Roeck li...@roeck-us.net: I think I know what to do here. Can you look into the ina209 driver ? It uses update_interval and calculates the number of samples to use from it. The ina226 datasheet suggests that we can do the same, combined with the conversion

Re: [v8, 5/5] hwmon: ina2xx: allow to change the averaging rate at run-time

2015-01-07 Thread Bartosz Golaszewski
2015-01-06 19:18 GMT+01:00 Guenter Roeck li...@roeck-us.net: ina226_avg_val() calculates the average value from ina226_avg_tab and then you loop through ina226_avg_tab to find the index into ina226_avg_tab again, only to use the thus calculated index for accessing ina226_avg_tab[] once more.

[PATCH v4 0/5] new macro: find_closest()

2015-03-19 Thread Bartosz Golaszewski
collisions - use consistent statement expression syntax v3: https://lkml.org/lkml/2015/3/19/369 v2: https://lkml.org/lkml/2015/3/10/582 v1: https://lkml.org/lkml/2015/2/24/509 Bartosz Golaszewski (5): util_macros.h: add find_closest() macro documentation: update CodingStyle on local variables

[PATCH v4 4/5] hwmon: (lm85) use find_closest() in x_TO_REG() functions

2015-03-19 Thread Bartosz Golaszewski
Replace RANGE_TO_REG() and FREQ_TO_REG() implementations with calls to find_closest(). Signed-off-by: Bartosz Golaszewski bgolaszew...@baylibre.com --- drivers/hwmon/lm85.c | 26 -- 1 file changed, 8 insertions(+), 18 deletions(-) diff --git a/drivers/hwmon/lm85.c b

[PATCH v4 5/5] hwmon: (w83795) use find_closest_descending() in pwm_freq_to_reg()

2015-03-19 Thread Bartosz Golaszewski
Replace the loop iterating over pwm_freq_cksel0 with a call to find_closest_descending(). Signed-off-by: Bartosz Golaszewski bgolaszew...@baylibre.com --- drivers/hwmon/w83795.c | 8 +++- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/hwmon/w83795.c b/drivers/hwmon

[PATCH v4 1/5] util_macros.h: add find_closest() macro

2015-03-19 Thread Bartosz Golaszewski
Searching for the member of an array closest to 'x' is duplicated in several places. Add a new include - util_macros.h - and two macros that implement this algorithm for arrays sorted both in ascending and descending order. Signed-off-by: Bartosz Golaszewski bgolaszew...@baylibre.com

[PATCH v4 3/5] hwmon: (ina2xx) replace ina226_avg_bits() with find_closest()

2015-03-19 Thread Bartosz Golaszewski
Use find_closest() to locate the closest average in ina226_avg_tab. Signed-off-by: Bartosz Golaszewski bgolaszew...@baylibre.com --- drivers/hwmon/ina2xx.c | 17 +++-- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/drivers/hwmon/ina2xx.c b/drivers/hwmon/ina2xx.c index

[PATCH v4 2/5] documentation: update CodingStyle on local variables naming in macros

2015-03-19 Thread Bartosz Golaszewski
Describe proper naming convention for local variables in macros resembling functions. Signed-off-by: Bartosz Golaszewski bgolaszew...@baylibre.com --- Documentation/CodingStyle | 13 + 1 file changed, 13 insertions(+) diff --git a/Documentation/CodingStyle b/Documentation

[PATCH v3 2/4] hwmon: (ina2xx) replace ina226_avg_bits() with find_closest()

2015-03-19 Thread Bartosz Golaszewski
Use find_closest() to locate the closest average in ina226_avg_tab. Signed-off-by: Bartosz Golaszewski bgolaszew...@baylibre.com --- drivers/hwmon/ina2xx.c | 17 +++-- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/drivers/hwmon/ina2xx.c b/drivers/hwmon/ina2xx.c index

[PATCH v3 1/4] util_macros.h: add find_closest() macro

2015-03-19 Thread Bartosz Golaszewski
Searching for the member of an array closest to 'x' is duplicated in several places. Add a new include - util_macros.h - and two macros that implement this algorithm for arrays sorted both in ascending and descending order. Signed-off-by: Bartosz Golaszewski bgolaszew...@baylibre.com

[PATCH v3 0/4] new macro: find_closest()

2015-03-19 Thread Bartosz Golaszewski
() to find_closest_descending() v2: https://lkml.org/lkml/2015/3/10/582 v1: https://lkml.org/lkml/2015/2/24/509 Bartosz Golaszewski (4): util_macros.h: add find_closest() macro hwmon: (ina2xx) replace ina226_avg_bits() with find_closest() hwmon: (lm85) use find_closest() in x_TO_REG

[PATCH v3 3/4] hwmon: (lm85) use find_closest() in x_TO_REG() functions

2015-03-19 Thread Bartosz Golaszewski
Replace RANGE_TO_REG() and FREQ_TO_REG() implementations with calls to find_closest(). Signed-off-by: Bartosz Golaszewski bgolaszew...@baylibre.com --- drivers/hwmon/lm85.c | 26 -- 1 file changed, 8 insertions(+), 18 deletions(-) diff --git a/drivers/hwmon/lm85.c b

[PATCH v3 4/4] hwmon: (w83795) use find_closest_descending() in pwm_freq_to_reg()

2015-03-19 Thread Bartosz Golaszewski
Replace the loop iterating over pwm_freq_cksel0 with a call to find_closest_descending(). Signed-off-by: Bartosz Golaszewski bgolaszew...@baylibre.com --- drivers/hwmon/w83795.c | 8 +++- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/hwmon/w83795.c b/drivers/hwmon

[PATCH v2 4/4] hwmon: (w83795) use find_closest_desc() in pwm_freq_to_reg()

2015-03-10 Thread Bartosz Golaszewski
Replace the loop iterating over pwm_freq_cksel0 with a call to find_closest_desc(). Signed-off-by: Bartosz Golaszewski bgolaszew...@baylibre.com --- drivers/hwmon/w83795.c | 7 ++- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/hwmon/w83795.c b/drivers/hwmon/w83795.c

[PATCH v2 3/4] hwmon: (lm85) replace x_TO_REG() functions with find_closest()

2015-03-10 Thread Bartosz Golaszewski
Replace RANGE_TO_REG() and FREQ_TO_REG() functions with calls to find_closest(). Signed-off-by: Bartosz Golaszewski bgolaszew...@baylibre.com --- drivers/hwmon/lm85.c | 43 --- 1 file changed, 12 insertions(+), 31 deletions(-) diff --git a/drivers/hwmon

[PATCH v2 1/4] kernel.h: add find_closest() macro

2015-03-10 Thread Bartosz Golaszewski
Searching for the member of an array closest to 'x' is duplicated in several places. Add two macros that implement this algorithm for arrays sorted both in ascending and descending order. Signed-off-by: Bartosz Golaszewski bgolaszew...@baylibre.com --- include/linux/kernel.h | 23

[PATCH v2 0/4] kernel.h: find_closest() macro

2015-03-10 Thread Bartosz Golaszewski
of these macros in some hwmon drivers. v2: - fixed an off-by-one bug in patch [3/4] v1: https://lkml.org/lkml/2015/2/24/509 Bartosz Golaszewski (4): kernel.h: add find_closest() macro hwmon: (ina2xx) replace ina226_avg_bits() with find_closest() hwmon: (lm85) replace x_TO_REG() functions

[PATCH v2 2/4] hwmon: (ina2xx) replace ina226_avg_bits() with find_closest()

2015-03-10 Thread Bartosz Golaszewski
Use find_closest() to locate the closest average in ina226_avg_tab. Signed-off-by: Bartosz Golaszewski bgolaszew...@baylibre.com --- drivers/hwmon/ina2xx.c | 16 ++-- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/drivers/hwmon/ina2xx.c b/drivers/hwmon/ina2xx.c index

[RESEND PATCH 4/4] hwmon: (w83795) use find_closest_desc() in pwm_freq_to_reg()

2015-02-24 Thread Bartosz Golaszewski
Replace the loop iterating over pwm_freq_cksel0 with a call to find_closest_desc(). Signed-off-by: Bartosz Golaszewski bgolaszew...@baylibre.com --- drivers/hwmon/w83795.c | 7 ++- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/hwmon/w83795.c b/drivers/hwmon/w83795.c

[PATCH 0/4] find_closest() macro

2015-02-24 Thread Bartosz Golaszewski
of these macros in some hwmon drivers. Bartosz Golaszewski (4): kernel.h: add find_closest() macro hwmon: (ina2xx) replace ina226_avg_bits() with find_closest() hwmon: (lm85) replace XXX_TO_REG() functions with find_closest() hwmon: (w83795) use find_closest_desc() in pwm_freq_to_reg() drivers/hwmon

[PATCH 1/4] kernel.h: add find_closest() macro

2015-02-24 Thread Bartosz Golaszewski
Searching for the member of an array closest to 'x' is duplicated in several places. Add two macros that implement this algorithm for arrays sorted both in ascending and descending order. Signed-off-by: Bartosz Golaszewski bgolaszew...@baylibre.com --- include/linux/kernel.h | 23

[PATCH 2/4] hwmon: (ina2xx) replace ina226_avg_bits() with find_closest()

2015-02-24 Thread Bartosz Golaszewski
Use find_closest() to locate the closest average in ina226_avg_tab. Signed-off-by: Bartosz Golaszewski bgolaszew...@baylibre.com --- drivers/hwmon/ina2xx.c | 16 ++-- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/drivers/hwmon/ina2xx.c b/drivers/hwmon/ina2xx.c index

[PATCH 4/4] hwmon: (w83795) use find_closest_desc() in pwm_freq_to_reg()

2015-02-24 Thread Bartosz Golaszewski
Replace the loop iterating over pwm_freq_cksel0 by a call to find_closest_desc(). Signed-off-by: Bartosz Golaszewski bgolaszew...@baylibre.com --- drivers/hwmon/w83795.c | 7 ++- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/hwmon/w83795.c b/drivers/hwmon/w83795.c

[RESEND PATCH 2/4] hwmon: (ina2xx) replace ina226_avg_bits() with find_closest()

2015-02-24 Thread Bartosz Golaszewski
Use find_closest() to locate the closest average in ina226_avg_tab. Signed-off-by: Bartosz Golaszewski bgolaszew...@baylibre.com --- drivers/hwmon/ina2xx.c | 16 ++-- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/drivers/hwmon/ina2xx.c b/drivers/hwmon/ina2xx.c index

  1   2   3   4   5   6   7   8   9   10   >