Messages in this thread | | | Date | Wed, 11 Mar 2020 10:14:50 +0200 | From | Andy Shevchenko <> | 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
| |