* [PATCH 0/2] Add hwmon support for TI LM5066I hotswap controller @ 2017-08-29 21:21 Xo Wang 2017-08-29 21:21 ` [PATCH 1/2] hwmon: (pmbus/lm25066) Offset coefficient depends on CL Xo Wang 2017-08-29 21:21 ` [PATCH 2/2] hwmon: (pmbus/lm25066) Add support for TI LM5066I Xo Wang 0 siblings, 2 replies; 5+ messages in thread From: Xo Wang @ 2017-08-29 21:21 UTC (permalink / raw) To: jdelvare, linux, corbet Cc: Xo Wang, linux-hwmon, linux-doc, linux-kernel, openbmc Tested with hardware on Aspeed AST2500 connected to LM5066I on a custom board. Xo Wang (2): hwmon: (pmbus/lm25066) Offset coefficient depends on CL hwmon: (pmbus/lm25066) Add support for TI LM5066I Documentation/hwmon/lm25066 | 9 +++++++-- drivers/hwmon/pmbus/lm25066.c | 47 +++++++++++++++++++++++++++++++++++++++---- 2 files changed, 50 insertions(+), 6 deletions(-) -- 2.14.1.342.g6490525c54-goog ^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/2] hwmon: (pmbus/lm25066) Offset coefficient depends on CL 2017-08-29 21:21 [PATCH 0/2] Add hwmon support for TI LM5066I hotswap controller Xo Wang @ 2017-08-29 21:21 ` Xo Wang 2017-08-30 2:02 ` [1/2] " Guenter Roeck 2017-08-29 21:21 ` [PATCH 2/2] hwmon: (pmbus/lm25066) Add support for TI LM5066I Xo Wang 1 sibling, 1 reply; 5+ messages in thread From: Xo Wang @ 2017-08-29 21:21 UTC (permalink / raw) To: jdelvare, linux, corbet Cc: Xo Wang, linux-hwmon, linux-doc, linux-kernel, openbmc 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> --- drivers/hwmon/pmbus/lm25066.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/hwmon/pmbus/lm25066.c b/drivers/hwmon/pmbus/lm25066.c index a3d912cd3b8d..232b4af13e12 100644 --- a/drivers/hwmon/pmbus/lm25066.c +++ b/drivers/hwmon/pmbus/lm25066.c @@ -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); -- 2.14.1.342.g6490525c54-goog ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [1/2] hwmon: (pmbus/lm25066) Offset coefficient depends on CL 2017-08-29 21:21 ` [PATCH 1/2] hwmon: (pmbus/lm25066) Offset coefficient depends on CL Xo Wang @ 2017-08-30 2:02 ` Guenter Roeck 0 siblings, 0 replies; 5+ messages in thread From: Guenter Roeck @ 2017-08-30 2:02 UTC (permalink / raw) To: Xo Wang; +Cc: jdelvare, corbet, linux-hwmon, linux-doc, linux-kernel, openbmc On Tue, Aug 29, 2017 at 02:21:16PM -0700, Xo Wang wrote: > 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> Applied to hwmon-next. Thanks, Guenter > --- > drivers/hwmon/pmbus/lm25066.c | 6 ++++-- > 1 file changed, 4 insertions(+), 2 deletions(-) > > diff --git a/drivers/hwmon/pmbus/lm25066.c b/drivers/hwmon/pmbus/lm25066.c > index a3d912cd3b8d..232b4af13e12 100644 > --- a/drivers/hwmon/pmbus/lm25066.c > +++ b/drivers/hwmon/pmbus/lm25066.c > @@ -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); ^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 2/2] hwmon: (pmbus/lm25066) Add support for TI LM5066I 2017-08-29 21:21 [PATCH 0/2] Add hwmon support for TI LM5066I hotswap controller Xo Wang 2017-08-29 21:21 ` [PATCH 1/2] hwmon: (pmbus/lm25066) Offset coefficient depends on CL Xo Wang @ 2017-08-29 21:21 ` Xo Wang 2017-08-30 2:03 ` [2/2] " Guenter Roeck 1 sibling, 1 reply; 5+ messages in thread From: Xo Wang @ 2017-08-29 21:21 UTC (permalink / raw) To: jdelvare, linux, corbet Cc: Xo Wang, linux-hwmon, linux-doc, linux-kernel, openbmc The TI LM5066I hotswap controller is a more accurate version of the LM5066 device already supported. It has different measurement conversion coefficients than the LM5066, so it needs to be recognized as a different device. Signed-off-by: Xo Wang <xow@google.com> --- Documentation/hwmon/lm25066 | 9 +++++++-- drivers/hwmon/pmbus/lm25066.c | 41 +++++++++++++++++++++++++++++++++++++++-- 2 files changed, 46 insertions(+), 4 deletions(-) diff --git a/Documentation/hwmon/lm25066 b/Documentation/hwmon/lm25066 index 2cb20ebb234d..3fa6bf820c88 100644 --- a/Documentation/hwmon/lm25066 +++ b/Documentation/hwmon/lm25066 @@ -29,6 +29,11 @@ Supported chips: Addresses scanned: - Datasheet: http://www.national.com/pf/LM/LM5066.html + * Texas Instruments LM5066I + Prefix: 'lm5066i' + Addresses scanned: - + Datasheet: + http://www.ti.com/product/LM5066I Author: Guenter Roeck <linux@roeck-us.net> @@ -37,8 +42,8 @@ Description ----------- This driver supports hardware monitoring for National Semiconductor / TI LM25056, -LM25063, LM25066, LM5064, and LM5066 Power Management, Monitoring, Control, and -Protection ICs. +LM25063, LM25066, LM5064, and LM5066/LM5066I Power Management, Monitoring, +Control, and Protection ICs. The driver is a client driver to the core PMBus driver. Please see Documentation/hwmon/pmbus for details on PMBus client drivers. diff --git a/drivers/hwmon/pmbus/lm25066.c b/drivers/hwmon/pmbus/lm25066.c index 232b4af13e12..10d17fb8f283 100644 --- a/drivers/hwmon/pmbus/lm25066.c +++ b/drivers/hwmon/pmbus/lm25066.c @@ -28,7 +28,7 @@ #include <linux/i2c.h> #include "pmbus.h" -enum chips { lm25056, lm25063, lm25066, lm5064, lm5066 }; +enum chips { lm25056, lm25063, lm25066, lm5064, lm5066, lm5066i }; #define LM25066_READ_VAUX 0xd0 #define LM25066_MFR_READ_IIN 0xd1 @@ -65,7 +65,7 @@ struct __coeff { #define PSC_CURRENT_IN_L (PSC_NUM_CLASSES) #define PSC_POWER_L (PSC_NUM_CLASSES + 1) -static struct __coeff lm25066_coeff[5][PSC_NUM_CLASSES + 2] = { +static struct __coeff lm25066_coeff[6][PSC_NUM_CLASSES + 2] = { [lm25056] = { [PSC_VOLTAGE_IN] = { .m = 16296, @@ -210,6 +210,41 @@ static struct __coeff lm25066_coeff[5][PSC_NUM_CLASSES + 2] = { .m = 16, }, }, + [lm5066i] = { + [PSC_VOLTAGE_IN] = { + .m = 4617, + .b = -140, + .R = -2, + }, + [PSC_VOLTAGE_OUT] = { + .m = 4602, + .b = 500, + .R = -2, + }, + [PSC_CURRENT_IN] = { + .m = 15076, + .b = -504, + .R = -2, + }, + [PSC_CURRENT_IN_L] = { + .m = 7645, + .b = 100, + .R = -2, + }, + [PSC_POWER] = { + .m = 1701, + .b = -4000, + .R = -3, + }, + [PSC_POWER_L] = { + .m = 861, + .b = -965, + .R = -3, + }, + [PSC_TEMPERATURE] = { + .m = 16, + }, + }, }; struct lm25066_data { @@ -250,6 +285,7 @@ static int lm25066_read_word_data(struct i2c_client *client, int page, int reg) ret = DIV_ROUND_CLOSEST(ret * 70, 453); break; case lm5066: + case lm5066i: /* VIN: 2.18 mV VAUX: 725 uV LSB */ ret = DIV_ROUND_CLOSEST(ret * 725, 2180); break; @@ -511,6 +547,7 @@ static const struct i2c_device_id lm25066_id[] = { {"lm25066", lm25066}, {"lm5064", lm5064}, {"lm5066", lm5066}, + {"lm5066i", lm5066i}, { } }; -- 2.14.1.342.g6490525c54-goog ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [2/2] hwmon: (pmbus/lm25066) Add support for TI LM5066I 2017-08-29 21:21 ` [PATCH 2/2] hwmon: (pmbus/lm25066) Add support for TI LM5066I Xo Wang @ 2017-08-30 2:03 ` Guenter Roeck 0 siblings, 0 replies; 5+ messages in thread From: Guenter Roeck @ 2017-08-30 2:03 UTC (permalink / raw) To: Xo Wang; +Cc: jdelvare, corbet, linux-hwmon, linux-doc, linux-kernel, openbmc On Tue, Aug 29, 2017 at 02:21:17PM -0700, Xo Wang wrote: > The TI LM5066I hotswap controller is a more accurate version of the > LM5066 device already supported. It has different measurement conversion > coefficients than the LM5066, so it needs to be recognized as a > different device. > > Signed-off-by: Xo Wang <xow@google.com> Applied to hwmon-next. Thanks, Guenter > --- > Documentation/hwmon/lm25066 | 9 +++++++-- > drivers/hwmon/pmbus/lm25066.c | 41 +++++++++++++++++++++++++++++++++++++++-- > 2 files changed, 46 insertions(+), 4 deletions(-) > > diff --git a/Documentation/hwmon/lm25066 b/Documentation/hwmon/lm25066 > index 2cb20ebb234d..3fa6bf820c88 100644 > --- a/Documentation/hwmon/lm25066 > +++ b/Documentation/hwmon/lm25066 > @@ -29,6 +29,11 @@ Supported chips: > Addresses scanned: - > Datasheet: > http://www.national.com/pf/LM/LM5066.html > + * Texas Instruments LM5066I > + Prefix: 'lm5066i' > + Addresses scanned: - > + Datasheet: > + http://www.ti.com/product/LM5066I > > Author: Guenter Roeck <linux@roeck-us.net> > > @@ -37,8 +42,8 @@ Description > ----------- > > This driver supports hardware monitoring for National Semiconductor / TI LM25056, > -LM25063, LM25066, LM5064, and LM5066 Power Management, Monitoring, Control, and > -Protection ICs. > +LM25063, LM25066, LM5064, and LM5066/LM5066I Power Management, Monitoring, > +Control, and Protection ICs. > > The driver is a client driver to the core PMBus driver. Please see > Documentation/hwmon/pmbus for details on PMBus client drivers. > diff --git a/drivers/hwmon/pmbus/lm25066.c b/drivers/hwmon/pmbus/lm25066.c > index 232b4af13e12..10d17fb8f283 100644 > --- a/drivers/hwmon/pmbus/lm25066.c > +++ b/drivers/hwmon/pmbus/lm25066.c > @@ -28,7 +28,7 @@ > #include <linux/i2c.h> > #include "pmbus.h" > > -enum chips { lm25056, lm25063, lm25066, lm5064, lm5066 }; > +enum chips { lm25056, lm25063, lm25066, lm5064, lm5066, lm5066i }; > > #define LM25066_READ_VAUX 0xd0 > #define LM25066_MFR_READ_IIN 0xd1 > @@ -65,7 +65,7 @@ struct __coeff { > #define PSC_CURRENT_IN_L (PSC_NUM_CLASSES) > #define PSC_POWER_L (PSC_NUM_CLASSES + 1) > > -static struct __coeff lm25066_coeff[5][PSC_NUM_CLASSES + 2] = { > +static struct __coeff lm25066_coeff[6][PSC_NUM_CLASSES + 2] = { > [lm25056] = { > [PSC_VOLTAGE_IN] = { > .m = 16296, > @@ -210,6 +210,41 @@ static struct __coeff lm25066_coeff[5][PSC_NUM_CLASSES + 2] = { > .m = 16, > }, > }, > + [lm5066i] = { > + [PSC_VOLTAGE_IN] = { > + .m = 4617, > + .b = -140, > + .R = -2, > + }, > + [PSC_VOLTAGE_OUT] = { > + .m = 4602, > + .b = 500, > + .R = -2, > + }, > + [PSC_CURRENT_IN] = { > + .m = 15076, > + .b = -504, > + .R = -2, > + }, > + [PSC_CURRENT_IN_L] = { > + .m = 7645, > + .b = 100, > + .R = -2, > + }, > + [PSC_POWER] = { > + .m = 1701, > + .b = -4000, > + .R = -3, > + }, > + [PSC_POWER_L] = { > + .m = 861, > + .b = -965, > + .R = -3, > + }, > + [PSC_TEMPERATURE] = { > + .m = 16, > + }, > + }, > }; > > struct lm25066_data { > @@ -250,6 +285,7 @@ static int lm25066_read_word_data(struct i2c_client *client, int page, int reg) > ret = DIV_ROUND_CLOSEST(ret * 70, 453); > break; > case lm5066: > + case lm5066i: > /* VIN: 2.18 mV VAUX: 725 uV LSB */ > ret = DIV_ROUND_CLOSEST(ret * 725, 2180); > break; > @@ -511,6 +547,7 @@ static const struct i2c_device_id lm25066_id[] = { > {"lm25066", lm25066}, > {"lm5064", lm5064}, > {"lm5066", lm5066}, > + {"lm5066i", lm5066i}, > { } > }; > ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2017-08-30 2:03 UTC | newest] Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2017-08-29 21:21 [PATCH 0/2] Add hwmon support for TI LM5066I hotswap controller Xo Wang 2017-08-29 21:21 ` [PATCH 1/2] hwmon: (pmbus/lm25066) Offset coefficient depends on CL Xo Wang 2017-08-30 2:02 ` [1/2] " Guenter Roeck 2017-08-29 21:21 ` [PATCH 2/2] hwmon: (pmbus/lm25066) Add support for TI LM5066I Xo Wang 2017-08-30 2:03 ` [2/2] " Guenter Roeck
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®