lkml.org 
[lkml]   [2019]   [Oct]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 2/3] hwmon: (pmbus) add BEL PFE3000 power supply driver
On Tue, Oct 29, 2019 at 05:50:48AM -0700, Guenter Roeck wrote:
> On Mon, Oct 28, 2019 at 04:49:03PM -0700, rentao.bupt@gmail.com wrote:
> > From: Tao Ren <rentao.bupt@gmail.com>
> >
> > Add the driver to support BEL PFE3000 which is 3000 Wat AC to DC power
>
> which is a ...
>
> Watt

My bad.. I just moved to a new machine and didn't notice import errors
printed by checkpatch.pl: it might be the reason why the error is not
detected by checkpach.pl.
Thanks for pointing it out, will fix it in v2.

> > supply. The chip has 8 pages.
>
> FWIW, that is a bit misleading here. It isn't really 8 pages. I would suggest
> to drop that comment (or, if you insist, at least add "two of which are
> reserved").

I will remove the part in patch v2.

> >
> > Signed-off-by: Tao Ren <rentao.bupt@gmail.com>
> > ---
> > drivers/hwmon/pmbus/bel-pfe.c | 65 ++++++++++++++++++++++++++++++++++-
> > 1 file changed, 64 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/hwmon/pmbus/bel-pfe.c b/drivers/hwmon/pmbus/bel-pfe.c
> > index 117f9af21bf3..7b6c90b056c9 100644
> > --- a/drivers/hwmon/pmbus/bel-pfe.c
> > +++ b/drivers/hwmon/pmbus/bel-pfe.c
> > @@ -10,9 +10,21 @@
> > #include <linux/init.h>
> > #include <linux/err.h>
> > #include <linux/i2c.h>
> > +#include <linux/pmbus.h>
> > +
> > #include "pmbus.h"
> >
> > -enum chips {pfe1100};
> > +enum chips {pfe1100, pfe3000};
> > +
> > +/*
> > + * Disable status check for pfe3000 devices, because some devices report
> > + * communication error (invalid command) for VOUT_MODE command (0x20)
> > + * although correct VOUT_MODE (0x16) is returned: it leads to incorrect
> > + * exponent in linear mode.
> > + */
> > +static struct pmbus_platform_data pfe3000_plat_data = {
> > + .flags = PMBUS_SKIP_STATUS_CHECK,
> > +};
> >
> > static struct pmbus_driver_info pfe_driver_info[] = {
> > [pfe1100] = {
> > @@ -34,6 +46,45 @@ static struct pmbus_driver_info pfe_driver_info[] = {
> > PMBUS_HAVE_STATUS_TEMP |
> > PMBUS_HAVE_FAN12,
> > },
> > +
> > + [pfe3000] = {
> > + .pages = 8,
> > + .format[PSC_VOLTAGE_IN] = linear,
> > + .format[PSC_VOLTAGE_OUT] = linear,
> > + .format[PSC_CURRENT_IN] = linear,
> > + .format[PSC_CURRENT_OUT] = linear,
> > + .format[PSC_POWER] = linear,
> > + .format[PSC_TEMPERATURE] = linear,
> > + .format[PSC_FAN] = linear,
> > +
> > + /* Page 0: V1. */
> > + .func[0] = PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT |
> > + PMBUS_HAVE_IOUT | PMBUS_HAVE_STATUS_IOUT |
> > + PMBUS_HAVE_POUT | PMBUS_HAVE_FAN12 |
> > + PMBUS_HAVE_VIN | PMBUS_HAVE_IIN |
> > + PMBUS_HAVE_PIN | PMBUS_HAVE_STATUS_INPUT |
> > + PMBUS_HAVE_TEMP | PMBUS_HAVE_TEMP2 |
> > + PMBUS_HAVE_TEMP3 | PMBUS_HAVE_STATUS_TEMP |
> > + PMBUS_HAVE_VCAP,
> > +
> > + /* Page 1: Vsb. */
> > + .func[1] = PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT |
> > + PMBUS_HAVE_IOUT | PMBUS_HAVE_STATUS_IOUT |
> > + PMBUS_HAVE_PIN | PMBUS_HAVE_STATUS_INPUT |
> > + PMBUS_HAVE_POUT,
> > +
> > + /*
> > + * Page 2: V1 Ishare.
> > + * Page 4: V1 Cathode.
> > + * Page 5: Vsb Cathode.
> > + * Page 6: V1 Sense.
> > + * Page 3 and 7 are reserved.
>
> If page 7 is reserved, and doesn't have any attributes, it doesn't really
> make sense to claim support for 8 pages above. I would suugest to make it 7.

Will set total pages to 7 in patch v2.

> > + */
> > + .func[2] = PMBUS_HAVE_VOUT,
> > + .func[4] = PMBUS_HAVE_VOUT,
> > + .func[5] = PMBUS_HAVE_VOUT,
> > + .func[6] = PMBUS_HAVE_VOUT,
> > + },
> > };
> >
> > static int pfe_pmbus_probe(struct i2c_client *client,
> > @@ -42,11 +93,23 @@ static int pfe_pmbus_probe(struct i2c_client *client,
> > int model;
> >
> > model = (int)id->driver_data;
> > +
> > + /*
> > + * PFE3000-12-069RA devices may not stay in page 0 during device
> > + * probe which leads to probe failure (read status word failed).
> > + * So let's set the device to page 0 at the beginning.
> > + */
> > + if (model == pfe3000) {
> > + client->dev.platform_data = &pfe3000_plat_data;
> > + i2c_smbus_write_byte_data(client, PMBUS_PAGE, 0);
> > + }
> > +
> > return pmbus_do_probe(client, id, &pfe_driver_info[model]);
> > }
> >
> > static const struct i2c_device_id pfe_device_id[] = {
> > {"pfe1100", pfe1100},
> > + {"pfe3000", pfe3000},
> > {}
> > };
> >

\
 
 \ /
  Last update: 2019-10-29 19:01    [W:0.043 / U:0.156 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site