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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
,
- 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
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
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
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
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
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
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
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
:
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
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
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
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
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
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
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
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
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
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
%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
:
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
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
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
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
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
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
.
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
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
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
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
.
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
/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
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
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
.
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
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
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
-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
/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
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
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
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
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
+
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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.
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
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
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
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
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
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
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
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
() 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
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
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
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
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
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
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
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
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
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
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
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
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
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 - 100 of 5668 matches
Mail list logo