hwmon: (pmbus/lm25066) Offset coefficient depends on CL
authorXo Wang <xow@google.com>
Tue, 29 Aug 2017 21:21:16 +0000 (14:21 -0700)
committerGuenter Roeck <linux@roeck-us.net>
Wed, 30 Aug 2017 13:31:12 +0000 (06:31 -0700)
When converting the DIRECT format CURRENT_IN and POWER commands, make
the offset coefficient ("b") predicate on the value of the current limit
setting.

Signed-off-by: Xo Wang <xow@google.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
drivers/hwmon/pmbus/lm25066.c

index a3d912cd3b8d7605692ce00618776516e41b01ff..232b4af13e126500fecde6165671ad5fd672c703 100644 (file)
@@ -488,16 +488,18 @@ static int lm25066_probe(struct i2c_client *client,
        info->m[PSC_VOLTAGE_OUT] = coeff[PSC_VOLTAGE_OUT].m;
        info->b[PSC_VOLTAGE_OUT] = coeff[PSC_VOLTAGE_OUT].b;
        info->R[PSC_VOLTAGE_OUT] = coeff[PSC_VOLTAGE_OUT].R;
-       info->b[PSC_CURRENT_IN] = coeff[PSC_CURRENT_IN].b;
        info->R[PSC_CURRENT_IN] = coeff[PSC_CURRENT_IN].R;
-       info->b[PSC_POWER] = coeff[PSC_POWER].b;
        info->R[PSC_POWER] = coeff[PSC_POWER].R;
        if (config & LM25066_DEV_SETUP_CL) {
                info->m[PSC_CURRENT_IN] = coeff[PSC_CURRENT_IN_L].m;
+               info->b[PSC_CURRENT_IN] = coeff[PSC_CURRENT_IN_L].b;
                info->m[PSC_POWER] = coeff[PSC_POWER_L].m;
+               info->b[PSC_POWER] = coeff[PSC_POWER_L].b;
        } else {
                info->m[PSC_CURRENT_IN] = coeff[PSC_CURRENT_IN].m;
+               info->b[PSC_CURRENT_IN] = coeff[PSC_CURRENT_IN].b;
                info->m[PSC_POWER] = coeff[PSC_POWER].m;
+               info->b[PSC_POWER] = coeff[PSC_POWER].b;
        }
 
        return pmbus_do_probe(client, id, info);