[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200311081450.GZ1922688@smile.fi.intel.com>
Date: Wed, 11 Mar 2020 10:14:50 +0200
From: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To: Tobias Schramm <t.schramm@...jaro.org>
Cc: Sebastian Reichel <sre@...nel.org>,
Rob Herring <robh+dt@...nel.org>,
Mark Rutland <mark.rutland@....com>,
Mauro Carvalho Chehab <mchehab+huawei@...nel.org>,
"David S. Miller" <davem@...emloft.net>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Jonathan Cameron <Jonathan.Cameron@...wei.com>,
linux-pm@...r.kernel.org, devicetree@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 2/2] power: supply: add CellWise cw2015 fuel gauge
driver
On Tue, Mar 10, 2020 at 07:55:42PM +0100, Tobias Schramm wrote:
> >> +static int cw_read_word(struct cw_battery *cw_bat, u8 reg, u16 *val)
> >> +{
> >> + u8 reg_val[2];
> >> + int ret;
> >> +
> >> + ret = regmap_raw_read(cw_bat->regmap, reg, reg_val, 2);
> >> + *val = (reg_val[0] << 8) + reg_val[1];
> >> + return ret;
> >> +}
> >
> > NIH BE type of readings? Can REGMAP_ENDIAN_BIG help?
>
> Not really, or can it? Registers on the cw2015 are a wild mix of single
> bytes and words. There does not seem to be a per register override for
> reg_/val_bits.
I see.
Perhaps
__be16 value;
ret = regmap(..., (...)value, sizeof(value));
if (ret)
return ret; // note, you missed this in above.
*val = be16_to_cpu(value);
return 0;
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists