Skip to contentSkip to conversation

Fix swapped coeffs for LM5066 and LM5066i iin

PATCH In review Matt Wilbur 2 participants 4 messages Jan 28, 2019 – Feb 1, 2019 Hardware monitoring

lore
Share & tools
lore
#0 lore raw

cover Fix swapped coeffs for LM5066 and LM5066i iin

For the LM5066,

For CL=GND, 50 mV threshold && DEVICE_SETUP[4] == 0 For CL=VDD, 26 mV threshold && DEVICE_SETUP[4] == 1

(from Section 8.3.1 and Table 31 of current datasheet)

And from Table 43 (I have reversed the rows of the datasheet to stay consistent with your ordering):

CL = GND: m = 5405, b =-600, R - 2
CL = VDD: m = 10753, b = -1200, R = -2

Combining the two statements:
DEVICE_SETUP[4] == 0: m = 5405, b =-600, R - 2 DEVICE_SETUP[4] == 1: m = 10753, b = -1200, R = -2

According to current code (again reversing the order to be consistent with the above):

DEVICE_SETUP[4] == 0: use coeff[PSC_CURRENT_IN] DEVICE_SETUP[4] == 1: use coeff[PSC_CURRENT_IN_L]

And for the lm5066 coefficient:

        [PSC_CURRENT_IN] = {
            .m = 10753,
            .R = -2,
        },
        [PSC_CURRENT_IN_L] = {
            .m = 5405,
            .R = -2,
        },

Again, combing the two:

DEVICE_SETUP[4] == 0: m = 10753, b = 0, R = -2 DEVICE_SETUP[4] == 1: m = 5405, b = 0, R = -2

which which is the opposite of the device datasheet (which I copy and paste here):

DEVICE_SETUP[4] == 0: m = 5405, b =-600, R - 2 DEVICE_SETUP[4] == 1: m = 10753, b = -1200, R = -2

Matt Wilbur (1):
Fix swapped coeffs for LM5066 and LM5066i iin

 drivers/hwmon/pmbus/lm25066.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
Signature · 1 line
2.17.1
#1 lore raw

PATCH 1/1 Fix swapped coeffs for LM5066 and LM5066i iin

---
 drivers/hwmon/pmbus/lm25066.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/hwmon/pmbus/lm25066.c +6 -6
index 53db78753a0d..9d917b5f0a81 100644
@@ -156,11 +156,11 @@ static struct __coeff lm25066_coeff[6][PSC_NUM_CLASSES + 2] = {
 			.R = -2,
 		},
 		[PSC_CURRENT_IN] = {
-			.m = 10753,
+			.m = 5405,
 			.R = -2,
 		},
 		[PSC_CURRENT_IN_L] = {
-			.m = 5405,
+			.m = 10753,
 			.R = -2,
 		},
 		[PSC_POWER] = {
@@ -197,13 +197,13 @@ static struct __coeff lm25066_coeff[6][PSC_NUM_CLASSES + 2] = {
 			.R = -2,
 		},
 		[PSC_POWER] = {
-			.m = 1701,
-			.b = -4000,
+			.m = 861,
+			.b = -965,
 			.R = -3,
 		},
 		[PSC_POWER_L] = {
-			.m = 861,
-			.b = -965,
+			.m = 1701,
+			.b = -4000,
 			.R = -3,
 		},
 		[PSC_TEMPERATURE] = {
Signature · 1 line
2.17.1
maintainer
#2 lore raw

Hi,

Quoted 1 line · Matt Wilbur

---

Unfortunately, your patch is not signed, and I can not apply it. Also, the explanation should be part of this patch. Please also note the expected subject line, which should start with "hwmon: (pmbus/lm25066)".

On top of that, while the subject claims to also address LM5066i, it does not really do that.

Guenter

Quoted 42 lines
 drivers/hwmon/pmbus/lm25066.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/hwmon/pmbus/lm25066.c +6 -6
index 53db78753a0d..9d917b5f0a81 100644
@@ -156,11 +156,11 @@ static struct __coeff lm25066_coeff[6][PSC_NUM_CLASSES + 2] = {
 			.R = -2,
 		},
 		[PSC_CURRENT_IN] = {
-			.m = 10753,
+			.m = 5405,
 			.R = -2,
 		},
 		[PSC_CURRENT_IN_L] = {
-			.m = 5405,
+			.m = 10753,
 			.R = -2,
 		},
 		[PSC_POWER] = {
@@ -197,13 +197,13 @@ static struct __coeff lm25066_coeff[6][PSC_NUM_CLASSES + 2] = {
 			.R = -2,
 		},
 		[PSC_POWER] = {
-			.m = 1701,
-			.b = -4000,
+			.m = 861,
+			.b = -965,
 			.R = -3,
 		},
 		[PSC_POWER_L] = {
-			.m = 861,
-			.b = -965,
+			.m = 1701,
+			.b = -4000,
 			.R = -3,
 		},
 		[PSC_TEMPERATURE] = {
Signature · 1 line
2.17.1
#3 lore raw
Quoted 6 lines · Guenter Roeck

Hi,

Quoted 1 line · Matt Wilbur

---

Quoted 7 lines

Unfortunately, your patch is not signed, and I can not apply it. Also, the explanation should be part of this patch. Please also note the expected subject line, which should start with "hwmon: (pmbus/lm25066)".

On top of that, while the subject claims to also address LM5066i, it does not really do that.

I will give it another shot - but I did switch the coefficients for the LM5066i current measurement.

Since this was my first attempt at submitting a patch, I wanted to work through the process.
I also need to swap power coefficients and add the b coefficient for the LM5066 and LM5066i.

Matt

Quoted 45 lines

Guenter

Quoted 42 lines
 drivers/hwmon/pmbus/lm25066.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/hwmon/pmbus/lm25066.c +6 -7
index 53db78753a0d..9d917b5f0a81 100644
@@ -156,11 +156,11 @@ static struct __coeff lm25066_coeff[6][PSC_NUM_CLASSES + 2] = {
                      .R = -2,
              },
              [PSC_CURRENT_IN] = {
-                     .m = 10753,
+                     .m = 5405,
                      .R = -2,
              },
              [PSC_CURRENT_IN_L] = {
-                     .m = 5405,
+                     .m = 10753,
                      .R = -2,
              },
              [PSC_POWER] = {
@@ -197,13 +197,13 @@ static struct __coeff lm25066_coeff[6][PSC_NUM_CLASSES + 2] = {
                      .R = -2,
              },
              [PSC_POWER] = {
-                     .m = 1701,
-                     .b = -4000,
+                     .m = 861,
+                     .b = -965,
                      .R = -3,
              },
              [PSC_POWER_L] = {
-                     .m = 861,
-                     .b = -965,
+                     .m = 1701,
+                     .b = -4000,
                      .R = -3,
              },
              [PSC_TEMPERATURE] = {
--

2.17.1